@konstructio/ui 0.1.2-alpha.43 → 0.1.2-alpha.46

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 (59) hide show
  1. package/dist/components/AlertDialog/AlertDialog.js +39 -37
  2. package/dist/components/AlertDialog/components/AlertDialogTrigger.js +1 -1
  3. package/dist/components/AlertDialog/components/index.js +1 -1
  4. package/dist/components/Badge/Badge.js +23 -26
  5. package/dist/components/Badge/Badge.variants.js +1 -1
  6. package/dist/components/Button/Button.variants.js +108 -98
  7. package/dist/components/Checkbox/Checkbox.js +104 -100
  8. package/dist/components/Checkbox/Checkbox.variants.js +30 -7
  9. package/dist/components/Filter/Filter.js +1 -1
  10. package/dist/components/Filter/components/BadgeDropdown/BadgeMultiSelect.js +9 -10
  11. package/dist/components/Filter/components/DateFilterDropdown/DateFilterDropdown.js +76 -43
  12. package/dist/components/Filter/components/ResetButton/ResetButton.js +21 -32
  13. package/dist/components/Filter/events/index.js +3 -3
  14. package/dist/components/ImageUpload/ImageUpload.js +221 -0
  15. package/dist/components/ImageUpload/ImageUpload.variants.js +109 -0
  16. package/dist/components/Input/Input.variants.js +10 -2
  17. package/dist/components/PhoneNumberInput/PhoneNumberInput.variants.js +4 -4
  18. package/dist/components/PhoneNumberInput/components/FlagContent/FlagContent.js +16 -7
  19. package/dist/components/PhoneNumberInput/components/FlagSelectorList/FlagSelectorList.js +92 -74
  20. package/dist/components/PhoneNumberInput/components/FlagSelectorWrapper/FlagSelectorWrapper.js +53 -29
  21. package/dist/components/PhoneNumberInput/components/Wrapper.js +139 -120
  22. package/dist/components/Select/Select.js +48 -0
  23. package/dist/components/{Dropdown/Dropdown.variants.js → Select/Select.variants.js} +8 -8
  24. package/dist/components/{Dropdown → Select}/components/List/List.js +73 -46
  25. package/dist/components/{Dropdown → Select}/components/List/List.variants.js +11 -8
  26. package/dist/components/{Dropdown → Select}/components/ListItem/ListItem.js +34 -34
  27. package/dist/components/{Dropdown → Select}/components/ListItem/ListItem.variants.js +5 -4
  28. package/dist/components/{Dropdown → Select}/components/Wrapper.js +88 -88
  29. package/dist/components/Select/contexts/index.js +6 -0
  30. package/dist/components/{Dropdown/contexts/dropdown.context.js → Select/contexts/select.context.js} +2 -2
  31. package/dist/components/Select/contexts/select.hook.js +11 -0
  32. package/dist/components/Select/contexts/select.provider.js +58 -0
  33. package/dist/components/{Dropdown → Select}/hooks/useNavigationList.js +3 -3
  34. package/dist/components/{Dropdown/hooks/useDropdown.js → Select/hooks/useSelect.js} +33 -33
  35. package/dist/components/Switch/Switch.js +153 -125
  36. package/dist/components/Switch/Switch.variants.js +15 -6
  37. package/dist/components/Typography/Typography.js +25 -27
  38. package/dist/components/Typography/Typography.variants.js +2 -2
  39. package/dist/components/VirtualizedTable/components/Actions/Actions.js +14 -14
  40. package/dist/components/VirtualizedTable/components/DropdownPaginate/DropdownPaginate.js +10 -10
  41. package/dist/components/VirtualizedTable/components/Skeleton/Skeleton.js +1 -1
  42. package/dist/components/index.js +77 -74
  43. package/dist/{index-CPU02rhe.js → index-D6KzX_ef.js} +13 -12
  44. package/dist/index.d.ts +106 -60
  45. package/dist/index.js +109 -106
  46. package/dist/package.json +4 -4
  47. package/dist/styles.css +1 -1
  48. package/dist/ui/civo-theme.css +6 -5
  49. package/dist/ui/theme.css +27 -0
  50. package/dist/x-BXShoIAM.js +8 -0
  51. package/package.json +4 -4
  52. package/dist/components/Dropdown/Dropdown.js +0 -48
  53. package/dist/components/Dropdown/contexts/dropdown.hook.js +0 -13
  54. package/dist/components/Dropdown/contexts/dropdown.provider.js +0 -58
  55. package/dist/components/Dropdown/contexts/index.js +0 -6
  56. /package/dist/components/{Dropdown → Select}/components/EmptyList.js +0 -0
  57. /package/dist/components/{Dropdown → Select}/components/index.js +0 -0
  58. /package/dist/components/{Dropdown → Select}/constants/index.js +0 -0
  59. /package/dist/components/{Dropdown → Select}/constants/pagination.js +0 -0
