@oneplatformdev/ui 0.0.1-beta.102 → 0.0.1-beta.104

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.
@@ -9,7 +9,7 @@ import "../Command/Command.mjs";
9
9
  import "@oneplatformdev/utils";
10
10
  import "@oneplatformdev/hooks";
11
11
  import "lucide-react";
12
- import { C as c } from "../Combobox-Dfbnw0oF.js";
12
+ import { C as c } from "../Combobox-B9bMpp7r.js";
13
13
  export {
14
14
  c as Combobox
15
15
  };
@@ -33,6 +33,8 @@ export interface ComboboxProps {
33
33
  emptyLabel?: string;
34
34
  /** Command Empty list action */
35
35
  emptyAction?: ((params: ComboboxPropsOnMountParams) => ReactNode) | ReactNode;
36
+ /** Command Input footer action */
37
+ commandInputAction?: ((params: ComboboxPropsOnMountParams) => ReactNode) | ReactNode;
36
38
  /** Callback for load data on start component */
37
39
  onMount?: (params: ComboboxPropsOnMountParams) => Promise<void>;
38
40
  }
@@ -20,7 +20,7 @@ import "../Card/Card.mjs";
20
20
  import "../Carousel/Carousel.mjs";
21
21
  import "../Checkbox/Checkbox.mjs";
22
22
  import "@radix-ui/react-collapsible";
23
- import { a as no } from "../Combobox-Dfbnw0oF.js";
23
+ import { a as no } from "../Combobox-B9bMpp7r.js";
24
24
  import "../Command/Command.mjs";
25
25
  import "../DropdownMenu/DropdownMenu.mjs";
26
26
  import "../Table/Table.mjs";
@@ -3,7 +3,7 @@ import "../Button/Button.mjs";
3
3
  import "../Button/buttonVariants.mjs";
4
4
  import "react";
5
5
  import "../Collapsible/Collapsible.mjs";
6
- import { c as a, b as e } from "../Combobox-Dfbnw0oF.js";
6
+ import { c as a, b as e } from "../Combobox-B9bMpp7r.js";
7
7
  import "lucide-react";
8
8
  import "@oneplatformdev/utils";
