@oneplatformdev/ui 0.0.1-beta.18 → 0.0.1-beta.19

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,120 +1,122 @@
1
- import { jsx as a, jsxs as t } from "react/jsx-runtime";
2
- import n, { useRef as U, useEffect as w, useCallback as _ } from "react";
1
+ import { jsx as a, jsxs as r } from "react/jsx-runtime";
2
+ import n, { useRef as _, useCallback as w, useEffect as x } from "react";
3
3
  import { LoadingMask as B } from "../LoadingMask/LoadingMask.mjs";
4
- import { Popover as F, PopoverTrigger as G, PopoverContent as V } from "../Popover/Popover.mjs";
5
- import { Button as W } from "../Button/Button.mjs";
4
+ import { Popover as F, PopoverTrigger as V, PopoverContent as X } from "../Popover/Popover.mjs";
5
+ import { Button as q } from "../Button/Button.mjs";
6
6
  import "../Button/buttonVariants.mjs";
7
- import { Command as X, CommandInput as q, CommandList as z, CommandEmpty as A, CommandGroup as H, CommandItem as J } from "../Command/Command.mjs";
8
- import { cn as x } from "@oneplatformdev/utils";
9
- import { useDebounceCallback as K } from "@oneplatformdev/hooks";
10
- import { X as Q, ChevronsUpDown as Y, Check as Z } from "lucide-react";
11
- const ie = (N) => {
7
+ import { Command as z, CommandInput as A, CommandList as H, CommandEmpty as J, CommandGroup as K, CommandItem as Q } from "../Command/Command.mjs";
8
+ import { cn as N } from "@oneplatformdev/utils";
9
+ import { useDebounceCallback as W } from "@oneplatformdev/hooks";
10
+ import { X as Y, ChevronsUpDown as Z, Check as $ } from "lucide-react";
11
+ const de = (S) => {
12
12
  var y;
13
13
  const {
14
14
  value: o,
15
- onChange: S,
16
- placeholder: k,
15
+ onChange: k,
16
+ placeholder: D,
17
17
  disabled: L,
18
18
  searchLabel: O,
19
19
  fetchOptions: P,
20
- options: r,
20
+ options: t,
21
21
  emptyLabel: j = "No options",
22
- onMount: s
23
- } = N, c = U(!1), [l, p] = n.useState(!1), [D, h] = n.useState(""), [f, i] = n.useState([]), [d, b] = n.useState(), [v, C] = n.useState(!1);
24
- w(() => {
25
- r != null && r.length && i(r);
26
- }, [r]);
27
- const M = async () => {
22
+ onMount: u
23
+ } = S, s = _(!1), [l, p] = n.useState(!1), [G, h] = n.useState(""), [f, c] = n.useState([]), [i, b] = n.useState(), [v, C] = n.useState(!1), M = w(async () => {
24
+ await g();
25
+ }, []), T = W(M, 1e3, { leading: !1, trailing: !0 });
26
+ x(() => {
27
+ t != null && t.length && c(t);
28
+ }, [t]);
29
+ const E = async () => {
28
30
  l || (g(), h(""));
29
31
  }, g = async (e) => {
30
32
  C(!0);
31
33
  try {
32
- const u = await P(e);
33
- i(u);
34
- } catch (u) {
35
- console.error("Unexpected error while get option:", u);
34
+ const m = await P(e);
35
+ c(m);
36
+ } catch (m) {
37
+ console.error("Unexpected error while get option:", m);
36
38
  } finally {
37
39
  C(!1);
38
40
  }
39
- }, T = K(g, 1e3), E = (e) => {
41
+ }, I = (e) => {
40
42
  h(e), T(e);
41
- }, m = (e) => {
42
- S(e.value), b(e);
43
- }, I = () => {
44
- m({ value: "", label: "" }), b(void 0);
45
- }, R = _(() => {
46
- if (!s) {
47
- c.current = !0;
43
+ }, d = (e) => {
44
+ k(e.value), b(e);
45
+ }, R = () => {
46
+ d({ value: "", label: "" }), b(void 0);
47
+ }, U = w(() => {
48
+ if (!u) {
49
+ s.current = !0;
48
50
  return;
49
51
  }
50
- s({ setOptions: i }).finally(() => {
51
- c.current = !0;
52
+ u({ setOptions: c }).finally(() => {
53
+ s.current = !0;
52
54
  });
53
- }, [s]);
54
- return w(() => (R(), () => {
55
- c.current = !1;
56
- }), []), /* @__PURE__ */ a("div", { className: "w-full", children: /* @__PURE__ */ t(
55
+ }, []);
56
+ return x(() => (U(), () => {
57
+ s.current = !1;
58
+ }), []), /* @__PURE__ */ a("div", { className: "w-full", children: /* @__PURE__ */ r(
57
59
  F,
58
60
  {
59
61
  open: l,
60
62
  onOpenChange: (e) => {
61
- p(e), e && M();
63
+ p(e), e && E();
62
64
  },
63
65
  children: [
64
- /* @__PURE__ */ a(G, { asChild: !0, className: "border-border", children: /* @__PURE__ */ t(
65
- W,
66
+ /* @__PURE__ */ a(V, { asChild: !0, className: "border-border", children: /* @__PURE__ */ r(
67
+ q,
66
68
  {
67
69
  variant: "outline",
68
70
  role: "combobox",
69
71
  "aria-expanded": l,
70
- className: x(
72
+ className: N(
71
73
  "w-full justify-between font-normal text-sm border bg-input",
72
74
  l ? "border-2 border-sidebar-accent" : "border-border"
73
75
  ),
74
76
  disabled: L,
75
77
  children: [
76
- /* @__PURE__ */ a("span", { className: "truncate max-w-[calc(100%-1.5rem)] overflow-hidden whitespace-nowrap", children: o ? ((y = f.find((e) => e.value === o)) == null ? void 0 : y.label) || (d == null ? void 0 : d.label) : /* @__PURE__ */ a("span", { className: "text-gray-400", children: k }) }),
78
+ /* @__PURE__ */ a("span", { className: "truncate max-w-[calc(100%-1.5rem)] overflow-hidden whitespace-nowrap", children: o ? ((y = f.find((e) => e.value === o)) == null ? void 0 : y.label) || (i == null ? void 0 : i.label) : /* @__PURE__ */ a("span", { className: "text-gray-400", children: D }) }),
77
79
  o ? /* @__PURE__ */ a(
78
- Q,
80
+ Y,
79
81
  {
80
82
  className: "opacity-50 w-4 h-4 cursor-pointer hover:opacity-100",
81
83
  onClick: (e) => {
82
- e.stopPropagation(), I();
84
+ e.stopPropagation(), R();
83
85
  }
84
86
  }
85
- ) : /* @__PURE__ */ a(Y, { className: "opacity-50 w-4 h-4" })
87
+ ) : /* @__PURE__ */ a(Z, { className: "opacity-50 w-4 h-4" })
86
88
  ]
87
89
  }
88
90
  ) }),
89
91
  /* @__PURE__ */ a(
90
- V,
92
+ X,
91
93
  {
92
94
  className: "w-[var(--radix-popper-anchor-width)] max-w-none p-0",
93
95
  align: "start",
94
- children: /* @__PURE__ */ t(X, { shouldFilter: !1, children: [
96
+ children: /* @__PURE__ */ r(z, { shouldFilter: !1, children: [
95
97
  /* @__PURE__ */ a(
96
- q,
98
+ A,
97
99
  {
98
100
  placeholder: O,
99
- value: D,
100
- onValueChange: E
101
+ value: G,
102
+ onValueChange: I
101
103
  }
102
104
  ),
103
- /* @__PURE__ */ t(z, { children: [
104
- !v && /* @__PURE__ */ a(A, { children: j }),
105
- /* @__PURE__ */ a(H, { children: v ? /* @__PURE__ */ a("div", { className: "flex justify-center", children: /* @__PURE__ */ a(B, {}) }) : f.map((e) => /* @__PURE__ */ t(
106
- J,
105
+ /* @__PURE__ */ r(H, { children: [
106
+ !v && /* @__PURE__ */ a(J, { children: j }),
107
+ /* @__PURE__ */ a(K, { children: v ? /* @__PURE__ */ a("div", { className: "flex justify-center", children: /* @__PURE__ */ a(B, {}) }) : f.map((e) => /* @__PURE__ */ r(
108
+ Q,
107
109
  {
108
110
  value: e.value,
109
111
  onSelect: () => {
110
- o === e.value ? m({ value: "", label: "" }) : m(e), p(!1);
112
+ o === e.value ? d({ value: "", label: "" }) : d(e), p(!1);
111
113
  },
112
114
  children: [
113
115
  e.label,
114
116
  /* @__PURE__ */ a(
115
- Z,
117
+ $,
116
118
  {
117
- className: x(
119
+ className: N(
118
120
  "ml-auto",
119
121
  o === e.value ? "opacity-100" : "opacity-0"
120
122
  )
@@ -133,5 +135,5 @@ const ie = (N) => {
133
135
  ) });
134
136
  };
135
137
  export {
136
- ie as Combobox
138
+ de as Combobox
137
139
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oneplatformdev/ui",
3
- "version": "0.0.1-beta.18",
3
+ "version": "0.0.1-beta.19",
4
4
  "description": "UI React Components.",
5
5
  "author": "One Platform Development Team",
6
6
  "keywords": [