@@ -23,7 +23,7 @@ const a = e(
23
23
  "kubefirst:aria-expanded:border-kubefirst-primary",
24
24
  "kubefirst:aria-expanded:text-kubefirst-secondary",
25
25
  "dark:border-metal-700",
26
- "dark:focus-visible:bg-slate-800",
26
+ "dark:focus-visible:bg-metal-800",
27
27
  "dark:bg-metal-800"
28
28
  ],
29
29
  {
@@ -38,7 +38,7 @@ const a = e(
38
38
  false: ""
39
39
  },
40
40
  disabled: {
41
- true: ["cursor-default", "bg-gray-100", "dark:bg-slate-700/80"],
41
+ true: ["cursor-default", "bg-gray-100", "dark:bg-metal-700/80"],
42
42
  false: []
43
43
  }
44
44
  },
@@ -52,24 +52,24 @@ const a = e(
52
52
  "bg-transparent",
53
53
  "border-none",
54
54
  "outline-none",
55
- "text-zinc-700",
55
+ "text-metal-700",
56
56
  "text-sm",
57
57
  "capitalize",
58
58
  "placeholder:text-sm",
59
59
  "placeholder:normal-case",
60
60
  "placeholder:select-none",
61
- "dark:placeholder:text-slate-400",
62
- "dark:text-slate-50"
61
+ "dark:placeholder:text-metal-400",
62
+ "dark:text-metal-50"
63
63
  ]), d = e([
64
64
  "mb-1",
65
65
  "cursor-pointer",
66
66
  "text-sm",
67
67
  "leading-5",
68
68
  "tracking-[0.1px]",
69
- "dark:text-slate-50"
69
+ "dark:text-metal-50"
70
70
  ]);
71
71
  export {
72
- a as dropdownVariants,
73
72
  t as inputVariants,
74
- d as labelVariants
73
+ d as labelVariants,
74
+ a as selectVariants
75
75
  };
@@ -3,127 +3,127 @@ import { S as Z } from "../../../../index-BvoZGpli.js";
3
3
  import { d as B } from "../../../../debounce-BFejQm9P.js";
4
4
  import { forwardRef as G, useRef as C, useState as J, useImperativeHandle as K, useMemo as M, useEffect as Q } from "react";
5
5
  import { Loading as R } from "../../../Loading/Loading.js";
6
- import { cn as a } from "../../../../utils/index.js";
6
+ import { cn as o } from "../../../../utils/index.js";
7
7
  import { useNavigationUlList as W } from "../../hooks/useNavigationList.js";
8
8
  import { ListItem as b } from "../ListItem/ListItem.js";
9
9
  import { listVariants as X } from "./List.variants.js";
10
10
  import { DEFAULT_LIST_SIZE as Y } from "../../constants/pagination.js";
