@oneplatformdev/ui 0.0.1-beta.34 → 0.0.1-beta.35

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