@konstructio/ui 0.0.12-alpha.1 → 0.0.12-alpha.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.
Files changed (113) hide show
  1. package/dist/{Combination-BQYb0Gw7.js → Combination-b348x__d.js} +24 -24
  2. package/dist/Modal-B-E9uaA6.js +922 -0
  3. package/dist/components/Alert/Alert.js +58 -0
  4. package/dist/components/Alert/Alert.variants.js +77 -0
  5. package/dist/components/AlertDialog/AlertDialog.js +1 -1
  6. package/dist/components/AlertDialog/components/AlertDialogTrigger.js +1 -1
  7. package/dist/components/AlertDialog/components/index.js +1 -1
  8. package/dist/components/Autocomplete/Autocomplete.variants.js +0 -1
  9. package/dist/components/Autocomplete/components/List/List.js +3 -3
  10. package/dist/components/Breadcrumb/Breadcrumb.js +3 -3
  11. package/dist/components/Breadcrumb/Breadcrumb.variants.js +18 -15
  12. package/dist/components/Breadcrumb/components/Item/Item.js +4 -4
  13. package/dist/components/Breadcrumb/hooks/useBreadcrumb.js +1 -1
  14. package/dist/components/Button/Button.js +1 -1
  15. package/dist/components/Card/Card.js +3 -3
  16. package/dist/components/Checkbox/Checkbox.js +5 -5
  17. package/dist/components/Command/Command.js +32 -0
  18. package/dist/components/Command/Command.variants.js +97 -0
  19. package/dist/components/Command/components/Command.js +8 -0
  20. package/dist/components/Command/components/CommandEmpty.js +15 -0
  21. package/dist/components/Command/components/CommandGroup.js +19 -0
  22. package/dist/components/Command/components/CommandInput.js +84 -0
  23. package/dist/components/Command/components/CommandItem.js +29 -0
  24. package/dist/components/Command/components/CommandList.js +16 -0
  25. package/dist/components/Command/components/CommandSeparator.js +16 -0
  26. package/dist/components/Command/components/CommandShortcut.js +19 -0
  27. package/dist/components/Command/components/DialogContent.js +31 -0
  28. package/dist/components/Command/components/DialogOverlay.js +19 -0
  29. package/dist/components/Command/components/index.js +20 -0
  30. package/dist/components/Command/contexts/Command.context.js +13 -0
  31. package/dist/components/Command/contexts/Command.provider.js +24 -0
  32. package/dist/components/Command/contexts/index.js +6 -0
  33. package/dist/components/Divider/Divider.js +10 -0
  34. package/dist/components/Divider/Divider.variants.js +14 -0
  35. package/dist/components/Dropdown/Dropdown.js +5 -5
  36. package/dist/components/Dropdown/Dropdown.variants.js +22 -3
  37. package/dist/components/Dropdown/components/List/List.variants.js +4 -4
  38. package/dist/components/Dropdown/components/ListItem/ListItem.js +19 -18
  39. package/dist/components/Dropdown/components/ListItem/ListItem.variants.js +6 -4
  40. package/dist/components/Dropdown/components/Wrapper.js +88 -57
  41. package/dist/components/Dropdown/contexts/dropdown.context.js +1 -1
  42. package/dist/components/Dropdown/contexts/dropdown.provider.js +11 -11
  43. package/dist/components/Input/Input.js +112 -67
  44. package/dist/components/Input/Input.variants.js +5 -6
  45. package/dist/components/Loading/Loading.js +109 -0
  46. package/dist/components/Loading/Loading.variants.js +19 -0
  47. package/dist/components/Modal/Modal.js +3 -3
  48. package/dist/components/Modal/components/Body/Body.js +1 -1
  49. package/dist/components/Modal/components/Footer/Footer.js +1 -1
  50. package/dist/components/Modal/components/Header/Header.js +1 -1
  51. package/dist/components/Modal/components/Wrapper/Wrapper.js +4 -5
  52. package/dist/components/Modal/components/index.js +1 -1
  53. package/dist/components/NumberInput/NumberInput.js +1 -1
  54. package/dist/components/ProgressBar/ProgressBar.js +3 -3
  55. package/dist/components/Radio/Radio.js +4 -4
  56. package/dist/components/RadioGroup/RadioGroup.js +1 -1
  57. package/dist/components/Range/Range.js +4 -4
  58. package/dist/components/Sidebar/Sidebar.variants.js +2 -1
  59. package/dist/components/Sidebar/components/Logo/Logo.variants.js +9 -17
  60. package/dist/components/Sidebar/components/NavigationGroup/NavigationGroup.variants.js +2 -2
  61. package/dist/components/Sidebar/components/NavigationOption/NavigationOption.variants.js +6 -5
  62. package/dist/components/Sidebar/components/Wrapper/Wrapper.js +3 -3
  63. package/dist/components/Slider/Slider.js +14 -14
  64. package/dist/components/Switch/Switch.js +17 -17
  65. package/dist/components/Tag/Tag.js +17 -5
  66. package/dist/components/Tag/Tag.variants.js +11 -1
  67. package/dist/components/TagSelect/TagSelect.js +6 -71
  68. package/dist/components/TagSelect/TagSelect.variants.js +29 -50
  69. package/dist/components/TagSelect/components/Item/Item.js +23 -0
  70. package/dist/components/TagSelect/components/Item/Item.variants.js +31 -0
  71. package/dist/components/TagSelect/components/List/List.js +13 -0
  72. package/dist/components/TagSelect/components/List/List.variants.js +37 -0
  73. package/dist/components/TagSelect/components/Wrapper/Wrapper.js +88 -0
  74. package/dist/components/TagSelect/components/index.js +8 -0
  75. package/dist/components/TagSelect/contexts/TagSelect.context.js +19 -0
  76. package/dist/components/TagSelect/contexts/TagSelect.hook.js +11 -0
  77. package/dist/components/TagSelect/contexts/TagSelect.provider.js +69 -0
  78. package/dist/components/TagSelect/contexts/index.js +6 -0
  79. package/dist/components/TagSelect/hooks/useTagSelect.js +22 -27
  80. package/dist/components/TextArea/TextArea.js +28 -22
  81. package/dist/components/TextArea/TextArea.variants.js +0 -1
  82. package/dist/components/Toast/Toast.js +143 -130
  83. package/dist/components/Toast/Toast.variants.js +2 -3
  84. package/dist/components/Tooltip/Tooltip.js +4 -4
  85. package/dist/components/Typography/Typography.js +31 -0
  86. package/dist/components/Typography/Typography.variants.js +63 -0
  87. package/dist/components/index.js +61 -53
  88. package/dist/{index-BxeV34ij.js → index-4ecjw_Aj.js} +1 -1
  89. package/dist/index-B_6_jmOO.js +68 -0
  90. package/dist/{index-BBjak_0p.js → index-BbsJ0VIJ.js} +2 -2
  91. package/dist/{index-CJsYodgi.js → index-BzaHYXkt.js} +9 -9
  92. package/dist/{index-KEdwcThH.js → index-CbTU3cnP.js} +1 -1
  93. package/dist/{index-8vgf-x5i.js → index-Cva-e5M4.js} +2 -2
  94. package/dist/index-CzSBQN5S.js +432 -0
  95. package/dist/index-D7QNmo_D.js +422 -0
  96. package/dist/index-DUA6Y_AE.js +126 -0
  97. package/dist/{index-CoqDsznq.js → index-D_76wh4w.js} +3 -3
  98. package/dist/{index-D4Q2rMby.js → index-Dj1pom3_.js} +2 -2
  99. package/dist/index-DyKo5ZJT.js +446 -0
  100. package/dist/index.d.ts +63 -12
  101. package/dist/index.js +76 -68
  102. package/dist/package.json +36 -35
  103. package/dist/plugins/konstruct.js +34 -31
  104. package/dist/plugins/utils/animation.styles.js +162 -0
  105. package/dist/plugins/utils/index.js +7 -0
  106. package/dist/styles.css +1 -1
  107. package/dist/{useBreadcrumb-CojbXFVD.js → useBreadcrumb-BsIeMoR1.js} +47 -47
  108. package/dist/utils/index.js +320 -322
  109. package/package.json +36 -35
  110. package/dist/Modal-W2GbkC_F.js +0 -906
  111. package/dist/index-1GLoikpT.js +0 -19134
  112. package/dist/index-BVppSRDQ.js +0 -551
  113. package/dist/index-DoOsnuB6.js +0 -72
