@oneplatformdev/ui 0.1.99-beta.3 → 0.1.99-beta.5
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.
- package/Button/Button.d.ts +1 -7
- package/Button/Button.d.ts.map +1 -1
- package/Button/Button.js.map +1 -1
- package/Button/Button.stories.js +45 -53
- package/Button/Button.stories.js.map +1 -1
- package/Button/Button.types.d.ts +2 -1
- package/Button/Button.types.d.ts.map +1 -1
- package/ButtonIcon/ButtonIcon.d.ts +26 -20
- package/ButtonIcon/ButtonIcon.d.ts.map +1 -1
- package/ButtonIcon/ButtonIcon.js +44 -40
- package/ButtonIcon/ButtonIcon.js.map +1 -1
- package/ButtonIcon/ButtonIcon.stories.js +89 -73
- package/ButtonIcon/ButtonIcon.stories.js.map +1 -1
- package/ButtonIcon/ButtonIcon.types.d.ts +2 -1
- package/ButtonIcon/ButtonIcon.types.d.ts.map +1 -1
- package/CHANGELOG.md +16 -0
- package/Input/Input.js +2 -2
- package/Input/Input.js.map +1 -1
- package/package.json +7 -4
- package/Button/Button.s.d.ts +0 -83
- package/Button/Button.s.d.ts.map +0 -1
- package/Button/Button.s.js +0 -163
- package/Button/Button.s.js.map +0 -1
|
@@ -1,35 +1,12 @@
|
|
|
1
|
-
import { jsx as o, jsxs as
|
|
2
|
-
import { ButtonIcon as
|
|
3
|
-
import { PlusIcon as
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { jsx as o, jsxs as i } from "react/jsx-runtime";
|
|
2
|
+
import { ButtonIcon as c } from "./ButtonIcon.js";
|
|
3
|
+
import { FileDownIcon as r, Trash2Icon as l, PlusIcon as t } from "lucide-react";
|
|
4
|
+
import { DashedWrapper as u } from "../.storybook/Wrappers.js";
|
|
5
|
+
const h = (e) => /* @__PURE__ */ o(c, { ...e });
|
|
6
|
+
h.args = {
|
|
6
7
|
onClick: { action: (e) => e }
|
|
7
8
|
};
|
|
8
|
-
const
|
|
9
|
-
"div",
|
|
10
|
-
{
|
|
11
|
-
style: {
|
|
12
|
-
padding: "0px 20px",
|
|
13
|
-
display: "flex",
|
|
14
|
-
gap: "32px",
|
|
15
|
-
alignItems: "flex-start"
|
|
16
|
-
},
|
|
17
|
-
children: /* @__PURE__ */ o(
|
|
18
|
-
"div",
|
|
19
|
-
{
|
|
20
|
-
style: {
|
|
21
|
-
position: "relative",
|
|
22
|
-
border: "2px dashed rgba(139, 92, 246, 0.7)",
|
|
23
|
-
borderRadius: "24px",
|
|
24
|
-
padding: "24px 32px",
|
|
25
|
-
display: "flex",
|
|
26
|
-
gap: "32px"
|
|
27
|
-
},
|
|
28
|
-
children: e.children
|
|
29
|
-
}
|
|
30
|
-
)
|
|
31
|
-
}
|
|
32
|
-
), t = (e) => /* @__PURE__ */ o(
|
|
9
|
+
const n = (e) => /* @__PURE__ */ o(
|
|
33
10
|
"div",
|
|
34
11
|
{
|
|
35
12
|
style: {
|
|
@@ -39,7 +16,7 @@ const p = (e) => /* @__PURE__ */ o(
|
|
|
39
16
|
gap: "16px"
|
|
40
17
|
},
|
|
41
18
|
children: ["default", "hover", "focus", "active", "disabled"].map((a) => /* @__PURE__ */ o(
|
|
42
|
-
|
|
19
|
+
c,
|
|
43
20
|
{
|
|
44
21
|
id: a,
|
|
45
22
|
...e,
|
|
@@ -49,57 +26,76 @@ const p = (e) => /* @__PURE__ */ o(
|
|
|
49
26
|
a
|
|
50
27
|
))
|
|
51
28
|
}
|
|
52
|
-
),
|
|
53
|
-
/* @__PURE__ */
|
|
54
|
-
/* @__PURE__ */ o(
|
|
55
|
-
/* @__PURE__ */ o(
|
|
56
|
-
/* @__PURE__ */ o(
|
|
29
|
+
), s = (e) => /* @__PURE__ */ i("div", { className: "flex", children: [
|
|
30
|
+
/* @__PURE__ */ i(u, { children: [
|
|
31
|
+
/* @__PURE__ */ o(n, { ...e, variant: "contained" }),
|
|
32
|
+
/* @__PURE__ */ o(n, { ...e, variant: "outlined" }),
|
|
33
|
+
/* @__PURE__ */ o(n, { ...e, variant: "ghost" })
|
|
57
34
|
] }),
|
|
58
|
-
/* @__PURE__ */
|
|
59
|
-
/* @__PURE__ */ o(
|
|
60
|
-
/* @__PURE__ */ o(
|
|
61
|
-
/* @__PURE__ */ o(
|
|
35
|
+
/* @__PURE__ */ i(u, { children: [
|
|
36
|
+
/* @__PURE__ */ o(n, { ...e, variant: "contained", rounded: !0 }),
|
|
37
|
+
/* @__PURE__ */ o(n, { ...e, variant: "outlined", rounded: !0 }),
|
|
38
|
+
/* @__PURE__ */ o(n, { ...e, variant: "ghost", rounded: !0 })
|
|
62
39
|
] })
|
|
63
|
-
] }),
|
|
40
|
+
] }), p = ["contained", "outlined", "ghost"], m = ["primary", "secondary", "error"], f = ["xs", "sm", "md", "lg"], y = "contained", I = "primary", B = "lg", g = {
|
|
41
|
+
undefined: void 0,
|
|
42
|
+
"<PlusIcon />": /* @__PURE__ */ o(t, {}),
|
|
43
|
+
"<Trash2Icon />": /* @__PURE__ */ o(l, {}),
|
|
44
|
+
"<FileDownIcon />": /* @__PURE__ */ o(r, {}),
|
|
45
|
+
PlusIcon: t,
|
|
46
|
+
Trash2Icon: l,
|
|
47
|
+
FileDownIcon: r
|
|
48
|
+
}, v = {
|
|
49
|
+
"<PlusIcon />": /* @__PURE__ */ o(t, {}),
|
|
50
|
+
"<Trash2Icon />": /* @__PURE__ */ o(l, {}),
|
|
51
|
+
"<FileDownIcon />": /* @__PURE__ */ o(r, {})
|
|
52
|
+
}, b = {
|
|
64
53
|
title: "ButtonIcon",
|
|
65
|
-
component:
|
|
66
|
-
render:
|
|
54
|
+
component: c,
|
|
55
|
+
render: h,
|
|
67
56
|
args: {
|
|
68
57
|
asChild: !1,
|
|
69
58
|
disabled: !1,
|
|
70
59
|
loading: !1,
|
|
71
60
|
rounded: !1,
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
61
|
+
variant: y,
|
|
62
|
+
color: I,
|
|
63
|
+
size: B,
|
|
64
|
+
children: /* @__PURE__ */ o(t, {}),
|
|
65
|
+
icon: void 0,
|
|
66
|
+
message: void 0,
|
|
67
|
+
title: void 0
|
|
77
68
|
},
|
|
78
69
|
argTypes: {
|
|
70
|
+
tooltip: {
|
|
71
|
+
name: "tooltip",
|
|
72
|
+
description: "ButtonIcon tooltip from ButtonIconProps [deprecated, use title and message instead]",
|
|
73
|
+
control: !1
|
|
74
|
+
},
|
|
79
75
|
asChild: {
|
|
80
76
|
name: "asChild",
|
|
81
|
-
description: "ButtonIcon asChild",
|
|
77
|
+
description: "ButtonIcon asChild from ButtonIconProps [boolean]",
|
|
82
78
|
control: !1
|
|
83
79
|
},
|
|
84
80
|
variant: {
|
|
85
81
|
name: "variant",
|
|
86
82
|
description: "ButtonIcon variant",
|
|
87
|
-
defaultValue:
|
|
88
|
-
options:
|
|
83
|
+
defaultValue: p[0],
|
|
84
|
+
options: p,
|
|
89
85
|
control: { type: "inline-radio" }
|
|
90
86
|
},
|
|
91
87
|
color: {
|
|
92
88
|
name: "color",
|
|
93
89
|
description: "ButtonIcon color",
|
|
94
|
-
defaultValue:
|
|
95
|
-
options:
|
|
90
|
+
defaultValue: m[0],
|
|
91
|
+
options: m,
|
|
96
92
|
control: { type: "inline-radio" }
|
|
97
93
|
},
|
|
98
94
|
size: {
|
|
99
95
|
name: "size",
|
|
100
96
|
description: "ButtonIcon size",
|
|
101
|
-
defaultValue:
|
|
102
|
-
options:
|
|
97
|
+
defaultValue: f[0],
|
|
98
|
+
options: f,
|
|
103
99
|
control: { type: "inline-radio" }
|
|
104
100
|
},
|
|
105
101
|
title: {
|
|
@@ -126,6 +122,20 @@ const p = (e) => /* @__PURE__ */ o(
|
|
|
126
122
|
name: "loading",
|
|
127
123
|
description: "ButtonIcon loading",
|
|
128
124
|
control: { type: "boolean" }
|
|
125
|
+
},
|
|
126
|
+
icon: {
|
|
127
|
+
name: "icon",
|
|
128
|
+
description: "ButtonIcon icon from ButtonIconProps [`undefined` | `ComponentType<SVGProps<SVGSVGElement>>` | `ReactElement<SVGProps<SVGSVGElement>>`]",
|
|
129
|
+
options: Object.keys(g),
|
|
130
|
+
mapping: g,
|
|
131
|
+
control: { type: "inline-radio" }
|
|
132
|
+
},
|
|
133
|
+
children: {
|
|
134
|
+
name: "children",
|
|
135
|
+
description: "ButtonIcon children from ButtonIconProps [`ReactNode`]",
|
|
136
|
+
options: Object.keys(v),
|
|
137
|
+
mapping: v,
|
|
138
|
+
control: { type: "inline-radio" }
|
|
129
139
|
}
|
|
130
140
|
},
|
|
131
141
|
parameters: {
|
|
@@ -136,15 +146,21 @@ const p = (e) => /* @__PURE__ */ o(
|
|
|
136
146
|
disabled: "#disabled"
|
|
137
147
|
}
|
|
138
148
|
}
|
|
139
|
-
},
|
|
149
|
+
}, d = {
|
|
140
150
|
asChild: !1,
|
|
141
151
|
disabled: !1,
|
|
142
152
|
loading: !1,
|
|
143
153
|
rounded: !1,
|
|
144
|
-
children: /* @__PURE__ */ o(
|
|
145
|
-
},
|
|
154
|
+
children: /* @__PURE__ */ o(t, {})
|
|
155
|
+
}, D = {
|
|
156
|
+
args: {
|
|
157
|
+
...b.args,
|
|
158
|
+
icon: r,
|
|
159
|
+
children: void 0
|
|
160
|
+
}
|
|
161
|
+
}, x = {
|
|
146
162
|
args: {
|
|
147
|
-
...
|
|
163
|
+
...d,
|
|
148
164
|
color: "primary",
|
|
149
165
|
size: "lg"
|
|
150
166
|
},
|
|
@@ -152,14 +168,14 @@ const p = (e) => /* @__PURE__ */ o(
|
|
|
152
168
|
variant: { control: !1 },
|
|
153
169
|
color: { control: !1 }
|
|
154
170
|
},
|
|
155
|
-
render:
|
|
171
|
+
render: s
|
|
156
172
|
};
|
|
157
|
-
|
|
173
|
+
x.parameters = {
|
|
158
174
|
controls: { exclude: ["variant", "color"] }
|
|
159
175
|
};
|
|
160
|
-
const
|
|
176
|
+
const P = {
|
|
161
177
|
args: {
|
|
162
|
-
...
|
|
178
|
+
...d,
|
|
163
179
|
color: "secondary",
|
|
164
180
|
size: "lg"
|
|
165
181
|
},
|
|
@@ -167,14 +183,14 @@ const g = {
|
|
|
167
183
|
variant: { control: !1 },
|
|
168
184
|
color: { control: !1 }
|
|
169
185
|
},
|
|
170
|
-
render:
|
|
186
|
+
render: s
|
|
171
187
|
};
|
|
172
|
-
|
|
188
|
+
P.parameters = {
|
|
173
189
|
controls: { exclude: ["variant", "color"] }
|
|
174
190
|
};
|
|
175
|
-
const
|
|
191
|
+
const T = {
|
|
176
192
|
args: {
|
|
177
|
-
...
|
|
193
|
+
...d,
|
|
178
194
|
color: "error",
|
|
179
195
|
size: "lg"
|
|
180
196
|
},
|
|
@@ -182,16 +198,16 @@ const v = {
|
|
|
182
198
|
variant: { control: !1 },
|
|
183
199
|
color: { control: !1 }
|
|
184
200
|
},
|
|
185
|
-
render:
|
|
201
|
+
render: s
|
|
186
202
|
};
|
|
187
|
-
|
|
203
|
+
T.parameters = {
|
|
188
204
|
controls: { exclude: ["variant", "color"] }
|
|
189
205
|
};
|
|
190
206
|
export {
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
207
|
+
D as Default,
|
|
208
|
+
T as Error,
|
|
209
|
+
x as Primary,
|
|
210
|
+
P as Secondary,
|
|
195
211
|
b as default
|
|
196
212
|
};
|
|
197
213
|
//# sourceMappingURL=ButtonIcon.stories.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonIcon.stories.js","sources":["../../src/ButtonIcon/ButtonIcon.stories.tsx"],"sourcesContent":["import type { Meta, StoryObj } from '@storybook/react';\n\nimport { ButtonIcon } from './ButtonIcon';\nimport type { ButtonIconProps } from './ButtonIcon.types';\nimport React, { PropsWithChildren } from 'react';\nimport { PlusIcon } from 'lucide-react'\n\nconst Template = (props: ButtonIconProps) => <ButtonIcon {...props}/>\nTemplate.args = {\n onClick: { action: (e: React.MouseEvent<HTMLButtonElement>) => e },\n};\n\nconst DashedWrapper = (props: PropsWithChildren) => {\n return (\n <div\n style={{\n padding: '0px 20px',\n display: 'flex',\n gap: '32px',\n alignItems: 'flex-start',\n }}\n >\n <div\n style={{\n position: 'relative',\n border: '2px dashed rgba(139, 92, 246, 0.7)',\n borderRadius: '24px',\n padding: '24px 32px',\n display: 'flex',\n gap: '32px',\n }}\n >\n {props.children}\n </div>\n </div>\n )\n}\n\nconst States = (props: ButtonIconProps) => (\n <div\n style={{\n position: 'relative',\n display: 'flex',\n flexDirection: 'column',\n gap: '16px',\n }}\n >\n {[ 'default', 'hover', 'focus', 'active', 'disabled' ]\n .map((state) => (\n <ButtonIcon\n key={state}\n id={state}\n {...props}\n disabled={state === 'disabled' || props.disabled}\n >\n {props.children}\n </ButtonIcon>\n ))}\n </div>\n);\n\nconst StateRender = (props: ButtonIconProps) => (\n <div className='flex'>\n <DashedWrapper>\n <States {...props} variant='contained'/>\n <States {...props} variant='outlined'/>\n <States {...props} variant='ghost'/>\n </DashedWrapper>\n <DashedWrapper>\n <States {...props} variant='contained' rounded/>\n <States {...props} variant='outlined' rounded/>\n <States {...props} variant='ghost' rounded/>\n </DashedWrapper>\n </div>\n);\n\nconst variants: ButtonIconProps['variant'][] = [ 'contained', 'outlined', 'ghost' ]\nconst colors: ButtonIconProps['color'][] = [ 'primary', 'secondary', 'error' ]\nconst sizes: ButtonIconProps['size'][] = [ 'xs', 'sm', 'md', 'lg' ]\n\nconst meta = {\n title: 'ButtonIcon',\n component: ButtonIcon,\n render: Template,\n args: {\n asChild: false,\n disabled: false,\n loading: false,\n rounded: false,\n children: <PlusIcon/>,\n variant: variants[0],\n color: colors[0],\n size: sizes[0],\n message: '',\n },\n argTypes: {\n asChild: {\n name: 'asChild',\n description: 'ButtonIcon asChild',\n control: false\n },\n variant: {\n name: 'variant',\n description: 'ButtonIcon variant',\n defaultValue: variants[0],\n options: variants,\n control: { type: 'inline-radio', },\n },\n color: {\n name: 'color',\n description: 'ButtonIcon color',\n defaultValue: colors[0],\n options: colors,\n control: { type: 'inline-radio' },\n },\n size: {\n name: 'size',\n description: 'ButtonIcon size',\n defaultValue: sizes[0],\n options: sizes,\n control: { type: 'inline-radio' },\n },\n title: {\n name: 'title',\n description: \"ButtonIcon tooltip title from HTMLAttributes<HTMLButtonElement> [string only]\",\n control: { type: 'text' },\n },\n message: {\n name: 'message',\n description: 'ButtonIcon tooltip message from ButtonProps [ReactNode]',\n control: { type: \"object\" },\n },\n disabled: {\n name: 'disabled',\n description: 'ButtonIcon disabled',\n control: { type: 'boolean' }\n },\n rounded: {\n name: 'rounded',\n description: 'ButtonIcon rounded',\n control: { type: 'boolean' }\n },\n loading: {\n name: 'loading',\n description: 'ButtonIcon loading',\n control: { type: 'boolean' }\n },\n },\n parameters: {\n pseudo: {\n hover: '#hover',\n focus: '#focus',\n active: '#active',\n disabled: '#disabled',\n },\n }\n} satisfies Meta<typeof ButtonIcon>;\n\nexport default meta;\n\ntype Story = StoryObj<typeof meta>;\nconst args: Story['args'] = {\n asChild: false,\n disabled: false,\n loading: false,\n rounded: false,\n children: <PlusIcon/>,\n}\n\nexport const Default: Story = { args };\n\nexport const Primary: Story = {\n args: {\n ...args,\n color: 'primary',\n size: 'lg',\n },\n argTypes: {\n variant: { control: false },\n color: { control: false },\n },\n render: StateRender,\n};\nPrimary.parameters = {\n controls: { exclude: [ 'variant', 'color' ] },\n}\n\nexport const Secondary: Story = {\n args: {\n ...args,\n color: 'secondary',\n size: 'lg',\n },\n argTypes: {\n variant: { control: false },\n color: { control: false },\n },\n render: StateRender,\n};\nSecondary.parameters = {\n controls: { exclude: [ 'variant', 'color' ] },\n}\n\nexport const Error: Story = {\n args: {\n ...args,\n color: 'error',\n size: 'lg',\n },\n argTypes: {\n variant: { control: false },\n color: { control: false },\n },\n render: StateRender,\n};\nError.parameters = {\n controls: { exclude: [ 'variant', 'color' ] },\n}\n"],"names":["Template","props","jsx","ButtonIcon","DashedWrapper","States","state","StateRender","jsxs","variants","colors","sizes","meta","PlusIcon","args","Default","Primary","Secondary","Error"],"mappings":";;;AAOA,MAA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A;AAC5C;AAEO,MAAMC,IAAmB;AAAA,EAC9B,MAAM;AAAA,IACJ,GAAGH;AAAA,IACH,OAAO;AAAA,IACP,MAAM;AAAA,EAAA;AAAA,EAER,UAAU;AAAA,IACR,SAAS,EAAE,SAAS,GAAA;AAAA,IACpB,OAAO,EAAE,SAAS,GAAA;AAAA,EAAM;AAAA,EAE1B,QAAQP;AACV;AACAU,EAAU,aAAa;AAAA,EACrB,UAAU,EAAE,SAAS,CAAE,WAAW,OAAQ,EAAA;AAC5C;AAEO,MAAMC,IAAe;AAAA,EAC1B,MAAM;AAAA,IACJ,GAAGJ;AAAA,IACH,OAAO;AAAA,IACP,MAAM;AAAA,EAAA;AAAA,EAER,UAAU;AAAA,IACR,SAAS,EAAE,SAAS,GAAA;AAAA,IACpB,OAAO,EAAE,SAAS,GAAA;AAAA,EAAM;AAAA,EAE1B,QAAQP;AACV;AACAW,EAAM,aAAa;AAAA,EACjB,UAAU,EAAE,SAAS,CAAE,WAAW,OAAQ,EAAA;AAC5C;"}
|
|
1
|
+
{"version":3,"file":"ButtonIcon.stories.js","sources":["../../src/ButtonIcon/ButtonIcon.stories.tsx"],"sourcesContent":["import type { Meta, StoryObj } from '@storybook/react';\n\nimport { ButtonIcon } from './ButtonIcon';\nimport type { ButtonIconProps } from './ButtonIcon.types';\nimport React from 'react';\nimport { FileDownIcon, PlusIcon, Trash2Icon } from 'lucide-react'\nimport { DashedWrapper } from \"../../.storybook/Wrappers\";\nimport { ButtonProps } from \"../Button\";\n\nconst Template = (props: ButtonIconProps) => <ButtonIcon {...props}/>\nTemplate.args = {\n onClick: { action: (e: React.MouseEvent<HTMLButtonElement>) => e },\n};\n\nconst States = (props: ButtonIconProps) => (\n <div\n style={{\n position: 'relative',\n display: 'flex',\n flexDirection: 'column',\n gap: '16px',\n }}\n >\n {[ 'default', 'hover', 'focus', 'active', 'disabled' ]\n .map((state) => (\n <ButtonIcon\n key={state}\n id={state}\n {...props}\n disabled={state === 'disabled' || props.disabled}\n >\n {props.children}\n </ButtonIcon>\n ))}\n </div>\n);\n\nconst StateRender = (props: ButtonIconProps) => (\n <div className='flex'>\n <DashedWrapper>\n <States {...props} variant='contained'/>\n <States {...props} variant='outlined'/>\n <States {...props} variant='ghost'/>\n </DashedWrapper>\n <DashedWrapper>\n <States {...props} variant='contained' rounded/>\n <States {...props} variant='outlined' rounded/>\n <States {...props} variant='ghost' rounded/>\n </DashedWrapper>\n </div>\n);\n\nconst variants: ButtonIconProps['variant'][] = [ 'contained', 'outlined', 'ghost' ]\nconst colors: ButtonIconProps['color'][] = [ 'primary', 'secondary', 'error' ]\nconst sizes: ButtonIconProps['size'][] = [ 'xs', 'sm', 'md', 'lg' ]\n\nconst variant_default: ButtonProps['variant'] = 'contained';\nconst color_default: ButtonProps['color'] = 'primary';\nconst size_default: ButtonProps['size'] = 'lg';\n\nconst iconMap = {\n 'undefined': undefined,\n \"<PlusIcon />\": <PlusIcon/>,\n \"<Trash2Icon />\": <Trash2Icon/>,\n \"<FileDownIcon />\": <FileDownIcon/>,\n PlusIcon: PlusIcon,\n Trash2Icon: Trash2Icon,\n FileDownIcon: FileDownIcon,\n};\n\nconst iconChildrenMap = {\n \"<PlusIcon />\": <PlusIcon/>,\n \"<Trash2Icon />\": <Trash2Icon/>,\n \"<FileDownIcon />\": <FileDownIcon/>,\n};\n\nconst meta = {\n title: 'ButtonIcon',\n component: ButtonIcon,\n render: Template,\n args: {\n asChild: false,\n disabled: false,\n loading: false,\n rounded: false,\n variant: variant_default,\n color: color_default,\n size: size_default,\n children: <PlusIcon/>,\n icon: undefined,\n message: undefined,\n title: undefined,\n },\n argTypes: {\n tooltip: {\n name: 'tooltip',\n description: 'ButtonIcon tooltip from ButtonIconProps [deprecated, use title and message instead]',\n control: false,\n },\n asChild: {\n name: 'asChild',\n description: 'ButtonIcon asChild from ButtonIconProps [boolean]',\n control: false\n },\n variant: {\n name: 'variant',\n description: 'ButtonIcon variant',\n defaultValue: variants[0],\n options: variants,\n control: { type: 'inline-radio', },\n },\n color: {\n name: 'color',\n description: 'ButtonIcon color',\n defaultValue: colors[0],\n options: colors,\n control: { type: 'inline-radio' },\n },\n size: {\n name: 'size',\n description: 'ButtonIcon size',\n defaultValue: sizes[0],\n options: sizes,\n control: { type: 'inline-radio' },\n },\n title: {\n name: 'title',\n description: \"ButtonIcon tooltip title from HTMLAttributes<HTMLButtonElement> [string only]\",\n control: { type: 'text' },\n },\n message: {\n name: 'message',\n description: 'ButtonIcon tooltip message from ButtonProps [ReactNode]',\n control: { type: \"object\" },\n },\n disabled: {\n name: 'disabled',\n description: 'ButtonIcon disabled',\n control: { type: 'boolean' }\n },\n rounded: {\n name: 'rounded',\n description: 'ButtonIcon rounded',\n control: { type: 'boolean' }\n },\n loading: {\n name: 'loading',\n description: 'ButtonIcon loading',\n control: { type: 'boolean' }\n },\n icon: {\n name: 'icon',\n description: 'ButtonIcon icon from ButtonIconProps [`undefined` | `ComponentType<SVGProps<SVGSVGElement>>` | `ReactElement<SVGProps<SVGSVGElement>>`]',\n options: Object.keys(iconMap),\n mapping: iconMap,\n control: { type: 'inline-radio' },\n },\n children: {\n name: 'children',\n description: 'ButtonIcon children from ButtonIconProps [`ReactNode`]',\n options: Object.keys(iconChildrenMap),\n mapping: iconChildrenMap,\n control: { type: 'inline-radio' },\n },\n },\n parameters: {\n pseudo: {\n hover: '#hover',\n focus: '#focus',\n active: '#active',\n disabled: '#disabled',\n },\n }\n} satisfies Meta<typeof ButtonIcon>;\n\nexport default meta;\n\ntype Story = StoryObj<typeof meta>;\nconst args: Story['args'] = {\n asChild: false,\n disabled: false,\n loading: false,\n rounded: false,\n children: <PlusIcon/>,\n}\n\nexport const Default: Story = {\n args: {\n ...meta.args,\n icon: FileDownIcon,\n children: undefined,\n }\n};\n\nexport const Primary: Story = {\n args: {\n ...args,\n color: 'primary',\n size: 'lg',\n },\n argTypes: {\n variant: { control: false },\n color: { control: false },\n },\n render: StateRender,\n};\nPrimary.parameters = {\n controls: { exclude: [ 'variant', 'color' ] },\n}\n\nexport const Secondary: Story = {\n args: {\n ...args,\n color: 'secondary',\n size: 'lg',\n },\n argTypes: {\n variant: { control: false },\n color: { control: false },\n },\n render: StateRender,\n};\nSecondary.parameters = {\n controls: { exclude: [ 'variant', 'color' ] },\n}\n\nexport const Error: Story = {\n args: {\n ...args,\n color: 'error',\n size: 'lg',\n },\n argTypes: {\n variant: { control: false },\n color: { control: false },\n },\n render: StateRender,\n};\nError.parameters = {\n controls: { exclude: [ 'variant', 'color' ] },\n}\n"],"names":["Template","props","jsx","ButtonIcon","States","state","StateRender","jsxs","DashedWrapper","variants","colors","sizes","variant_default","color_default","size_default","iconMap","PlusIcon","Trash2Icon","FileDownIcon","iconChildrenMap","meta","args","Default","Primary","Secondary","Error"],"mappings":";;;;AASA,MAAMA,IAAW,CAACC,MAA2B,gBAAAC,EAACC,GAAA,EAAY,GAAGF,GAAM;AACnED,EAAS,OAAO;AAAA,EACd,SAAS,EAAE,QAAQ,CAAC,MAA2C,EAAA;AACjE;AAEA,MAAMI,IAAS,CAACH,MACd,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,OAAO;AAAA,MACL,UAAU;AAAA,MACV,SAAS;AAAA,MACT,eAAe;AAAA,MACf,KAAK;AAAA,IAAA;AAAA,IAGN,UAAA,CAAE,WAAW,SAAS,SAAS,UAAU,UAAW,EAClD,IAAI,CAACG,MACJ,gBAAAH;AAAA,MAACC;AAAA,MAAA;AAAA,QAEC,IAAIE;AAAA,QACH,GAAGJ;AAAA,QACJ,UAAUI,MAAU,cAAcJ,EAAM;AAAA,QAEvC,UAAAA,EAAM;AAAA,MAAA;AAAA,MALFI;AAAA,IAAA,CAOR;AAAA,EAAA;AACL,GAGIC,IAAc,CAACL,MACnB,gBAAAM,EAAC,OAAA,EAAI,WAAU,QACb,UAAA;AAAA,EAAA,gBAAAA,EAACC,GAAA,EACC,UAAA;AAAA,IAAA,gBAAAN,EAACE,GAAA,EAAQ,GAAGH,GAAO,SAAQ,Y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MAAMC,IAAe;AAAA,EAC1B,MAAM;AAAA,IACJ,GAAGJ;AAAA,IACH,OAAO;AAAA,IACP,MAAM;AAAA,EAAA;AAAA,EAER,UAAU;AAAA,IACR,SAAS,EAAE,SAAS,GAAA;AAAA,IACpB,OAAO,EAAE,SAAS,GAAA;AAAA,EAAM;AAAA,EAE1B,QAAQf;AACV;AACAmB,EAAM,aAAa;AAAA,EACjB,UAAU,EAAE,SAAS,CAAE,WAAW,OAAQ,EAAA;AAC5C;"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { ButtonIconVarianceProps } from './buttonIconVariants';
|
|
2
|
-
import { ButtonBaseProps } from '../Button';
|
|
2
|
+
import { ButtonBaseProps, ButtonIconType } from '../Button';
|
|
3
3
|
export interface ButtonIconSlotProps {
|
|
4
4
|
}
|
|
5
5
|
export interface ButtonIconProps extends ButtonBaseProps<ButtonIconVarianceProps, ButtonIconSlotProps> {
|
|
6
|
+
icon?: ButtonIconType;
|
|
6
7
|
}
|
|
7
8
|
//# sourceMappingURL=ButtonIcon.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonIcon.types.d.ts","sourceRoot":"","sources":["../../src/ButtonIcon/ButtonIcon.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EACL,KAAK,eAAe,
|
|
1
|
+
{"version":3,"file":"ButtonIcon.types.d.ts","sourceRoot":"","sources":["../../src/ButtonIcon/ButtonIcon.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,cAAc,EACpB,MAAM,WAAW,CAAC;AAEnB,MAAM,WAAW,mBAAmB;CAAG;AAEvC,MAAM,WAAW,eACf,SAAQ,eAAe,CAAC,uBAAuB,EAAE,mBAAmB,CAAC;IACrE,IAAI,CAAC,EAAE,cAAc,CAAC;CACvB"}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
## 0.1.99-beta.5 (2025-12-29)
|
|
2
|
+
|
|
3
|
+
### 🧱 Updated Dependencies
|
|
4
|
+
|
|
5
|
+
- Updated @oneplatformdev/utils to 0.1.99-beta.5
|
|
6
|
+
- Updated @oneplatformdev/hooks to 0.1.99-beta.5
|
|
7
|
+
- Updated @oneplatformdev/tokens to 0.1.99-beta.5
|
|
8
|
+
|
|
9
|
+
## 0.1.99-beta.4 (2025-12-29)
|
|
10
|
+
|
|
11
|
+
### 🧱 Updated Dependencies
|
|
12
|
+
|
|
13
|
+
- Updated @oneplatformdev/utils to 0.1.99-beta.4
|
|
14
|
+
- Updated @oneplatformdev/hooks to 0.1.99-beta.4
|
|
15
|
+
- Updated @oneplatformdev/tokens to 0.1.99-beta.4
|
|
16
|
+
|
|
1
17
|
## 0.1.99-beta.3 (2025-12-29)
|
|
2
18
|
|
|
3
19
|
### 🚀 Features
|
package/Input/Input.js
CHANGED
package/Input/Input.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.js","sources":["../../src/Input/Input.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport { Eye, EyeOff } from 'lucide-react';\nimport { inputVariants } from './inputVariants';\n\nimport { cn } from '@oneplatformdev/utils';\nimport { InputProps } from './Input.types';\n\nexport const BaseInput = React.forwardRef<HTMLInputElement, InputProps>(\n (props, ref) => {\n const {\n className,\n variant,\n type,\n slotProps: { input, wrapper } = {},\n onChange,\n onTransform,\n fullSize = false,\n ...rest\n } = props;\n const {\n startAdornment,\n className: classNameInputSlotProps,\n ...restInputSlotProps\n } = input || {};\n return (\n <div\n {...(wrapper || {})}\n className={cn(\n 'relative',\n fullSize && 'w-full',\n wrapper?.className\n )}>\n {Boolean(startAdornment) && (\n <span className=\"absolute left-[10px] top-1/2 -translate-y-1/2\">\n {startAdornment}\n </span>\n )}\n <input\n type={type}\n className={cn(\n inputVariants({ variant, className }),\n
|
|
1
|
+
{"version":3,"file":"Input.js","sources":["../../src/Input/Input.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport { Eye, EyeOff } from 'lucide-react';\nimport { inputVariants } from './inputVariants';\n\nimport { cn } from '@oneplatformdev/utils';\nimport { InputProps } from './Input.types';\n\nexport const BaseInput = React.forwardRef<HTMLInputElement, InputProps>(\n (props, ref) => {\n const {\n className,\n variant,\n type,\n slotProps: { input, wrapper } = {},\n onChange,\n onTransform,\n fullSize = false,\n ...rest\n } = props;\n const {\n startAdornment,\n className: classNameInputSlotProps,\n ...restInputSlotProps\n } = input || {};\n return (\n <div\n {...(wrapper || {})}\n className={cn(\n 'relative',\n fullSize && 'w-full',\n wrapper?.className\n )}>\n {Boolean(startAdornment) && (\n <span className=\"absolute left-[10px] top-1/2 -translate-y-1/2\">\n {startAdornment}\n </span>\n )}\n <input\n type={type}\n className={cn(\n inputVariants({ variant, className }),\n Boolean(startAdornment) && 'pl-8',\n classNameInputSlotProps,\n fullSize && 'min-w-auto',\n )}\n ref={ref}\n {...restInputSlotProps}\n {...rest}\n onChange={(e) => {\n if (typeof onTransform?.(e.target.value, e) === 'string') {\n e.target.value = onTransform(e.target.value, e);\n }\n if (onChange) onChange(e);\n }}\n />\n </div>\n );\n }\n);\nBaseInput.displayName = 'Input';\n\nexport const PasswordInput = React.forwardRef<HTMLInputElement, InputProps>(\n (props, ref) => {\n const [isVisible, setIsVisible] = useState<boolean>(false);\n\n const inputType = isVisible ? 'text' : 'password';\n\n const toggleVisibility = () => {\n setIsVisible(!isVisible);\n };\n\n return (\n <div {...(props?.slotProps?.wrapper || {})} className={cn('relative', props?.slotProps?.wrapper?.className)}>\n <BaseInput {...props} type={inputType} className=\"pr-8\" ref={ref} />\n <VisibilityButton isVisible={isVisible} onClick={toggleVisibility} />\n </div>\n );\n }\n);\nPasswordInput.displayName = 'PasswordInput';\n\ntype VisibilityButtonProps = {\n isVisible: boolean\n onClick: () => void\n}\n\nconst VisibilityButton = ({ isVisible, onClick }:VisibilityButtonProps) => (\n <button\n type=\"button\"\n onClick={onClick}\n className=\"absolute top-1/2 right-3 transform -translate-y-1/2\"\n >\n {isVisible ? <Eye size={16} /> : <EyeOff size={16} />}\n </button>\n);\n\nexport const Input = React.forwardRef<HTMLInputElement, InputProps>(\n ({ type, ...props }, ref) => {\n if (type === 'password') return <PasswordInput type={type} {...props} ref={ref} />;\n return <BaseInput type={type} {...props} ref={ref} />;\n }\n);\nInput.displayName = 'Input';\n"],"names":["BaseInput","React","props","ref","className","variant","type","input","wrapper","onChange","onTransform","fullSize","rest","startAdornment","classNameInputSlotProps","restInputSlotProps","jsxs","cn","jsx","inputVariants","e","PasswordInput","isVisible","setIsVisible","useState","inputType","toggleVisibility","VisibilityButton","onClick","Eye","EyeOff","Input"],"mappings":";;;;;AAOO,MAAMA,IAAYC,EAAM;AAAA,EAC7B,CAACC,GAAOC,MAAQ;AACd,UAAM;AAAA,MACJ,WAAAC;AAAA,MACA,SAAAC;AAAA,MACA,MAAAC;AAAA,MACA,WAAW,EAAE,OAAAC,GAAO,SAAAC,EAAA,IAAY,CAAA;AAAA,MAChC,UAAAC;AAAA,MACA,aAAAC;AAAA,MACA,UAAAC,IAAW;AAAA,MACX,GAAGC;AAAA,IAAA,IACDV,GACE;AAAA,MACJ,gBAAAW;AAAA,MACA,WAAWC;AAAA,MACX,GAAGC;AAAA,IAAA,IACDR,KAAS,CAAA;AACb,WACE,gBAAAS;AAAA,MAAC;AAAA,MAAA;AAAA,QACE,GAAIR,KAAW,CAAA;AAAA,QAChB,WAAWS;AAAA,UACT;AAAA,UACAN,KAAY;AAAA,UACZH,GAAS;AAAA,QAAA;AAAA,QAEV,UAAA;AAAA,UAAA,EAAQK,KACP,gBAAAK,EAAC,QAAA,EAAK,WAAU,iDACb,UAAAL,GACH;AAAA,UAEF,gBAAAK;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,MAAAZ;AAAA,cAC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AX,EAACY,GAAA,EAAO,MAAM,GAAA,CAAI;AAAA,EAAA;AACrD,GAGWC,IAAQ9B,EAAM;AAAA,EACzB,CAAC,EAAE,MAAAK,GAAM,GAAGJ,EAAA,GAASC,MACfG,MAAS,aAAmB,gBAAAY,EAACG,KAAc,MAAAf,GAAa,GAAGJ,GAAO,KAAAC,GAAU,IACzE,gBAAAe,EAAClB,GAAA,EAAU,MAAAM,GAAa,GAAGJ,GAAO,KAAAC,GAAU;AAEvD;AACA4B,EAAM,cAAc;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oneplatformdev/ui",
|
|
3
|
-
"version": "0.1.99-beta.
|
|
3
|
+
"version": "0.1.99-beta.5",
|
|
4
4
|
"description": "UI component library for OnePlatform",
|
|
5
5
|
"author": "One Platform Development Team",
|
|
6
6
|
"keywords": [
|
|
@@ -105,8 +105,11 @@
|
|
|
105
105
|
"recharts": "^3.2.0",
|
|
106
106
|
"sonner": "^2.0.7",
|
|
107
107
|
"vaul": "^1.1.2",
|
|
108
|
-
"@oneplatformdev/tokens": "^0.1.99-beta.
|
|
109
|
-
"@oneplatformdev/utils": "^0.1.99-beta.
|
|
110
|
-
"@oneplatformdev/hooks": "^0.1.99-beta.
|
|
108
|
+
"@oneplatformdev/tokens": "^0.1.99-beta.5",
|
|
109
|
+
"@oneplatformdev/utils": "^0.1.99-beta.5",
|
|
110
|
+
"@oneplatformdev/hooks": "^0.1.99-beta.5"
|
|
111
|
+
},
|
|
112
|
+
"scripts": {
|
|
113
|
+
"chromatic": "chromatic"
|
|
111
114
|
}
|
|
112
115
|
}
|
package/Button/Button.s.d.ts
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { StoryObj } from '@storybook/react';
|
|
2
|
-
import { ButtonProps } from './Button.types';
|
|
3
|
-
declare const meta: {
|
|
4
|
-
title: string;
|
|
5
|
-
component: import('react').ForwardRefExoticComponent<ButtonProps & import('react').RefAttributes<HTMLButtonElement>>;
|
|
6
|
-
render: (props: ButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
args: {
|
|
8
|
-
tooltip: undefined;
|
|
9
|
-
asChild: false;
|
|
10
|
-
variant: "none" | "default" | "destructive" | "outline" | "secondary" | "contained" | "outlined" | "ghost" | null | undefined;
|
|
11
|
-
color: "secondary" | "primary" | "error" | null | undefined;
|
|
12
|
-
size: "xs" | "sm" | "md" | "lg" | null | undefined;
|
|
13
|
-
disabled: false;
|
|
14
|
-
};
|
|
15
|
-
argTypes: {
|
|
16
|
-
tooltip: {
|
|
17
|
-
control: false;
|
|
18
|
-
};
|
|
19
|
-
asChild: {
|
|
20
|
-
control: false;
|
|
21
|
-
};
|
|
22
|
-
variant: {
|
|
23
|
-
options: ("none" | "default" | "destructive" | "outline" | "secondary" | "contained" | "outlined" | "ghost" | null | undefined)[];
|
|
24
|
-
control: {
|
|
25
|
-
type: "inline-radio";
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
color: {
|
|
29
|
-
options: ("secondary" | "primary" | "error" | null | undefined)[];
|
|
30
|
-
control: {
|
|
31
|
-
type: "inline-radio";
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
size: {
|
|
35
|
-
options: ("xs" | "sm" | "md" | "lg" | null | undefined)[];
|
|
36
|
-
control: {
|
|
37
|
-
type: "inline-radio";
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
|
-
title: {
|
|
41
|
-
name: string;
|
|
42
|
-
description: string;
|
|
43
|
-
control: {
|
|
44
|
-
type: "text";
|
|
45
|
-
};
|
|
46
|
-
};
|
|
47
|
-
message: {
|
|
48
|
-
name: string;
|
|
49
|
-
description: string;
|
|
50
|
-
control: {
|
|
51
|
-
type: "object";
|
|
52
|
-
};
|
|
53
|
-
};
|
|
54
|
-
slotProps: {
|
|
55
|
-
name: string;
|
|
56
|
-
description: string;
|
|
57
|
-
control: {
|
|
58
|
-
type: "object";
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
};
|
|
62
|
-
tags: string[];
|
|
63
|
-
parameters: {
|
|
64
|
-
docs: {
|
|
65
|
-
description: {
|
|
66
|
-
component: string;
|
|
67
|
-
};
|
|
68
|
-
};
|
|
69
|
-
pseudo: {
|
|
70
|
-
hover: string;
|
|
71
|
-
focus: string;
|
|
72
|
-
active: string;
|
|
73
|
-
disabled: string;
|
|
74
|
-
};
|
|
75
|
-
};
|
|
76
|
-
};
|
|
77
|
-
export default meta;
|
|
78
|
-
type Story = StoryObj<typeof meta>;
|
|
79
|
-
export declare const Default: Story;
|
|
80
|
-
export declare const Primary: Story;
|
|
81
|
-
export declare const Secondary: Story;
|
|
82
|
-
export declare const Error: Story;
|
|
83
|
-
//# sourceMappingURL=Button.s.d.ts.map
|
package/Button/Button.s.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Button.s.d.ts","sourceRoot":"","sources":["../../src/Button/Button.s.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAGvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AA2DlD,QAAA,MAAM,IAAI;;;oBAvDe,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwGL,CAAC;AAChC,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAQnC,eAAO,MAAM,OAAO,EAAE,KAKrB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,KAoBrB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KAoBvB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KAoBnB,CAAC"}
|
package/Button/Button.s.js
DELETED
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
import { jsx as e, jsxs as n } from "react/jsx-runtime";
|
|
2
|
-
import { Button as i } from "./Button.js";
|
|
3
|
-
import { PlusIcon as s } from "lucide-react";
|
|
4
|
-
const g = (o) => /* @__PURE__ */ e(i, { ...o }), a = (o) => /* @__PURE__ */ e(
|
|
5
|
-
"div",
|
|
6
|
-
{
|
|
7
|
-
style: {
|
|
8
|
-
padding: "0px 20px",
|
|
9
|
-
display: "flex",
|
|
10
|
-
gap: "32px",
|
|
11
|
-
alignItems: "flex-start"
|
|
12
|
-
},
|
|
13
|
-
children: /* @__PURE__ */ e(
|
|
14
|
-
"div",
|
|
15
|
-
{
|
|
16
|
-
style: {
|
|
17
|
-
position: "relative",
|
|
18
|
-
border: "2px dashed rgba(139, 92, 246, 0.7)",
|
|
19
|
-
borderRadius: "24px",
|
|
20
|
-
padding: "24px 32px",
|
|
21
|
-
display: "flex",
|
|
22
|
-
gap: "32px"
|
|
23
|
-
},
|
|
24
|
-
children: o.children
|
|
25
|
-
}
|
|
26
|
-
)
|
|
27
|
-
}
|
|
28
|
-
), t = (o) => /* @__PURE__ */ e(
|
|
29
|
-
"div",
|
|
30
|
-
{
|
|
31
|
-
style: {
|
|
32
|
-
position: "relative",
|
|
33
|
-
display: "flex",
|
|
34
|
-
flexDirection: "column",
|
|
35
|
-
gap: "16px"
|
|
36
|
-
},
|
|
37
|
-
children: ["default", "hover", "focus", "active", "disabled"].map((r) => /* @__PURE__ */ e(
|
|
38
|
-
i,
|
|
39
|
-
{
|
|
40
|
-
id: r,
|
|
41
|
-
...o,
|
|
42
|
-
disabled: r === "disabled" || o.disabled,
|
|
43
|
-
children: o.children ?? r
|
|
44
|
-
},
|
|
45
|
-
r
|
|
46
|
-
))
|
|
47
|
-
}
|
|
48
|
-
), d = ["none", "contained", "outlined", "ghost"], c = ["primary", "secondary", "error"], p = ["xs", "sm", "md", "lg"], m = {
|
|
49
|
-
title: "Button",
|
|
50
|
-
component: i,
|
|
51
|
-
render: g,
|
|
52
|
-
args: {
|
|
53
|
-
tooltip: void 0,
|
|
54
|
-
asChild: !1,
|
|
55
|
-
//
|
|
56
|
-
variant: d[0],
|
|
57
|
-
color: c[0],
|
|
58
|
-
size: p[0],
|
|
59
|
-
disabled: !1
|
|
60
|
-
},
|
|
61
|
-
argTypes: {
|
|
62
|
-
tooltip: { control: !1 },
|
|
63
|
-
asChild: { control: !1 },
|
|
64
|
-
variant: { options: d, control: { type: "inline-radio" } },
|
|
65
|
-
color: { options: c, control: { type: "inline-radio" } },
|
|
66
|
-
size: { options: p, control: { type: "inline-radio" } },
|
|
67
|
-
title: {
|
|
68
|
-
name: "title",
|
|
69
|
-
description: "Button tooltip title from HTMLAttributes<HTMLButtonElement> [string only]",
|
|
70
|
-
control: { type: "text" }
|
|
71
|
-
},
|
|
72
|
-
message: {
|
|
73
|
-
name: "message",
|
|
74
|
-
description: "Button tooltip message from ButtonProps [ReactNode]",
|
|
75
|
-
control: { type: "object" }
|
|
76
|
-
},
|
|
77
|
-
slotProps: {
|
|
78
|
-
name: "slotProps",
|
|
79
|
-
description: "Button slotProps from ButtonProps [object]",
|
|
80
|
-
control: { type: "object" }
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
tags: ["autodocs"],
|
|
84
|
-
parameters: {
|
|
85
|
-
docs: {
|
|
86
|
-
description: {
|
|
87
|
-
component: "Universal button component with variants, icons and tooltip support."
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
pseudo: {
|
|
91
|
-
hover: "#hover",
|
|
92
|
-
focus: "#focus",
|
|
93
|
-
active: "#active",
|
|
94
|
-
disabled: "#disabled"
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}, l = {
|
|
98
|
-
...m.args,
|
|
99
|
-
startAdornment: /* @__PURE__ */ e(s, {}),
|
|
100
|
-
endAdornment: /* @__PURE__ */ e(s, {}),
|
|
101
|
-
children: "children"
|
|
102
|
-
}, u = {
|
|
103
|
-
args: {
|
|
104
|
-
...m.args,
|
|
105
|
-
children: "__children__"
|
|
106
|
-
}
|
|
107
|
-
}, y = {
|
|
108
|
-
args: {
|
|
109
|
-
...l,
|
|
110
|
-
color: "primary",
|
|
111
|
-
size: "lg",
|
|
112
|
-
children: "Створити"
|
|
113
|
-
},
|
|
114
|
-
argTypes: {
|
|
115
|
-
variant: { control: !1 },
|
|
116
|
-
color: { control: !1 }
|
|
117
|
-
},
|
|
118
|
-
render: (o) => /* @__PURE__ */ e("div", { className: "flex", children: /* @__PURE__ */ n(a, { children: [
|
|
119
|
-
/* @__PURE__ */ e(t, { ...o, variant: "contained" }),
|
|
120
|
-
/* @__PURE__ */ e(t, { ...o, variant: "outlined" }),
|
|
121
|
-
/* @__PURE__ */ e(t, { ...o, variant: "ghost" })
|
|
122
|
-
] }) })
|
|
123
|
-
}, x = {
|
|
124
|
-
args: {
|
|
125
|
-
...l,
|
|
126
|
-
color: "secondary",
|
|
127
|
-
size: "lg",
|
|
128
|
-
children: "Створити"
|
|
129
|
-
},
|
|
130
|
-
argTypes: {
|
|
131
|
-
variant: { control: !1 },
|
|
132
|
-
color: { control: !1 }
|
|
133
|
-
},
|
|
134
|
-
render: (o) => /* @__PURE__ */ e("div", { className: "flex", children: /* @__PURE__ */ n(a, { children: [
|
|
135
|
-
/* @__PURE__ */ e(t, { ...o, variant: "contained" }),
|
|
136
|
-
/* @__PURE__ */ e(t, { ...o, variant: "outlined" }),
|
|
137
|
-
/* @__PURE__ */ e(t, { ...o, variant: "ghost" })
|
|
138
|
-
] }) })
|
|
139
|
-
}, b = {
|
|
140
|
-
args: {
|
|
141
|
-
...l,
|
|
142
|
-
color: "error",
|
|
143
|
-
size: "lg",
|
|
144
|
-
children: "Створити"
|
|
145
|
-
},
|
|
146
|
-
argTypes: {
|
|
147
|
-
variant: { control: !1 },
|
|
148
|
-
color: { control: !1 }
|
|
149
|
-
},
|
|
150
|
-
render: (o) => /* @__PURE__ */ e("div", { className: "flex", children: /* @__PURE__ */ n(a, { children: [
|
|
151
|
-
/* @__PURE__ */ e(t, { ...o, variant: "contained" }),
|
|
152
|
-
/* @__PURE__ */ e(t, { ...o, variant: "outlined" }),
|
|
153
|
-
/* @__PURE__ */ e(t, { ...o, variant: "ghost" })
|
|
154
|
-
] }) })
|
|
155
|
-
};
|
|
156
|
-
export {
|
|
157
|
-
u as Default,
|
|
158
|
-
b as Error,
|
|
159
|
-
y as Primary,
|
|
160
|
-
x as Secondary,
|
|
161
|
-
m as default
|
|
162
|
-
};
|
|
163
|
-
//# sourceMappingURL=Button.s.js.map
|