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