@@ -0,0 +1,16 @@
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ import { forwardRef as p } from "react";
3
+ import { V as r } from "../../../index-CzSBQN5S.js";
4
+ import { cn as t } from "../../../utils/index.js";
5
+ const s = p(({ className: o, ...a }, m) => /* @__PURE__ */ e(
6
+ r.Separator,
7
+ {
8
+ ref: m,
9
+ className: t("-mx-1 h-px border-t border-neutral-900/45 mb-2", o),
10
+ ...a
11
+ }
12
+ ));
13
+ s.displayName = r.Separator.displayName;
14
+ export {
15
+ s as CommandSeparator
16
+ };
@@ -0,0 +1,19 @@
1
+ import { jsx as m } from "react/jsx-runtime";
2
+ import { cn as r } from "../../../utils/index.js";
3
+ const a = ({
4
+ className: t,
5
+ ...o
6
+ }) => /* @__PURE__ */ m(
7
+ "span",
8
+ {
9
+ className: r(
10
+ "ml-auto text-xs tracking-widest text-muted-foreground",
11
+ t
12
+ ),
13
+ ...o
14
+ }
15
+ );
16
+ a.displayName = "CommandShortcut";
17
+ export {
18
+ a as CommandShortcut
19
+ };
@@ -0,0 +1,31 @@
1
+ import { jsxs as t, jsx as a } from "react/jsx-runtime";
2
+ import { forwardRef as i } from "react";
3
+ import { a as r, C as o, b as l } from "../../../index-DyKo5ZJT.js";
4
+ import { cn as m } from "../../../utils/index.js";
5
+ import { DialogOverlay as p } from "./DialogOverlay.js";
6
+ import { X as c } from "../../../x-DU-Zw-L_.js";
7
+ const f = i(({ className: e, children: s, ...n }, d) => /* @__PURE__ */ t(r, { children: [
8
+ /* @__PURE__ */ a(p, {}),
9
+ /* @__PURE__ */ t(
10
+ o,
11
+ {
12
+ ref: d,
13
+ className: m(
14
+ "fixed text-white left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
15
+ e
16
+ ),
17
+ ...n,
18
+ children: [
19
+ s,
20
+ /* @__PURE__ */ t(l, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground text-white", children: [
21
+ /* @__PURE__ */ a(c, { className: "h-4 w-4" }),
22
+ /* @__PURE__ */ a("span", { className: "sr-only", children: "Close" })
23
+ ] })
24
+ ]
25
+ }
26
+ )
27
+ ] }));
28
+ f.displayName = o.displayName;
29
+ export {
30
+ f as DialogContent
31
+ };
@@ -0,0 +1,19 @@
1
+ import { jsx as s } from "react/jsx-runtime";
2
+ import { forwardRef as i } from "react";
3
+ import { O as a } from "../../../index-DyKo5ZJT.js";
4
+ import { cn as m } from "../../../utils/index.js";
5
+ const r = i(({ className: t, ...e }, o) => /* @__PURE__ */ s(
6
+ a,
7
+ {
8
+ ref: o,
9
+ className: m(
10
+ "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
11
+ t
12
+ ),
13
+ ...e
14
+ }
15
+ ));
16
+ r.displayName = a.displayName;
17
+ export {
18
+ r as DialogOverlay
19
+ };
@@ -0,0 +1,20 @@
1
+ import { CommandEmpty as r } from "./CommandEmpty.js";
2
+ import { CommandGroup as p } from "./CommandGroup.js";
3
+ import { CommandInput as a } from "./CommandInput.js";
4
+ import { CommandItem as f } from "./CommandItem.js";
5
+ import { CommandList as C } from "./CommandList.js";
6
+ import { CommandSeparator as u } from "./CommandSeparator.js";
7
+ import { CommandShortcut as I } from "./CommandShortcut.js";
8
+ import { DialogContent as c } from "./DialogContent.js";
9
+ import { Command as h } from "./Command.js";
10
+ export {
11
+ h as Command,
12
+ r as CommandEmpty,
13
+ p as CommandGroup,
14
+ a as CommandInput,
15
+ f as CommandItem,
16
+ C as CommandList,
17
+ u as CommandSeparator,
18
+ I as CommandShortcut,
19
+ c as DialogContent
20
+ };
@@ -0,0 +1,13 @@
1
+ import { createContext as e } from "react";
2
+ const t = {
3
+ isOpen: !1,
4
+ setOpen: () => {
5
+ throw new Error("onOpen is not implemented");
6
+ },
7
+ toggleOpen: () => {
8
+ throw new Error("toggleOpen is not implemented");
9
+ }
10
+ }, o = e(t);
11
+ export {
12
+ o as CommandContext
13
+ };
@@ -0,0 +1,24 @@
1
+ import { CommandContext as s } from "./Command.context.js";
2
+ import { jsx as a } from "react/jsx-runtime";
3
+ import { useCallback as e } from "react";
4
+ import { useToggle as p } from "../../../hooks/useToggle.js";
5
+ const f = ({ children: t }) => {
6
+ const [r, o] = p(!1), n = e(
7
+ (l) => o(l),
8
+ [o]
9
+ ), m = e(() => o(), [o]);
10
+ return /* @__PURE__ */ a(
11
+ s.Provider,
12
+ {
13
+ value: {
14
+ isOpen: r,
15
+ setOpen: n,
16
+ toggleOpen: m
17
+ },
18
+ children: t
19
+ }
20
+ );
21
+ };
22
+ export {
23
+ f as CommandProvider
24
+ };
@@ -0,0 +1,6 @@
1
+ import { CommandContext as r } from "./Command.context.js";
2
+ import { CommandProvider as t } from "./Command.provider.js";
3
+ export {
4
+ r as CommandContext,
5
+ t as CommandProvider
6
+ };
@@ -0,0 +1,10 @@
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ import { dividerVariants as a } from "./Divider.variants.js";
3
+ const d = ({
4
+ className: i,
5
+ ...r
6
+ }) => /* @__PURE__ */ e("div", { className: a({ className: i }), ...r });
7
+ d.displayName = "Divider";
8
+ export {
9
+ d as Divider
10
+ };
@@ -0,0 +1,14 @@
1
+ import { c as a } from "../../index-BNmRGtA6.js";
2
+ const i = a(["h-[1px]", "bg-zinc-200", "w-full"], {
3
+ variants: {
4
+ variant: {
5
+ default: ""
6
+ }
7
+ },
8
+ defaultVariants: {
9
+ variant: "default"
10
+ }
11
+ });
12
+ export {
13
+ i as dividerVariants
14
+ };
@@ -1,8 +1,8 @@
1
1
  import { jsx as r } from "react/jsx-runtime";