9
9
  export {
@@ -1,4 +1,4 @@
1
- import { C as m } from "../Combobox-Dfbnw0oF.js";
1
+ import { C as m } from "../Combobox-B9bMpp7r.js";
2
2
  export {
3
3
  m as Combobox
4
4
  };
@@ -1,15 +1,15 @@
1
- import { jsxs as s, jsx as e, Fragment as A } from "react/jsx-runtime";
2
- import f, { forwardRef as y, useState as V, useRef as W, useEffect as X, useCallback as g, useLayoutEffect as H } from "react";
3
- import { LoadingMask as J } from "./LoadingMask/LoadingMask.mjs";
1
+ import { jsxs as l, jsx as e, Fragment as W } from "react/jsx-runtime";
2
+ import f, { forwardRef as y, useState as X, useRef as H, useEffect as J, useCallback as b, useMemo as K, useLayoutEffect as Q } from "react";
3
+ import { LoadingMask as Y } from "./LoadingMask/LoadingMask.mjs";
4
4
  import "./LoadingMask/RenderLoadingMask.mjs";
5
- import { Popover as K, PopoverTrigger as Q, PopoverContent as Y } from "./Popover/Popover.mjs";
6
- import { Button as _ } from "./Button/Button.mjs";
5
+ import { Popover as Z, PopoverTrigger as $, PopoverContent as ee } from "./Popover/Popover.mjs";
6
+ import { Button as R } from "./Button/Button.mjs";
7
7
  import "./Button/buttonVariants.mjs";
8
- import { CommandItem as Z, Command as $, CommandInput as ee, CommandList as te, CommandGroup as oe, CommandEmpty as F } from "./Command/Command.mjs";
8
+ import { CommandItem as te, Command as oe, CommandInput as re, CommandList as ae, CommandGroup as ne, CommandEmpty as F } from "./Command/Command.mjs";
9
9
  import { cn as p } from "@oneplatformdev/utils";
10
- import { useDebounceCallback as re } from "@oneplatformdev/hooks";
11
- import { Check as ae, ChevronDownIcon as ie, X as ne, ChevronsUpDown as le } from "lucide-react";
12
- import { Collapsible as se, CollapsibleTrigger as pe, CollapsibleContent as me } from "./Collapsible/Collapsible.mjs";
10
+ import { useDebounceCallback as ie } from "@oneplatformdev/hooks";
11
+ import { Check as se, ChevronDownIcon as le, X as pe, ChevronsUpDown as me } from "lucide-react";
12
+ import { Collapsible as ce, CollapsibleTrigger as de, CollapsibleContent as ue } from "./Collapsible/Collapsible.mjs";
13
13
  import "./Accordion/Accordion.mjs";
14
14
  import "./Alert/Alert.mjs";
15
15
  import "./AlertDialog/AlertDialogRoot.mjs";
@@ -63,18 +63,18 @@ import "./Toggle/Toggle.mjs";
63
63
  import "./ToggleGroup/ToggleGroup.mjs";
64
64
  import "./Tooltip/TooltipRoot.mjs";
65
65
  import "./Dropzone/Dropzone.mjs";
66
- const ce = 8, I = y((n, l) => {
67
- const { children: t, setOpen: m, option: o, onChangeOption: i, value: c = "", deep: a = 0 } = n;
68
- return /* @__PURE__ */ s(
69
- Z,
66
+ const he = 8, _ = y((i, s) => {
67
+ const { children: t, setOpen: m, option: o, onChangeOption: n, value: c = "", deep: a = 0 } = i;
68
+ return /* @__PURE__ */ l(
69
+ te,
70
70
  {
71
- ref: l,
71
+ ref: s,
72
72
  value: o.value,
73
73
  onSelect: () => {
74
- c === o.value ? i == null || i({ value: "", label: "" }) : i == null || i(o), m(!1);
74
+ c === o.value ? n == null || n({ value: "", label: "" }) : n == null || n(o), m(!1);
75
75
  },
76
76
  style: {
77
- paddingLeft: (a + 1) * ce
77
+ paddingLeft: (a + 1) * he
78
78
  },
79
79
  children: [
80
80
  t,
@@ -88,7 +88,7 @@ const ce = 8, I = y((n, l) => {
88
88
  }
89
89
  ),
90
90
  /* @__PURE__ */ e(
91
- ae,
91
+ se,
92
92
  {
93
93
  className: p(
94
94
  "ml-auto",
@@ -100,23 +100,23 @@ const ce = 8, I = y((n, l) => {
100
100
  },
101
101
  o.value
102
102
  );
103
- }), M = y((n, l) => {
103
+ }), q = y((i, s) => {
104
104
  var c;
105
- const { option: t, deep: m = 0 } = n, [o, i] = V(!0);
106
- return (c = t == null ? void 0 : t.items) != null && c.length ? /* @__PURE__ */ s(
107
- se,
105
+ const { option: t, deep: m = 0 } = i, [o, n] = X(!0);
106
+ return (c = t == null ? void 0 : t.items) != null && c.length ? /* @__PURE__ */ l(
107
+ ce,
108
108
  {
109
- ref: l,
109
+ ref: s,
110
110
  open: o,
111
- onOpenChange: i,
111
+ onOpenChange: n,
112
112
  "data-opened": o,
113
113
  className: p("group/collapsible"),
114
114
  children: [
115
- /* @__PURE__ */ e(I, { ...n, children: /* @__PURE__ */ e(pe, { asChild: !0, children: /* @__PURE__ */ s(
116
- _,
115
+ /* @__PURE__ */ e(_, { ...i, children: /* @__PURE__ */ e(de, { asChild: !0, children: /* @__PURE__ */ l(
116
+ R,
117
117
  {
118
118
  onClick: (a) => {
119
- a == null || a.preventDefault(), a == null || a.stopPropagation(), i((d) => !d);
119
+ a == null || a.preventDefault(), a == null || a.stopPropagation(), n((d) => !d);
120
120
  },
121
121
  type: "button",
122
122
  variant: "ghost",
@@ -124,7 +124,7 @@ const ce = 8, I = y((n, l) => {
124
124
  className: p("aspect-square size-6", "transition-transform"),
125
125
  children: [
126
126
  /* @__PURE__ */ e(
127
- ie,
127
+ le,
128
128
  {
129
129
  className: p(
130
130
  "!size-5",
@@ -137,10 +137,10 @@ const ce = 8, I = y((n, l) => {
137
137
  ]
138
138
  }
139
139
  ) }) }),
140
- /* @__PURE__ */ e(me, { children: /* @__PURE__ */ e("div", { className: "flex flex-col gap-0", children: t == null ? void 0 : t.items.map((a) => /* @__PURE__ */ e(
141
- M,
140
+ /* @__PURE__ */ e(ue, { children: /* @__PURE__ */ e("div", { className: "flex flex-col gap-0", children: t == null ? void 0 : t.items.map((a) => /* @__PURE__ */ e(
141
+ q,
142
142
  {
143
- ...n,
143
+ ...i,
144
144
  deep: m + 1,
145
145
  option: a
146
146
  },
@@ -148,31 +148,32 @@ const ce = 8, I = y((n, l) => {
148
148
  )) }) })
149
149
  ]
150
150
  }
151
- ) : /* @__PURE__ */ e(I, { ...n, ref: l });
152
- }), de = y((n, l) => {
153
- const { options: t = [], ...m } = n;
154
- return /* @__PURE__ */ e("div", { ref: l, className: "flex flex-col gap-0", children: t.map((o) => /* @__PURE__ */ e(M, { ...m, option: o }, o.value)) });
155
- }), St = y(
156
- (n, l) => {
151
+ ) : /* @__PURE__ */ e(_, { ...i, ref: s });
152
+ }), fe = y((i, s) => {
153
+ const { options: t = [], ...m } = i;
154
+ return /* @__PURE__ */ e("div", { ref: s, className: "flex flex-col gap-0", children: t.map((o) => /* @__PURE__ */ e(q, { ...m, option: o }, o.value)) });
155
+ }), Dt = y(
156
+ (i, s) => {
157
157
  var j;
158
158
  const {
159
159
  value: t,
160
160
  onChange: m,
161
161
  placeholder: o,
162
- disabled: i,
162
+ disabled: n,
163
163
  searchLabel: c = "Type to search...",
164
164
  fetchOptions: a,
165
165
  options: d,
166
166
  emptyLabel: L = "No options",
167
- emptyAction: b,
168
- onMount: P
169
- } = n, w = W(!1), [u, v] = f.useState(!1), [C, T] = f.useState(""), [N, x] = f.useState([]), [S, k] = f.useState(), [O, h] = f.useState(!1);
170
- X(() => {
167
+ emptyAction: g,
168
+ commandInputAction: w,
169
+ onMount: T
170
+ } = i, N = H(!1), [u, v] = f.useState(!1), [C, k] = f.useState(""), [S, x] = f.useState([]), [O, E] = f.useState(), [P, h] = f.useState(!1);
171
+ J(() => {
171
172
  d != null && d.length && x(d);
172
173
  }, [d]);
173
- const R = async () => {
174
- u || (E(), T(""));
175
- }, E = g(async (r) => {
174
+ const A = async () => {
175
+ u || (z(), k(""));
176
+ }, z = b(async (r) => {
176
177
  h(!0);
177
178
  try {
178
179
  const D = await a(r);
@@ -182,38 +183,43 @@ const ce = 8, I = y((n, l) => {
182
183
  } finally {
183
184
  h(!1);
184
185
  }
185
- }, []), q = re(E, 1e3, {
186
+ }, []), B = ie(z, 1e3, {
186
187
  leading: !1,
187
188
  trailing: !0
188
- }), B = g((r) => {
189
- h(!0), T(r), q(r);
190
- }, []), z = g((r) => {
191
- m(r.value), k(r), h(!1);
192
- }, []), G = g(() => {
193
- z({ value: "", label: "" }), k(void 0), h(!1);
194
- }, []), U = g(() => {
195
- if (!P) {
196
- w.current = !0;
189
+ }), G = b((r) => {
190
+ h(!0), k(r), B(r);
191
+ }, []), I = b((r) => {
192
+ m(r.value), E(r), h(!1);
193
+ }, []), U = b(() => {
194
+ I({ value: "", label: "" }), E(void 0), h(!1);
195
+ }, []), M = K(() => ({
196
+ setOptions: x,
197
+ search: C || "",
198
+ open: u,
199
+ setOpen: v
200
+ }), []), V = b(() => {
201
+ if (!T) {
202
+ N.current = !0;
197
203
  return;
198
204
  }
199
- P({ setOptions: x, search: C || "", open: u, setOpen: v }).finally(
205
+ T({ setOptions: x, search: C || "", open: u, setOpen: v }).finally(
200
206
  () => {
201
- w.current = !0;
207
+ N.current = !0;
202
208
  }
203
209
  );
204
210
  }, []);
205
- return H(() => (U(), () => {
206
- w.current = !1;
207
- }), []), /* @__PURE__ */ e("div", { className: "w-full", ref: l, children: /* @__PURE__ */ s(
208
- K,
211
+ return Q(() => (V(), () => {
212
+ N.current = !1;
213
+ }), []), /* @__PURE__ */ e("div", { className: "w-full", ref: s, children: /* @__PURE__ */ l(
214
+ Z,
209
215
  {
210
216
  open: u,
211
217
  onOpenChange: (r) => {
212
- v(r), r && R();
218
+ v(r), r && A();
213
219
  },
214
220
  children: [
215
- /* @__PURE__ */ e(Q, { asChild: !0, className: "border-input", children: /* @__PURE__ */ s(
216
- _,
221
+ /* @__PURE__ */ e($, { asChild: !0, className: "border-input", children: /* @__PURE__ */ l(
222
+ R,
217
223
  {
218
224
  variant: "outline",
219
225
  role: "combobox",
@@ -225,9 +231,9 @@ const ce = 8, I = y((n, l) => {
225
231
  u && "border-2 outline-none ring-1 ring-ring",
226
232
  "focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
227
233
  ),
228
- disabled: i,
234
+ disabled: n,
229
235
  children: [
230
- /* @__PURE__ */ e("span", { className: "truncate max-w-[calc(100%-1.5rem)] overflow-hidden whitespace-nowrap", children: t ? ((j = N.find((r) => r.value === t)) == null ? void 0 : j.label) || (S == null ? void 0 : S.label) : /* @__PURE__ */ e("span", { className: "text-gray-400", children: o }) }),
236
+ /* @__PURE__ */ e("span", { className: "truncate max-w-[calc(100%-1.5rem)] overflow-hidden whitespace-nowrap", children: t ? ((j = S.find((r) => r.value === t)) == null ? void 0 : j.label) || (O == null ? void 0 : O.label) : /* @__PURE__ */ e("span", { className: "text-gray-400", children: o }) }),
231
237
  t ? /* @__PURE__ */ e(
232
238
  "div",
233
239
  {
@@ -238,49 +244,45 @@ const ce = 8, I = y((n, l) => {
238
244
  "opacity-50 cursor-pointer hover:opacity-100"
239
245
  ),
240
246
  onClick: (r) => {
241
- r.stopPropagation(), G();
247
+ r.stopPropagation(), U();
242
248
  },
243
- children: /* @__PURE__ */ e(ne, {})
249
+ children: /* @__PURE__ */ e(pe, {})
244
250
  }
245
- ) : /* @__PURE__ */ e(le, { className: "opacity-50 w-4 h-4" })
251
+ ) : /* @__PURE__ */ e(me, { className: "opacity-50 w-4 h-4" })
246
252
  ]
247
253
  }
248
254
  ) }),
249
255
  /* @__PURE__ */ e(
250
- Y,
256
+ ee,
251
257
  {
252
258
  className: "w-[var(--radix-popper-anchor-width)] max-w-none p-0",
253
259
  align: "start",
254
- children: /* @__PURE__ */ s($, { shouldFilter: !1, children: [
260
+ children: /* @__PURE__ */ l(oe, { shouldFilter: !1, children: [
255
261
  /* @__PURE__ */ e(
256
- ee,
262
+ re,
257
263
  {
258
264
  placeholder: c,
259
265
  value: C,
260
- onValueChange: B
266
+ onValueChange: G
261
267
  }
262
268
  ),
263
- /* @__PURE__ */ e(te, { children: /* @__PURE__ */ s(
264
- oe,
269
+ typeof w == "function" ? w(M) : w,
270
+ /* @__PURE__ */ e(ae, { children: /* @__PURE__ */ l(
271
+ ne,
265
272
  {
266
- className: p(!N.length && "p-0 shadow-none"),
273
+ className: p(!S.length && "p-0 shadow-none"),
267
274
  children: [
268
- O && /* @__PURE__ */ e(J, { fullWidth: !0 }),
269
- !O && !!C && /* @__PURE__ */ e(A, { children: b ? /* @__PURE__ */ s(F, { className: "flex flex-col gap-3 py-5 px-3 items-center", children: [
275
+ P && /* @__PURE__ */ e(Y, { fullWidth: !0 }),
276
+ !P && !!C && /* @__PURE__ */ e(W, { children: g ? /* @__PURE__ */ l(F, { className: "flex flex-col gap-3 py-5 px-3 items-center", children: [
270
277
  /* @__PURE__ */ e("span", { children: L }),
271
- typeof b == "function" ? b({
272
- setOptions: x,
273
- search: C || "",
274
- open: u,
275
- setOpen: v
276
- }) : b
278
+ typeof g == "function" ? g(M) : g
277
279
  ] }) : /* @__PURE__ */ e(F, { children: L }) }),
278
- !O && /* @__PURE__ */ e(
279
- de,
280
+ !P && /* @__PURE__ */ e(
281
+ fe,
280
282
  {
281
283
  value: t,
282
- options: N,
283
- onChangeOption: z,
284
+ options: S,
285
+ onChangeOption: I,
284
286
  setOpen: v
285
287
  }
286
288
  )
@@ -296,8 +298,8 @@ const ce = 8, I = y((n, l) => {
296
298
  }
297
299
  );
298
300
  export {
299
- St as C,
300
- I as a,
301
- M as b,
302
- de as c
301
+ Dt as C,
302
+ _ as a,
303
+ q as b,
304
+ fe as c
303
305
  };
@@ -1,7 +1,7 @@
1
1
  import { jsx as o } from "react/jsx-runtime";
2
2
  import { FormControl as a } from "../Form/Form.mjs";
3
3
  import { FormRenderControl as b } from "../Form/FormRenderControl.mjs";
4
- import { C as p } from "../Combobox-Dfbnw0oF.js";
4
+ import { C as p } from "../Combobox-B9bMpp7r.js";
5
5
  const x = (m) => {
6
6
  const { form: n, label: e, name: t, ...C } = m;
7
7
  return /* @__PURE__ */ o(
@@ -4,13 +4,13 @@ import { FormRenderControl as I } from "../Form/FormRenderControl.mjs";
4
4
  import { Input as y } from "../Input/Input.mjs";
5
5
  import { forwardRef as C } from "react";
6
6
  function b(l, e) {
7
- const { form: m, label: h, name: p, onChange: u, onBlur: a, onPaste: s, style: v, ...g } = l;
7
+ const { form: m, label: v, name: p, onChange: u, onBlur: a, onPaste: s, style: h, ...g } = l;
8
8
  return /* @__PURE__ */ c(
9
9
  I,
10
10
  {
11
11
  form: m,
12
12
  name: p,
13
- label: h,
13
+ label: v,
14
14
  render: ({ field: o }) => /* @__PURE__ */ c(F, { children: /* @__PURE__ */ c(
15
15
  y,
16
16
  {
@@ -19,14 +19,14 @@ function b(l, e) {
19
19
  ref: (t) => {
20
20
  o.ref(t), typeof e == "function" ? e(t) : e && (e.current = t);
21
21
  },
22
- style: v,
22
+ style: h,
23
23
  value: o.value || "",
24
24
  onChange: (...t) => {
25
25
  var r;
26
26
  (r = o.onChange) == null || r.call(o, ...t), u == null || u(...t);
27
27
  },
28
28
  onPaste: (t) => {
29
- const r = t.clipboardData.getData("text"), n = t.currentTarget, i = n.selectionStart ?? n.value.length, x = n.selectionEnd ?? n.value.length, D = n.value.slice(0, i) + r + n.value.slice(x);
29
+ const r = t.clipboardData.getData("text"), n = t.currentTarget, x = n.selectionStart ?? n.value.length, i = n.selectionEnd ?? n.value.length, D = n.value.slice(0, x) + r + n.value.slice(i);
30
30
  t.preventDefault(), m.setValue(p, D, {
31
31
  shouldDirty: !0,
32
32
  shouldTouch: !0
@@ -41,7 +41,7 @@ function b(l, e) {
41
41
  }
42
42
  );
43
43
  }
44
- const B = C(b);
44
+ const E = C(b);
45
45
  export {
46
- B as FormInput
46
+ E as FormInput
47
47
  };
package/index.mjs CHANGED
@@ -20,7 +20,7 @@ import { Carousel as go, CarouselContent as xo, CarouselItem as fo, CarouselNext
20
20
  import { ChartContainer as To, ChartLegend as Do, ChartLegendContent as co, ChartStyle as Mo, ChartTooltip as Po, ChartTooltipContent as Ao } from "./Chart/Chart.mjs";
21
21
  import { Checkbox as wo, CheckboxLabel as ho } from "./Checkbox/Checkbox.mjs";
22
22
  import { Collapsible as Fo, CollapsibleContent as Lo, CollapsibleTrigger as Ro } from "./Collapsible/Collapsible.mjs";
23
- import { C as Go } from "./Combobox-Dfbnw0oF.js";
23
+ import { C as Go } from "./Combobox-B9bMpp7r.js";
24
24
  import { Command as Ho, CommandDialog as No, CommandEmpty as Vo, CommandGroup as yo, CommandInput as Eo, CommandItem as Oo, CommandList as zo, CommandSeparator as _o, CommandShortcut as Uo } from "./Command/Command.mjs";
25
25
  import { DataTable as jo } from "./DataTable/DataTable.mjs";
26
26
  import { DatePicker as Jo } from "./DatePicker/DatePicker.mjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oneplatformdev/ui",
3
- "version": "0.0.1-beta.102",
3
+ "version": "0.0.1-beta.104",
4
4
  "description": "UI React Components.",
5
5
  "author": "One Platform Development Team",
6
6
  "keywords": [