@oneplatformdev/ui 0.1.99-beta.1 → 0.1.99-beta.11
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/.storybook/Wrappers.js +30 -0
- package/.storybook/Wrappers.js.map +1 -0
- package/Badge/badgeVariants.d.ts +1 -1
- package/Button/Button.d.ts +58 -0
- package/Button/Button.d.ts.map +1 -1
- package/Button/Button.js +60 -61
- package/Button/Button.js.map +1 -1
- package/Button/Button.stories.js +207 -70
- package/Button/Button.stories.js.map +1 -1
- package/Button/Button.types.d.ts +52 -6
- 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 +23 -0
- package/Button/ButtonCounterBadge.js.map +1 -0
- package/Button/buttonVariants.d.ts +12 -29
- package/Button/buttonVariants.d.ts.map +1 -1
- package/Button/buttonVariants.js +74 -12
- package/Button/buttonVariants.js.map +1 -1
- package/Button/index.js +6 -5
- package/ButtonIcon/ButtonIcon.d.ts +56 -0
- package/ButtonIcon/ButtonIcon.d.ts.map +1 -1
- package/ButtonIcon/ButtonIcon.js +70 -45
- package/ButtonIcon/ButtonIcon.js.map +1 -1
- package/ButtonIcon/ButtonIcon.stories.js +127 -79
- package/ButtonIcon/ButtonIcon.stories.js.map +1 -1
- package/ButtonIcon/ButtonIcon.types.d.ts +6 -8
- package/ButtonIcon/ButtonIcon.types.d.ts.map +1 -1
- package/ButtonIcon/buttonIconVariants.d.ts +4 -2
- package/ButtonIcon/buttonIconVariants.d.ts.map +1 -1
- package/ButtonIcon/buttonIconVariants.js +5 -5
- package/ButtonIcon/buttonIconVariants.js.map +1 -1
- package/CHANGELOG.md +147 -0
- package/Input/Input.d.ts.map +1 -1
- package/Input/Input.js +51 -38
- package/Input/Input.js.map +1 -1
- package/Input/Input.types.d.ts +1 -0
- package/Input/Input.types.d.ts.map +1 -1
- package/LoadedIcon/LoadedIcon.d.ts +1 -1
- package/LoadedIcon/LoadedIcon.d.ts.map +1 -1
- package/LoadedIcon/LoadedIcon.js +17 -13
- package/LoadedIcon/LoadedIcon.js.map +1 -1
- package/Textarea/Textarea.js +6 -6
- package/Textarea/Textarea.js.map +1 -1
- package/Textarea/Textarea.stories.js +12 -0
- package/Textarea/Textarea.stories.js.map +1 -0
- 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.js +326 -325
- package/package.json +7 -4
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as p } from "react/jsx-runtime";
|
|
2
|
+
const r = (e) => /* @__PURE__ */ p(
|
|
3
|
+
"div",
|
|
4
|
+
{
|
|
5
|
+
style: {
|
|
6
|
+
padding: "0px 20px",
|
|
7
|
+
display: "flex",
|
|
8
|
+
gap: "32px",
|
|
9
|
+
alignItems: "flex-start"
|
|
10
|
+
},
|
|
11
|
+
children: /* @__PURE__ */ p(
|
|
12
|
+
"div",
|
|
13
|
+
{
|
|
14
|
+
style: {
|
|
15
|
+
position: "relative",
|
|
16
|
+
border: "2px dashed rgba(139, 92, 246, 0.7)",
|
|
17
|
+
borderRadius: "24px",
|
|
18
|
+
padding: "24px 32px",
|
|
19
|
+
display: "flex",
|
|
20
|
+
gap: "32px"
|
|
21
|
+
},
|
|
22
|
+
children: e.children
|
|
23
|
+
}
|
|
24
|
+
)
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
export {
|
|
28
|
+
r as DashedWrapper
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=Wrappers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Wrappers.js","sources":["../../.storybook/Wrappers.tsx"],"sourcesContent":["import { PropsWithChildren } from \"react\";\n\nexport const MoreWrapper = (props: PropsWithChildren) => (\n <div\n style={{\n position: 'relative',\n padding: '24px 32px',\n display: 'flex',\n gap: '32px',\n }}\n >\n {props.children}\n </div>\n)\n\nexport const 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"],"names":["DashedWrapper","props","jsx"],"mappings":";AAeO,MAAMA,IAAgB,CAACC,MAE1B,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,OAAO;AAAA,MACL,SAAS;AAAA,MACT,SAAS;AAAA,MACT,KAAK;AAAA,MACL,YAAY;AAAA,IAAA;AAAA,IAGd,UAAA,gBAAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,OAAO;AAAA,UACL,UAAU;AAAA,UACV,QAAQ;AAAA,UACR,cAAc;AAAA,UACd,SAAS;AAAA,UACT,SAAS;AAAA,UACT,KAAK;AAAA,QAAA;AAAA,QAGN,UAAAD,EAAM;AAAA,MAAA;AAAA,IAAA;AAAA,EACT;AAAA;"}
|
package/Badge/badgeVariants.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const badgeVariants: (props?: ({
|
|
2
|
-
variant?: "default" | "destructive" | "
|
|
2
|
+
variant?: "default" | "destructive" | "secondary" | "outline" | null | undefined;
|
|
3
3
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
4
4
|
//# sourceMappingURL=badgeVariants.d.ts.map
|
package/Button/Button.d.ts
CHANGED
|
@@ -1,5 +1,63 @@
|
|
|
1
1
|
import { ButtonProps } from './Button.types';
|
|
2
2
|
import * as React from "react";
|
|
3
|
+
/**
|
|
4
|
+
* Universal Button component used for triggering actions and UI interactions.
|
|
5
|
+
* Supports variants, sizes, colors, start/end icon adornments, custom slot content,
|
|
6
|
+
* tooltip integration, loading state, and polymorphic rendering via `asChild`.
|
|
7
|
+
*
|
|
8
|
+
* @public
|
|
9
|
+
* @see [Documentation](#) // TODO: add link to docs
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* > Import:
|
|
13
|
+
* ```tsx
|
|
14
|
+
* import { Button } from '@oneplatformdev/ui/Button';
|
|
15
|
+
* ```
|
|
16
|
+
* > Basic usage:
|
|
17
|
+
* ```tsx
|
|
18
|
+
* <Button>Click me</Button>
|
|
19
|
+
* ```
|
|
20
|
+
* > Variant and size:
|
|
21
|
+
* ```tsx
|
|
22
|
+
* <Button variant="outline" size="lg">Large Button</Button>
|
|
23
|
+
* ```
|
|
24
|
+
* > With icons:
|
|
25
|
+
* ```tsx
|
|
26
|
+
* <Button startAdornment={<PlusIcon />}>Create</Button>
|
|
27
|
+
* <Button endAdornment={<ArrowRightIcon />}>Next</Button>
|
|
28
|
+
* ```
|
|
29
|
+
* > Icon style button:
|
|
30
|
+
* ```tsx
|
|
31
|
+
* <Button size="icon">
|
|
32
|
+
* <PlusIcon />
|
|
33
|
+
* </Button>
|
|
34
|
+
* ```
|
|
35
|
+
* > Polymorphic rendering (`asChild`):
|
|
36
|
+
* ```tsx
|
|
37
|
+
* <Button asChild>
|
|
38
|
+
* <a href="/dashboard">Go to Dashboard</a>
|
|
39
|
+
* </Button>
|
|
40
|
+
* ```
|
|
41
|
+
* > Tooltip via `message` or native `title`:
|
|
42
|
+
* ```tsx
|
|
43
|
+
* <Button title="Tooltip text">Hover me</Button>
|
|
44
|
+
* <Button message="Tooltip content">Hover me</Button>
|
|
45
|
+
* ```
|
|
46
|
+
* > Loading state:
|
|
47
|
+
* ```tsx
|
|
48
|
+
* <Button loading>Processing...</Button>
|
|
49
|
+
* ```
|
|
50
|
+
* > Disabled:
|
|
51
|
+
* ```tsx
|
|
52
|
+
* <Button disabled>Disabled</Button>
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* @remarks
|
|
56
|
+
* - Designed for texted usage. If you need icon-only, use `ButtonIcon`.
|
|
57
|
+
* - Works with any SVG React component or element, e.g. lucide-react, heroicons, custom icons.
|
|
58
|
+
*
|
|
59
|
+
* @see {@link ButtonIcon} for icon-only buttons
|
|
60
|
+
*/
|
|
3
61
|
export declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
4
62
|
export default Button;
|
|
5
63
|
//# sourceMappingURL=Button.d.ts.map
|
package/Button/Button.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../src/Button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAK9B,OAAO,
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../src/Button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAK9B,OAAO,EAAwB,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAqDxE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AACH,eAAO,MAAM,MAAM,uFA0ElB,CAAA;AAED,eAAe,MAAM,CAAC"}
|
package/Button/Button.js
CHANGED
|
@@ -1,77 +1,76 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import * as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { jsxs as N, Fragment as E, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import * as R from "react";
|
|
3
|
+
import { isValidElement as V, createElement as j } from "react";
|
|
4
|
+
import { Slot as C } from "@radix-ui/react-slot";
|
|
5
|
+
import { cn as I } from "@oneplatformdev/utils";
|
|
6
|
+
import { buttonVariants as F } from "./buttonVariants.js";
|
|
6
7
|
import "@radix-ui/react-tooltip";
|
|
7
|
-
import { Tooltip as
|
|
8
|
-
import { LoadedIcon as
|
|
9
|
-
const
|
|
10
|
-
const { variant:
|
|
11
|
-
if (
|
|
12
|
-
return console.warn('Button variant "default" is deprecated. Please use "variant=contained color=primary" instead.'),
|
|
13
|
-
if (
|
|
14
|
-
return console.warn('Button
|
|
15
|
-
if (
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
throw console.warn('Button variant "link" is not implemented yet. Please contact the development team for more information.'), new Error('Button variant "link" is not implemented yet. Please contact the development team for more information.');
|
|
21
|
-
return t;
|
|
22
|
-
}, R = x.forwardRef(
|
|
23
|
-
(a, o) => {
|
|
8
|
+
import { Tooltip as L } from "../Tooltip/Tooltip.js";
|
|
9
|
+
import { LoadedIcon as y } from "../LoadedIcon/LoadedIcon.js";
|
|
10
|
+
const S = (n) => {
|
|
11
|
+
const { variant: t, size: r, color: s } = n, e = { color: s, variant: t, size: r };
|
|
12
|
+
if (t === "default")
|
|
13
|
+
return console.warn('Button variant "default" is deprecated. Please use "variant=contained color=primary" instead.'), e.variant = "contained", e.color = "primary", e;
|
|
14
|
+
if (r === "icon")
|
|
15
|
+
return console.warn('Button size "icon" is deprecated. Please use "<ButtonIcon/>" component instead.'), e.variant = "contained", e.color = "secondary", e;
|
|
16
|
+
if (t === "transparent")
|
|
17
|
+
throw console.warn('Button variant "transparent" is removed. Please use "variant=none" instead.'), new Error('Button variant "transparent" is removed. Please use "variant=none" instead.');
|
|
18
|
+
return t === "outline" ? (console.warn('Button variant "outline" is deprecated. Please use "variant=outlined color=primary" instead.'), e.variant = "outlined", e.color = "primary", e) : t === "secondary" ? (console.warn('Button variant "secondary" is deprecated. Please use "variant=contained color=secondary" instead.'), e.variant = "contained", e.color = "secondary", e) : (t === "destructive" && (console.warn('Button variant "destructive" is deprecated. Please use "variant=contained color=error" instead.'), e.variant = "contained", e.color = "error"), e);
|
|
19
|
+
}, B = (n) => n ? V(n) ? n : j(n) : null, T = R.forwardRef(
|
|
20
|
+
(n, t) => {
|
|
24
21
|
const {
|
|
25
|
-
disabled:
|
|
26
|
-
className:
|
|
27
|
-
variant:
|
|
28
|
-
color:
|
|
29
|
-
size:
|
|
30
|
-
asChild:
|
|
31
|
-
title:
|
|
32
|
-
tooltip:
|
|
33
|
-
tooltipProps:
|
|
34
|
-
message:
|
|
35
|
-
loading:
|
|
36
|
-
children:
|
|
22
|
+
disabled: r,
|
|
23
|
+
className: s,
|
|
24
|
+
variant: e,
|
|
25
|
+
color: h,
|
|
26
|
+
size: c,
|
|
27
|
+
asChild: d = !1,
|
|
28
|
+
title: w = "",
|
|
29
|
+
tooltip: P,
|
|
30
|
+
tooltipProps: u = {},
|
|
31
|
+
message: g,
|
|
32
|
+
loading: a = !1,
|
|
33
|
+
children: p,
|
|
37
34
|
startAdornment: m,
|
|
38
|
-
endAdornment:
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
35
|
+
endAdornment: f,
|
|
36
|
+
screenReader: i,
|
|
37
|
+
...b
|
|
38
|
+
} = n, x = d ? C : "button", l = g || P || w, z = d ? p : /* @__PURE__ */ N(E, { children: [
|
|
39
|
+
!!m && /* @__PURE__ */ o(y, { loading: a, size: c, children: B(m) }),
|
|
40
|
+
p,
|
|
41
|
+
!!f && /* @__PURE__ */ o(y, { loading: a, size: c, children: B(f) }),
|
|
42
|
+
!!i && /* @__PURE__ */ o("span", { className: "sr-only", children: typeof i == "string" ? i : i.text })
|
|
43
|
+
] }), v = /* @__PURE__ */ o(
|
|
44
|
+
x,
|
|
46
45
|
{
|
|
47
46
|
type: "button",
|
|
48
|
-
ref:
|
|
49
|
-
disabled:
|
|
50
|
-
className:
|
|
51
|
-
|
|
52
|
-
...
|
|
53
|
-
className:
|
|
47
|
+
ref: t,
|
|
48
|
+
disabled: r,
|
|
49
|
+
className: I(
|
|
50
|
+
F({
|
|
51
|
+
...S({ variant: e, size: c, color: h }),
|
|
52
|
+
className: s
|
|
54
53
|
}),
|
|
55
|
-
|
|
54
|
+
a && "pointer-events-none opacity-80 user-select-none"
|
|
56
55
|
),
|
|
57
|
-
...
|
|
58
|
-
children:
|
|
56
|
+
...b,
|
|
57
|
+
children: z
|
|
59
58
|
}
|
|
60
59
|
);
|
|
61
|
-
return
|
|
62
|
-
|
|
60
|
+
return l ? /* @__PURE__ */ o(
|
|
61
|
+
L,
|
|
63
62
|
{
|
|
64
|
-
...
|
|
65
|
-
open:
|
|
66
|
-
message:
|
|
67
|
-
children:
|
|
63
|
+
...u || {},
|
|
64
|
+
open: u.open ?? (r || a || !l) ? !1 : void 0,
|
|
65
|
+
message: l,
|
|
66
|
+
children: v
|
|
68
67
|
}
|
|
69
|
-
) :
|
|
68
|
+
) : v;
|
|
70
69
|
}
|
|
71
70
|
);
|
|
72
|
-
|
|
71
|
+
T.displayName = "Button";
|
|
73
72
|
export {
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
T as Button,
|
|
74
|
+
T as default
|
|
76
75
|
};
|
|
77
76
|
//# sourceMappingURL=Button.js.map
|
package/Button/Button.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sources":["../../src/Button/Button.tsx"],"sourcesContent":["import * as React from \"react\"\nimport { Slot } from \"@radix-ui/react-slot\"\n\nimport { cn } from \"@oneplatformdev/utils\"\nimport {
|
|
1
|
+
{"version":3,"file":"Button.js","sources":["../../src/Button/Button.tsx"],"sourcesContent":["import * as React from \"react\"\nimport { Slot } from \"@radix-ui/react-slot\"\n\nimport { cn } from \"@oneplatformdev/utils\"\nimport { ButtonVarianceProps, buttonVariants } from './buttonVariants';\nimport { ButtonAdornmentProps, type ButtonProps } from './Button.types';\n\nimport { Tooltip } from '../Tooltip';\nimport { LoadedIcon } from \"../LoadedIcon\";\nimport { createElement, isValidElement } from \"react\";\n\nconst normalizedVariantProperties = (props: ButtonVarianceProps): ButtonVarianceProps => {\n const { variant, size, color } = props;\n const vls = { color, variant, size }\n if ((variant as string) === 'default') {\n console.warn('Button variant \"default\" is deprecated. Please use \"variant=contained color=primary\" instead.')\n vls.variant = 'contained'\n vls.color = 'primary'\n return vls\n }\n if ((size as string) === 'icon') {\n console.warn('Button size \"icon\" is deprecated. Please use \"<ButtonIcon/>\" component instead.')\n vls.variant = 'contained'\n vls.color = 'secondary'\n return vls\n // throw new Error('Button variant \"transparent\" is removed. Please use \"variant=none\" instead.')\n }\n if ((variant as string) === 'transparent') {\n console.warn('Button variant \"transparent\" is removed. Please use \"variant=none\" instead.')\n throw new Error('Button variant \"transparent\" is removed. Please use \"variant=none\" instead.')\n }\n if ((variant as string) === 'outline') {\n console.warn('Button variant \"outline\" is deprecated. Please use \"variant=outlined color=primary\" instead.')\n vls.variant = 'outlined'\n vls.color = 'primary'\n return vls\n }\n if ((variant as string) === 'secondary') {\n console.warn('Button variant \"secondary\" is deprecated. Please use \"variant=contained color=secondary\" instead.')\n vls.variant = 'contained'\n vls.color = 'secondary'\n return vls\n }\n if ((variant as string) === 'destructive') {\n console.warn('Button variant \"destructive\" is deprecated. Please use \"variant=contained color=error\" instead.')\n vls.variant = 'contained'\n vls.color = 'error'\n return vls\n }\n return vls;\n}\n\nconst renderAdornment = (Adornment?: ButtonAdornmentProps) => {\n if (!Adornment) return null;\n if (isValidElement(Adornment)) return Adornment;\n return createElement(Adornment);\n};\n\n/**\n * Universal Button component used for triggering actions and UI interactions.\n * Supports variants, sizes, colors, start/end icon adornments, custom slot content,\n * tooltip integration, loading state, and polymorphic rendering via `asChild`.\n *\n * @public\n * @see [Documentation](#) // TODO: add link to docs\n *\n * @example\n * > Import:\n * ```tsx\n * import { Button } from '@oneplatformdev/ui/Button';\n * ```\n * > Basic usage:\n * ```tsx\n * <Button>Click me</Button>\n * ```\n * > Variant and size:\n * ```tsx\n * <Button variant=\"outline\" size=\"lg\">Large Button</Button>\n * ```\n * > With icons:\n * ```tsx\n * <Button startAdornment={<PlusIcon />}>Create</Button>\n * <Button endAdornment={<ArrowRightIcon />}>Next</Button>\n * ```\n * > Icon style button:\n * ```tsx\n * <Button size=\"icon\">\n * <PlusIcon />\n * </Button>\n * ```\n * > Polymorphic rendering (`asChild`):\n * ```tsx\n * <Button asChild>\n * <a href=\"/dashboard\">Go to Dashboard</a>\n * </Button>\n * ```\n * > Tooltip via `message` or native `title`:\n * ```tsx\n * <Button title=\"Tooltip text\">Hover me</Button>\n * <Button message=\"Tooltip content\">Hover me</Button>\n * ```\n * > Loading state:\n * ```tsx\n * <Button loading>Processing...</Button>\n * ```\n * > Disabled:\n * ```tsx\n * <Button disabled>Disabled</Button>\n * ```\n *\n * @remarks\n * - Designed for texted usage. If you need icon-only, use `ButtonIcon`.\n * - Works with any SVG React component or element, e.g. lucide-react, heroicons, custom icons.\n *\n * @see {@link ButtonIcon} for icon-only buttons\n */\nexport const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n (props, ref) => {\n const {\n disabled,\n className,\n variant,\n color,\n size,\n asChild = false,\n title = '',\n tooltip,\n tooltipProps = {},\n message,\n loading = false,\n children,\n startAdornment,\n endAdornment,\n screenReader,\n ...rest\n } = props;\n const Comp = asChild ? Slot : \"button\"\n const msg = message || tooltip || title;\n\n const content = asChild\n ? children\n : (\n <>\n {!!startAdornment && (\n <LoadedIcon loading={loading} size={size}>\n {renderAdornment(startAdornment)}\n </LoadedIcon>\n )}\n\n {children}\n\n {!!endAdornment && (\n <LoadedIcon loading={loading} size={size}>\n {renderAdornment(endAdornment)}\n </LoadedIcon>\n )}\n\n {!!screenReader && <span className=\"sr-only\">{typeof screenReader === 'string' ? screenReader : screenReader.text}</span>}\n </>\n )\n\n const cmp = (\n <Comp\n type='button'\n ref={ref}\n disabled={disabled}\n className={cn(\n buttonVariants({\n ...normalizedVariantProperties({ variant, size, color }),\n className\n }),\n loading && 'pointer-events-none opacity-80 user-select-none',\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)\nButton.displayName = \"Button\"\nexport default Button;\n"],"names":["normalizedVariantProperties","props","variant","size","color","vls","renderAdornment","Adornment","isValidElement","createElement","Button","React","ref","disabled","className","asChild","title","tooltip","tooltipProps","message","loading","children","startAdornment","endAdornment","screenReader","rest","Comp","Slot","msg","content","jsxs","Fragment","jsx","LoadedIcon","cmp","cn","buttonVariants","Tooltip"],"mappings":";;;;;;;;;AAWA,MAAMA,IAA8B,CAACC,MAAoD;AACvF,QAAM,EAAE,SAAAC,GAAS,MAAAC,GAAM,OAAAC,EAAA,IAAUH,GAC3BI,IAAM,EAAE,OAAAD,GAAO,SAAAF,GAAS,MAAAC,EAAA;AAC9B,MAAKD,MAAuB;AAC1B,mBAAQ,KAAK,+FAA+F,GAC5GG,EAAI,UAAU,aACdA,EAAI,QAAQ,WACLA;AAET,MAAKF,MAAoB;AACvB,mBAAQ,KAAK,iFAAiF,GAC9FE,EAAI,UAAU,aACdA,EAAI,QAAQ,aACLA;AAGT,MAAKH,MAAuB;AAC1B,kBAAQ,KAAK,6EAA6E,GACpF,IAAI,MAAM,6EAA6E;AAE/F,SAAKA,MAAuB,aAC1B,QAAQ,KAAK,8FAA8F,GAC3GG,EAAI,UAAU,YACdA,EAAI,QAAQ,WACLA,KAEJH,MAAuB,eAC1B,QAAQ,KAAK,mGAAmG,GAChHG,EAAI,UAAU,aACdA,EAAI,QAAQ,aACLA,MAEJH,MAAuB,kBAC1B,QAAQ,KAAK,iGAAiG,GAC9GG,EAAI,UAAU,aACdA,EAAI,QAAQ,UACLA;AAGX,GAEMC,IAAkB,CAACC,MAClBA,IACDC,EAAeD,CAAS,IAAUA,IAC/BE,EAAcF,CAAS,IAFP,MA+DZG,IAASC,EAAM;AAAA,EAC1B,CAACV,GAAOW,MAAQ;AACd,UAAM;AAAA,MACJ,UAAAC;AAAA,MACA,WAAAC;AAAA,MACA,SAAAZ;AAAA,MACA,OAAAE;AAAA,MACA,MAAAD;AAAA,MACA,SAAAY,IAAU;AAAA,MACV,OAAAC,IAAQ;AAAA,MACR,SAAAC;AAAA,MACA,cAAAC,IAAe,CAAA;AAAA,MACf,SAAAC;AAAA,MACA,SAAAC,IAAU;AAAA,MACV,UAAAC;AAAA,MACA,gBAAAC;AAAA,MACA,cAAAC;AAAA,MACA,cAAAC;AAAA,MACA,GAAGC;AAAA,IAAA,IACDxB,GACEyB,IAAOX,IAAUY,IAAO,UACxBC,IAAMT,KAAWF,KAAWD,GAE5Ba,IAAUd,IACZM,IAEA,gBAAAS,EAAAC,GAAA,EACG,UAAA;AAAA,MAAA,CAAC,CAACT,KACD,gBAAAU,EAACC,GAAA,EAAW,SAAAb,GAAkB,MAAAjB,GAC3B,UAAAG,EAAgBgB,CAAc,GACjC;AAAA,MAGDD;AAAA,MAEA,CAAC,CAACE,KACD,gBAAAS,EAACC,KAAW,SAAAb,GAAkB,MAAAjB,GAC3B,UAAAG,EAAgBiB,CAAY,GAC/B;AAAA,MAGD,CAAC,CAACC,KAAgB,gBAAAQ,EAAC,QAAA,EAAK,WAAU,WAAW,UAAA,OAAOR,KAAiB,WAAWA,IAAeA,EAAa,KAAA,CAAK;AAAA,IAAA,GACpH,GAGEU,IACJ,gBAAAF;AAAA,MAACN;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,KAAAd;AAAA,QACA,UAAAC;AAAA,QACA,WAAWsB;AAAA,UACTC,EAAe;AAAA,YACb,GAAGpC,EAA4B,EAAE,SAAAE,GAAS,MAAAC,GAAM,OAAAC,GAAO;AAAA,YACvD,WAAAU;AAAA,UAAA,CACD;AAAA,UACDM,KAAW;AAAA,QAAA;AAAA,QAEZ,GAAGK;AAAA,QAEH,UAAAI;AAAA,MAAA;AAAA,IAAA;AAIL,WAAKD,IAEH,gBAAAI;AAAA,MAACK;AAAA,MAAA;AAAA,QACE,GAAInB,KAAgB,CAAA;AAAA,QACrB,MAAMA,EAAa,SAASL,KAAYO,KAAW,CAACQ,KAAO,KAAQ;AAAA,QACnE,SAASA;AAAA,QAER,UAAAM;AAAA,MAAA;AAAA,IAAA,IAPYA;AAAA,EAUnB;AACF;AACAxB,EAAO,cAAc;"}
|
package/Button/Button.stories.js
CHANGED
|
@@ -1,31 +1,8 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { Button as
|
|
3
|
-
import { PlusIcon as
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
{
|
|
7
|
-
style: {
|
|
8
|
-
padding: "0px 20px",
|
|
9
|
-
display: "flex",
|
|
10
|
-
gap: "32px",
|
|
11
|
-
alignItems: "flex-start"
|
|
12
|
-
},
|
|
13
|
-
children: /* @__PURE__ */ a(
|
|
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: e.children
|
|
25
|
-
}
|
|
26
|
-
)
|
|
27
|
-
}
|
|
28
|
-
), r = (e) => /* @__PURE__ */ a(
|
|
1
|
+
import { jsx as t, jsxs as i } from "react/jsx-runtime";
|
|
2
|
+
import { Button as o } from "./Button.js";
|
|
3
|
+
import { FileDownIcon as m, Trash2Icon as p, PlusIcon as n } from "lucide-react";
|
|
4
|
+
import { DashedWrapper as a } from "../.storybook/Wrappers.js";
|
|
5
|
+
const r = (e) => /* @__PURE__ */ t(
|
|
29
6
|
"div",
|
|
30
7
|
{
|
|
31
8
|
style: {
|
|
@@ -34,33 +11,107 @@ const h = (e) => /* @__PURE__ */ a(t, { ...e }), i = (e) => /* @__PURE__ */ a(
|
|
|
34
11
|
flexDirection: "column",
|
|
35
12
|
gap: "16px"
|
|
36
13
|
},
|
|
37
|
-
children: ["default", "hover", "focus", "active", "disabled"].map((l) => /* @__PURE__ */
|
|
38
|
-
|
|
14
|
+
children: ["default", "hover", "focus", "active", "disabled", "loading"].map((l) => /* @__PURE__ */ t(
|
|
15
|
+
o,
|
|
39
16
|
{
|
|
40
17
|
id: l,
|
|
41
18
|
...e,
|
|
42
19
|
disabled: l === "disabled" || e.disabled,
|
|
20
|
+
loading: l === "loading" || e.loading,
|
|
43
21
|
children: e.children
|
|
44
22
|
},
|
|
45
23
|
l
|
|
46
24
|
))
|
|
47
25
|
}
|
|
48
|
-
),
|
|
26
|
+
), u = ["none", "contained", "outlined", "ghost"], g = ["primary", "secondary", "error"], f = ["xs", "sm", "md", "lg"], h = "contained", y = "primary", v = "lg", s = {
|
|
27
|
+
undefined: void 0,
|
|
28
|
+
"<PlusIcon />": /* @__PURE__ */ t(n, {}),
|
|
29
|
+
"<Trash2Icon />": /* @__PURE__ */ t(p, {}),
|
|
30
|
+
"<FileDownIcon />": /* @__PURE__ */ t(m, {}),
|
|
31
|
+
PlusIcon: n,
|
|
32
|
+
Trash2Icon: p,
|
|
33
|
+
FileDownIcon: m
|
|
34
|
+
}, d = {
|
|
49
35
|
title: "Button",
|
|
50
|
-
component:
|
|
51
|
-
render:
|
|
36
|
+
component: o,
|
|
37
|
+
// render: Template,
|
|
52
38
|
args: {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
39
|
+
tooltip: void 0,
|
|
40
|
+
asChild: !1,
|
|
41
|
+
//
|
|
42
|
+
variant: h,
|
|
43
|
+
color: y,
|
|
44
|
+
size: v,
|
|
45
|
+
loading: !1,
|
|
56
46
|
disabled: !1,
|
|
57
|
-
|
|
47
|
+
startAdornment: void 0,
|
|
48
|
+
endAdornment: void 0,
|
|
49
|
+
slotProps: {},
|
|
50
|
+
tooltipProps: {}
|
|
58
51
|
},
|
|
59
52
|
argTypes: {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
53
|
+
tooltip: {
|
|
54
|
+
name: "tooltip",
|
|
55
|
+
description: "Button tooltip from ButtonProps [deprecated, use title and message instead]",
|
|
56
|
+
control: !1
|
|
57
|
+
},
|
|
58
|
+
asChild: {
|
|
59
|
+
name: "asChild",
|
|
60
|
+
description: "Button asChild from ButtonProps [boolean]",
|
|
61
|
+
control: !1
|
|
62
|
+
},
|
|
63
|
+
variant: {
|
|
64
|
+
name: "variant",
|
|
65
|
+
description: "Button variant from ButtonProps",
|
|
66
|
+
options: u,
|
|
67
|
+
control: { type: "inline-radio" }
|
|
68
|
+
},
|
|
69
|
+
color: {
|
|
70
|
+
name: "color",
|
|
71
|
+
description: "Button color from ButtonProps",
|
|
72
|
+
options: g,
|
|
73
|
+
control: { type: "inline-radio" }
|
|
74
|
+
},
|
|
75
|
+
size: {
|
|
76
|
+
name: "size",
|
|
77
|
+
description: "Button size from ButtonProps",
|
|
78
|
+
options: f,
|
|
79
|
+
control: { type: "inline-radio" }
|
|
80
|
+
},
|
|
81
|
+
title: {
|
|
82
|
+
name: "title",
|
|
83
|
+
description: "Button tooltip title from HTMLAttributes<HTMLButtonElement> [string only]",
|
|
84
|
+
control: { type: "text" }
|
|
85
|
+
},
|
|
86
|
+
message: {
|
|
87
|
+
name: "message",
|
|
88
|
+
description: "Button tooltip message from ButtonProps [ReactNode]",
|
|
89
|
+
control: { type: "object" }
|
|
90
|
+
},
|
|
91
|
+
startAdornment: {
|
|
92
|
+
name: "startAdornment",
|
|
93
|
+
description: "Button startAdornment from ButtonProps [`undefined` | `ComponentType<SVGProps<SVGSVGElement>>` | `ReactElement<SVGProps<SVGSVGElement>>`]",
|
|
94
|
+
options: Object.keys(s),
|
|
95
|
+
mapping: s,
|
|
96
|
+
control: { type: "inline-radio" }
|
|
97
|
+
},
|
|
98
|
+
endAdornment: {
|
|
99
|
+
name: "endAdornment",
|
|
100
|
+
description: "Button endAdornment from ButtonProps [`undefined` | `ComponentType<SVGProps<SVGSVGElement>>` | `ReactElement<SVGProps<SVGSVGElement>>`]",
|
|
101
|
+
options: Object.keys(s),
|
|
102
|
+
mapping: s,
|
|
103
|
+
control: { type: "inline-radio" }
|
|
104
|
+
},
|
|
105
|
+
slotProps: {
|
|
106
|
+
name: "slotProps",
|
|
107
|
+
description: "Button slotProps from ButtonProps [object]",
|
|
108
|
+
control: { type: "object" }
|
|
109
|
+
},
|
|
110
|
+
tooltipProps: {
|
|
111
|
+
name: "tooltipProps",
|
|
112
|
+
description: "Button tooltipProps from ButtonProps [object]",
|
|
113
|
+
control: { type: "object" }
|
|
114
|
+
}
|
|
64
115
|
},
|
|
65
116
|
parameters: {
|
|
66
117
|
pseudo: {
|
|
@@ -70,16 +121,99 @@ const h = (e) => /* @__PURE__ */ a(t, { ...e }), i = (e) => /* @__PURE__ */ a(
|
|
|
70
121
|
disabled: "#disabled"
|
|
71
122
|
}
|
|
72
123
|
}
|
|
73
|
-
},
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
startAdornment: /* @__PURE__ */ a(s, {}),
|
|
78
|
-
endAdornment: /* @__PURE__ */ a(s, {}),
|
|
124
|
+
}, c = {
|
|
125
|
+
...d.args,
|
|
126
|
+
startAdornment: /* @__PURE__ */ t(n, {}),
|
|
127
|
+
endAdornment: /* @__PURE__ */ t(n, {}),
|
|
79
128
|
children: "children"
|
|
80
|
-
},
|
|
129
|
+
}, D = {
|
|
130
|
+
args: {
|
|
131
|
+
...d.args,
|
|
132
|
+
children: "_children_"
|
|
133
|
+
}
|
|
134
|
+
}, x = {
|
|
135
|
+
render: (e) => /* @__PURE__ */ i(a, { children: [
|
|
136
|
+
/* @__PURE__ */ t(o, { ...e }),
|
|
137
|
+
/* @__PURE__ */ t(o, { ...e, startAdornment: /* @__PURE__ */ t(n, {}) }),
|
|
138
|
+
/* @__PURE__ */ t(o, { ...e, startAdornment: /* @__PURE__ */ t(n, {}), endAdornment: /* @__PURE__ */ t(n, {}) }),
|
|
139
|
+
/* @__PURE__ */ t(o, { ...e, endAdornment: /* @__PURE__ */ t(n, {}) })
|
|
140
|
+
] }),
|
|
141
|
+
args: {
|
|
142
|
+
...d.args,
|
|
143
|
+
disabled: !0,
|
|
144
|
+
children: "disabled"
|
|
145
|
+
}
|
|
146
|
+
}, S = {
|
|
147
|
+
render: (e) => /* @__PURE__ */ i(a, { children: [
|
|
148
|
+
/* @__PURE__ */ t(o, { ...e }),
|
|
149
|
+
/* @__PURE__ */ t(o, { ...e, startAdornment: /* @__PURE__ */ t(n, {}) }),
|
|
150
|
+
/* @__PURE__ */ t(o, { ...e, startAdornment: /* @__PURE__ */ t(n, {}), endAdornment: /* @__PURE__ */ t(n, {}) }),
|
|
151
|
+
/* @__PURE__ */ t(o, { ...e, endAdornment: /* @__PURE__ */ t(n, {}) })
|
|
152
|
+
] }),
|
|
153
|
+
args: {
|
|
154
|
+
children: "Loading…",
|
|
155
|
+
loading: !0
|
|
156
|
+
}
|
|
157
|
+
}, G = {
|
|
158
|
+
render: (e) => /* @__PURE__ */ t(a, { children: /* @__PURE__ */ i("div", { style: { display: "flex", flexDirection: "column", gap: "16px" }, children: [
|
|
159
|
+
/* @__PURE__ */ t(
|
|
160
|
+
o,
|
|
161
|
+
{
|
|
162
|
+
...e,
|
|
163
|
+
title: "delayDuration: 0",
|
|
164
|
+
tooltipProps: { delayDuration: 0 },
|
|
165
|
+
children: "delayDuration: 0"
|
|
166
|
+
}
|
|
167
|
+
),
|
|
168
|
+
/* @__PURE__ */ t(
|
|
169
|
+
o,
|
|
170
|
+
{
|
|
171
|
+
...e,
|
|
172
|
+
title: "delayDuration: 300 [default]",
|
|
173
|
+
tooltipProps: { delayDuration: 300 },
|
|
174
|
+
children: "delayDuration: 300"
|
|
175
|
+
}
|
|
176
|
+
),
|
|
177
|
+
/* @__PURE__ */ t(
|
|
178
|
+
o,
|
|
179
|
+
{
|
|
180
|
+
...e,
|
|
181
|
+
title: "delayDuration: 700",
|
|
182
|
+
tooltipProps: { delayDuration: 700 },
|
|
183
|
+
children: "delayDuration: 700"
|
|
184
|
+
}
|
|
185
|
+
),
|
|
186
|
+
/* @__PURE__ */ t(o, { ...e, title: "title_string", children: "title" }),
|
|
187
|
+
/* @__PURE__ */ t(o, { ...e, message: "message_string", children: "message: string" }),
|
|
188
|
+
/* @__PURE__ */ t(
|
|
189
|
+
o,
|
|
190
|
+
{
|
|
191
|
+
...e,
|
|
192
|
+
message: /* @__PURE__ */ t("span", { children: "message_node_span" }),
|
|
193
|
+
children: "message: ReactNode"
|
|
194
|
+
}
|
|
195
|
+
),
|
|
196
|
+
/* @__PURE__ */ t(
|
|
197
|
+
o,
|
|
198
|
+
{
|
|
199
|
+
...e,
|
|
200
|
+
message: "message_string",
|
|
201
|
+
tooltipProps: {
|
|
202
|
+
showQuestionMark: !0
|
|
203
|
+
},
|
|
204
|
+
children: "showQuestionMark: true"
|
|
205
|
+
}
|
|
206
|
+
)
|
|
207
|
+
] }) }),
|
|
208
|
+
args: {
|
|
209
|
+
children: "tooltips",
|
|
210
|
+
tooltipProps: {
|
|
211
|
+
defaultOpen: !0
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}, V = {
|
|
81
215
|
args: {
|
|
82
|
-
...
|
|
216
|
+
...c,
|
|
83
217
|
color: "primary",
|
|
84
218
|
size: "lg",
|
|
85
219
|
children: "Створити"
|
|
@@ -88,14 +222,14 @@ const h = (e) => /* @__PURE__ */ a(t, { ...e }), i = (e) => /* @__PURE__ */ a(
|
|
|
88
222
|
variant: { control: !1 },
|
|
89
223
|
color: { control: !1 }
|
|
90
224
|
},
|
|
91
|
-
render: (e) => /* @__PURE__ */
|
|
92
|
-
/* @__PURE__ */
|
|
93
|
-
/* @__PURE__ */
|
|
94
|
-
/* @__PURE__ */
|
|
225
|
+
render: (e) => /* @__PURE__ */ t("div", { className: "flex", children: /* @__PURE__ */ i(a, { children: [
|
|
226
|
+
/* @__PURE__ */ t(r, { ...e, variant: "contained" }),
|
|
227
|
+
/* @__PURE__ */ t(r, { ...e, variant: "outlined" }),
|
|
228
|
+
/* @__PURE__ */ t(r, { ...e, variant: "ghost" })
|
|
95
229
|
] }) })
|
|
96
|
-
},
|
|
230
|
+
}, T = {
|
|
97
231
|
args: {
|
|
98
|
-
...
|
|
232
|
+
...c,
|
|
99
233
|
color: "secondary",
|
|
100
234
|
size: "lg",
|
|
101
235
|
children: "Створити"
|
|
@@ -104,14 +238,14 @@ const h = (e) => /* @__PURE__ */ a(t, { ...e }), i = (e) => /* @__PURE__ */ a(
|
|
|
104
238
|
variant: { control: !1 },
|
|
105
239
|
color: { control: !1 }
|
|
106
240
|
},
|
|
107
|
-
render: (e) => /* @__PURE__ */
|
|
108
|
-
/* @__PURE__ */
|
|
109
|
-
/* @__PURE__ */
|
|
110
|
-
/* @__PURE__ */
|
|
241
|
+
render: (e) => /* @__PURE__ */ t("div", { className: "flex", children: /* @__PURE__ */ i(a, { children: [
|
|
242
|
+
/* @__PURE__ */ t(r, { ...e, variant: "contained" }),
|
|
243
|
+
/* @__PURE__ */ t(r, { ...e, variant: "outlined" }),
|
|
244
|
+
/* @__PURE__ */ t(r, { ...e, variant: "ghost" })
|
|
111
245
|
] }) })
|
|
112
|
-
},
|
|
246
|
+
}, _ = {
|
|
113
247
|
args: {
|
|
114
|
-
...
|
|
248
|
+
...c,
|
|
115
249
|
color: "error",
|
|
116
250
|
size: "lg",
|
|
117
251
|
children: "Створити"
|
|
@@ -120,17 +254,20 @@ const h = (e) => /* @__PURE__ */ a(t, { ...e }), i = (e) => /* @__PURE__ */ a(
|
|
|
120
254
|
variant: { control: !1 },
|
|
121
255
|
color: { control: !1 }
|
|
122
256
|
},
|
|
123
|
-
render: (e) => /* @__PURE__ */
|
|
124
|
-
/* @__PURE__ */
|
|
125
|
-
/* @__PURE__ */
|
|
126
|
-
/* @__PURE__ */
|
|
257
|
+
render: (e) => /* @__PURE__ */ t("div", { className: "flex", children: /* @__PURE__ */ i(a, { children: [
|
|
258
|
+
/* @__PURE__ */ t(r, { ...e, variant: "contained" }),
|
|
259
|
+
/* @__PURE__ */ t(r, { ...e, variant: "outlined" }),
|
|
260
|
+
/* @__PURE__ */ t(r, { ...e, variant: "ghost" })
|
|
127
261
|
] }) })
|
|
128
262
|
};
|
|
129
263
|
export {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
264
|
+
D as Default,
|
|
265
|
+
x as Disabled,
|
|
266
|
+
_ as Error,
|
|
267
|
+
S as Loading,
|
|
268
|
+
V as Primary,
|
|
269
|
+
T as Secondary,
|
|
270
|
+
G as Tooltips,
|
|
271
|
+
d as default
|
|
135
272
|
};
|
|
136
273
|
//# sourceMappingURL=Button.stories.js.map
|