Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.
TypeScript accessibilityalternativecloudflarecloudflare-workersdesignfreefrontendopen-sourceradix-uireactremixweb-developmentwebflowwebsite-builderwebsite-developmentwebsiteswebstudio
update names for both comboicon and numeric-gesture-control
Sultancafb14ddd942
diff --git a/apps/designer/app/designer/features/style-panel/shared/configs.ts b/apps/designer/app/designer/features/style-panel/shared/configs.tsindex 3750e0cb33..531d7b9071 100644--- a/apps/designer/app/designer/features/style-panel/shared/configs.ts+++ b/apps/designer/app/designer/features/style-panel/shared/configs.ts@@ -18,7 +18,7 @@ export type Control =| "Spacing"| "Combobox"| "Color"- | "Comboicon"+ | "IconButtonWithMenu"| "Select"| "Empty";@@ -54,7 +54,7 @@ const getControl = (property: StyleProperty): Control => {case "justifyItems":case "justifyContent":case "alignContent": {- return "Comboicon";+ return "IconButtonWithMenu";}case "placeContent": {return "Empty";diff --git a/apps/designer/app/designer/features/style-panel/style-section.tsx b/apps/designer/app/designer/features/style-panel/style-section.tsxindex d2c3d895c5..45d2ae1550 100644--- a/apps/designer/app/designer/features/style-panel/style-section.tsx+++ b/apps/designer/app/designer/features/style-panel/style-section.tsx@@ -12,12 +12,12 @@ import {Button,Collapsible,Combobox,- Comboicon,+ IconButtonWithMenu,Select,IconButton,TextField,Tooltip,- // numericGestureControl,+ // numericScrubControl,} from "@webstudio-is/design-system";import { TriangleRightIcon, TriangleDownIcon } from "@webstudio-is/icons";import * as icons from "@webstudio-is/icons";@@ -199,7 +199,7 @@ const ComboboxControl = ({// const refCallback = useCallback((node: HTMLElement) => {// let disconnectedCallback = () => {};// if (node) {- // disconnectedCallback = numericGestureControl(node, {+ // disconnectedCallback = numericScrubControl(node, {// minValue: 0,// initialValue: parseFloat(String(value?.value)) || 0,// onValueChange: (event) => {@@ -369,7 +369,7 @@ const SelectControl = ({);};-const ComboiconControl = ({+const IconButtonWithMenuControl = ({currentStyle,inheritedStyle,setProperty,@@ -402,7 +402,7 @@ const ComboiconControl = ({}return (- <Comboicon+ <IconButtonWithMenulabel={styleConfig.label}items={styleConfig.items}value={String(currentValue)}@@ -433,7 +433,7 @@ const ComboiconControl = ({},}),}}- ></Comboicon>+ ></IconButtonWithMenu>);};@@ -671,7 +671,7 @@ export const renderCategory = ({const css = {alignItems: "center",gap: "8px",- "& > [data-type=comboicon]": {+ "& > [data-type=iconbuttonwithmenu]": {display: "flex",justifyContent: "center",alignItems: "center",@@ -775,6 +775,6 @@ const controls: {Color: ColorControl,Spacing: SpacingControl,Combobox: ComboboxControl,- Comboicon: ComboiconControl,+ IconButtonWithMenu: IconButtonWithMenuControl,Select: SelectControl,};diff --git a/packages/design-system/src/components/comboicon.tsx b/packages/design-system/src/components/icon-button-with-menu.tsxsimilarity index 98%rename from packages/design-system/src/components/comboicon.tsxrename to packages/design-system/src/components/icon-button-with-menu.tsxindex bc4e97848d..4d82e9a552 100644--- a/packages/design-system/src/components/comboicon.tsx+++ b/packages/design-system/src/components/icon-button-with-menu.tsx@@ -84,7 +84,7 @@ const IconButton = styled("button", {},});-export const Comboicon = ({+export const IconButtonWithMenu = ({label,value,items,diff --git a/packages/design-system/src/components/primitives/numeric-gesture-control.stories.tsx b/packages/design-system/src/components/primitives/numeric-gesture-control.stories.tsxindex 895631e6bc..40c18b1705 100644--- a/packages/design-system/src/components/primitives/numeric-gesture-control.stories.tsx+++ b/packages/design-system/src/components/primitives/numeric-gesture-control.stories.tsx@@ -1,23 +1,23 @@import { useRef, useEffect, RefObject } from "react";import {- numericGestureControl,- type NumericGestureValue,- type NumericGestureDirection,+ numericScrubControl,+ type NumericScrubValue,+ type NumericScrubDirection,} from "./numeric-gesture-control";-const useNumericGestureControl = ({+const useNumericScrubControl = ({ref,value,direction,}: {ref: RefObject<HTMLInputElement>;- value: NumericGestureValue;- direction: NumericGestureDirection;+ value: NumericScrubValue;+ direction: NumericScrubDirection;}) => {useEffect(() => {if (ref.current === null) return;ref.current.value = String(value);- const { disconnectedCallback } = numericGestureControl(ref.current, {+ const { disconnectedCallback } = numericScrubControl(ref.current, {initialValue: value,direction: direction,onValueChange: (event) => {@@ -34,11 +34,11 @@ const Input = ({value,direction,}: {- value: NumericGestureValue;- direction: NumericGestureDirection;+ value: NumericScrubValue;+ direction: NumericScrubDirection;}) => {const ref = useRef<HTMLInputElement | null>(null);- useNumericGestureControl({ ref, value, direction });+ useNumericScrubControl({ ref, value, direction });return <input defaultValue={value} ref={ref} />;};@@ -47,7 +47,7 @@ export const NumericInput = Object.assign(Input.bind({}), {});export default {- title: "numericGestureControl",+ title: "numericScrubControl",component: Input,argTypes: {value: {diff --git a/packages/design-system/src/components/primitives/numeric-gesture-control.ts b/packages/design-system/src/components/primitives/numeric-gesture-control.tsindex e3bf5655f9..a3f983fed2 100644--- a/packages/design-system/src/components/primitives/numeric-gesture-control.ts+++ b/packages/design-system/src/components/primitives/numeric-gesture-control.ts@@ -5,7 +5,7 @@* - dispatches {onValueChange} method while pointermove and pointerdown are active* - dispatched {onValueChange} recieves a new value: old value + accumulation of the pointer move axis* @example- * numericGestureControl(document.querySelector('input'), {+ * numericScrubControl(document.querySelector('input'), {* onValueChange: (event) => {* event.preventDefault();* event.target.value = event.value;@@ -14,23 +14,23 @@* });*/-export type NumericGestureDirection = "horizontal" | "vertical";+export type NumericScrubDirection = "horizontal" | "vertical";-export type NumericGestureValue = number;+export type NumericScrubValue = number;-export type NumericGestureOptions = {- minValue?: NumericGestureValue;- maxValue?: NumericGestureValue;- initialValue?: NumericGestureValue;- direction?: NumericGestureDirection;+export type NumericScrubOptions = {+ minValue?: NumericScrubValue;+ maxValue?: NumericScrubValue;+ initialValue?: NumericScrubValue;+ direction?: NumericScrubDirection;onValueChange: (event: {target: HTMLInputElement;- value: NumericGestureValue;+ value: NumericScrubValue;preventDefault: () => void;}) => void;};-type NumericGestureState = {+type NumericScrubState = {value: number;cursor?: SVGElement;offset: number;@@ -38,7 +38,7 @@ type NumericGestureState = {direction: string;};-export const numericGestureControl = (+export const numericScrubControl = (targetNode: HTMLInputElement,{minValue = Number.MIN_SAFE_INTEGER,@@ -46,10 +46,10 @@ export const numericGestureControl = (initialValue = 0,direction = "horizontal",onValueChange = () => null,- }: NumericGestureOptions+ }: NumericScrubOptions) => {const eventNames = ["pointerup", "pointerdown", "pointermove"] as const;- const state: NumericGestureState = {+ const state: NumericScrubState = {value: initialValue,cursor: undefined,offset: 0,@@ -119,7 +119,7 @@ export const numericGestureControl = (};const requestPointerLock = (- state: NumericGestureState,+ state: NumericScrubState,event: PointerEvent,targetNode: HTMLElement) => {@@ -166,7 +166,7 @@ const requestPointerLock = (};const exitPointerLock = (- state: NumericGestureState,+ state: NumericScrubState,event: PointerEvent,targetNode: HTMLElement) => {diff --git a/packages/design-system/src/index.ts b/packages/design-system/src/index.tsindex da3c190777..b92cfec99a 100644--- a/packages/design-system/src/index.ts+++ b/packages/design-system/src/index.ts@@ -59,5 +59,5 @@ export * from "./components/radio";export * from "./components/combobox";export * from "./components/checkbox";export * from "./components/avatar";-export * from "./components/comboicon";+export * from "./components/icon-button-with-menu";export * from "./components/primitives/numeric-gesture-control";