@ensi-platform/admin-ui 0.10.0 → 0.11.0

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 (201) hide show
  1. package/dist/{Component-BjITARbg.js → Component-6rieHJdg.js} +2 -2
  2. package/dist/{Component-BjITARbg.js.map → Component-6rieHJdg.js.map} +1 -1
  3. package/dist/{Component-DxkpQKZ9.js → Component-BH5skHn_.js} +2 -2
  4. package/dist/{Component-DxkpQKZ9.js.map → Component-BH5skHn_.js.map} +1 -1
  5. package/dist/{Component-D9cY4WmP.js → Component-BZqLGwzc.js} +2 -2
  6. package/dist/{Component-D9cY4WmP.js.map → Component-BZqLGwzc.js.map} +1 -1
  7. package/dist/{Component-DcSDEfYC.js → Component-C4vHIDMZ.js} +3 -3
  8. package/dist/{Component-DcSDEfYC.js.map → Component-C4vHIDMZ.js.map} +1 -1
  9. package/dist/{Component-c2va6Tzq.js → Component-CkazNd13.js} +2 -2
  10. package/dist/{Component-c2va6Tzq.js.map → Component-CkazNd13.js.map} +1 -1
  11. package/dist/{Component-BO5LvfoO.js → Component-DH7wdC3G.js} +3 -3
  12. package/dist/{Component-BO5LvfoO.js.map → Component-DH7wdC3G.js.map} +1 -1
  13. package/dist/{Component-Cxk1CLsH.js → Component-DOlDNQnu.js} +3 -3
  14. package/dist/{Component-Cxk1CLsH.js.map → Component-DOlDNQnu.js.map} +1 -1
  15. package/dist/{Component-BMol_xnR.js → Component-DpACJ8IJ.js} +2 -2
  16. package/dist/{Component-BMol_xnR.js.map → Component-DpACJ8IJ.js.map} +1 -1
  17. package/dist/{Component-CD81ynoG.js → Component-IFlvrceZ.js} +3 -3
  18. package/dist/{Component-CD81ynoG.js.map → Component-IFlvrceZ.js.map} +1 -1
  19. package/dist/Upload-Bi4Xl-j5.js +120 -0
  20. package/dist/Upload-Bi4Xl-j5.js.map +1 -0
  21. package/dist/action-popup/index.js +2 -2
  22. package/dist/active-filters/index.js +2 -2
  23. package/dist/arrangement-settings/index.js +2 -2
  24. package/dist/assets/index.css +1 -1
  25. package/dist/assets/index15.css +1 -1
  26. package/dist/assets/index16.css +1 -1
  27. package/dist/assets/index17.css +1 -1
  28. package/dist/assets/index18.css +1 -1
  29. package/dist/assets/index19.css +1 -1
  30. package/dist/assets/index20.css +1 -1
  31. package/dist/assets/index21.css +1 -1
  32. package/dist/assets/index22.css +1 -1
  33. package/dist/assets/index23.css +1 -1
  34. package/dist/assets/index24.css +1 -1
  35. package/dist/assets/index25.css +1 -1
  36. package/dist/assets/index26.css +1 -1
  37. package/dist/assets/index27.css +1 -1
  38. package/dist/assets/index28.css +1 -1
  39. package/dist/assets/index29.css +1 -1
  40. package/dist/assets/index30.css +1 -1
  41. package/dist/assets/index31.css +1 -1
  42. package/dist/assets/index32.css +1 -0
  43. package/dist/assets/index33.css +1 -0
  44. package/dist/assets/index8.css +1 -1
  45. package/dist/assets/index9.css +1 -1
  46. package/dist/autocomplete/index.js +2 -2
  47. package/dist/autocomplete-async/index.js +2 -2
  48. package/dist/bottom-sheet/index.js +2 -2
  49. package/dist/cascade-menu/index.js +3 -3
  50. package/dist/checkbox/index.js +1 -1
  51. package/dist/checkbox-group/index.js +1 -1
  52. package/dist/color-picker/Component.d.ts +5 -0
  53. package/dist/color-picker/Component.d.ts.map +1 -0
  54. package/dist/color-picker/FormColorPicker.d.ts +6 -0
  55. package/dist/color-picker/FormColorPicker.d.ts.map +1 -0
  56. package/dist/color-picker/index.d.ts +4 -0
  57. package/dist/color-picker/index.d.ts.map +1 -0
  58. package/dist/color-picker/index.js +347 -0
  59. package/dist/color-picker/index.js.map +1 -0
  60. package/dist/color-picker/theme.d.ts +6 -0
  61. package/dist/color-picker/theme.d.ts.map +1 -0
  62. package/dist/color-picker/types.d.ts +58 -0
  63. package/dist/color-picker/types.d.ts.map +1 -0
  64. package/dist/color-picker/utils.d.ts +23 -0
  65. package/dist/color-picker/utils.d.ts.map +1 -0
  66. package/dist/combobox/index.js +4 -4
  67. package/dist/copy-button/index.js +1 -1
  68. package/dist/data-table/index.js +3 -3
  69. package/dist/date-picker/index.js +4 -4
  70. package/dist/date-range-picker/index.js +4 -4
  71. package/dist/drawer/index.js +1 -1
  72. package/dist/dropzone/Component.d.ts +14 -0
  73. package/dist/dropzone/Component.d.ts.map +1 -0
  74. package/dist/dropzone/FormDropzone.d.ts +6 -0
  75. package/dist/dropzone/FormDropzone.d.ts.map +1 -0
  76. package/dist/dropzone/__tests__/helpers.d.ts +37 -0
  77. package/dist/dropzone/__tests__/helpers.d.ts.map +1 -0
  78. package/dist/dropzone/components/Action/index.d.ts +14 -0
  79. package/dist/dropzone/components/Action/index.d.ts.map +1 -0
  80. package/dist/dropzone/components/ActionSlot/index.d.ts +10 -0
  81. package/dist/dropzone/components/ActionSlot/index.d.ts.map +1 -0
  82. package/dist/dropzone/components/FileCopy/index.d.ts +7 -0
  83. package/dist/dropzone/components/FileCopy/index.d.ts.map +1 -0
  84. package/dist/dropzone/components/FileListDrag/index.d.ts +11 -0
  85. package/dist/dropzone/components/FileListDrag/index.d.ts.map +1 -0
  86. package/dist/dropzone/components/FileRows/index.d.ts +9 -0
  87. package/dist/dropzone/components/FileRows/index.d.ts.map +1 -0
  88. package/dist/dropzone/components/FileSkeletons/index.d.ts +8 -0
  89. package/dist/dropzone/components/FileSkeletons/index.d.ts.map +1 -0
  90. package/dist/dropzone/components/GridItem/index.d.ts +7 -0
  91. package/dist/dropzone/components/GridItem/index.d.ts.map +1 -0
  92. package/dist/dropzone/components/GridList/index.d.ts +7 -0
  93. package/dist/dropzone/components/GridList/index.d.ts.map +1 -0
  94. package/dist/dropzone/components/Grip/index.d.ts +7 -0
  95. package/dist/dropzone/components/Grip/index.d.ts.map +1 -0
  96. package/dist/dropzone/components/Item/index.d.ts +7 -0
  97. package/dist/dropzone/components/Item/index.d.ts.map +1 -0
  98. package/dist/dropzone/components/ItemRoot/index.d.ts +8 -0
  99. package/dist/dropzone/components/ItemRoot/index.d.ts.map +1 -0
  100. package/dist/dropzone/components/List/index.d.ts +7 -0
  101. package/dist/dropzone/components/List/index.d.ts.map +1 -0
  102. package/dist/dropzone/components/Preview/index.d.ts +6 -0
  103. package/dist/dropzone/components/Preview/index.d.ts.map +1 -0
  104. package/dist/dropzone/components/Progress/index.d.ts +7 -0
  105. package/dist/dropzone/components/Progress/index.d.ts.map +1 -0
  106. package/dist/dropzone/components/Quota/index.d.ts +9 -0
  107. package/dist/dropzone/components/Quota/index.d.ts.map +1 -0
  108. package/dist/dropzone/components/SelectionMark/index.d.ts +5 -0
  109. package/dist/dropzone/components/SelectionMark/index.d.ts.map +1 -0
  110. package/dist/dropzone/components/TypeMark/index.d.ts +5 -0
  111. package/dist/dropzone/components/TypeMark/index.d.ts.map +1 -0
  112. package/dist/dropzone/components/Zone/index.d.ts +34 -0
  113. package/dist/dropzone/components/Zone/index.d.ts.map +1 -0
  114. package/dist/dropzone/components/ZoneSkeleton/index.d.ts +3 -0
  115. package/dist/dropzone/components/ZoneSkeleton/index.d.ts.map +1 -0
  116. package/dist/dropzone/hooks/useDropzoneFiles.d.ts +30 -0
  117. package/dist/dropzone/hooks/useDropzoneFiles.d.ts.map +1 -0
  118. package/dist/dropzone/hooks/useDropzoneFocus.d.ts +18 -0
  119. package/dist/dropzone/hooks/useDropzoneFocus.d.ts.map +1 -0
  120. package/dist/dropzone/hooks/useDropzoneSelection.d.ts +15 -0
  121. package/dist/dropzone/hooks/useDropzoneSelection.d.ts.map +1 -0
  122. package/dist/dropzone/hooks/useDropzoneUploads.d.ts +27 -0
  123. package/dist/dropzone/hooks/useDropzoneUploads.d.ts.map +1 -0
  124. package/dist/dropzone/hooks/useFileList/index.d.ts +23 -0
  125. package/dist/dropzone/hooks/useFileList/index.d.ts.map +1 -0
  126. package/dist/dropzone/index.d.ts +4 -0
  127. package/dist/dropzone/index.d.ts.map +1 -0
  128. package/dist/dropzone/index.js +1516 -0
  129. package/dist/dropzone/index.js.map +1 -0
  130. package/dist/dropzone/theme.d.ts +6 -0
  131. package/dist/dropzone/theme.d.ts.map +1 -0
  132. package/dist/dropzone/types.d.ts +240 -0
  133. package/dist/dropzone/types.d.ts.map +1 -0
  134. package/dist/dropzone/utils.d.ts +123 -0
  135. package/dist/dropzone/utils.d.ts.map +1 -0
  136. package/dist/filters/index.js +1 -1
  137. package/dist/form/hooks/useFieldHook.d.ts +4 -2
  138. package/dist/form/hooks/useFieldHook.d.ts.map +1 -1
  139. package/dist/form/index.js +2 -2
  140. package/dist/grid-layout/index.js +1 -1
  141. package/dist/hooks-CekMiYbX.js +91 -0
  142. package/dist/hooks-CekMiYbX.js.map +1 -0
  143. package/dist/icons/File.d.ts +7 -0
  144. package/dist/icons/File.d.ts.map +1 -0
  145. package/dist/icons/ListChecks.d.ts +8 -0
  146. package/dist/icons/ListChecks.d.ts.map +1 -0
  147. package/dist/icons/index.d.ts +2 -0
  148. package/dist/icons/index.d.ts.map +1 -1
  149. package/dist/icons/index.js +83 -145
  150. package/dist/icons/index.js.map +1 -1
  151. package/dist/{index-BXlN61PG.js → index-BccXGF9t.js} +2 -2
  152. package/dist/{index-BXlN61PG.js.map → index-BccXGF9t.js.map} +1 -1
  153. package/dist/{index-CDCqZ3um.js → index-C_oo7Xm5.js} +3 -3
  154. package/dist/{index-CDCqZ3um.js.map → index-C_oo7Xm5.js.map} +1 -1
  155. package/dist/{index-CdAE-ZaU.js → index-DxsuVBkE.js} +4 -4
  156. package/dist/{index-CdAE-ZaU.js.map → index-DxsuVBkE.js.map} +1 -1
  157. package/dist/input/index.js +2 -2
  158. package/dist/loader/index.js +2 -2
  159. package/dist/menu-list/index.js +1 -1
  160. package/dist/{metrics-B5YsELiI.js → metrics-Cv_jrA15.js} +2 -2
  161. package/dist/{metrics-B5YsELiI.js.map → metrics-Cv_jrA15.js.map} +1 -1
  162. package/dist/modal/index.js +1 -1
  163. package/dist/multi-autocomplete/index.js +2 -2
  164. package/dist/multi-autocomplete-async/index.js +2 -2
  165. package/dist/multi-select/index.js +4 -4
  166. package/dist/number-input/index.js +2 -2
  167. package/dist/number-range/index.js +2 -2
  168. package/dist/provider/context.d.ts.map +1 -1
  169. package/dist/provider/index.js +2 -2
  170. package/dist/provider/types.d.ts +76 -0
  171. package/dist/provider/types.d.ts.map +1 -1
  172. package/dist/select/index.js +2 -2
  173. package/dist/slider/index.js +2 -2
  174. package/dist/suggest-checklist/index.js +3 -3
  175. package/dist/switch/index.js +1 -1
  176. package/dist/table/index.js +1 -1
  177. package/dist/tabs/index.js +1 -1
  178. package/dist/tag/index.js +1 -1
  179. package/dist/textarea/index.js +3 -3
  180. package/dist/time-field/index.js +2 -2
  181. package/dist/toast/index.js +2 -2
  182. package/dist/typography/index.js +1 -1
  183. package/dist/useFieldHook-o47pjrRg.js +56 -0
  184. package/dist/useFieldHook-o47pjrRg.js.map +1 -0
  185. package/dist/{utils-Dj_u-w0s.js → utils-DrTtzDsS.js} +3 -3
  186. package/dist/{utils-Dj_u-w0s.js.map → utils-DrTtzDsS.js.map} +1 -1
  187. package/dist/vertical-tabs/index.js +1 -1
  188. package/package.json +10 -1
  189. package/src/color-picker/docs/Description.md +45 -0
  190. package/src/color-picker/docs/Example.md +5 -0
  191. package/src/color-picker/docs/cssVariables.ts +40 -0
  192. package/src/color-picker/types.ts +67 -0
  193. package/src/dropzone/docs/Description.md +73 -0
  194. package/src/dropzone/docs/Example.md +17 -0
  195. package/src/dropzone/docs/cssVariables.ts +32 -0
  196. package/src/dropzone/types.ts +268 -0
  197. package/src/provider/types.ts +76 -0
  198. package/dist/hooks-BlX5Y4Zt.js +0 -53
  199. package/dist/hooks-BlX5Y4Zt.js.map +0 -1
  200. package/dist/useFieldHook-Bt9nST7g.js +0 -52
  201. package/dist/useFieldHook-Bt9nST7g.js.map +0 -1
