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

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 (93) hide show
  1. package/dist/{Modal-DZUwNzSW.js → Modal-B-E9uaA6.js} +354 -346
  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/Autocomplete/Autocomplete.variants.js +0 -1
  7. package/dist/components/Breadcrumb/Breadcrumb.variants.js +18 -15
  8. package/dist/components/Checkbox/Checkbox.js +1 -1
  9. package/dist/components/Command/Command.js +32 -0
  10. package/dist/components/Command/Command.variants.js +97 -0
  11. package/dist/components/Command/components/Command.js +8 -0
  12. package/dist/components/Command/components/CommandEmpty.js +15 -0
  13. package/dist/components/Command/components/CommandGroup.js +19 -0
  14. package/dist/components/Command/components/CommandInput.js +84 -0
  15. package/dist/components/Command/components/CommandItem.js +29 -0
  16. package/dist/components/Command/components/CommandList.js +16 -0
  17. package/dist/components/Command/components/CommandSeparator.js +16 -0
  18. package/dist/components/Command/components/CommandShortcut.js +19 -0
  19. package/dist/components/Command/components/DialogContent.js +31 -0
  20. package/dist/components/Command/components/DialogOverlay.js +19 -0
  21. package/dist/components/Command/components/index.js +20 -0
  22. package/dist/components/Command/contexts/Command.context.js +13 -0
  23. package/dist/components/Command/contexts/Command.provider.js +24 -0
  24. package/dist/components/Command/contexts/index.js +6 -0
  25. package/dist/components/Dropdown/Dropdown.js +6 -6
  26. package/dist/components/Dropdown/Dropdown.variants.js +22 -3
  27. package/dist/components/Dropdown/components/List/List.js +42 -16
  28. package/dist/components/Dropdown/components/List/List.variants.js +7 -5
  29. package/dist/components/Dropdown/components/ListItem/ListItem.js +26 -21
  30. package/dist/components/Dropdown/components/ListItem/ListItem.variants.js +6 -4
  31. package/dist/components/Dropdown/components/Wrapper.js +97 -63
  32. package/dist/components/Dropdown/contexts/dropdown.context.js +1 -1
  33. package/dist/components/Dropdown/contexts/dropdown.provider.js +9 -9
  34. package/dist/components/Input/Input.js +112 -67
  35. package/dist/components/Input/Input.variants.js +5 -6
  36. package/dist/components/Loading/Loading.js +102 -21
  37. package/dist/components/Loading/Loading.variants.js +13 -14
  38. package/dist/components/Modal/Modal.js +3 -3
  39. package/dist/components/Modal/components/Wrapper/Wrapper.js +3 -4
  40. package/dist/components/Modal/components/index.js +1 -1
  41. package/dist/components/NumberInput/NumberInput.js +88 -88
  42. package/dist/components/NumberInput/NumberInput.variants.js +23 -19
  43. package/dist/components/Range/Range.js +1 -1
  44. package/dist/components/Sidebar/Sidebar.variants.js +2 -1
  45. package/dist/components/Sidebar/components/Logo/Logo.variants.js +9 -17
  46. package/dist/components/Sidebar/components/NavigationGroup/NavigationGroup.variants.js +2 -2
  47. package/dist/components/Sidebar/components/NavigationOption/NavigationOption.variants.js +6 -5
  48. package/dist/components/Slider/Slider.js +1 -1
  49. package/dist/components/Switch/Switch.js +1 -1
  50. package/dist/components/Switch/Switch.variants.js +4 -4
  51. package/dist/components/Table/Table.js +31 -0
  52. package/dist/components/Table/Table.variants.js +78 -0
  53. package/dist/components/Table/components/Body.js +28 -0
  54. package/dist/components/Table/components/Filter.js +9 -0
  55. package/dist/components/Table/components/Head.js +28 -0
  56. package/dist/components/Table/components/Row.js +34 -0
  57. package/dist/components/Tag/Tag.js +17 -5
  58. package/dist/components/Tag/Tag.variants.js +11 -1
  59. package/dist/components/TagSelect/TagSelect.js +6 -71
  60. package/dist/components/TagSelect/TagSelect.variants.js +29 -50
  61. package/dist/components/TagSelect/components/Item/Item.js +23 -0
  62. package/dist/components/TagSelect/components/Item/Item.variants.js +31 -0
  63. package/dist/components/TagSelect/components/List/List.js +13 -0
  64. package/dist/components/TagSelect/components/List/List.variants.js +37 -0
  65. package/dist/components/TagSelect/components/Wrapper/Wrapper.js +88 -0
  66. package/dist/components/TagSelect/components/index.js +8 -0
  67. package/dist/components/TagSelect/contexts/TagSelect.context.js +19 -0
  68. package/dist/components/TagSelect/contexts/TagSelect.hook.js +11 -0
  69. package/dist/components/TagSelect/contexts/TagSelect.provider.js +69 -0
  70. package/dist/components/TagSelect/contexts/index.js +6 -0
  71. package/dist/components/TagSelect/hooks/useTagSelect.js +22 -27
  72. package/dist/components/TextArea/TextArea.js +28 -22
  73. package/dist/components/TextArea/TextArea.variants.js +0 -1
  74. package/dist/components/Toast/Toast.js +141 -128
  75. package/dist/components/Toast/Toast.variants.js +2 -3
  76. package/dist/components/Typography/Typography.js +23 -22
  77. package/dist/components/Typography/Typography.variants.js +49 -22
  78. package/dist/components/index.js +22 -20
  79. package/dist/{index-C6WtlN_F.js → index-BzaHYXkt.js} +1 -1
  80. package/dist/{index-Z1voPZOH.js → index-CbTU3cnP.js} +1 -1
  81. package/dist/index-CzSBQN5S.js +432 -0
  82. package/dist/index-D7QNmo_D.js +422 -0
  83. package/dist/index-DUA6Y_AE.js +126 -0
  84. package/dist/{index-B33at13_.js → index-D_76wh4w.js} +1 -1
  85. package/dist/index-DyKo5ZJT.js +446 -0
  86. package/dist/index.d.ts +82 -16
  87. package/dist/index.js +18 -16
  88. package/dist/package.json +26 -24
  89. package/dist/styles.css +1 -1
  90. package/dist/utils/index.js +320 -322
  91. package/package.json +26 -24
  92. package/dist/index-3jTPaVvh.js +0 -551
  93. package/dist/index-BTeAm7mx.js +0 -19133
