@oneplatformdev/ui 0.1.99-beta.5 → 0.1.99-beta.51
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/Accordion/Accordion.d.ts +1 -1
- package/Accordion/Accordion.d.ts.map +1 -1
- package/Accordion/Accordion.js +48 -26
- package/Accordion/Accordion.js.map +1 -1
- package/AlertDialog/AlertDialogRoot.d.ts.map +1 -1
- package/AlertDialog/AlertDialogRoot.js +15 -14
- package/AlertDialog/AlertDialogRoot.js.map +1 -1
- package/Badge/badgeVariants.d.ts +1 -1
- package/Button/Button.d.ts +7 -1
- package/Button/Button.d.ts.map +1 -1
- package/Button/Button.js +44 -42
- package/Button/Button.js.map +1 -1
- package/Button/Button.types.d.ts +22 -0
- package/Button/Button.types.d.ts.map +1 -1
- package/Button/ButtonCounterBadge.d.ts +7 -0
- package/Button/ButtonCounterBadge.d.ts.map +1 -0
- package/Button/ButtonCounterBadge.js +20 -0
- package/Button/ButtonCounterBadge.js.map +1 -0
- package/Button/buttonVariants.d.ts +11 -20
- package/Button/buttonVariants.d.ts.map +1 -1
- package/Button/buttonVariants.js +76 -12
- package/Button/buttonVariants.js.map +1 -1
- package/Button/index.js +6 -5
- package/ButtonIcon/ButtonIcon.d.ts +6 -1
- package/ButtonIcon/ButtonIcon.d.ts.map +1 -1
- package/ButtonIcon/ButtonIcon.js +70 -50
- package/ButtonIcon/ButtonIcon.js.map +1 -1
- package/ButtonIcon/ButtonIcon.stories.js +82 -55
- package/ButtonIcon/ButtonIcon.stories.js.map +1 -1
- package/ButtonIcon/buttonIconVariants.d.ts +1 -1
- package/ButtonIcon/buttonIconVariants.d.ts.map +1 -1
- package/ButtonIcon/buttonIconVariants.js +7 -6
- package/ButtonIcon/buttonIconVariants.js.map +1 -1
- package/CHANGELOG.md +556 -0
- package/Combobox/Combobox.d.ts +2 -1
- package/Combobox/Combobox.d.ts.map +1 -1
- package/Combobox/Combobox.js +124 -122
- package/Combobox/Combobox.js.map +1 -1
- package/Combobox/Combobox.stories.js +208 -0
- package/Combobox/Combobox.stories.js.map +1 -0
- package/Combobox/Combobox.types.d.ts +2 -0
- package/Combobox/Combobox.types.d.ts.map +1 -1
- package/Combobox/ComboboxOptions.d.ts.map +1 -1
- package/Combobox/ComboboxOptions.js +42 -42
- package/Combobox/ComboboxOptions.js.map +1 -1
- package/Dialog/Dialog.d.ts.map +1 -1
- package/Dialog/Dialog.js +22 -16
- package/Dialog/Dialog.js.map +1 -1
- package/Dialog/Dialog.types.d.ts +4 -0
- package/Dialog/Dialog.types.d.ts.map +1 -0
- package/Dialog/Dialog.types.js +2 -0
- package/Dialog/Dialog.types.js.map +1 -0
- package/Dialog/index.d.ts +1 -0
- package/Dialog/index.d.ts.map +1 -1
- package/DropdownMenu/DropdownMenu.d.ts.map +1 -1
- package/DropdownMenu/DropdownMenu.js +33 -20
- package/DropdownMenu/DropdownMenu.js.map +1 -1
- package/Form/Form.d.ts.map +1 -1
- package/Form/Form.js.map +1 -1
- package/Form/FormRenderControl.d.ts.map +1 -1
- package/Form/FormRenderControl.js +26 -13
- package/Form/FormRenderControl.js.map +1 -1
- package/Form/FormRenderControl.types.d.ts +2 -1
- package/Form/FormRenderControl.types.d.ts.map +1 -1
- package/Form/FormTooltipButton.d.ts +6 -0
- package/Form/FormTooltipButton.d.ts.map +1 -0
- package/Form/FormTooltipButton.js +34 -0
- package/Form/FormTooltipButton.js.map +1 -0
- package/FormInput/FormInput.d.ts.map +1 -1
- package/FormInput/FormInput.js +22 -21
- package/FormInput/FormInput.js.map +1 -1
- package/InfoBlock/InfoBlock.d.ts +7 -0
- package/InfoBlock/InfoBlock.d.ts.map +1 -0
- package/InfoBlock/InfoBlock.js +27 -0
- package/InfoBlock/InfoBlock.js.map +1 -0
- package/InfoBlock/InfoBlock.stories.js +14 -0
- package/InfoBlock/InfoBlock.stories.js.map +1 -0
- package/InfoBlock/InfoBlock.types.d.ts +8 -0
- package/InfoBlock/InfoBlock.types.d.ts.map +1 -0
- package/InfoBlock/InfoBlock.types.js +2 -0
- package/InfoBlock/InfoBlock.types.js.map +1 -0
- package/InfoBlock/index.d.ts +3 -0
- package/InfoBlock/index.d.ts.map +1 -0
- package/InfoBlock/index.js +5 -0
- package/InfoBlock/index.js.map +1 -0
- package/InfoBlock/infoBlockVariants.d.ts +6 -0
- package/InfoBlock/infoBlockVariants.d.ts.map +1 -0
- package/InfoBlock/infoBlockVariants.js +26 -0
- package/InfoBlock/infoBlockVariants.js.map +1 -0
- package/Input/Input.js +1 -1
- package/Input/Input.js.map +1 -1
- package/Input/inputVariants.d.ts.map +1 -1
- package/Input/inputVariants.js +5 -4
- package/Input/inputVariants.js.map +1 -1
- package/LoadedIcon/LoadedIcon.d.ts.map +1 -1
- package/LoadedIcon/LoadedIcon.js +3 -1
- package/LoadedIcon/LoadedIcon.js.map +1 -1
- package/Resizable/Resizable.d.ts +5 -20
- package/Resizable/Resizable.d.ts.map +1 -1
- package/Resizable/Resizable.js +48 -31
- package/Resizable/Resizable.js.map +1 -1
- package/Resizable/Resizable.stories.js +140 -0
- package/Resizable/Resizable.stories.js.map +1 -0
- package/Search/Search.js +12 -12
- package/Search/Search.js.map +1 -1
- package/Search/Search.stories.js +17 -0
- package/Search/Search.stories.js.map +1 -0
- package/Textarea/Textarea.d.ts.map +1 -1
- package/Textarea/Textarea.js +50 -45
- package/Textarea/Textarea.js.map +1 -1
- package/Textarea/Textarea.stories.js +12 -0
- package/Textarea/Textarea.stories.js.map +1 -0
- package/Textarea/Textarea.types.d.ts +3 -1
- package/Textarea/Textarea.types.d.ts.map +1 -1
- package/Textarea/useAutosizeTextArea.d.ts +1 -1
- package/Textarea/useAutosizeTextArea.d.ts.map +1 -1
- package/Textarea/useAutosizeTextArea.js.map +1 -1
- package/Tooltip/Tooltip.d.ts.map +1 -1
- package/Tooltip/Tooltip.js.map +1 -1
- package/index.d.ts +1 -0
- package/index.d.ts.map +1 -1
- package/index.js +328 -325
- package/index.js.map +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buttonVariants.d.ts","sourceRoot":"","sources":["../../src/Button/buttonVariants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAGlE,eAAO,MAAM,cAAc;;;;
|
|
1
|
+
{"version":3,"file":"buttonVariants.d.ts","sourceRoot":"","sources":["../../src/Button/buttonVariants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAGlE,eAAO,MAAM,cAAc;;;;8EA+I1B,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG,YAAY,CAAC,OAAO,cAAc,CAAC,CAAC;AAEtE,eAAO,MAAM,mBAAmB;;;;;;8EAoE/B,CAAA;AACD,MAAM,MAAM,mBAAmB,GAAG,YAAY,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
|
package/Button/buttonVariants.js
CHANGED
|
@@ -1,22 +1,18 @@
|
|
|
1
|
-
import { cva as
|
|
1
|
+
import { cva as r } from "class-variance-authority";
|
|
2
2
|
import { cn as e } from "@oneplatformdev/utils";
|
|
3
|
-
const
|
|
3
|
+
const s = r(
|
|
4
4
|
[
|
|
5
|
-
"inline-flex items-center justify-center",
|
|
5
|
+
"inline-flex items-center justify-center box-border",
|
|
6
6
|
"whitespace-nowrap font-medium",
|
|
7
|
-
"cursor-pointer
|
|
7
|
+
"cursor-pointer",
|
|
8
8
|
"transition-colors focus-visible:outline-hidden focus-visible:ring-none focus-visible:ring-transparent",
|
|
9
9
|
"disabled:pointer-events-none disabled:cursor-default",
|
|
10
|
-
"[&_svg]:pointer-events-none [&_svg]:shrink-0"
|
|
10
|
+
"[&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
11
|
+
"transition-transform duration-200 [&_svg]:transition-transform [&_svg]:duration-200"
|
|
11
12
|
],
|
|
12
13
|
{
|
|
13
14
|
variants: {
|
|
14
15
|
variant: {
|
|
15
|
-
default: "deprecated.do_not_use",
|
|
16
|
-
outline: "deprecated.do_not_use",
|
|
17
|
-
secondary: "deprecated.do_not_use",
|
|
18
|
-
destructive: "deprecated.do_not_use",
|
|
19
|
-
//
|
|
20
16
|
none: "",
|
|
21
17
|
contained: "",
|
|
22
18
|
outlined: "",
|
|
@@ -35,7 +31,7 @@ const o = t(
|
|
|
35
31
|
"text-sm leading-[1.12] [&_svg]:size-6"
|
|
36
32
|
),
|
|
37
33
|
lg: e(
|
|
38
|
-
"min-h-10 min-w-35 rounded-lg gap-1 px-
|
|
34
|
+
"min-h-10 min-w-35 rounded-lg gap-1 px-2.5 py-1.5",
|
|
39
35
|
"text-base leading-normal [&_svg]:size-6"
|
|
40
36
|
)
|
|
41
37
|
}
|
|
@@ -147,8 +143,76 @@ const o = t(
|
|
|
147
143
|
size: "lg"
|
|
148
144
|
}
|
|
149
145
|
}
|
|
146
|
+
), o = r(
|
|
147
|
+
[
|
|
148
|
+
"absolute z-0",
|
|
149
|
+
"flex items-center justify-center text-center p-0",
|
|
150
|
+
"font-medium leading-none tracking-tighter",
|
|
151
|
+
"rounded-full w-fit min-w-4 h-4 text-[10px] px-0.5 box-border"
|
|
152
|
+
],
|
|
153
|
+
{
|
|
154
|
+
variants: {
|
|
155
|
+
variant: {
|
|
156
|
+
none: "",
|
|
157
|
+
contained: "",
|
|
158
|
+
outlined: "",
|
|
159
|
+
ghost: ""
|
|
160
|
+
},
|
|
161
|
+
color: {
|
|
162
|
+
primary: "",
|
|
163
|
+
secondary: "",
|
|
164
|
+
error: ""
|
|
165
|
+
},
|
|
166
|
+
size: {
|
|
167
|
+
xs: "",
|
|
168
|
+
sm: "",
|
|
169
|
+
md: "",
|
|
170
|
+
lg: "-top-[2px] left-[14px]"
|
|
171
|
+
},
|
|
172
|
+
rounded: {
|
|
173
|
+
true: "left-1/2 -translate-x-1/2 -translate-y-1/2",
|
|
174
|
+
false: ""
|
|
175
|
+
},
|
|
176
|
+
disabled: {
|
|
177
|
+
true: "",
|
|
178
|
+
false: ""
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
compoundVariants: [
|
|
182
|
+
// SIZE XS
|
|
183
|
+
{ size: "xs", rounded: !1, className: "-top-px -right-px translate-x-1/2 -translate-y-1/2" },
|
|
184
|
+
{ size: "xs", rounded: !0, className: "-top-px" },
|
|
185
|
+
// SIZE SM
|
|
186
|
+
{ size: "sm", rounded: !1, className: "top-0 right-0 translate-x-1/2 -translate-y-1/2" },
|
|
187
|
+
{ size: "sm", rounded: !0, className: "-top-[3px]" },
|
|
188
|
+
// SIZE MD
|
|
189
|
+
{ size: "md", rounded: !1, className: "-top-[4px] left-[12px]" },
|
|
190
|
+
{ size: "md", rounded: !0, className: "-top-[6px]" },
|
|
191
|
+
// SIZE LG
|
|
192
|
+
{ size: "lg", rounded: !1, className: "-top-[4px] left-[12px]" },
|
|
193
|
+
{ size: "lg", rounded: !0, className: "-top-2" },
|
|
194
|
+
// COLORS
|
|
195
|
+
{
|
|
196
|
+
color: ["primary", "secondary", "error"],
|
|
197
|
+
className: "bg-[#9368FF] text-[#FCFCFC]"
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
color: ["primary", "secondary", "error"],
|
|
201
|
+
disabled: !0,
|
|
202
|
+
className: "bg-[#666A78] text-[#FCFCFC]"
|
|
203
|
+
}
|
|
204
|
+
],
|
|
205
|
+
defaultVariants: {
|
|
206
|
+
color: "primary",
|
|
207
|
+
variant: "contained",
|
|
208
|
+
size: "lg",
|
|
209
|
+
disabled: !1,
|
|
210
|
+
rounded: !1
|
|
211
|
+
}
|
|
212
|
+
}
|
|
150
213
|
);
|
|
151
214
|
export {
|
|
152
|
-
o as
|
|
215
|
+
o as buttonBadgeVariants,
|
|
216
|
+
s as buttonVariants
|
|
153
217
|
};
|
|
154
218
|
//# sourceMappingURL=buttonVariants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buttonVariants.js","sources":["../../src/Button/buttonVariants.ts"],"sourcesContent":["import { cva, type VariantProps } from 'class-variance-authority';\nimport { cn } from \"@oneplatformdev/utils\";\n\nexport const buttonVariants = cva(\n [\n \"inline-flex items-center justify-center\",\n 'whitespace-nowrap font-medium',\n 'cursor-pointer box-border',\n \"transition-colors focus-visible:outline-hidden focus-visible:ring-none focus-visible:ring-transparent\",\n \"disabled:pointer-events-none disabled:cursor-default\",\n \"[&_svg]:pointer-events-none [&_svg]:shrink-0\",\n ],\n {\n variants: {\n variant: {\n default: \"deprecated.do_not_use\",\n outline: \"deprecated.do_not_use\",\n secondary: \"deprecated.do_not_use\",\n destructive: \"deprecated.do_not_use\",\n //\n none: \"\",\n contained: \"\",\n outlined: \"\",\n ghost: '',\n },\n color: {\n primary: '',\n secondary: '',\n error: '',\n },\n size: {\n xs: 'rounded-sm p-1 gap-1 text-xs min-h-4 min-w-14',\n sm: 'rounded-md p-1 gap-1 text-sm min-h-6 min-w-20',\n md: cn(\n 'min-h-8 min-w-[102px] rounded-lg gap-1 px-2 py-1',\n 'text-sm leading-[1.12] [&_svg]:size-6',\n ),\n lg: cn(\n \"min-h-10 min-w-35 rounded-lg gap-1 px-3 py-2\",\n 'text-base leading-normal [&_svg]:size-6',\n )\n }\n },\n compoundVariants: [\n // PRIMARY BUTTON VARIANTS\n {\n color: 'primary',\n variant: 'contained',\n className: cn(\n 'bg-[#9368FF] border border-[#9368FF] text-[#FCFCFC] [&_svg]:text-[#FCFCFC]',\n 'hover:bg-[#7F4EEB]',\n 'focus:bg-[#7F4EEB] focus:border-[#6B3DD9]',\n 'active:bg-[#6B3DD9]',\n 'disabled:bg-[#E8E9EB] disabled:border-[#E8E9EB] disabled:text-[#666A78] disabled:[&_svg]:text-[#666A78]',\n ),\n },\n {\n color: 'primary',\n variant: 'outlined',\n className: cn(\n 'bg-transparent border border-[#9368FF] text-[#9368FF] [&_svg]:text-[#9368FF]',\n 'hover:bg-[#9368FF0F]',\n 'active:bg-[#9368FF0F] active:border-[#6B3DD9]',\n 'disabled:border-[#EBEBEB] disabled:text-[#666A78] disabled:[&_svg]:text-[#666A78]',\n ),\n },\n {\n color: 'primary',\n variant: 'ghost',\n className: cn(\n 'bg-transparent border border-transparent text-[#9368FF] [&_svg]:text-[#9368FF]',\n 'hover:text-[#6B3DD9] hover:[&_svg]:text-[#6B3DD9]',\n 'focus:text-[#6B3DD9] focus:[&_svg]:text-[#6B3DD9]',\n 'active:bg-[#9368FF0F]',\n 'disabled:text-[#666A78] disabled:[&_svg]:text-[#666A78]',\n ),\n },\n // SECONDARY BUTTON VARIANTS\n {\n color: 'secondary',\n variant: 'contained',\n className: cn(\n 'bg-[#FCFCFC] border border-[#E1E1E5] text-[#06080D] [&_svg]:text-[#06080D]',\n 'hover:bg-[#F9FAFB] hover:border-[#E1E1E5]',\n 'focus:bg-[#FCFCFC] focus:border-[#C5C7CD]',\n 'active:bg-[#F9FAFB] active:border-[#C5C7CD]',\n 'disabled:bg-[#FCFCFC] disabled:border-[#EBEBEB] disabled:text-[#666A78] disabled:[&_svg]:text-[#666A78]',\n ),\n },\n {\n color: 'secondary',\n variant: 'outlined',\n className: cn(\n 'bg-transparent border border-[#E1E1E5] text-[#06080D] [&_svg]:text-[#06080D]',\n 'hover:bg-[#F9FAFB] hover:border-[#E1E1E5]',\n 'focus:bg-[#FCFCFC] focus:border-[#C5C7CD]',\n 'active:bg-[#F9FAFB] active:border-[#C5C7CD]',\n 'disabled:bg-[#FCFCFC] disabled:border-[#EBEBEB] disabled:text-[#666A78] disabled:[&_svg]:text-[#666A78]',\n ),\n },\n {\n color: 'secondary',\n variant: 'ghost',\n className: cn(\n 'text-[#06080D] [&_svg]:text-[#06080D] bg-transparent border border-transparent',\n 'hover:bg-[#F9FAFB]',\n 'focus:bg-[#FCFCFC]',\n 'active:bg-[#F9FAFB]',\n 'disabled:bg-[#FCFCFC] disabled:text-[#666A78] disabled:[&_svg]:text-[#666A78]',\n ),\n },\n // ERROR BUTTON VARIANTS\n {\n color: 'error',\n variant: 'contained',\n className: cn(\n 'bg-[#EF4444] border border-[#EF4444] text-[#FCFCFC] [&_svg]:text-[#FCFCFC]',\n 'hover:bg-[#DC2626]',\n 'focus:bg-[#DC2626]',\n 'active:bg-[#DC2626]',\n 'disabled:bg-[#E8E9EB] disabled:border-[#E8E9EB] disabled:text-[#666A78] disabled:[&_svg]:text-[#666A78]',\n ),\n },\n {\n color: 'error',\n variant: 'outlined',\n className: cn(\n 'bg-transparent border border-[#EF4444] text-[#EF4444] [&_svg]:text-[#EF4444]',\n 'hover:bg-[#EF44440F]',\n 'active:bg-[#DC26260F] active:border-[#DC2626]',\n 'disabled:border-[#EBEBEB] disabled:text-[#666A78] disabled:[&_svg]:text-[#666A78]',\n ),\n },\n {\n color: 'error',\n variant: 'ghost',\n className: cn(\n 'bg-transparent border border-transparent text-[#EF4444] [&_svg]:text-[#EF4444]',\n 'hover:bg-[#EF44440F] hover:text-[#DC2626] hover:[&_svg]:text-[#DC2626]',\n 'active:bg-[#DC26260F] active:border-[#DC2626]',\n 'disabled:text-[#666A78] disabled:[&_svg]:text-[#666A78]',\n ),\n },\n ],\n defaultVariants: {\n variant: 'contained',\n color: 'primary',\n size: 'lg',\n },\n }\n)\n\nexport type ButtonCVAProps = VariantProps<typeof buttonVariants>;\n\ntype ButtonCVANoVariantProps = Omit<VariantProps<typeof buttonVariants>, 'variant'>\n\ntype ButtonCVAVariants = ButtonCVAProps['variant'];\n\n/** @deprecated use \"variant=contained color=primary\" instead */\ntype LegacyDefaultVariant = 'default';\n/** @deprecated use \"variant=outlined color=primary\" instead */\ntype LegacyOutlineVariant = 'outline';\n/** @deprecated use \"variant=text color=primary\" instead */\ntype LegacyGhostVariant = 'ghost';\n/** @deprecated use \"variant=contained color=secondary\" instead */\ntype LegacySecondaryVariant = 'secondary';\n/** @deprecated use \"variant=contained color=error\" instead */\ntype LegacyDestructiveVariant = 'destructive';\n\ntype ModernVariant =\n | Exclude<ButtonCVAVariants, 'default' | 'outline' | 'ghost' | 'secondary' | 'destructive'>\n | LegacyDefaultVariant\n | LegacyOutlineVariant\n | LegacyGhostVariant\n | LegacySecondaryVariant\n | LegacyDestructiveVariant;\n\nexport interface ButtonVarianceProps extends ButtonCVANoVariantProps {\n variant?: ModernVariant;\n}\n"],"names":["buttonVariants","cva","cn"],"mappings":";;AAGO,MAAMA,IAAiBC;AAAA,EAC5B;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAAA,EAEF;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,SAAS;AAAA,QACT,SAAS;AAAA,QACT,WAAW;AAAA,QACX,aAAa;AAAA;AAAA,QAEb,MAAM;AAAA,QACN,WAAW;AAAA,QACX,UAAU;AAAA,QACV,OAAO;AAAA,MAAA;AAAA,MAET,OAAO;AAAA,QACL,SAAS;AAAA,QACT,WAAW;AAAA,QACX,OAAO;AAAA,MAAA;AAAA,MAET,MAAM;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,IAAIC;AAAA,UACF;AAAA,UACA;AAAA,QAAA;AAAA,QAEF,IAAIA;AAAA,UACF;AAAA,UACA;AAAA,QAAA;AAAA,MACF;AAAA,IACF;AAAA,IAEF,kBAAkB;AAAA;AAAA,MAEhB;AAAA,QACE,OAAO;AAAA,QACP,SAAS;AAAA,QACT,WAAWA;AAAA,UACT;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QAAA;AAAA,MACF;AAAA,MAEF;AAAA,QACE,OAAO;AAAA,QACP,SAAS;AAAA,QACT,WAAWA;AAAA,UACT;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QAAA;AAAA,MACF;AAAA,MAEF;AAAA,QACE,OAAO;AAAA,QACP,SAAS;AAAA,QACT,WAAWA;AAAA,UACT;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QAAA;AAAA,MACF;AAAA;AAAA,MAGF;AAAA,QACE,OAAO;AAAA,QACP,SAAS;AAAA,QACT,WAAWA;AAAA,UACT;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QAAA;AAAA,MACF;AAAA,MAEF;AAAA,QACE,OAAO;AAAA,QACP,SAAS;AAAA,QACT,WAAWA;AAAA,UACT;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QAAA;AAAA,MACF;AAAA,MAEF;AAAA,QACE,OAAO;AAAA,QACP,SAAS;AAAA,QACT,WAAWA;AAAA,UACT;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QAAA;AAAA,MACF;AAAA;AAAA,MAGF;AAAA,QACE,OAAO;AAAA,QACP,SAAS;AAAA,QACT,WAAWA;AAAA,UACT;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QAAA;AAAA,MACF;AAAA,MAEF;AAAA,QACE,OAAO;AAAA,QACP,SAAS;AAAA,QACT,WAAWA;AAAA,UACT;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QAAA;AAAA,MACF;AAAA,MAEF;AAAA,QACE,OAAO;AAAA,QACP,SAAS;AAAA,QACT,WAAWA;AAAA,UACT;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QAAA;AAAA,MACF;AAAA,IACF;AAAA,IAEF,iBAAiB;AAAA,MACf,SAAS;AAAA,MACT,OAAO;AAAA,MACP,MAAM;AAAA,IAAA;AAAA,EACR;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"buttonVariants.js","sources":["../../src/Button/buttonVariants.ts"],"sourcesContent":["import { cva, type VariantProps } from 'class-variance-authority';\nimport { cn } from \"@oneplatformdev/utils\";\n\nexport const buttonVariants = cva(\n [\n \"inline-flex items-center justify-center box-border\",\n 'whitespace-nowrap font-medium',\n 'cursor-pointer',\n \"transition-colors focus-visible:outline-hidden focus-visible:ring-none focus-visible:ring-transparent\",\n \"disabled:pointer-events-none disabled:cursor-default\",\n \"[&_svg]:pointer-events-none [&_svg]:shrink-0\",\n 'transition-transform duration-200 [&_svg]:transition-transform [&_svg]:duration-200',\n ],\n {\n variants: {\n variant: {\n none: \"\",\n contained: \"\",\n outlined: \"\",\n ghost: '',\n },\n color: {\n primary: '',\n secondary: '',\n error: '',\n },\n size: {\n xs: 'rounded-sm p-1 gap-1 text-xs min-h-4 min-w-14',\n sm: 'rounded-md p-1 gap-1 text-sm min-h-6 min-w-20',\n md: cn(\n 'min-h-8 min-w-[102px] rounded-lg gap-1 px-2 py-1',\n 'text-sm leading-[1.12] [&_svg]:size-6',\n ),\n lg: cn(\n \"min-h-10 min-w-35 rounded-lg gap-1 px-2.5 py-1.5\",\n 'text-base leading-normal [&_svg]:size-6',\n )\n }\n },\n compoundVariants: [\n // PRIMARY BUTTON VARIANTS\n {\n color: 'primary',\n variant: 'contained',\n className: cn(\n 'bg-[#9368FF] border border-[#9368FF] text-[#FCFCFC] [&_svg]:text-[#FCFCFC]',\n 'hover:bg-[#7F4EEB]',\n 'focus:bg-[#7F4EEB] focus:border-[#6B3DD9]',\n 'active:bg-[#6B3DD9]',\n 'disabled:bg-[#E8E9EB] disabled:border-[#E8E9EB] disabled:text-[#666A78] disabled:[&_svg]:text-[#666A78]',\n ),\n },\n {\n color: 'primary',\n variant: 'outlined',\n className: cn(\n 'bg-transparent border border-[#9368FF] text-[#9368FF] [&_svg]:text-[#9368FF]',\n 'hover:bg-[#9368FF0F]',\n 'active:bg-[#9368FF0F] active:border-[#6B3DD9]',\n 'disabled:border-[#EBEBEB] disabled:text-[#666A78] disabled:[&_svg]:text-[#666A78]',\n ),\n },\n {\n color: 'primary',\n variant: 'ghost',\n className: cn(\n 'bg-transparent border border-transparent text-[#9368FF] [&_svg]:text-[#9368FF]',\n 'hover:text-[#6B3DD9] hover:[&_svg]:text-[#6B3DD9]',\n 'focus:text-[#6B3DD9] focus:[&_svg]:text-[#6B3DD9]',\n 'active:bg-[#9368FF0F]',\n 'disabled:text-[#666A78] disabled:[&_svg]:text-[#666A78]',\n ),\n },\n // SECONDARY BUTTON VARIANTS\n {\n color: 'secondary',\n variant: 'contained',\n className: cn(\n 'bg-[#FCFCFC] border border-[#E1E1E5] text-[#06080D] [&_svg]:text-[#06080D]',\n 'hover:bg-[#F9FAFB] hover:border-[#E1E1E5]',\n 'focus:bg-[#FCFCFC] focus:border-[#C5C7CD]',\n 'active:bg-[#F9FAFB] active:border-[#C5C7CD]',\n 'disabled:bg-[#FCFCFC] disabled:border-[#EBEBEB] disabled:text-[#666A78] disabled:[&_svg]:text-[#666A78]',\n ),\n },\n {\n color: 'secondary',\n variant: 'outlined',\n className: cn(\n 'bg-transparent border border-[#E1E1E5] text-[#06080D] [&_svg]:text-[#06080D]',\n 'hover:bg-[#F9FAFB] hover:border-[#E1E1E5]',\n 'focus:bg-[#FCFCFC] focus:border-[#C5C7CD]',\n 'active:bg-[#F9FAFB] active:border-[#C5C7CD]',\n 'disabled:bg-[#FCFCFC] disabled:border-[#EBEBEB] disabled:text-[#666A78] disabled:[&_svg]:text-[#666A78]',\n ),\n },\n {\n color: 'secondary',\n variant: 'ghost',\n className: cn(\n 'text-[#06080D] [&_svg]:text-[#06080D] bg-transparent border border-transparent',\n 'hover:bg-[#F9FAFB]',\n 'focus:bg-[#FCFCFC]',\n 'active:bg-[#F9FAFB]',\n 'disabled:bg-[#FCFCFC] disabled:text-[#666A78] disabled:[&_svg]:text-[#666A78]',\n ),\n },\n // ERROR BUTTON VARIANTS\n {\n color: 'error',\n variant: 'contained',\n className: cn(\n 'bg-[#EF4444] border border-[#EF4444] text-[#FCFCFC] [&_svg]:text-[#FCFCFC]',\n 'hover:bg-[#DC2626]',\n 'focus:bg-[#DC2626]',\n 'active:bg-[#DC2626]',\n 'disabled:bg-[#E8E9EB] disabled:border-[#E8E9EB] disabled:text-[#666A78] disabled:[&_svg]:text-[#666A78]',\n ),\n },\n {\n color: 'error',\n variant: 'outlined',\n className: cn(\n 'bg-transparent border border-[#EF4444] text-[#EF4444] [&_svg]:text-[#EF4444]',\n 'hover:bg-[#EF44440F]',\n 'active:bg-[#DC26260F] active:border-[#DC2626]',\n 'disabled:border-[#EBEBEB] disabled:text-[#666A78] disabled:[&_svg]:text-[#666A78]',\n ),\n },\n {\n color: 'error',\n variant: 'ghost',\n className: cn(\n 'bg-transparent border border-transparent text-[#EF4444] [&_svg]:text-[#EF4444]',\n 'hover:bg-[#EF44440F] hover:text-[#DC2626] hover:[&_svg]:text-[#DC2626]',\n 'active:bg-[#DC26260F] active:border-[#DC2626]',\n 'disabled:text-[#666A78] disabled:[&_svg]:text-[#666A78]',\n ),\n },\n ],\n defaultVariants: {\n variant: 'contained',\n color: 'primary',\n size: 'lg',\n },\n }\n)\n\nexport type ButtonVarianceProps = VariantProps<typeof buttonVariants>;\n\nexport const buttonBadgeVariants = cva(\n [\n 'absolute z-0',\n 'flex items-center justify-center text-center p-0',\n 'font-medium leading-none tracking-tighter',\n 'rounded-full w-fit min-w-4 h-4 text-[10px] px-0.5 box-border',\n ],\n {\n variants: {\n variant: {\n none: '',\n contained: '',\n outlined: '',\n ghost: \"\",\n },\n color: {\n primary: \"\",\n secondary: \"\",\n error: \"\"\n },\n size: {\n xs: '',\n sm: '',\n md: '',\n lg: '-top-[2px] left-[14px]',\n },\n rounded: {\n true: 'left-1/2 -translate-x-1/2 -translate-y-1/2',\n false: '',\n },\n disabled: {\n true: '',\n false: '',\n }\n },\n compoundVariants: [\n // SIZE XS\n { size: 'xs', rounded: false, className: '-top-px -right-px translate-x-1/2 -translate-y-1/2' },\n { size: 'xs', rounded: true, className: '-top-px' },\n // SIZE SM\n { size: 'sm', rounded: false, className: 'top-0 right-0 translate-x-1/2 -translate-y-1/2' },\n { size: 'sm', rounded: true, className: '-top-[3px]' },\n // SIZE MD\n { size: 'md', rounded: false, className: '-top-[4px] left-[12px]' },\n { size: 'md', rounded: true, className: '-top-[6px]' },\n // SIZE LG\n { size: 'lg', rounded: false, className: '-top-[4px] left-[12px]' },\n { size: 'lg', rounded: true, className: '-top-2' },\n\n // COLORS\n {\n color: ['primary', 'secondary', 'error'],\n className: 'bg-[#9368FF] text-[#FCFCFC]',\n },\n {\n color: ['primary', 'secondary', 'error'],\n disabled: true,\n className: 'bg-[#666A78] text-[#FCFCFC]'\n },\n ],\n defaultVariants: {\n color: \"primary\",\n variant: \"contained\",\n size: \"lg\",\n disabled: false,\n rounded: false,\n },\n }\n)\nexport type ButtonBadgeCVAProps = VariantProps<typeof buttonBadgeVariants>;\n"],"names":["buttonVariants","cva","cn","buttonBadgeVariants"],"mappings":"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"}
|
package/Button/index.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { Button as
|
|
2
|
-
import {
|
|
1
|
+
import { Button as a, Button as n } from "./Button.js";
|
|
2
|
+
import { buttonBadgeVariants as u, buttonVariants as e } from "./buttonVariants.js";
|
|
3
3
|
export {
|
|
4
|
-
|
|
5
|
-
u as
|
|
6
|
-
|
|
4
|
+
a as Button,
|
|
5
|
+
u as buttonBadgeVariants,
|
|
6
|
+
e as buttonVariants,
|
|
7
|
+
n as default
|
|
7
8
|
};
|
|
8
9
|
//# sourceMappingURL=index.js.map
|
|
@@ -43,12 +43,17 @@ import * as React from "react";
|
|
|
43
43
|
* <Trash2 />
|
|
44
44
|
*</ButtonIcon>
|
|
45
45
|
* ```
|
|
46
|
+
* > Badge counter:
|
|
47
|
+
* ```tsx
|
|
48
|
+
*<ButtonIcon counter={5} icon={MessageCircleMoreIcon}/>
|
|
49
|
+
*<ButtonIcon counter={{ count: 8 }} icon={MessageCircleMoreIcon}/>
|
|
50
|
+
* ```
|
|
46
51
|
*
|
|
47
52
|
* @remarks
|
|
48
53
|
* - Designed for icon-only usage. If you need text, use `Button`.
|
|
49
54
|
* - Works with any SVG React component or element, e.g. lucide-react, heroicons, custom icons.
|
|
50
55
|
*
|
|
51
|
-
* @see {@link
|
|
56
|
+
* @see {@link Button} for regular text buttons
|
|
52
57
|
*/
|
|
53
58
|
export declare const ButtonIcon: React.ForwardRefExoticComponent<ButtonIconProps & React.RefAttributes<HTMLButtonElement>>;
|
|
54
59
|
export default ButtonIcon;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonIcon.d.ts","sourceRoot":"","sources":["../../src/ButtonIcon/ButtonIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"ButtonIcon.d.ts","sourceRoot":"","sources":["../../src/ButtonIcon/ButtonIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAerD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AACH,eAAO,MAAM,UAAU,2FAgFtB,CAAA;AAED,eAAe,UAAU,CAAC"}
|
package/ButtonIcon/ButtonIcon.js
CHANGED
|
@@ -1,65 +1,85 @@
|
|
|
1
|
-
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import * as
|
|
3
|
-
import { isValidElement as
|
|
4
|
-
import { cn as
|
|
5
|
-
import { buttonIconVariants as
|
|
6
|
-
import { Slot as
|
|
1
|
+
import { jsxs as g, Fragment as R, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import * as j from "react";
|
|
3
|
+
import { isValidElement as E, createElement as I } from "react";
|
|
4
|
+
import { cn as V } from "@oneplatformdev/utils";
|
|
5
|
+
import { buttonIconVariants as w } from "./buttonIconVariants.js";
|
|
6
|
+
import { Slot as z } from "@radix-ui/react-slot";
|
|
7
7
|
import "@radix-ui/react-tooltip";
|
|
8
|
-
import { Tooltip as
|
|
9
|
-
import { LoadedIcon as
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
import { Tooltip as F } from "../Tooltip/Tooltip.js";
|
|
9
|
+
import { LoadedIcon as L } from "../LoadedIcon/LoadedIcon.js";
|
|
10
|
+
import { ButtonCounterBadge as P } from "../Button/ButtonCounterBadge.js";
|
|
11
|
+
const S = (t) => t ? E(t) ? t : I(t) : null, T = j.forwardRef(
|
|
12
|
+
(t, h) => {
|
|
12
13
|
const {
|
|
13
|
-
asChild:
|
|
14
|
-
children:
|
|
15
|
-
icon:
|
|
16
|
-
disabled:
|
|
17
|
-
loading:
|
|
18
|
-
message:
|
|
19
|
-
title:
|
|
20
|
-
tooltipProps:
|
|
21
|
-
className:
|
|
22
|
-
variant:
|
|
23
|
-
color:
|
|
24
|
-
size:
|
|
25
|
-
rounded:
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
14
|
+
asChild: a,
|
|
15
|
+
children: m,
|
|
16
|
+
icon: b,
|
|
17
|
+
disabled: e = !1,
|
|
18
|
+
loading: n = !1,
|
|
19
|
+
message: y,
|
|
20
|
+
title: x = "",
|
|
21
|
+
tooltipProps: l = {},
|
|
22
|
+
className: B,
|
|
23
|
+
variant: c,
|
|
24
|
+
color: p,
|
|
25
|
+
size: s,
|
|
26
|
+
rounded: u,
|
|
27
|
+
screenReader: o,
|
|
28
|
+
counter: N,
|
|
29
|
+
...v
|
|
30
|
+
} = t, C = a ? z : "button", i = y || x, d = a ? m : /* @__PURE__ */ g(R, { children: [
|
|
31
|
+
/* @__PURE__ */ g(L, { loading: n, size: s, children: [
|
|
32
|
+
S(b) ?? m,
|
|
33
|
+
/* @__PURE__ */ r(
|
|
34
|
+
P,
|
|
35
|
+
{
|
|
36
|
+
counter: N,
|
|
37
|
+
variant: c,
|
|
38
|
+
color: p,
|
|
39
|
+
size: s,
|
|
40
|
+
disabled: e,
|
|
41
|
+
rounded: u
|
|
42
|
+
}
|
|
43
|
+
)
|
|
44
|
+
] }),
|
|
45
|
+
!!o && /* @__PURE__ */ r("span", { className: "sr-only", children: typeof o == "string" ? o : o.text })
|
|
46
|
+
] });
|
|
47
|
+
if (!d) return null;
|
|
48
|
+
const f = /* @__PURE__ */ r(
|
|
49
|
+
C,
|
|
31
50
|
{
|
|
32
51
|
type: "button",
|
|
33
|
-
ref:
|
|
34
|
-
disabled:
|
|
35
|
-
className:
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
52
|
+
ref: h,
|
|
53
|
+
disabled: e,
|
|
54
|
+
className: V(
|
|
55
|
+
"group group/button group/button-icon",
|
|
56
|
+
w({
|
|
57
|
+
variant: c,
|
|
58
|
+
size: s,
|
|
59
|
+
color: p,
|
|
60
|
+
rounded: u,
|
|
61
|
+
className: B
|
|
42
62
|
}),
|
|
43
|
-
|
|
63
|
+
n && "pointer-events-none opacity-80"
|
|
44
64
|
),
|
|
45
|
-
...
|
|
46
|
-
children:
|
|
65
|
+
...v,
|
|
66
|
+
children: d
|
|
47
67
|
}
|
|
48
68
|
);
|
|
49
|
-
return
|
|
50
|
-
|
|
69
|
+
return i ? /* @__PURE__ */ r(
|
|
70
|
+
F,
|
|
51
71
|
{
|
|
52
|
-
...
|
|
53
|
-
open:
|
|
54
|
-
message:
|
|
55
|
-
children:
|
|
72
|
+
...l || {},
|
|
73
|
+
open: l.open ?? (e || n || !i) ? !1 : void 0,
|
|
74
|
+
message: i,
|
|
75
|
+
children: f
|
|
56
76
|
}
|
|
57
|
-
) :
|
|
77
|
+
) : f;
|
|
58
78
|
}
|
|
59
79
|
);
|
|
60
|
-
|
|
80
|
+
T.displayName = "Button";
|
|
61
81
|
export {
|
|
62
|
-
|
|
63
|
-
|
|
82
|
+
T as ButtonIcon,
|
|
83
|
+
T as default
|
|
64
84
|
};
|
|
65
85
|
//# sourceMappingURL=ButtonIcon.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonIcon.js","sources":["../../src/ButtonIcon/ButtonIcon.tsx"],"sourcesContent":["import * as React from \"react\"\n\nimport { cn } from \"@oneplatformdev/utils\"\nimport { buttonIconVariants } from './buttonIconVariants';\nimport { ButtonIconProps } from './ButtonIcon.types';\nimport { Slot } from \"@radix-ui/react-slot\"\n\nimport { Tooltip } from '../Tooltip';\nimport { LoadedIcon } from \"../LoadedIcon\";\nimport { ButtonIconType } from \"../Button\";\nimport { createElement, isValidElement } from \"react\";\n\nconst renderInnerIcon = (Icon?: ButtonIconType) => {\n if (!Icon) return null;\n if (isValidElement(Icon)) return Icon;\n return createElement(Icon);\n};\n\n/**\n * Icon-only version of the Button component.\n *\n * `ButtonIcon` is used for compact actions represented by an icon instead of text.\n * Supports all core features of Button: variants, sizes, tooltips, disabled and loading state.\n *\n * @public\n * @see [Documentation](#) // TODO: add link to docs\n *\n * @example\n * > Import:\n * ```tsx\n * import { ButtonIcon } from '@oneplatformdev/ui/ButtonIcon';\n * ```\n * > Basic usage by icon:\n * ```tsx\n *<ButtonIcon icon={<PlusIcon />}/>\n *<ButtonIcon icon={PlusIcon}/>\n * ```\n * > Basic usage by children:\n * ```tsx\n *<ButtonIcon>\n * <PlusIcon />\n *</ButtonIcon>\n * ```\n * > With variant & color:\n * ```tsx\n *<ButtonIcon variant=\"outline\" color=\"primary\">\n * <Search />\n *</ButtonIcon>\n * ```\n * > With tooltip message:\n * ```tsx\n *<ButtonIcon message=\"Edit item\">\n * <PencilLine />\n *</ButtonIcon>\n * ```\n * > Loading state:\n * ```tsx\n *<ButtonIcon loading>\n * <Trash2 />\n *</ButtonIcon>\n * ```\n *\n * @remarks\n * - Designed for icon-only usage. If you need text, use `Button`.\n * - Works with any SVG React component or element, e.g. lucide-react, heroicons, custom icons.\n *\n * @see {@link
|
|
1
|
+
{"version":3,"file":"ButtonIcon.js","sources":["../../src/ButtonIcon/ButtonIcon.tsx"],"sourcesContent":["import * as React from \"react\"\n\nimport { cn } from \"@oneplatformdev/utils\"\nimport { buttonIconVariants } from './buttonIconVariants';\nimport { ButtonIconProps } from './ButtonIcon.types';\nimport { Slot } from \"@radix-ui/react-slot\"\n\nimport { Tooltip } from '../Tooltip';\nimport { LoadedIcon } from \"../LoadedIcon\";\nimport { ButtonIconType } from \"../Button\";\nimport { createElement, isValidElement } from \"react\";\nimport { ButtonCounterBadge } from \"../Button/ButtonCounterBadge\";\n\nconst renderInnerIcon = (Icon?: ButtonIconType) => {\n if (!Icon) return null;\n if (isValidElement(Icon)) return Icon;\n return createElement(Icon);\n};\n\n/**\n * Icon-only version of the Button component.\n *\n * `ButtonIcon` is used for compact actions represented by an icon instead of text.\n * Supports all core features of Button: variants, sizes, tooltips, disabled and loading state.\n *\n * @public\n * @see [Documentation](#) // TODO: add link to docs\n *\n * @example\n * > Import:\n * ```tsx\n * import { ButtonIcon } from '@oneplatformdev/ui/ButtonIcon';\n * ```\n * > Basic usage by icon:\n * ```tsx\n *<ButtonIcon icon={<PlusIcon />}/>\n *<ButtonIcon icon={PlusIcon}/>\n * ```\n * > Basic usage by children:\n * ```tsx\n *<ButtonIcon>\n * <PlusIcon />\n *</ButtonIcon>\n * ```\n * > With variant & color:\n * ```tsx\n *<ButtonIcon variant=\"outline\" color=\"primary\">\n * <Search />\n *</ButtonIcon>\n * ```\n * > With tooltip message:\n * ```tsx\n *<ButtonIcon message=\"Edit item\">\n * <PencilLine />\n *</ButtonIcon>\n * ```\n * > Loading state:\n * ```tsx\n *<ButtonIcon loading>\n * <Trash2 />\n *</ButtonIcon>\n * ```\n * > Badge counter:\n * ```tsx\n *<ButtonIcon counter={5} icon={MessageCircleMoreIcon}/>\n *<ButtonIcon counter={{ count: 8 }} icon={MessageCircleMoreIcon}/>\n * ```\n *\n * @remarks\n * - Designed for icon-only usage. If you need text, use `Button`.\n * - Works with any SVG React component or element, e.g. lucide-react, heroicons, custom icons.\n *\n * @see {@link Button} for regular text buttons\n */\nexport const ButtonIcon = React.forwardRef<HTMLButtonElement, ButtonIconProps>(\n (props, ref) => {\n const {\n asChild,\n children,\n icon,\n disabled = false,\n loading = false,\n message,\n title = '',\n tooltipProps = {},\n className,\n variant,\n color,\n size,\n rounded,\n screenReader,\n counter,\n ...rest\n } = props;\n\n const Comp = asChild ? Slot : \"button\"\n const msg = message || title;\n\n const content = asChild\n ? children\n : (\n <>\n <LoadedIcon loading={loading} size={size}>\n {renderInnerIcon(icon) ?? children}\n <ButtonCounterBadge\n counter={counter}\n variant={variant}\n color={color}\n size={size}\n disabled={disabled}\n rounded={rounded}\n />\n </LoadedIcon>\n\n {!!screenReader && (\n <span className=\"sr-only\">\n {typeof screenReader === 'string' ? screenReader : screenReader.text}\n </span>\n )}\n </>\n )\n\n if (!content) return null;\n\n const cmp = (\n <Comp\n type='button'\n ref={ref}\n disabled={disabled}\n className={cn(\n 'group group/button group/button-icon',\n buttonIconVariants({\n variant, size, color, rounded,\n className\n }),\n loading && 'pointer-events-none opacity-80',\n )}\n {...rest}\n >\n {content}\n </Comp>\n )\n\n if (!msg) return cmp\n return (\n <Tooltip\n {...(tooltipProps || {})}\n open={tooltipProps.open ?? (disabled || loading || !msg) ? false : undefined}\n message={msg}\n >\n {cmp}\n </Tooltip>\n )\n }\n)\nButtonIcon.displayName = \"Button\"\nexport default ButtonIcon;\n"],"names":["renderInnerIcon","Icon","isValidElement","createElement","ButtonIcon","React","props","ref","asChild","children","icon","disabled","loading","message","title","tooltipProps","className","variant","color","size","rounded","screenReader","counter","rest","Comp","Slot","msg","content","jsxs","Fragment","LoadedIcon","jsx","ButtonCounterBadge","cmp","cn","buttonIconVariants","Tooltip"],"mappings":";;;;;;;;;;AAaA,MAAMA,IAAkB,CAACC,MAClBA,IACDC,EAAeD,CAAI,IAAUA,IAC1BE,EAAcF,CAAI,IAFP,MA4DPG,IAAaC,EAAM;AAAA,EAC9B,CAACC,GAAOC,MAAQ;AACd,UAAM;AAAA,MACJ,SAAAC;AAAA,MACA,UAAAC;AAAA,MACA,MAAAC;AAAA,MACA,UAAAC,IAAW;AAAA,MACX,SAAAC,IAAU;AAAA,MACV,SAAAC;AAAA,MACA,OAAAC,IAAQ;AAAA,MACR,cAAAC,IAAe,CAAA;AAAA,MACf,WAAAC;AAAA,MACA,SAAAC;AAAA,MACA,OAAAC;AAAA,MACA,MAAAC;AAAA,MACA,SAAAC;AAAA,MACA,cAAAC;AAAA,MACA,SAAAC;AAAA,MACA,GAAGC;AAAA,IAAA,IACDjB,GAEEkB,IAAOhB,IAAUiB,IAAO,UACxBC,IAAMb,KAAWC,GAEjBa,IAAUnB,IACZC,IAEA,gBAAAmB,EAAAC,GAAA,EACE,UAAA;AAAA,MAAA,gBAAAD,EAACE,GAAA,EAAW,SAAAlB,GAAkB,MAAAO,GAC3B,UAAA;AAAA,QAAAnB,EAAgBU,CAAI,KAAKD;AAAA,QAC1B,gBAAAsB;AAAA,UAACC;AAAA,UAAA;AAAA,YACC,SAAAV;AAAA,YACA,SAAAL;AAAA,YACA,OAAAC;AAAA,YACA,MAAAC;AAAA,YACA,UAAAR;AAAA,YACA,SAAAS;AAAA,UAAA;AAAA,QAAA;AAAA,MACF,GACF;AAAA,MAEC,CAAC,CAACC,KACD,gBAAAU,EAAC,QAAA,EAAK,WAAU,WACb,UAAA,OAAOV,KAAiB,WAAWA,IAAeA,EAAa,KAAA,CAClE;AAAA,IAAA,GAEJ;AAGJ,QAAI,CAACM,EAAS,QAAO;AAErB,UAAMM,IACJ,gBAAAF;AAAA,MAACP;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,KAAAjB;AAAA,QACA,UAAAI;AAAA,QACA,WAAWuB;AAAA,UACT;AAAA,UACAC,EAAmB;AAAA,YACjB,SAAAlB;AAAA,YAAS,MAAAE;AAAA,YAAM,OAAAD;AAAA,YAAO,SAAAE;AAAA,YACtB,WAAAJ;AAAA,UAAA,CACD;AAAA,UACDJ,KAAW;AAAA,QAAA;AAAA,QAEZ,GAAGW;AAAA,QAEH,UAAAI;AAAA,MAAA;AAAA,IAAA;AAIL,WAAKD,IAEH,gBAAAK;AAAA,MAACK;AAAA,MAAA;AAAA,QACE,GAAIrB,KAAgB,CAAA;AAAA,QACrB,MAAMA,EAAa,SAASJ,KAAYC,KAAW,CAACc,KAAO,KAAQ;AAAA,QACnE,SAASA;AAAA,QAER,UAAAO;AAAA,MAAA;AAAA,IAAA,IAPYA;AAAA,EAUnB;AACF;AACA7B,EAAW,cAAc;"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx as o, jsxs as i } from "react/jsx-runtime";
|
|
2
|
-
import { ButtonIcon as
|
|
3
|
-
import { FileDownIcon as
|
|
4
|
-
import { DashedWrapper as
|
|
5
|
-
const h = (e) => /* @__PURE__ */ o(
|
|
2
|
+
import { ButtonIcon as t } from "./ButtonIcon.js";
|
|
3
|
+
import { FileDownIcon as c, Trash2Icon as l, PlusIcon as a, MessageCircleMoreIcon as y } from "lucide-react";
|
|
4
|
+
import { DashedWrapper as s } from "../.storybook/Wrappers.js";
|
|
5
|
+
const h = (e) => /* @__PURE__ */ o(t, { ...e });
|
|
6
6
|
h.args = {
|
|
7
7
|
onClick: { action: (e) => e }
|
|
8
8
|
};
|
|
9
|
-
const
|
|
9
|
+
const r = (e) => /* @__PURE__ */ o(
|
|
10
10
|
"div",
|
|
11
11
|
{
|
|
12
12
|
style: {
|
|
@@ -15,53 +15,53 @@ const n = (e) => /* @__PURE__ */ o(
|
|
|
15
15
|
flexDirection: "column",
|
|
16
16
|
gap: "16px"
|
|
17
17
|
},
|
|
18
|
-
children: ["default", "hover", "focus", "active", "disabled"].map((
|
|
19
|
-
|
|
18
|
+
children: ["default", "hover", "focus", "active", "disabled"].map((n) => /* @__PURE__ */ o(
|
|
19
|
+
t,
|
|
20
20
|
{
|
|
21
|
-
id:
|
|
21
|
+
id: n,
|
|
22
22
|
...e,
|
|
23
|
-
disabled:
|
|
23
|
+
disabled: n === "disabled" || e.disabled,
|
|
24
24
|
children: e.children
|
|
25
25
|
},
|
|
26
|
-
|
|
26
|
+
n
|
|
27
27
|
))
|
|
28
28
|
}
|
|
29
|
-
),
|
|
30
|
-
/* @__PURE__ */ i(
|
|
31
|
-
/* @__PURE__ */ o(
|
|
32
|
-
/* @__PURE__ */ o(
|
|
33
|
-
/* @__PURE__ */ o(
|
|
29
|
+
), u = (e) => /* @__PURE__ */ i("div", { className: "flex", children: [
|
|
30
|
+
/* @__PURE__ */ i(s, { children: [
|
|
31
|
+
/* @__PURE__ */ o(r, { ...e, variant: "contained" }),
|
|
32
|
+
/* @__PURE__ */ o(r, { ...e, variant: "outlined" }),
|
|
33
|
+
/* @__PURE__ */ o(r, { ...e, variant: "ghost" })
|
|
34
34
|
] }),
|
|
35
|
-
/* @__PURE__ */ i(
|
|
36
|
-
/* @__PURE__ */ o(
|
|
37
|
-
/* @__PURE__ */ o(
|
|
38
|
-
/* @__PURE__ */ o(
|
|
35
|
+
/* @__PURE__ */ i(s, { children: [
|
|
36
|
+
/* @__PURE__ */ o(r, { ...e, variant: "contained", rounded: !0 }),
|
|
37
|
+
/* @__PURE__ */ o(r, { ...e, variant: "outlined", rounded: !0 }),
|
|
38
|
+
/* @__PURE__ */ o(r, { ...e, variant: "ghost", rounded: !0 })
|
|
39
39
|
] })
|
|
40
|
-
] }), p = ["contained", "outlined", "ghost"],
|
|
40
|
+
] }), p = ["contained", "outlined", "ghost"], f = ["primary", "secondary", "error"], d = ["xs", "sm", "md", "lg"], B = "contained", b = "primary", x = "lg", g = {
|
|
41
41
|
undefined: void 0,
|
|
42
|
-
"<PlusIcon />": /* @__PURE__ */ o(
|
|
42
|
+
"<PlusIcon />": /* @__PURE__ */ o(a, {}),
|
|
43
43
|
"<Trash2Icon />": /* @__PURE__ */ o(l, {}),
|
|
44
|
-
"<FileDownIcon />": /* @__PURE__ */ o(
|
|
45
|
-
PlusIcon:
|
|
44
|
+
"<FileDownIcon />": /* @__PURE__ */ o(c, {}),
|
|
45
|
+
PlusIcon: a,
|
|
46
46
|
Trash2Icon: l,
|
|
47
|
-
FileDownIcon:
|
|
47
|
+
FileDownIcon: c
|
|
48
48
|
}, v = {
|
|
49
|
-
"<PlusIcon />": /* @__PURE__ */ o(
|
|
49
|
+
"<PlusIcon />": /* @__PURE__ */ o(a, {}),
|
|
50
50
|
"<Trash2Icon />": /* @__PURE__ */ o(l, {}),
|
|
51
|
-
"<FileDownIcon />": /* @__PURE__ */ o(
|
|
52
|
-
},
|
|
51
|
+
"<FileDownIcon />": /* @__PURE__ */ o(c, {})
|
|
52
|
+
}, I = {
|
|
53
53
|
title: "ButtonIcon",
|
|
54
|
-
component:
|
|
54
|
+
component: t,
|
|
55
55
|
render: h,
|
|
56
56
|
args: {
|
|
57
57
|
asChild: !1,
|
|
58
58
|
disabled: !1,
|
|
59
59
|
loading: !1,
|
|
60
60
|
rounded: !1,
|
|
61
|
-
variant:
|
|
62
|
-
color:
|
|
63
|
-
size:
|
|
64
|
-
children: /* @__PURE__ */ o(
|
|
61
|
+
variant: B,
|
|
62
|
+
color: b,
|
|
63
|
+
size: x,
|
|
64
|
+
children: /* @__PURE__ */ o(a, {}),
|
|
65
65
|
icon: void 0,
|
|
66
66
|
message: void 0,
|
|
67
67
|
title: void 0
|
|
@@ -87,15 +87,15 @@ const n = (e) => /* @__PURE__ */ o(
|
|
|
87
87
|
color: {
|
|
88
88
|
name: "color",
|
|
89
89
|
description: "ButtonIcon color",
|
|
90
|
-
defaultValue:
|
|
91
|
-
options:
|
|
90
|
+
defaultValue: f[0],
|
|
91
|
+
options: f,
|
|
92
92
|
control: { type: "inline-radio" }
|
|
93
93
|
},
|
|
94
94
|
size: {
|
|
95
95
|
name: "size",
|
|
96
96
|
description: "ButtonIcon size",
|
|
97
|
-
defaultValue:
|
|
98
|
-
options:
|
|
97
|
+
defaultValue: d[0],
|
|
98
|
+
options: d,
|
|
99
99
|
control: { type: "inline-radio" }
|
|
100
100
|
},
|
|
101
101
|
title: {
|
|
@@ -136,6 +136,11 @@ const n = (e) => /* @__PURE__ */ o(
|
|
|
136
136
|
options: Object.keys(v),
|
|
137
137
|
mapping: v,
|
|
138
138
|
control: { type: "inline-radio" }
|
|
139
|
+
},
|
|
140
|
+
counter: {
|
|
141
|
+
name: "counter",
|
|
142
|
+
description: "ButtonIcon counter from ButtonIconProps [`number` | `ButtonCounterBadgeReaderOptions`]",
|
|
143
|
+
control: { type: "number" }
|
|
139
144
|
}
|
|
140
145
|
},
|
|
141
146
|
parameters: {
|
|
@@ -146,21 +151,42 @@ const n = (e) => /* @__PURE__ */ o(
|
|
|
146
151
|
disabled: "#disabled"
|
|
147
152
|
}
|
|
148
153
|
}
|
|
149
|
-
},
|
|
154
|
+
}, m = {
|
|
150
155
|
asChild: !1,
|
|
151
156
|
disabled: !1,
|
|
152
157
|
loading: !1,
|
|
153
158
|
rounded: !1,
|
|
154
|
-
children: /* @__PURE__ */ o(
|
|
155
|
-
},
|
|
159
|
+
children: /* @__PURE__ */ o(a, {})
|
|
160
|
+
}, M = {
|
|
156
161
|
args: {
|
|
157
|
-
...
|
|
158
|
-
icon:
|
|
162
|
+
...I.args,
|
|
163
|
+
icon: c,
|
|
159
164
|
children: void 0
|
|
160
165
|
}
|
|
161
|
-
},
|
|
166
|
+
}, j = {
|
|
167
|
+
render: (e) => /* @__PURE__ */ o("div", { className: "flex flex-col gap-3", children: d.map((n) => /* @__PURE__ */ i(s, { children: [
|
|
168
|
+
/* @__PURE__ */ o(t, { ...e, size: n, message: "from counter" }),
|
|
169
|
+
/* @__PURE__ */ o(t, { ...e, size: n, counter: 0, message: "count=0" }),
|
|
170
|
+
/* @__PURE__ */ o(t, { ...e, size: n, counter: 9, message: "count=9" }),
|
|
171
|
+
/* @__PURE__ */ o(t, { ...e, size: n, counter: 99, message: "count=99" }),
|
|
172
|
+
/* @__PURE__ */ o(t, { ...e, size: n, counter: 999, message: "count=999" })
|
|
173
|
+
] }, n)) }),
|
|
162
174
|
args: {
|
|
163
|
-
...
|
|
175
|
+
...I.args,
|
|
176
|
+
variant: "ghost",
|
|
177
|
+
color: "secondary",
|
|
178
|
+
icon: y,
|
|
179
|
+
counter: 12,
|
|
180
|
+
title: "counter"
|
|
181
|
+
},
|
|
182
|
+
parameters: {
|
|
183
|
+
controls: {
|
|
184
|
+
include: ["counter", "variant", "color", "disabled", "loading", "rounded"]
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}, P = {
|
|
188
|
+
args: {
|
|
189
|
+
...m,
|
|
164
190
|
color: "primary",
|
|
165
191
|
size: "lg"
|
|
166
192
|
},
|
|
@@ -168,14 +194,14 @@ const n = (e) => /* @__PURE__ */ o(
|
|
|
168
194
|
variant: { control: !1 },
|
|
169
195
|
color: { control: !1 }
|
|
170
196
|
},
|
|
171
|
-
render:
|
|
197
|
+
render: u
|
|
172
198
|
};
|
|
173
|
-
|
|
199
|
+
P.parameters = {
|
|
174
200
|
controls: { exclude: ["variant", "color"] }
|
|
175
201
|
};
|
|
176
|
-
const
|
|
202
|
+
const C = {
|
|
177
203
|
args: {
|
|
178
|
-
...
|
|
204
|
+
...m,
|
|
179
205
|
color: "secondary",
|
|
180
206
|
size: "lg"
|
|
181
207
|
},
|
|
@@ -183,14 +209,14 @@ const P = {
|
|
|
183
209
|
variant: { control: !1 },
|
|
184
210
|
color: { control: !1 }
|
|
185
211
|
},
|
|
186
|
-
render:
|
|
212
|
+
render: u
|
|
187
213
|
};
|
|
188
|
-
|
|
214
|
+
C.parameters = {
|
|
189
215
|
controls: { exclude: ["variant", "color"] }
|
|
190
216
|
};
|
|
191
217
|
const T = {
|
|
192
218
|
args: {
|
|
193
|
-
...
|
|
219
|
+
...m,
|
|
194
220
|
color: "error",
|
|
195
221
|
size: "lg"
|
|
196
222
|
},
|
|
@@ -198,16 +224,17 @@ const T = {
|
|
|
198
224
|
variant: { control: !1 },
|
|
199
225
|
color: { control: !1 }
|
|
200
226
|
},
|
|
201
|
-
render:
|
|
227
|
+
render: u
|
|
202
228
|
};
|
|
203
229
|
T.parameters = {
|
|
204
230
|
controls: { exclude: ["variant", "color"] }
|
|
205
231
|
};
|
|
206
232
|
export {
|
|
207
|
-
|
|
233
|
+
j as Counter,
|
|
234
|
+
M as Default,
|
|
208
235
|
T as Error,
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
236
|
+
P as Primary,
|
|
237
|
+
C as Secondary,
|
|
238
|
+
I as default
|
|
212
239
|
};
|
|
213
240
|
//# sourceMappingURL=ButtonIcon.stories.js.map
|