diff --git a/component-docs/public/__registry__/component/action-button.json b/component-docs/public/__registry__/component/action-button.json index 568248649..c338ef5d8 100644 --- a/component-docs/public/__registry__/component/action-button.json +++ b/component-docs/public/__registry__/component/action-button.json @@ -3,7 +3,10 @@ "dependencies": [ "@radix-ui/react-slot" ], - "files": [ - "component/action-button.tsx" + "registries": [ + { + "name": "action-button.tsx", + "content": "\"use client\";\n\nimport \"@seed-design/stylesheet/actionButton.css\";\n\nimport * as React from \"react\";\nimport clsx from \"clsx\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { actionButton, type ActionButtonVariantProps } from \"@seed-design/recipe/actionButton\";\n\nexport interface ActionButtonProps\n extends React.ButtonHTMLAttributes,\n ActionButtonVariantProps {\n prefixIcon?: React.ReactNode;\n\n suffixIcon?: React.ReactNode;\n\n asChild?: boolean;\n}\n\n/**\n * @see https://component.seed-design.io/components/box-button\n */\nexport const ActionButton = React.forwardRef(\n (\n {\n className,\n variant = \"brandSolid\",\n size = \"medium\",\n children,\n prefixIcon,\n suffixIcon,\n layout = \"withText\",\n asChild = false,\n ...otherProps\n },\n ref,\n ) => {\n const Comp = asChild ? Slot : \"button\";\n const classNames = actionButton({ variant, layout, size });\n return (\n \n {prefixIcon && {prefixIcon}}\n {layout === \"withText\" ? (\n {children}\n ) : (\n {children}\n )}\n {suffixIcon && {suffixIcon}}\n \n );\n },\n);\nActionButton.displayName = \"ActionButton\";\n" + } ] } \ No newline at end of file diff --git a/component-docs/public/__registry__/component/action-chip.json b/component-docs/public/__registry__/component/action-chip.json index ab27a80cd..2d8638e27 100644 --- a/component-docs/public/__registry__/component/action-chip.json +++ b/component-docs/public/__registry__/component/action-chip.json @@ -3,7 +3,10 @@ "dependencies": [ "@radix-ui/react-slot" ], - "files": [ - "component/action-chip.tsx" + "registries": [ + { + "name": "action-chip.tsx", + "content": "import { Slot } from \"@radix-ui/react-slot\";\nimport { actionChip, type ActionChipVariantProps } from \"@seed-design/recipe/actionChip\";\nimport clsx from \"clsx\";\nimport * as React from \"react\";\n\nimport \"@seed-design/stylesheet/actionChip.css\";\n\nexport interface ActionChipProps\n extends React.ButtonHTMLAttributes,\n ActionChipVariantProps {\n prefixIcon?: React.ReactNode;\n\n suffixIcon?: React.ReactNode;\n\n asChild?: boolean;\n}\n\nexport const ActionChip = React.forwardRef(\n (\n {\n className,\n size = \"medium\",\n layout = \"withText\",\n children,\n prefixIcon,\n suffixIcon,\n asChild = false,\n ...otherProps\n },\n ref,\n ) => {\n const Comp = asChild ? Slot : \"button\";\n const classNames = actionChip({ size, layout });\n return (\n \n {prefixIcon && {prefixIcon}}\n {layout === \"withText\" ? (\n {children}\n ) : (\n {children}\n )}\n {suffixIcon && {suffixIcon}}\n \n );\n },\n);\nActionChip.displayName = \"ActionChip\";\n" + } ] } \ No newline at end of file diff --git a/component-docs/public/__registry__/component/alert-dialog.json b/component-docs/public/__registry__/component/alert-dialog.json index c3262bc22..a8ee9b74a 100644 --- a/component-docs/public/__registry__/component/alert-dialog.json +++ b/component-docs/public/__registry__/component/alert-dialog.json @@ -3,7 +3,10 @@ "innerDependencies": [ "action-button" ], - "files": [ - "component/alert-dialog.tsx" + "registries": [ + { + "name": "alert-dialog.tsx", + "content": "\"use client\";\n\nimport \"@seed-design/stylesheet/dialog.css\";\n\nimport * as React from \"react\";\nimport { dialog } from \"@seed-design/recipe/dialog\";\n\nimport { ActionButton } from \"./action-button\";\n\nexport type AlertDialogProps = {\n title: string;\n description: string;\n onInteractOutside?: React.MouseEventHandler;\n};\n\n/**\n * @see https://component.seed-design.io/components/alert-dialog\n */\nexport const AlertDialog: React.FC = ({\n title,\n description,\n onInteractOutside,\n}) => {\n const containerRef = React.useRef(null);\n const backdropRef = React.useRef(null);\n\n const popLock = React.useRef(false);\n\n const onClickOutside: React.MouseEventHandler = (e) => {\n onInteractOutside?.(e);\n\n if (e.defaultPrevented) {\n return;\n }\n\n if (popLock.current) {\n return;\n }\n popLock.current = true;\n };\n const onClickContent: React.MouseEventHandler = (e) => {\n e.stopPropagation();\n };\n\n const classNames = dialog();\n\n return (\n \n
\n
\n
\n

{title}

\n

{description}

\n
\n
\n lol\n lol\n
\n
\n
\n );\n};\nAlertDialog.displayName = \"AlertDialog\";\n" + } ] } \ No newline at end of file diff --git a/component-docs/public/__registry__/component/checkbox.json b/component-docs/public/__registry__/component/checkbox.json index 6f5590554..cac10726d 100644 --- a/component-docs/public/__registry__/component/checkbox.json +++ b/component-docs/public/__registry__/component/checkbox.json @@ -3,7 +3,10 @@ "dependencies": [ "@seed-design/react-checkbox" ], - "files": [ - "component/checkbox.tsx" + "registries": [ + { + "name": "checkbox.tsx", + "content": "\"use client\";\n\nimport { type UseCheckboxProps, useCheckbox } from \"@seed-design/react-checkbox\";\nimport { type CheckboxVariantProps, checkbox } from \"@seed-design/recipe/checkbox\";\nimport clsx from \"clsx\";\nimport * as React from \"react\";\nimport type { CSSProperties } from \"react\";\n\nimport \"@seed-design/stylesheet/checkbox.css\";\n\ntype Assign = Omit & U;\n\nconst visuallyHidden: CSSProperties = {\n border: 0,\n clip: \"rect(0 0 0 0)\",\n height: \"1px\",\n margin: \"-1px\",\n overflow: \"hidden\",\n padding: 0,\n position: \"absolute\",\n whiteSpace: \"nowrap\",\n width: \"1px\",\n};\n\nconst Checkmark = React.forwardRef>((props, ref) => (\n \n \n \n));\n\nexport interface CheckboxProps\n extends Assign, UseCheckboxProps>,\n CheckboxVariantProps {\n label: React.ReactNode;\n}\n\nexport const Checkbox = React.forwardRef(\n ({ className, size = \"medium\", label, ...otherProps }, ref) => {\n const { stateProps, restProps, controlProps, hiddenInputProps, rootProps } =\n useCheckbox(otherProps);\n\n const classNames = checkbox({ size });\n return (\n \n );\n },\n);\nCheckbox.displayName = \"Checkbox\";\n" + } ] } \ No newline at end of file diff --git a/component-docs/public/__registry__/component/chip-tabs.json b/component-docs/public/__registry__/component/chip-tabs.json index 1f0f3ef5c..0ed90a854 100644 --- a/component-docs/public/__registry__/component/chip-tabs.json +++ b/component-docs/public/__registry__/component/chip-tabs.json @@ -3,7 +3,10 @@ "dependencies": [ "@seed-design/react-tabs" ], - "files": [ - "component/chip-tabs.tsx" + "registries": [ + { + "name": "chip-tabs.tsx", + "content": "\"use client\";\n\nimport {\n useLazyContents,\n useTabs,\n type ContentProps,\n type TriggerProps,\n type UseLazyContentsProps,\n type UseTabsProps,\n} from \"@seed-design/react-tabs\";\nimport { chipTab } from \"@seed-design/recipe/chipTab\";\nimport { ChipTabsVariant, chipTabs } from \"@seed-design/recipe/chipTabs\";\nimport clsx from \"clsx\";\nimport * as React from \"react\";\n\nimport \"@seed-design/stylesheet/chipTab.css\";\nimport \"@seed-design/stylesheet/chipTabs.css\";\n\ntype Assign = Omit & U;\n\ninterface ChipTabsContextValue {\n api: ReturnType;\n classNames: ReturnType;\n shouldRender: (value: string) => boolean;\n variant: ChipTabsVariant[\"variant\"];\n}\n\nconst ChipTabsContext = React.createContext(null);\n\nconst useChipTabsContext = () => {\n const context = React.useContext(ChipTabsContext);\n if (!context) {\n throw new Error(\"Tabs cannot be rendered outside the Tabs\");\n }\n return context;\n};\n\nexport interface ChipTabsProps\n extends Assign, Omit>,\n ChipTabsVariant,\n Omit {}\n\nexport const ChipTabs = React.forwardRef((props, ref) => {\n const { className, lazyMode, isLazy, variant } = props;\n const api = useTabs(props);\n const classNames = chipTabs({\n variant,\n });\n const { rootProps, value, restProps } = api;\n const { shouldRender } = useLazyContents({ currentValue: value, lazyMode, isLazy });\n\n return (\n
\n \n {props.children}\n \n
\n );\n});\nChipTabs.displayName = \"ChipTabs\";\n\nexport const ChipTabTriggerList = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes\n>(({ className, children, ...otherProps }, ref) => {\n const { api, classNames } = useChipTabsContext();\n const { tabTriggerListProps, triggerSize } = api;\n const { left } = triggerSize;\n const { triggerList } = classNames;\n\n const containerRef = React.useRef(null);\n React.useImperativeHandle(ref, () => containerRef.current as HTMLDivElement);\n\n React.useEffect(() => {\n if (containerRef.current) {\n containerRef.current?.scrollTo({\n // NOTE: 27px is half of tab's min-width\n left: left - 27,\n behavior: \"smooth\",\n });\n }\n }, [left]);\n\n return (\n \n {children}\n \n );\n});\nChipTabTriggerList.displayName = \"ChipTabTriggerList\";\n\nexport interface ChipTabTriggerProps\n extends Assign, TriggerProps> {}\n\nexport const ChipTabTrigger = React.forwardRef(\n ({ className, children, value, isDisabled, ...otherProps }, ref) => {\n const { api, variant } = useChipTabsContext();\n const { getTabTriggerProps } = api;\n const { label, root } = chipTab({\n variant,\n });\n const { rootProps, labelProps } = getTabTriggerProps({ value, isDisabled });\n\n return (\n \n );\n },\n);\nChipTabTrigger.displayName = \"ChipTabTrigger\";\n\nexport const ChipTabContent = React.forwardRef<\n HTMLDivElement,\n Assign, ContentProps>\n>(({ className, children, value, ...otherProps }, ref) => {\n const { api, classNames, shouldRender } = useChipTabsContext();\n const { getTabContentProps } = api;\n const { content } = classNames;\n const tabContentProps = getTabContentProps({ value });\n const isRender = shouldRender(value);\n\n return (\n
\n {isRender && children}\n
\n );\n});\nChipTabContent.displayName = \"ChipTabContent\";\n" + } ] } \ No newline at end of file diff --git a/component-docs/public/__registry__/component/control-chip.json b/component-docs/public/__registry__/component/control-chip.json index b9bb5d23c..d3b75ec6a 100644 --- a/component-docs/public/__registry__/component/control-chip.json +++ b/component-docs/public/__registry__/component/control-chip.json @@ -3,7 +3,10 @@ "dependencies": [ "@radix-ui/react-slot" ], - "files": [ - "component/control-chip.tsx" + "registries": [ + { + "name": "control-chip.tsx", + "content": "import { Slot } from \"@radix-ui/react-slot\";\nimport { controlChip, type ControlChipVariantProps } from \"@seed-design/recipe/controlChip\";\nimport clsx from \"clsx\";\nimport * as React from \"react\";\n\nimport \"@seed-design/stylesheet/controlChip.css\";\nimport { UseCheckboxProps, useCheckbox } from \"@seed-design/react-checkbox\";\nimport { visuallyHidden } from \"../util/visuallyHidden\";\n\nexport interface ControlChipToggleProps\n extends Omit, \"size\">,\n UseCheckboxProps,\n ControlChipVariantProps {\n prefixIcon?: React.ReactNode;\n\n suffixIcon?: React.ReactNode;\n}\n\nconst ControlChipToggle = React.forwardRef(\n (\n {\n className,\n size = \"medium\",\n layout = \"withText\",\n children,\n prefixIcon,\n suffixIcon,\n ...otherProps\n },\n ref,\n ) => {\n const classNames = controlChip({ size, layout });\n const { rootProps, hiddenInputProps, stateProps, restProps } = useCheckbox(otherProps);\n return (\n \n );\n },\n);\nControlChipToggle.displayName = \"ControlChip.Toggle\";\n\nexport const ControlChip = Object.assign(\n () => {\n console.warn(\n \"ControlChip is a base component and should not be rendered. Use ControlChip.Toggle or ControlChip.Radio instead.\",\n );\n },\n {\n Toggle: ControlChipToggle,\n },\n);\n" + } ] } \ No newline at end of file diff --git a/component-docs/public/__registry__/component/expand-button.json b/component-docs/public/__registry__/component/expand-button.json index 2a027fe88..bf186b6dc 100644 --- a/component-docs/public/__registry__/component/expand-button.json +++ b/component-docs/public/__registry__/component/expand-button.json @@ -3,7 +3,10 @@ "dependencies": [ "@radix-ui/react-slot" ], - "files": [ - "component/expand-button.tsx" + "registries": [ + { + "name": "expand-button.tsx", + "content": "\"use client\";\n\nimport \"@seed-design/stylesheet/expandButton.css\";\n\nimport * as React from \"react\";\nimport clsx from \"clsx\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { expandButton, type ExpandButtonVariantProps } from \"@seed-design/recipe/expandButton\";\n\nexport interface ExpandButtonProps\n extends React.ButtonHTMLAttributes,\n ExpandButtonVariantProps {\n suffixIcon?: React.ReactNode;\n\n asChild?: boolean;\n}\n\n/**\n * @see https://component.seed-design.io/components/box-button\n */\nexport const ExpandButton = React.forwardRef(\n ({ className, children, suffixIcon, asChild = false, ...otherProps }, ref) => {\n const Comp = asChild ? Slot : \"button\";\n const classNames = expandButton({});\n return (\n \n {children}\n {suffixIcon && {suffixIcon}}\n \n );\n },\n);\nExpandButton.displayName = \"ExpandButton\";\n" + } ] } \ No newline at end of file diff --git a/component-docs/public/__registry__/component/switch.json b/component-docs/public/__registry__/component/switch.json index db30dd2ba..44c460957 100644 --- a/component-docs/public/__registry__/component/switch.json +++ b/component-docs/public/__registry__/component/switch.json @@ -3,7 +3,10 @@ "dependencies": [ "@seed-design/react-switch" ], - "files": [ - "component/switch.tsx" + "registries": [ + { + "name": "switch.tsx", + "content": "import { type UseSwitchProps, useSwitch } from \"@seed-design/react-switch\";\nimport { type SwitchVariantProps, switchStyle } from \"@seed-design/recipe/switch\";\nimport clsx from \"clsx\";\nimport * as React from \"react\";\n\nimport type { Assign } from \"../util/types\";\nimport { visuallyHidden } from \"../util/visuallyHidden\";\n\nimport \"@seed-design/stylesheet/switch.css\";\n\nexport interface SwitchProps\n extends Assign, UseSwitchProps>,\n SwitchVariantProps {}\n\nexport const Switch = React.forwardRef(\n ({ className, size = \"medium\", ...otherProps }, ref) => {\n const { restProps, controlProps, hiddenInputProps, rootProps, thumbProps } =\n useSwitch(otherProps);\n const classNames = switchStyle({ size });\n\n return (\n