11
- import { useDropdownContext as $ } from "../../contexts/dropdown.hook.js";
11
+ import { useSelectContext as $ } from "../../contexts/select.hook.js";
12
12
  const fe = G(
13
13
  ({
14
14
  additionalOptions: F,
15
15
  className: N,
16
- inputRef: i,
16
+ inputRef: l,
17
17
  isLoading: E,
18
- itemClassName: l,
18
+ itemClassName: i,
19
19
  name: I,
20
- searchable: y = !1,
20
+ searchable: x = !1,
21
21
  listItemSecondRowClassName: c,
22
- wrapperInputRef: j,
22
+ wrapperInputRef: S,
23
23
  isInfiniteScrollEnabled: u,
24
24
  onFetchMoreOptions: f,
25
- noOptionsText: L
26
- }, O) => {
27
- const o = C(null), m = C(null), [p, w] = J(!1), {
28
- isOpen: P,
25
+ noOptionsText: y
26
+ }, j) => {
27
+ const n = C(null), m = C(null), [p, L] = J(!1), {
28
+ isOpen: O,
29
29
  searchTerm: g,
30
- canFilter: S,
31
- canContinueFetching: n,
30
+ canFilter: P,
31
+ canContinueFetching: a,
32
32
  page: d,
33
- options: x,
33
+ options: w,
34
34
  isTyping: k,
35
35
  setOptions: T,
36
- setPage: D,
37
- setCanContinueFetching: U
36
+ setPage: U,
37
+ setCanContinueFetching: _
38
38
  } = $();
39
- K(O, () => o.current, [o]);
40
- const h = y && S ? x.filter((e) => {
39
+ K(j, () => n.current, [n]);
40
+ const h = x && P ? w.filter((e) => {
41
41
  const t = g.toLowerCase();
42
42
  return (typeof e.label == "string" ? e.label.toLowerCase() : "").includes(t);
43
- }) : x;
43
+ }) : w;
44
44
  W({
45
- ulRef: o,
46
- wrapperInputRef: j,
47
- searchable: y,
45
+ ulRef: n,
46
+ wrapperInputRef: S,
47
+ searchable: x,
48
48
  filteredOptions: h
49
49
  });
50
- const _ = h.filter(
50
+ const q = h.filter(
51
51
  (e, t, s) => t === s.findIndex((v) => v.value === e.value)
52
- ), q = h.length === 0, z = M(
52
+ ), z = h.length === 0, A = M(
53
53
  () => B(async (e) => {
54
54
  const [t] = e;
55
- if (t.isIntersecting && !p && f && n)
55
+ if (t.isIntersecting && !p && f && a)
56
56
  try {
57
- w(!0);
58
- const s = d + 1, { data: v, hasMore: A } = await f({
57
+ L(!0);
58
+ const s = d + 1, { data: v, hasMore: D } = await f({
59
59
  page: s,
60
60
  pageSize: Y,
61
61
  termOfSearch: g
62
62
  });
63
- D(s), U(A), T((H) => [...H, ...v]);
63
+ U(s), _(D), T((H) => [...H, ...v]);
64
64
  } catch {
65
65
  console.error("Error fetching more options");
66
66
  } finally {
67
- w(!1);
67
+ L(!1);
68
68
  }
69
69
  }, 100),
70
70
  [p, f, g, d]
71
71
  );
72
72
  return Q(() => {
73
- if (u && n && m.current && !k) {
74
- const e = new IntersectionObserver(z, {
73
+ if (u && a && m.current && !k) {
74
+ const e = new IntersectionObserver(A, {
75
75
  threshold: 0.1
76
76
  });
77
77
  return e.observe(m.current), () => e.disconnect();
78
78
  }
79
79
  }, [
80
80
  u,
81
- n,
81
+ a,
82
82
  p,
83
83
  k,
84
84
  d
85
85
  ]), /* @__PURE__ */ V(
86
86
  "ul",
87
87
  {
88
- ref: o,
88
+ ref: n,
89
89
  title: I,
90
90
  role: "listbox",
91
- className: a(X({ className: N })),
92
- "data-state": P ? "open" : "closed",
91
+ className: o(X({ className: N })),
92
+ "data-state": O ? "open" : "closed",
93
93
  children: [
94
94
  E ? /* @__PURE__ */ r(
95
95
  b,
96
96
  {
97
- className: a("select-none", l),
97
+ className: o("select-none", i),
98
98
  isClickable: !1,
99
- inputRef: i,
99
+ inputRef: l,
100
100
  value: "Loading...",
101
101
  label: "Loading...",
102
102
  listItemSecondRowClassName: c
103
103
  }
104
- ) : q ? /* @__PURE__ */ r(
104
+ ) : z ? /* @__PURE__ */ r(
105
105
  b,
106
106
  {
107
107
  isEmpty: !0,
108
- className: a("select-none", l),
108
+ className: o("select-none", i),
109
109
  isClickable: !1,
110
- inputRef: i,
111
- value: L ?? "",
112
- label: L ?? "No options",
110
+ inputRef: l,
111
+ value: y ?? "",
112
+ label: y ?? "No options",
113
113
  listItemSecondRowClassName: c
114
114
  }
115
- ) : _.map((e) => /* @__PURE__ */ r(
115
+ ) : q.map((e) => /* @__PURE__ */ r(
116
116
  b,
117
117
  {
118
- className: a("select-none", l),
118
+ className: o("select-none", i),
119
119
  isClickable: !0,
120
- inputRef: i,
120
+ inputRef: l,
121
121
  listItemSecondRowClassName: c,
122
122
  ...e
123
123
  },
124
124
  e.value
125
125
  )),
126
- u && n && /* @__PURE__ */ r(
126
+ u && a && /* @__PURE__ */ r(
127
127
  "li",
128
128
  {
129
129
  ref: m,
@@ -134,7 +134,34 @@ const fe = G(
134
134
  children: /* @__PURE__ */ r(R, { className: "w-4 h-4 text-aurora-500 select-none" })
135
135
  }
136
136
  ),
137
- F?.map((e, t) => /* @__PURE__ */ r("li", { role: "option", "data-action": "true", children: /* @__PURE__ */ r(Z, { className: "flex p-2 w-full h-full gap-1 items-center text-sm [&>svg]:w-3.5 [&>svg]:h-3.5 [&>svg]:shrink-0 cursor-pointer select-none hover:bg-gray-50 hover:dark:bg-slate-700 focus:outline-0", children: e }) }, t))
137
+ F?.map((e, t) => /* @__PURE__ */ r("li", { role: "option", "data-action": "true", children: /* @__PURE__ */ r(
138
+ Z,
139
+ {
140
+ className: o(
141
+ "flex",
142
+ "min-h-10",
143
+ "py-2",
144
+ "px-6",
145
+ "w-full",
146
+ "h-full",
147
+ "gap-1",
148
+ "items-center",
149
+ "text-sm",
150
+ "[&>svg]:-ml-1",
151
+ "[&>svg]:w-3.5",
152
+ "[&>svg]:h-3.5",
153
+ "[&>svg]:shrink-0",
154
+ "cursor-pointer",
155
+ "select-none",
156
+ "hover:bg-gray-50",
157
+ "hover:dark:bg-metal-700",
158
+ "focus:outline-0",
159
+ "text-blue-600",
160
+ "dark:text-aurora-500"
161
+ ),
162
+ children: e
163
+ }
164
+ ) }, t))
138
165
  ]
139
166
  }
140
167
  );
@@ -1,5 +1,6 @@
1
- import { c as o } from "../../../../index-D29mdTf5.js";
2
- const t = o([
1
+ import { c as t } from "../../../../index-D29mdTf5.js";
2
+ const o = t([
3
+ "scrollbar",
3
4
  "absolute",
4
5
  "bg-white",
5
6
  "border",
@@ -11,18 +12,20 @@ const t = o([
11
12
  "top-full",
12
13
  "w-full",
13
14
  "z-10",
14
- "max-h-[185px]",
15
+ "max-h-44",
15
16
  "overflow-y-auto",
16
17
  "border-gray-200",
17
18
  "text-zinc-700",
18
19
  "animate-in",
19
20
  "fade-in-50",
20
21
  "zoom-in-95",
21
- "duration-[200ms]",
22
- "dark:bg-slate-800",
23
- "dark:border-slate-700",
24
- "dark:text-slate-50"
22
+ "duration-200",
23
+ "dark:bg-metal-800",
24
+ "dark:border-metal-700",
25
+ "dark:text-metal-50",
26
+ "[&>li:first-child]:mt-2",
27
+ "[&>li:last-child]:mb-2"
25
28
  ]);
26
29
  export {
27
- t as listVariants
30
+ o as listVariants
28
31
  };
@@ -1,46 +1,46 @@
1
- import { jsx as s, jsxs as d } from "react/jsx-runtime";
1
+ import { jsx as n, jsxs as d } from "react/jsx-runtime";
2
2
  import { useRef as I, useCallback as u } from "react";
3
- import { cn as l } from "../../../../utils/index.js";
3
+ import { cn as s } from "../../../../utils/index.js";
4
4
  import { Typography as y } from "../../../Typography/Typography.js";
5
5
  import { listItemVariants as L } from "./ListItem.variants.js";
6
- import { useDropdownContext as V } from "../../contexts/dropdown.hook.js";
7
- function j(c, n) {
8
- const i = n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), o = new RegExp(`(${i})`, "gi");
9
- return c.split(o).map((a, t) => a.toLowerCase() === n.toLowerCase() ? /* @__PURE__ */ s(
6
+ import { useSelectContext as V } from "../../contexts/select.hook.js";
7
+ function j(c, r) {
8
+ const i = r.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), o = new RegExp(`(${i})`, "gi");
9
+ return c.split(o).map((a, t) => a.toLowerCase() === r.toLowerCase() ? /* @__PURE__ */ n(
10
10
  "mark",
11
11
  {
12
- className: "bg-transparent font-semibold text-slate-800 dark:text-slate-50",
12
+ className: "bg-transparent font-semibold text-metal-800 dark:text-metal-50",
13
13
  children: a
14
14
  },
15
15
  t
16
- ) : /* @__PURE__ */ s("span", { children: a }, t));
16
+ ) : /* @__PURE__ */ n("span", { children: a }, t));
17
17
  }
18
18
  const K = ({
19
19
  isEmpty: c,
20
- isClickable: n,
20
+ isClickable: r,
21
21
  className: i,
22
22
  inputRef: o,
23
23
  listItemSecondRowClassName: a,
24
24
  ...t
25
25
  }) => {
26
- const { searchTerm: m, highlightSearchEnabled: h, setValue: p, toggleOpen: x } = V(), b = I(null), f = u(
26
+ const { searchTerm: m, highlightSearchEnabled: h, setValue: x, toggleOpen: g } = V(), b = I(null), f = u(
27
27
  (e) => {
28
- p(e.value, o), x(!1);
28
+ x(e.value, o), g(!1);
29
29
  },
30
- [p, x]
31
- ), w = u(
32
- (e, r) => {
33
- e.key === "Enter" && (e.stopPropagation(), f(r));
30
+ [x, g]
31
+ ), N = u(
32
+ (e, l) => {
33
+ e.key === "Enter" && (e.stopPropagation(), f(l));
34
34
  },
35
35
  [f]
36
- ), N = u(
37
- ({ label: e, rightComponent: r, subLabel: g, rightComponentClassName: C }) => {
36
+ ), w = u(
37
+ ({ label: e, rightComponent: l, subLabel: p, rightComponentClassName: C }) => {
38
38
  if (c)
39
- return /* @__PURE__ */ s(
39
+ return /* @__PURE__ */ n(
40
40
  y,
41
41
  {
42
42
  variant: "body2",
43
- className: "text-zinc-800 dark:text-slate-50 italic",
43
+ className: "text-zinc-800 dark:text-metal-50 italic",
44
44
  children: e
45
45
  }
46
46
  );
@@ -51,27 +51,27 @@ const K = ({
51
51
  y,
52
52
  {
53
53
  variant: "body2",
54
- className: "text-zinc-700 dark:text-slate-50 font-medium",
54
+ className: "text-zinc-700 dark:text-metal-50 font-medium",
55
55
  children: [
56
- r ? /* @__PURE__ */ d(
56
+ l ? /* @__PURE__ */ d(
57
57
  "span",
58
58
  {
59
- className: l("flex gap-2 items-center", C),
59
+ className: s("flex gap-2 items-center", C),
60
60
  children: [
61
61
  k,
62
62
  " ",
63
- r
63
+ l
64
64
  ]
65
65
  }
66
66
  ) : k,
67
- g ? /* @__PURE__ */ s(
67
+ p ? /* @__PURE__ */ n(
68
68
  "span",
69
69
  {
70
- className: l(
71
- "block font-normal text-sm text-slate-800 dark:text-slate-50",
70
+ className: s(
71
+ "block font-normal text-sm text-metal-800 dark:text-metal-50",
72
72
  a
73
73
  ),
74
- children: g
74
+ children: p
75
75
  }
76
76
  ) : null
77
77
  ]
@@ -86,28 +86,28 @@ const K = ({
86
86
  ref: b,
87
87
  role: "option",
88
88
  "data-action": "false",
89
- className: l(L({ className: i })),
89
+ className: s(L({ className: i })),
90
90
  tabIndex: 0,
91
91
  onClick: (e) => {
92
- n && (f(t), e.stopPropagation());
92
+ r && (f(t), e.stopPropagation());
93
93
  },
94
- onKeyDown: (e) => w(e, t),
94
+ onKeyDown: (e) => N(e, t),
95
95
  children: [
96
- t.leftIcon ? /* @__PURE__ */ s(
96
+ t.leftIcon ? /* @__PURE__ */ n(
97
97
  "span",
98
98
  {
99
- className: l(
99
+ className: s(
100
100
  "w-4 h-4 flex justify-center",
101
101
  {
102
102
  "items-center": !t.subLabel,
103
- "items-baseline -translate-y-2": !!t.subLabel
103
+ "items-baseline -tranmetal-y-2": !!t.subLabel
104
104
  },
105
105
  t.leftIconClassName
106
106
  ),
107
107
  children: t.leftIcon
108
108
  }
109
109
  ) : null,
110
- N(t)
110
+ w(t)
111
111
  ]
112
112
  }
113
113
  );
@@ -1,8 +1,8 @@
1
1
  import { c as r } from "../../../../index-D29mdTf5.js";
2
2
  const t = r([
3
3
  "cursor-pointer",
4
- "py-2",
5
- "px-2",
4
+ "py-1.5",
5
+ "px-6",
6
6
  "h-full",
7
7
  "focus-visible:outline-none",
8
8
  "m-0",
@@ -12,10 +12,11 @@ const t = r([
12
12
  "gap-3",
13
13
  "transition-bg",
14
14
  "duration-250",
15
+ "min-h-10",
15
16
  "hover:bg-gray-50",
16
17
  "focus:bg-gray-50",
17
- "dark:hover:bg-slate-700",
18
- "dark:focus:bg-slate-700"
18
+ "dark:hover:bg-metal-700",
19
+ "dark:focus:bg-metal-700"
19
20
  ]);
20
21
  export {
21
22
  t as listItemVariants