@@ -1,25 +1,51 @@
1
- import { jsx as e } from "react/jsx-runtime";
2
- import { forwardRef as a, useRef as p, useImperativeHandle as u } from "react";
3
- import { cn as c } from "../../../../utils/index.js";
4
- import { useNavigationUlList as d } from "../../hooks/useNavigationList.js";
5
- import { ListItem as x } from "../ListItem/ListItem.js";
6
- import { listVariants as v } from "./List.variants.js";
7
- import { useDropdownContext as L } from "../../contexts/dropdown.hook.js";
8
- const j = a(
9
- ({ options: i, theme: t, wrapperRef: m, wrapperInputRef: s, name: l }, n) => {
10
- const r = p(null), { isOpen: f } = L();
11
- return u(n, () => r.current, [r]), d({ ulRef: r, wrapperRef: m, wrapperInputRef: s }), /* @__PURE__ */ e(
1
+ import { jsx as i } from "react/jsx-runtime";
2
+ import { forwardRef as c, useRef as d, useImperativeHandle as b } from "react";
3
+ import { cn as v } from "../../../../utils/index.js";
4
+ import { useNavigationUlList as x } from "../../hooks/useNavigationList.js";
5
+ import { ListItem as l } from "../ListItem/ListItem.js";
6
+ import { listVariants as L } from "./List.variants.js";
7
+ import { useDropdownContext as g } from "../../contexts/dropdown.hook.js";
8
+ const y = c(
9
+ ({ isLoading: s, options: r, theme: o, wrapperRef: a, wrapperInputRef: n, name: m }, f) => {
10
+ const e = d(null), { isOpen: p } = g();
11
+ b(f, () => e.current, [e]), x({ ulRef: e, wrapperRef: a, wrapperInputRef: n });
12
+ const u = r.length === 0;
13
+ return /* @__PURE__ */ i(
12
14
  "ul",
13
15
  {
14
- ref: r,
15
- title: l,
16
+ ref: e,
17
+ title: m,
16
18
  role: "listbox",
17
- className: c(v({ theme: t }), f ? "flex" : "hidden"),
18
- children: i.map((o) => /* @__PURE__ */ e(x, { theme: t, ...o }, o.value))
19
+ className: v(L({ theme: o }), p ? "flex" : "hidden"),
20
+ children: s ? /* @__PURE__ */ i(
21
+ l,
22
+ {
23
+ theme: o,
24
+ isClickable: !1,
25
+ value: "Loading...",
26
+ label: "Loading..."
27
+ }
28
+ ) : u ? /* @__PURE__ */ i(
29
+ l,
30
+ {
31
+ theme: o,
32
+ isClickable: !1,
33
+ value: "No options",
34
+ label: "No options"
35
+ }
36
+ ) : r.map((t) => /* @__PURE__ */ i(
37
+ l,
38
+ {
39
+ theme: o,
40
+ isClickable: !0,
41
+ ...t
42
+ },
43
+ t.value
44
+ ))
19
45
  }
20
46
  );
21
47
  }
22
48
  );
23
49
  export {
24
- j as List
50
+ y as List
25
51
  };
@@ -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 e = t(
3
3
  [
4
4
  "absolute",
5
5
  "bg-white",
@@ -14,13 +14,15 @@ const t = r(
14
14
  "top-full",
15
15
  "transition-all",
16
16
  "w-full",
17
- "z-10"
17
+ "z-10",
18
+ "max-h-[185px]",
19
+ "overflow-y-auto"
18
20
  ],
19
21
  {
20
22
  variants: {
21
23
  theme: {
22
24
  colony: ["border-red-400"],
23
- kubefirst: ["border-kubefirst-primary"],
25
+ kubefirst: ["text-zinc-700"],
24
26
  civo: ""
25
27
  }
26
28
  },
@@ -30,5 +32,5 @@ const t = r(
30
32
  }
31
33
  );
32
34
  export {
33
- t as listVariants
35
+ e as listVariants
34
36
  };
@@ -1,36 +1,41 @@
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 p, jsx as o } from "react/jsx-runtime";
2
+ import { useRef as u, useCallback as s } from "react";
3
3
  import { cn as d } from "../../../../utils/index.js";
4
- import { listItemVariants as p } from "./ListItem.variants.js";
5
- 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);
4
+ import { listItemVariants as h } from "./ListItem.variants.js";
5
+ import { Typography as x } from "../../../Typography/Typography.js";
6
+ import { useDropdownContext as y } from "../../contexts/dropdown.hook.js";
7
+ const j = ({
8
+ isClickable: a,
9
+ theme: c,
10
+ ...e
11
+ }) => {
12
+ const { setValue: n, toggleOpen: r } = y(), i = u(null), l = s(
13
+ (t) => {
14
+ n(t.value), r(!1);
10
15
  },
11
- [n, s]
12
- ), a = r(
13
- (l, m) => {
14
- l.key === "Enter" && t(m);
16
+ [n, r]
17
+ ), m = s(
18
+ (t, f) => {
19
+ t.key === "Enter" && l(f);
15
20
  },
16
- [t]
21
+ [l]
17
22
  );
18
- return /* @__PURE__ */ f(
23
+ return /* @__PURE__ */ p(
19
24
  "li",
20
25
  {
21
- ref: c,
26
+ ref: i,
22
27
  role: "option",
23
- className: d(p({ theme: o })),
28
+ className: d(h({ theme: c })),
24
29
  tabIndex: 0,
25
- onClick: () => t(e),
26
- onKeyDown: (l) => a(l, e),
30
+ onClick: () => a && l(e),
31
+ onKeyDown: (t) => m(t, e),
27
32
  children: [
28
- e.leftIcon ? /* @__PURE__ */ i("span", { className: "w-4 h-4 flex justify-center items-center", children: e.leftIcon }) : null,
29
- e.label
33
+ e.leftIcon ? /* @__PURE__ */ o("span", { className: "w-4 h-4 flex justify-center items-center", children: e.leftIcon }) : null,
34
+ /* @__PURE__ */ o(x, { variant: "body2", className: "text-zinc-700", children: e.label })
30
35
  ]
31
36
  }
32
37
  );
33
38
  };
34
39
  export {
35
- C as ListItem
40
+ j as ListItem
36
41
  };
@@ -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,101 @@
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(() => {
14
- r.current && (r.current.value = e ? e.value : "");
15
- }, [e]), m(() => {
16
- if (c) {
17
- const l = a.find(
18
- (i) => i.value === c
19
- );
20
- l && w(l);
1
+ import { jsxs as m, jsx as t } from "react/jsx-runtime";
2
+ import { forwardRef as H, useId as M, useRef as O, useImperativeHandle as U, useMemo as W, useEffect as p } from "react";
3
+ import { cn as u } from "../../../utils/index.js";
4
+ import { labelVariants as B, dropdownVariants as G } from "../Dropdown.variants.js";
5
+ import { useDropdown as J } from "../hooks/useDropdown.js";
6
+ import { List as K } from "./List/List.js";
7
+ import { Typography as z } from "../../Typography/Typography.js";
8
+ import { Loading as P } from "../../Loading/Loading.js";
9
+ import { C as Q } from "../../../chevron-up-DgLBQCKD.js";
10
+ import { useDropdownContext as S } from "../contexts/dropdown.hook.js";
11
+ import { useTheme as X } from "../../../contexts/theme.hook.js";
12
+ const ae = H(
13
+ ({
14
+ theme: T,
15
+ label: h,
16
+ labelClassName: j,
17
+ placeholder: E,
18
+ name: l,
19
+ options: n,
20
+ required: x,
21
+ defaultValue: f,
22
+ isLoading: v
23
+ }, L) => {
24
+ const b = M(), s = O(null), w = O(null), { wrapperRef: a, wrapperInputRef: N, handleOpen: k, handleOpenIfClosed: D } = J({ ulRef: w }), { isOpen: g, toggleOpen: C, value: r, setValue: I } = S(), { theme: F } = X(), d = T ?? F, c = l ? `${b}-${l}` : b;
25
+ U(L, () => s.current, [s]);
26
+ const e = W(() => n.find(({ value: o }) => o === r), [n, r]);
27
+ p(() => {
28
+ s.current && (s.current.value = r ? e == null ? void 0 : e.value : "");
29
+ }, [e, r]), p(() => {
30
+ if (f && !r) {
31
+ const o = n && n.find((i) => i.value === f);
32
+ o && I(o.value);
21
33
  }
22
- }, [c, a, w]), m(() => {
34
+ }, [f, n, I, r]), p(() => {
23
35
  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);
36
+ const o = new AbortController();
37
+ return (i = a.current) == null || i.addEventListener("focusout", (A) => {
38
+ var R;
39
+ const y = A.relatedTarget;
40
+ (!y || !((R = a.current) != null && R.contains(y))) && C(!1);
29
41
  }), () => {
30
- l.abort();
42
+ o.abort();
31
43
  };
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(
44
+ }, [C, a]);
45
+ const $ = () => e != null && e.leftIcon ? /* @__PURE__ */ t("span", { className: "w-4 h-4 flex justify-center items-center", children: e.leftIcon }) : null;
46
+ return /* @__PURE__ */ m("div", { ref: a, className: "flex flex-col w-full relative", children: [
47
+ h ? /* @__PURE__ */ m(
36
48
  "label",
37
49
  {
38
- id: s,
39
- className: "m-2 cursor-pointer",
40
- htmlFor: s,
41
- onClick: E,
42
- children: p
50
+ id: c,
51
+ className: u(
52
+ B({ theme: d }),
53
+ j
54
+ ),
55
+ htmlFor: c,
56
+ onClick: D,
57
+ children: [
58
+ h,
59
+ x ? /* @__PURE__ */ t("span", { className: "text-red-500 ml-1", children: "*" }) : null
60
+ ]
43
61
  }
44
62
  ) : null,
45
- /* @__PURE__ */ f(
63
+ /* @__PURE__ */ m(
46
64
  "div",
47
65
  {
48
- ref: h,
49
- id: s,
50
- className: R(A({ theme: v })),
66
+ ref: N,
67
+ id: c,
68
+ className: u(G({ theme: d })),
51
69
  role: "combobox",
52
- onClick: y,
53
- "aria-expanded": x,
70
+ onClick: k,
71
+ "aria-expanded": g,
54
72
  tabIndex: 0,
55
- "aria-labelledby": s,
73
+ "aria-labelledby": c,
56
74
  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 }),
61
- /* @__PURE__ */ t(
62
- W,
75
+ /* @__PURE__ */ t("span", { className: "text-base text-inherit", children: r ? /* @__PURE__ */ m(
76
+ z,
77
+ {
78
+ variant: "body2",
79
+ className: "flex gap-3 items-center text-zinc-700",
80
+ children: [
81
+ $(),
82
+ e == null ? void 0 : e.label
83
+ ]
84
+ }
85
+ ) : /* @__PURE__ */ t(
86
+ z,
87
+ {
88
+ variant: "body2",
89
+ className: "flex gap-3 items-center text-zinc-700",
90
+ children: E
91
+ }
92
+ ) }),
93
+ v ? /* @__PURE__ */ t(P, { className: "w-4 h-4 text-zinc-500" }) : /* @__PURE__ */ t(
94
+ Q,
63
95
  {
64
- className: R(
65
- "w-4 h-4 text-inherit transition-all duration-50",
66
- x ? "rotate-0" : "rotate-180"
96
+ className: u(
97
+ "w-4 h-4 text-zinc-500 transition-all duration-50",
98
+ g ? "rotate-0" : "rotate-180"
67
99
  )
68
100
  }
69
101
  )
@@ -73,27 +105,29 @@ const X = F(
73
105
  /* @__PURE__ */ t(
74
106
  "input",
75
107
  {
76
- ref: r,
108
+ ref: s,
77
109
  type: "text",
78
- name: o,
110
+ name: l,
79
111
  className: "hidden",
80
- "aria-hidden": "true"
112
+ "aria-hidden": "true",
113
+ required: x
81
114
  }
82
115
  ),
83
116
  /* @__PURE__ */ t(
84
- U,
117
+ K,
85
118
  {
86
- ref: u,
87
- name: o,
88
- wrapperRef: n,
89
- wrapperInputRef: h,
90
- options: a,
91
- theme: v
119
+ ref: w,
120
+ name: l,
121
+ wrapperRef: a,
122
+ wrapperInputRef: N,
123
+ options: n,
124
+ isLoading: !!v,
125
+ theme: d
92
126
  }
93
127
  )
94
128
  ] });
95
129
  }
96
130
  );
97
131
  export {
98
- X as Wrapper
132
+ ae as Wrapper
99
133
  };
@@ -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,18 +1,18 @@
1
- import { jsx as u } from "react/jsx-runtime";
2
- import { useState as i, useCallback as c } from "react";
1
+ import { jsx as i } from "react/jsx-runtime";
2
+ import { useCallback as u } 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 w = ({ children: t, onChange: r, value: e, name: o }) => {
6
+ const [l, p] = f(!1), s = u(
7
+ (m) => {
8
+ r == null || r({ target: { value: m, name: o ?? "" } });
9
9
  },
10
- [o]
10
+ [r, o]
11
11
  );
12
- return /* @__PURE__ */ u(
12
+ return /* @__PURE__ */ i(
13
13
  d.Provider,
14
14
  {
15
- value: { value: l, isOpen: e, setValue: m, toggleOpen: s },
15
+ value: { value: e, isOpen: l, setValue: s, toggleOpen: p },
16
16
  children: t
17
17
  }
18
18
  );