@konstructio/ui 0.0.12-alpha.2 → 0.0.12-alpha.3

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 (64) hide show
  1. package/dist/{Modal-DZUwNzSW.js → Modal-ByNiP7eb.js} +3 -3
  2. package/dist/components/Alert/Alert.js +1 -1
  3. package/dist/components/AlertDialog/AlertDialog.js +1 -1
  4. package/dist/components/AlertDialog/components/AlertDialogTrigger.js +1 -1
  5. package/dist/components/AlertDialog/components/index.js +1 -1
  6. package/dist/components/Checkbox/Checkbox.js +1 -1
  7. package/dist/components/Command/Command.js +32 -0
  8. package/dist/components/Command/Command.variants.js +97 -0
  9. package/dist/components/Command/components/Command.js +8 -0
  10. package/dist/components/Command/components/CommandEmpty.js +15 -0
  11. package/dist/components/Command/components/CommandGroup.js +19 -0
  12. package/dist/components/Command/components/CommandInput.js +84 -0
  13. package/dist/components/Command/components/CommandItem.js +29 -0
  14. package/dist/components/Command/components/CommandList.js +16 -0
  15. package/dist/components/Command/components/CommandSeparator.js +16 -0
  16. package/dist/components/Command/components/CommandShortcut.js +19 -0
  17. package/dist/components/Command/components/DialogContent.js +31 -0
  18. package/dist/components/Command/components/DialogOverlay.js +19 -0
  19. package/dist/components/Command/components/index.js +20 -0
  20. package/dist/components/Command/contexts/Command.context.js +13 -0
  21. package/dist/components/Command/contexts/Command.provider.js +24 -0
  22. package/dist/components/Command/contexts/index.js +6 -0
  23. package/dist/components/Loading/Loading.js +102 -21
  24. package/dist/components/Loading/Loading.variants.js +13 -14
  25. package/dist/components/Modal/Modal.js +2 -2
  26. package/dist/components/Modal/components/Wrapper/Wrapper.js +2 -2
  27. package/dist/components/Modal/components/index.js +1 -1
  28. package/dist/components/NumberInput/NumberInput.js +1 -1
  29. package/dist/components/Range/Range.js +1 -1
  30. package/dist/components/Slider/Slider.js +1 -1
  31. package/dist/components/Switch/Switch.js +1 -1
  32. package/dist/components/Tag/Tag.js +17 -5
  33. package/dist/components/Tag/Tag.variants.js +11 -1
  34. package/dist/components/TagSelect/TagSelect.js +6 -71
  35. package/dist/components/TagSelect/TagSelect.variants.js +29 -50
  36. package/dist/components/TagSelect/components/Item/Item.js +23 -0
  37. package/dist/components/TagSelect/components/Item/Item.variants.js +31 -0
  38. package/dist/components/TagSelect/components/List/List.js +13 -0
  39. package/dist/components/TagSelect/components/List/List.variants.js +37 -0
  40. package/dist/components/TagSelect/components/Wrapper/Wrapper.js +88 -0
  41. package/dist/components/TagSelect/components/index.js +8 -0
  42. package/dist/components/TagSelect/contexts/TagSelect.context.js +19 -0
  43. package/dist/components/TagSelect/contexts/TagSelect.hook.js +11 -0
  44. package/dist/components/TagSelect/contexts/TagSelect.provider.js +69 -0
  45. package/dist/components/TagSelect/contexts/index.js +6 -0
  46. package/dist/components/TagSelect/hooks/useTagSelect.js +22 -27
  47. package/dist/components/Toast/Toast.js +3 -3
  48. package/dist/components/Typography/Typography.js +23 -22
  49. package/dist/components/Typography/Typography.variants.js +49 -22
  50. package/dist/components/index.js +1 -1
  51. package/dist/{index-C6WtlN_F.js → index-BzaHYXkt.js} +1 -1
  52. package/dist/{index-Z1voPZOH.js → index-CbTU3cnP.js} +1 -1
  53. package/dist/index-CzSBQN5S.js +432 -0
  54. package/dist/index-D7QNmo_D.js +422 -0
  55. package/dist/index-DUA6Y_AE.js +126 -0
  56. package/dist/{index-B33at13_.js → index-D_76wh4w.js} +1 -1
  57. package/dist/index-DyKo5ZJT.js +446 -0
  58. package/dist/index.d.ts +15 -5
  59. package/dist/index.js +1 -1
  60. package/dist/package.json +17 -13
  61. package/dist/styles.css +1 -1
  62. package/package.json +16 -13
  63. package/dist/index-3jTPaVvh.js +0 -551
  64. package/dist/index-BTeAm7mx.js +0 -19133
