@spark-ui/components 11.4.3 → 11.5.1
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/alert-dialog/index.mjs +4 -4
- package/dist/avatar/index.d.mts +2 -2
- package/dist/avatar/index.d.ts +2 -2
- package/dist/avatar/index.mjs +3 -3
- package/dist/button/index.mjs +1 -1
- package/dist/carousel/index.mjs +3 -3
- package/dist/{chunk-HEKSVWYW.mjs → chunk-2YM6GKWW.mjs} +2 -1
- package/dist/{chunk-XYK6V3JF.mjs → chunk-DCXWGQVZ.mjs} +2 -2
- package/dist/{chunk-D7YBYT5H.mjs → chunk-GPJMLIHC.mjs} +2 -2
- package/dist/{chunk-2BSBKLHG.mjs → chunk-WLI4EPS6.mjs} +2 -2
- package/dist/combobox/index.mjs +6 -6
- package/dist/dialog/index.mjs +4 -4
- package/dist/docgen.json +13 -9
- package/dist/drawer/index.mjs +3 -3
- package/dist/dropdown/index.mjs +4 -4
- package/dist/file-upload/index.d.mts +2 -2
- package/dist/file-upload/index.d.ts +2 -2
- package/dist/file-upload/index.js +88 -31
- package/dist/file-upload/index.js.map +1 -1
- package/dist/file-upload/index.mjs +94 -36
- package/dist/file-upload/index.mjs.map +1 -1
- package/dist/icon-button/index.mjs +2 -2
- package/dist/pagination/index.mjs +5 -5
- package/dist/popover/index.mjs +4 -4
- package/dist/scrolling-list/index.mjs +5 -5
- package/dist/snackbar/index.mjs +5 -5
- package/dist/stepper/index.mjs +3 -3
- package/dist/tabs/index.mjs +4 -4
- package/dist/toast/index.d.mts +6 -6
- package/dist/toast/index.d.ts +6 -6
- package/dist/toast/index.mjs +5 -5
- package/package.json +5 -5
- /package/dist/{chunk-HEKSVWYW.mjs.map → chunk-2YM6GKWW.mjs.map} +0 -0
- /package/dist/{chunk-XYK6V3JF.mjs.map → chunk-DCXWGQVZ.mjs.map} +0 -0
- /package/dist/{chunk-D7YBYT5H.mjs.map → chunk-GPJMLIHC.mjs.map} +0 -0
- /package/dist/{chunk-2BSBKLHG.mjs.map → chunk-WLI4EPS6.mjs.map} +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Dialog
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-HEKSVWYW.mjs";
|
|
3
|
+
} from "../chunk-WLI4EPS6.mjs";
|
|
4
|
+
import "../chunk-DCXWGQVZ.mjs";
|
|
5
|
+
import "../chunk-2YM6GKWW.mjs";
|
|
7
6
|
import "../chunk-GAK4SC2F.mjs";
|
|
7
|
+
import "../chunk-UMUMFMFB.mjs";
|
|
8
8
|
import "../chunk-KEGAAGJW.mjs";
|
|
9
9
|
import "../chunk-6QCEPQ3U.mjs";
|
|
10
10
|
|
package/dist/avatar/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import * as
|
|
2
|
+
import * as react from 'react';
|
|
3
3
|
import { ComponentPropsWithoutRef } from 'react';
|
|
4
4
|
|
|
5
5
|
interface AvatarImageProps$1 extends React.ImgHTMLAttributes<HTMLImageElement> {
|
|
@@ -45,7 +45,7 @@ declare const AvatarPlaceholder: {
|
|
|
45
45
|
displayName: string;
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
-
interface AvatarProps extends
|
|
48
|
+
interface AvatarProps extends react.HTMLAttributes<HTMLDivElement> {
|
|
49
49
|
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';
|
|
50
50
|
isOnline?: boolean;
|
|
51
51
|
onlineText?: string;
|
package/dist/avatar/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import * as
|
|
2
|
+
import * as react from 'react';
|
|
3
3
|
import { ComponentPropsWithoutRef } from 'react';
|
|
4
4
|
|
|
5
5
|
interface AvatarImageProps$1 extends React.ImgHTMLAttributes<HTMLImageElement> {
|
|
@@ -45,7 +45,7 @@ declare const AvatarPlaceholder: {
|
|
|
45
45
|
displayName: string;
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
-
interface AvatarProps extends
|
|
48
|
+
interface AvatarProps extends react.HTMLAttributes<HTMLDivElement> {
|
|
49
49
|
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';
|
|
50
50
|
isOnline?: boolean;
|
|
51
51
|
onlineText?: string;
|
package/dist/avatar/index.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
IconButton
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-DCXWGQVZ.mjs";
|
|
4
|
+
import "../chunk-2YM6GKWW.mjs";
|
|
5
|
+
import "../chunk-GAK4SC2F.mjs";
|
|
4
6
|
import {
|
|
5
7
|
Icon
|
|
6
8
|
} from "../chunk-UMUMFMFB.mjs";
|
|
7
|
-
import "../chunk-HEKSVWYW.mjs";
|
|
8
|
-
import "../chunk-GAK4SC2F.mjs";
|
|
9
9
|
import "../chunk-KEGAAGJW.mjs";
|
|
10
10
|
import {
|
|
11
11
|
Slot
|
package/dist/button/index.mjs
CHANGED
package/dist/carousel/index.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
IconButton
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-DCXWGQVZ.mjs";
|
|
4
|
+
import "../chunk-2YM6GKWW.mjs";
|
|
5
|
+
import "../chunk-GAK4SC2F.mjs";
|
|
4
6
|
import {
|
|
5
7
|
Icon
|
|
6
8
|
} from "../chunk-UMUMFMFB.mjs";
|
|
7
|
-
import "../chunk-HEKSVWYW.mjs";
|
|
8
|
-
import "../chunk-GAK4SC2F.mjs";
|
|
9
9
|
import "../chunk-KEGAAGJW.mjs";
|
|
10
10
|
import "../chunk-6QCEPQ3U.mjs";
|
|
11
11
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Button
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-2YM6GKWW.mjs";
|
|
4
4
|
|
|
5
5
|
// src/icon-button/IconButton.styles.tsx
|
|
6
6
|
import { makeVariants } from "@spark-ui/internal-utils";
|
|
@@ -50,4 +50,4 @@ IconButton.displayName = "IconButton";
|
|
|
50
50
|
export {
|
|
51
51
|
IconButton
|
|
52
52
|
};
|
|
53
|
-
//# sourceMappingURL=chunk-
|
|
53
|
+
//# sourceMappingURL=chunk-DCXWGQVZ.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
IconButton
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-DCXWGQVZ.mjs";
|
|
4
4
|
import {
|
|
5
5
|
Icon
|
|
6
6
|
} from "./chunk-UMUMFMFB.mjs";
|
|
@@ -305,4 +305,4 @@ Trigger.displayName = "Popover.Trigger";
|
|
|
305
305
|
export {
|
|
306
306
|
Popover2 as Popover
|
|
307
307
|
};
|
|
308
|
-
//# sourceMappingURL=chunk-
|
|
308
|
+
//# sourceMappingURL=chunk-GPJMLIHC.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
IconButton
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-DCXWGQVZ.mjs";
|
|
4
4
|
import {
|
|
5
5
|
Icon
|
|
6
6
|
} from "./chunk-UMUMFMFB.mjs";
|
|
@@ -355,4 +355,4 @@ Description.displayName = "Dialog.Description";
|
|
|
355
355
|
export {
|
|
356
356
|
Dialog2 as Dialog
|
|
357
357
|
};
|
|
358
|
-
//# sourceMappingURL=chunk-
|
|
358
|
+
//# sourceMappingURL=chunk-WLI4EPS6.mjs.map
|
package/dist/combobox/index.mjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Popover
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-GPJMLIHC.mjs";
|
|
4
4
|
import {
|
|
5
5
|
IconButton
|
|
6
|
-
} from "../chunk-
|
|
7
|
-
import
|
|
8
|
-
Icon
|
|
9
|
-
} from "../chunk-UMUMFMFB.mjs";
|
|
10
|
-
import "../chunk-HEKSVWYW.mjs";
|
|
6
|
+
} from "../chunk-DCXWGQVZ.mjs";
|
|
7
|
+
import "../chunk-2YM6GKWW.mjs";
|
|
11
8
|
import {
|
|
12
9
|
Spinner
|
|
13
10
|
} from "../chunk-GAK4SC2F.mjs";
|
|
11
|
+
import {
|
|
12
|
+
Icon
|
|
13
|
+
} from "../chunk-UMUMFMFB.mjs";
|
|
14
14
|
import {
|
|
15
15
|
VisuallyHidden
|
|
16
16
|
} from "../chunk-KEGAAGJW.mjs";
|
package/dist/dialog/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Dialog
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-HEKSVWYW.mjs";
|
|
3
|
+
} from "../chunk-WLI4EPS6.mjs";
|
|
4
|
+
import "../chunk-DCXWGQVZ.mjs";
|
|
5
|
+
import "../chunk-2YM6GKWW.mjs";
|
|
7
6
|
import "../chunk-GAK4SC2F.mjs";
|
|
7
|
+
import "../chunk-UMUMFMFB.mjs";
|
|
8
8
|
import "../chunk-KEGAAGJW.mjs";
|
|
9
9
|
import "../chunk-6QCEPQ3U.mjs";
|
|
10
10
|
export {
|
package/dist/docgen.json
CHANGED
|
@@ -30202,13 +30202,6 @@
|
|
|
30202
30202
|
}
|
|
30203
30203
|
}
|
|
30204
30204
|
},
|
|
30205
|
-
"FileUploadContext": {
|
|
30206
|
-
"tags": {},
|
|
30207
|
-
"description": "",
|
|
30208
|
-
"displayName": "FileUploadContext",
|
|
30209
|
-
"methods": [],
|
|
30210
|
-
"props": {}
|
|
30211
|
-
},
|
|
30212
30205
|
"FileUpload": {
|
|
30213
30206
|
"tags": {},
|
|
30214
30207
|
"description": "",
|
|
@@ -30735,6 +30728,13 @@
|
|
|
30735
30728
|
}
|
|
30736
30729
|
}
|
|
30737
30730
|
},
|
|
30731
|
+
"DropzoneContext": {
|
|
30732
|
+
"tags": {},
|
|
30733
|
+
"description": "",
|
|
30734
|
+
"displayName": "DropzoneContext",
|
|
30735
|
+
"methods": [],
|
|
30736
|
+
"props": {}
|
|
30737
|
+
},
|
|
30738
30738
|
"FileUpload.ItemDeleteTrigger": {
|
|
30739
30739
|
"tags": {},
|
|
30740
30740
|
"description": "",
|
|
@@ -31603,7 +31603,9 @@
|
|
|
31603
31603
|
}
|
|
31604
31604
|
},
|
|
31605
31605
|
"size": {
|
|
31606
|
-
"defaultValue":
|
|
31606
|
+
"defaultValue": {
|
|
31607
|
+
"value": "md"
|
|
31608
|
+
},
|
|
31607
31609
|
"description": "Size of the button.",
|
|
31608
31610
|
"name": "size",
|
|
31609
31611
|
"declarations": [],
|
|
@@ -31673,7 +31675,9 @@
|
|
|
31673
31675
|
}
|
|
31674
31676
|
},
|
|
31675
31677
|
"shape": {
|
|
31676
|
-
"defaultValue":
|
|
31678
|
+
"defaultValue": {
|
|
31679
|
+
"value": "rounded"
|
|
31680
|
+
},
|
|
31677
31681
|
"description": "Shape of the button.",
|
|
31678
31682
|
"name": "shape",
|
|
31679
31683
|
"declarations": [],
|
package/dist/drawer/index.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
IconButton
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-DCXWGQVZ.mjs";
|
|
4
|
+
import "../chunk-2YM6GKWW.mjs";
|
|
5
|
+
import "../chunk-GAK4SC2F.mjs";
|
|
4
6
|
import {
|
|
5
7
|
Icon
|
|
6
8
|
} from "../chunk-UMUMFMFB.mjs";
|
|
7
|
-
import "../chunk-HEKSVWYW.mjs";
|
|
8
|
-
import "../chunk-GAK4SC2F.mjs";
|
|
9
9
|
import "../chunk-KEGAAGJW.mjs";
|
|
10
10
|
import "../chunk-6QCEPQ3U.mjs";
|
|
11
11
|
|
package/dist/dropdown/index.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Popover
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-GPJMLIHC.mjs";
|
|
4
|
+
import "../chunk-DCXWGQVZ.mjs";
|
|
5
|
+
import "../chunk-2YM6GKWW.mjs";
|
|
6
|
+
import "../chunk-GAK4SC2F.mjs";
|
|
5
7
|
import {
|
|
6
8
|
Icon
|
|
7
9
|
} from "../chunk-UMUMFMFB.mjs";
|
|
8
|
-
import "../chunk-HEKSVWYW.mjs";
|
|
9
|
-
import "../chunk-GAK4SC2F.mjs";
|
|
10
10
|
import {
|
|
11
11
|
VisuallyHidden
|
|
12
12
|
} from "../chunk-KEGAAGJW.mjs";
|
|
@@ -98,7 +98,7 @@ interface FileChangeDetails {
|
|
|
98
98
|
rejectedFiles: RejectedFile$1[];
|
|
99
99
|
}
|
|
100
100
|
declare const FileUpload$1: {
|
|
101
|
-
({ asChild: _asChild, children, defaultValue, value: controlledValue, onFileAccept, onFileReject, onFileChange, multiple, accept, maxFiles, maxFileSize, minFileSize, disabled, readOnly, locale, }: FileUploadProps): react_jsx_runtime.JSX.Element;
|
|
101
|
+
({ asChild: _asChild, children, defaultValue, value: controlledValue, onFileAccept, onFileReject, onFileChange, multiple, accept, maxFiles, maxFileSize, minFileSize, disabled: disabledProp, readOnly: readOnlyProp, locale, }: FileUploadProps): react_jsx_runtime.JSX.Element;
|
|
102
102
|
displayName: string;
|
|
103
103
|
};
|
|
104
104
|
|
|
@@ -233,7 +233,7 @@ interface FileUploadTriggerProps extends Omit<ButtonProps, 'children' | 'disable
|
|
|
233
233
|
unstyled?: boolean;
|
|
234
234
|
}
|
|
235
235
|
declare const Trigger: {
|
|
236
|
-
({ className, children, asChild, unstyled, design, intent, ref, ...props }: FileUploadTriggerProps): react_jsx_runtime.JSX.Element;
|
|
236
|
+
({ className, children, asChild, unstyled, design, intent, size, shape, ref, ...props }: FileUploadTriggerProps): react_jsx_runtime.JSX.Element;
|
|
237
237
|
displayName: string;
|
|
238
238
|
};
|
|
239
239
|
|
|
@@ -98,7 +98,7 @@ interface FileChangeDetails {
|
|
|
98
98
|
rejectedFiles: RejectedFile$1[];
|
|
99
99
|
}
|
|
100
100
|
declare const FileUpload$1: {
|
|
101
|
-
({ asChild: _asChild, children, defaultValue, value: controlledValue, onFileAccept, onFileReject, onFileChange, multiple, accept, maxFiles, maxFileSize, minFileSize, disabled, readOnly, locale, }: FileUploadProps): react_jsx_runtime.JSX.Element;
|
|
101
|
+
({ asChild: _asChild, children, defaultValue, value: controlledValue, onFileAccept, onFileReject, onFileChange, multiple, accept, maxFiles, maxFileSize, minFileSize, disabled: disabledProp, readOnly: readOnlyProp, locale, }: FileUploadProps): react_jsx_runtime.JSX.Element;
|
|
102
102
|
displayName: string;
|
|
103
103
|
};
|
|
104
104
|
|
|
@@ -233,7 +233,7 @@ interface FileUploadTriggerProps extends Omit<ButtonProps, 'children' | 'disable
|
|
|
233
233
|
unstyled?: boolean;
|
|
234
234
|
}
|
|
235
235
|
declare const Trigger: {
|
|
236
|
-
({ className, children, asChild, unstyled, design, intent, ref, ...props }: FileUploadTriggerProps): react_jsx_runtime.JSX.Element;
|
|
236
|
+
({ className, children, asChild, unstyled, design, intent, size, shape, ref, ...props }: FileUploadTriggerProps): react_jsx_runtime.JSX.Element;
|
|
237
237
|
displayName: string;
|
|
238
238
|
};
|
|
239
239
|
|
|
@@ -25,6 +25,7 @@ __export(file_upload_exports, {
|
|
|
25
25
|
module.exports = __toCommonJS(file_upload_exports);
|
|
26
26
|
|
|
27
27
|
// src/file-upload/FileUpload.tsx
|
|
28
|
+
var import_form_field = require("@spark-ui/components/form-field");
|
|
28
29
|
var import_use_combined_state = require("@spark-ui/hooks/use-combined-state");
|
|
29
30
|
var import_react2 = require("react");
|
|
30
31
|
|
|
@@ -130,6 +131,7 @@ function getFileIcon(file) {
|
|
|
130
131
|
// src/file-upload/FileUpload.tsx
|
|
131
132
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
132
133
|
var FileUploadContext = (0, import_react2.createContext)(null);
|
|
134
|
+
var ID_PREFIX = ":file-upload";
|
|
133
135
|
var FileUpload = ({
|
|
134
136
|
asChild: _asChild = false,
|
|
135
137
|
children,
|
|
@@ -143,15 +145,31 @@ var FileUpload = ({
|
|
|
143
145
|
maxFiles,
|
|
144
146
|
maxFileSize,
|
|
145
147
|
minFileSize,
|
|
146
|
-
disabled = false,
|
|
147
|
-
readOnly = false,
|
|
148
|
+
disabled: disabledProp = false,
|
|
149
|
+
readOnly: readOnlyProp = false,
|
|
148
150
|
locale
|
|
149
151
|
}) => {
|
|
152
|
+
const field = (0, import_form_field.useFormFieldControl)();
|
|
153
|
+
const {
|
|
154
|
+
id: fieldId,
|
|
155
|
+
name: fieldName,
|
|
156
|
+
isInvalid,
|
|
157
|
+
isRequired,
|
|
158
|
+
description,
|
|
159
|
+
disabled: fieldDisabled,
|
|
160
|
+
readOnly: fieldReadOnly,
|
|
161
|
+
labelId
|
|
162
|
+
} = field;
|
|
150
163
|
const defaultLocale = locale || (typeof navigator !== "undefined" && navigator.language ? navigator.language : "en");
|
|
164
|
+
const internalId = (0, import_react2.useId)();
|
|
165
|
+
const inputId = fieldId || `${ID_PREFIX}-${internalId}`;
|
|
166
|
+
const inputName = fieldName;
|
|
151
167
|
const inputRef = (0, import_react2.useRef)(null);
|
|
152
168
|
const triggerRef = (0, import_react2.useRef)(null);
|
|
153
169
|
const dropzoneRef = (0, import_react2.useRef)(null);
|
|
154
170
|
const deleteButtonRefs = (0, import_react2.useRef)([]);
|
|
171
|
+
const disabled = fieldDisabled ?? disabledProp;
|
|
172
|
+
const readOnly = fieldReadOnly ?? readOnlyProp;
|
|
155
173
|
const [filesState, setFilesState, ,] = (0, import_use_combined_state.useCombinedState)(controlledValue, defaultValue);
|
|
156
174
|
const files = filesState ?? [];
|
|
157
175
|
const setFiles = setFilesState;
|
|
@@ -337,7 +355,10 @@ var FileUpload = ({
|
|
|
337
355
|
maxFilesReached,
|
|
338
356
|
disabled,
|
|
339
357
|
readOnly,
|
|
340
|
-
locale: defaultLocale
|
|
358
|
+
locale: defaultLocale,
|
|
359
|
+
description,
|
|
360
|
+
isInvalid,
|
|
361
|
+
isRequired
|
|
341
362
|
},
|
|
342
363
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "relative", children: [
|
|
343
364
|
children,
|
|
@@ -347,12 +368,16 @@ var FileUpload = ({
|
|
|
347
368
|
ref: inputRef,
|
|
348
369
|
type: "file",
|
|
349
370
|
tabIndex: -1,
|
|
350
|
-
id:
|
|
371
|
+
id: inputId,
|
|
351
372
|
multiple,
|
|
352
|
-
name:
|
|
373
|
+
name: inputName,
|
|
353
374
|
accept,
|
|
354
375
|
disabled,
|
|
355
376
|
readOnly: readOnly && !disabled,
|
|
377
|
+
required: isRequired,
|
|
378
|
+
"aria-invalid": isInvalid,
|
|
379
|
+
"aria-describedby": description,
|
|
380
|
+
"aria-label": !labelId ? "Upload files test" : void 0,
|
|
356
381
|
className: "sr-only",
|
|
357
382
|
onChange: (e) => {
|
|
358
383
|
if (e.target.files && !disabled && !readOnly) {
|
|
@@ -508,7 +533,7 @@ var progressBarStyles = (0, import_class_variance_authority2.cva)(
|
|
|
508
533
|
// src/progress/ProgressContext.tsx
|
|
509
534
|
var import_react5 = require("react");
|
|
510
535
|
var ProgressContext = (0, import_react5.createContext)(null);
|
|
511
|
-
var
|
|
536
|
+
var ID_PREFIX2 = ":progress";
|
|
512
537
|
var useProgress = () => {
|
|
513
538
|
const context = (0, import_react5.useContext)(ProgressContext);
|
|
514
539
|
if (!context) {
|
|
@@ -644,7 +669,7 @@ var ProgressLabel = ({
|
|
|
644
669
|
ref: forwardedRef,
|
|
645
670
|
...others
|
|
646
671
|
}) => {
|
|
647
|
-
const internalID = `${
|
|
672
|
+
const internalID = `${ID_PREFIX2}-label-${(0, import_react7.useId)()}`;
|
|
648
673
|
const id = idProp || internalID;
|
|
649
674
|
const { onLabelId } = useProgress();
|
|
650
675
|
const rootRef = (0, import_react7.useCallback)(
|
|
@@ -1709,6 +1734,8 @@ Context.displayName = "FileUpload.Context";
|
|
|
1709
1734
|
var import_class_variance_authority11 = require("class-variance-authority");
|
|
1710
1735
|
var import_react10 = require("react");
|
|
1711
1736
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1737
|
+
var DropzoneContext = (0, import_react10.createContext)(false);
|
|
1738
|
+
var useDropzoneContext = () => (0, import_react10.useContext)(DropzoneContext);
|
|
1712
1739
|
function Dropzone({
|
|
1713
1740
|
children,
|
|
1714
1741
|
className,
|
|
@@ -1747,7 +1774,7 @@ function Dropzone({
|
|
|
1747
1774
|
}
|
|
1748
1775
|
};
|
|
1749
1776
|
const isDisabled = ctx.disabled || ctx.readOnly;
|
|
1750
|
-
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1777
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(DropzoneContext.Provider, { value: true, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1751
1778
|
"div",
|
|
1752
1779
|
{
|
|
1753
1780
|
ref: (node) => {
|
|
@@ -1759,6 +1786,9 @@ function Dropzone({
|
|
|
1759
1786
|
role: "button",
|
|
1760
1787
|
tabIndex: isDisabled ? -1 : 0,
|
|
1761
1788
|
"aria-disabled": ctx.disabled ? true : void 0,
|
|
1789
|
+
"aria-describedby": ctx.description,
|
|
1790
|
+
"aria-invalid": ctx.isInvalid,
|
|
1791
|
+
"aria-required": ctx.isRequired,
|
|
1762
1792
|
onClick: handleClick,
|
|
1763
1793
|
onKeyDown: handleKeyDown,
|
|
1764
1794
|
onDrop: handleDrop,
|
|
@@ -1788,7 +1818,7 @@ function Dropzone({
|
|
|
1788
1818
|
},
|
|
1789
1819
|
children
|
|
1790
1820
|
}
|
|
1791
|
-
);
|
|
1821
|
+
) });
|
|
1792
1822
|
}
|
|
1793
1823
|
Dropzone.displayName = "FileUploadDropzone";
|
|
1794
1824
|
|
|
@@ -1952,10 +1982,13 @@ var Trigger = ({
|
|
|
1952
1982
|
unstyled = false,
|
|
1953
1983
|
design = "filled",
|
|
1954
1984
|
intent = "basic",
|
|
1985
|
+
size = "md",
|
|
1986
|
+
shape = "rounded",
|
|
1955
1987
|
ref,
|
|
1956
1988
|
...props
|
|
1957
1989
|
}) => {
|
|
1958
|
-
const { inputRef, triggerRef, disabled, readOnly } = useFileUploadContext();
|
|
1990
|
+
const { inputRef, triggerRef, disabled, readOnly, description, isInvalid, isRequired } = useFileUploadContext();
|
|
1991
|
+
const isInsideDropzone = useDropzoneContext();
|
|
1959
1992
|
const handleClick = (e) => {
|
|
1960
1993
|
e.stopPropagation();
|
|
1961
1994
|
e.preventDefault();
|
|
@@ -1963,34 +1996,58 @@ var Trigger = ({
|
|
|
1963
1996
|
inputRef.current?.click();
|
|
1964
1997
|
}
|
|
1965
1998
|
};
|
|
1966
|
-
const
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
{
|
|
1999
|
+
const handleRef = (node) => {
|
|
2000
|
+
if (triggerRef) {
|
|
2001
|
+
triggerRef.current = node;
|
|
2002
|
+
}
|
|
2003
|
+
if (ref) {
|
|
2004
|
+
if (typeof ref === "function") {
|
|
2005
|
+
ref(node);
|
|
2006
|
+
} else {
|
|
2007
|
+
ref.current = node;
|
|
2008
|
+
}
|
|
2009
|
+
}
|
|
2010
|
+
};
|
|
2011
|
+
let Component;
|
|
2012
|
+
let componentProps;
|
|
2013
|
+
if (isInsideDropzone) {
|
|
2014
|
+
Component = "span";
|
|
2015
|
+
const spanStyles = unstyled ? className : buttonStyles({
|
|
2016
|
+
design,
|
|
2017
|
+
intent,
|
|
2018
|
+
size,
|
|
2019
|
+
shape,
|
|
2020
|
+
disabled: disabled || readOnly,
|
|
2021
|
+
className
|
|
2022
|
+
});
|
|
2023
|
+
componentProps = {
|
|
2024
|
+
ref: handleRef,
|
|
2025
|
+
"data-spark-component": "file-upload-trigger",
|
|
2026
|
+
className: spanStyles
|
|
2027
|
+
// No onClick, no role, no tabIndex - Dropzone handles interaction
|
|
2028
|
+
// No aria attributes here - they're on the Dropzone
|
|
2029
|
+
};
|
|
2030
|
+
} else {
|
|
2031
|
+
const buttonComponent = unstyled ? "button" : Button;
|
|
2032
|
+
Component = asChild ? Slot : buttonComponent;
|
|
2033
|
+
componentProps = {
|
|
2034
|
+
ref: handleRef,
|
|
1971
2035
|
type: "button",
|
|
1972
|
-
ref: (node) => {
|
|
1973
|
-
if (triggerRef) {
|
|
1974
|
-
triggerRef.current = node;
|
|
1975
|
-
}
|
|
1976
|
-
if (ref) {
|
|
1977
|
-
if (typeof ref === "function") {
|
|
1978
|
-
ref(node);
|
|
1979
|
-
} else {
|
|
1980
|
-
ref.current = node;
|
|
1981
|
-
}
|
|
1982
|
-
}
|
|
1983
|
-
},
|
|
1984
2036
|
design,
|
|
1985
2037
|
intent,
|
|
2038
|
+
size,
|
|
2039
|
+
shape,
|
|
1986
2040
|
"data-spark-component": "file-upload-trigger",
|
|
1987
2041
|
className: (0, import_class_variance_authority15.cx)(className),
|
|
1988
2042
|
disabled: disabled || readOnly,
|
|
1989
2043
|
onClick: handleClick,
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
2044
|
+
"aria-describedby": description,
|
|
2045
|
+
"aria-invalid": isInvalid,
|
|
2046
|
+
"aria-required": isRequired,
|
|
2047
|
+
...props
|
|
2048
|
+
};
|
|
2049
|
+
}
|
|
2050
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Component, { ...componentProps, children });
|
|
1994
2051
|
};
|
|
1995
2052
|
Trigger.displayName = "FileUpload.Trigger";
|
|
1996
2053
|
|