Skip to content

Commit

Permalink
feat: Select Box 간 간격 지정
Browse files Browse the repository at this point in the history
  • Loading branch information
te6-in committed Dec 3, 2024
1 parent f408add commit 744d6bd
Show file tree
Hide file tree
Showing 22 changed files with 184 additions and 112 deletions.
4 changes: 2 additions & 2 deletions docs/components/example/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@
"segmented-control-long-label-fixed-width": "import { SegmentedControl, Segment } from \"seed-design/ui/segmented-control\";\n\nexport default function SegmentedControlLongLabelFixedWidth() {\n return (\n <SegmentedControl defaultValue=\"price\">\n <Segment value=\"price\">가격 높은 순</Segment>\n <Segment value=\"discount\">할인율 높은 순</Segment>\n <Segment value=\"popularity\">인기 많은 순</Segment>\n </SegmentedControl>\n );\n}",
"segmented-control-long-label": "import { SegmentedControl, Segment } from \"seed-design/ui/segmented-control\";\n\nexport default function SegmentedControlLongLabel() {\n return (\n <SegmentedControl defaultValue=\"price\">\n <Segment value=\"price\">가격 높은 순</Segment>\n <Segment value=\"discount\">할인율 높은 순</Segment>\n <Segment value=\"popularity\">인기 많은 순</Segment>\n </SegmentedControl>\n );\n}",
"segmented-control-preview": "import { SegmentedControl, Segment } from \"seed-design/ui/segmented-control\";\n\nexport default function SegmentedControlPreview() {\n return (\n <SegmentedControl defaultValue=\"Hot\">\n <Segment value=\"Hot\">Hot</Segment>\n <Segment value=\"New\">New</Segment>\n </SegmentedControl>\n );\n}",
"select-box-check-preview": "import { SelectBoxCheck } from \"seed-design/ui/select-box-check\";\n\nexport default function SelectBoxRadioGroupPreview() {\n return <SelectBoxCheck label=\"Culpa\" />;\n}",
"select-box-radio-group-preview": "import { SelectBoxRadioGroup, SelectBoxRadio } from \"seed-design/ui/select-box-radio-group\";\n\nexport default function SelectBoxRadioGroupPreview() {\n return (\n <SelectBoxRadioGroup className=\"flex flex-col gap-2 w-full\">\n <SelectBoxRadio value=\"culpa\" label=\"Culpa\" />\n <SelectBoxRadio\n value=\"voluptate\"\n label=\"Voluptate\"\n description=\"Elit cupidatat dolore fugiat enim veniam culpa.\"\n />\n <SelectBoxRadio value=\"eiusmod\" label=\"Eiusmod\" />\n </SelectBoxRadioGroup>\n );\n}",
"select-box-check-group-preview": "import { SelectBoxCheck, SelectBoxCheckGroup } from \"@/registry/ui/select-box-check-group\";\n\nexport default function SelectBoxCheckGroupPreview() {\n return (\n <SelectBoxCheckGroup>\n <SelectBoxCheck value=\"culpa\" label=\"Culpa\" defaultChecked />\n <SelectBoxCheck\n value=\"voluptate\"\n label=\"Voluptate\"\n description=\"Elit cupidatat dolore fugiat enim veniam culpa.\"\n />\n <SelectBoxCheck value=\"eiusmod\" label=\"Eiusmod\" />\n </SelectBoxCheckGroup>\n );\n}",
"select-box-radio-group-preview": "import { SelectBoxRadioGroup, SelectBoxRadio } from \"seed-design/ui/select-box-radio-group\";\n\nexport default function SelectBoxRadioGroupPreview() {\n return (\n <SelectBoxRadioGroup className=\"flex flex-col gap-2 w-full\" defaultValue=\"culpa\">\n <SelectBoxRadio value=\"culpa\" label=\"Culpa\" />\n <SelectBoxRadio\n value=\"voluptate\"\n label=\"Voluptate\"\n description=\"Elit cupidatat dolore fugiat enim veniam culpa.\"\n />\n <SelectBoxRadio value=\"eiusmod\" label=\"Eiusmod\" />\n </SelectBoxRadioGroup>\n );\n}",
"skeleton-wave-activity": "import type { ActivityComponentType } from \"@stackflow/react/future\";\nimport type * as React from \"react\";\n\nimport Layout from \"@/components/stackflow/ActivityLayout\";\nimport { Skeleton } from \"seed-design/ui/skeleton\";\nimport {\n useSkeletonDuration,\n useIsRealLoading,\n useSkeletonLoading,\n useSkeletonTimingFunction,\n useSkeletonInitTransitionDuration,\n useSkeletonGradient,\n} from \"@/stores/skeleton\";\n\ndeclare module \"@stackflow/config\" {\n interface Register {\n SkeletonWave: unknown;\n }\n}\n\nconst Fallback = () => {\n return (\n <div style={{ display: \"flex\", flexDirection: \"column\", gap: \"12px\" }}>\n <Skeleton width=\"100%\" height=\"300px\" borderRadius=\"square\" />\n <div style={{ display: \"flex\", flexDirection: \"column\", gap: \"4px\" }}>\n <Skeleton width=\"50px\" height=\"50px\" borderRadius=\"circle\" />\n <Skeleton width=\"100%\" height=\"20px\" borderRadius=\"rounded\" />\n <Skeleton width=\"200px\" height=\"20px\" borderRadius=\"rounded\" />\n </div>\n </div>\n );\n};\n\nconst SkeletonWaveActivity: ActivityComponentType<\"SkeletonWave\"> = () => {\n const isLoading = useSkeletonLoading();\n const isRealLoading = useIsRealLoading();\n const animationDuration = useSkeletonDuration();\n const animationTiming = useSkeletonTimingFunction();\n const initTransitionDuration = useSkeletonInitTransitionDuration();\n const gradient = useSkeletonGradient();\n\n return (\n <Layout>\n <div\n style={\n {\n padding: \"16px\",\n \"--skeleton-gradient\": gradient,\n \"--skeleton-init-transition-duration\": initTransitionDuration,\n \"--skeleton-animation-duration\": animationDuration,\n \"--skeleton-animation-timing-function\": animationTiming,\n } as React.CSSProperties\n }\n >\n {isLoading ? isRealLoading && <Fallback /> : <div>content</div>}\n </div>\n </Layout>\n );\n};\n\nexport default SkeletonWaveActivity;\n\nSkeletonWaveActivity.displayName = \"SkeletonWaveActivity\";",
"switch-disabled": "import { Switch } from \"seed-design/ui/switch\";\n\nexport default function SwitchDisabled() {\n return (\n <div style={{ display: \"flex\", flexDirection: \"column\", gap: 10 }}>\n <Switch disabled />\n <Switch checked disabled />\n </div>\n );\n}",
"switch-medium": "import { useState } from \"react\";\nimport { Switch } from \"seed-design/ui/switch\";\n\nexport default function SwitchMedium() {\n const [isChecked, setIsChecked] = useState(false);\n\n return (\n <Switch size=\"medium\" checked={isChecked} onCheckedChange={setIsChecked} />\n );\n}",
Expand Down
15 changes: 15 additions & 0 deletions docs/components/example/select-box-check-group-preview.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { SelectBoxCheck, SelectBoxCheckGroup } from "@/registry/ui/select-box-check-group";