2
- import { forwardRef as f } from "react";
3
- import { DropdownProvider as i } from "./contexts/dropdown.provider.js";
4
- import { Wrapper as t } from "./components/Wrapper.js";
5
- const a = f(({ onChange: o, ...p }, m) => /* @__PURE__ */ r(i, { onChange: o, children: /* @__PURE__ */ r(t, { ref: m, ...p }) }));
2
+ import { forwardRef as i } from "react";
3
+ import { DropdownProvider as t } from "./contexts/dropdown.provider.js";
4
+ import { Wrapper as d } from "./components/Wrapper.js";
5
+ const c = i(({ onChange: o, value: p, ...m }, f) => /* @__PURE__ */ r(t, { onChange: o, value: p, children: /* @__PURE__ */ r(d, { ref: f, ...m }) }));
6
6
  export {
7
- a as Dropdown
7
+ c as Dropdown
8
8
  };
@@ -1,5 +1,5 @@
1
1
  import { c as e } from "../../index-BNmRGtA6.js";
2
- const a = e(
2
+ const t = e(
3
3
  [
4
4
  "border",
5
5
  "cursor-pointer",
@@ -13,7 +13,8 @@ const a = e(
13
13
  "rounded-md",
14
14
  "transition-all",
15
15
  "w-full",
16
- "outline-none"
16
+ "outline-none",
17
+ "h-9"
17
18
  ],
18
19
  {
19
20
  variants: {
@@ -35,7 +36,25 @@ const a = e(
35
36
  theme: "kubefirst"
36
37
  }
37
38
  }
39
+ ), a = e(
40
+ [
41
+ "mb-1",
42
+ "cursor-pointer",
43
+ "text-[14px]",
44
+ "leading-[20px]",
45
+ "tracking-[0.1px]"
46
+ ],
47
+ {
48
+ variants: {
49
+ theme: {
50
+ kubefirst: "",
51
+ colony: "",
52
+ civo: ""
53
+ }
54
+ }
55
+ }
38
56
  );
39
57
  export {
40
- a as dropdownVariants
58
+ t as dropdownVariants,
59
+ a as labelVariants
41
60
  };
@@ -1,5 +1,5 @@
1
- import { c as r } from "../../../../index-BNmRGtA6.js";
2
- const t = r(
1
+ import { c as t } from "../../../../index-BNmRGtA6.js";
2
+ const o = t(
3
3
  [
4
4
  "absolute",
5
5
  "bg-white",
@@ -20,7 +20,7 @@ const t = r(
20
20
  variants: {
21
21
  theme: {
22
22
  colony: ["border-red-400"],
23
- kubefirst: ["border-kubefirst-primary"],
23
+ kubefirst: ["text-zinc-700"],
24
24
  civo: ""
25
25
  }
26
26
  },
@@ -30,5 +30,5 @@ const t = r(
30
30
  }
31
31
  );
32
32
  export {
33
- t as listVariants
33
+ o as listVariants
34
34
  };
@@ -1,36 +1,37 @@
1
- import { jsxs as f, jsx as i } from "react/jsx-runtime";
2
- import { useRef as u, useCallback as r } from "react";
1
+ import { jsxs as f, jsx as o } from "react/jsx-runtime";
2
+ import { useRef as p, useCallback as s } from "react";
3
3
  import { cn as d } from "../../../../utils/index.js";
4
- import { listItemVariants as p } from "./ListItem.variants.js";
4
+ import { listItemVariants as u } from "./ListItem.variants.js";
5
+ import { Typography as h } from "../../../Typography/Typography.js";
5
6
  import { useDropdownContext as x } from "../../contexts/dropdown.hook.js";
6
- const C = ({ theme: o, ...e }) => {
7
- const { setValue: n, toggleOpen: s } = x(), c = u(null), t = r(
8
- (l) => {
9
- n(l), s(!1);
7
+ const g = ({ theme: a, ...e }) => {
8
+ const { setValue: n, toggleOpen: r } = x(), c = p(null), l = s(
9
+ (t) => {
10
+ n(t), r(!1);
10
11
  },
11
- [n, s]
12
- ), a = r(
13
- (l, m) => {
14
- l.key === "Enter" && t(m);
12
+ [n, r]
13
+ ), i = s(
14
+ (t, m) => {
15
+ t.key === "Enter" && l(m);
15
16
  },
16
- [t]
17
+ [l]
17
18
  );
18
19
  return /* @__PURE__ */ f(
19
20
  "li",
20
21
  {
21
22
  ref: c,
22
23
  role: "option",
23
- className: d(p({ theme: o })),
24
+ className: d(u({ theme: a })),
24
25
  tabIndex: 0,
25
- onClick: () => t(e),
26
- onKeyDown: (l) => a(l, e),
26
+ onClick: () => l(e),
27
+ onKeyDown: (t) => i(t, e),
27
28
  children: [
28
- e.leftIcon ? /* @__PURE__ */ i("span", { className: "w-4 h-4 flex justify-center items-center", children: e.leftIcon }) : null,
29
- e.label
29
+ e.leftIcon ? /* @__PURE__ */ o("span", { className: "w-4 h-4 flex justify-center items-center", children: e.leftIcon }) : null,
30
+ /* @__PURE__ */ o(h, { variant: "body2", className: "text-zinc-700", children: e.label })
30
31
  ]
31
32
  }
32
33
  );
33
34
  };
34
35
  export {
35
- C as ListItem
36
+ g as ListItem
36
37
  };
@@ -1,5 +1,5 @@
1
1
  import { c as e } from "../../../../index-BNmRGtA6.js";
2
- const t = e(
2
+ const o = e(
3
3
  [
4
4
  "cursor-pointer",
5
5
  "py-2",
@@ -10,12 +10,14 @@ const t = e(
10
10
  "w-full",
11
11
  "flex",
12
12
  "items-center",
13
- "gap-3"
13
+ "gap-3",
14
+ "hover:bg-slate-50",
15
+ "focus:bg-slate-50"
14
16
  ],
15
17
  {
16
18
  variants: {
17
19
  theme: {
18
- kubefirst: ["focus:bg-purple-100", "hover:bg-purple-100"],
20
+ kubefirst: [""],
19
21
  colony: ["focus:bg-red-100", "hover:bg-red-100"],
20
22
  civo: ""
21
23
  }
@@ -26,5 +28,5 @@ const t = e(
26
28
  }
27
29
  );
28
30
  export {
29
- t as listItemVariants
31
+ o as listItemVariants
30
32
  };
@@ -1,69 +1,99 @@
1
- import { jsxs as f, jsx as t } from "react/jsx-runtime";
2
- import { forwardRef as F, useId as L, useRef as N, useImperativeHandle as $, useEffect as m } from "react";
3
- import { cn as R } from "../../../utils/index.js";
4
- import { dropdownVariants as A } from "../Dropdown.variants.js";
5
- import { useDropdown as H } from "../hooks/useDropdown.js";
6
- import { List as U } from "./List/List.js";
7
- import { C as W } from "../../../chevron-up-DgLBQCKD.js";
8
- import { useDropdownContext as q } from "../contexts/dropdown.hook.js";
9
- import { useTheme as z } from "../../../contexts/theme.hook.js";
10
- const X = F(
11
- ({ theme: g, label: p, placeholder: O, name: o, options: a, defaultValue: c }, j) => {
12
- const d = L(), r = N(null), u = N(null), { wrapperRef: n, wrapperInputRef: h, handleOpen: y, handleOpenIfClosed: E } = H({ ulRef: u }), { isOpen: x, value: e, setValue: w, toggleOpen: b } = q(), { theme: T } = z(), v = g ?? T, s = o ? `${d}-${o}` : d;
13
- $(j, () => r.current, [r]), m(() => {
1
+ import { jsxs as i, jsx as t } from "react/jsx-runtime";
2
+ import { forwardRef as $, useId as A, useRef as y, useImperativeHandle as H, useEffect as d } from "react";
3
+ import { cn as p } from "../../../utils/index.js";
4
+ import { labelVariants as U, dropdownVariants as V } from "../Dropdown.variants.js";
5
+ import { useDropdown as W } from "../hooks/useDropdown.js";
6
+ import { List as B } from "./List/List.js";
7
+ import { Typography as R } from "../../Typography/Typography.js";
8
+ import { C as G } from "../../../chevron-up-DgLBQCKD.js";
9
+ import { useDropdownContext as J } from "../contexts/dropdown.hook.js";
10
+ import { useTheme as K } from "../../../contexts/theme.hook.js";
11
+ const te = $(
12
+ ({
13
+ theme: O,
14
+ label: u,
15
+ labelClassName: T,
16
+ placeholder: j,
17
+ name: o,
18
+ options: c,
19
+ required: h,
20
+ defaultValue: m
21
+ }, z) => {
22
+ const x = A(), r = y(null), b = y(null), { wrapperRef: n, wrapperInputRef: w, handleOpen: E, handleOpenIfClosed: k } = W({ ulRef: b }), { isOpen: v, toggleOpen: N, value: e, setValue: C } = J(), { theme: D } = K(), f = O ?? D, l = o ? `${x}-${o}` : x;
23
+ H(z, () => r.current, [r]), d(() => {
14
24
  r.current && (r.current.value = e ? e.value : "");
15
- }, [e]), m(() => {
16
- if (c) {
17
- const l = a.find(
18
- (i) => i.value === c
25
+ }, [e]), d(() => {
26
+ if (m && !e) {
27
+ const a = c.find(
28
+ (s) => s.value === m
19
29
  );
20
- l && w(l);
30
+ a && C(a);
21
31
  }
22
- }, [c, a, w]), m(() => {
23
- var i;
24
- const l = new AbortController();
25
- return (i = n.current) == null || i.addEventListener("focusout", (D) => {
26
- var I;
27
- const C = D.relatedTarget;
28
- (!C || !((I = n.current) != null && I.contains(C))) && b(!1);
32
+ }, [m, c, C, e]), d(() => {
33
+ var s;
34
+ const a = new AbortController();
35
+ return (s = n.current) == null || s.addEventListener("focusout", (L) => {
36
+ var g;
37
+ const I = L.relatedTarget;
38
+ (!I || !((g = n.current) != null && g.contains(I))) && N(!1);
29
39
  }), () => {
30
- l.abort();
40
+ a.abort();
31
41
  };
32
- }, [b, n]);
33
- const k = () => e != null && e.leftIcon ? /* @__PURE__ */ t("span", { className: "w-4 h-4 flex justify-center items-center", children: e.leftIcon }) : null;
34
- return /* @__PURE__ */ f("div", { ref: n, className: "flex flex-col w-full relative", children: [
35
- p ? /* @__PURE__ */ t(
42
+ }, [N, n]);
43
+ const F = () => e != null && e.leftIcon ? /* @__PURE__ */ t("span", { className: "w-4 h-4 flex justify-center items-center", children: e.leftIcon }) : null;
44
+ return /* @__PURE__ */ i("div", { ref: n, className: "flex flex-col w-full relative", children: [
45
+ u ? /* @__PURE__ */ i(
36
46
  "label",
37
47
  {
38
- id: s,
39
- className: "m-2 cursor-pointer",
40
- htmlFor: s,
41
- onClick: E,
42
- children: p
48
+ id: l,
49
+ className: p(
50
+ U({ theme: f }),
51
+ T
52
+ ),
53
+ htmlFor: l,
54
+ onClick: k,
55
+ children: [
56
+ u,
57
+ h ? /* @__PURE__ */ t("span", { className: "text-red-500 ml-1", children: "*" }) : null
58
+ ]
43
59
  }
44
60
  ) : null,
45
- /* @__PURE__ */ f(
61
+ /* @__PURE__ */ i(
46
62
  "div",
47
63
  {
48
- ref: h,
49
- id: s,
50
- className: R(A({ theme: v })),
64
+ ref: w,
65
+ id: l,
66
+ className: p(V({ theme: f })),
51
67
  role: "combobox",
52
- onClick: y,
53
- "aria-expanded": x,
68
+ onClick: E,
69
+ "aria-expanded": v,
54
70
  tabIndex: 0,
55
- "aria-labelledby": s,
71
+ "aria-labelledby": l,
56
72
  children: [
57
- /* @__PURE__ */ t("span", { className: "text-base text-inherit", children: e ? /* @__PURE__ */ f("span", { className: "flex gap-3 items-center", children: [
58
- k(),
59
- e.label
60
- ] }) : O }),
73
+ /* @__PURE__ */ t("span", { className: "text-base text-inherit", children: e ? /* @__PURE__ */ i(
74
+ R,
75
+ {
76
+ variant: "body2",
77
+ className: "flex gap-3 items-center text-zinc-700",
78
+ children: [
79
+ F(),
80
+ e.label
81
+ ]
82
+ }
83
+ ) : /* @__PURE__ */ t(
84
+ R,
85
+ {
86
+ variant: "body2",
87
+ className: "flex gap-3 items-center text-zinc-700",
88
+ children: j
89
+ }
90
+ ) }),
61
91
  /* @__PURE__ */ t(
62
- W,
92
+ G,
63
93
  {
64
- className: R(
65
- "w-4 h-4 text-inherit transition-all duration-50",
66
- x ? "rotate-0" : "rotate-180"
94
+ className: p(
95
+ "w-4 h-4 text-zinc-500 transition-all duration-50",
96
+ v ? "rotate-0" : "rotate-180"
67
97
  )
68
98
  }
69
99
  )
@@ -77,23 +107,24 @@ const X = F(
77
107
  type: "text",
78
108
  name: o,
79
109
  className: "hidden",
80
- "aria-hidden": "true"
110
+ "aria-hidden": "true",
111
+ required: h
81
112
  }
82
113
  ),
83
114
  /* @__PURE__ */ t(
84
- U,
115
+ B,
85
116
  {
86
- ref: u,
117
+ ref: b,
87
118
  name: o,
88
119
  wrapperRef: n,
89
- wrapperInputRef: h,
90
- options: a,
91
- theme: v
120
+ wrapperInputRef: w,
121
+ options: c,
122
+ theme: f
92
123
  }
93
124
  )
94
125
  ] });
95
126
  }
96
127
  );
97
128
  export {
98
- X as Wrapper
129
+ te as Wrapper
99
130
  };
@@ -1,10 +1,10 @@
1
1
  import { createContext as e } from "react";
2
2
  const t = e({
3
- value: null,
4
3
  isOpen: !1,
5
4
  toggleOpen() {
6
5
  throw new Error("toggleOpen function must be overridden");
7
6
  },
7
+ value: void 0,
8
8
  setValue() {
9
9
  throw new Error("setValue function must be overridden");
10
10
  }
@@ -1,22 +1,22 @@
1
- import { jsx as u } from "react/jsx-runtime";
2
- import { useState as i, useCallback as c } from "react";
1
+ import { jsx as m } from "react/jsx-runtime";
2
+ import { useCallback as i } from "react";
3
3
  import { DropdownContext as d } from "./dropdown.context.js";
4
4
  import { useToggle as f } from "../../../hooks/useToggle.js";
5
- const w = ({ children: t, onChange: o }) => {
6
- const [e, s] = f(!1), [l, p] = i(null), m = c(
7
- (r) => {
8
- o == null || o(r), p(r);
5
+ const a = ({ children: o, onChange: r, value: t }) => {
6
+ const [e, p] = f(!1), s = i(
7
+ (l) => {
8
+ r == null || r(l);
9
9
  },
10
- [o]
10
+ [r]
11
11
  );
12
- return /* @__PURE__ */ u(
12
+ return /* @__PURE__ */ m(
13
13
  d.Provider,
14
14
  {
15
- value: { value: l, isOpen: e, setValue: m, toggleOpen: s },
16
- children: t
15
+ value: { value: t, isOpen: e, setValue: s, toggleOpen: p },
16
+ children: o
17
17
  }
18
18
  );
19
19
  };
20
20
  export {
21
- w as DropdownProvider
21
+ a as DropdownProvider
22
22
  };