@oneplatformdev/ui 0.0.1-beta.14 → 0.0.1-beta.141

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.
Files changed (141) hide show
  1. package/Accordion/Accordion.d.ts +5 -3
  2. package/Accordion/Accordion.mjs +27 -24
  3. package/AlertDialog/AlertDialogRoot.d.ts +2 -2
  4. package/AlertDialog/AlertDialogRoot.mjs +7 -7
  5. package/Button/Button.mjs +11 -10
  6. package/Button/buttonVariants.mjs +14 -8
  7. package/Calendar/Calendar.mjs +3 -2
  8. package/Card/Card.d.ts +1 -1
  9. package/Card/Card.mjs +24 -23
  10. package/Checkbox/Checkbox.d.ts +5 -4
  11. package/Checkbox/Checkbox.mjs +48 -21
  12. package/Checkbox/Checkbox.types.d.ts +10 -0
  13. package/Checkbox/index.d.ts +1 -0
  14. package/Checkbox/index.mjs +3 -2
  15. package/Combobox/Combobox.d.ts +2 -2
  16. package/Combobox/Combobox.mjs +12 -123
  17. package/Combobox/Combobox.types.d.ts +36 -1
  18. package/Combobox/ComboboxOptionItem.d.ts +5 -0
  19. package/Combobox/ComboboxOptionItem.mjs +69 -0
  20. package/Combobox/ComboboxOptions.d.ts +4 -0
  21. package/Combobox/ComboboxOptions.mjs +12 -0
  22. package/Combobox/index.mjs +1 -1
  23. package/Combobox-CkGEIfTD.js +325 -0
  24. package/Command/Command.d.ts +1 -1
  25. package/Command/Command.mjs +15 -7
  26. package/DataTable/DataTable.d.ts +10 -3
  27. package/DataTable/DataTable.mjs +33 -33
  28. package/DataTable/DataTableColumnFilter.d.ts +4 -0
  29. package/DataTable/DataTableColumnFilter.mjs +31 -0
  30. package/DatePicker/DatePicker.mjs +2 -2
  31. package/Dialog/Dialog.d.ts +7 -3
  32. package/Dialog/Dialog.mjs +95 -52
  33. package/Dialog/DialogOverlayScope.d.ts +9 -0
  34. package/Dialog/DialogOverlayScope.mjs +10 -0
  35. package/Dialog/index.d.ts +1 -0
  36. package/Dialog/index.mjs +12 -8
  37. package/DropdownMenu/DropdownMenu.d.ts +2 -2
  38. package/DropdownMenu/DropdownMenu.mjs +30 -26
  39. package/Dropzone/Dropzone.d.ts +2 -2
  40. package/Dropzone/Dropzone.mjs +111 -97
  41. package/Dropzone/Dropzone.types.d.ts +8 -0
  42. package/Dropzone/{FilePreview.mjs → DropzoneFilePreview.mjs} +1 -1
  43. package/Dropzone/DropzoneSinglePickPreview.d.ts +10 -0
  44. package/Dropzone/DropzoneSinglePickPreview.mjs +44 -0
  45. package/Dropzone/DropzoneUtils.d.ts +1 -0
  46. package/Dropzone/DropzoneUtils.mjs +17 -8
  47. package/Dropzone/index.mjs +1 -1
  48. package/Form/Form.d.ts +2 -2
  49. package/Form/Form.mjs +48 -45
  50. package/Form/FormRenderControl.d.ts +2 -3
  51. package/Form/FormRenderControl.mjs +10 -10
  52. package/Form/FormRenderControl.types.d.ts +5 -7
  53. package/FormCheckbox/FormCheckbox.d.ts +2 -3
  54. package/FormCheckbox/FormCheckbox.mjs +23 -23
  55. package/FormCheckbox/FormCheckbox.types.d.ts +3 -3
  56. package/FormCombobox/FormCombobox.d.ts +2 -2
  57. package/FormCombobox/FormCombobox.mjs +6 -6
  58. package/FormCombobox/FormCombobox.types.d.ts +2 -3
  59. package/FormDatePicker/FormDatePicker.d.ts +2 -2
  60. package/FormDatePicker/FormDatePicker.mjs +20 -18
  61. package/FormDatePicker/FormDatePicker.types.d.ts +2 -3
  62. package/FormDropzone/FormDropzone.d.ts +2 -2
  63. package/FormDropzone/FormDropzone.mjs +8 -16
  64. package/FormDropzone/FormDropzone.types.d.ts +2 -3
  65. package/FormInput/FormInput.d.ts +5 -3
  66. package/FormInput/FormInput.mjs +37 -16
  67. package/FormInput/FormInput.types.d.ts +2 -3
  68. package/FormRadio/FormRadio.d.ts +4 -0
  69. package/FormRadio/FormRadio.mjs +40 -0
  70. package/FormRadio/FormRadio.types.d.ts +6 -0
  71. package/FormRadio/index.d.ts +2 -0
  72. package/FormRadio/index.mjs +4 -0
  73. package/FormRadio/package.json +7 -0
  74. package/FormSelect/FormSelect.d.ts +2 -3
  75. package/FormSelect/FormSelect.mjs +19 -17
  76. package/FormSelect/FormSelect.types.d.ts +2 -3
  77. package/FormTextarea/FormTextarea.d.ts +2 -3
  78. package/FormTextarea/FormTextarea.mjs +13 -12
  79. package/FormTextarea/FormTextarea.types.d.ts +2 -3
  80. package/Input/Input.mjs +50 -38
  81. package/Input/Input.types.d.ts +6 -2
  82. package/Input/inputVariants.mjs +9 -3
  83. package/Label/Label.d.ts +2 -2
  84. package/Label/labelVariants.mjs +7 -4
  85. package/LazyLoader/LazyLoader.mjs +5 -4
  86. package/LoadedIcon/LoadedIcon.d.ts +11 -0
  87. package/LoadedIcon/LoadedIcon.mjs +27 -0
  88. package/LoadedIcon/index.d.ts +1 -0
  89. package/LoadedIcon/index.mjs +4 -0
  90. package/LoadedIcon/package.json +7 -0
  91. package/LoadingMask/LoadingMask.d.ts +4 -1
  92. package/LoadingMask/LoadingMask.mjs +18 -56
  93. package/LoadingMask/LoadingMask.types.d.ts +5 -0
  94. package/LoadingMask/RenderLoadingMask.d.ts +3 -0
  95. package/LoadingMask/RenderLoadingMask.mjs +108 -0
  96. package/LoadingMask/index.d.ts +2 -0
  97. package/LoadingMask/index.mjs +4 -2
  98. package/Popover/Popover.d.ts +3 -3
  99. package/Popover/Popover.mjs +30 -21
  100. package/Radio/Radio.d.ts +4 -0
  101. package/Radio/Radio.mjs +12 -0
  102. package/Radio/Radio.types.d.ts +11 -0
  103. package/Radio/index.d.ts +2 -0
  104. package/Radio/index.mjs +4 -0
  105. package/Radio/package.json +7 -0
  106. package/RadioGroup/RadioGroup.d.ts +9 -3
  107. package/RadioGroup/RadioGroup.mjs +37 -19
  108. package/RadioGroup/index.mjs +4 -3
  109. package/ScrollArea/ScrollArea.d.ts +2 -2
  110. package/ScrollArea/ScrollArea.mjs +26 -13
  111. package/Search/Search.d.ts +1 -2
  112. package/Search/Search.mjs +36 -21
  113. package/Search/Search.types.d.ts +1 -0
  114. package/Select/Select.mjs +94 -63
  115. package/Select/Select.types.d.ts +11 -3
  116. package/Select/SelectRoot.d.ts +2 -2
  117. package/Select/SelectRoot.mjs +29 -24
  118. package/Sheet/Sheet.d.ts +5 -2
  119. package/Sheet/Sheet.mjs +33 -33
  120. package/TablePagination/TablePagination.d.ts +16 -0
  121. package/TablePagination/TablePagination.mjs +74 -0
  122. package/TablePagination/index.d.ts +1 -0
  123. package/TablePagination/index.mjs +4 -0
  124. package/TablePagination/package.json +7 -0
  125. package/Tabs/Tabs.d.ts +3 -2
  126. package/Tabs/Tabs.mjs +20 -6
  127. package/Tabs/Tabs.types.d.ts +5 -2
  128. package/Tabs/index.mjs +8 -7
  129. package/Textarea/Textarea.d.ts +1 -1
  130. package/Textarea/Textarea.mjs +72 -15
  131. package/Textarea/Textarea.types.d.ts +16 -2
  132. package/Textarea/useAutosizeTextArea.d.ts +3 -0
  133. package/Textarea/useAutosizeTextArea.mjs +20 -0
  134. package/Toast/toastVariants.mjs +3 -3
  135. package/index.css +1 -1
  136. package/index.d.ts +2 -0
  137. package/index.mjs +305 -292
  138. package/package.json +6 -6
  139. package/tailwind.config.mjs +13 -13
  140. /package/Dropzone/{FilePreview.d.ts → DropzoneFilePreview.d.ts} +0 -0
  141. /package/{FilePreview-Dhtv8F4u.js → DropzoneFilePreview-Dhtv8F4u.js} +0 -0
