@konstructio/ui 0.0.2
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/LICENSE.md +21 -0
- package/README.md +19 -0
- package/dist/AlertDialogTrigger-BIbxXexQ.js +553 -0
- package/dist/Combination-Cmu9JRkv.js +479 -0
- package/dist/Modal-CO0_SnXD.js +909 -0
- package/dist/_commonjsHelpers-C6fGbg64.js +6 -0
- package/dist/chevron-up-Cmu1oXfj.js +54 -0
- package/dist/components/AlertDialog/AlertDialog.d.ts +3 -0
- package/dist/components/AlertDialog/AlertDialog.js +54 -0
- package/dist/components/AlertDialog/AlertDialog.types.d.ts +13 -0
- package/dist/components/AlertDialog/AlertDialog.types.js +1 -0
- package/dist/components/AlertDialog/AlertDialog.variants.d.ts +3 -0
- package/dist/components/AlertDialog/AlertDialog.variants.js +16 -0
- package/dist/components/AlertDialog/components/AlertDialogTrigger.d.ts +3 -0
- package/dist/components/AlertDialog/components/AlertDialogTrigger.js +10 -0
- package/dist/components/AlertDialog/components/AlertDialogTrigger.types.d.ts +6 -0
- package/dist/components/AlertDialog/components/AlertDialogTrigger.types.js +1 -0
- package/dist/components/AlertDialog/components/index.d.ts +1 -0
- package/dist/components/AlertDialog/components/index.js +4 -0
- package/dist/components/AlertDialog/hooks/index.d.ts +1 -0
- package/dist/components/AlertDialog/hooks/index.js +4 -0
- package/dist/components/AlertDialog/hooks/useAlertDialog.d.ts +7 -0
- package/dist/components/AlertDialog/hooks/useAlertDialog.js +10 -0
- package/dist/components/Autocomplete/Autocomplete.d.ts +3 -0
- package/dist/components/Autocomplete/Autocomplete.js +84 -0
- package/dist/components/Autocomplete/Autocomplete.types.d.ts +18 -0
- package/dist/components/Autocomplete/Autocomplete.types.js +1 -0
- package/dist/components/Autocomplete/Autocomplete.variants.d.ts +8 -0
- package/dist/components/Autocomplete/Autocomplete.variants.js +61 -0
- package/dist/components/Autocomplete/components/List.d.ts +3 -0
- package/dist/components/Autocomplete/components/List.js +57 -0
- package/dist/components/Autocomplete/components/List.types.d.ts +13 -0
- package/dist/components/Autocomplete/components/List.types.js +1 -0
- package/dist/components/Autocomplete/components/List.variants.d.ts +16 -0
- package/dist/components/Autocomplete/components/List.variants.js +81 -0
- package/dist/components/Autocomplete/hooks/index.d.ts +2 -0
- package/dist/components/Autocomplete/hooks/index.js +6 -0
- package/dist/components/Autocomplete/hooks/useAutocomplete.d.ts +17 -0
- package/dist/components/Autocomplete/hooks/useAutocomplete.js +81 -0
- package/dist/components/Autocomplete/hooks/useNavigationList.d.ts +10 -0
- package/dist/components/Autocomplete/hooks/useNavigationList.js +78 -0
- package/dist/components/Breadcrumb/Breadcrumb.d.ts +3 -0
- package/dist/components/Breadcrumb/Breadcrumb.js +460 -0
- package/dist/components/Breadcrumb/Breadcrumb.types.d.ts +11 -0
- package/dist/components/Breadcrumb/Breadcrumb.types.js +1 -0
- package/dist/components/Breadcrumb/Breadcrumb.variants.d.ts +12 -0
- package/dist/components/Breadcrumb/Breadcrumb.variants.js +61 -0
- package/dist/components/Breadcrumb/hooks/useBreadcrumb.d.ts +3 -0
- package/dist/components/Breadcrumb/hooks/useBreadcrumb.js +5 -0
- package/dist/components/Button/Button.d.ts +4 -0
- package/dist/components/Button/Button.js +42 -0
- package/dist/components/Button/Button.types.d.ts +7 -0
- package/dist/components/Button/Button.types.js +1 -0
- package/dist/components/Button/Button.variants.d.ts +6 -0
- package/dist/components/Button/Button.variants.js +102 -0
- package/dist/components/Checkbox/Checkbox.d.ts +3 -0
- package/dist/components/Checkbox/Checkbox.js +233 -0
- package/dist/components/Checkbox/Checkbox.types.d.ts +12 -0
- package/dist/components/Checkbox/Checkbox.types.js +1 -0
- package/dist/components/Checkbox/Checkbox.variants.d.ts +9 -0
- package/dist/components/Checkbox/Checkbox.variants.js +82 -0
- package/dist/components/Dropdown/Dropdown.d.ts +3 -0
- package/dist/components/Dropdown/Dropdown.js +10 -0
- package/dist/components/Dropdown/Dropdown.types.d.ts +15 -0
- package/dist/components/Dropdown/Dropdown.types.js +1 -0
- package/dist/components/Dropdown/Dropdown.variants.d.ts +3 -0
- package/dist/components/Dropdown/Dropdown.variants.js +45 -0
- package/dist/components/Dropdown/components/EmptyList.d.ts +2 -0
- package/dist/components/Dropdown/components/EmptyList.js +5 -0
- package/dist/components/Dropdown/components/List/List.d.ts +3 -0
- package/dist/components/Dropdown/components/List/List.js +25 -0
- package/dist/components/Dropdown/components/List/List.types.d.ts +8 -0
- package/dist/components/Dropdown/components/List/List.types.js +1 -0
- package/dist/components/Dropdown/components/List/List.variants.d.ts +3 -0
- package/dist/components/Dropdown/components/List/List.variants.js +34 -0
- package/dist/components/Dropdown/components/ListItem/ListItem.d.ts +3 -0
- package/dist/components/Dropdown/components/ListItem/ListItem.js +29 -0
- package/dist/components/Dropdown/components/ListItem/ListItem.types.d.ts +4 -0
- package/dist/components/Dropdown/components/ListItem/ListItem.types.js +1 -0
- package/dist/components/Dropdown/components/ListItem/ListItem.variants.d.ts +3 -0
- package/dist/components/Dropdown/components/ListItem/ListItem.variants.js +19 -0
- package/dist/components/Dropdown/components/Wrapper.d.ts +3 -0
- package/dist/components/Dropdown/components/Wrapper.js +90 -0
- package/dist/components/Dropdown/components/index.d.ts +3 -0
- package/dist/components/Dropdown/components/index.js +8 -0
- package/dist/components/Dropdown/contexts/dropdown.context.d.ts +8 -0
- package/dist/components/Dropdown/contexts/dropdown.context.js +14 -0
- package/dist/components/Dropdown/contexts/dropdown.hook.d.ts +2 -0
- package/dist/components/Dropdown/contexts/dropdown.hook.js +11 -0
- package/dist/components/Dropdown/contexts/dropdown.provider.d.ts +2 -0
- package/dist/components/Dropdown/contexts/dropdown.provider.js +11 -0
- package/dist/components/Dropdown/contexts/index.d.ts +2 -0
- package/dist/components/Dropdown/contexts/index.js +6 -0
- package/dist/components/Dropdown/hooks/useDropdown.d.ts +11 -0
- package/dist/components/Dropdown/hooks/useDropdown.js +65 -0
- package/dist/components/Dropdown/hooks/useNavigationList.d.ts +8 -0
- package/dist/components/Dropdown/hooks/useNavigationList.js +66 -0
- package/dist/components/Input/Input.d.ts +3 -0
- package/dist/components/Input/Input.js +178 -0
- package/dist/components/Input/Input.types.d.ts +9 -0
- package/dist/components/Input/Input.types.js +1 -0
- package/dist/components/Input/Input.variants.d.ts +4 -0
- package/dist/components/Input/Input.variants.js +43 -0
- package/dist/components/Modal/Modal.d.ts +8 -0
- package/dist/components/Modal/Modal.js +10 -0
- package/dist/components/Modal/Modal.types.d.ts +12 -0
- package/dist/components/Modal/Modal.types.js +1 -0
- package/dist/components/Modal/components/Body/Body.d.ts +3 -0
- package/dist/components/Modal/components/Body/Body.js +7 -0
- package/dist/components/Modal/components/Body/Body.types.d.ts +5 -0
- package/dist/components/Modal/components/Body/Body.types.js +1 -0
- package/dist/components/Modal/components/Footer/Footer.d.ts +3 -0
- package/dist/components/Modal/components/Footer/Footer.js +6 -0
- package/dist/components/Modal/components/Footer/Footer.types.d.ts +5 -0
- package/dist/components/Modal/components/Footer/Footer.types.js +1 -0
- package/dist/components/Modal/components/Header/Header.d.ts +3 -0
- package/dist/components/Modal/components/Header/Header.js +6 -0
- package/dist/components/Modal/components/Header/Header.types.d.ts +5 -0
- package/dist/components/Modal/components/Header/Header.types.js +1 -0
- package/dist/components/Modal/components/Wrapper/Wrapper.d.ts +3 -0
- package/dist/components/Modal/components/Wrapper/Wrapper.js +13 -0
- package/dist/components/Modal/components/Wrapper/Wrapper.types.d.ts +7 -0
- package/dist/components/Modal/components/Wrapper/Wrapper.types.js +1 -0
- package/dist/components/Modal/components/Wrapper/Wrapper.variants.d.ts +6 -0
- package/dist/components/Modal/components/Wrapper/Wrapper.variants.js +48 -0
- package/dist/components/Modal/components/index.d.ts +4 -0
- package/dist/components/Modal/components/index.js +10 -0
- package/dist/components/Modal/contexts/Modal.context.d.ts +2 -0
- package/dist/components/Modal/contexts/Modal.context.js +20 -0
- package/dist/components/Modal/contexts/Modal.provider.d.ts +4 -0
- package/dist/components/Modal/contexts/Modal.provider.js +26 -0
- package/dist/components/Modal/contexts/Modal.types.d.ts +9 -0
- package/dist/components/Modal/contexts/Modal.types.js +1 -0
- package/dist/components/Modal/contexts/index.d.ts +1 -0
- package/dist/components/Modal/contexts/index.js +4 -0
- package/dist/components/Modal/hooks/index.d.ts +1 -0
- package/dist/components/Modal/hooks/index.js +4 -0
- package/dist/components/Modal/hooks/useModal.d.ts +9 -0
- package/dist/components/Modal/hooks/useModal.js +27 -0
- package/dist/components/NumberInput/NumberInput.d.ts +3 -0
- package/dist/components/NumberInput/NumberInput.js +181 -0
- package/dist/components/NumberInput/NumberInput.types.d.ts +11 -0
- package/dist/components/NumberInput/NumberInput.types.js +1 -0
- package/dist/components/NumberInput/NumberInput.variants.d.ts +11 -0
- package/dist/components/NumberInput/NumberInput.variants.js +78 -0
- package/dist/components/ProgressBar/ProgressBar.d.ts +3 -0
- package/dist/components/ProgressBar/ProgressBar.js +37 -0
- package/dist/components/ProgressBar/ProgressBar.types.d.ts +8 -0
- package/dist/components/ProgressBar/ProgressBar.types.js +1 -0
- package/dist/components/ProgressBar/ProgressBar.variants.d.ts +7 -0
- package/dist/components/ProgressBar/ProgressBar.variants.js +62 -0
- package/dist/components/Radio/Radio.d.ts +3 -0
- package/dist/components/Radio/Radio.js +58 -0
- package/dist/components/Radio/Radio.types.d.ts +12 -0
- package/dist/components/Radio/Radio.types.js +1 -0
- package/dist/components/Radio/Radio.variants.d.ts +3 -0
- package/dist/components/Radio/Radio.variants.js +49 -0
- package/dist/components/RadioGroup/RadioGroup.d.ts +3 -0
- package/dist/components/RadioGroup/RadioGroup.js +37 -0
- package/dist/components/RadioGroup/RadioGroup.types.d.ts +11 -0
- package/dist/components/RadioGroup/RadioGroup.types.js +1 -0
- package/dist/components/Range/Range.d.ts +3 -0
- package/dist/components/Range/Range.js +70 -0
- package/dist/components/Range/Range.types.d.ts +13 -0
- package/dist/components/Range/Range.types.js +1 -0
- package/dist/components/Range/Range.variants.d.ts +14 -0
- package/dist/components/Range/Range.variants.js +93 -0
- package/dist/components/Slider/Slider.d.ts +3 -0
- package/dist/components/Slider/Slider.js +52 -0
- package/dist/components/Slider/Slider.types.d.ts +13 -0
- package/dist/components/Slider/Slider.types.js +1 -0
- package/dist/components/Slider/Slider.variants.d.ts +11 -0
- package/dist/components/Slider/Slider.variants.js +69 -0
- package/dist/components/Switch/Switch.d.ts +3 -0
- package/dist/components/Switch/Switch.js +176 -0
- package/dist/components/Switch/Switch.types.d.ts +10 -0
- package/dist/components/Switch/Switch.types.js +1 -0
- package/dist/components/Switch/Switch.variants.d.ts +6 -0
- package/dist/components/Switch/Switch.variants.js +58 -0
- package/dist/components/Tag/Tag.d.ts +3 -0
- package/dist/components/Tag/Tag.js +6 -0
- package/dist/components/Tag/Tag.types.d.ts +4 -0
- package/dist/components/Tag/Tag.types.js +1 -0
- package/dist/components/Tag/Tag.variants.d.ts +3 -0
- package/dist/components/Tag/Tag.variants.js +31 -0
- package/dist/components/TagSelect/TagSelect.d.ts +3 -0
- package/dist/components/TagSelect/TagSelect.js +75 -0
- package/dist/components/TagSelect/TagSelect.types.d.ts +9 -0
- package/dist/components/TagSelect/TagSelect.types.js +1 -0
- package/dist/components/TagSelect/TagSelect.variants.d.ts +9 -0
- package/dist/components/TagSelect/TagSelect.variants.js +83 -0
- package/dist/components/TagSelect/hooks/useTagSelect.d.ts +9 -0
- package/dist/components/TagSelect/hooks/useTagSelect.js +39 -0
- package/dist/components/TextArea/TextArea.d.ts +3 -0
- package/dist/components/TextArea/TextArea.js +34 -0
- package/dist/components/TextArea/TextArea.types.d.ts +10 -0
- package/dist/components/TextArea/TextArea.types.js +1 -0
- package/dist/components/TextArea/TextArea.variants.d.ts +3 -0
- package/dist/components/TextArea/TextArea.variants.js +34 -0
- package/dist/components/Toast/Toast.d.ts +3 -0
- package/dist/components/Toast/Toast.js +471 -0
- package/dist/components/Toast/Toast.types.d.ts +12 -0
- package/dist/components/Toast/Toast.types.js +1 -0
- package/dist/components/Toast/Toast.variants.d.ts +9 -0
- package/dist/components/Toast/Toast.variants.js +74 -0
- package/dist/components/Tooltip/Tooltip.d.ts +3 -0
- package/dist/components/Tooltip/Tooltip.js +42 -0
- package/dist/components/Tooltip/Tooltip.types.d.ts +8 -0
- package/dist/components/Tooltip/Tooltip.types.js +1 -0
- package/dist/components/Tooltip/Tooltip.variants.d.ts +8 -0
- package/dist/components/Tooltip/Tooltip.variants.js +93 -0
- package/dist/components/Tooltip/hooks/useTooltip.d.ts +4 -0
- package/dist/components/Tooltip/hooks/useTooltip.js +25 -0
- package/dist/components/index.d.ts +19 -0
- package/dist/components/index.js +40 -0
- package/dist/contexts/index.d.ts +3 -0
- package/dist/contexts/index.js +8 -0
- package/dist/contexts/theme.context.d.ts +6 -0
- package/dist/contexts/theme.context.js +10 -0
- package/dist/contexts/theme.hook.d.ts +7 -0
- package/dist/contexts/theme.hook.js +9 -0
- package/dist/contexts/theme.provider.d.ts +7 -0
- package/dist/contexts/theme.provider.js +17 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.js +4 -0
- package/dist/hooks/useToggle.d.ts +1 -0
- package/dist/hooks/useToggle.js +11 -0
- package/dist/index-2K8qjK4R.js +145 -0
- package/dist/index-2hJuj4UN.js +19069 -0
- package/dist/index-4qm4jAkj.js +92 -0
- package/dist/index-8vgf-x5i.js +118 -0
- package/dist/index-BJ7FQg17.js +35 -0
- package/dist/index-B_GWswUP.js +71 -0
- package/dist/index-BqM_XclQ.js +94 -0
- package/dist/index-BwYCDOHZ.js +44 -0
- package/dist/index-BxeV34ij.js +32 -0
- package/dist/index-CCavb-1K.js +57 -0
- package/dist/index-DFbnnPzA.js +423 -0
- package/dist/index-DQMInta3.js +663 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +50 -0
- package/dist/js.cookie-OLEfuq_g.js +74 -0
- package/dist/package.json +118 -0
- package/dist/plugins/index.d.ts +1 -0
- package/dist/plugins/index.js +4 -0
- package/dist/plugins/konstruct.d.ts +4 -0
- package/dist/plugins/konstruct.js +104 -0
- package/dist/plugins/utils/colors.d.ts +206 -0
- package/dist/plugins/utils/colors.js +626 -0
- package/dist/styles.css +1 -0
- package/dist/styles.d.ts +0 -0
- package/dist/styles.js +1 -0
- package/dist/useBreadcrumb-BSMnc4Fu.js +341 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.js +2278 -0
- package/package.json +118 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const sliderVariants: (props?: ({
|
|
2
|
+
theme?: "kubefirst" | "konstruct" | "colony" | null | undefined;
|
|
3
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
4
|
+
export declare const trackVariants: (props?: ({
|
|
5
|
+
theme?: "kubefirst" | "konstruct" | "colony" | null | undefined;
|
|
6
|
+
size?: "sm" | "lg" | "md" | null | undefined;
|
|
7
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
8
|
+
export declare const thumbVariants: (props?: ({
|
|
9
|
+
theme?: "kubefirst" | "konstruct" | "colony" | null | undefined;
|
|
10
|
+
size?: "sm" | "lg" | "md" | null | undefined;
|
|
11
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { c as e } from "../../index-BwYCDOHZ.js";
|
|
2
|
+
const r = e(
|
|
3
|
+
["relative", "flex", "items-center", "w-full"],
|
|
4
|
+
{
|
|
5
|
+
variants: {
|
|
6
|
+
theme: {
|
|
7
|
+
kubefirst: "",
|
|
8
|
+
konstruct: "",
|
|
9
|
+
colony: ""
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
defaultVariants: {
|
|
13
|
+
theme: "kubefirst"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
), s = e(["relative", "flex-grow", "rounded-full"], {
|
|
17
|
+
variants: {
|
|
18
|
+
theme: {
|
|
19
|
+
kubefirst: ["bg-kubefirst-purple-dark"],
|
|
20
|
+
konstruct: ["bg-orange-500"],
|
|
21
|
+
colony: ["bg-red-500"]
|
|
22
|
+
},
|
|
23
|
+
size: {
|
|
24
|
+
sm: ["h-1"],
|
|
25
|
+
md: ["h-2"],
|
|
26
|
+
lg: ["h-3"]
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
defaultVariants: {
|
|
30
|
+
theme: "kubefirst",
|
|
31
|
+
size: "md"
|
|
32
|
+
}
|
|
33
|
+
}), a = e(
|
|
34
|
+
[
|
|
35
|
+
"block",
|
|
36
|
+
"w-5",
|
|
37
|
+
"h-5",
|
|
38
|
+
"rounded-full",
|
|
39
|
+
"cursor-pointer",
|
|
40
|
+
"focus-visible:outline-none",
|
|
41
|
+
"shadow-md",
|
|
42
|
+
"bg-white",
|
|
43
|
+
"border",
|
|
44
|
+
"border-gray-300"
|
|
45
|
+
],
|
|
46
|
+
{
|
|
47
|
+
variants: {
|
|
48
|
+
theme: {
|
|
49
|
+
kubefirst: "",
|
|
50
|
+
konstruct: "",
|
|
51
|
+
colony: ""
|
|
52
|
+
},
|
|
53
|
+
size: {
|
|
54
|
+
sm: ["w-5", "h-5"],
|
|
55
|
+
md: ["w-6", "h-6"],
|
|
56
|
+
lg: ["w-7", "h-7"]
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
defaultVariants: {
|
|
60
|
+
theme: "kubefirst",
|
|
61
|
+
size: "md"
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
export {
|
|
66
|
+
r as sliderVariants,
|
|
67
|
+
a as thumbVariants,
|
|
68
|
+
s as trackVariants
|
|
69
|
+
};
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { jsxs as x, jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import * as h from "react";
|
|
3
|
+
import { forwardRef as I, useState as _, useRef as H, useId as A, useImperativeHandle as M, useEffect as $, useCallback as j } from "react";
|
|
4
|
+
import { c as z, a as B, d as q } from "../../index-8vgf-x5i.js";
|
|
5
|
+
import { u as F } from "../../index-CCavb-1K.js";
|
|
6
|
+
import { u as O, a as V } from "../../index-BxeV34ij.js";
|
|
7
|
+
import { P } from "../../index-BJ7FQg17.js";
|
|
8
|
+
import { cn as D } from "../../utils/index.js";
|
|
9
|
+
import "../../contexts/theme.context.js";
|
|
10
|
+
import { useTheme as L } from "../../contexts/theme.hook.js";
|
|
11
|
+
import "../../js.cookie-OLEfuq_g.js";
|
|
12
|
+
import { switchVariants as U, thumbVariants as W } from "./Switch.variants.js";
|
|
13
|
+
var k = "Switch", [X, ue] = z(k), [G, J] = X(k), g = h.forwardRef(
|
|
14
|
+
(e, r) => {
|
|
15
|
+
const {
|
|
16
|
+
__scopeSwitch: t,
|
|
17
|
+
name: s,
|
|
18
|
+
checked: c,
|
|
19
|
+
defaultChecked: p,
|
|
20
|
+
required: n,
|
|
21
|
+
disabled: a,
|
|
22
|
+
value: i = "on",
|
|
23
|
+
onCheckedChange: m,
|
|
24
|
+
form: o,
|
|
25
|
+
...u
|
|
26
|
+
} = e, [d, b] = h.useState(null), v = F(r, (C) => b(C)), f = h.useRef(!1), w = d ? o || !!d.closest("form") : !0, [S = !1, E] = B({
|
|
27
|
+
prop: c,
|
|
28
|
+
defaultProp: p,
|
|
29
|
+
onChange: m
|
|
30
|
+
});
|
|
31
|
+
return /* @__PURE__ */ x(G, { scope: t, checked: S, disabled: a, children: [
|
|
32
|
+
/* @__PURE__ */ l(
|
|
33
|
+
P.button,
|
|
34
|
+
{
|
|
35
|
+
type: "button",
|
|
36
|
+
role: "switch",
|
|
37
|
+
"aria-checked": S,
|
|
38
|
+
"aria-required": n,
|
|
39
|
+
"data-state": N(S),
|
|
40
|
+
"data-disabled": a ? "" : void 0,
|
|
41
|
+
disabled: a,
|
|
42
|
+
value: i,
|
|
43
|
+
...u,
|
|
44
|
+
ref: v,
|
|
45
|
+
onClick: q(e.onClick, (C) => {
|
|
46
|
+
E((T) => !T), w && (f.current = C.isPropagationStopped(), f.current || C.stopPropagation());
|
|
47
|
+
})
|
|
48
|
+
}
|
|
49
|
+
),
|
|
50
|
+
w && /* @__PURE__ */ l(
|
|
51
|
+
K,
|
|
52
|
+
{
|
|
53
|
+
control: d,
|
|
54
|
+
bubbles: !f.current,
|
|
55
|
+
name: s,
|
|
56
|
+
value: i,
|
|
57
|
+
checked: S,
|
|
58
|
+
required: n,
|
|
59
|
+
disabled: a,
|
|
60
|
+
form: o,
|
|
61
|
+
style: { transform: "translateX(-100%)" }
|
|
62
|
+
}
|
|
63
|
+
)
|
|
64
|
+
] });
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
g.displayName = k;
|
|
68
|
+
var R = "SwitchThumb", y = h.forwardRef(
|
|
69
|
+
(e, r) => {
|
|
70
|
+
const { __scopeSwitch: t, ...s } = e, c = J(R, t);
|
|
71
|
+
return /* @__PURE__ */ l(
|
|
72
|
+
P.span,
|
|
73
|
+
{
|
|
74
|
+
"data-state": N(c.checked),
|
|
75
|
+
"data-disabled": c.disabled ? "" : void 0,
|
|
76
|
+
...s,
|
|
77
|
+
ref: r
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
);
|
|
82
|
+
y.displayName = R;
|
|
83
|
+
var K = (e) => {
|
|
84
|
+
const { control: r, checked: t, bubbles: s = !0, ...c } = e, p = h.useRef(null), n = O(t), a = V(r);
|
|
85
|
+
return h.useEffect(() => {
|
|
86
|
+
const i = p.current, m = window.HTMLInputElement.prototype, u = Object.getOwnPropertyDescriptor(m, "checked").set;
|
|
87
|
+
if (n !== t && u) {
|
|
88
|
+
const d = new Event("click", { bubbles: s });
|
|
89
|
+
u.call(i, t), i.dispatchEvent(d);
|
|
90
|
+
}
|
|
91
|
+
}, [n, t, s]), /* @__PURE__ */ l(
|
|
92
|
+
"input",
|
|
93
|
+
{
|
|
94
|
+
type: "checkbox",
|
|
95
|
+
"aria-hidden": !0,
|
|
96
|
+
defaultChecked: t,
|
|
97
|
+
...c,
|
|
98
|
+
tabIndex: -1,
|
|
99
|
+
ref: p,
|
|
100
|
+
style: {
|
|
101
|
+
...e.style,
|
|
102
|
+
...a,
|
|
103
|
+
position: "absolute",
|
|
104
|
+
pointerEvents: "none",
|
|
105
|
+
opacity: 0,
|
|
106
|
+
margin: 0
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
);
|
|
110
|
+
};
|
|
111
|
+
function N(e) {
|
|
112
|
+
return e ? "checked" : "unchecked";
|
|
113
|
+
}
|
|
114
|
+
var Q = g, Y = y;
|
|
115
|
+
const de = I(
|
|
116
|
+
({
|
|
117
|
+
name: e,
|
|
118
|
+
defaultChecked: r,
|
|
119
|
+
alignment: t = "horizontal",
|
|
120
|
+
theme: s,
|
|
121
|
+
thumbClassName: c,
|
|
122
|
+
className: p,
|
|
123
|
+
label: n
|
|
124
|
+
}, a) => {
|
|
125
|
+
const [i, m] = _(r ?? !1), o = H(null), u = A(), { theme: d } = L(), b = s ?? d, v = e ? `${u}-${e}` : u;
|
|
126
|
+
M(a, () => o.current, [o]), $(() => {
|
|
127
|
+
o.current && (o.current.value = `${i}`);
|
|
128
|
+
}, [i]);
|
|
129
|
+
const f = j(
|
|
130
|
+
(w) => m(w),
|
|
131
|
+
[]
|
|
132
|
+
);
|
|
133
|
+
return /* @__PURE__ */ x(
|
|
134
|
+
"div",
|
|
135
|
+
{
|
|
136
|
+
className: D(
|
|
137
|
+
"w-full flex gap-3",
|
|
138
|
+
t === "vertical" ? "flex-col" : "flex-row"
|
|
139
|
+
),
|
|
140
|
+
children: [
|
|
141
|
+
n ? /* @__PURE__ */ l(
|
|
142
|
+
"label",
|
|
143
|
+
{
|
|
144
|
+
className: "text-base",
|
|
145
|
+
htmlFor: v,
|
|
146
|
+
style: { paddingRight: 15 },
|
|
147
|
+
children: n
|
|
148
|
+
}
|
|
149
|
+
) : null,
|
|
150
|
+
/* @__PURE__ */ l(
|
|
151
|
+
Q,
|
|
152
|
+
{
|
|
153
|
+
id: v,
|
|
154
|
+
defaultChecked: r,
|
|
155
|
+
onCheckedChange: f,
|
|
156
|
+
className: U({ theme: b, className: p }),
|
|
157
|
+
children: /* @__PURE__ */ l(
|
|
158
|
+
Y,
|
|
159
|
+
{
|
|
160
|
+
className: W({
|
|
161
|
+
theme: b,
|
|
162
|
+
className: c
|
|
163
|
+
})
|
|
164
|
+
}
|
|
165
|
+
)
|
|
166
|
+
}
|
|
167
|
+
),
|
|
168
|
+
/* @__PURE__ */ l("input", { ref: o, name: e, type: "text", className: "hidden" })
|
|
169
|
+
]
|
|
170
|
+
}
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
);
|
|
174
|
+
export {
|
|
175
|
+
de as Switch
|
|
176
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { VariantProps } from 'class-variance-authority';
|
|
2
|
+
import { switchVariants } from './Switch.variants';
|
|
3
|
+
export interface SwitchProps extends VariantProps<typeof switchVariants> {
|
|
4
|
+
alignment?: 'horizontal' | 'vertical';
|
|
5
|
+
className?: string;
|
|
6
|
+
defaultChecked?: boolean;
|
|
7
|
+
label?: string;
|
|
8
|
+
name?: string;
|
|
9
|
+
thumbClassName?: string;
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const switchVariants: (props?: ({
|
|
2
|
+
theme?: "kubefirst" | "konstruct" | "colony" | null | undefined;
|
|
3
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
4
|
+
export declare const thumbVariants: (props?: ({
|
|
5
|
+
theme?: "kubefirst" | "konstruct" | "colony" | null | undefined;
|
|
6
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { c as t } from "../../index-BwYCDOHZ.js";
|
|
2
|
+
const e = t(
|
|
3
|
+
[
|
|
4
|
+
"w-12",
|
|
5
|
+
"h-7",
|
|
6
|
+
"flex",
|
|
7
|
+
"items-center",
|
|
8
|
+
"rounded-full",
|
|
9
|
+
"shadow",
|
|
10
|
+
"focus:shadow-md",
|
|
11
|
+
"data-[state=unchecked]:bg-zinc-200",
|
|
12
|
+
"transition-all",
|
|
13
|
+
"delay-10",
|
|
14
|
+
"duration-250"
|
|
15
|
+
],
|
|
16
|
+
{
|
|
17
|
+
variants: {
|
|
18
|
+
theme: {
|
|
19
|
+
konstruct: "bg-orange-600",
|
|
20
|
+
kubefirst: "bg-kubefirst-purple-light",
|
|
21
|
+
colony: "bg-red-600"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
defaultVariants: {
|
|
25
|
+
theme: "kubefirst"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
), r = t(
|
|
29
|
+
[
|
|
30
|
+
"block",
|
|
31
|
+
"w-6",
|
|
32
|
+
"h-6",
|
|
33
|
+
"bg-white",
|
|
34
|
+
"rounded-full",
|
|
35
|
+
"shadow-md",
|
|
36
|
+
"transition-all",
|
|
37
|
+
"translate-x-1",
|
|
38
|
+
"data-[state=checked]:translate-x-5",
|
|
39
|
+
"delay-10",
|
|
40
|
+
"duration-300"
|
|
41
|
+
],
|
|
42
|
+
{
|
|
43
|
+
variants: {
|
|
44
|
+
theme: {
|
|
45
|
+
konstruct: "",
|
|
46
|
+
kubefirst: "",
|
|
47
|
+
colony: ""
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
defaultVariants: {
|
|
51
|
+
theme: "kubefirst"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
);
|
|
55
|
+
export {
|
|
56
|
+
e as switchVariants,
|
|
57
|
+
r as thumbVariants
|
|
58
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { tagVariants as i } from "./Tag.variants.js";
|
|
3
|
+
const m = ({ label: r, color: t }) => /* @__PURE__ */ a("div", { className: i({ color: t }), children: /* @__PURE__ */ a("span", { className: "text-inherit", children: r }) });
|
|
4
|
+
export {
|
|
5
|
+
m as Tag
|
|
6
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const tagVariants: (props?: ({
|
|
2
|
+
color?: "default" | "gray" | "cyan" | "gold" | "green" | "light blue" | "lime" | "pink" | "purple" | "emerald" | "fuscia" | "indigo" | "light-orange" | "dark-sky-blue" | "mistery" | null | undefined;
|
|
3
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { c as e } from "../../index-BwYCDOHZ.js";
|
|
2
|
+
const f = e(
|
|
3
|
+
["px-2", "py-1", "rounded-md", "w-max", "text-xs"],
|
|
4
|
+
{
|
|
5
|
+
variants: {
|
|
6
|
+
color: {
|
|
7
|
+
gray: ["bg-[#f4f4f5]", "text-[#71717a]"],
|
|
8
|
+
cyan: ["bg-[#ecfeff]", "text-[#0e7490]"],
|
|
9
|
+
gold: ["bg-[#fef9c3]", "text-[#a16207]"],
|
|
10
|
+
green: ["bg-[#dcfce7]", "text-[#15803d]"],
|
|
11
|
+
"light blue": ["bg-[#e0f2fe]", "text-[#0369a1]"],
|
|
12
|
+
lime: ["bg-[#ecfccb]", "text-[#4d7c0f]"],
|
|
13
|
+
pink: ["bg-[#fce7f3]", "text-[#be185d]"],
|
|
14
|
+
purple: ["bg-[#ede9fe]", "text-[#6d28d9]"],
|
|
15
|
+
emerald: ["bg-[#ecfdf5]", "text-[#047857]"],
|
|
16
|
+
fuscia: ["bg-[#fdf4ff]", "text-[#a21caf]"],
|
|
17
|
+
indigo: ["bg-[#e0e7ff]", "text-[#4338ca]"],
|
|
18
|
+
"light-orange": ["bg-[#fef3c7]", "text-[#d97706]"],
|
|
19
|
+
"dark-sky-blue": ["bg-[#dbeafe]", "text-[#1d4ed8]"],
|
|
20
|
+
mistery: ["bg-[#1e2235]", "text-[#81e2b4]"],
|
|
21
|
+
default: ["bg-transparent", "text-[#71717A]"]
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
defaultVariants: {
|
|
25
|
+
color: "default"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
export {
|
|
30
|
+
f as tagVariants
|
|
31
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { jsxs as p, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as g, useId as w, useRef as C, useImperativeHandle as T, useEffect as R } from "react";
|
|
3
|
+
import "../../contexts/theme.context.js";
|
|
4
|
+
import { useTheme as S } from "../../contexts/theme.hook.js";
|
|
5
|
+
import "../../js.cookie-OLEfuq_g.js";
|
|
6
|
+
import { cn as u } from "../../utils/index.js";
|
|
7
|
+
import { Tag as d } from "../Tag/Tag.js";
|
|
8
|
+
import { useTagSelect as k } from "./hooks/useTagSelect.js";
|
|
9
|
+
import { tagSelectVariants as I, tagListVariants as V, tagItemVariants as j } from "./TagSelect.variants.js";
|
|
10
|
+
import { C as y } from "../../chevron-up-Cmu1oXfj.js";
|
|
11
|
+
const B = g(({ label: n, name: r, options: f, placeholder: h = "Select a value...", theme: l }, x) => {
|
|
12
|
+
const s = w(), { theme: o } = S(), t = C(null), {
|
|
13
|
+
isOpen: a,
|
|
14
|
+
selectedTag: c,
|
|
15
|
+
value: m,
|
|
16
|
+
wrapperRef: b,
|
|
17
|
+
handleClickTag: N,
|
|
18
|
+
handleOpenDropdown: v
|
|
19
|
+
} = k();
|
|
20
|
+
return T(x, () => t.current, [t]), R(() => {
|
|
21
|
+
t.current && (t.current.value = m);
|
|
22
|
+
}, [m]), /* @__PURE__ */ p("div", { ref: b, className: "flex flex-col w-full relative", children: [
|
|
23
|
+
n ? /* @__PURE__ */ e("label", { className: "m-2 cursor-pointer", htmlFor: r ?? s, children: n }) : null,
|
|
24
|
+
/* @__PURE__ */ p(
|
|
25
|
+
"div",
|
|
26
|
+
{
|
|
27
|
+
id: r ?? s,
|
|
28
|
+
className: I({ theme: l ?? o }),
|
|
29
|
+
role: "combobox",
|
|
30
|
+
onClick: v,
|
|
31
|
+
"aria-expanded": a,
|
|
32
|
+
children: [
|
|
33
|
+
c ? /* @__PURE__ */ e(d, { ...c }) : /* @__PURE__ */ e("span", { className: "text-base text-inherit", children: h }),
|
|
34
|
+
/* @__PURE__ */ e(
|
|
35
|
+
y,
|
|
36
|
+
{
|
|
37
|
+
className: u(
|
|
38
|
+
"w-4 h-4 text-inherit transition-all duration-50",
|
|
39
|
+
a ? "rotate-0" : "rotate-180"
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
)
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
),
|
|
46
|
+
/* @__PURE__ */ e("input", { ref: t, type: "text", name: r, className: "hidden" }),
|
|
47
|
+
a ? /* @__PURE__ */ e(
|
|
48
|
+
"ul",
|
|
49
|
+
{
|
|
50
|
+
role: "listbox",
|
|
51
|
+
className: u(V({ theme: l ?? o })),
|
|
52
|
+
children: f.map((i) => /* @__PURE__ */ e(
|
|
53
|
+
"li",
|
|
54
|
+
{
|
|
55
|
+
className: j({ theme: l ?? o }),
|
|
56
|
+
role: "option",
|
|
57
|
+
children: /* @__PURE__ */ e(
|
|
58
|
+
"button",
|
|
59
|
+
{
|
|
60
|
+
type: "button",
|
|
61
|
+
role: "button",
|
|
62
|
+
className: "m-0 p-0 w-full",
|
|
63
|
+
onClick: () => N(i),
|
|
64
|
+
children: /* @__PURE__ */ e(d, { label: i.label, color: i.color })
|
|
65
|
+
}
|
|
66
|
+
)
|
|
67
|
+
}
|
|
68
|
+
))
|
|
69
|
+
}
|
|
70
|
+
) : null
|
|
71
|
+
] });
|
|
72
|
+
});
|
|
73
|
+
export {
|
|
74
|
+
B as TagSelect
|
|
75
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { VariantProps } from 'class-variance-authority';
|
|
2
|
+
import { TagProps } from '../Tag/Tag.types';
|
|
3
|
+
import { tagSelectVariants } from './TagSelect.variants';
|
|
4
|
+
export interface TagSelectProps extends VariantProps<typeof tagSelectVariants> {
|
|
5
|
+
label?: string;
|
|
6
|
+
options: TagProps[];
|
|
7
|
+
name?: string;
|
|
8
|
+
placeholder?: string;
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const tagSelectVariants: (props?: ({
|
|
2
|
+
theme?: "kubefirst" | "konstruct" | "colony" | null | undefined;
|
|
3
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
4
|
+
export declare const tagListVariants: (props?: ({
|
|
5
|
+
theme?: "kubefirst" | "konstruct" | "colony" | null | undefined;
|
|
6
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
7
|
+
export declare const tagItemVariants: (props?: ({
|
|
8
|
+
theme?: "kubefirst" | "konstruct" | "colony" | null | undefined;
|
|
9
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { c as e } from "../../index-BwYCDOHZ.js";
|
|
2
|
+
const t = e(
|
|
3
|
+
[
|
|
4
|
+
"border",
|
|
5
|
+
"cursor-pointer",
|
|
6
|
+
"duration-250",
|
|
7
|
+
"ease-in-out",
|
|
8
|
+
"flex",
|
|
9
|
+
"items-center",
|
|
10
|
+
"justify-between",
|
|
11
|
+
"px-3",
|
|
12
|
+
"py-1",
|
|
13
|
+
"rounded-md",
|
|
14
|
+
"transition-all",
|
|
15
|
+
"w-full"
|
|
16
|
+
],
|
|
17
|
+
{
|
|
18
|
+
variants: {
|
|
19
|
+
theme: {
|
|
20
|
+
colony: ["aria-expanded:border-red-400", "aria-expanded:text-red-400"],
|
|
21
|
+
konstruct: [
|
|
22
|
+
"aria-expanded:border-orange-400",
|
|
23
|
+
"aria-expanded:text-orange-400"
|
|
24
|
+
],
|
|
25
|
+
kubefirst: [
|
|
26
|
+
"aria-expanded:border-kubefirst-purple-light",
|
|
27
|
+
"aria-expanded:text-kubefirst-purple-dark"
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
defaultVariants: {
|
|
32
|
+
theme: "kubefirst"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
), a = e(
|
|
36
|
+
[
|
|
37
|
+
"absolute",
|
|
38
|
+
"bg-white",
|
|
39
|
+
"border",
|
|
40
|
+
"duration-100",
|
|
41
|
+
"ease-in-out",
|
|
42
|
+
"flex",
|
|
43
|
+
"flex-col",
|
|
44
|
+
"mt-1",
|
|
45
|
+
"rounded-md",
|
|
46
|
+
"shadow-sm",
|
|
47
|
+
"top-full",
|
|
48
|
+
"transition-all",
|
|
49
|
+
"w-full",
|
|
50
|
+
"z-10"
|
|
51
|
+
],
|
|
52
|
+
{
|
|
53
|
+
variants: {
|
|
54
|
+
theme: {
|
|
55
|
+
colony: ["border-red-400"],
|
|
56
|
+
konstruct: ["border-orange-400"],
|
|
57
|
+
kubefirst: ["border-kubefirst-purple-light"]
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
defaultVariants: {
|
|
61
|
+
theme: "kubefirst"
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
), o = e(
|
|
65
|
+
["cursor-pointer", "py-1", "px-2", "last:mb-2", "first:mt-2", "h-full"],
|
|
66
|
+
{
|
|
67
|
+
variants: {
|
|
68
|
+
theme: {
|
|
69
|
+
colony: "hover:bg-red-100",
|
|
70
|
+
konstruct: "hover:bg-orange-100",
|
|
71
|
+
kubefirst: "hover:bg-purple-100"
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
defaultVariants: {
|
|
75
|
+
theme: "kubefirst"
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
export {
|
|
80
|
+
o as tagItemVariants,
|
|
81
|
+
a as tagListVariants,
|
|
82
|
+
t as tagSelectVariants
|
|
83
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TagProps } from '../../Tag/Tag.types';
|
|
2
|
+
export declare const useTagSelect: () => {
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
selectedTag: TagProps | null;
|
|
5
|
+
value: string;
|
|
6
|
+
wrapperRef: import('react').RefObject<HTMLDivElement>;
|
|
7
|
+
handleClickTag: (tag: TagProps) => void;
|
|
8
|
+
handleOpenDropdown: () => void;
|
|
9
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { useRef as b, useState as o, useEffect as k, useCallback as a } from "react";
|
|
2
|
+
import { useToggle as w } from "../../../hooks/useToggle.js";
|
|
3
|
+
const C = () => {
|
|
4
|
+
const t = b(null), [r, e] = w(!1), [c, d] = o(null), [u, i] = o("");
|
|
5
|
+
k(() => {
|
|
6
|
+
const n = new AbortController(), p = (s) => {
|
|
7
|
+
s.key === "Escape" && e(!1);
|
|
8
|
+
}, m = (s) => {
|
|
9
|
+
var l;
|
|
10
|
+
(l = t.current) != null && l.contains(s.target) || e(!1);
|
|
11
|
+
};
|
|
12
|
+
return document.addEventListener("keydown", p, {
|
|
13
|
+
signal: n.signal
|
|
14
|
+
}), document.addEventListener("mousedown", m, {
|
|
15
|
+
signal: n.signal
|
|
16
|
+
}), () => {
|
|
17
|
+
n.abort();
|
|
18
|
+
};
|
|
19
|
+
}, [e, t]);
|
|
20
|
+
const f = a(() => {
|
|
21
|
+
e();
|
|
22
|
+
}, [e]), g = a(
|
|
23
|
+
(n) => {
|
|
24
|
+
d(n), e(!1), i(n.label);
|
|
25
|
+
},
|
|
26
|
+
[e]
|
|
27
|
+
);
|
|
28
|
+
return {
|
|
29
|
+
isOpen: r,
|
|
30
|
+
selectedTag: c,
|
|
31
|
+
value: u,
|
|
32
|
+
wrapperRef: t,
|
|
33
|
+
handleClickTag: g,
|
|
34
|
+
handleOpenDropdown: f
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
export {
|
|
38
|
+
C as useTagSelect
|
|
39
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsxs as h, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as v, useId as N, useState as T, useCallback as j } from "react";
|
|
3
|
+
import { textAreaVariants as A } from "./TextArea.variants.js";
|
|
4
|
+
import "../../contexts/theme.context.js";
|
|
5
|
+
import { useTheme as I } from "../../contexts/theme.hook.js";
|
|
6
|
+
import "../../js.cookie-OLEfuq_g.js";
|
|
7
|
+
const S = v(
|
|
8
|
+
({ initialValue: m, label: t, name: o, placeholder: l, rows: c = 3, theme: i, onChange: e }, u) => {
|
|
9
|
+
const r = N(), { theme: d } = I(), s = o ? `${r}-name` : r, [p, x] = T(m ?? ""), f = j(
|
|
10
|
+
(n) => {
|
|
11
|
+
x(n.target.value), e == null || e();
|
|
12
|
+
},
|
|
13
|
+
[e]
|
|
14
|
+
);
|
|
15
|
+
return /* @__PURE__ */ h("div", { className: "flex flex-col gap-2", children: [
|
|
16
|
+
t ? /* @__PURE__ */ a("label", { htmlFor: s, className: "cursor-pointer", children: t }) : null,
|
|
17
|
+
/* @__PURE__ */ a(
|
|
18
|
+
"textarea",
|
|
19
|
+
{
|
|
20
|
+
id: s,
|
|
21
|
+
ref: u,
|
|
22
|
+
className: A({ theme: i ?? d }),
|
|
23
|
+
rows: c,
|
|
24
|
+
placeholder: l,
|
|
25
|
+
value: p,
|
|
26
|
+
onChange: f
|
|
27
|
+
}
|
|
28
|
+
)
|
|
29
|
+
] });
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
export {
|
|
33
|
+
S as TextArea
|
|
34
|
+
};
|