export default function SelectBoxCheckGroupPreview() {
return (
<SelectBoxCheckGroup>
<SelectBoxCheck value="culpa" label="Culpa" defaultChecked />
<SelectBoxCheck
value="voluptate"
label="Voluptate"
description="Elit cupidatat dolore fugiat enim veniam culpa."
/>
<SelectBoxCheck value="eiusmod" label="Eiusmod" />
</SelectBoxCheckGroup>
);
}
5 changes: 0 additions & 5 deletions docs/components/example/select-box-check-preview.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion docs/components/example/select-box-radio-group-preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { SelectBoxRadioGroup, SelectBoxRadio } from "seed-design/ui/select-box-r

export default function SelectBoxRadioGroupPreview() {
return (
<SelectBoxRadioGroup className="flex flex-col gap-2 w-full">
<SelectBoxRadioGroup className="flex flex-col gap-2 w-full" defaultValue="culpa">
<SelectBoxRadio value="culpa" label="Culpa" />
<SelectBoxRadio
value="voluptate"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
title: Select Box Check Group
---

<ComponentExample name="select-box-check-group-preview" />

## 설치

<Installation name="select-box-check-group" />

## Props

### `SelectBoxCheckGroup`

`SelectBoxCheckGroup`은 받는 prop이 없어요. `SelectBoxCheck` 간 간격을 설정하는 목적으로만 사용돼요.

### `SelectBoxCheck`

<AutoTypeTable
path="./registry/ui/select-box-check-group.tsx"
name="SelectBoxCheckProps"
/>

This file was deleted.

4 changes: 2 additions & 2 deletions docs/public/__registry__/ui/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,13 @@
]
},
{
"name": "select-box-check",
"name": "select-box-check-group",
"dependencies": [
"@seed-design/react-checkbox",
"@daangn/react-monochrome-icon"
],
"files": [
"ui:select-box-check.tsx"
"ui:select-box-check-group.tsx"
]
},
{
Expand Down
14 changes: 14 additions & 0 deletions docs/public/__registry__/ui/select-box-check-group.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "select-box-check-group",
"dependencies": [
"@seed-design/react-checkbox",
"@daangn/react-monochrome-icon"
],
"registries": [
{
"name": "select-box-check-group.tsx",
"type": "ui",
"content": "\"use client\";\n\nimport {\n type UseCheckboxProps,\n useCheckbox,\n} from \"@seed-design/react-checkbox\";\nimport {\n checkbox,\n type CheckboxVariantProps,\n} from \"@seed-design/recipe/checkbox\";\nimport {\n type SelectBoxVariantProps,\n selectBox,\n} from \"@seed-design/recipe/selectBox\";\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/checkbox.css\";\nimport \"@seed-design/stylesheet/selectBox.css\";\nimport {\n IconCheckmarkFatFill,\n IconMinusFatFill,\n} from \"@daangn/react-monochrome-icon\";\n\nexport const SelectBoxCheckGroup = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, children, ...otherProps }, ref) => {\n const classNames = selectBox();\n\n return (\n <div ref={ref} {...otherProps} className={clsx(classNames.root, className)}>\n {children}\n </div>\n );\n});\nSelectBoxCheckGroup.displayName = \"SelectBoxCheckGroup\";\n\nexport interface SelectBoxCheckProps\n extends SelectBoxVariantProps,\n Pick<CheckboxVariantProps, \"indeterminate\">,\n Omit<UseCheckboxProps, \"disabled\" | \"invalid\"> {\n label: string;\n description?: string;\n}\n\ntype ReactSelectBoxCheck = Assign<\n Omit<React.InputHTMLAttributes<HTMLInputElement>, \"children\">,\n SelectBoxCheckProps\n>;\n\nexport const SelectBoxCheck = React.forwardRef<\n HTMLInputElement,\n ReactSelectBoxCheck\n>(({ className, label, description, indeterminate, ...otherProps }, ref) => {\n const { rootProps, restProps, hiddenInputProps, controlProps, stateProps } =\n useCheckbox(otherProps);\n\n const checkClassNames = checkbox({\n size: \"large\",\n variant: \"square\",\n indeterminate,\n });\n const selectBoxClassNames = selectBox();\n\n return (\n <label\n className={clsx(selectBoxClassNames.box, className)}\n {...rootProps}\n {...restProps}\n >\n <input ref={ref} {...hiddenInputProps} style={visuallyHidden} />\n <div className={selectBoxClassNames.content}>\n <span className={selectBoxClassNames.label}>{label}</span>\n {description && (\n <span className={selectBoxClassNames.description}>{description}</span>\n )}\n </div>\n <div\n {...controlProps}\n className={clsx(selectBoxClassNames.control, checkClassNames.control)}\n >\n {!indeterminate ? (\n <IconCheckmarkFatFill\n aria-hidden\n {...stateProps}\n className={checkClassNames.icon}\n />\n ) : (\n <IconMinusFatFill\n aria-hidden\n {...stateProps}\n className={checkClassNames.icon}\n />\n )}\n </div>\n </label>\n );\n});\nSelectBoxCheck.displayName = \"SelectBoxCheck\";\n"
}
]
}
14 changes: 0 additions & 14 deletions docs/public/__registry__/ui/select-box-check.json

This file was deleted.

Loading

0 comments on commit 744d6bd

Please sign in to comment.