@konstructio/ui 0.1.2-alpha.2 → 0.1.2-alpha.4

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.
@@ -1,5 +1,5 @@
1
1
  import { c as r } from "../../index-D29mdTf5.js";
2
- const t = r(
2
+ const e = r(
3
3
  [
4
4
  "cursor-pointer",
5
5
  "border",
@@ -10,9 +10,10 @@ const t = r(
10
10
  "justify-center",
11
11
  "items-center",
12
12
  "transition-all",
13
- "text-white",
13
+ "text-slate-800",
14
14
  "border-zinc-400",
15
- "kubefirst:border-kubefirst-primary"
15
+ "kubefirst:border-kubefirst-primary",
16
+ "kubefirst:text-white"
16
17
  ],
17
18
  {
18
19
  variants: {
@@ -40,6 +41,6 @@ const t = r(
40
41
  }
41
42
  ), a = r(["cursor-pointer", "text-slate-800"]);
42
43
  export {
43
- t as checkboxVariants,
44
+ e as checkboxVariants,
44
45
  a as labelVariants
45
46
  };
@@ -1,30 +1,42 @@
1
- import { jsx as t, jsxs as m } from "react/jsx-runtime";
2
- import { forwardRef as p } from "react";
3
- import { DropdownProvider as n } from "./contexts/dropdown.provider.js";
4
- import { Wrapper as c } from "./components/Wrapper.js";
5
- const v = p(({ onChange: r, onBlur: l, value: a, error: s, helperText: e, name: o, ...i }, d) => /* @__PURE__ */ t(
6
- n,
7
- {
1
+ import { jsx as t, jsxs as p } from "react/jsx-runtime";
2
+ import { forwardRef as n } from "react";
3
+ import { DropdownProvider as c } from "./contexts/dropdown.provider.js";
4
+ import { Wrapper as x } from "./components/Wrapper.js";
5
+ const N = n(
6
+ ({
8
7
  onChange: r,
9
8
  onBlur: l,
10
9
  value: a,
10
+ error: s,
11
+ helperText: e,
11
12
  name: o,
12
- children: /* @__PURE__ */ m("div", { className: "relative w-full", children: [
13
- /* @__PURE__ */ t(
14
- c,
15
- {
16
- name: o,
17
- error: s,
18
- ref: d,
19
- onBlur: l,
20
- ...i
21
- }
22
- ),
23
- s ? /* @__PURE__ */ t("span", { className: "text-xs text-red-700", children: s }) : null,
24
- !s && e ? /* @__PURE__ */ t("span", { className: "text-xs text-slate-600", children: e }) : null
25
- ] })
26
- }
27
- ));
13
+ highlightSearch: i,
14
+ ...d
15
+ }, m) => /* @__PURE__ */ t(
16
+ c,
17
+ {
18
+ highlightSearch: i,
19
+ name: o,
20
+ value: a,
21
+ onBlur: l,
22
+ onChange: r,
23
+ children: /* @__PURE__ */ p("div", { className: "relative w-full", children: [
24
+ /* @__PURE__ */ t(
25
+ x,
26
+ {
27
+ name: o,
28
+ error: s,
29
+ ref: m,
30
+ onBlur: l,
31
+ ...d
32
+ }
33
+ ),
34
+ s ? /* @__PURE__ */ t("span", { className: "text-xs text-red-700", children: s }) : null,
35
+ !s && e ? /* @__PURE__ */ t("span", { className: "text-xs text-slate-600", children: e }) : null
36
+ ] })
37
+ }
38
+ )
39
+ );
28
40
  export {
29
- v as Dropdown
41
+ N as Dropdown
30
42
  };
@@ -1,6 +1,7 @@
1
- import { c as r } from "../../index-D29mdTf5.js";
2
- const a = r(
1
+ import { c as e } from "../../index-D29mdTf5.js";
2
+ const a = e(
3
3
  [
4
+ "group",
4
5
  "border",
5
6
  "cursor-pointer",
6
7
  "ease-in-out",
@@ -20,7 +21,9 @@ const a = r(
20
21
  "aria-expanded:border-aurora-500",
21
22
  "aria-expanded:text-aurora-500",
22
23
  "kubefirst:aria-expanded:border-kubefirst-primary",
23
- "kubefirst:aria-expanded:text-kubefirst-secondary"
24
+ "kubefirst:aria-expanded:text-kubefirst-secondary",
25
+ "dark:border-slate-600",
26
+ "dark:focus-visible:bg-slate-800"
24
27
  ],
25
28
  {
26
29
  variants: {
@@ -38,14 +41,29 @@ const a = r(
38
41
  hasError: !1
39
42
  }
40
43
  }
41
- ), t = r([
44
+ ), t = e([
45
+ "flex-1",
46
+ "bg-transparent",
47
+ "border-none",
48
+ "outline-none",
49
+ "text-zinc-700",
50
+ "text-sm",
51
+ "capitalize",
52
+ "placeholder:text-sm",
53
+ "placeholder:normal-case",
54
+ "placeholder:select-none",
55
+ "dark:placeholder:text-slate-400",
56
+ "dark:text-slate-50"
57
+ ]), n = e([
42
58
  "mb-1",
43
59
  "cursor-pointer",
44
- "text-[14px]",
60
+ "text-sm",
45
61
  "leading-[20px]",
46
- "tracking-[0.1px]"
62
+ "tracking-[0.1px]",
63
+ "dark:text-slate-50"
47
64
  ]);
48
65
  export {
49
66
  a as dropdownVariants,
50
- t as labelVariants
67
+ t as inputVariants,
68
+ n as labelVariants
51
69
  };
@@ -1,64 +1,76 @@
1
- import { jsx as t } from "react/jsx-runtime";
2
- import { forwardRef as v, useRef as w, useImperativeHandle as N } from "react";
3
- import { cn as h } from "../../../../utils/index.js";
4
- import { useNavigationUlList as x } from "../../hooks/useNavigationList.js";
5
- import { ListItem as s } from "../ListItem/ListItem.js";
6
- import { listVariants as C } from "./List.variants.js";
7
- import { useDropdownContext as k } from "../../contexts/dropdown.hook.js";
8
- const T = v(
1
+ import { jsx as l, jsxs as x, Fragment as N } from "react/jsx-runtime";
2
+ import { forwardRef as k, useRef as C, useImperativeHandle as y } from "react";
3
+ import { cn as o } from "../../../../utils/index.js";
4
+ import { useNavigationUlList as R } from "../../hooks/useNavigationList.js";
5
+ import { ListItem as a } from "../ListItem/ListItem.js";
6
+ import { listVariants as j } from "./List.variants.js";
7
+ import { S as I } from "../../../../index-DQH6odE9.js";
8
+ import { useDropdownContext as O } from "../../contexts/dropdown.hook.js";
9
+ const z = k(
9
10
  ({
10
- className: i,
11
- isLoading: n,
12
- itemClassName: o,
13
- name: c,
14
- options: r,
15
- searchable: m = !1,
16
- wrapperInputRef: f,
17
- wrapperRef: p
18
- }, u) => {
19
- const l = w(null), { isOpen: b, searchTerm: d } = k();
20
- N(u, () => l.current, [l]), x({ ulRef: l, wrapperRef: p, wrapperInputRef: f });
21
- const a = m ? r.filter((e) => {
22
- const g = d.toLowerCase();
23
- return (typeof e.label == "string" ? e.label.toLowerCase() : "").includes(g);
24
- }) : r, L = a.length === 0;
25
- return /* @__PURE__ */ t(
11
+ additionalOptions: m,
12
+ className: f,
13
+ inputRef: p,
14
+ isLoading: u,
15
+ itemClassName: s,
16
+ name: d,
17
+ options: n,
18
+ searchable: i = !1,
19
+ wrapperInputRef: g,
20
+ wrapperRef: b
21
+ }, h) => {
22
+ const t = C(null), { isOpen: v, searchTerm: L } = O();
23
+ y(h, () => t.current, [t]), R({
24
+ ulRef: t,
25
+ wrapperRef: b,
26
+ wrapperInputRef: g,
27
+ inputRef: p,
28
+ searchable: i
29
+ });
30
+ const c = i ? n.filter((e) => {
31
+ const r = L.toLowerCase();
32
+ return (typeof e.label == "string" ? e.label.toLowerCase() : "").includes(r);
33
+ }) : n, w = c.length === 0;
34
+ return /* @__PURE__ */ l(
26
35
  "ul",
27
36
  {
28
- ref: l,
29
- title: c,
37
+ ref: t,
38
+ title: d,
30
39
  role: "listbox",
31
- className: h(C({ className: i })),
32
- "data-state": b ? "open" : "closed",
33
- children: n ? /* @__PURE__ */ t(
34
- s,
40
+ className: o(j({ className: f })),
41
+ "data-state": v ? "open" : "closed",
42
+ children: u ? /* @__PURE__ */ l(
43
+ a,
35
44
  {
36
- className: o,
45
+ className: o("select-none", s),
37
46
  isClickable: !1,
38
47
  value: "Loading...",
39
48
  label: "Loading..."
40
49
  }
41
- ) : L ? /* @__PURE__ */ t(
42
- s,
50
+ ) : w ? /* @__PURE__ */ l(
51
+ a,
43
52
  {
44
- className: o,
53
+ className: o("select-none", s),
45
54
  isClickable: !1,
46
55
  value: "No options",
47
56
  label: "No options"
48
57
  }
49
- ) : a.map((e) => /* @__PURE__ */ t(
50
- s,
51
- {
52
- className: o,
53
- isClickable: !0,
54
- ...e
55
- },
56
- e.value
57
- ))
58
+ ) : /* @__PURE__ */ x(N, { children: [
59
+ c.map((e) => /* @__PURE__ */ l(
60
+ a,
61
+ {
62
+ className: o("select-none", s),
63
+ isClickable: !0,
64
+ ...e
65
+ },
66
+ e.value
67
+ )),
68
+ m?.map((e, r) => /* @__PURE__ */ l("li", { role: "option", "data-action": "true", children: /* @__PURE__ */ l(I, { 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 }) }, r))
69
+ ] })
58
70
  }
59
71
  );
60
72
  }
61
73
  );
62
74
  export {
63
- T as List
75
+ z as List
64
76
  };
@@ -1,26 +1,28 @@
1
1
  import { c as o } from "../../../../index-D29mdTf5.js";
2
- const a = o([
2
+ const t = o([
3
3
  "absolute",
4
4
  "bg-white",
5
5
  "border",
6
- "duration-100",
7
- "ease-in-out",
8
6
  "flex-col",
9
7
  "mt-1",
10
8
  "overflow-hidden",
11
9
  "rounded-md",
12
10
  "shadow-2xs",
13
11
  "top-full",
14
- "transition-all",
15
12
  "w-full",
16
13
  "z-10",
17
14
  "max-h-[185px]",
18
15
  "overflow-y-auto",
19
16
  "border-gray-200",
20
17
  "text-zinc-700",
21
- "data-[state=open]:block",
22
- "data-[state=closed]:hidden"
18
+ "animate-in",
19
+ "fade-in-50",
20
+ "zoom-in-95",
21
+ "duration-[200ms]",
22
+ "dark:bg-slate-800",
23
+ "dark:border-slate-700",
24
+ "dark:text-slate-50"
23
25
  ]);
24
26
  export {
25
- a as listVariants
27
+ t as listVariants
26
28
  };
@@ -1,43 +1,66 @@
1
- import { jsxs as p, jsx as r } from "react/jsx-runtime";
2
- import { useRef as u, useCallback as s } from "react";
3
- import { Typography as d } from "../../../Typography/Typography.js";
4
- import { cn as h } from "../../../../utils/index.js";
5
- import { listItemVariants as x } from "./ListItem.variants.js";
6
- import { useDropdownContext as y } from "../../contexts/dropdown.hook.js";
7
- const j = ({
8
- isClickable: a,
9
- className: i,
1
+ import { jsx as o, jsxs as x } from "react/jsx-runtime";
2
+ import { useRef as u, useCallback as l } from "react";
3
+ import { Typography as b } from "../../../Typography/Typography.js";
4
+ import { cn as w } from "../../../../utils/index.js";
5
+ import { listItemVariants as y } from "./ListItem.variants.js";
6
+ import { useDropdownContext as k } from "../../contexts/dropdown.hook.js";
7
+ const D = ({
8
+ isClickable: f,
9
+ className: p,
10
10
  ...t
11
11
  }) => {
12
- const { setValue: l, toggleOpen: n } = y(), c = u(null), o = s(
12
+ const { searchTerm: r, highlightSearchEnabled: i, setValue: c, toggleOpen: m } = k(), d = u(null), a = l(
13
13
  (e) => {
14
- l(e.value), n(!1);
14
+ c(e.value), m(!1);
15
15
  },
16
- [l, n]
17
- ), m = s(
18
- (e, f) => {
19
- e.key === "Enter" && (e.stopPropagation(), o(f));
16
+ [c, m]
17
+ ), h = l(
18
+ (e, s) => {
19
+ e.key === "Enter" && (e.stopPropagation(), a(s));
20
20
  },
21
- [o]
21
+ [a]
22
+ ), g = l(
23
+ (e) => {
24
+ if (typeof e != "string")
25
+ return e;
26
+ const s = i && r.length > 0 ? e.split(new RegExp(`(${r})`, "gi")).map((n) => n.toLowerCase() === r.toLowerCase() ? /* @__PURE__ */ o(
27
+ "mark",
28
+ {
29
+ className: "bg-transparent font-semibold text-slate-800 dark:text-slate-50",
30
+ children: n
31
+ },
32
+ n
33
+ ) : n) : [e];
34
+ return /* @__PURE__ */ o(
35
+ b,
36
+ {
37
+ variant: "body2",
38
+ className: "text-zinc-700 dark:text-slate-50",
39
+ children: s
40
+ }
41
+ );
42
+ },
43
+ [i, r]
22
44
  );
23
- return /* @__PURE__ */ p(
45
+ return /* @__PURE__ */ x(
24
46
  "li",
25
47
  {
26
- ref: c,
48
+ ref: d,
27
49
  role: "option",
28
- className: h(x({ className: i })),
50
+ "data-action": "false",
51
+ className: w(y({ className: p })),
29
52
  tabIndex: 0,
30
53
  onClick: (e) => {
31
- a && (o(t), e.stopPropagation());
54
+ f && (a(t), e.stopPropagation());
32
55
  },
33
- onKeyDown: (e) => m(e, t),
56
+ onKeyDown: (e) => h(e, t),
34
57
  children: [
35
- t.leftIcon ? /* @__PURE__ */ r("span", { className: "w-4 h-4 flex justify-center items-center", children: t.leftIcon }) : null,
36
- /* @__PURE__ */ r(d, { variant: "body2", className: "text-zinc-700", children: t.label })
58
+ t.leftIcon ? /* @__PURE__ */ o("span", { className: "w-4 h-4 flex justify-center items-center", children: t.leftIcon }) : null,
59
+ g(t.label)
37
60
  ]
38
61
  }
39
62
  );
40
63
  };
41
64
  export {
42
- j as ListItem
65
+ D as ListItem
43
66
  };
@@ -1,5 +1,5 @@
1
- import { c as o } from "../../../../index-D29mdTf5.js";
2
- const i = o([
1
+ import { c as r } from "../../../../index-D29mdTf5.js";
2
+ const t = r([
3
3
  "cursor-pointer",
4
4
  "py-2",
5
5
  "px-2",
@@ -10,11 +10,13 @@ const i = o([
10
10
  "flex",
11
11
  "items-center",
12
12
  "gap-3",
13
- "hover:bg-slate-50",
14
- "focus:bg-slate-50",
15
- "civo:focus:bg-civo-primary/5",
16
- "civo:hover:bg-civo-primary/5"
13
+ "transition-bg",
14
+ "duration-250",
15
+ "hover:bg-gray-50",
16
+ "focus:bg-gray-50",
17
+ "dark:hover:bg-slate-700",
18
+ "dark:focus:bg-slate-700"
17
19
  ]);
18
20
  export {
19
- i as listItemVariants
21
+ t as listItemVariants
20
22
  };