@reitwagen/design-components 0.0.11 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,8 +8,7 @@ declare const buttonVariants: (props?: ({
8
8
  full?: boolean | null | undefined;
9
9
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
10
10
  interface ButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "disabled" | "color">, VariantProps<typeof buttonVariants> {
11
- children: ReactNode;
12
- full?: boolean;
11
+ children?: ReactNode;
13
12
  leftContent?: ReactNode;
14
13
  rightContent?: ReactNode;
15
14
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../src/components/Button/Button.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACxD,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAGlE,QAAA,MAAM,cAAc;;;;;;8EAwInB,CAAC;AAEF,UAAU,WACR,SAAQ,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,EACzE,YAAY,CAAC,OAAO,cAAc,CAAC;IACrC,QAAQ,EAAE,SAAS,CAAC;IACpB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,YAAY,CAAC,EAAE,SAAS,CAAC;CAC1B;AAED,wBAAgB,MAAM,CAAC,EACrB,SAAS,EACT,OAAO,EACP,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,IAAY,EACZ,GAAG,KAAK,EACT,EAAE,WAAW,2CAqBb;yBAhCe,MAAM"}
1
+ {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../src/components/Button/Button.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACxD,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAGlE,QAAA,MAAM,cAAc;;;;;;8EAyInB,CAAC;AAEF,UAAU,WACR,SAAQ,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,EACzE,YAAY,CAAC,OAAO,cAAc,CAAC;IACrC,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,YAAY,CAAC,EAAE,SAAS,CAAC;CAC1B;AAED,wBAAgB,MAAM,CAAC,EACrB,SAAS,EACT,OAAO,EACP,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,IAAI,EACJ,GAAG,KAAK,EACT,EAAE,WAAW,2CAqBb;yBAhCe,MAAM"}
@@ -24,8 +24,8 @@ const buttonVariants = (0, class_variance_authority_1.cva)("ui:flex ui:items-cen
24
24
  small: "ui:text-button3 ui:rounded-[10px] ui:h-[34px] ui:px-[14px] ui:py-[8px]",
25
25
  },
26
26
  disabled: {
27
- false: "ui:cursor-pointer",
28
27
  true: "ui:pointer-events-none",
28
+ false: "ui:cursor-pointer",
29
29
  },
30
30
  full: {
31
31
  true: "ui:flex-1 ui:w-full",
@@ -127,9 +127,10 @@ const buttonVariants = (0, class_variance_authority_1.cva)("ui:flex ui:items-cen
127
127
  size: "large",
128
128
  variant: "solid",
129
129
  disabled: false,
130
+ full: false,
130
131
  },
131
132
  });
132
- function Button({ className, variant, color, size, disabled, children, leftContent, rightContent, full = false, ...props }) {
133
+ function Button({ className, variant, color, size, disabled, children, leftContent, rightContent, full, ...props }) {
133
134
  return ((0, jsx_runtime_1.jsxs)("button", { className: (0, style_1.cn)(buttonVariants({
134
135
  variant,
135
136
  color,
@@ -1 +1 @@
1
- {"version":3,"file":"Button.stories.d.ts","sourceRoot":"","sources":["../../../src/components/Button/Button.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiDqB,CAAC;AAEhC,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,QAAQ,EAAE,KA6BtB,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,KAgCpB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KA+BnB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KAgBnB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAsBtB,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,KAsBlB,CAAC"}
1
+ {"version":3,"file":"Button.stories.d.ts","sourceRoot":"","sources":["../../../src/components/Button/Button.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiDqB,CAAC;AAEhC,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,QAAQ,EAAE,KA6BtB,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,KAgCpB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KA+BnB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KAcnB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAoBtB,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,KAoBlB,CAAC"}
@@ -111,7 +111,7 @@ exports.Sizes = {
111
111
  },
112
112
  };
113
113
  exports.Solid = {
114
- render: (props) => ((0, jsx_runtime_1.jsx)("div", { className: "ui:flex ui:flex-1", children: (0, jsx_runtime_1.jsx)(Button_1.Button, { variant: "solid", color: "primary", size: "large", ...props, children: props.children }) })),
114
+ render: (props) => ((0, jsx_runtime_1.jsx)(Button_1.Button, { variant: "solid", color: "primary", size: "large", ...props, children: props.children })),
115
115
  args: {
116
116
  children: "Button text",
117
117
  variant: "solid",
@@ -122,7 +122,7 @@ exports.Solid = {
122
122
  },
123
123
  };
124
124
  exports.Outlined = {
125
- render: (props) => ((0, jsx_runtime_1.jsx)("div", { className: "ui:flex ui:flex-1", children: (0, jsx_runtime_1.jsx)(Button_1.Button, { variant: "outlined", color: "primary", size: "large", ...props, children: props.children }) })),
125
+ render: (props) => ((0, jsx_runtime_1.jsx)(Button_1.Button, { variant: "outlined", color: "primary", size: "large", ...props, children: props.children })),
126
126
  args: {
127
127
  children: "Button text",
128
128
  variant: "outlined",
@@ -139,7 +139,7 @@ exports.Outlined = {
139
139
  },
140
140
  };
141
141
  exports.Text = {
142
- render: (props) => ((0, jsx_runtime_1.jsx)("div", { className: "ui:flex ui:flex-1", children: (0, jsx_runtime_1.jsx)(Button_1.Button, { variant: "text", color: "primary", size: "large", ...props, children: props.children }) })),
142
+ render: (props) => ((0, jsx_runtime_1.jsx)(Button_1.Button, { variant: "text", color: "primary", size: "large", ...props, children: props.children })),
143
143
  args: {
144
144
  children: "Button text",
145
145
  variant: "text",
@@ -0,0 +1,22 @@
1
+ import { ElementType, ReactNode } from "react";
2
+ import { PolymorphicComponentProps } from "../../types/props";
3
+ import { VariantProps } from "class-variance-authority";
4
+ declare const chipVariants: (props?: ({
5
+ variant?: "fill" | "text" | "line" | null | undefined;
6
+ size?: "large" | "medium" | "small" | null | undefined;
7
+ disabled?: boolean | null | undefined;
8
+ isSelected?: boolean | null | undefined;
9
+ isActive?: boolean | null | undefined;
10
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
11
+ type ChipOwnProps = VariantProps<typeof chipVariants> & {
12
+ children?: ReactNode;
13
+ leftContent?: ReactNode;
14
+ rightContent?: ReactNode;
15
+ };
16
+ type ChipProps<C extends ElementType> = PolymorphicComponentProps<C, ChipOwnProps>;
17
+ export declare function Chip<C extends ElementType = "button">({ className, as, children, variant, size, disabled, isSelected, isActive, leftContent, rightContent, ...props }: ChipProps<C>): import("react/jsx-runtime").JSX.Element;
18
+ export declare namespace Chip {
19
+ var displayName: string;
20
+ }
21
+ export {};
22
+ //# sourceMappingURL=Chip.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Chip.d.ts","sourceRoot":"","sources":["../../../src/components/Chip/Chip.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAO,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAG7D,QAAA,MAAM,YAAY;;;;;;8EA4HjB,CAAC;AAEF,KAAK,YAAY,GAAG,YAAY,CAAC,OAAO,YAAY,CAAC,GAAG;IACtD,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,YAAY,CAAC,EAAE,SAAS,CAAC;CAC1B,CAAC;AAEF,KAAK,SAAS,CAAC,CAAC,SAAS,WAAW,IAAI,yBAAyB,CAC/D,CAAC,EACD,YAAY,CACb,CAAC;AAEF,wBAAgB,IAAI,CAAC,CAAC,SAAS,WAAW,GAAG,QAAQ,EAAE,EACrD,SAAS,EACT,EAAE,EACF,QAAQ,EACR,OAAO,EACP,IAAI,EACJ,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,GAAG,KAAK,EACT,EAAE,SAAS,CAAC,CAAC,CAAC,2CAuBd;yBAnCe,IAAI"}
@@ -0,0 +1,139 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Chip = Chip;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const class_variance_authority_1 = require("class-variance-authority");
6
+ const style_1 = require("../../utils/style");
7
+ const chipVariants = (0, class_variance_authority_1.cva)("ui:flex ui:items-center ui:justify-center ui:gap-1 ui:select-none", {
8
+ variants: {
9
+ variant: {
10
+ fill: "ui:transition-colors ui:duration-300 ui:rounded-full",
11
+ line: "ui:transition-colors ui:duration-100 ui:rounded-full",
12
+ text: "ui:rounded-[8px]",
13
+ },
14
+ size: {
15
+ large: "ui:text-button2 ui:h-[38px] ui:px-[18px] ui:py-[9px]",
16
+ medium: "ui:text-button3 ui:h-[32px] ui:px-[14px] ui:py-[7px]",
17
+ small: "ui:text-button3 ui:h-[26px] ui:px-[10px] ui:py-[4.5px]",
18
+ },
19
+ disabled: {
20
+ true: "ui:pointer-events-none",
21
+ false: "ui:cursor-pointer",
22
+ },
23
+ isSelected: {
24
+ true: "",
25
+ false: "",
26
+ },
27
+ isActive: {
28
+ true: "",
29
+ false: "",
30
+ },
31
+ },
32
+ compoundVariants: [
33
+ {
34
+ variant: "fill",
35
+ isSelected: false,
36
+ isActive: false,
37
+ className: "ui:bg-gray-50 ui:text-gray-500",
38
+ },
39
+ {
40
+ variant: "fill",
41
+ isSelected: true,
42
+ isActive: false,
43
+ className: "ui:bg-blue-50 ui:text-blue-700",
44
+ },
45
+ {
46
+ variant: "fill",
47
+ isSelected: false,
48
+ isActive: true,
49
+ className: "ui:bg-gray-100 ui:text-gray-600",
50
+ },
51
+ {
52
+ variant: "fill",
53
+ isSelected: true,
54
+ isActive: true,
55
+ className: "ui:bg-blue-100 ui:text-blue-800",
56
+ },
57
+ {
58
+ variant: "fill",
59
+ isSelected: true,
60
+ isActive: false,
61
+ disabled: true,
62
+ className: "ui:bg-blue-50 ui:text-blue-300",
63
+ },
64
+ {
65
+ variant: "fill",
66
+ isSelected: false,
67
+ isActive: false,
68
+ disabled: true,
69
+ className: "ui:bg-gray-50 ui:text-gray-300",
70
+ },
71
+ {
72
+ variant: "line",
73
+ isSelected: false,
74
+ isActive: false,
75
+ className: "ui:border ui:border-gray-100 ui:text-gray-500 ui:bg-white",
76
+ },
77
+ {
78
+ variant: "line",
79
+ isSelected: false,
80
+ isActive: true,
81
+ className: "ui:border ui:border-gray-200 ui:text-gray-700 ui:bg-gray-100",
82
+ },
83
+ {
84
+ variant: "line",
85
+ isSelected: true,
86
+ isActive: false,
87
+ className: "ui:text-white ui:bg-gray-700",
88
+ },
89
+ {
90
+ variant: "line",
91
+ isSelected: true,
92
+ isActive: true,
93
+ className: "ui:text-gray-200 ui:bg-gray-800",
94
+ },
95
+ {
96
+ variant: "text",
97
+ isSelected: false,
98
+ isActive: false,
99
+ className: "ui:text-gray-500 ui:bg-white",
100
+ },
101
+ {
102
+ variant: "text",
103
+ isSelected: true,
104
+ isActive: false,
105
+ className: "ui:text-gray-700 ui:bg-gray-100",
106
+ },
107
+ {
108
+ variant: "text",
109
+ isSelected: false,
110
+ isActive: true,
111
+ className: "ui:text-gray-600 ui:bg-gray-50",
112
+ },
113
+ {
114
+ variant: "text",
115
+ isSelected: true,
116
+ isActive: true,
117
+ className: "ui:text-gray-800 ui:bg-gray-200",
118
+ },
119
+ ],
120
+ defaultVariants: {
121
+ variant: "fill",
122
+ size: "large",
123
+ isSelected: false,
124
+ isActive: false,
125
+ disabled: false,
126
+ },
127
+ });
128
+ function Chip({ className, as, children, variant, size, disabled, isSelected, isActive, leftContent, rightContent, ...props }) {
129
+ const Component = as || "button";
130
+ return ((0, jsx_runtime_1.jsxs)(Component, { className: (0, style_1.cn)(chipVariants({
131
+ variant,
132
+ disabled,
133
+ isSelected,
134
+ isActive,
135
+ size,
136
+ className,
137
+ })), disabled: disabled || undefined, ...props, children: [leftContent, (0, jsx_runtime_1.jsx)("span", { children: children }), rightContent] }));
138
+ }
139
+ Chip.displayName = "Chip";
@@ -0,0 +1,53 @@
1
+ import type { StoryObj } from "@storybook/react";
2
+ import { Chip } from "./Chip";
3
+ declare const meta: {
4
+ title: string;
5
+ component: typeof Chip;
6
+ tags: string[];
7
+ parameters: {
8
+ docs: {
9
+ description: {
10
+ component: string;
11
+ };
12
+ };
13
+ };
14
+ argTypes: {
15
+ variant: {
16
+ control: {
17
+ type: "radio";
18
+ };
19
+ options: string[];
20
+ };
21
+ disabled: {
22
+ control: {
23
+ type: "boolean";
24
+ };
25
+ options: string[];
26
+ };
27
+ isSelected: {
28
+ control: {
29
+ type: "boolean";
30
+ };
31
+ options: string[];
32
+ };
33
+ isActive: {
34
+ control: {
35
+ type: "boolean";
36
+ };
37
+ options: string[];
38
+ };
39
+ size: {
40
+ control: {
41
+ type: "radio";
42
+ };
43
+ options: string[];
44
+ };
45
+ };
46
+ };
47
+ export default meta;
48
+ type Story = StoryObj<typeof meta>;
49
+ export declare const Variants: Story;
50
+ export declare const Fill: Story;
51
+ export declare const Line: Story;
52
+ export declare const Text: Story;
53
+ //# sourceMappingURL=Chip.stories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Chip.stories.d.ts","sourceRoot":"","sources":["../../../src/components/Chip/Chip.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuCmB,CAAC;AAE9B,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,QAAQ,EAAE,KAqCtB,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,KAmBlB,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,KAkBlB,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,KAmBlB,CAAC"}
@@ -0,0 +1,119 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Text = exports.Line = exports.Fill = exports.Variants = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const Chip_1 = require("./Chip");
6
+ const meta = {
7
+ title: "Components/Chip",
8
+ component: Chip_1.Chip,
9
+ tags: ["autodocs"],
10
+ parameters: {
11
+ docs: {
12
+ description: {
13
+ component: `
14
+ 정보 요약과 화면의 복잡성을 줄이는 데 사용되며, 카테고리를 분류해 특정 정보를 시각적으로 표현합니다.
15
+
16
+ ## <b>Chip guide</b>
17
+
18
+ 카테고리를 설명하는 키워드를 통해 콘텐츠를 분류합니다. 사용자에게 직접 필터링할 수 있는 콘텐츠 구분 기능을 제공합니다.
19
+ `,
20
+ },
21
+ },
22
+ },
23
+ argTypes: {
24
+ variant: {
25
+ control: { type: "radio" },
26
+ options: ["fill", "line", "text"],
27
+ },
28
+ disabled: {
29
+ control: { type: "boolean" },
30
+ options: ["true", "false"],
31
+ },
32
+ isSelected: {
33
+ control: { type: "boolean" },
34
+ options: ["true", "false"],
35
+ },
36
+ isActive: {
37
+ control: { type: "boolean" },
38
+ options: ["true", "false"],
39
+ },
40
+ size: {
41
+ control: { type: "radio" },
42
+ options: ["large", "medium", "small"],
43
+ },
44
+ },
45
+ };
46
+ exports.default = meta;
47
+ exports.Variants = {
48
+ parameters: {
49
+ docs: {
50
+ description: {
51
+ story: `
52
+ - Chip의 variant 스타일을 변경하려면 <code>variant</code> 속성을 사용하세요. 사용할 수 있는 값에는 <code>fill</code>, <code>line</code>, <code>text</code> 가 있어요. 기본값은 <code>fill</code> 입니다.
53
+ `,
54
+ },
55
+ },
56
+ },
57
+ render: (props) => ((0, jsx_runtime_1.jsxs)("div", { className: "ui:flex ui:gap-2", children: [(0, jsx_runtime_1.jsx)(Chip_1.Chip, { variant: "fill", size: "large", ...props, children: props.children }), (0, jsx_runtime_1.jsx)(Chip_1.Chip, { variant: "line", size: "large", ...props, children: props.children }), (0, jsx_runtime_1.jsx)(Chip_1.Chip, { variant: "text", size: "small", ...props, children: props.children })] })),
58
+ args: {
59
+ children: "Button text",
60
+ disabled: false,
61
+ },
62
+ argTypes: {
63
+ isSelected: {
64
+ control: { type: "boolean" },
65
+ options: ["true", "false"],
66
+ },
67
+ isActive: {
68
+ control: { type: "boolean" },
69
+ options: ["true", "false"],
70
+ },
71
+ },
72
+ };
73
+ exports.Fill = {
74
+ render: (props) => ((0, jsx_runtime_1.jsx)(Chip_1.Chip, { variant: "fill", ...props, children: props.children })),
75
+ args: {
76
+ children: "Text Field",
77
+ variant: "fill",
78
+ disabled: false,
79
+ isSelected: false,
80
+ isActive: false,
81
+ },
82
+ argTypes: {
83
+ size: {
84
+ control: { type: "radio" },
85
+ options: ["large"],
86
+ },
87
+ },
88
+ };
89
+ exports.Line = {
90
+ render: (props) => ((0, jsx_runtime_1.jsx)(Chip_1.Chip, { variant: "line", ...props, children: props.children })),
91
+ args: {
92
+ children: "Text Field",
93
+ variant: "line",
94
+ isSelected: false,
95
+ isActive: false,
96
+ },
97
+ argTypes: {
98
+ size: {
99
+ control: { type: "radio" },
100
+ options: ["large", "medium"],
101
+ },
102
+ },
103
+ };
104
+ exports.Text = {
105
+ render: (props) => ((0, jsx_runtime_1.jsx)(Chip_1.Chip, { variant: "text", size: "small", ...props, children: props.children })),
106
+ args: {
107
+ children: "Text Field",
108
+ variant: "text",
109
+ isSelected: false,
110
+ isActive: false,
111
+ size: "small",
112
+ },
113
+ argTypes: {
114
+ size: {
115
+ control: { type: "radio" },
116
+ options: ["small"],
117
+ },
118
+ },
119
+ };
@@ -0,0 +1,2 @@
1
+ export { Chip } from "./Chip";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Chip/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Chip = void 0;
4
+ var Chip_1 = require("./Chip");
5
+ Object.defineProperty(exports, "Chip", { enumerable: true, get: function () { return Chip_1.Chip; } });
@@ -0,0 +1,15 @@
1
+ import { ButtonHTMLAttributes } from "react";
2
+ import { type VariantProps } from "class-variance-authority";
3
+ declare const toggleVariants: (props?: ({
4
+ disabled?: boolean | null | undefined;
5
+ checked?: boolean | null | undefined;
6
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
7
+ interface ToggleProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "disabled">, VariantProps<typeof toggleVariants> {
8
+ onCheckedChange?: (checked: boolean) => void;
9
+ }
10
+ export declare function Toggle({ checked, disabled, onCheckedChange, ...props }: ToggleProps): import("react/jsx-runtime").JSX.Element;
11
+ export declare namespace Toggle {
12
+ var displayName: string;
13
+ }
14
+ export {};
15
+ //# sourceMappingURL=Toggle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Toggle.d.ts","sourceRoot":"","sources":["../../../src/components/Toggle/Toggle.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAGlE,QAAA,MAAM,cAAc;;;8EAmCnB,CAAC;AA6BF,UAAU,WACR,SAAQ,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,UAAU,CAAC,EAC/D,YAAY,CAAC,OAAO,cAAc,CAAC;IACrC,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;CAC9C;AAED,wBAAgB,MAAM,CAAC,EACrB,OAAO,EACP,QAAQ,EACR,eAAe,EACf,GAAG,KAAK,EACT,EAAE,WAAW,2CAkBb;yBAvBe,MAAM"}
@@ -0,0 +1,70 @@
1
+ "use client";
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.Toggle = Toggle;
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const class_variance_authority_1 = require("class-variance-authority");
7
+ const style_1 = require("../../utils/style");
8
+ const toggleVariants = (0, class_variance_authority_1.cva)("ui:ring-0 ui:h-[31px] ui:w-[51px] ui:rounded-full ui:inline-flex ui:items-center ui:rounded-full ui:transition-colors ui:duration-100", {
9
+ variants: {
10
+ disabled: {
11
+ true: "ui:pointer-events-none",
12
+ false: "ui:cursor-pointer",
13
+ },
14
+ checked: {
15
+ true: "ui:bg-blue-700",
16
+ false: "ui:bg-gray-100",
17
+ },
18
+ },
19
+ compoundVariants: [
20
+ {
21
+ disabled: false,
22
+ checked: false,
23
+ className: "ui:active:bg-gray-200",
24
+ },
25
+ {
26
+ disabled: true,
27
+ checked: false,
28
+ className: "ui:bg-gray-50",
29
+ },
30
+ {
31
+ disabled: true,
32
+ checked: true,
33
+ className: "ui:bg-blue-300",
34
+ },
35
+ ],
36
+ defaultVariants: {
37
+ disabled: false,
38
+ checked: false,
39
+ },
40
+ });
41
+ const thumbVariants = (0, class_variance_authority_1.cva)("ui:bg-white ui:rounded-full ui:transition-transform", {
42
+ variants: {
43
+ disabled: {
44
+ true: "",
45
+ false: "",
46
+ },
47
+ checked: {
48
+ true: "ui:w-[25px] ui:h-[25px] ui:translate-x-6",
49
+ false: "ui:w-[21px] ui:h-[21px] ui:translate-x-1",
50
+ },
51
+ },
52
+ compoundVariants: [
53
+ {
54
+ disabled: false,
55
+ checked: false,
56
+ className: "ui:active:bg-gray-100",
57
+ },
58
+ ],
59
+ defaultVariants: {
60
+ disabled: false,
61
+ checked: false,
62
+ },
63
+ });
64
+ function Toggle({ checked, disabled, onCheckedChange, ...props }) {
65
+ return ((0, jsx_runtime_1.jsx)("button", { role: "switch", onClick: () => onCheckedChange?.(!checked), "aria-checked": Boolean(checked), className: (0, style_1.cn)(toggleVariants({
66
+ checked,
67
+ disabled,
68
+ })), disabled: disabled || undefined, ...props, children: (0, jsx_runtime_1.jsx)("span", { className: thumbVariants({ checked, disabled }) }) }));
69
+ }
70
+ Toggle.displayName = "Toggle";
@@ -0,0 +1,32 @@
1
+ import type { StoryObj } from "@storybook/react";
2
+ import { Toggle } from "./Toggle";
3
+ declare const meta: {
4
+ title: string;
5
+ component: typeof Toggle;
6
+ tags: string[];
7
+ parameters: {
8
+ docs: {
9
+ description: {
10
+ component: string;
11
+ };
12
+ };
13
+ };
14
+ argTypes: {
15
+ disabled: {
16
+ control: {
17
+ type: "boolean";
18
+ };
19
+ options: string[];
20
+ };
21
+ checked: {
22
+ control: {
23
+ type: "boolean";
24
+ };
25
+ options: string[];
26
+ };
27
+ };
28
+ };
29
+ export default meta;
30
+ type Story = StoryObj<typeof meta>;
31
+ export declare const Controlled: Story;
32
+ //# sourceMappingURL=Toggle.stories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Toggle.stories.d.ts","sourceRoot":"","sources":["../../../src/components/Toggle/Toggle.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;CAwBqB,CAAC;AAEhC,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAanC,eAAO,MAAM,UAAU,EAAE,KAWxB,CAAC"}
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Controlled = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const test_1 = require("@storybook/test");
7
+ const Toggle_1 = require("./Toggle");
8
+ const meta = {
9
+ title: "Components/Toggle",
10
+ component: Toggle_1.Toggle,
11
+ tags: ["autodocs"],
12
+ parameters: {
13
+ docs: {
14
+ description: {
15
+ component: `
16
+ 즉각적인 상태 전환(켜기/끄기)을 위한 요소로, 활성화/비활성화 기능을 나타냅니다.
17
+
18
+ `,
19
+ },
20
+ },
21
+ },
22
+ argTypes: {
23
+ disabled: {
24
+ control: { type: "boolean" },
25
+ options: ["true", "false"],
26
+ },
27
+ checked: {
28
+ control: { type: "boolean" },
29
+ options: ["true", "false"],
30
+ },
31
+ },
32
+ };
33
+ exports.default = meta;
34
+ function ToggleWithControlled(props) {
35
+ const [checked, setChecked] = (0, react_1.useState)(props.checked);
36
+ return ((0, jsx_runtime_1.jsx)(Toggle_1.Toggle, { ...props, checked: checked, onCheckedChange: () => setChecked(!checked) }));
37
+ }
38
+ exports.Controlled = {
39
+ render: (props) => (0, jsx_runtime_1.jsx)(ToggleWithControlled, { ...props }),
40
+ args: {
41
+ checked: false,
42
+ disabled: false,
43
+ },
44
+ play: async ({ canvasElement }) => {
45
+ const canvas = (0, test_1.within)(canvasElement);
46
+ const toggle = canvas.getByRole("switch");
47
+ await test_1.userEvent.click(toggle);
48
+ },
49
+ };
@@ -0,0 +1,2 @@
1
+ export { Toggle } from "./Toggle";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Toggle/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Toggle = void 0;
4
+ var Toggle_1 = require("./Toggle");
5
+ Object.defineProperty(exports, "Toggle", { enumerable: true, get: function () { return Toggle_1.Toggle; } });
package/dist/index.css CHANGED
@@ -14,6 +14,7 @@
14
14
  --ui-color-blue-600: #4878ff;
15
15
  --ui-color-blue-700: #3052fd;
16
16
  --ui-color-blue-800: #0e2dc6;
17
+ --ui-color-gray-50: #f6f7fa;
17
18
  --ui-color-gray-100: #ededf0;
18
19
  --ui-color-gray-200: #dedee4;
19
20
  --ui-color-gray-300: #bcbcc4;
@@ -276,9 +277,30 @@
276
277
  .ui\:grid {
277
278
  display: grid;
278
279
  }
280
+ .ui\:inline-flex {
281
+ display: inline-flex;
282
+ }
283
+ .ui\:h-\[21px\] {
284
+ height: 21px;
285
+ }
286
+ .ui\:h-\[25px\] {
287
+ height: 25px;
288
+ }
289
+ .ui\:h-\[26px\] {
290
+ height: 26px;
291
+ }
292
+ .ui\:h-\[31px\] {
293
+ height: 31px;
294
+ }
295
+ .ui\:h-\[32px\] {
296
+ height: 32px;
297
+ }
279
298
  .ui\:h-\[34px\] {
280
299
  height: 34px;
281
300
  }
301
+ .ui\:h-\[38px\] {
302
+ height: 38px;
303
+ }
282
304
  .ui\:h-\[40px\] {
283
305
  height: 40px;
284
306
  }
@@ -288,6 +310,15 @@
288
310
  .ui\:h-px {
289
311
  height: 1px;
290
312
  }
313
+ .ui\:w-\[21px\] {
314
+ width: 21px;
315
+ }
316
+ .ui\:w-\[25px\] {
317
+ width: 25px;
318
+ }
319
+ .ui\:w-\[51px\] {
320
+ width: 51px;
321
+ }
291
322
  .ui\:w-full {
292
323
  width: 100%;
293
324
  }
@@ -297,6 +328,14 @@
297
328
  .ui\:flex-1 {
298
329
  flex: 1;
299
330
  }
331
+ .ui\:translate-x-1 {
332
+ --tw-translate-x: calc(var(--ui-spacing) * 1);
333
+ translate: var(--tw-translate-x) var(--tw-translate-y);
334
+ }
335
+ .ui\:translate-x-6 {
336
+ --tw-translate-x: calc(var(--ui-spacing) * 6);
337
+ translate: var(--tw-translate-x) var(--tw-translate-y);
338
+ }
300
339
  .ui\:cursor-pointer {
301
340
  cursor: pointer;
302
341
  }
@@ -315,6 +354,9 @@
315
354
  .ui\:justify-center {
316
355
  justify-content: center;
317
356
  }
357
+ .ui\:gap-1 {
358
+ gap: calc(var(--ui-spacing) * 1);
359
+ }
318
360
  .ui\:gap-1\.5 {
319
361
  gap: calc(var(--ui-spacing) * 1.5);
320
362
  }
@@ -327,6 +369,9 @@
327
369
  .ui\:gap-5 {
328
370
  gap: calc(var(--ui-spacing) * 5);
329
371
  }
372
+ .ui\:rounded-\[8px\] {
373
+ border-radius: 8px;
374
+ }
330
375
  .ui\:rounded-\[10px\] {
331
376
  border-radius: 10px;
332
377
  }
@@ -336,6 +381,9 @@
336
381
  .ui\:rounded-\[14px\] {
337
382
  border-radius: 14px;
338
383
  }
384
+ .ui\:rounded-full {
385
+ border-radius: calc(infinity * 1px);
386
+ }
339
387
  .ui\:border {
340
388
  border-style: var(--tw-border-style);
341
389
  border-width: 1px;
@@ -355,24 +403,48 @@
355
403
  .ui\:bg-blue-50 {
356
404
  background-color: var(--ui-color-blue-50);
357
405
  }
406
+ .ui\:bg-blue-100 {
407
+ background-color: var(--ui-color-blue-100);
408
+ }
358
409
  .ui\:bg-blue-300 {
359
410
  background-color: var(--ui-color-blue-300);
360
411
  }
361
412
  .ui\:bg-blue-600 {
362
413
  background-color: var(--ui-color-blue-600);
363
414
  }
415
+ .ui\:bg-blue-700 {
416
+ background-color: var(--ui-color-blue-700);
417
+ }
418
+ .ui\:bg-gray-50 {
419
+ background-color: var(--ui-color-gray-50);
420
+ }
364
421
  .ui\:bg-gray-100 {
365
422
  background-color: var(--ui-color-gray-100);
366
423
  }
424
+ .ui\:bg-gray-200 {
425
+ background-color: var(--ui-color-gray-200);
426
+ }
367
427
  .ui\:bg-gray-400 {
368
428
  background-color: var(--ui-color-gray-400);
369
429
  }
430
+ .ui\:bg-gray-700 {
431
+ background-color: var(--ui-color-gray-700);
432
+ }
370
433
  .ui\:bg-gray-800 {
371
434
  background-color: var(--ui-color-gray-800);
372
435
  }
436
+ .ui\:bg-white {
437
+ background-color: var(--ui-color-white);
438
+ }
439
+ .ui\:px-\[10px\] {
440
+ padding-inline: 10px;
441
+ }
373
442
  .ui\:px-\[14px\] {
374
443
  padding-inline: 14px;
375
444
  }
445
+ .ui\:px-\[18px\] {
446
+ padding-inline: 18px;
447
+ }
376
448
  .ui\:px-\[20px\] {
377
449
  padding-inline: 20px;
378
450
  }
@@ -382,9 +454,18 @@
382
454
  .ui\:py-1 {
383
455
  padding-block: calc(var(--ui-spacing) * 1);
384
456
  }
457
+ .ui\:py-\[4\.5px\] {
458
+ padding-block: 4.5px;
459
+ }
460
+ .ui\:py-\[7px\] {
461
+ padding-block: 7px;
462
+ }
385
463
  .ui\:py-\[8px\] {
386
464
  padding-block: 8px;
387
465
  }
466
+ .ui\:py-\[9px\] {
467
+ padding-block: 9px;
468
+ }
388
469
  .ui\:py-\[10px\] {
389
470
  padding-block: 10px;
390
471
  }
@@ -526,6 +607,12 @@
526
607
  .ui\:text-blue-700 {
527
608
  color: var(--ui-color-blue-700);
528
609
  }
610
+ .ui\:text-blue-800 {
611
+ color: var(--ui-color-blue-800);
612
+ }
613
+ .ui\:text-gray-200 {
614
+ color: var(--ui-color-gray-200);
615
+ }
529
616
  .ui\:text-gray-300 {
530
617
  color: var(--ui-color-gray-300);
531
618
  }
@@ -538,14 +625,30 @@
538
625
  .ui\:text-gray-700 {
539
626
  color: var(--ui-color-gray-700);
540
627
  }
628
+ .ui\:text-gray-800 {
629
+ color: var(--ui-color-gray-800);
630
+ }
541
631
  .ui\:text-white {
542
632
  color: var(--ui-color-white);
543
633
  }
634
+ .ui\:ring-0 {
635
+ --tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);
636
+ box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
637
+ }
544
638
  .ui\:transition-colors {
545
639
  transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to;
546
640
  transition-timing-function: var(--tw-ease, var(--ui-default-transition-timing-function));
547
641
  transition-duration: var(--tw-duration, var(--ui-default-transition-duration));
548
642
  }
643
+ .ui\:transition-transform {
644
+ transition-property: transform, translate, scale, rotate;
645
+ transition-timing-function: var(--tw-ease, var(--ui-default-transition-timing-function));
646
+ transition-duration: var(--tw-duration, var(--ui-default-transition-duration));
647
+ }
648
+ .ui\:duration-100 {
649
+ --tw-duration: 100ms;
650
+ transition-duration: 100ms;
651
+ }
549
652
  .ui\:duration-300 {
550
653
  --tw-duration: 300ms;
551
654
  transition-duration: 300ms;
@@ -761,11 +864,91 @@
761
864
  }
762
865
  }
763
866
  @layer utilities;
867
+ @property --tw-translate-x {
868
+ syntax: "*";
869
+ inherits: false;
870
+ initial-value: 0;
871
+ }
872
+ @property --tw-translate-y {
873
+ syntax: "*";
874
+ inherits: false;
875
+ initial-value: 0;
876
+ }
877
+ @property --tw-translate-z {
878
+ syntax: "*";
879
+ inherits: false;
880
+ initial-value: 0;
881
+ }
764
882
  @property --tw-border-style {
765
883
  syntax: "*";
766
884
  inherits: false;
767
885
  initial-value: solid;
768
886
  }
887
+ @property --tw-shadow {
888
+ syntax: "*";
889
+ inherits: false;
890
+ initial-value: 0 0 #0000;
891
+ }
892
+ @property --tw-shadow-color {
893
+ syntax: "*";
894
+ inherits: false;
895
+ }
896
+ @property --tw-shadow-alpha {
897
+ syntax: "<percentage>";
898
+ inherits: false;
899
+ initial-value: 100%;
900
+ }
901
+ @property --tw-inset-shadow {
902
+ syntax: "*";
903
+ inherits: false;
904
+ initial-value: 0 0 #0000;
905
+ }
906
+ @property --tw-inset-shadow-color {
907
+ syntax: "*";
908
+ inherits: false;
909
+ }
910
+ @property --tw-inset-shadow-alpha {
911
+ syntax: "<percentage>";
912
+ inherits: false;
913
+ initial-value: 100%;
914
+ }
915
+ @property --tw-ring-color {
916
+ syntax: "*";
917
+ inherits: false;
918
+ }
919
+ @property --tw-ring-shadow {
920
+ syntax: "*";
921
+ inherits: false;
922
+ initial-value: 0 0 #0000;
923
+ }
924
+ @property --tw-inset-ring-color {
925
+ syntax: "*";
926
+ inherits: false;
927
+ }
928
+ @property --tw-inset-ring-shadow {
929
+ syntax: "*";
930
+ inherits: false;
931
+ initial-value: 0 0 #0000;
932
+ }
933
+ @property --tw-ring-inset {
934
+ syntax: "*";
935
+ inherits: false;
936
+ }
937
+ @property --tw-ring-offset-width {
938
+ syntax: "<length>";
939
+ inherits: false;
940
+ initial-value: 0px;
941
+ }
942
+ @property --tw-ring-offset-color {
943
+ syntax: "*";
944
+ inherits: false;
945
+ initial-value: #fff;
946
+ }
947
+ @property --tw-ring-offset-shadow {
948
+ syntax: "*";
949
+ inherits: false;
950
+ initial-value: 0 0 #0000;
951
+ }
769
952
  @property --tw-duration {
770
953
  syntax: "*";
771
954
  inherits: false;
@@ -773,7 +956,24 @@
773
956
  @layer properties {
774
957
  @supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))) {
775
958
  *, ::before, ::after, ::backdrop {
959
+ --tw-translate-x: 0;
960
+ --tw-translate-y: 0;
961
+ --tw-translate-z: 0;
776
962
  --tw-border-style: solid;
963
+ --tw-shadow: 0 0 #0000;
964
+ --tw-shadow-color: initial;
965
+ --tw-shadow-alpha: 100%;
966
+ --tw-inset-shadow: 0 0 #0000;
967
+ --tw-inset-shadow-color: initial;
968
+ --tw-inset-shadow-alpha: 100%;
969
+ --tw-ring-color: initial;
970
+ --tw-ring-shadow: 0 0 #0000;
971
+ --tw-inset-ring-color: initial;
972
+ --tw-inset-ring-shadow: 0 0 #0000;
973
+ --tw-ring-inset: initial;
974
+ --tw-ring-offset-width: 0px;
975
+ --tw-ring-offset-color: #fff;
976
+ --tw-ring-offset-shadow: 0 0 #0000;
777
977
  --tw-duration: initial;
778
978
  }
779
979
  }
package/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
1
  export * from "./components/Button";
2
+ export * from "./components/Chip";
3
+ export * from "./components/Toggle";
2
4
  export * from "./components/Icons";
3
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,qBAAqB,CAAC;AAGpC,cAAc,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AAGpC,cAAc,oBAAoB,CAAC"}
package/dist/index.js CHANGED
@@ -16,5 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  /* ------------------------------- COMPONENTS ------------------------------- */
18
18
  __exportStar(require("./components/Button"), exports);
19
+ __exportStar(require("./components/Chip"), exports);
20
+ __exportStar(require("./components/Toggle"), exports);
19
21
  /* --------------------------------- ICONS ---------------------------------- */
20
22
  __exportStar(require("./components/Icons"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reitwagen/design-components",
3
- "version": "0.0.11",
3
+ "version": "0.2.0",
4
4
  "sideEffects": [
5
5
  "**/*.css"
6
6
  ],
@@ -32,6 +32,7 @@
32
32
  "devDependencies": {
33
33
  "@storybook/addon-docs": "^10.0.7",
34
34
  "@storybook/react": "^10.0.7",
35
+ "@storybook/test": "^8.6.14",
35
36
  "@svgr/core": "^8.1.0",
36
37
  "@svgr/plugin-jsx": "^8.1.0",
37
38
  "@svgr/plugin-prettier": "^8.1.0",
@@ -48,8 +49,8 @@
48
49
  "tailwindcss": "^4.1.5",
49
50
  "ts-node": "^10.9.2",
50
51
  "typescript": "5.9.2",
51
- "@reitwagen/tailwind-config": "0.0.0",
52
52
  "@reitwagen/eslint-config": "0.0.0",
53
+ "@reitwagen/tailwind-config": "0.0.0",
53
54
  "@reitwagen/typescript-config": "0.0.0"
54
55
  },
55
56
  "dependencies": {