@techsio/ui-kit 0.42.0 → 0.44.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.
- package/dist/molecules/cascade-select.js +508 -0
- package/dist/molecules/file-upload.js +369 -0
- package/dist/src/molecules/cascade-select.d.ts +231 -0
- package/dist/src/molecules/cascade-select.d.ts.map +1 -0
- package/dist/src/molecules/file-upload.d.ts +84 -0
- package/dist/src/molecules/file-upload.d.ts.map +1 -0
- package/dist/src/types/zag.d.ts +2 -0
- package/dist/src/types/zag.d.ts.map +1 -1
- package/dist/stories/changelog/changelog.stories.d.ts.map +1 -1
- package/dist/stories/molecules/cascade-select.stories.d.ts +254 -0
- package/dist/stories/molecules/cascade-select.stories.d.ts.map +1 -0
- package/dist/stories/molecules/file-upload.stories.d.ts +105 -0
- package/dist/stories/molecules/file-upload.stories.d.ts.map +1 -0
- package/dist/test/cascade-select.behavior.spec.d.ts +2 -0
- package/dist/test/cascade-select.behavior.spec.d.ts.map +1 -0
- package/package.json +3 -1
- package/src/tokens/components/components.css +2 -0
- package/src/tokens/components/molecules/_cascade-select.css +66 -0
- package/src/tokens/components/molecules/_file-upload.css +128 -0
- package/src/tokens/figma/brand-overrides.css +2 -2
- package/src/tokens/figma/business/variables.css +3 -2
- package/src/tokens/figma/dark/variables.css +1 -0
- package/src/tokens/figma/light/variables.css +3 -2
- package/src/tokens/figma/neo/variables.css +3 -2
- package/src/tokens/figma/neo-dark/variables.css +1 -0
- package/src/tokens/figma/variables.css +3 -2
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { connect, machine } from "@zag-js/file-upload";
|
|
3
|
+
import { mergeProps, normalizeProps, useMachine } from "@zag-js/react";
|
|
4
|
+
import { createContext, useContext, useEffect, useId, useRef, useState } from "react";
|
|
5
|
+
import { ActionIcon } from "../atoms/action-icon.js";
|
|
6
|
+
import { Button } from "../atoms/button.js";
|
|
7
|
+
import { Icon } from "../atoms/icon.js";
|
|
8
|
+
import { Image } from "../atoms/image.js";
|
|
9
|
+
import { Label } from "../atoms/label.js";
|
|
10
|
+
import { tv } from "../utils.js";
|
|
11
|
+
const fileUploadStyles = tv({
|
|
12
|
+
slots: {
|
|
13
|
+
root: "flex w-full flex-col items-start gap-file-upload-root",
|
|
14
|
+
label: [
|
|
15
|
+
"font-file-upload-label text-file-upload-label text-file-upload-label-fg",
|
|
16
|
+
"data-disabled:text-file-upload-label-disabled-fg"
|
|
17
|
+
],
|
|
18
|
+
dropzone: [
|
|
19
|
+
"flex min-h-file-upload-dropzone-min-height w-full cursor-pointer flex-col items-center justify-center gap-file-upload-dropzone",
|
|
20
|
+
"file-upload-dropzone-border-dashed file-upload-dropzone-border-width rounded-file-upload-dropzone border-file-upload-dropzone-border bg-file-upload-dropzone-bg p-file-upload-dropzone",
|
|
21
|
+
"transition-colors hover:bg-file-upload-dropzone-hover-bg motion-reduce:transition-none",
|
|
22
|
+
"focus-visible:file-upload-focus",
|
|
23
|
+
"data-dragging:file-upload-dropzone-border-solid data-dragging:border-file-upload-dropzone-dragging-border data-dragging:bg-file-upload-dropzone-dragging-bg",
|
|
24
|
+
"data-invalid:border-file-upload-dropzone-invalid-border",
|
|
25
|
+
"data-disabled:cursor-not-allowed data-disabled:border-file-upload-dropzone-disabled-border data-disabled:bg-file-upload-dropzone-disabled-bg",
|
|
26
|
+
"data-readonly:cursor-default"
|
|
27
|
+
],
|
|
28
|
+
trigger: "",
|
|
29
|
+
itemGroup: "flex w-full flex-col gap-file-upload-item-group empty:hidden",
|
|
30
|
+
item: [
|
|
31
|
+
"flex w-full items-center gap-file-upload-item",
|
|
32
|
+
"file-upload-item-border-width rounded-file-upload-item border-file-upload-item-border bg-file-upload-item-bg p-file-upload-item text-file-upload-item",
|
|
33
|
+
"data-[type=rejected]:border-file-upload-item-rejected-border data-[type=rejected]:bg-file-upload-item-rejected-bg",
|
|
34
|
+
"data-disabled:text-file-upload-item-disabled-fg"
|
|
35
|
+
],
|
|
36
|
+
itemPreview: [
|
|
37
|
+
"flex size-file-upload-item-preview shrink-0 items-center justify-center overflow-hidden rounded-file-upload-item-preview text-file-upload-item-preview-fg",
|
|
38
|
+
"data-disabled:text-file-upload-item-disabled-fg"
|
|
39
|
+
],
|
|
40
|
+
itemPreviewImage: "size-full object-cover",
|
|
41
|
+
itemName: [
|
|
42
|
+
"min-w-0 flex-1 truncate font-file-upload-item-name text-file-upload-item-name-fg",
|
|
43
|
+
"data-disabled:text-file-upload-item-disabled-fg"
|
|
44
|
+
],
|
|
45
|
+
itemSizeText: [
|
|
46
|
+
"text-file-upload-item-size text-file-upload-item-size-fg",
|
|
47
|
+
"data-disabled:text-file-upload-item-disabled-fg"
|
|
48
|
+
],
|
|
49
|
+
itemDeleteTrigger: "",
|
|
50
|
+
clearTrigger: ""
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
const FileUploadContext = /*#__PURE__*/ createContext(null);
|
|
54
|
+
function useFileUploadContext() {
|
|
55
|
+
const context = useContext(FileUploadContext);
|
|
56
|
+
if (!context) throw new Error("FileUpload components must be used within FileUpload.Root");
|
|
57
|
+
return context;
|
|
58
|
+
}
|
|
59
|
+
const FileUploadItemGroupContext = /*#__PURE__*/ createContext(null);
|
|
60
|
+
function useFileUploadItemGroupContext() {
|
|
61
|
+
const context = useContext(FileUploadItemGroupContext);
|
|
62
|
+
if (!context) throw new Error("FileUpload.Item must be used within FileUpload.ItemGroup");
|
|
63
|
+
return context;
|
|
64
|
+
}
|
|
65
|
+
const FileUploadItemContext = /*#__PURE__*/ createContext(null);
|
|
66
|
+
function useFileUploadItemContext() {
|
|
67
|
+
const context = useContext(FileUploadItemContext);
|
|
68
|
+
if (!context) throw new Error("FileUpload item components must be used within FileUpload.Item");
|
|
69
|
+
return context;
|
|
70
|
+
}
|
|
71
|
+
function FileUpload({ accept, acceptedFiles, allowDrop, capture, children, className, defaultAcceptedFiles, dir = "ltr", directory, disabled, getRootNode, id, ids, invalid, locale, maxFileSize, maxFiles, minFileSize, name, onFileAccept, onFileChange, onFileReject, preventDocumentDrop, readOnly, ref, required, transformFiles, translations, validate, ...props }) {
|
|
72
|
+
const generatedId = useId();
|
|
73
|
+
const service = useMachine(machine, {
|
|
74
|
+
accept,
|
|
75
|
+
acceptedFiles,
|
|
76
|
+
allowDrop,
|
|
77
|
+
capture,
|
|
78
|
+
defaultAcceptedFiles,
|
|
79
|
+
dir,
|
|
80
|
+
directory,
|
|
81
|
+
disabled,
|
|
82
|
+
getRootNode,
|
|
83
|
+
id: id ?? generatedId,
|
|
84
|
+
ids,
|
|
85
|
+
invalid,
|
|
86
|
+
locale,
|
|
87
|
+
maxFileSize,
|
|
88
|
+
maxFiles,
|
|
89
|
+
minFileSize,
|
|
90
|
+
name,
|
|
91
|
+
onFileAccept,
|
|
92
|
+
onFileChange,
|
|
93
|
+
onFileReject,
|
|
94
|
+
preventDocumentDrop,
|
|
95
|
+
readOnly,
|
|
96
|
+
required,
|
|
97
|
+
transformFiles,
|
|
98
|
+
translations,
|
|
99
|
+
validate
|
|
100
|
+
});
|
|
101
|
+
const api = connect(service, normalizeProps);
|
|
102
|
+
const styles = fileUploadStyles();
|
|
103
|
+
const rootProps = mergeProps(props, api.getRootProps());
|
|
104
|
+
return /*#__PURE__*/ jsx(FileUploadContext.Provider, {
|
|
105
|
+
value: {
|
|
106
|
+
api,
|
|
107
|
+
required,
|
|
108
|
+
styles
|
|
109
|
+
},
|
|
110
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
111
|
+
className: styles.root({
|
|
112
|
+
className
|
|
113
|
+
}),
|
|
114
|
+
ref: ref,
|
|
115
|
+
...rootProps,
|
|
116
|
+
children: children
|
|
117
|
+
})
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
FileUpload.Context = function({ children }) {
|
|
121
|
+
const { api } = useFileUploadContext();
|
|
122
|
+
return children(api);
|
|
123
|
+
};
|
|
124
|
+
FileUpload.Label = function({ children, className, ref, ...props }) {
|
|
125
|
+
const { api, required, styles } = useFileUploadContext();
|
|
126
|
+
const labelProps = mergeProps({
|
|
127
|
+
ref
|
|
128
|
+
}, props, api.getLabelProps());
|
|
129
|
+
return /*#__PURE__*/ jsx(Label, {
|
|
130
|
+
className: styles.label({
|
|
131
|
+
className
|
|
132
|
+
}),
|
|
133
|
+
required: required,
|
|
134
|
+
size: "current",
|
|
135
|
+
...labelProps,
|
|
136
|
+
children: children
|
|
137
|
+
});
|
|
138
|
+
};
|
|
139
|
+
FileUpload.Dropzone = function({ children, className, disableClick, onClick, onKeyDown, ref, ...props }) {
|
|
140
|
+
const { api, styles } = useFileUploadContext();
|
|
141
|
+
const { onClick: onMachineClick, onKeyDown: onMachineKeyDown, ...machineDropzoneProps } = api.getDropzoneProps({
|
|
142
|
+
disableClick
|
|
143
|
+
});
|
|
144
|
+
const dropzoneProps = mergeProps(props, machineDropzoneProps, {
|
|
145
|
+
onClick (event) {
|
|
146
|
+
onClick?.(event);
|
|
147
|
+
if (!event.defaultPrevented) onMachineClick?.(event);
|
|
148
|
+
},
|
|
149
|
+
onKeyDown (event) {
|
|
150
|
+
onKeyDown?.(event);
|
|
151
|
+
if (!event.defaultPrevented) onMachineKeyDown?.(event);
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
return /*#__PURE__*/ jsx("div", {
|
|
155
|
+
className: styles.dropzone({
|
|
156
|
+
className
|
|
157
|
+
}),
|
|
158
|
+
ref: ref,
|
|
159
|
+
...dropzoneProps,
|
|
160
|
+
children: children
|
|
161
|
+
});
|
|
162
|
+
};
|
|
163
|
+
FileUpload.HiddenInput = function({ ref, ...props }) {
|
|
164
|
+
const { api } = useFileUploadContext();
|
|
165
|
+
const inputProps = mergeProps(props, api.getHiddenInputProps());
|
|
166
|
+
return /*#__PURE__*/ jsx("input", {
|
|
167
|
+
ref: ref,
|
|
168
|
+
...inputProps
|
|
169
|
+
});
|
|
170
|
+
};
|
|
171
|
+
FileUpload.Trigger = function({ children, className, disabled, icon = "token-icon-file-upload-trigger", onClick, ref, ...props }) {
|
|
172
|
+
const { api, styles } = useFileUploadContext();
|
|
173
|
+
const { disabled: machineDisabled, onClick: onMachineClick, ...machineTriggerProps } = api.getTriggerProps();
|
|
174
|
+
const triggerProps = mergeProps(props, machineTriggerProps);
|
|
175
|
+
const isDisabled = Boolean(disabled || machineDisabled);
|
|
176
|
+
return /*#__PURE__*/ jsx(Button, {
|
|
177
|
+
className: styles.trigger({
|
|
178
|
+
className
|
|
179
|
+
}),
|
|
180
|
+
disabled: isDisabled,
|
|
181
|
+
icon: icon,
|
|
182
|
+
onClick: (event)=>{
|
|
183
|
+
onClick?.(event);
|
|
184
|
+
if (!event.defaultPrevented) onMachineClick?.(event);
|
|
185
|
+
},
|
|
186
|
+
ref: ref,
|
|
187
|
+
size: "md",
|
|
188
|
+
theme: "outlined",
|
|
189
|
+
type: "button",
|
|
190
|
+
variant: "primary",
|
|
191
|
+
...triggerProps,
|
|
192
|
+
children: children
|
|
193
|
+
});
|
|
194
|
+
};
|
|
195
|
+
FileUpload.ItemGroup = function({ children, className, ref, type = "accepted", ...props }) {
|
|
196
|
+
const { api, styles } = useFileUploadContext();
|
|
197
|
+
const itemGroupProps = mergeProps(props, api.getItemGroupProps({
|
|
198
|
+
type
|
|
199
|
+
}));
|
|
200
|
+
return /*#__PURE__*/ jsx(FileUploadItemGroupContext.Provider, {
|
|
201
|
+
value: {
|
|
202
|
+
type
|
|
203
|
+
},
|
|
204
|
+
children: /*#__PURE__*/ jsx("ul", {
|
|
205
|
+
className: styles.itemGroup({
|
|
206
|
+
className
|
|
207
|
+
}),
|
|
208
|
+
ref: ref,
|
|
209
|
+
...itemGroupProps,
|
|
210
|
+
children: children
|
|
211
|
+
})
|
|
212
|
+
});
|
|
213
|
+
};
|
|
214
|
+
FileUpload.Item = function({ children, className, file, ref, ...props }) {
|
|
215
|
+
const { api, styles } = useFileUploadContext();
|
|
216
|
+
const { type } = useFileUploadItemGroupContext();
|
|
217
|
+
const itemProps = mergeProps(props, api.getItemProps({
|
|
218
|
+
file,
|
|
219
|
+
type
|
|
220
|
+
}));
|
|
221
|
+
return /*#__PURE__*/ jsx(FileUploadItemContext.Provider, {
|
|
222
|
+
value: {
|
|
223
|
+
file,
|
|
224
|
+
type
|
|
225
|
+
},
|
|
226
|
+
children: /*#__PURE__*/ jsx("li", {
|
|
227
|
+
className: styles.item({
|
|
228
|
+
className
|
|
229
|
+
}),
|
|
230
|
+
ref: ref,
|
|
231
|
+
...itemProps,
|
|
232
|
+
children: children
|
|
233
|
+
})
|
|
234
|
+
});
|
|
235
|
+
};
|
|
236
|
+
FileUpload.ItemPreview = function({ children, className, ref, ...props }) {
|
|
237
|
+
const { api, styles } = useFileUploadContext();
|
|
238
|
+
const { file, type } = useFileUploadItemContext();
|
|
239
|
+
const previewProps = mergeProps(props, api.getItemPreviewProps({
|
|
240
|
+
file,
|
|
241
|
+
type
|
|
242
|
+
}));
|
|
243
|
+
return /*#__PURE__*/ jsx("div", {
|
|
244
|
+
className: styles.itemPreview({
|
|
245
|
+
className
|
|
246
|
+
}),
|
|
247
|
+
ref: ref,
|
|
248
|
+
...previewProps,
|
|
249
|
+
children: children ?? /*#__PURE__*/ jsx(Icon, {
|
|
250
|
+
icon: "token-icon-file-upload-preview",
|
|
251
|
+
size: "lg"
|
|
252
|
+
})
|
|
253
|
+
});
|
|
254
|
+
};
|
|
255
|
+
FileUpload.ItemPreviewImage = function({ className, ref, ...props }) {
|
|
256
|
+
const { api, styles } = useFileUploadContext();
|
|
257
|
+
const { file, type } = useFileUploadItemContext();
|
|
258
|
+
const apiRef = useRef(api);
|
|
259
|
+
const [url, setUrl] = useState();
|
|
260
|
+
apiRef.current = api;
|
|
261
|
+
useEffect(()=>{
|
|
262
|
+
setUrl(void 0);
|
|
263
|
+
return apiRef.current.createFileUrl(file, setUrl);
|
|
264
|
+
}, [
|
|
265
|
+
file
|
|
266
|
+
]);
|
|
267
|
+
if (!url) return null;
|
|
268
|
+
const imageProps = mergeProps({
|
|
269
|
+
ref
|
|
270
|
+
}, props, api.getItemPreviewImageProps({
|
|
271
|
+
file,
|
|
272
|
+
type,
|
|
273
|
+
url
|
|
274
|
+
}));
|
|
275
|
+
const { alt, src, ...imageElementProps } = imageProps;
|
|
276
|
+
return /*#__PURE__*/ jsx(Image, {
|
|
277
|
+
alt: alt ?? file.name,
|
|
278
|
+
className: styles.itemPreviewImage({
|
|
279
|
+
className
|
|
280
|
+
}),
|
|
281
|
+
size: "custom",
|
|
282
|
+
src: src ?? url,
|
|
283
|
+
...imageElementProps
|
|
284
|
+
});
|
|
285
|
+
};
|
|
286
|
+
FileUpload.ItemName = function({ children, className, ref, ...props }) {
|
|
287
|
+
const { api, styles } = useFileUploadContext();
|
|
288
|
+
const { file, type } = useFileUploadItemContext();
|
|
289
|
+
const nameProps = mergeProps(props, api.getItemNameProps({
|
|
290
|
+
file,
|
|
291
|
+
type
|
|
292
|
+
}));
|
|
293
|
+
return /*#__PURE__*/ jsx("span", {
|
|
294
|
+
className: styles.itemName({
|
|
295
|
+
className
|
|
296
|
+
}),
|
|
297
|
+
ref: ref,
|
|
298
|
+
...nameProps,
|
|
299
|
+
children: children ?? file.name
|
|
300
|
+
});
|
|
301
|
+
};
|
|
302
|
+
FileUpload.ItemSizeText = function({ children, className, ref, ...props }) {
|
|
303
|
+
const { api, styles } = useFileUploadContext();
|
|
304
|
+
const { file, type } = useFileUploadItemContext();
|
|
305
|
+
const sizeTextProps = mergeProps(props, api.getItemSizeTextProps({
|
|
306
|
+
file,
|
|
307
|
+
type
|
|
308
|
+
}));
|
|
309
|
+
return /*#__PURE__*/ jsx("span", {
|
|
310
|
+
className: styles.itemSizeText({
|
|
311
|
+
className
|
|
312
|
+
}),
|
|
313
|
+
ref: ref,
|
|
314
|
+
...sizeTextProps,
|
|
315
|
+
children: children ?? api.getFileSize(file)
|
|
316
|
+
});
|
|
317
|
+
};
|
|
318
|
+
FileUpload.ItemDeleteTrigger = function({ className, disabled, icon = "token-icon-file-upload-delete", onClick, ref, ...props }) {
|
|
319
|
+
const { api, styles } = useFileUploadContext();
|
|
320
|
+
const { file, type } = useFileUploadItemContext();
|
|
321
|
+
const { disabled: machineDisabled, onClick: onMachineClick, ...machineDeleteProps } = api.getItemDeleteTriggerProps({
|
|
322
|
+
file,
|
|
323
|
+
type
|
|
324
|
+
});
|
|
325
|
+
const deleteProps = mergeProps(props, machineDeleteProps);
|
|
326
|
+
const isDisabled = Boolean(disabled || machineDisabled);
|
|
327
|
+
return /*#__PURE__*/ jsx(ActionIcon, {
|
|
328
|
+
className: styles.itemDeleteTrigger({
|
|
329
|
+
className
|
|
330
|
+
}),
|
|
331
|
+
disabled: isDisabled,
|
|
332
|
+
icon: icon,
|
|
333
|
+
onClick: (event)=>{
|
|
334
|
+
onClick?.(event);
|
|
335
|
+
if (!event.defaultPrevented) onMachineClick?.(event);
|
|
336
|
+
},
|
|
337
|
+
ref: ref,
|
|
338
|
+
size: "md",
|
|
339
|
+
tone: "neutral",
|
|
340
|
+
type: "button",
|
|
341
|
+
...deleteProps
|
|
342
|
+
});
|
|
343
|
+
};
|
|
344
|
+
FileUpload.ClearTrigger = function({ "aria-label": ariaLabel = "Clear files", className, disabled, icon = "token-icon-file-upload-clear", onClick, ref, ...props }) {
|
|
345
|
+
const { api, styles } = useFileUploadContext();
|
|
346
|
+
const { disabled: machineDisabled, onClick: onMachineClick, ...machineClearProps } = api.getClearTriggerProps();
|
|
347
|
+
const clearProps = mergeProps(props, machineClearProps);
|
|
348
|
+
const isDisabled = Boolean(disabled || machineDisabled);
|
|
349
|
+
return /*#__PURE__*/ jsx(ActionIcon, {
|
|
350
|
+
"aria-label": ariaLabel,
|
|
351
|
+
className: styles.clearTrigger({
|
|
352
|
+
className
|
|
353
|
+
}),
|
|
354
|
+
disabled: isDisabled,
|
|
355
|
+
icon: icon,
|
|
356
|
+
onClick: (event)=>{
|
|
357
|
+
onClick?.(event);
|
|
358
|
+
if (!event.defaultPrevented) onMachineClick?.(event);
|
|
359
|
+
},
|
|
360
|
+
ref: ref,
|
|
361
|
+
size: "md",
|
|
362
|
+
tone: "neutral",
|
|
363
|
+
type: "button",
|
|
364
|
+
...clearProps
|
|
365
|
+
});
|
|
366
|
+
};
|
|
367
|
+
FileUpload.Root = FileUpload;
|
|
368
|
+
FileUpload.displayName = "FileUpload";
|
|
369
|
+
export { FileUpload };
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CascadeSelect — @techsio/ui-kit molecule.
|
|
3
|
+
*
|
|
4
|
+
* @component CascadeSelect
|
|
5
|
+
* @componentVersion v1.0.1
|
|
6
|
+
* @skill cascade-select-usage
|
|
7
|
+
* @changelog libs/ui/stories/changelog/changelog.stories.tsx
|
|
8
|
+
*
|
|
9
|
+
* Versioning is enforced at commit by scripts/check-skill-sync.mjs: @componentVersion must match
|
|
10
|
+
* the cascade-select-usage skill's component_version and a changelog entry. Bump all three together.
|
|
11
|
+
*/
|
|
12
|
+
import { type Api as ZagCascadeSelectApi, type ItemProps as ZagCascadeSelectItemProps, type Props as ZagCascadeSelectProps } from "@zag-js/cascade-select";
|
|
13
|
+
import { type PropTypes } from "@zag-js/react";
|
|
14
|
+
import { type ComponentPropsWithoutRef, type Dispatch, type ReactNode, type Ref, type SetStateAction } from "react";
|
|
15
|
+
import type { VariantProps } from "tailwind-variants";
|
|
16
|
+
import { type ActionIconProps } from "../atoms/action-icon.js";
|
|
17
|
+
import { type IconProps } from "../atoms/icon.js";
|
|
18
|
+
import { Label } from "../atoms/label.js";
|
|
19
|
+
import { type StatusTextProps } from "../atoms/status-text.js";
|
|
20
|
+
export type CascadeSelectSize = "xs" | "sm" | "md" | "lg";
|
|
21
|
+
export type CascadeSelectValidateStatus = "default" | "error" | "success" | "warning";
|
|
22
|
+
export type CascadeSelectItem = {
|
|
23
|
+
label: string;
|
|
24
|
+
value: string;
|
|
25
|
+
children?: CascadeSelectItem[];
|
|
26
|
+
disabled?: boolean;
|
|
27
|
+
};
|
|
28
|
+
export declare const cascadeSelectVariants: import("tailwind-variants").TVReturnType<{
|
|
29
|
+
size: {
|
|
30
|
+
xs: {
|
|
31
|
+
trigger: string;
|
|
32
|
+
content: string;
|
|
33
|
+
valueText: string;
|
|
34
|
+
};
|
|
35
|
+
sm: {
|
|
36
|
+
trigger: string;
|
|
37
|
+
content: string;
|
|
38
|
+
valueText: string;
|
|
39
|
+
};
|
|
40
|
+
md: {
|
|
41
|
+
trigger: string;
|
|
42
|
+
content: string;
|
|
43
|
+
valueText: string;
|
|
44
|
+
};
|
|
45
|
+
lg: {
|
|
46
|
+
trigger: string;
|
|
47
|
+
content: string;
|
|
48
|
+
valueText: string;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
}, {
|
|
52
|
+
root: string;
|
|
53
|
+
control: string;
|
|
54
|
+
positioner: string;
|
|
55
|
+
trigger: string[];
|
|
56
|
+
clearTrigger: string;
|
|
57
|
+
content: string[];
|
|
58
|
+
list: string;
|
|
59
|
+
item: string[];
|
|
60
|
+
itemText: string;
|
|
61
|
+
branchIndicator: string[];
|
|
62
|
+
itemIndicator: string[];
|
|
63
|
+
valueText: string[];
|
|
64
|
+
indicator: string[];
|
|
65
|
+
}, undefined, {
|
|
66
|
+
size: {
|
|
67
|
+
xs: {
|
|
68
|
+
trigger: string;
|
|
69
|
+
content: string;
|
|
70
|
+
valueText: string;
|
|
71
|
+
};
|
|
72
|
+
sm: {
|
|
73
|
+
trigger: string;
|
|
74
|
+
content: string;
|
|
75
|
+
valueText: string;
|
|
76
|
+
};
|
|
77
|
+
md: {
|
|
78
|
+
trigger: string;
|
|
79
|
+
content: string;
|
|
80
|
+
valueText: string;
|
|
81
|
+
};
|
|
82
|
+
lg: {
|
|
83
|
+
trigger: string;
|
|
84
|
+
content: string;
|
|
85
|
+
valueText: string;
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
}, {
|
|
89
|
+
root: string;
|
|
90
|
+
control: string;
|
|
91
|
+
positioner: string;
|
|
92
|
+
trigger: string[];
|
|
93
|
+
clearTrigger: string;
|
|
94
|
+
content: string[];
|
|
95
|
+
list: string;
|
|
96
|
+
item: string[];
|
|
97
|
+
itemText: string;
|
|
98
|
+
branchIndicator: string[];
|
|
99
|
+
itemIndicator: string[];
|
|
100
|
+
valueText: string[];
|
|
101
|
+
indicator: string[];
|
|
102
|
+
}, import("tailwind-variants").TVReturnType<{
|
|
103
|
+
size: {
|
|
104
|
+
xs: {
|
|
105
|
+
trigger: string;
|
|
106
|
+
content: string;
|
|
107
|
+
valueText: string;
|
|
108
|
+
};
|
|
109
|
+
sm: {
|
|
110
|
+
trigger: string;
|
|
111
|
+
content: string;
|
|
112
|
+
valueText: string;
|
|
113
|
+
};
|
|
114
|
+
md: {
|
|
115
|
+
trigger: string;
|
|
116
|
+
content: string;
|
|
117
|
+
valueText: string;
|
|
118
|
+
};
|
|
119
|
+
lg: {
|
|
120
|
+
trigger: string;
|
|
121
|
+
content: string;
|
|
122
|
+
valueText: string;
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
}, {
|
|
126
|
+
root: string;
|
|
127
|
+
control: string;
|
|
128
|
+
positioner: string;
|
|
129
|
+
trigger: string[];
|
|
130
|
+
clearTrigger: string;
|
|
131
|
+
content: string[];
|
|
132
|
+
list: string;
|
|
133
|
+
item: string[];
|
|
134
|
+
itemText: string;
|
|
135
|
+
branchIndicator: string[];
|
|
136
|
+
itemIndicator: string[];
|
|
137
|
+
valueText: string[];
|
|
138
|
+
indicator: string[];
|
|
139
|
+
}, undefined, unknown, unknown, undefined>>;
|
|
140
|
+
type CascadeSelectApi = ZagCascadeSelectApi<PropTypes, CascadeSelectItem>;
|
|
141
|
+
type CascadeSelectContextValue = {
|
|
142
|
+
api: CascadeSelectApi;
|
|
143
|
+
formatValue?: (selectedItems: CascadeSelectItem[][]) => string;
|
|
144
|
+
required: boolean;
|
|
145
|
+
size: CascadeSelectSize;
|
|
146
|
+
statusTextIds: string[];
|
|
147
|
+
setStatusTextIds: Dispatch<SetStateAction<string[]>>;
|
|
148
|
+
validateStatus: CascadeSelectValidateStatus;
|
|
149
|
+
};
|
|
150
|
+
export declare function useCascadeSelectContext(): CascadeSelectContextValue;
|
|
151
|
+
export type CascadeSelectProps = VariantProps<typeof cascadeSelectVariants> & Omit<ZagCascadeSelectProps<CascadeSelectItem>, "collection" | "id" | "invalid"> & {
|
|
152
|
+
children: ReactNode;
|
|
153
|
+
className?: string;
|
|
154
|
+
id?: string;
|
|
155
|
+
items: CascadeSelectItem[];
|
|
156
|
+
ref?: Ref<HTMLDivElement>;
|
|
157
|
+
validateStatus?: CascadeSelectValidateStatus;
|
|
158
|
+
};
|
|
159
|
+
export declare function CascadeSelect({ children, className, id: providedId, items, ref, required, size, validateStatus, ...machineProps }: CascadeSelectProps): import("react/jsx-runtime").JSX.Element;
|
|
160
|
+
export declare namespace CascadeSelect {
|
|
161
|
+
var Label: ({ children, ...props }: CascadeSelectLabelProps) => import("react/jsx-runtime").JSX.Element;
|
|
162
|
+
var Control: ({ className, ref, ...props }: CascadeSelectControlProps) => import("react/jsx-runtime").JSX.Element;
|
|
163
|
+
var Trigger: ({ className, ref, ...props }: CascadeSelectTriggerProps) => import("react/jsx-runtime").JSX.Element;
|
|
164
|
+
var ValueText: ({ children, className, placeholder, ref, ...props }: CascadeSelectValueTextProps) => import("react/jsx-runtime").JSX.Element;
|
|
165
|
+
var Indicator: ({ children, className, iconSize, ref, ...props }: CascadeSelectIndicatorProps) => import("react/jsx-runtime").JSX.Element;
|
|
166
|
+
var ClearTrigger: ({ "aria-label": ariaLabel, className, ref, ...props }: CascadeSelectClearTriggerProps) => import("react/jsx-runtime").JSX.Element;
|
|
167
|
+
var Positioner: ({ className, ref, ...props }: CascadeSelectPositionerProps) => import("react/jsx-runtime").JSX.Element;
|
|
168
|
+
var Content: ({ className, ref, ...props }: CascadeSelectContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
169
|
+
var List: ({ className, indexPath, item, ref, value, ...props }: CascadeSelectListProps) => import("react/jsx-runtime").JSX.Element;
|
|
170
|
+
var Item: ({ children, className, indexPath, item, ref, value, ...props }: CascadeSelectItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
171
|
+
var ItemText: ({ children, className, ref, ...props }: CascadeSelectItemTextProps) => import("react/jsx-runtime").JSX.Element;
|
|
172
|
+
var BranchIndicator: ({ children, className, iconSize, ref, ...props }: CascadeSelectBranchIndicatorProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
173
|
+
var ItemIndicator: ({ children, className, iconSize, ref, ...props }: CascadeSelectItemIndicatorProps) => import("react/jsx-runtime").JSX.Element;
|
|
174
|
+
var Node: ({ indexPath, node, value, }: CascadeSelectNodeProps) => import("react/jsx-runtime").JSX.Element;
|
|
175
|
+
var StatusText: ({ id: providedId, size: sizeProp, status: statusProp, ...props }: CascadeSelectStatusTextProps) => import("react/jsx-runtime").JSX.Element;
|
|
176
|
+
var displayName: string;
|
|
177
|
+
}
|
|
178
|
+
type CascadeSelectLabelProps = Omit<ComponentPropsWithoutRef<typeof Label>, "disabled" | "required">;
|
|
179
|
+
type CascadeSelectControlProps = ComponentPropsWithoutRef<"div"> & {
|
|
180
|
+
ref?: Ref<HTMLDivElement>;
|
|
181
|
+
};
|
|
182
|
+
type CascadeSelectTriggerProps = ComponentPropsWithoutRef<"button"> & {
|
|
183
|
+
ref?: Ref<HTMLButtonElement>;
|
|
184
|
+
};
|
|
185
|
+
type CascadeSelectValueTextProps = Omit<ComponentPropsWithoutRef<"span">, "children"> & {
|
|
186
|
+
children?: ReactNode | ((selectedItems: CascadeSelectItem[][]) => ReactNode);
|
|
187
|
+
placeholder?: ReactNode;
|
|
188
|
+
ref?: Ref<HTMLSpanElement>;
|
|
189
|
+
};
|
|
190
|
+
type CascadeSelectIndicatorProps = ComponentPropsWithoutRef<"span"> & {
|
|
191
|
+
iconSize?: IconProps["size"];
|
|
192
|
+
ref?: Ref<HTMLSpanElement>;
|
|
193
|
+
};
|
|
194
|
+
type CascadeSelectClearTriggerProps = Omit<ActionIconProps, "icon" | "size" | "tone"> & {
|
|
195
|
+
ref?: Ref<HTMLButtonElement>;
|
|
196
|
+
};
|
|
197
|
+
type CascadeSelectPositionerProps = ComponentPropsWithoutRef<"div"> & {
|
|
198
|
+
ref?: Ref<HTMLDivElement>;
|
|
199
|
+
};
|
|
200
|
+
type CascadeSelectContentProps = ComponentPropsWithoutRef<"div"> & {
|
|
201
|
+
ref?: Ref<HTMLDivElement>;
|
|
202
|
+
};
|
|
203
|
+
type CascadeSelectNodePartProps = ZagCascadeSelectItemProps<CascadeSelectItem>;
|
|
204
|
+
type CascadeSelectListProps = Omit<ComponentPropsWithoutRef<"ul">, keyof CascadeSelectNodePartProps> & CascadeSelectNodePartProps & {
|
|
205
|
+
ref?: Ref<HTMLUListElement>;
|
|
206
|
+
};
|
|
207
|
+
type CascadeSelectItemProps = Omit<ComponentPropsWithoutRef<"li">, keyof CascadeSelectNodePartProps> & CascadeSelectNodePartProps & {
|
|
208
|
+
ref?: Ref<HTMLLIElement>;
|
|
209
|
+
};
|
|
210
|
+
type CascadeSelectItemTextProps = ComponentPropsWithoutRef<"span"> & {
|
|
211
|
+
ref?: Ref<HTMLSpanElement>;
|
|
212
|
+
};
|
|
213
|
+
type CascadeSelectBranchIndicatorProps = ComponentPropsWithoutRef<"span"> & {
|
|
214
|
+
iconSize?: IconProps["size"];
|
|
215
|
+
ref?: Ref<HTMLSpanElement>;
|
|
216
|
+
};
|
|
217
|
+
type CascadeSelectItemIndicatorProps = ComponentPropsWithoutRef<"span"> & {
|
|
218
|
+
iconSize?: IconProps["size"];
|
|
219
|
+
ref?: Ref<HTMLSpanElement>;
|
|
220
|
+
};
|
|
221
|
+
type CascadeSelectNodeProps = {
|
|
222
|
+
indexPath?: number[];
|
|
223
|
+
node?: CascadeSelectItem;
|
|
224
|
+
value?: string[];
|
|
225
|
+
};
|
|
226
|
+
type CascadeSelectStatusTextProps = Omit<StatusTextProps, "size" | "status"> & {
|
|
227
|
+
size?: CascadeSelectSize;
|
|
228
|
+
status?: CascadeSelectValidateStatus;
|
|
229
|
+
};
|
|
230
|
+
export {};
|
|
231
|
+
//# sourceMappingURL=cascade-select.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cascade-select.d.ts","sourceRoot":"","sources":["../../../src/molecules/cascade-select.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAIL,KAAK,GAAG,IAAI,mBAAmB,EAC/B,KAAK,SAAS,IAAI,yBAAyB,EAE3C,KAAK,KAAK,IAAI,qBAAqB,EAEpC,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAIL,KAAK,SAAS,EAEf,MAAM,eAAe,CAAA;AACtB,OAAO,EACL,KAAK,wBAAwB,EAE7B,KAAK,QAAQ,EACb,KAAK,SAAS,EACd,KAAK,GAAG,EACR,KAAK,cAAc,EAMpB,MAAM,OAAO,CAAA;AACd,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACrD,OAAO,EAAc,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAEvE,OAAO,EAAQ,KAAK,SAAS,EAAE,MAAM,eAAe,CAAA;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AACtC,OAAO,EAAc,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAGvE,MAAM,MAAM,iBAAiB,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;AAEzD,MAAM,MAAM,2BAA2B,GACnC,SAAS,GACT,OAAO,GACP,SAAS,GACT,SAAS,CAAA;AAEb,MAAM,MAAM,iBAAiB,GAAG;IAC9B,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,iBAAiB,EAAE,CAAA;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAWD,eAAO,MAAM,qBAAqB;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