@konstructio/ui 0.1.2-alpha.33 → 0.1.2-alpha.34

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,12 +1,12 @@
1
- import { jsxs as g, jsx as l } from "react/jsx-runtime";
2
- import { useRef as y, useCallback as m } from "react";
3
- import { Typography as w } from "../../../Typography/Typography.js";
4
- import { cn as f } from "../../../../utils/index.js";
5
- import { listItemVariants as C } from "./ListItem.variants.js";
1
+ import { jsxs as f, jsx as l } from "react/jsx-runtime";
2
+ import { useRef as N, useCallback as u } from "react";
3
+ import { cn as r } from "../../../../utils/index.js";
4
+ import { Typography as C } from "../../../Typography/Typography.js";
5
+ import { listItemVariants as I } from "./ListItem.variants.js";
6
6
  import { useDropdownContext as L } from "../../contexts/dropdown.hook.js";
7
- function I(r, n) {
8
- const o = n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), c = new RegExp(`(${o})`, "gi");
9
- return r.split(c).map((t, a) => t.toLowerCase() === n.toLowerCase() ? /* @__PURE__ */ l(
7
+ function V(o, s) {
8
+ const c = s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), i = new RegExp(`(${c})`, "gi");
9
+ return o.split(i).map((t, a) => t.toLowerCase() === s.toLowerCase() ? /* @__PURE__ */ l(
10
10
  "mark",
11
11
  {
12
12
  className: "bg-transparent font-semibold text-slate-800 dark:text-slate-50",
@@ -15,43 +15,53 @@ function I(r, n) {
15
15
  a
16
16
  ) : /* @__PURE__ */ l("span", { children: t }, a));
17
17
  }
18
- const $ = ({
19
- isClickable: r,
20
- className: n,
21
- inputRef: o,
22
- listItemSecondRowClassName: c,
18
+ const P = ({
19
+ isClickable: o,
20
+ className: s,
21
+ inputRef: c,
22
+ listItemSecondRowClassName: i,
23
23
  ...t
24
24
  }) => {
25
- const { searchTerm: a, highlightSearchEnabled: d, setValue: h, toggleOpen: u } = L(), p = y(null), i = m(
25
+ const { searchTerm: a, highlightSearchEnabled: d, setValue: h, toggleOpen: p } = L(), k = N(null), m = u(
26
26
  (e) => {
27
- h(e.value, o), u(!1);
27
+ h(e.value, c), p(!1);
28
28
  },
29
- [h, u]
30
- ), x = m(
31
- (e, s) => {
32
- e.key === "Enter" && (e.stopPropagation(), i(s));
29
+ [h, p]
30
+ ), y = u(
31
+ (e, n) => {
32
+ e.key === "Enter" && (e.stopPropagation(), m(n));
33
33
  },
34
- [i]
35
- ), b = m(
36
- (e, s) => {
34
+ [m]
35
+ ), b = u(
36
+ ({ label: e, rightComponent: n, subLabel: g, rightComponentClassName: w }) => {
37
37
  if (typeof e != "string")
38
38
  return e;
39
- const k = d && a.length > 0 ? I(e, a) : [e];
40
- return /* @__PURE__ */ g(
41
- w,
39
+ const x = d && a.length > 0 ? V(e, a) : [e];
40
+ return /* @__PURE__ */ f(
41
+ C,
42
42
  {
43
43
  variant: "body2",
44
44
  className: "text-zinc-700 dark:text-slate-50 font-medium",
45
45
  children: [
46
- k,
47
- s ? /* @__PURE__ */ l(
46
+ n ? /* @__PURE__ */ f(
48
47
  "span",
49
48
  {
50
- className: f(
49
+ className: r("flex gap-2 items-center", w),
50
+ children: [
51
+ x,
52
+ " ",
53
+ n
54
+ ]
55
+ }
56
+ ) : x,
57
+ g ? /* @__PURE__ */ l(
58
+ "span",
59
+ {
60
+ className: r(
51
61
  "block font-normal text-sm text-slate-800 dark:text-slate-50",
52
- c
62
+ i
53
63
  ),
54
- children: s
64
+ children: g
55
65
  }
56
66
  ) : null
57
67
  ]
@@ -60,34 +70,38 @@ const $ = ({
60
70
  },
61
71
  [d, a]
62
72
  );
63
- return /* @__PURE__ */ g(
73
+ return /* @__PURE__ */ f(
64
74
  "li",
65
75
  {
66
- ref: p,
76
+ ref: k,
67
77
  role: "option",
68
78
  "data-action": "false",
69
- className: f(C({ className: n })),
79
+ className: r(I({ className: s })),
70
80
  tabIndex: 0,
71
81
  onClick: (e) => {
72
- r && (i(t), e.stopPropagation());
82
+ o && (m(t), e.stopPropagation());
73
83
  },
74
- onKeyDown: (e) => x(e, t),
84
+ onKeyDown: (e) => y(e, t),
75
85
  children: [
76
86
  t.leftIcon ? /* @__PURE__ */ l(
77
87
  "span",
78
88
  {
79
- className: f("w-4 h-4 flex justify-center", {
80
- "items-center": !t.subLabel,
81
- "items-baseline -translate-y-2": !!t.subLabel
82
- }),
89
+ className: r(
90
+ "w-4 h-4 flex justify-center",
91
+ {
92
+ "items-center": !t.subLabel,
93
+ "items-baseline -translate-y-2": !!t.subLabel
94
+ },
95
+ t.leftIconClassName
96
+ ),
83
97
  children: t.leftIcon
84
98
  }
85
99
  ) : null,
86
- b(t.label, t.subLabel)
100
+ b(t)
87
101
  ]
88
102
  }
89
103
  );
90
104
  };
91
105
  export {
92
- $ as ListItem
106
+ P as ListItem
93
107
  };
package/dist/index.d.ts CHANGED
@@ -475,6 +475,9 @@ declare type Option_3 = {
475
475
  label: string;
476
476
  subLabel?: string | ReactNode;
477
477
  leftIcon?: ReactNode | string;
478
+ leftIconClassName?: string;
479
+ rightComponent?: ReactNode | string;
480
+ rightComponentClassName?: string;
478
481
  value: string;
479
482
  };
480
483
 
package/dist/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@konstructio/ui",
3
3
  "description": "A set of reusable and customizable React components built for konstruct.io",
4
4
  "private": false,
5
- "version": "0.1.2-alpha.32",
5
+ "version": "0.1.2-alpha.33",
6
6
  "type": "module",
7
7
  "license": "MIT",
8
8
  "main": "dist/index.js",
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@konstructio/ui",
3
3
  "description": "A set of reusable and customizable React components built for konstruct.io",
4
4
  "private": false,
5
- "version": "0.1.2-alpha.33",
5
+ "version": "0.1.2-alpha.34",
6
6
  "type": "module",
7
7
  "license": "MIT",
8
8
  "main": "dist/index.js",