@@ -1,20 +1,19 @@
1
1
  import { c as t } from "../../index-BNmRGtA6.js";
2
- const i = t(["h-", "w-8", "animate-spin"], {
3
- variants: {
4
- variant: {
5
- default: ""
2
+ const r = t(
3
+ ["h-8", "w-8", "animate-spin", "text-inherit"],
4
+ {
5
+ variants: {
6
+ theme: {
7
+ kubefirst: "text-kubefirst-primary",
8
+ colony: "text-colony-primary",
9
+ civo: "text-civo-primary"
10
+ }
6
11
  },
7
- theme: {
8
- kubefirst: "text-kubefirst-primary",
9
- colony: "text-colony-primary",
10
- civo: "text-civo-primary"
12
+ defaultVariants: {
13
+ theme: "kubefirst"
11
14
  }
12
- },
13
- defaultVariants: {
14
- variant: "default",
15
- theme: "kubefirst"
16
15
  }
17
- });
16
+ );
18
17
  export {
19
- i as loadingVariants
18
+ r as loadingVariants
20
19
  };
@@ -1,6 +1,6 @@
1
1
  import "react/jsx-runtime";
2
- import "../../index-BTeAm7mx.js";
3
- import { M as d } from "../../Modal-DZUwNzSW.js";
2
+ import "../../index-D7QNmo_D.js";
3
+ import { M as d } from "../../Modal-ByNiP7eb.js";
4
4
  import "./components/Header/Header.js";
5
5
  import "./components/Body/Body.js";
6
6
  import "./components/Footer/Footer.js";
@@ -1,7 +1,7 @@
1
1
  import "react/jsx-runtime";
2
- import "../../../../index-Z1voPZOH.js";
2
+ import "../../../../index-CbTU3cnP.js";
3
3
  import "react";
4
- import { W as x } from "../../../../Modal-DZUwNzSW.js";
4
+ import { W as x } from "../../../../Modal-ByNiP7eb.js";
5
5
  import "../../../../Combination-b348x__d.js";
6
6
  import "../../../../utils/index.js";
7
7
  import "./Wrapper.variants.js";
@@ -1,7 +1,7 @@
1
1
  import { Body as e } from "./Body/Body.js";
2
2
  import { Footer as t } from "./Footer/Footer.js";
3
3
  import { Header as m } from "./Header/Header.js";
4
- import { W as a } from "../../../Modal-DZUwNzSW.js";
4
+ import { W as a } from "../../../Modal-ByNiP7eb.js";
5
5
  export {
6
6
  e as Body,
7
7
  t as Footer,
@@ -1,5 +1,5 @@
1
1
  import { jsxs as y, jsx as u } from "react/jsx-runtime";
2
- import { R as j } from "../../index-Z1voPZOH.js";
2
+ import { R as j } from "../../index-CbTU3cnP.js";
3
3
  import p, { forwardRef as d, useId as E, useState as T, useCallback as x } from "react";
4
4
  import { cn as h } from "../../utils/index.js";
5
5
  import { labelVariants as $, buttonVariants as P, numberInputVariants as L } from "./NumberInput.variants.js";
@@ -1,5 +1,5 @@
1
1
  import { jsxs as r, jsx as e } from "react/jsx-runtime";
2
- import { R as V, T as v, a as T, b as c } from "../../index-C6WtlN_F.js";
2
+ import { R as V, T as v, a as T, b as c } from "../../index-BzaHYXkt.js";
3
3
  import { forwardRef as b, useRef as j, useState as k, useImperativeHandle as w, useEffect as y, useCallback as C } from "react";
4
4
  import { cn as t } from "../../utils/index.js";
5
5
  import { rangeOutsideVariants as S, trackVariants as $, thumbVariants as i, rangeVariants as E } from "./Range.variants.js";
@@ -1,5 +1,5 @@
1
1
  import { jsxs as l, jsx as t } from "react/jsx-runtime";
2
- import { R as v, T, b as V } from "../../index-C6WtlN_F.js";
2
+ import { R as v, T, b as V } from "../../index-BzaHYXkt.js";
3
3
  import { forwardRef as b, useRef as R, useState as g, useImperativeHandle as j, useEffect as k, useCallback as w } from "react";
4
4
  import { cn as a } from "../../utils/index.js";
5
5
  import { trackVariants as y, thumbVariants as C, sliderVariants as S } from "./Slider.variants.js";
@@ -4,7 +4,7 @@ import { forwardRef as _, useState as H, useRef as A, useId as M, useImperativeH
4
4
  import { a as B, c as q, b as F } from "../../index-Cva-e5M4.js";
5
5
  import { u as O } from "../../index-B_6_jmOO.js";
6
6
  import { u as V, a as D } from "../../index-4ecjw_Aj.js";
7
- import { P as g } from "../../index-BTeAm7mx.js";
7
+ import { P as g } from "../../index-D7QNmo_D.js";
8
8
  import { cn as x } from "../../utils/index.js";
9
9
  import { thumbVariants as L, switchVariants as U } from "./Switch.variants.js";
10
10
  import { useTheme as W } from "../../contexts/theme.hook.js";
@@ -1,7 +1,19 @@
1
- import { jsx as r } from "react/jsx-runtime";
2
- import { cn as i } from "../../utils/index.js";
3
- import { tagVariants as m } from "./Tag.variants.js";
4
- const n = ({ label: t, color: a }) => /* @__PURE__ */ r("div", { className: i(m({ color: a })), children: /* @__PURE__ */ r("span", { className: "text-inherit", children: t }) });
1
+ import { jsxs as n, jsx as a } from "react/jsx-runtime";
2
+ import { S as r } from "../../index-B_6_jmOO.js";
3
+ import { cn as o } from "../../utils/index.js";
4
+ import { tagVariants as c } from "./Tag.variants.js";
5
+ const u = ({
6
+ label: i,
7
+ color: s,
8
+ rightIcon: t,
9
+ leftIcon: e,
10
+ className: l,
11
+ "data-value": m
12
+ }) => /* @__PURE__ */ n("div", { className: o(c({ color: s, className: l })), "data-value": m, children: [
13
+ e ? /* @__PURE__ */ a(r, { className: "text-inherit", children: e }) : null,
14
+ /* @__PURE__ */ a("span", { className: "text-inherit", children: i }),
15
+ t ? /* @__PURE__ */ a(r, { className: "text-inherit", children: t }) : null
16
+ ] });
5
17
  export {
6
- n as Tag
18
+ u as Tag
7
19
  };
@@ -1,6 +1,16 @@
1
1
  import { c as e } from "../../index-BNmRGtA6.js";
2
2
  const f = e(
3
- ["px-2", "py-1", "rounded-md", "w-max", "text-xs"],
3
+ [
4
+ "px-2",
5
+ "py-1",
6
+ "rounded-md",
7
+ "w-max",
8
+ "text-xs",
9
+ "flex",
10
+ "items-center",
11
+ "justify-center",
12
+ "gap-1"
13
+ ],
4
14
  {
5
15
  variants: {
6
16
  color: {
@@ -1,73 +1,8 @@
1
- import { jsxs as u, 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 { cn as r } from "../../utils/index.js";
4
- import { Tag as d } from "../Tag/Tag.js";
5
- import { useTagSelect as S } from "./hooks/useTagSelect.js";
6
- import { tagSelectVariants as k, tagItemVariants as I, tagListVariants as V } from "./TagSelect.variants.js";
7
- import { C as j } from "../../chevron-up-DgLBQCKD.js";
8
- import { useTheme as y } from "../../contexts/theme.hook.js";
9
- const z = g(({ label: s, name: l, options: f, placeholder: h = "Select a value...", theme: o }, x) => {
10
- const c = w(), { theme: a } = y(), t = C(null), {
11
- isOpen: n,
12
- selectedTag: m,
13
- value: p,
14
- wrapperRef: b,
15
- handleClickTag: N,
16
- handleOpenDropdown: v
17
- } = S();
18
- return T(x, () => t.current, [t]), R(() => {
19
- t.current && (t.current.value = p);
20
- }, [p]), /* @__PURE__ */ u("div", { ref: b, className: "flex flex-col w-full relative", children: [
21
- s ? /* @__PURE__ */ e("label", { className: "m-2 cursor-pointer", htmlFor: l ?? c, children: s }) : null,
22
- /* @__PURE__ */ u(
23
- "div",
24
- {
25
- id: l ?? c,
26
- className: r(k({ theme: o ?? a })),
27
- role: "combobox",
28
- onClick: v,
29
- "aria-expanded": n,
30
- children: [
31
- m ? /* @__PURE__ */ e(d, { ...m }) : /* @__PURE__ */ e("span", { className: "text-base text-inherit", children: h }),
32
- /* @__PURE__ */ e(
33
- j,
34
- {
35
- className: r(
36
- "w-4 h-4 text-inherit transition-all duration-50",
37
- n ? "rotate-0" : "rotate-180"
38
- )
39
- }
40
- )
41
- ]
42
- }
43
- ),
44
- /* @__PURE__ */ e("input", { ref: t, type: "text", name: l, className: "hidden" }),
45
- n ? /* @__PURE__ */ e(
46
- "ul",
47
- {
48
- role: "listbox",
49
- className: r(V({ theme: o ?? a })),
50
- children: f.map((i) => /* @__PURE__ */ e(
51
- "li",
52
- {
53
- className: r(I({ theme: o ?? a })),
54
- role: "option",
55
- children: /* @__PURE__ */ e(
56
- "button",
57
- {
58
- type: "button",
59
- role: "button",
60
- className: "m-0 p-0 w-full",
61
- onClick: () => N(i),
62
- children: /* @__PURE__ */ e(d, { label: i.label, color: i.color })
63
- }
64
- )
65
- }
66
- ))
67
- }
68
- ) : null
69
- ] });
70
- });
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { forwardRef as p } from "react";
3
+ import { TagSelectProvider as f } from "./contexts/TagSelect.provider.js";
4
+ import { Wrapper as i } from "./components/Wrapper/Wrapper.js";
5
+ const n = p(({ options: o, multiselect: e, ...t }, m) => /* @__PURE__ */ r(f, { defaultOptions: o, multiselect: e, children: /* @__PURE__ */ r(i, { ref: m, ...t }) }));
71
6
  export {
72
- z as TagSelect
7
+ n as TagSelect
73
8
  };
@@ -1,27 +1,11 @@
1
1
  import { c as e } from "../../index-BNmRGtA6.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
- ],
2
+ const r = e(
3
+ ["flex", "flex-col", "w-full", "relative", "text-zinc-500"],
17
4
  {
18
5
  variants: {
19
6
  theme: {
20
- colony: ["aria-expanded:border-red-400", "aria-expanded:text-red-400"],
21
- kubefirst: [
22
- "aria-expanded:border-kubefirst-primary",
23
- "aria-expanded:text-kubefirst-secondary"
24
- ],
7
+ colony: "",
8
+ kubefirst: "",
25
9
  civo: ""
26
10
  }
27
11
  },
@@ -29,42 +13,37 @@ const t = e(
29
13
  theme: "kubefirst"
30
14
  }
31
15
  }
32
- ), a = e(
16
+ ), a = e(["my-2", "cursor-pointer"], {
17
+ variants: {
18
+ theme: {
19
+ colony: "",
20
+ kubefirst: "",
21
+ civo: ""
22
+ }
23
+ },
24
+ defaultVariants: {
25
+ theme: "kubefirst"
26
+ }
27
+ }), i = e(
33
28
  [
34
- "absolute",
35
- "bg-white",
36
29
  "border",
37
- "duration-100",
30
+ "cursor-pointer",
31
+ "duration-250",
38
32
  "ease-in-out",
39
33
  "flex",
40
- "flex-col",
41
- "mt-1",
42
- "rounded-md",
43
- "shadow-sm",
44
- "top-full",
34
+ "items-center",
35
+ "justify-between",
36
+ "px-2",
37
+ "py-1",
38
+ "rounded",
45
39
  "transition-all",
46
- "w-full",
47
- "z-10"
40
+ "w-full"
48
41
  ],
49
42
  {
50
43
  variants: {
51
44
  theme: {
52
- colony: ["border-red-400"],
53
- kubefirst: ["border-kubefirst-primary"],
54
- civo: ""
55
- }
56
- },
57
- defaultVariants: {
58
- theme: "kubefirst"
59
- }
60
- }
61
- ), i = e(
62
- ["cursor-pointer", "py-1", "px-2", "last:mb-2", "first:mt-2", "h-full"],
63
- {
64
- variants: {
65
- theme: {
66
- colony: "hover:bg-red-100",
67
- kubefirst: "hover:bg-purple-100",
45
+ colony: "",
46
+ kubefirst: "",
68
47
  civo: ""
69
48
  }
70
49
  },
@@ -74,7 +53,7 @@ const t = e(
74
53
  }
75
54
  );
76
55
  export {
77
- i as tagItemVariants,
78
- a as tagListVariants,
79
- t as tagSelectVariants
56
+ a as labelVariants,
57
+ i as tagSelectVariants,
58
+ r as wrapperVariants
80
59
  };
@@ -0,0 +1,23 @@
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { Tag as i } from "../../../Tag/Tag.js";
3
+ import { cn as c } from "../../../../utils/index.js";
4
+ import { wrapperVariants as n } from "./Item.variants.js";
5
+ import { useTagSelect as s } from "../../contexts/TagSelect.hook.js";
6
+ import { useTheme as h } from "../../../../contexts/theme.hook.js";
7
+ const g = ({ option: e, theme: r }) => {
8
+ const { theme: m } = h(), { onSelectTag: o } = s();
9
+ return /* @__PURE__ */ t(
10
+ "li",
11
+ {
12
+ role: "option",
13
+ className: c(
14
+ n({ theme: r ?? m, isSelected: e.isSelected })
15
+ ),
16
+ onClick: () => o(e),
17
+ children: /* @__PURE__ */ t(i, { ...e })
18
+ }
19
+ );
20
+ };
21
+ export {
22
+ g as Item
23
+ };
@@ -0,0 +1,31 @@
1
+ import { c as e } from "../../../../index-BNmRGtA6.js";
2
+ const r = e(
3
+ ["cursor-pointer", "py-1.5", "px-2", "last:pb-2", "first:pt-2", "h-full"],
4
+ {
5
+ variants: {
6
+ theme: {
7
+ colony: "",
8
+ kubefirst: ["hover:bg-purple-100"],
9
+ civo: ""
10
+ },
11
+ isSelected: {
12
+ true: "",
13
+ false: ""
14
+ }
15
+ },
16
+ compoundVariants: [
17
+ {
18
+ theme: "kubefirst",
19
+ isSelected: !0,
20
+ class: ["bg-purple-100"]
21
+ }
22
+ ],
23
+ defaultVariants: {
24
+ theme: "kubefirst",
25
+ isSelected: !1
26
+ }
27
+ }
28
+ );
29
+ export {
30
+ r as wrapperVariants
31
+ };
@@ -0,0 +1,13 @@
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ import { cn as i } from "../../../../utils/index.js";
3
+ import { Item as n } from "../Item/Item.js";
4
+ import { wrapperVariants as p } from "./List.variants.js";
5
+ import { useTagSelect as a } from "../../contexts/TagSelect.hook.js";
6
+ import { useTheme as c } from "../../../../contexts/theme.hook.js";
7
+ const d = ({ theme: m }) => {
8
+ const { tags: t } = a(), { theme: s } = c(), o = m ?? s;
9
+ return /* @__PURE__ */ e("ul", { role: "listbox", className: i(p({ theme: o })), children: t.length > 0 ? t.map((r) => /* @__PURE__ */ e(n, { theme: o, option: r }, r.id)) : /* @__PURE__ */ e("span", { className: "text-center text-sm px-4 py-2", children: "There is not options available" }) });
10
+ };
11
+ export {
12
+ d as List
13
+ };
@@ -0,0 +1,37 @@
1
+ import { c as e } from "../../../../index-BNmRGtA6.js";
2
+ const t = e(
3
+ [
4
+ "absolute",
5
+ "bg-white",
6
+ "border",
7
+ "duration-100",
8
+ "flex",
9
+ "flex-col",
10
+ "mt-0.5",
11
+ "rounded",
12
+ "shadow-sm",
13
+ "top-full",
14
+ "transition-all",
15
+ "w-full",
16
+ "z-10",
17
+ "animate-in",
18
+ "fade-in-60",
19
+ "zoom-in-95",
20
+ "overflow-hidden"
21
+ ],
22
+ {
23
+ variants: {
24
+ theme: {
25
+ colony: "",
26
+ kubefirst: "",
27
+ civo: ""
28
+ }
29
+ },
30
+ defaultVariants: {
31
+ theme: "kubefirst"
32
+ }
33
+ }
34
+ );
35
+ export {
36
+ t as wrapperVariants
37
+ };
@@ -0,0 +1,88 @@
1
+ import "../Item/Item.js";
2
+ import { List as w } from "../List/List.js";
3
+ import { jsxs as c, jsx as e } from "react/jsx-runtime";
4
+ import { forwardRef as C, useId as b, useImperativeHandle as S } from "react";
5
+ import { Tag as k } from "../../../Tag/Tag.js";
6
+ import { cn as a } from "../../../../utils/index.js";
7
+ import { useTagSelect as R } from "../../hooks/useTagSelect.js";
8
+ import { labelVariants as I, tagSelectVariants as O, wrapperVariants as V } from "../../TagSelect.variants.js";
9
+ import { X as j } from "../../../../x-DU-Zw-L_.js";
10
+ import { C as y } from "../../../../chevron-up-DgLBQCKD.js";
11
+ import { useTheme as F } from "../../../../contexts/theme.hook.js";
12
+ import { useTagSelect as H } from "../../contexts/TagSelect.hook.js";
13
+ const J = C(
14
+ ({
15
+ label: n,
16
+ labelClassName: p,
17
+ name: s,
18
+ placeholder: h = "Select a value...",
19
+ theme: d,
20
+ wrapperClassName: f
21
+ }, u) => {
22
+ const l = b(), { theme: x } = F(), { selectedTags: m, isOpen: o, onOpen: N, onRemoveTag: v, inputRef: i } = H(), { wrapperRef: T, handleOpen: g } = R(), t = d ?? x;
23
+ return S(u, () => i.current, [i]), /* @__PURE__ */ c(
24
+ "div",
25
+ {
26
+ ref: T,
27
+ className: a(
28
+ V({
29
+ theme: t,
30
+ className: f
31
+ })
32
+ ),
33
+ children: [
34
+ n ? /* @__PURE__ */ e(
35
+ "label",
36
+ {
37
+ htmlFor: s ?? l,
38
+ className: a(
39
+ I({
40
+ theme: t,
41
+ className: p
42
+ })
43
+ ),
44
+ onClick: () => N(!0),
45
+ children: n
46
+ }
47
+ ) : null,
48
+ /* @__PURE__ */ c(
49
+ "div",
50
+ {
51
+ id: s ?? l,
52
+ className: a(O({ theme: t })),
53
+ role: "combobox",
54
+ onClick: g,
55
+ "aria-expanded": o,
56
+ children: [
57
+ m.length === 0 ? /* @__PURE__ */ e("span", { className: "text-base text-inherit select-none", children: h }) : /* @__PURE__ */ e("div", { className: "flex flex-wrap gap-1.5", children: m.map((r) => /* @__PURE__ */ e(
58
+ k,
59
+ {
60
+ ...r,
61
+ className: "select-none",
62
+ rightIcon: /* @__PURE__ */ e(j, { className: "w-3 h-3", onClick: () => v(r) }),
63
+ "data-value": r.label
64
+ },
65
+ r.id
66
+ )) }),
67
+ /* @__PURE__ */ e(
68
+ y,
69
+ {
70
+ className: a(
71
+ "w-4 h-4 text-inherit transition-all duration-50 shrink-0",
72
+ o ? "rotate-0" : "rotate-180"
73
+ )
74
+ }
75
+ )
76
+ ]
77
+ }
78
+ ),
79
+ /* @__PURE__ */ e("input", { ref: i, type: "text", name: s, className: "hidden" }),
80
+ o ? /* @__PURE__ */ e(w, { theme: t }) : null
81
+ ]
82
+ }
83
+ );
84
+ }
85
+ );
86
+ export {
87
+ J as Wrapper
88
+ };
@@ -0,0 +1,8 @@
1
+ import { Item as e } from "./Item/Item.js";
2
+ import { List as t } from "./List/List.js";
3
+ import { Wrapper as f } from "./Wrapper/Wrapper.js";
4
+ export {
5
+ e as Item,
6
+ t as List,
7
+ f as Wrapper
8
+ };
@@ -0,0 +1,19 @@
1
+ import { createContext as e } from "react";
2
+ const t = {
3
+ tags: [],
4
+ selectedTags: [],
5
+ isOpen: !1,
6
+ inputRef: null,
7
+ onSelectTag() {
8
+ throw new Error("Function not implemented.");
9
+ },
10
+ onRemoveTag() {
11
+ throw new Error("Function not implemented.");
12
+ },
13
+ onOpen() {
14
+ throw new Error("Function not implemented.");
15
+ }
16
+ }, o = e(t);
17
+ export {
18
+ o as TagSelectContext
19
+ };
@@ -0,0 +1,11 @@
1
+ import { useContext as t } from "react";
2
+ import { TagSelectContext as o } from "./TagSelect.context.js";
3
+ const c = () => {
4
+ const e = t(o);
5
+ if (!e)
6
+ throw new Error("useTagSelect must be used within a TagSelectProvider");
7
+ return e;
8
+ };
9
+ export {
10
+ c as useTagSelect
11
+ };
@@ -0,0 +1,69 @@
1
+ import { jsx as I } from "react/jsx-runtime";
2
+ import { useRef as R, useState as T, useCallback as l } from "react";
3
+ import { TagSelectContext as x } from "./TagSelect.context.js";
4
+ import { useToggle as w } from "../../../hooks/useToggle.js";
5
+ const k = ({
6
+ children: m,
7
+ defaultOptions: n = [],
8
+ multiselect: d = !0
9
+ }) => {
10
+ const i = R(null), [p, a] = w(!1), [S, g] = T(n), [r, u] = T([]), o = l((t) => {
11
+ if (i.current) {
12
+ const s = t.map(({ id: c, label: e }) => ({
13
+ id: c,
14
+ value: e
15
+ }));
16
+ i.current.value = JSON.stringify(s);
17
+ }
18
+ }, []), f = l(
19
+ (t) => {
20
+ const s = [...d ? r : [], t];
21
+ u(s);
22
+ const c = s.map((e) => e.id);
23
+ g(() => d ? n.filter(
24
+ (e) => !c.includes(e.id)
25
+ ) : n.map((e) => ({
26
+ ...e,
27
+ isSelected: c.includes(e.id)
28
+ }))), o(s), a(!1);
29
+ },
30
+ [
31
+ n,
32
+ o,
33
+ d,
34
+ r,
35
+ a
36
+ ]
37
+ ), v = l(
38
+ (t) => {
39
+ const s = r.filter((e) => e.id !== t.id);
40
+ u(s);
41
+ const c = s.map((e) => e.id);
42
+ g(
43
+ () => n.filter((e) => !c.includes(e.id))
44
+ ), o(s);
45
+ },
46
+ [n, o, r]
47
+ ), h = l(
48
+ (t) => a(t),
49
+ [a]
50
+ );
51
+ return /* @__PURE__ */ I(
52
+ x.Provider,
53
+ {
54
+ value: {
55
+ tags: S,
56
+ selectedTags: r,
57
+ isOpen: p,
58
+ inputRef: i,
59
+ onSelectTag: f,
60
+ onRemoveTag: v,
61
+ onOpen: h
62
+ },
63
+ children: m
64
+ }
65
+ );
66
+ };
67
+ export {
68
+ k as TagSelectProvider
69
+ };
@@ -0,0 +1,6 @@
1
+ import { useTagSelect as o } from "./TagSelect.hook.js";
2
+ import { TagSelectProvider as a } from "./TagSelect.provider.js";
3
+ export {
4
+ a as TagSelectProvider,
5
+ o as useTagSelect
6
+ };