@@ -1,140 +1,154 @@
1
- import { jsxs as r, jsx as o } from "react/jsx-runtime";
2
- import { forwardRef as L, useState as y, useEffect as M } from "react";
3
- import { useDropzone as U } from "react-dropzone";
4
- import { Card as j } from "../Card/Card.mjs";
5
- import { File as O, X } from "lucide-react";
6
- import { cn as f } from "@oneplatformdev/utils";
7
- import { F as Y, D as q } from "../FilePreview-Dhtv8F4u.js";
8
- import { isFile as v, extractName as G } from "./DropzoneUtils.mjs";
9
- const H = L(
1
+ import { jsxs as r, jsx as i, Fragment as H } from "react/jsx-runtime";
2
+ import { X as O } from "lucide-react";
3
+ import { forwardRef as X, useState as w, useImperativeHandle as Y } from "react";
4
+ import { useDropzone as q } from "react-dropzone";
5
+ import { cn as p } from "@oneplatformdev/utils";
6
+ import { Card as G } from "../Card/Card.mjs";
7
+ import { F as J, D as K } from "../DropzoneFilePreview-Dhtv8F4u.js";
8
+ import { DropzoneSinglePickPreview as Q } from "./DropzoneSinglePickPreview.mjs";
9
+ import { DefaultFileIcon as R, isFile as g, extractName as Z } from "./DropzoneUtils.mjs";
10
+ const $ = X(
10
11
  ({
11
- acceptTypes: w = q,
12
- maxSizeMB: b,
13
- maxFiles: h = 1,
14
- onErrors: g,
15
- hideErrors: F = !1,
16
- disabled: p = !1,
17
- classNames: l,
18
- value: m = [],
12
+ acceptTypes: y = K,
13
+ maxSizeMB: F,
14
+ maxFiles: v = 1,
15
+ onErrors: a,
16
+ hideErrors: D = !1,
17
+ disabled: d = !1,
18
+ classNames: o,
19
+ value: z = [],
19
20
  onChangeValue: s,
20
- className: u,
21
- labelDropzonePrompt: z = "Drop files here or click to select",
22
- labelOrClickToSelect: J = "Click to select files",
23
- labelSelectedFiles: D = "Selected Files",
24
- labelUploadErrors: I = "Upload Errors",
25
- labelFileTooLarge: k = "File is too large",
26
- labelInvalidFileType: E = "Invalid file type",
27
- ...S
28
- }, P) => {
29
- const [c, a] = y(m), [d, N] = y([]);
30
- M(() => {
31
- a(m);
32
- }, [m]);
33
- const W = (e, i) => {
34
- N(i), g && g(i);
35
- const t = [...c, ...e].slice(0, h);
36
- a(t), s == null || s(t);
37
- }, T = (e, i) => {
38
- if (p) return;
21
+ className: I,
22
+ labelDropzonePrompt: E = "Drop files here or click to select",
23
+ labelDropzoneSubPrompt: b = "",
24
+ labelOrClickToSelect: C = "Click to select files",
25
+ labelSelectedFiles: S = "Selected Files",
26
+ labelUploadErrors: N = "Upload Errors",
27
+ labelFileTooLarge: W = "File is too large",
28
+ labelInvalidFileType: k = "Invalid file type",
29
+ singlePick: c = !1,
30
+ labelDropzoneClassname: B,
31
+ labelDropzoneSubClassname: T,
32
+ ..._
33
+ }, A) => {
34
+ const [n, x] = w(z), [f, L] = w([]), M = (e, l) => {
35
+ L(l), a == null || a(l);
36
+ const t = c ? e.slice(0, 1) : [...n, ...e].slice(0, v);
37
+ x(t), s == null || s(t);
38
+ }, u = (e, l) => {
39
+ if (d) return;
39
40
  e.stopPropagation();
40
- const t = c.filter((n, x) => x !== i);
41
- a(t), s == null || s(t);
42
- }, { getRootProps: _, getInputProps: A, isDragActive: B } = U({
43
- onDrop: W,
44
- accept: w.reduce((e, i) => (e[i] = [], e), {}),
45
- maxSize: b * 1024 * 1024,
46
- maxFiles: h,
47
- disabled: p
41
+ const t = n.filter((m, h) => h !== l);
42
+ x(t), s == null || s(t);
43
+ }, { getRootProps: P, getInputProps: U, isDragActive: j } = q({
44
+ onDrop: M,
45
+ accept: y.reduce((e, l) => (e[l] = [], e), {}),
46
+ maxSize: F * 1024 * 1024,
47
+ maxFiles: c ? 1 : v,
48
+ disabled: d
48
49
  });
49
- return /* @__PURE__ */ r(
50
- j,
50
+ return Y(A, () => ({
51
+ setItems: x
52
+ }), []), /* @__PURE__ */ r(
53
+ G,
51
54
  {
52
- ..._(),
53
- ...S,
54
- className: f(
55
- "border-dashed border-2 p-6 text-center flex flex-col items-center justify-center",
56
- p && "bg-gray-300 pointer-events-none",
57
- d.length > 0 ? "border-red-500" : "border-gray-300",
58
- B && "bg-gray-100",
59
- u
55
+ ...P(),
56
+ ..._,
57
+ className: p(
58
+ "border-dashed p-2 text-center flex flex-col items-center justify-center cursor-pointer",
59
+ d && "border-[#E4E4E7] pointer-events-none",
60
+ f.length > 0 ? "border-red-500" : "!border-[#E4E4E7]",
61
+ j && "bg-gray-100",
62
+ c && "!shadow-none",
63
+ c && n.length > 0 && "!p-0 !shadow-none",
64
+ I
60
65
  ),
61
- ref: P,
62
66
  children: [
63
- /* @__PURE__ */ o("input", { ...A() }),
64
- c.length === 0 && d.length === 0 && /* @__PURE__ */ r(
67
+ /* @__PURE__ */ i("input", { ...U() }),
68
+ n.length === 0 && f.length === 0 && /* @__PURE__ */ r(
65
69
  "div",
66
70
  {
67
- className: f(
71
+ className: p(
68
72
  "flex flex-col items-center gap-1",
69
- l == null ? void 0 : l.idleWrapper
73
+ o == null ? void 0 : o.idleWrapper
70
74
  ),
71
75
  children: [
72
- /* @__PURE__ */ o(O, { className: "w-8 h-8 text-gray-500" }),
73
- !p && /* @__PURE__ */ o("span", { className: "font-semibold text-gray-600", children: z })
76
+ /* @__PURE__ */ i(R, {}),
77
+ !d && /* @__PURE__ */ r(H, { children: [
78
+ /* @__PURE__ */ i("span", { className: p("font-medium text-md text-foreground max-w-[200px]", B), children: E }),
79
+ /* @__PURE__ */ i("span", { className: p("font-normal text-xs text-foreground max-w-[250px]", T), children: b })
80
+ ] })
74
81
  ]
75
82
  }
76
83
  ),
77
- c.length > 0 && /* @__PURE__ */ r("div", { className: f("w-full mt-2", l == null ? void 0 : l.previewWrapper), children: [
78
- /* @__PURE__ */ r("span", { className: "font-semibold text-gray-600", children: [
79
- D,
84
+ f.length > 0 && /* @__PURE__ */ r("div", { className: p("w-full mt-4", o == null ? void 0 : o.errorWrapper), children: [
85
+ /* @__PURE__ */ r("span", { className: "font-semibold text-red-500", children: [
86
+ N,
80
87
  ":"
81
88
  ] }),
82
- /* @__PURE__ */ o("ul", { className: "mt-2 text-sm text-gray-500 flex flex-wrap gap-4 items-start justify-center", children: c.map((e, i) => {
83
- const t = v(e) ? e.name : G(e), n = v(e) ? (e.size / (1024 * 1024)).toFixed(2) + " MB" : "";
89
+ /* @__PURE__ */ i("ul", { className: "mt-2 text-sm text-red-500 list-disc list-inside", children: f.map((e, l) => /* @__PURE__ */ r("li", { children: [
90
+ e.file.name,
91
+ " (",
92
+ (e.file.size / (1024 * 1024)).toFixed(2),
93
+ " MB)",
94
+ !D && /* @__PURE__ */ i("ul", { className: "ml-4 list-disc list-inside", children: e.errors.map((t, m) => /* @__PURE__ */ r("li", { children: [
95
+ t.code === "file-too-large" && W,
96
+ t.code === "file-invalid-type" && k,
97
+ t.code !== "file-too-large" && t.code !== "file-invalid-type" && t.message
98
+ ] }, m)) })
99
+ ] }, l)) })
100
+ ] }),
101
+ !!(c && n.length) && /* @__PURE__ */ i(
102
+ Q,
103
+ {
104
+ item: n[0],
105
+ onRemoveClick: (e) => u(e, 0),
106
+ disabled: d
107
+ }
108
+ ),
109
+ !c && n.length > 0 && /* @__PURE__ */ r("div", { className: p("w-full mt-2", o == null ? void 0 : o.previewWrapper), children: [
110
+ /* @__PURE__ */ r("pre", { className: "font-semibold text-gray-600", children: [
111
+ S,
112
+ ":"
113
+ ] }),
114
+ /* @__PURE__ */ i("ul", { className: "mt-2 text-sm text-gray-500 flex flex-wrap gap-4 items-start justify-center", children: n.map((e, l) => {
115
+ const t = g(e) ? e.name : Z(e), m = g(e) ? (e.size / (1024 * 1024)).toFixed(2) + " MB" : "";
84
116
  return /* @__PURE__ */ r(
85
117
  "li",
86
118
  {
87
119
  className: "flex flex-col items-center gap-2 relative",
88
120
  children: [
89
121
  /* @__PURE__ */ r("div", { className: "relative", children: [
90
- /* @__PURE__ */ o(Y, { item: e, styles: l }),
91
- /* @__PURE__ */ o("div", { className: "absolute top-0 right-0 cursor-pointer bg-gray-300 rounded-sm", children: /* @__PURE__ */ o(
92
- X,
122
+ /* @__PURE__ */ i(J, { item: e, styles: o }),
123
+ /* @__PURE__ */ i(
124
+ "div",
93
125
  {
94
- size: 16,
95
- strokeWidth: 1,
96
- color: "black",
97
- onClick: (x) => T(x, i)
126
+ className: "absolute top-0 right-0 cursor-pointer bg-gray-300 rounded-sm",
127
+ onClick: (h) => u(h, l),
128
+ children: /* @__PURE__ */ i(O, { size: 16, strokeWidth: 1, color: "black" })
98
129
  }
99
- ) })
130
+ )
100
131
  ] }),
101
132
  /* @__PURE__ */ r("span", { className: "inline-flex flex-col items-center", children: [
102
- /* @__PURE__ */ o("span", { className: "max-w-[80px] text-ellipsis overflow-hidden whitespace-nowrap", children: t }),
103
- n && /* @__PURE__ */ r("span", { children: [
133
+ /* @__PURE__ */ i("span", { className: "max-w-[80px] text-ellipsis overflow-hidden whitespace-nowrap", children: t }),
134
+ m && /* @__PURE__ */ r("span", { children: [
104
135
  "(",
105
- n,
136
+ m,
106
137
  ")"
107
138
  ] })
108
139
  ] })
109
140
  ]
110
141
  },
111
- i
142
+ l
112
143
  );
113
144
  }) })
114
- ] }),
115
- d.length > 0 && /* @__PURE__ */ r("div", { className: f("w-full mt-4", l == null ? void 0 : l.errorWrapper), children: [
116
- /* @__PURE__ */ r("span", { className: "font-semibold text-red-500", children: [
117
- I,
118
- ":"
119
- ] }),
120
- /* @__PURE__ */ o("ul", { className: "mt-2 text-sm text-red-500 list-disc list-inside", children: d.map((e, i) => /* @__PURE__ */ r("li", { children: [
121
- e.file.name,
122
- " (",
123
- (e.file.size / (1024 * 1024)).toFixed(2),
124
- " MB)",
125
- !F && /* @__PURE__ */ o("ul", { className: "ml-4 list-disc list-inside", children: e.errors.map((t, n) => /* @__PURE__ */ r("li", { children: [
126
- t.code === "file-too-large" && k,
127
- t.code === "file-invalid-type" && E,
128
- t.code !== "file-too-large" && t.code !== "file-invalid-type" && t.message
129
- ] }, n)) })
130
- ] }, i)) })
131
145
  ] })
132
146
  ]
133
147
  }
134
148
  );
135
149
  }
136
150
  );
137
- H.displayName = "Dropzone";
151
+ $.displayName = "Dropzone";
138
152
  export {
139
- H as Dropzone
153
+ $ as Dropzone
140
154
  };
@@ -1,3 +1,4 @@
1
+ import { Dispatch, SetStateAction } from 'react';
1
2
  import { FileRejection } from 'react-dropzone';
2
3
 
3
4
  export type DropzoneValueItem = File | string;
@@ -7,6 +8,7 @@ export interface FilePreviewProps {
7
8
  }
8
9
  export interface DropzoneTranslations {
9
10
  labelDropzonePrompt?: string;
11
+ labelDropzoneSubPrompt?: string;
10
12
  labelOrClickToSelect?: string;
11
13
  labelSelectedFiles?: string;
12
14
  labelUploadErrors?: string;
@@ -23,6 +25,9 @@ export interface DropzoneProps extends DropzoneTranslations, React.HTMLAttribute
23
25
  classNames?: DropzoneStyles;
24
26
  value?: DropzoneValueItem[];
25
27
  onChangeValue?: (items: DropzoneValueItem[]) => void;
28
+ singlePick?: boolean;
29
+ labelDropzoneClassname?: string;
30
+ labelDropzoneSubClassname?: string;
26
31
  }
27
32
  export interface DropzoneStyles {
28
33
  idleWrapper?: string;
@@ -34,3 +39,6 @@ export interface DropzoneStyles {
34
39
  }
35
40
  export declare const DEFAULT_FILE_TYPES: string[];
36
41
  export declare const DEFAULT_IMAGES_TYPES: string[];
42
+ export interface DropzoneControl {
43
+ setItems: Dispatch<SetStateAction<DropzoneValueItem[]>>;
44
+ }
@@ -1,7 +1,7 @@
1
1
  import "react/jsx-runtime";
2
2
  import "react";
3
3
  import "lucide-react";
4
- import { F } from "../FilePreview-Dhtv8F4u.js";
4
+ import { F } from "../DropzoneFilePreview-Dhtv8F4u.js";
5
5
  import "./DropzoneUtils.mjs";
6
6
  import "@oneplatformdev/utils";
7
7
  export {
@@ -0,0 +1,10 @@
1
+ import { DropzoneValueItem } from './Dropzone.types';
2
+
3
+ export declare const transformImageToSrc: (preview?: string | File | null) => string;
4
+ interface SinglePickPreviewProps {
5
+ item: DropzoneValueItem;
6
+ disabled?: boolean;
7
+ onRemoveClick: (e: React.MouseEvent<HTMLDivElement>) => void;
8
+ }
9
+ export declare const DropzoneSinglePickPreview: ({ item, disabled, onRemoveClick, }: SinglePickPreviewProps) => import("react/jsx-runtime").JSX.Element;
10
+ export {};
@@ -0,0 +1,44 @@
1
+ import { jsxs as c, jsx as o } from "react/jsx-runtime";
2
+ import { useMemo as a } from "react";
3
+ import { isFile as d } from "./DropzoneUtils.mjs";
4
+ import { X as f, FileIcon as h } from "lucide-react";
5
+ const g = (t) => {
6
+ if (!t) return "";
7
+ switch (!0) {
8
+ case (typeof t == "string" && !!t.trim() && t !== "null"):
9
+ return t;
10
+ case t instanceof File:
11
+ return URL.createObjectURL(t);
12
+ case t instanceof FileList:
13
+ return t[0] ? URL.createObjectURL(t[0]) : "";
14
+ default:
15
+ return "";
16
+ }
17
+ }, j = ({
18
+ item: t,
19
+ disabled: i,
20
+ onRemoveClick: u
21
+ }) => {
22
+ const r = d(t), e = r ? t.name : t, s = a(() => {
23
+ var l;
24
+ return r && ((l = t == null ? void 0 : t.type) == null ? void 0 : l.includes("image")) || typeof t == "string";
25
+ }, [t, r]), n = a(() => s ? g(t) : "", [t, s]);
26
+ return /* @__PURE__ */ c("div", { className: "relative w-full h-64 sm:h-80 md:h-96 overflow-hidden outline-[#E4E4E7] outline-[2px] outline-dashed outline-offset-[-1px] rounded-lg", children: [
27
+ !i && /* @__PURE__ */ o("div", { className: "absolute top-2 right-2 cursor-pointer bg-white/70 rounded-[4px] p-1 shadow", onClick: u, children: /* @__PURE__ */ o(f, { size: 16, strokeWidth: 2, color: "black" }) }),
28
+ n ? /* @__PURE__ */ o(
29
+ "img",
30
+ {
31
+ src: n,
32
+ alt: e == null ? void 0 : e.toString(),
33
+ className: "w-full h-full object-cover rounded-lg "
34
+ }
35
+ ) : /* @__PURE__ */ c("div", { className: "w-full h-full flex flex-col items-center justify-center text-gray-600", children: [
36
+ /* @__PURE__ */ o(h, { size: 28 }),
37
+ /* @__PURE__ */ o("span", { className: "text-sm mt-2 break-all px-2 text-center", children: e == null ? void 0 : e.toString() })
38
+ ] })
39
+ ] });
40
+ };
41
+ export {
42
+ j as DropzoneSinglePickPreview,
43
+ g as transformImageToSrc
44
+ };
@@ -2,3 +2,4 @@ import { DropzoneValueItem } from './Dropzone.types';
2
2
 
3
3
  export declare function isFile(item: DropzoneValueItem): item is File;
4
4
  export declare function extractName(url: string): string;
5
+ export declare const DefaultFileIcon: () => import("react/jsx-runtime").JSX.Element;
@@ -1,15 +1,24 @@
1
- function e(t) {
2
- return t instanceof File;
1
+ import { jsxs as t, jsx as l } from "react/jsx-runtime";
2
+ function d(e) {
3
+ return e instanceof File;
3
4
  }
4
- function i(t) {
5
+ function r(e) {
5
6
  try {
6
- const n = t.split("?")[0].split("#")[0].split("/");
7
- return n[n.length - 1] || t;
7
+ const i = e.split("?")[0].split("#")[0].split("/");
8
+ return i[i.length - 1] || e;
8
9
  } catch {
9
- return t;
10
+ return e;
10
11
  }
11
12
  }
13
+ const o = () => /* @__PURE__ */ t("svg", { width: "55", height: "55", viewBox: "0 0 55 55", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
14
+ /* @__PURE__ */ l("mask", { id: "mask0_2430_114601", maskUnits: "userSpaceOnUse", x: "7", y: "4", width: "39", height: "46", children: /* @__PURE__ */ l("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M7.25 4.68359H45.6174V49.354H7.25V4.68359Z", fill: "white" }) }),
15
+ /* @__PURE__ */ l("g", { mask: "url(#mask0_2430_114601)", children: /* @__PURE__ */ l("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M17.5386 8.05859C13.8103 8.05859 10.7143 11.0781 10.6266 14.8018V38.9196C10.5456 42.7468 13.5606 45.8968 17.3518 45.9801H35.5386C39.2938 45.8451 42.2661 42.7468 42.2413 38.9308V18.9216L31.8148 8.05859H17.5656H17.5386ZM17.5664 49.3551H17.2829C11.6309 49.2336 7.1309 44.5356 7.2524 38.8836V14.7613C7.38515 9.17909 11.9932 4.68359 17.5327 4.68359H17.5732H32.5334C32.9924 4.68359 33.4312 4.87034 33.7507 5.20109L45.1492 17.0743C45.4484 17.3871 45.6172 17.8078 45.6172 18.2421V38.9196C45.6532 44.5648 41.2522 49.1526 35.5979 49.3551H17.5664Z", fill: "#0D0E2B", "fill-opacity": "0.7" }) }),
16
+ /* @__PURE__ */ l("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M43.9198 20.3703H37.7233C33.6036 20.359 30.2578 17.002 30.2578 12.889V6.34375C30.2578 5.41225 31.0138 4.65625 31.9453 4.65625C32.8768 4.65625 33.6328 5.41225 33.6328 6.34375V12.889C33.6328 15.148 35.4688 16.9885 37.7278 16.9953H43.9198C44.8513 16.9953 45.6073 17.7513 45.6073 18.6828C45.6073 19.6143 44.8513 20.3703 43.9198 20.3703Z", fill: "#0D0E2B", "fill-opacity": "0.7" }),
17
+ /* @__PURE__ */ l("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M25.5708 37.729C24.6393 37.729 23.8833 36.973 23.8833 36.0415V22.4492C23.8833 21.5177 24.6393 20.7617 25.5708 20.7617C26.5023 20.7617 27.2583 21.5177 27.2583 22.4492V36.0415C27.2583 36.973 26.5023 37.729 25.5708 37.729Z", fill: "#0D0E2B", "fill-opacity": "0.7" }),
18
+ /* @__PURE__ */ l("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M25.5678 37.7279C25.1201 37.7279 24.6881 37.5501 24.3731 37.2306L19.0968 31.9341C18.4398 31.2726 18.4421 30.2039 19.1013 29.5469C19.7628 28.8899 20.8316 28.8899 21.4886 29.5514L25.5678 33.6509L29.6471 29.5514C30.3041 28.8899 31.3728 28.8899 32.0343 29.5469C32.6936 30.2039 32.6958 31.2726 32.0388 31.9341L26.7626 37.2306C26.4476 37.5501 26.0156 37.7279 25.5678 37.7279Z", fill: "#0D0E2B", "fill-opacity": "0.7" })
19
+ ] });
12
20
  export {
13
- i as extractName,
14
- e as isFile
21
+ o as DefaultFileIcon,
22
+ r as extractName,
23
+ d as isFile
15
24
  };
@@ -1,5 +1,5 @@
1
1
  import { Dropzone as r } from "./Dropzone.mjs";
2
- import { D as T, a as _ } from "../FilePreview-Dhtv8F4u.js";
2
+ import { D as T, a as _ } from "../DropzoneFilePreview-Dhtv8F4u.js";
3
3
  export {
4
4
  T as DEFAULT_FILE_TYPES,
5
5
  _ as DEFAULT_IMAGES_TYPES,
package/Form/Form.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { ControllerProps, FieldPath, FieldValues } from 'react-hook-form';
2
- import * as React from "react";
3
- import * as LabelPrimitive from "@radix-ui/react-label";
2
+ import * as React from 'react';
3
+ import * as LabelPrimitive from '@radix-ui/react-label';
4
4
  declare const Form: <TFieldValues extends FieldValues, TContext = any, TTransformedValues extends FieldValues | undefined = undefined>(props: import('react-hook-form').FormProviderProps<TFieldValues, TContext, TTransformedValues>) => React.JSX.Element;
5
5
  declare const FormField: <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ ...props }: ControllerProps<TFieldValues, TName>) => import("react/jsx-runtime").JSX.Element;
6
6
  declare const useFormField: () => {
package/Form/Form.mjs CHANGED
@@ -1,95 +1,98 @@
1
- import { jsx as i } from "react/jsx-runtime";
1
+ import { jsx as n } from "react/jsx-runtime";
2
2
  import * as s from "react";
3
3
  import { Slot as F } from "@radix-ui/react-slot";
4
4
  import { FormProvider as u, Controller as p, useFormContext as x } from "react-hook-form";
5
5
  import { cn as a } from "@oneplatformdev/utils";
6
6
  import { Label as I } from "../Label/Label.mjs";
7
7
  import "../Label/labelVariants.mjs";
8
- const M = u, f = s.createContext(
8
+ const M = u, l = s.createContext(
9
9
  {}
10
10
  ), S = ({
11
11
  ...e
12
- }) => /* @__PURE__ */ i(f.Provider, { value: { name: e.name }, children: /* @__PURE__ */ i(p, { ...e }) }), d = () => {
13
- const e = s.useContext(f), o = s.useContext(l), { getFieldState: r, formState: t } = x(), m = r(e.name, t);
12
+ }) => /* @__PURE__ */ n(l.Provider, { value: { name: e.name }, children: /* @__PURE__ */ n(p, { ...e }) }), c = () => {
13
+ const e = s.useContext(l), t = s.useContext(f), { getFieldState: o, formState: r } = x(), m = o(e.name, r);
14
14
  if (!e)
15
15
  throw new Error("useFormField should be used within <FormField>");
16
- const { id: n } = o;
16
+ const { id: i } = t;
17
17
  return {
18
- id: n,
18
+ id: i,
19
19
  name: e.name,
20
- formItemId: `${n}-form-item`,
21
- formDescriptionId: `${n}-form-item-description`,
22
- formMessageId: `${n}-form-item-message`,
20
+ formItemId: `${i}-form-item`,
21
+ formDescriptionId: `${i}-form-item-description`,
22
+ formMessageId: `${i}-form-item-message`,
23
23
  ...m
24
24
  };
25
- }, l = s.createContext(
25
+ }, f = s.createContext(
26
26
  {}
27
- ), C = s.forwardRef(({ className: e, ...o }, r) => {
28
- const t = s.useId();
29
- return /* @__PURE__ */ i(l.Provider, { value: { id: t }, children: /* @__PURE__ */ i("div", { ref: r, className: a("space-y-2", e), ...o }) });
27
+ ), v = s.forwardRef(({ className: e, ...t }, o) => {
28
+ const r = s.useId();
29
+ return /* @__PURE__ */ n(f.Provider, { value: { id: r }, children: /* @__PURE__ */ n("div", { ref: o, className: a("space-y-1", e), ...t }) });
30
30
  });
31
- C.displayName = "FormItem";
32
- const g = s.forwardRef(({ className: e, ...o }, r) => {
33
- const { error: t, formItemId: m } = d();
34
- return /* @__PURE__ */ i(
31
+ v.displayName = "FormItem";
32
+ const C = s.forwardRef(({ className: e, ...t }, o) => {
33
+ const { error: r, formItemId: m } = c();
34
+ return /* @__PURE__ */ n(
35
35
  I,
36
36
  {
37
- ref: r,
38
- className: a(t && "text-destructive", e),
37
+ ref: o,
38
+ "data-state": r ? "invalid" : "valid",
39
+ className: a(r && "text-destructive", e),
39
40
  htmlFor: m,
40
- ...o
41
+ ...t
41
42
  }
42
43
  );
43
44
  });
44
- g.displayName = "FormLabel";
45
- const v = s.forwardRef(({ ...e }, o) => {
46
- const { error: r, formItemId: t, formDescriptionId: m, formMessageId: n } = d();
47
- return /* @__PURE__ */ i(
45
+ C.displayName = "FormLabel";
46
+ const g = s.forwardRef(({ className: e, ...t }, o) => {
47
+ const { error: r, formItemId: m, formDescriptionId: i, formMessageId: d } = c();
48
+ return /* @__PURE__ */ n(
48
49
  F,
49
50
  {
50
51
  ref: o,
51
- id: t,
52
- "aria-describedby": r ? `${m} ${n}` : `${m}`,
52
+ id: m,
53
+ "data-state": r ? "invalid" : "valid",
54
+ "aria-describedby": r ? `${i} ${d}` : `${i}`,
53
55
  "aria-invalid": !!r,
54
- ...e
56
+ className: a("group/form-control", e),
57
+ ...t
55
58
  }
56
59
  );
57
60
  });
58
- v.displayName = "FormControl";
59
- const N = s.forwardRef(({ className: e, ...o }, r) => {
60
- const { formDescriptionId: t } = d();
61
- return /* @__PURE__ */ i(
61
+ g.displayName = "FormControl";
62
+ const N = s.forwardRef(({ className: e, ...t }, o) => {
63
+ const { formDescriptionId: r } = c();
64
+ return /* @__PURE__ */ n(
62
65
  "p",
63
66
  {
64
- ref: r,
65
- id: t,
67
+ ref: o,
68
+ id: r,
66
69
  className: a("text-[0.8rem] text-muted-foreground", e),
67
- ...o
70
+ ...t
68
71
  }
69
72
  );
70
73
  });
71
74
  N.displayName = "FormDescription";
72
- const w = s.forwardRef(({ className: e, children: o, ...r }, t) => {
73
- const { error: m, formMessageId: n } = d(), c = m ? String(m == null ? void 0 : m.message) : o;
74
- return c ? /* @__PURE__ */ i(
75
+ const w = s.forwardRef(({ className: e, children: t, ...o }, r) => {
76
+ const { error: m, formMessageId: i } = c(), d = m ? String(m == null ? void 0 : m.message) : t;
77
+ return d ? /* @__PURE__ */ n(
75
78
  "p",
76
79
  {
77
- ref: t,
78
- id: n,
80
+ ref: r,
81
+ id: i,
79
82
  className: a("text-[0.8rem] font-medium text-destructive", e),
80
- ...r,
81
- children: c
83
+ ...o,
84
+ children: d
82
85
  }
83
86
  ) : null;
84
87
  });
85
88
  w.displayName = "FormMessage";
86
89
  export {
87
90
  M as Form,
88
- v as FormControl,
91
+ g as FormControl,
89
92
  N as FormDescription,
90
93
  S as FormField,
91
- C as FormItem,
92
- g as FormLabel,
94
+ v as FormItem,
95
+ C as FormLabel,
93
96
  w as FormMessage,
94
- d as useFormField
97
+ c as useFormField
95
98
  };
@@ -1,5 +1,4 @@
1
- import { FieldValues } from 'react-hook-form/dist/types/fields';
2
- import { UseFormReturn } from 'react-hook-form';
1
+ import { FieldValues } from 'react-hook-form';
3
2
  import { FormRenderControlProps } from './FormRenderControl.types';
4
3
 
5
- export declare const FormRenderControl: <Data extends FieldValues, Form extends UseFormReturn<Data>>(props: FormRenderControlProps<Data, Form>) => import("react/jsx-runtime").JSX.Element;
4
+ export declare const FormRenderControl: <Data extends FieldValues>(props: FormRenderControlProps<Data>) => import("react/jsx-runtime").JSX.Element;
@@ -1,21 +1,21 @@
1
- import { jsx as r, jsxs as c } from "react/jsx-runtime";
2
- import { FormField as d, FormItem as F, FormLabel as a, FormMessage as i } from "./Form.mjs";
3
- const x = (e) => {
4
- const { form: n, name: m, label: o, render: t, ...l } = e;
1
+ import { jsx as r, jsxs as a } from "react/jsx-runtime";
2
+ import { FormField as d, FormItem as i, FormLabel as F, FormMessage as p } from "./Form.mjs";
3
+ const b = (e) => {
4
+ const { form: n, name: m, label: o, render: t, containerProps: l = {}, ...s } = e;
5
5
  return /* @__PURE__ */ r(
6
6
  d,
7
7
  {
8
8
  control: n.control,
9
9
  name: m,
10
- render: (s) => /* @__PURE__ */ c(F, { children: [
11
- !!o && /* @__PURE__ */ r(a, { children: o }),
12
- t(s),
13
- /* @__PURE__ */ r(i, {})
10
+ render: (c) => /* @__PURE__ */ a(i, { ...l, children: [
11
+ !!o && /* @__PURE__ */ r(F, { children: o }),
12
+ t(c),
13
+ /* @__PURE__ */ r(p, {})
14
14
  ] }),
15
- ...l
15
+ ...s
16
16
  }
17
17
  );
18
18
  };
19
19
  export {
20
- x as FormRenderControl
20
+ b as FormRenderControl
21
21
  };
@@ -1,7 +1,4 @@
1
- import { ControllerFieldState, ControllerRenderProps } from 'react-hook-form/dist/types/controller';
2
- import { FieldPath, UseFormStateReturn } from 'react-hook-form/dist/types';
3
- import { FieldValues } from 'react-hook-form/dist/types/fields';
4
- import { UseFormReturn } from 'react-hook-form';
1
+ import { ControllerFieldState, ControllerRenderProps, FieldPath, FieldValues, UseFormReturn, UseFormStateReturn } from 'react-hook-form';
5
2
  import { default as React } from 'react';
6
3
 
7
4
  export type FormRenderProps<Data extends FieldValues> = ({ field, fieldState, formState, }: {
@@ -9,10 +6,11 @@ export type FormRenderProps<Data extends FieldValues> = ({ field, fieldState, fo
9
6
  fieldState: ControllerFieldState;
10
7
  formState: UseFormStateReturn<Data>;
11
8
  }) => React.ReactElement;
12
- export interface FormRenderControlProps<Data extends FieldValues, Form extends UseFormReturn<Data>> {
13
- form: Form;
9
+ export interface FormRenderControlProps<Data extends FieldValues> {
10
+ form: UseFormReturn<Data>;
14
11
  name: FieldPath<Data>;
15
12
  label?: string;
16
13
  render: FormRenderProps<Data>;
14
+ containerProps?: React.HTMLAttributes<HTMLDivElement>;
17
15
  }
18
- export type FormRenderControlExtendProps<Data extends FieldValues, Form extends UseFormReturn<Data>> = Pick<FormRenderControlProps<Data, Form>, 'form' | 'name' | 'label'>;
16
+ export type FormRenderControlExtendProps<Data extends FieldValues> = Omit<FormRenderControlProps<Data>, 'render'>;
@@ -1,5 +1,4 @@
1
- import { UseFormReturn } from 'react-hook-form';
2
- import { FieldValues } from 'react-hook-form/dist/types/fields';
3
1
  import { FormCheckboxProps } from './FormCheckbox.types';
2
+ import { FieldValues } from 'react-hook-form';
4
3
 
5
- export declare const FormCheckbox: <Data extends FieldValues, Form extends UseFormReturn<Data>>(props: FormCheckboxProps<Data, Form>) => import("react/jsx-runtime").JSX.Element;
4
+ export declare const FormCheckbox: <Data extends FieldValues>(props: FormCheckboxProps<Data>) => import("react/jsx-runtime").JSX.Element;