@@ -0,0 +1,268 @@
1
+ import { type ComponentPropsWithRef, type ComponentType, type CSSProperties, type ReactNode, type Ref } from 'react';
2
+
3
+ import { type Accept } from 'react-dropzone';
4
+
5
+ import { type IDataTestIdProps } from '@ds/common';
6
+
7
+ import { type IFieldStateProps } from '@/field/types';
8
+ import { type IFormFieldLayoutProps } from '@/form/types';
9
+
10
+ /** One file in the dropzone value. */
11
+ export interface IDropzoneFile {
12
+ /** Stable id. Server files keep their own id. */
13
+ id: string;
14
+ /** File name. */
15
+ name: string;
16
+ /** Size in bytes. */
17
+ size: number;
18
+ /** MIME type. */
19
+ type: string;
20
+ /** Newly picked file. Absent for a file that already lives on the server. */
21
+ file?: File;
22
+ /** Preview or download address of a server file. */
23
+ url?: string;
24
+ }
25
+
26
+ export type TDropzoneSize = 'sm' | 'md' | 'lg';
27
+
28
+ /** A file that is visible but not in `value` yet. */
29
+ export interface IPendingDropzoneFile {
30
+ /** Local id until the server id arrives. */
31
+ id: string;
32
+ /** File name. */
33
+ name: string;
34
+ /** Size in bytes. */
35
+ size: number;
36
+ /** MIME type. */
37
+ type: string;
38
+ /** File passed to `upload`. */
39
+ file: File;
40
+ /** `uploading` hides remove. `error` keeps the row. */
41
+ status: 'uploading' | 'error';
42
+ /** Absent until `onProgress` reports a number. */
43
+ progress: number | null;
44
+ /** This row replaces the single file already in the list. */
45
+ replacing: boolean;
46
+ /** Rejection text. Absent when the failure has no message. */
47
+ error?: string;
48
+ }
49
+
50
+ /** One button on a file row. */
51
+ export interface IRowAction {
52
+ key: 'remove' | 'retry' | 'dismiss' | 'cancel';
53
+ label: string;
54
+ run: () => void;
55
+ disabled?: boolean;
56
+ }
57
+
58
+ /** Props shared by the row and the grid card. */
59
+ export type TDropzoneItemElement = 'div' | 'row';
60
+
61
+ /** Props of the file root. `row` is the settled list item. */
62
+ export interface IDropzoneItemElementProps {
63
+ id?: string;
64
+ textValue?: string;
65
+ 'aria-label'?: string;
66
+ 'data-file-id'?: string;
67
+ 'data-layout'?: 'stacked';
68
+ 'data-replacing'?: boolean;
69
+ 'data-flash'?: boolean;
70
+ 'data-flip'?: boolean;
71
+ style?: CSSProperties;
72
+ }
73
+
74
+ export interface IDropzoneItem {
75
+ /** Row root. `row` for a settled file, `div` while uploading. */
76
+ element: TDropzoneItemElement;
77
+ /** Props of that root (`id`, `textValue`, data attributes, drag shift). */
78
+ elementProps: IDropzoneItemElementProps;
79
+ /** File shown in the row. */
80
+ file: IDropzoneFile;
81
+ /** Control size. Sets the row height on the item root. */
82
+ size: TDropzoneSize;
83
+ /** Selected row paints the check. */
84
+ selected: boolean;
85
+ /** Grip label. Absent when reorder is off. */
86
+ gripLabel?: string;
87
+ /** Row actions. The grid card splits remove and dismiss onto the frame. */
88
+ actions: readonly IRowAction[];
89
+ /** Extra settled action from `renderAction`. */
90
+ action?: ReactNode;
91
+ /** Upload progress. `null` is indeterminate. Absent on a settled file. */
92
+ progress?: number | null;
93
+ /** Error caption. */
94
+ failedLabel?: string;
95
+ /** Replace caption. */
96
+ replaceLabel?: string;
97
+ }
98
+
99
+ export type TDropzoneVariant = 'primary';
100
+
101
+ /** Theme inputs. */
102
+ export interface IDropzoneThemeProps {
103
+ /** Control size. Inside Field, inherits `Field.size` when omitted. */
104
+ size?: TDropzoneSize;
105
+ /** Visual variant. */
106
+ variant?: TDropzoneVariant;
107
+ }
108
+
109
+ export type TDropzoneLayout = 'list' | 'grid';
110
+
111
+ /** Props of the file list. `list` receives them. */
112
+ export interface IFileListProps {
113
+ /** File element. The list passes the row model into it. */
114
+ item: ComponentType<IDropzoneItem>;
115
+ files: readonly IDropzoneFile[];
116
+ pending: readonly IPendingDropzoneFile[];
117
+ canReorder: boolean;
118
+ removable: boolean;
119
+ removeDisabled?: boolean;
120
+ disabled?: boolean;
121
+ selectable?: boolean;
122
+ selectedKeys?: ReadonlySet<string>;
123
+ onSelectionChange?: (keys: Set<string>) => void;
124
+ renderAction?: (file: IDropzoneFile) => ReactNode;
125
+ replacing?: boolean;
126
+ replaceTarget?: boolean;
127
+ flashId?: string | null;
128
+ willReplaceLabel: string;
129
+ focusId?: string | null;
130
+ size: TDropzoneSize;
131
+ listLabel: string;
132
+ removeLabel: string;
133
+ reorderLabel: string;
134
+ retryLabel: string;
135
+ cancelLabel: string;
136
+ replacingLabel: string;
137
+ failedLabel: string;
138
+ onRemove: (file: IDropzoneFile) => void;
139
+ onRetry: (id: string) => void;
140
+ onDismiss: (id: string) => void;
141
+ onCancel: (id: string) => void;
142
+ onReorder: (files: IDropzoneFile[]) => void;
143
+ }
144
+
145
+ /** Upload rows that are not in `value` yet. */
146
+ export interface IDropzonePendingState {
147
+ /** A file is still in flight. */
148
+ uploading: boolean;
149
+ /** A failed upload is still in the list. */
150
+ failed: boolean;
151
+ }
152
+
153
+ /** `true` on a key blocks that action. `false` and omission leave it on. */
154
+ export interface IDropzoneDisabledFlags {
155
+ add?: boolean;
156
+ remove?: boolean;
157
+ reorder?: boolean;
158
+ }
159
+
160
+ /** `true` blocks adding, removal, and reorder. An object blocks only the keys set to `true`. */
161
+ export type TDropzoneDisabled = boolean | IDropzoneDisabledFlags;
162
+
163
+ /** Server identity returned after `upload` resolves. */
164
+ export interface IDropzoneUploadResult {
165
+ /** Server id. Replaces the local id. */
166
+ id: string;
167
+ /** Download or preview address. */
168
+ url: string;
169
+ }
170
+
171
+ /** What `upload` receives besides the file. */
172
+ export interface IDropzoneUploadContext {
173
+ /** Reports 0–100. Omit the calls for an indeterminate bar. */
174
+ onProgress: (percent: number) => void;
175
+ /** Aborted when the row is cancelled. */
176
+ signal: AbortSignal;
177
+ }
178
+
179
+ /** Value and file rules. */
180
+ export interface IDropzoneControlProps {
181
+ /** Selected files. */
182
+ value?: IDropzoneFile[];
183
+ /** Initial files when `value` is omitted. */
184
+ defaultValue?: IDropzoneFile[];
185
+ /** Called with the next file list. */
186
+ onChange?: (files: IDropzoneFile[]) => void;
187
+ /** Called after a file was removed from the list. */
188
+ onRemove?: (file: IDropzoneFile) => void;
189
+ /** Allowed MIME types and extensions. */
190
+ accept?: Accept;
191
+ /** Max size of one file, in bytes. */
192
+ maxSize?: number;
193
+ /** Max size of the whole list, in bytes. Includes files still uploading. */
194
+ maxTotalSize?: number;
195
+ /** Max number of files. `1` replaces the current file. */
196
+ maxFiles?: number;
197
+ /** Max file name length. */
198
+ maxFileNameLength?: number;
199
+ /** Accept a file pasted into the focused zone. */
200
+ paste?: boolean;
201
+ /**
202
+ * `true` blocks adding, removal, and reorder.
203
+ * An object blocks only the flags set to `true`.
204
+ */
205
+ disabled?: TDropzoneDisabled;
206
+ /**
207
+ * Sends a file as soon as it is accepted.
208
+ * The file stays out of `value` until this resolves with `id` and `url`.
209
+ */
210
+ upload?: (file: File, context: IDropzoneUploadContext) => Promise<IDropzoneUploadResult>;
211
+ /**
212
+ * Custom refusal after type and size checks.
213
+ * A string keeps the file out and becomes the alert reason.
214
+ */
215
+ validate?: (file: File) => string | null | undefined | Promise<string | null | undefined>;
216
+ /** Fires when in-flight or failed uploads appear or clear. */
217
+ onPendingChange?: (state: IDropzonePendingState) => void;
218
+ }
219
+
220
+ /** Own / chrome props (not from DOM). */
221
+ export interface IDropzoneOwnProps extends IDataTestIdProps {
222
+ /** Ref to the dropzone root (React 19 prop). */
223
+ ref?: Ref<HTMLDivElement>;
224
+ /** Heading above the zone. */
225
+ title?: ReactNode;
226
+ /** Text under the heading and above the zone. */
227
+ description?: ReactNode;
228
+ /**
229
+ * Extra rule in the zone line, after accepted types and the per-file limit.
230
+ */
231
+ hint?: ReactNode;
232
+ /**
233
+ * Receives the local rejection line.
234
+ * When set, the line is not rendered inside the zone.
235
+ */
236
+ onRejectionChange?: (message: string) => void;
237
+ /** Renders an extra action for a settled file, next to remove. */
238
+ renderAction?: (file: IDropzoneFile) => ReactNode;
239
+ /** Show a loader instead of the file list. */
240
+ loading?: boolean;
241
+ /** `list` is a row. `grid` is a card. Picks `list` and `item` when those are omitted. */
242
+ layout?: TDropzoneLayout;
243
+ /** File list. Defaults from `layout`. */
244
+ list?: ComponentType<IFileListProps>;
245
+ /** File element. Defaults from `layout`. Passed into the list. */
246
+ item?: ComponentType<IDropzoneItem>;
247
+ }
248
+
249
+ export interface IDropzoneBaseProps
250
+ extends IDropzoneThemeProps, Omit<IFieldStateProps, 'disabled'>, IDropzoneControlProps, IDropzoneOwnProps {}
251
+
252
+ /** DOM keys omitted because names differ from ours. */
253
+ export type TDropzoneDomOmit = 'defaultValue' | 'onChange';
254
+
255
+ export interface IDropzoneProps
256
+ extends Omit<ComponentPropsWithRef<'div'>, keyof IDropzoneBaseProps | TDropzoneDomOmit>, IDropzoneBaseProps {}
257
+
258
+ /** Content slice for FormDropzone. */
259
+ export interface IDropzoneContentProps
260
+ extends
261
+ Omit<IDropzoneControlProps, 'value' | 'defaultValue' | 'onChange' | 'onPendingChange'>,
262
+ Pick<IDropzoneOwnProps, 'renderAction' | 'loading' | 'layout' | 'list' | 'item'> {}
263
+
264
+ export interface IFormDropzoneProps
265
+ extends Omit<IFormFieldLayoutProps, 'disabled'>, Pick<IDropzoneThemeProps, 'variant'>, IDropzoneContentProps {
266
+ /** Ref to the dropzone root (React 19 prop). */
267
+ ref?: Ref<HTMLDivElement>;
268
+ }
@@ -24,6 +24,16 @@ export interface IAuiLabels {
24
24
  moreSelected: string;
25
25
  /** DatePicker / DateRangePicker: open calendar button. */
26
26
  openCalendar: string;
27
+ /** ColorPicker: open the palette. */
28
+ openPalette: string;
29
+ /** ColorPicker: hex field accessible name. */
30
+ colorCode: string;
31
+ /** ColorPicker: hue slider accessible name. */
32
+ colorHue: string;
33
+ /** ColorPicker: palette dialog accessible name. */
34
+ colorPalette: string;
35
+ /** ColorPicker: preset swatch list accessible name. */
36
+ colorPresets: string;
27
37
  /** Table.PageSize: label before the select. */
28
38
  pageSize: string;
29
39
  /** Table.Pagination: previous-page control label. */
@@ -72,6 +82,72 @@ export interface IAuiLabels {
72
82
  copied: string;
73
83
  /** CopyButton: clipboard failure tooltip. */
74
84
  copyFailed: string;
85
+ /** Dropzone: zone instruction while the list is empty. */
86
+ dropzonePrompt: string;
87
+ /** Dropzone: kept for label overrides. The zone uses `dropzonePrompt`. */
88
+ dropzoneAdd: string;
89
+ /** Dropzone: remove-file button. */
90
+ dropzoneRemove: string;
91
+ /** Dropzone: file list accessible name. */
92
+ dropzoneList: string;
93
+ /** Dropzone: reorder handle. */
94
+ dropzoneReorder: string;
95
+ /** Dropzone: file exceeds `maxSize`. `{size}` is the limit. */
96
+ dropzoneTooBig: string;
97
+ /** Dropzone: size below 1 KB. `{size}` is a byte count. */
98
+ dropzoneByte: string;
99
+ /** Dropzone: size in kilobytes. `{size}` is the number. */
100
+ dropzoneKilobyte: string;
101
+ /** Dropzone: size in megabytes. `{size}` is the number. */
102
+ dropzoneMegabyte: string;
103
+ /** Dropzone: file type is outside `accept`. */
104
+ dropzoneBadType: string;
105
+ /** Dropzone: list is already at `maxFiles`. `{count}` is the limit. */
106
+ dropzoneTooMany: string;
107
+ /** Dropzone: file name is longer than `maxFileNameLength`. `{count}` is the limit. */
108
+ dropzoneNameLength: string;
109
+ /** Dropzone: a file with the same name is already in the list. */
110
+ dropzoneDuplicate: string;
111
+ /** Dropzone: rejection that has no specific copy. */
112
+ dropzoneRejected: string;
113
+ /** Dropzone: upload request failed. */
114
+ dropzoneUploadFailed: string;
115
+ /** Dropzone: retry a failed upload. */
116
+ dropzoneRetry: string;
117
+ /** Dropzone: hint under a multi-file list before the first selection. */
118
+ dropzoneSelectHint: string;
119
+ /** Dropzone: toolbar count. `{count}` selected, `{total}` in the list. */
120
+ dropzoneSelected: string;
121
+ /** Dropzone: select every settled file. */
122
+ dropzoneSelectAll: string;
123
+ /** Dropzone: remove the selection. */
124
+ dropzoneDeleteSelected: string;
125
+ /** Dropzone: live announcement. `{count}` is how many files left. */
126
+ dropzoneDeleted: string;
127
+ /** Dropzone: zone copy when `maxFiles` is 1 and a file is present. */
128
+ dropzoneReplace: string;
129
+ /** Dropzone: zone copy while a replacement is dragged. `{name}` is the current file. */
130
+ dropzoneReplaceDrop: string;
131
+ /** Dropzone: mark on the file a replacement upload will swap out. */
132
+ dropzoneReplacing: string;
133
+ /** Dropzone: file that a dragged file will replace. */
134
+ dropzoneWillReplace: string;
135
+ /** Dropzone: prefix when a replacement was refused. `{reason}` follows. */
136
+ dropzoneNotReplaced: string;
137
+ /** Dropzone: cancel an in-flight upload. */
138
+ dropzoneCancel: string;
139
+ /** Dropzone: file count quota. `{count}` used, `{max}` allowed. */
140
+ dropzoneQuotaCount: string;
141
+ /** Dropzone: byte quota. `{size}` and `{max}` are formatted. */
142
+ dropzoneQuotaBytes: string;
143
+ /** Dropzone: per-file ceiling. `{size}` is formatted. */
144
+ dropzonePerFile: string;
145
+ /** Dropzone: file does not fit `maxTotalSize`. `{name}`, `{size}` is the room left. */
146
+ dropzoneTotalTooBig: string;
147
+ /** Dropzone: the list is full. `{count}` and `{max}` are file counts. */
148
+ dropzoneLimitReached: string;
149
+ /** Dropzone: form message while a file is still uploading. */
150
+ dropzoneUploading: string;
75
151
  }
76
152
 
77
153
  export type TAuiLabels = IAuiLabels;
@@ -1,53 +0,0 @@
1
- import { createContext as i, useContext as o } from "react";
2
- const s = {
3
- close: "Закрыть",
4
- clear: "Очистить",
5
- confirm: "Подтвердить",
6
- cancel: "Отмена",
7
- delete: "Удалить",
8
- notDelete: "Не удалять",
9
- loading: "Загрузка",
10
- loadingSuggestions: "Загрузка подсказок",
11
- noSuggestions: "Ничего не найдено",
12
- suggestionsError: "Не удалось загрузить подсказки",
13
- moreSelected: "ещё выбрано",
14
- openCalendar: "Открыть календарь",
15
- pageSize: "Строк на странице",
16
- paginationPrev: "Назад",
17
- paginationNext: "Далее",
18
- paginationPage: "Страница {page}",
19
- paginationRange: "{from}–{to} из {total}",
20
- collapseSidebar: "Свернуть меню",
21
- expandSidebar: "Развернуть меню",
22
- resizeSidebar: "Изменить ширину меню",
23
- pinMenuItem: "Закрепить",
24
- unpinMenuItem: "Открепить",
25
- pinnedSection: "Закреплённые",
26
- pinnedSectionHint: "ПКМ по пункту меню, чтобы закрепить",
27
- searchMenu: "Поиск по меню",
28
- searchMenuEmpty: "Ничего не найдено",
29
- openInNewTab: "Открыть в новой вкладке",
30
- sortAscending: "По возрастанию",
31
- sortDescending: "По убыванию",
32
- moreActions: "Ещё действия",
33
- save: "Сохранить",
34
- arrangementList: "Элементы",
35
- clearFilters: "Очистить",
36
- copy: "Копировать",
37
- copied: "Скопировано: {value}",
38
- copyFailed: "Не удалось скопировать"
39
- }, t = i(null), e = () => {
40
- const n = o(t);
41
- if (!n)
42
- throw new Error("AdminUiProvider is required. Wrap the app with <AdminUiProvider>.");
43
- return n;
44
- }, r = () => e().labels, c = () => e().locale, l = () => e().direction, u = () => e().linkComponent ?? "a";
45
- export {
46
- t as A,
47
- l as a,
48
- u as b,
49
- c,
50
- s as d,
51
- r as u
52
- };
53
- //# sourceMappingURL=hooks-BlX5Y4Zt.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hooks-BlX5Y4Zt.js","sources":["../src/provider/context.ts","../src/provider/hooks.ts"],"sourcesContent":["import { createContext } from 'react';\n\nimport { type IAuiContextValue, type IAuiLabels } from './types';\n\nexport const defaultLabels: IAuiLabels = {\n close: 'Закрыть',\n clear: 'Очистить',\n confirm: 'Подтвердить',\n cancel: 'Отмена',\n delete: 'Удалить',\n notDelete: 'Не удалять',\n loading: 'Загрузка',\n loadingSuggestions: 'Загрузка подсказок',\n noSuggestions: 'Ничего не найдено',\n suggestionsError: 'Не удалось загрузить подсказки',\n moreSelected: 'ещё выбрано',\n openCalendar: 'Открыть календарь',\n pageSize: 'Строк на странице',\n paginationPrev: 'Назад',\n paginationNext: 'Далее',\n paginationPage: 'Страница {page}',\n paginationRange: '{from}–{to} из {total}',\n collapseSidebar: 'Свернуть меню',\n expandSidebar: 'Развернуть меню',\n resizeSidebar: 'Изменить ширину меню',\n pinMenuItem: 'Закрепить',\n unpinMenuItem: 'Открепить',\n pinnedSection: 'Закреплённые',\n pinnedSectionHint: 'ПКМ по пункту меню, чтобы закрепить',\n searchMenu: 'Поиск по меню',\n searchMenuEmpty: 'Ничего не найдено',\n openInNewTab: 'Открыть в новой вкладке',\n sortAscending: 'По возрастанию',\n sortDescending: 'По убыванию',\n moreActions: 'Ещё действия',\n save: 'Сохранить',\n arrangementList: 'Элементы',\n clearFilters: 'Очистить',\n copy: 'Копировать',\n copied: 'Скопировано: {value}',\n copyFailed: 'Не удалось скопировать',\n};\n\nexport const AuiContext = createContext<IAuiContextValue | null>(null);\n","import { useContext } from 'react';\n\nimport { AuiContext } from './context';\nimport { type IAuiContextValue, type IAuiLabels, type TAuiLinkComponent, type TTextDirection } from './types';\n\nconst useAuiContext = (): IAuiContextValue => {\n const context = useContext(AuiContext);\n\n if (!context) {\n throw new Error('AdminUiProvider is required. Wrap the app with <AdminUiProvider>.');\n }\n\n return context;\n};\n\nexport const useAuiLabels = (): IAuiLabels => useAuiContext().labels;\n\nexport const useAuiLocale = (): string => useAuiContext().locale;\n\nexport const useAuiDirection = (): TTextDirection => useAuiContext().direction;\n\n/** Host router link from AdminUiProvider. Defaults to `a`. */\nexport const useAuiLink = (): TAuiLinkComponent => useAuiContext().linkComponent ?? 'a';\n"],"names":["defaultLabels","AuiContext","createContext","useAuiContext","context","useContext","useAuiLabels","useAuiLocale","useAuiDirection","useAuiLink"],"mappings":";AAIO,MAAMA,IAA4B;AAAA,EACrC,OAAO;AAAA,EACP,OAAO;AAAA,EACP,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,SAAS;AAAA,EACT,oBAAoB;AAAA,EACpB,eAAe;AAAA,EACf,kBAAkB;AAAA,EAClB,cAAc;AAAA,EACd,cAAc;AAAA,EACd,UAAU;AAAA,EACV,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,EACjB,iBAAiB;AAAA,EACjB,eAAe;AAAA,EACf,eAAe;AAAA,EACf,aAAa;AAAA,EACb,eAAe;AAAA,EACf,eAAe;AAAA,EACf,mBAAmB;AAAA,EACnB,YAAY;AAAA,EACZ,iBAAiB;AAAA,EACjB,cAAc;AAAA,EACd,eAAe;AAAA,EACf,gBAAgB;AAAA,EAChB,aAAa;AAAA,EACb,MAAM;AAAA,EACN,iBAAiB;AAAA,EACjB,cAAc;AAAA,EACd,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,YAAY;AAChB,GAEaC,IAAaC,EAAuC,IAAI,GCtC/DC,IAAgB,MAAwB;AAC1C,QAAMC,IAAUC,EAAWJ,CAAU;AAErC,MAAI,CAACG;AACD,UAAM,IAAI,MAAM,mEAAmE;AAGvF,SAAOA;AACX,GAEaE,IAAe,MAAkBH,IAAgB,QAEjDI,IAAe,MAAcJ,IAAgB,QAE7CK,IAAkB,MAAsBL,IAAgB,WAGxDM,IAAa,MAAyBN,EAAA,EAAgB,iBAAiB;"}
@@ -1,52 +0,0 @@
1
- import { createContext as x, useContext as y, useCallback as l } from "react";
2
- import { useFormContext as b, useController as B } from "react-hook-form";
3
- const m = x(void 0), w = () => {
4
- const o = y(m);
5
- if (!o)
6
- throw new Error("This component must be used within a <Form> component");
7
- return o;
8
- }, T = (o) => Array.isArray(o) ? o[0] : o, a = (o, e) => typeof o == "boolean" ? o : o == null ? !1 : o[e] ?? !1, k = ({ name: o }) => {
9
- const { onChange: e, onBlur: c, disabled: d, readOnly: f } = w(), { control: C, setValue: F } = b(), { field: t, fieldState: g } = B({
10
- name: o,
11
- control: C
12
- }), i = l(
13
- (r) => {
14
- t.onBlur();
15
- const n = r?.currentTarget, u = n && "value" in n && typeof n.value == "string" ? n.value : t.value;
16
- c(o, u);
17
- },
18
- [t, o, c]
19
- ), p = {
20
- name: o,
21
- onBlur: i,
22
- disabled: a(d, o),
23
- readOnly: a(f, o) || void 0
24
- }, s = l(
25
- (r) => {
26
- t.onChange(r), e(o, r);
27
- },
28
- [t, o, e]
29
- ), h = l(
30
- (r, n) => {
31
- if (n !== void 0) {
32
- s(n);
33
- return;
34
- }
35
- if (!r)
36
- return;
37
- t.onChange(r);
38
- const u = r.currentTarget, { value: v } = u;
39
- e(o, v);
40
- },
41
- [t, o, e, s]
42
- );
43
- return { field: t, onChange: e, setValue: F, fieldState: g, inputProps: p, setFieldValue: s, onChangeHandler: h, onBlurHandler: i };
44
- };
45
- export {
46
- m as F,
47
- w as a,
48
- T as g,
49
- a as r,
50
- k as u
51
- };
52
- //# sourceMappingURL=useFieldHook-Bt9nST7g.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useFieldHook-Bt9nST7g.js","sources":["../src/form/context.ts","../src/form/utils.ts","../src/form/hooks/useFieldHook.ts"],"sourcesContent":["import { type BaseSyntheticEvent, createContext, useContext } from 'react';\n\nimport { type NativeFieldValue } from 'react-hook-form';\n\nimport { type TFormFieldFlag } from './types';\n\nexport interface IFormContextValue {\n onChange: (key: string, value: NativeFieldValue) => void;\n onBlur: (key: string, value: NativeFieldValue) => void;\n onSubmitHandler: (event?: BaseSyntheticEvent) => void;\n disabled?: TFormFieldFlag;\n readOnly?: TFormFieldFlag;\n}\n\nexport const FormContext = createContext<IFormContextValue | undefined>(undefined);\n\nexport const useAuiForm = (): IFormContextValue => {\n const context = useContext(FormContext);\n\n if (!context) {\n throw new Error('This component must be used within a <Form> component');\n }\n\n return context;\n};\n","import { type FieldError } from 'react-hook-form';\n\nimport { type TFormFieldFlag } from './types';\n\nexport const getError = (value?: FieldError) => (Array.isArray(value) ? value[0] : value);\n\n/** Resolves a form-level boolean or a per-field map. Keys are exact RHF names. */\nexport const resolveFieldFlag = (flag: TFormFieldFlag | undefined, name: string): boolean => {\n if (typeof flag === 'boolean') {\n return flag;\n }\n\n if (flag == null) {\n return false;\n }\n\n return flag[name] ?? false;\n};\n","import { type FocusEvent, type SyntheticEvent, useCallback } from 'react';\n\nimport { type NativeFieldValue, useController, useFormContext } from 'react-hook-form';\n\nimport { useAuiForm } from '../context';\nimport { type IFormFieldComponent } from '../types';\nimport { resolveFieldFlag } from '../utils';\n\n/** Builds controlled field wiring by `name` for FormInput / FormSelect / …. */\nexport const useFieldHook = <TElement extends HTMLElement = HTMLElement>({ name }: IFormFieldComponent) => {\n const { onChange, onBlur: onFormBlur, disabled, readOnly } = useAuiForm();\n const { control, setValue } = useFormContext();\n\n const { field, fieldState } = useController({\n name,\n control,\n });\n\n const onBlurHandler = useCallback(\n (e?: FocusEvent<TElement>) => {\n field.onBlur();\n const target = e?.currentTarget;\n const value = target && 'value' in target && typeof target.value === 'string' ? target.value : field.value;\n onFormBlur(name, value);\n },\n [field, name, onFormBlur]\n );\n\n const inputProps = {\n name,\n onBlur: onBlurHandler,\n disabled: resolveFieldFlag(disabled, name),\n readOnly: resolveFieldFlag(readOnly, name) || undefined,\n };\n\n const setFieldValue = useCallback(\n (value: NativeFieldValue) => {\n field.onChange(value);\n onChange(name, value);\n },\n [field, name, onChange]\n );\n\n const onChangeHandler = useCallback(\n <T extends HTMLInputElement | HTMLTextAreaElement, E extends Event>(\n e?: SyntheticEvent<T, E>,\n val?: NativeFieldValue\n ) => {\n if (val !== undefined) {\n setFieldValue(val);\n return;\n }\n\n if (!e) {\n return;\n }\n\n field.onChange(e);\n const target = e.currentTarget;\n const { value } = target as HTMLInputElement | HTMLTextAreaElement;\n onChange(name, value);\n },\n [field, name, onChange, setFieldValue]\n );\n\n return { field, onChange, setValue, fieldState, inputProps, setFieldValue, onChangeHandler, onBlurHandler };\n};\n"],"names":["FormContext","createContext","useAuiForm","context","useContext","getError","value","resolveFieldFlag","flag","name","useFieldHook","onChange","onFormBlur","disabled","readOnly","control","setValue","useFormContext","field","fieldState","useController","onBlurHandler","useCallback","e","target","inputProps","setFieldValue","onChangeHandler","val"],"mappings":";;AAcO,MAAMA,IAAcC,EAA6C,MAAS,GAEpEC,IAAa,MAAyB;AAC/C,QAAMC,IAAUC,EAAWJ,CAAW;AAEtC,MAAI,CAACG;AACD,UAAM,IAAI,MAAM,uDAAuD;AAG3E,SAAOA;AACX,GCpBaE,IAAW,CAACC,MAAwB,MAAM,QAAQA,CAAK,IAAIA,EAAM,CAAC,IAAIA,GAGtEC,IAAmB,CAACC,GAAkCC,MAC3D,OAAOD,KAAS,YACTA,IAGPA,KAAQ,OACD,KAGJA,EAAKC,CAAI,KAAK,ICPZC,IAAe,CAA6C,EAAE,MAAAD,QAAgC;AACvG,QAAM,EAAE,UAAAE,GAAU,QAAQC,GAAY,UAAAC,GAAU,UAAAC,EAAA,IAAaZ,EAAA,GACvD,EAAE,SAAAa,GAAS,UAAAC,EAAA,IAAaC,EAAA,GAExB,EAAE,OAAAC,GAAO,YAAAC,EAAA,IAAeC,EAAc;AAAA,IACxC,MAAAX;AAAA,IACA,SAAAM;AAAA,EAAA,CACH,GAEKM,IAAgBC;AAAA,IAClB,CAACC,MAA6B;AAC1B,MAAAL,EAAM,OAAA;AACN,YAAMM,IAASD,GAAG,eACZjB,IAAQkB,KAAU,WAAWA,KAAU,OAAOA,EAAO,SAAU,WAAWA,EAAO,QAAQN,EAAM;AACrG,MAAAN,EAAWH,GAAMH,CAAK;AAAA,IAC1B;AAAA,IACA,CAACY,GAAOT,GAAMG,CAAU;AAAA,EAAA,GAGtBa,IAAa;AAAA,IACf,MAAAhB;AAAA,IACA,QAAQY;AAAA,IACR,UAAUd,EAAiBM,GAAUJ,CAAI;AAAA,IACzC,UAAUF,EAAiBO,GAAUL,CAAI,KAAK;AAAA,EAAA,GAG5CiB,IAAgBJ;AAAA,IAClB,CAAChB,MAA4B;AACzB,MAAAY,EAAM,SAASZ,CAAK,GACpBK,EAASF,GAAMH,CAAK;AAAA,IACxB;AAAA,IACA,CAACY,GAAOT,GAAME,CAAQ;AAAA,EAAA,GAGpBgB,IAAkBL;AAAA,IACpB,CACIC,GACAK,MACC;AACD,UAAIA,MAAQ,QAAW;AACnB,QAAAF,EAAcE,CAAG;AACjB;AAAA,MACJ;AAEA,UAAI,CAACL;AACD;AAGJ,MAAAL,EAAM,SAASK,CAAC;AAChB,YAAMC,IAASD,EAAE,eACX,EAAE,OAAAjB,MAAUkB;AAClB,MAAAb,EAASF,GAAMH,CAAK;AAAA,IACxB;AAAA,IACA,CAACY,GAAOT,GAAME,GAAUe,CAAa;AAAA,EAAA;AAGzC,SAAO,EAAE,OAAAR,GAAO,UAAAP,GAAU,UAAAK,GAAU,YAAAG,GAAY,YAAAM,GAAY,eAAAC,GAAe,iBAAAC,GAAiB,eAAAN,EAAA;AAChG;"}