@oneplatformdev/ui 0.1.99-beta.5 → 0.1.99-beta.7
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.map +1 -1
- package/Button/Button.js +47 -43
- package/Button/Button.js.map +1 -1
- package/Button/Button.types.d.ts +10 -0
- package/Button/Button.types.d.ts.map +1 -1
- package/ButtonIcon/ButtonIcon.d.ts.map +1 -1
- package/ButtonIcon/ButtonIcon.js +44 -40
- package/ButtonIcon/ButtonIcon.js.map +1 -1
- package/CHANGELOG.md +33 -0
- 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/package.json +4 -4
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,EAAwB,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAqDxE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AACH,eAAO,MAAM,MAAM,
|
|
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,uFA2ElB,CAAA;AAED,eAAe,MAAM,CAAC"}
|
package/Button/Button.js
CHANGED
|
@@ -1,74 +1,78 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import * as
|
|
1
|
+
import { jsxs as y, Fragment as E, jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import * as R from "react";
|
|
3
3
|
import { isValidElement as V, createElement as j } from "react";
|
|
4
4
|
import { Slot as C } from "@radix-ui/react-slot";
|
|
5
5
|
import { cn as I } from "@oneplatformdev/utils";
|
|
6
|
-
import { buttonVariants as
|
|
6
|
+
import { buttonVariants as F } from "./buttonVariants.js";
|
|
7
7
|
import "@radix-ui/react-tooltip";
|
|
8
|
-
import { Tooltip as
|
|
9
|
-
import { LoadedIcon as
|
|
10
|
-
const
|
|
11
|
-
const { variant:
|
|
12
|
-
if (
|
|
8
|
+
import { Tooltip as L } from "../Tooltip/Tooltip.js";
|
|
9
|
+
import { LoadedIcon as B } 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
13
|
return console.warn('Button variant "default" is deprecated. Please use "variant=contained color=primary" instead.'), e.variant = "contained", e.color = "primary", e;
|
|
14
14
|
if (r === "icon")
|
|
15
15
|
return console.warn('Button size "icon" is deprecated. Please use "<ButtonIcon/>" component instead.'), e.variant = "contained", e.color = "secondary", e;
|
|
16
|
-
if (
|
|
16
|
+
if (t === "transparent")
|
|
17
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
|
|
19
|
-
},
|
|
20
|
-
(
|
|
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
|
+
}, h = (n) => n ? V(n) ? n : j(n) : null, T = R.forwardRef(
|
|
20
|
+
(n, t) => {
|
|
21
21
|
const {
|
|
22
22
|
disabled: r,
|
|
23
|
-
className:
|
|
23
|
+
className: s,
|
|
24
24
|
variant: e,
|
|
25
|
-
color:
|
|
26
|
-
size:
|
|
27
|
-
asChild:
|
|
28
|
-
title:
|
|
29
|
-
tooltip:
|
|
30
|
-
tooltipProps:
|
|
31
|
-
message:
|
|
25
|
+
color: w,
|
|
26
|
+
size: c,
|
|
27
|
+
asChild: d = !1,
|
|
28
|
+
title: P = "",
|
|
29
|
+
tooltip: g,
|
|
30
|
+
tooltipProps: u = {},
|
|
31
|
+
message: b,
|
|
32
32
|
loading: o = !1,
|
|
33
|
-
children:
|
|
33
|
+
children: p,
|
|
34
34
|
startAdornment: m,
|
|
35
|
-
endAdornment:
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
35
|
+
endAdornment: f,
|
|
36
|
+
screenReader: a,
|
|
37
|
+
...x
|
|
38
|
+
} = n, z = d ? C : "button", l = b || g || P, N = d ? p : /* @__PURE__ */ y(E, { children: [
|
|
39
|
+
!!m && /* @__PURE__ */ i(B, { loading: o, size: c, children: h(m) }),
|
|
40
|
+
p,
|
|
41
|
+
!!f && /* @__PURE__ */ i(B, { loading: o, size: c, children: h(f) })
|
|
42
|
+
] }), v = /* @__PURE__ */ y(
|
|
43
|
+
z,
|
|
43
44
|
{
|
|
44
45
|
type: "button",
|
|
45
|
-
ref:
|
|
46
|
+
ref: t,
|
|
46
47
|
disabled: r,
|
|
47
48
|
className: I(
|
|
48
|
-
|
|
49
|
-
...
|
|
50
|
-
className:
|
|
49
|
+
F({
|
|
50
|
+
...S({ variant: e, size: c, color: w }),
|
|
51
|
+
className: s
|
|
51
52
|
}),
|
|
52
53
|
o && "pointer-events-none opacity-80 user-select-none"
|
|
53
54
|
),
|
|
54
|
-
...
|
|
55
|
-
children:
|
|
55
|
+
...x,
|
|
56
|
+
children: [
|
|
57
|
+
N,
|
|
58
|
+
!!a && /* @__PURE__ */ i("span", { className: "sr-only", children: typeof a == "string" ? a : a.text })
|
|
59
|
+
]
|
|
56
60
|
}
|
|
57
61
|
);
|
|
58
|
-
return
|
|
59
|
-
|
|
62
|
+
return l ? /* @__PURE__ */ i(
|
|
63
|
+
L,
|
|
60
64
|
{
|
|
61
|
-
...
|
|
62
|
-
open:
|
|
63
|
-
message:
|
|
65
|
+
...u || {},
|
|
66
|
+
open: u.open ?? (r || o || !l) ? !1 : void 0,
|
|
67
|
+
message: l,
|
|
64
68
|
children: v
|
|
65
69
|
}
|
|
66
70
|
) : v;
|
|
67
71
|
}
|
|
68
72
|
);
|
|
69
|
-
|
|
73
|
+
T.displayName = "Button";
|
|
70
74
|
export {
|
|
71
|
-
|
|
72
|
-
|
|
75
|
+
T as Button,
|
|
76
|
+
T as default
|
|
73
77
|
};
|
|
74
78
|
//# 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 { ButtonCVAProps, 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: ButtonCVAProps): ButtonCVAProps => {\n const { variant, size, color } = props;\n const vls = { color, variant, size }\n if (variant === '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 === '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 === '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 === '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 Button} for regular text 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 ...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 )\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","rest","Comp","Slot","msg","content","jsxs","Fragment","jsx","LoadedIcon","cmp","cn","buttonVariants","Tooltip"],"mappings":";;;;;;;;;AAWA,MAAMA,IAA8B,CAACC,MAA0C;AAC7E,QAAM,EAAE,SAAAC,GAAS,MAAAC,GAAM,OAAAC,EAAA,IAAUH,GAC3BI,IAAM,EAAE,OAAAD,GAAO,SAAAF,GAAS,MAAAC,EAAA;AAC9B,MAAID,MAAY;AACd,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,SAAIA,MAAY,aACd,QAAQ,KAAK,8FAA8F,GAC3GG,EAAI,UAAU,YACdA,EAAI,QAAQ,WACLA,KAELH,MAAY,eACd,QAAQ,KAAK,mGAAmG,GAChHG,EAAI,UAAU,aACdA,EAAI,QAAQ,aACLA,MAELH,MAAY,kBACd,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,GAAGC;AAAA,IAAA,
|
|
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 { ButtonCVAProps, 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: ButtonCVAProps): ButtonCVAProps => {\n const { variant, size, color } = props;\n const vls = { color, variant, size }\n if (variant === '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 === '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 === '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 === '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 Button} for regular text 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 )\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 {!!screenReader && <span className=\"sr-only\">\n {typeof screenReader === 'string' ? screenReader : screenReader.text}\n </span>}\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,MAA0C;AAC7E,QAAM,EAAE,SAAAC,GAAS,MAAAC,GAAM,OAAAC,EAAA,IAAUH,GAC3BI,IAAM,EAAE,OAAAD,GAAO,SAAAF,GAAS,MAAAC,EAAA;AAC9B,MAAID,MAAY;AACd,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,SAAIA,MAAY,aACd,QAAQ,KAAK,8FAA8F,GAC3GG,EAAI,UAAU,YACdA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AE,SAAAE,GAAS,MAAAC,GAAM,OAAAC,GAAO;AAAA,YACvD,WAAAU;AAAA,UAAA,CACD;AAAA,UACDM,KAAW;AAAA,QAAA;AAAA,QAEZ,GAAGK;AAAA,QAEH,UAAA;AAAA,UAAAI;AAAA,UACA,CAAC,CAACL,KAAgB,gBAAAQ,EAAC,QAAA,EAAK,WAAU,WAChC,UAAA,OAAOR,KAAiB,WAAWA,IAAeA,EAAa,KAAA,CAClE;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAIJ,WAAKI,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.types.d.ts
CHANGED
|
@@ -2,10 +2,20 @@ import { ButtonHTMLAttributes, ComponentType, ReactElement, SVGProps, ReactNode
|
|
|
2
2
|
import { TooltipProps } from '../Tooltip';
|
|
3
3
|
import { ButtonVarianceProps } from './buttonVariants';
|
|
4
4
|
type ButtonAttributes = ButtonHTMLAttributes<HTMLButtonElement>;
|
|
5
|
+
type ButtonScreenReaderOptions = {
|
|
6
|
+
/** Text to be read by screen readers when the button is in a loading state. */
|
|
7
|
+
text?: string;
|
|
8
|
+
};
|
|
9
|
+
export type ButtonScreenReader = ButtonScreenReaderOptions['text'] | ButtonScreenReaderOptions;
|
|
5
10
|
export interface ButtonDefaultProps extends Omit<ButtonAttributes, 'color' | 'title' | 'disabled'> {
|
|
6
11
|
asChild?: boolean;
|
|
7
12
|
loading?: boolean;
|
|
8
13
|
disabled?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Screen reader text or options used for accessibility (e.g., when the button is loading).
|
|
16
|
+
* Accepts a string or an object with a `text` property for more control.
|
|
17
|
+
*/
|
|
18
|
+
screenReader?: ButtonScreenReader;
|
|
9
19
|
}
|
|
10
20
|
export interface ButtonTooltipProps {
|
|
11
21
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.types.d.ts","sourceRoot":"","sources":["../../src/Button/Button.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACnF,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAE5D,KAAK,gBAAgB,GAAG,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;AAEhE,MAAM,WAAW,kBACf,SAAQ,IAAI,CAAC,gBAAgB,EAAE,OAAO,GAAG,OAAO,GAAG,UAAU,CAAC;IAC9D,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Button.types.d.ts","sourceRoot":"","sources":["../../src/Button/Button.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACnF,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAE5D,KAAK,gBAAgB,GAAG,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;AAEhE,KAAK,yBAAyB,GAAG;IAC/B,+EAA+E;IAC/E,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAA;AACD,MAAM,MAAM,kBAAkB,GAAG,yBAAy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KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAcrD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,eAAO,MAAM,UAAU,
|
|
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;AAcrD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,eAAO,MAAM,UAAU,2FAiEtB,CAAA;AAED,eAAe,UAAU,CAAC"}
|
package/ButtonIcon/ButtonIcon.js
CHANGED
|
@@ -1,65 +1,69 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import * as
|
|
1
|
+
import { jsx as n, jsxs as R } from "react/jsx-runtime";
|
|
2
|
+
import * as j from "react";
|
|
3
3
|
import { isValidElement as B, createElement as C } from "react";
|
|
4
4
|
import { cn as E } from "@oneplatformdev/utils";
|
|
5
5
|
import { buttonIconVariants as I } from "./buttonIconVariants.js";
|
|
6
|
-
import { Slot as
|
|
6
|
+
import { Slot as V } from "@radix-ui/react-slot";
|
|
7
7
|
import "@radix-ui/react-tooltip";
|
|
8
|
-
import { Tooltip as
|
|
9
|
-
import { LoadedIcon as
|
|
10
|
-
const
|
|
11
|
-
(t,
|
|
8
|
+
import { Tooltip as w } from "../Tooltip/Tooltip.js";
|
|
9
|
+
import { LoadedIcon as z } from "../LoadedIcon/LoadedIcon.js";
|
|
10
|
+
const L = (t) => t ? B(t) ? t : C(t) : null, P = j.forwardRef(
|
|
11
|
+
(t, d) => {
|
|
12
12
|
const {
|
|
13
|
-
asChild:
|
|
13
|
+
asChild: s,
|
|
14
14
|
children: i,
|
|
15
|
-
icon:
|
|
16
|
-
disabled:
|
|
15
|
+
icon: f,
|
|
16
|
+
disabled: a = !1,
|
|
17
17
|
loading: o = !1,
|
|
18
|
-
message:
|
|
19
|
-
title:
|
|
20
|
-
tooltipProps:
|
|
21
|
-
className:
|
|
22
|
-
variant:
|
|
23
|
-
color:
|
|
18
|
+
message: u,
|
|
19
|
+
title: h = "",
|
|
20
|
+
tooltipProps: l = {},
|
|
21
|
+
className: g,
|
|
22
|
+
variant: y,
|
|
23
|
+
color: b,
|
|
24
24
|
size: m,
|
|
25
|
-
rounded:
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
rounded: x,
|
|
26
|
+
screenReader: e,
|
|
27
|
+
...N
|
|
28
|
+
} = t, v = s ? V : "button", r = u || h, c = s ? i : /* @__PURE__ */ n(z, { loading: o, size: m, children: L(f) ?? i });
|
|
29
|
+
if (!c) return null;
|
|
30
|
+
const p = /* @__PURE__ */ R(
|
|
31
|
+
v,
|
|
31
32
|
{
|
|
32
33
|
type: "button",
|
|
33
|
-
ref:
|
|
34
|
-
disabled:
|
|
34
|
+
ref: d,
|
|
35
|
+
disabled: a,
|
|
35
36
|
className: E(
|
|
36
37
|
I({
|
|
37
|
-
variant:
|
|
38
|
+
variant: y,
|
|
38
39
|
size: m,
|
|
39
|
-
color:
|
|
40
|
-
rounded:
|
|
41
|
-
className:
|
|
40
|
+
color: b,
|
|
41
|
+
rounded: x,
|
|
42
|
+
className: g
|
|
42
43
|
}),
|
|
43
44
|
o && "pointer-events-none opacity-80"
|
|
44
45
|
),
|
|
45
|
-
...
|
|
46
|
-
children:
|
|
46
|
+
...N,
|
|
47
|
+
children: [
|
|
48
|
+
c,
|
|
49
|
+
!!e && /* @__PURE__ */ n("span", { className: "sr-only", children: typeof e == "string" ? e : e.text })
|
|
50
|
+
]
|
|
47
51
|
}
|
|
48
52
|
);
|
|
49
|
-
return
|
|
50
|
-
|
|
53
|
+
return r ? /* @__PURE__ */ n(
|
|
54
|
+
w,
|
|
51
55
|
{
|
|
52
|
-
...
|
|
53
|
-
open:
|
|
54
|
-
message:
|
|
55
|
-
children:
|
|
56
|
+
...l || {},
|
|
57
|
+
open: l.open ?? (a || o || !r) ? !1 : void 0,
|
|
58
|
+
message: r,
|
|
59
|
+
children: p
|
|
56
60
|
}
|
|
57
|
-
) :
|
|
61
|
+
) : p;
|
|
58
62
|
}
|
|
59
63
|
);
|
|
60
|
-
|
|
64
|
+
P.displayName = "Button";
|
|
61
65
|
export {
|
|
62
|
-
|
|
63
|
-
|
|
66
|
+
P as ButtonIcon,
|
|
67
|
+
P as default
|
|
64
68
|
};
|
|
65
69
|
//# 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 ButtonIcon} for icon-only 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 ...rest\n } = props;\n\n const Comp = asChild ? Slot : \"button\"\n const msg = message || title;\n\n const content = asChild\n ? children\n : (\n <LoadedIcon loading={loading} size={size}>\n {renderInnerIcon(icon) ?? children}\n </LoadedIcon>\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 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","rest","Comp","Slot","msg","content","jsx","LoadedIcon","cmp","cn","buttonIconVariants","Tooltip"],"mappings":";;;;;;;;;AAYA,MAAMA,IAAkB,CAACC,MAClBA,IACDC,EAAeD,CAAI,IAAUA,IAC1BE,EAAcF,CAAI,IAFP,MAuDPG,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,GAAGC;AAAA,IAAA,
|
|
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 ButtonIcon} for icon-only 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 ...rest\n } = props;\n\n const Comp = asChild ? Slot : \"button\"\n const msg = message || title;\n\n const content = asChild\n ? children\n : (\n <LoadedIcon loading={loading} size={size}>\n {renderInnerIcon(icon) ?? children}\n </LoadedIcon>\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 buttonIconVariants({\n variant, size, color, rounded,\n className\n }),\n loading && 'pointer-events-none opacity-80',\n )}\n {...rest}\n >\n {content}\n {!!screenReader && <span className=\"sr-only\">\n {typeof screenReader === 'string' ? screenReader : screenReader.text}\n </span>}\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","rest","Comp","Slot","msg","content","jsx","LoadedIcon","cmp","jsxs","cn","buttonIconVariants","Toolt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BAAAE;AAAA,MAACM;AAAA,MAAA;AAAA,QACE,GAAIlB,KAAgB,CAAA;AAAA,QACrB,MAAMA,EAAa,SAASJ,KAAYC,KAAW,CAACa,KAAO,KAAQ;AAAA,QACnE,SAASA;AAAA,QAER,UAAAI;AAAA,MAAA;AAAA,IAAA,IAPYA;AAAA,EAUnB;AACF;AACAzB,EAAW,cAAc;"}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,36 @@
|
|
|
1
|
+
## 0.1.99-beta.7 (2025-12-29)
|
|
2
|
+
|
|
3
|
+
### 🚀 Features
|
|
4
|
+
|
|
5
|
+
- **Button:** add screen reader support for accessibility ([ec7de8e](https://github.com/oneplatformdev/core-web/commit/ec7de8e))
|
|
6
|
+
|
|
7
|
+
### 🧱 Updated Dependencies
|
|
8
|
+
|
|
9
|
+
- Updated @oneplatformdev/utils to 0.1.99-beta.7
|
|
10
|
+
- Updated @oneplatformdev/hooks to 0.1.99-beta.7
|
|
11
|
+
- Updated @oneplatformdev/tokens to 0.1.99-beta.7
|
|
12
|
+
|
|
13
|
+
### ❤️ Thank You
|
|
14
|
+
|
|
15
|
+
- Bohdan Radchenko
|
|
16
|
+
|
|
17
|
+
## 0.1.99-beta.6 (2025-12-29)
|
|
18
|
+
|
|
19
|
+
### 🚀 Features
|
|
20
|
+
|
|
21
|
+
- **ButtonIcon:** introduce icon-only variant with enhanced props and storybook support ([d643217](https://github.com/oneplatformdev/core-web/commit/d643217))
|
|
22
|
+
- **Button:** add storybook integration with loading and tooltip support ([72ae45e](https://github.com/oneplatformdev/core-web/commit/72ae45e))
|
|
23
|
+
|
|
24
|
+
### 🧱 Updated Dependencies
|
|
25
|
+
|
|
26
|
+
- Updated @oneplatformdev/utils to 0.1.99-beta.6
|
|
27
|
+
- Updated @oneplatformdev/hooks to 0.1.99-beta.6
|
|
28
|
+
- Updated @oneplatformdev/tokens to 0.1.99-beta.6
|
|
29
|
+
|
|
30
|
+
### ❤️ Thank You
|
|
31
|
+
|
|
32
|
+
- Bohdan Radchenko
|
|
33
|
+
|
|
1
34
|
## 0.1.99-beta.5 (2025-12-29)
|
|
2
35
|
|
|
3
36
|
### 🧱 Updated Dependencies
|
package/Textarea/Textarea.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsxs as l, Fragment as
|
|
1
|
+
import { jsxs as l, Fragment as p, jsx as b } from "react/jsx-runtime";
|
|
2
2
|
import * as h from "react";
|
|
3
3
|
import { useId as A, useRef as v, useState as w, useImperativeHandle as z, useEffect as F } from "react";
|
|
4
4
|
import { cn as d } from "@oneplatformdev/utils";
|
|
@@ -9,12 +9,12 @@ const y = h.forwardRef(
|
|
|
9
9
|
className: c,
|
|
10
10
|
value: t = "",
|
|
11
11
|
maxHeight: o = Number.MAX_SAFE_INTEGER,
|
|
12
|
-
minHeight: i =
|
|
12
|
+
minHeight: i = 40,
|
|
13
13
|
resizeble: f = !0,
|
|
14
14
|
counter: s = !1,
|
|
15
15
|
id: n = "",
|
|
16
16
|
...r
|
|
17
|
-
} = u, a = A(), e = v(null), [x,
|
|
17
|
+
} = u, a = A(), e = v(null), [x, g] = w("");
|
|
18
18
|
return N({
|
|
19
19
|
textAreaRef: e,
|
|
20
20
|
triggerAutoSize: x,
|
|
@@ -27,8 +27,8 @@ const y = h.forwardRef(
|
|
|
27
27
|
maxHeight: o,
|
|
28
28
|
minHeight: i
|
|
29
29
|
})), F(() => {
|
|
30
|
-
|
|
31
|
-
}, [r?.defaultValue, t]), /* @__PURE__ */ l(
|
|
30
|
+
g(t);
|
|
31
|
+
}, [r?.defaultValue, t]), /* @__PURE__ */ l(p, { children: [
|
|
32
32
|
/* @__PURE__ */ b(
|
|
33
33
|
"textarea",
|
|
34
34
|
{
|
|
@@ -38,7 +38,7 @@ const y = h.forwardRef(
|
|
|
38
38
|
value: t,
|
|
39
39
|
className: d(
|
|
40
40
|
"flex min-h-10 w-full px-3 py-2 text-base relative md:text-sm",
|
|
41
|
-
"rounded-
|
|
41
|
+
"rounded-lg border border-input bg-[#FCFCFC] shadow-none",
|
|
42
42
|
"placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
|
|
43
43
|
"focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring",
|
|
44
44
|
f ? "resize" : "resize-none overflow-hidden!",
|
package/Textarea/Textarea.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Textarea.js","sources":["../../src/Textarea/Textarea.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useEffect, useId, useImperativeHandle, useRef, useState } from 'react';\nimport { cn } from '@oneplatformdev/utils';\n\nimport { TextareaProps } from './Textarea.types';\nimport { useAutosizeTextArea } from './useAutosizeTextArea';\n\nconst Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(\n (textareaProps, ref) => {\n const {\n className,\n value = '',\n maxHeight = Number.MAX_SAFE_INTEGER,\n minHeight =
|
|
1
|
+
{"version":3,"file":"Textarea.js","sources":["../../src/Textarea/Textarea.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useEffect, useId, useImperativeHandle, useRef, useState } from 'react';\nimport { cn } from '@oneplatformdev/utils';\n\nimport { TextareaProps } from './Textarea.types';\nimport { useAutosizeTextArea } from './useAutosizeTextArea';\n\nconst Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(\n (textareaProps, ref) => {\n const {\n className,\n value = '',\n maxHeight = Number.MAX_SAFE_INTEGER,\n minHeight = 40,\n resizeble = true,\n counter = false,\n id: customId = '',\n ...props\n } = textareaProps;\n const id = useId();\n const textAreaRef = useRef<HTMLTextAreaElement | null>(null);\n const [triggerAutoSize, setTriggerAutoSize] = useState('');\n\n useAutosizeTextArea({\n textAreaRef,\n triggerAutoSize: triggerAutoSize,\n maxHeight,\n minHeight,\n });\n\n useImperativeHandle(ref, () => ({\n ...((textAreaRef.current ?? {}) as HTMLTextAreaElement),\n textArea: textAreaRef.current as HTMLTextAreaElement,\n focus: () => textAreaRef?.current?.focus(),\n maxHeight,\n minHeight,\n }));\n\n useEffect(() => {\n setTriggerAutoSize(value as string);\n }, [props?.defaultValue, value]);\n\n return (\n <>\n <textarea\n id={customId || id}\n {...props}\n ref={textAreaRef}\n value={value}\n className={cn(\n 'flex min-h-10 w-full px-3 py-2 text-base relative md:text-sm',\n 'rounded-lg border border-input bg-[#FCFCFC] shadow-none',\n 'placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50',\n 'focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring',\n resizeble ? 'resize' : 'resize-none overflow-hidden!',\n counter && 'pb-2',\n className\n )}\n />\n {counter && (\n <label\n htmlFor={customId || id}\n className={cn(\n 'w-full text-right inline-flex items-center justify-end',\n 'text-sm font-normal text-muted-foreground',\n 'leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70'\n )}\n >\n {String(value || '').length} / {props?.maxLength}\n </label>\n )}\n </>\n );\n }\n);\nTextarea.displayName = 'Textarea';\n\nexport { Textarea };\n"],"names":["Textarea","React","textareaProps","ref","className","value","maxHeight","minHeight","resizeble","counter","customId","props","id","useId","textAreaRef","useRef","triggerAutoSize","setTriggerAutoSize","useState","useAutosizeTextArea","useImperativeHandle","useEffect","jsxs","Fragment","jsx","cn"],"mappings":";;;;;AAOA,MAAMA,IAAWC,EAAM;AAAA,EACrB,CAACC,GAAeC,MAAQ;AACtB,UAAM;AAAA,MACJ,WAAAC;AAAA,MACA,OAAAC,IAAQ;AAAA,MACR,WAAAC,IAAY,OAAO;AAAA,MACnB,WAAAC,IAAY;AAAA,MACZ,WAAAC,IAAY;AAAA,MACZ,SAAAC,IAAU;AAAA,MACV,IAAIC,IAAW;AAAA,MACf,GAAGC;AAAA,IAAA,IACDT,GACEU,IAAKC,EAAA,GACLC,IAAcC,EAAmC,IAAI,GACrD,CAACC,GAAiBC,CAAkB,IAAIC,EAAS,EAAE;AAEzD,WAAAC,EAAoB;AAAA,MAClB,aAAAL;AAAA,MACA,iBAAAE;AAAA,MACA,WAAAV;AAAA,MACA,WAAAC;AAAA,IAAA,CACD,GAEDa,EAAoBjB,GAAK,OAAO;AAAA,MAC9B,GAAKW,EAAY,WAAW,CAAA;AAAA,MAC5B,UAAUA,EAAY;AAAA,MACtB,OAAO,MAAMA,GAAa,SAAS,MAAA;AAAA,MACnC,WAAAR;AAAA,MACA,WAAAC;AAAA,IAAA,EACA,GAEFc,EAAU,MAAM;AACd,MAAAJ,EAAmBZ,CAAe;AAAA,IACpC,GAAG,CAACM,GAAO,cAAcN,CAAK,CAAC,GAG7B,gBAAAiB,EAAAC,GAAA,EACE,UAAA;AAAA,MAAA,gBAAAC;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,IAAId,KAAYE;AAAA,UACf,GAAGD;AAAA,UACJ,KAAKG;AAAA,UACL,OAAAT;AAAA,UACA,WAAWoB;AAAA,YACT;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACAjB,IAAY,WAAW;AAAA,YACvBC,KAAW;AAAA,YACXL;AAAA,UAAA;AAAA,QACF;AAAA,MAAA;AAAA,MAEDK,KACC,gBAAAa;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,SAASZ,KAAYE;AAAA,UACrB,WAAWa;AAAA,YACT;AAAA,YACA;AAAA,YACA;AAAA,UAAA;AAAA,UAGD,UAAA;AAAA,YAAA,OAAOpB,KAAS,EAAE,EAAE;AAAA,YAAO;AAAA,YAAIM,GAAO;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IACzC,GAEJ;AAAA,EAEJ;AACF;AACAX,EAAS,cAAc;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Textarea.stories.js","sources":["../../src/Textarea/Textarea.stories.tsx"],"sourcesContent":["import type { Meta, StoryObj } from '@storybook/react-vite';\n\nimport { Textarea } from './Textarea';\n\nconst meta = {\n title: 'Textarea',\n component: Textarea,\n} satisfies Meta<typeof Textarea>;\n\nexport default meta;\n\ntype Story = StoryObj<typeof meta>;\n\nexport const Default: Story = {\n args: {}\n};\n"],"names":["meta","Textarea","Default"],"mappings":";AAIA,MAAMA,IAAO;AAAA,EACX,OAAO;AAAA,EACP,WAAWC;AACb,GAMaC,IAAiB;AAAA,EAC5B,MAAM,CAAA;AACR;"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { IUseAutosizeTextAreaProps } from '
|
|
1
|
+
import { IUseAutosizeTextAreaProps } from './Textarea.types';
|
|
2
2
|
export declare const useAutosizeTextArea: ({ textAreaRef, triggerAutoSize, maxHeight, minHeight, }: IUseAutosizeTextAreaProps) => void;
|
|
3
3
|
//# sourceMappingURL=useAutosizeTextArea.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAutosizeTextArea.d.ts","sourceRoot":"","sources":["../../src/Textarea/useAutosizeTextArea.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,yBAAyB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"useAutosizeTextArea.d.ts","sourceRoot":"","sources":["../../src/Textarea/useAutosizeTextArea.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAE7D,eAAO,MAAM,mBAAmB,GAAI,yDAKjC,yBAAyB,SAsB3B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAutosizeTextArea.js","sources":["../../src/Textarea/useAutosizeTextArea.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { IUseAutosizeTextAreaProps } from '
|
|
1
|
+
{"version":3,"file":"useAutosizeTextArea.js","sources":["../../src/Textarea/useAutosizeTextArea.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { IUseAutosizeTextAreaProps } from './Textarea.types';\n\nexport const useAutosizeTextArea = ({\n textAreaRef,\n triggerAutoSize,\n maxHeight = Number.MAX_SAFE_INTEGER,\n minHeight = 0,\n}: IUseAutosizeTextAreaProps) => {\n const [init, setInit] = React.useState(true);\n React.useEffect(() => {\n const offsetBorder = 0;\n const textAreaElement = textAreaRef.current;\n if (textAreaElement) {\n if (init) {\n textAreaElement.style.minHeight = `${minHeight + offsetBorder}px`;\n if (maxHeight > minHeight) {\n textAreaElement.style.maxHeight = `${maxHeight}px`;\n }\n setInit(false);\n }\n textAreaElement.style.height = `${minHeight + offsetBorder}px`;\n const scrollHeight = textAreaElement.scrollHeight;\n if (scrollHeight > maxHeight) {\n textAreaElement.style.height = `${maxHeight}px`;\n } else {\n textAreaElement.style.height = `${scrollHeight + offsetBorder}px`;\n }\n }\n }, [textAreaRef.current, triggerAutoSize]);\n};\n"],"names":["useAutosizeTextArea","textAreaRef","triggerAutoSize","maxHeight","minHeight","init","setInit","React","textAreaElement","scrollHeight"],"mappings":";AAKO,MAAMA,IAAsB,CAAC;AAAA,EAClC,aAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,WAAAC,IAAY,OAAO;AAAA,EACnB,WAAAC,IAAY;AACd,MAAiC;AAC/B,QAAM,CAACC,GAAMC,CAAO,IAAIC,EAAM,SAAS,EAAI;AAC3C,EAAAA,EAAM,UAAU,MAAM;AAEpB,UAAMC,IAAkBP,EAAY;AACpC,QAAIO,GAAiB;AACnB,MAAIH,MACFG,EAAgB,MAAM,YAAY,GAAGJ,IAAY,CAAY,MACzDD,IAAYC,MACdI,EAAgB,MAAM,YAAY,GAAGL,CAAS,OAEhDG,EAAQ,EAAK,IAEfE,EAAgB,MAAM,SAAS,GAAGJ,IAAY,CAAY;AAC1D,YAAMK,IAAeD,EAAgB;AACrC,MAAIC,IAAeN,IACjBK,EAAgB,MAAM,SAAS,GAAGL,CAAS,OAE3CK,EAAgB,MAAM,SAAS,GAAGC,IAAe,CAAY;AAAA,IAEjE;AAAA,EACF,GAAG,CAACR,EAAY,SAASC,CAAe,CAAC;AAC3C;"}
|
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.7",
|
|
4
4
|
"description": "UI component library for OnePlatform",
|
|
5
5
|
"author": "One Platform Development Team",
|
|
6
6
|
"keywords": [
|
|
@@ -105,9 +105,9 @@
|
|
|
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/
|
|
110
|
-
"@oneplatformdev/
|
|
108
|
+
"@oneplatformdev/tokens": "^0.1.99-beta.7",
|
|
109
|
+
"@oneplatformdev/hooks": "^0.1.99-beta.7",
|
|
110
|
+
"@oneplatformdev/utils": "^0.1.99-beta.7"
|
|
111
111
|
},
|
|
112
112
|
"scripts": {
|
|
113
113
|
"chromatic": "chromatic"
|