@povio/ui 3.2.2-rc.6 → 3.2.2
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/components/inputs/DateTime/shared/DateField.js +80 -83
- package/dist/components/inputs/File/FileUpload.d.ts +1 -1
- package/dist/components/inputs/File/FileUpload.js +6 -1
- package/dist/components/inputs/File/fileUpload.types.d.ts +6 -0
- package/dist/components/inputs/File/shared/FileCard.d.ts +2 -2
- package/dist/components/inputs/File/shared/FileCard.js +46 -40
- package/dist/components/inputs/File/shared/FileCardList.d.ts +2 -2
- package/dist/components/inputs/File/shared/FileCardList.js +27 -21
- package/dist/components/inputs/File/shared/FileUploadContent.d.ts +1 -1
- package/dist/components/inputs/File/shared/FileUploadContent.js +98 -84
- package/dist/components/inputs/File/shared/FileUploadContentEmpty.d.ts +2 -2
- package/dist/components/inputs/File/shared/FileUploadContentEmpty.js +157 -121
- package/dist/components/inputs/File/shared/FileUploadContentError.d.ts +2 -2
- package/dist/components/inputs/File/shared/FileUploadContentError.js +189 -153
- package/dist/components/inputs/File/shared/FileUploadContentFilled.d.ts +2 -2
- package/dist/components/inputs/File/shared/FileUploadContentFilled.js +181 -145
- package/dist/components/inputs/File/shared/FileUploadContentLoading.d.ts +2 -2
- package/dist/components/inputs/File/shared/FileUploadContentLoading.js +209 -168
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.js +4 -2
- package/dist/components/inputs/Selection/Select/QuerySelect.js +42 -38
- package/dist/components/inputs/Selection/shared/SelectBase.d.ts +2 -0
- package/dist/components/inputs/Selection/shared/SelectBase.js +35 -32
- package/dist/components/inputs/Selection/shared/SelectDesktop.js +212 -191
- package/dist/components/inputs/Selection/shared/SelectInput.js +193 -154
- package/dist/components/inputs/Selection/shared/select.context.d.ts +3 -2
- package/dist/components/inputs/Selection/shared/select.context.js +4 -2
- package/dist/components/overlays/ResponsivePopover/ResponsivePopover.d.ts +4 -1
- package/dist/components/overlays/ResponsivePopover/ResponsivePopover.js +91 -64
- package/dist/config/uiConfig.context.d.ts +5 -1
- package/dist/config/uiConfig.context.js +12 -3
- package/package.json +1 -1
|
@@ -11,7 +11,7 @@ import { useDateFieldState } from "react-stately";
|
|
|
11
11
|
//#region src/components/inputs/DateTime/shared/DateField.tsx
|
|
12
12
|
var omitNullValue = ({ value: _value, ...props }) => props;
|
|
13
13
|
var DateField = (t0) => {
|
|
14
|
-
const $ = c(
|
|
14
|
+
const $ = c(63);
|
|
15
15
|
const { ref, onClearChange, hidePlaceholder, isDisabled, disableManualEntry, dateGranularity: t1, isTimeOptional: t2, format, timeZone, segmentGroup, shouldAutoFixYear: t3, ...props } = t0;
|
|
16
16
|
const dateGranularity = t1 === void 0 ? "day" : t1;
|
|
17
17
|
const isTimeOptional = t2 === void 0 ? false : t2;
|
|
@@ -98,6 +98,7 @@ var DateField = (t0) => {
|
|
|
98
98
|
const isDateFilled = isMonthFilled && isDayFilled && isYearFilled;
|
|
99
99
|
const isHourEmpty = hourSegment && (hourSegment.isPlaceholder || Number.isNaN(parseInt(hourSegment.text ?? "", 10)));
|
|
100
100
|
const isMinuteEmpty = minuteSegment && (minuteSegment.isPlaceholder || Number.isNaN(parseInt(minuteSegment.text ?? "", 10)));
|
|
101
|
+
let correctedValue = null;
|
|
101
102
|
if (!isTimeOptional && isDateFilled && minuteSegment && isMinuteEmpty) {
|
|
102
103
|
let minute = minuteSegment?.value || 0;
|
|
103
104
|
if (minuteSegment?.text?.length && minuteSegment?.text?.length > 0) {
|
|
@@ -118,7 +119,6 @@ var DateField = (t0) => {
|
|
|
118
119
|
let year = (/* @__PURE__ */ new Date()).getFullYear();
|
|
119
120
|
if (yearSegment?.text?.length && yearSegment?.text?.length === 2) year = parseInt(`20${yearSegment?.text}`);
|
|
120
121
|
state.setSegment("year", year);
|
|
121
|
-
let correctedValue = null;
|
|
122
122
|
const month = getSegmentNumber(monthSegment);
|
|
123
123
|
const day = getSegmentNumber(daySegment);
|
|
124
124
|
const hasDateSegments = month !== null && day !== null;
|
|
@@ -126,7 +126,17 @@ var DateField = (t0) => {
|
|
|
126
126
|
if (state.value) correctedValue = state.value.set({ year });
|
|
127
127
|
else if (hasDateSegments && hasTimeSegment) correctedValue = new CalendarDateTime(year, month, day, getSegmentNumber(hourSegment) ?? 0, getSegmentNumber(minuteSegment) ?? 0);
|
|
128
128
|
else if (hasDateSegments) correctedValue = new CalendarDate(year, month, day);
|
|
129
|
-
|
|
129
|
+
}
|
|
130
|
+
const valueToCorrect = correctedValue ?? state.value;
|
|
131
|
+
if (!valueToCorrect) return;
|
|
132
|
+
const { year: year_0 } = valueToCorrect;
|
|
133
|
+
if (year_0 >= 0 && year_0 <= 99) {
|
|
134
|
+
const correctedYear = year_0 <= 50 ? 2e3 + year_0 : 1900 + year_0;
|
|
135
|
+
correctedValue = valueToCorrect.set({ year: correctedYear });
|
|
136
|
+
}
|
|
137
|
+
if (correctedValue) {
|
|
138
|
+
state.setValue(correctedValue);
|
|
139
|
+
props.onChange?.(correctedValue);
|
|
130
140
|
}
|
|
131
141
|
};
|
|
132
142
|
$[16] = isTimeOptional;
|
|
@@ -136,80 +146,67 @@ var DateField = (t0) => {
|
|
|
136
146
|
} else t9 = $[19];
|
|
137
147
|
const autoFixYear = t9;
|
|
138
148
|
let t10;
|
|
139
|
-
if ($[20] !== autoFixYear || $[21] !== fieldProps || $[22] !==
|
|
149
|
+
if ($[20] !== autoFixYear || $[21] !== fieldProps || $[22] !== shouldAutoFixYear) {
|
|
140
150
|
t10 = (e) => {
|
|
141
|
-
if (shouldAutoFixYear) autoFixYear();
|
|
151
|
+
if (shouldAutoFixYear && !e.currentTarget.contains(e.relatedTarget)) autoFixYear();
|
|
142
152
|
fieldProps.onBlur?.(e);
|
|
143
|
-
if (!state.value) return;
|
|
144
|
-
const currentValue = state.value;
|
|
145
|
-
const { year: year_0 } = currentValue;
|
|
146
|
-
if (year_0 >= 0 && year_0 <= 99) {
|
|
147
|
-
const correctedYear = year_0 <= 50 ? 2e3 + year_0 : 1900 + year_0;
|
|
148
|
-
const correctedDate = currentValue.set({ year: correctedYear });
|
|
149
|
-
if (correctedDate) {
|
|
150
|
-
state.setValue(correctedDate);
|
|
151
|
-
props.onChange?.(correctedDate);
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
153
|
};
|
|
155
154
|
$[20] = autoFixYear;
|
|
156
155
|
$[21] = fieldProps;
|
|
157
|
-
$[22] =
|
|
158
|
-
$[23] =
|
|
159
|
-
|
|
160
|
-
$[25] = t10;
|
|
161
|
-
} else t10 = $[25];
|
|
156
|
+
$[22] = shouldAutoFixYear;
|
|
157
|
+
$[23] = t10;
|
|
158
|
+
} else t10 = $[23];
|
|
162
159
|
const handleBlur = t10;
|
|
163
160
|
let t11;
|
|
164
|
-
if ($[
|
|
161
|
+
if ($[24] !== autoFixYear || $[25] !== state) {
|
|
165
162
|
t11 = () => ({
|
|
166
163
|
clearField: () => {
|
|
167
164
|
state.setValue(null);
|
|
168
165
|
},
|
|
169
166
|
autoFixYear
|
|
170
167
|
});
|
|
171
|
-
$[
|
|
172
|
-
$[
|
|
173
|
-
$[
|
|
174
|
-
} else t11 = $[
|
|
168
|
+
$[24] = autoFixYear;
|
|
169
|
+
$[25] = state;
|
|
170
|
+
$[26] = t11;
|
|
171
|
+
} else t11 = $[26];
|
|
175
172
|
useImperativeHandle(ref, t11);
|
|
176
173
|
let t12;
|
|
177
|
-
if ($[
|
|
174
|
+
if ($[27] !== previousValueRef || $[28] !== props.value || $[29] !== state) {
|
|
178
175
|
t12 = () => {
|
|
179
176
|
if (previousValueRef.current != null && props.value == null && state.value !== null) state.setValue(null);
|
|
180
177
|
previousValueRef.current = props.value;
|
|
181
178
|
};
|
|
182
|
-
$[
|
|
183
|
-
$[
|
|
184
|
-
$[
|
|
185
|
-
$[
|
|
186
|
-
} else t12 = $[
|
|
179
|
+
$[27] = previousValueRef;
|
|
180
|
+
$[28] = props.value;
|
|
181
|
+
$[29] = state;
|
|
182
|
+
$[30] = t12;
|
|
183
|
+
} else t12 = $[30];
|
|
187
184
|
let t13;
|
|
188
|
-
if ($[
|
|
185
|
+
if ($[31] !== props.value || $[32] !== state) {
|
|
189
186
|
t13 = [props.value, state];
|
|
190
|
-
$[
|
|
191
|
-
$[
|
|
192
|
-
$[
|
|
193
|
-
} else t13 = $[
|
|
187
|
+
$[31] = props.value;
|
|
188
|
+
$[32] = state;
|
|
189
|
+
$[33] = t13;
|
|
190
|
+
} else t13 = $[33];
|
|
194
191
|
useEffect(t12, t13);
|
|
195
192
|
let t14;
|
|
196
193
|
let t15;
|
|
197
|
-
if ($[
|
|
194
|
+
if ($[34] !== onClearChange || $[35] !== state.segments) {
|
|
198
195
|
t14 = () => {
|
|
199
196
|
onClearChange?.(state.segments.some(_temp7));
|
|
200
197
|
};
|
|
201
198
|
t15 = [state.segments, onClearChange];
|
|
202
|
-
$[
|
|
203
|
-
$[
|
|
204
|
-
$[
|
|
205
|
-
$[
|
|
199
|
+
$[34] = onClearChange;
|
|
200
|
+
$[35] = state.segments;
|
|
201
|
+
$[36] = t14;
|
|
202
|
+
$[37] = t15;
|
|
206
203
|
} else {
|
|
207
|
-
t14 = $[
|
|
208
|
-
t15 = $[
|
|
204
|
+
t14 = $[36];
|
|
205
|
+
t15 = $[37];
|
|
209
206
|
}
|
|
210
207
|
useEffect(t14, t15);
|
|
211
208
|
let t16;
|
|
212
|
-
if ($[
|
|
209
|
+
if ($[38] !== disableManualEntry || $[39] !== format || $[40] !== state.value || $[41] !== timeZone) {
|
|
213
210
|
const getFormattedDisplayValue = () => {
|
|
214
211
|
if (!disableManualEntry) return null;
|
|
215
212
|
if (!format) return null;
|
|
@@ -220,15 +217,15 @@ var DateField = (t0) => {
|
|
|
220
217
|
return formattedDate.toFormat(format);
|
|
221
218
|
};
|
|
222
219
|
t16 = getFormattedDisplayValue();
|
|
223
|
-
$[
|
|
224
|
-
$[
|
|
225
|
-
$[
|
|
226
|
-
$[
|
|
227
|
-
$[
|
|
228
|
-
} else t16 = $[
|
|
220
|
+
$[38] = disableManualEntry;
|
|
221
|
+
$[39] = format;
|
|
222
|
+
$[40] = state.value;
|
|
223
|
+
$[41] = timeZone;
|
|
224
|
+
$[42] = t16;
|
|
225
|
+
} else t16 = $[42];
|
|
229
226
|
const formattedDisplayValue = t16;
|
|
230
227
|
let t17;
|
|
231
|
-
if ($[
|
|
228
|
+
if ($[43] !== hidePlaceholder || $[44] !== isDisabled || $[45] !== segmentGroup || $[46] !== segmentsToRender || $[47] !== state) {
|
|
232
229
|
t17 = /* @__PURE__ */ jsx(Fragment, { children: segmentsToRender.map((segment_7, i) => /* @__PURE__ */ jsx(DateSegmentItem, {
|
|
233
230
|
segment: segment_7,
|
|
234
231
|
segmentGroup,
|
|
@@ -236,52 +233,52 @@ var DateField = (t0) => {
|
|
|
236
233
|
isDisabled,
|
|
237
234
|
hidePlaceholder
|
|
238
235
|
}, i)) });
|
|
239
|
-
$[
|
|
240
|
-
$[
|
|
241
|
-
$[
|
|
242
|
-
$[
|
|
243
|
-
$[
|
|
244
|
-
$[
|
|
245
|
-
} else t17 = $[
|
|
236
|
+
$[43] = hidePlaceholder;
|
|
237
|
+
$[44] = isDisabled;
|
|
238
|
+
$[45] = segmentGroup;
|
|
239
|
+
$[46] = segmentsToRender;
|
|
240
|
+
$[47] = state;
|
|
241
|
+
$[48] = t17;
|
|
242
|
+
} else t17 = $[48];
|
|
246
243
|
let fieldContent = t17;
|
|
247
244
|
if (formattedDisplayValue) {
|
|
248
245
|
const t18 = isDisabled && "text-interactive-text-secondary-disabled";
|
|
249
246
|
let t19;
|
|
250
|
-
if ($[
|
|
247
|
+
if ($[49] !== t18) {
|
|
251
248
|
t19 = clsx("select-none", t18);
|
|
252
|
-
$[
|
|
253
|
-
$[
|
|
254
|
-
} else t19 = $[
|
|
249
|
+
$[49] = t18;
|
|
250
|
+
$[50] = t19;
|
|
251
|
+
} else t19 = $[50];
|
|
255
252
|
let t20;
|
|
256
|
-
if ($[
|
|
253
|
+
if ($[51] !== formattedDisplayValue || $[52] !== t19) {
|
|
257
254
|
t20 = /* @__PURE__ */ jsx("span", {
|
|
258
255
|
className: t19,
|
|
259
256
|
children: formattedDisplayValue
|
|
260
257
|
});
|
|
261
|
-
$[
|
|
262
|
-
$[
|
|
263
|
-
$[
|
|
264
|
-
} else t20 = $[
|
|
258
|
+
$[51] = formattedDisplayValue;
|
|
259
|
+
$[52] = t19;
|
|
260
|
+
$[53] = t20;
|
|
261
|
+
} else t20 = $[53];
|
|
265
262
|
fieldContent = t20;
|
|
266
263
|
}
|
|
267
264
|
const t18 = disableManualEntry && "pointer-events-none";
|
|
268
265
|
let t19;
|
|
269
|
-
if ($[
|
|
266
|
+
if ($[54] !== t18) {
|
|
270
267
|
t19 = clsx("relative w-full", t18);
|
|
271
|
-
$[
|
|
272
|
-
$[
|
|
273
|
-
} else t19 = $[
|
|
268
|
+
$[54] = t18;
|
|
269
|
+
$[55] = t19;
|
|
270
|
+
} else t19 = $[55];
|
|
274
271
|
let t20;
|
|
275
|
-
if ($[
|
|
272
|
+
if ($[56] !== fieldContent) {
|
|
276
273
|
t20 = /* @__PURE__ */ jsx("div", {
|
|
277
274
|
className: "flex",
|
|
278
275
|
children: fieldContent
|
|
279
276
|
});
|
|
280
|
-
$[
|
|
281
|
-
$[
|
|
282
|
-
} else t20 = $[
|
|
277
|
+
$[56] = fieldContent;
|
|
278
|
+
$[57] = t20;
|
|
279
|
+
} else t20 = $[57];
|
|
283
280
|
let t21;
|
|
284
|
-
if ($[
|
|
281
|
+
if ($[58] !== fieldProps || $[59] !== handleBlur || $[60] !== t19 || $[61] !== t20) {
|
|
285
282
|
t21 = /* @__PURE__ */ jsx("div", {
|
|
286
283
|
...fieldProps,
|
|
287
284
|
ref: dataFieldRef,
|
|
@@ -289,12 +286,12 @@ var DateField = (t0) => {
|
|
|
289
286
|
className: t19,
|
|
290
287
|
children: t20
|
|
291
288
|
});
|
|
292
|
-
$[
|
|
293
|
-
$[
|
|
294
|
-
$[
|
|
295
|
-
$[
|
|
296
|
-
$[
|
|
297
|
-
} else t21 = $[
|
|
289
|
+
$[58] = fieldProps;
|
|
290
|
+
$[59] = handleBlur;
|
|
291
|
+
$[60] = t19;
|
|
292
|
+
$[61] = t20;
|
|
293
|
+
$[62] = t21;
|
|
294
|
+
} else t21 = $[62];
|
|
298
295
|
return t21;
|
|
299
296
|
};
|
|
300
297
|
function _temp(segment_0) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { FieldValues } from 'react-hook-form';
|
|
2
2
|
import { FileUploadProps } from './fileUpload.types';
|
|
3
|
-
export type { DefaultFile, FileUploadBaseProps, FileUploadError, FileUploadProps, FileUploadRequest, FileUploadResponse, FileUploadState, } from './fileUpload.types';
|
|
3
|
+
export type { DefaultFile, FileUploadBaseProps, FileUploadButtonProps, FileUploadError, FileUploadProps, FileUploadRequest, FileUploadResponse, FileUploadState, } from './fileUpload.types';
|
|
4
4
|
export declare const FileUpload: <TFieldValues extends FieldValues = FieldValues>(props: FileUploadProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -18,7 +18,7 @@ import { Controller } from "react-hook-form";
|
|
|
18
18
|
//#region src/components/inputs/File/FileUpload.tsx
|
|
19
19
|
var FileUploadBase = (props) => {
|
|
20
20
|
const { t } = useTranslation("ui");
|
|
21
|
-
const { ref: _ref, label, tooltipText, variant = "vertical", as = "button", helperText, isRequired, isDisabled, headerClassName, errorClassName, isHeaderHidden, error, className, allowsMultiple = false, hideLabel, acceptedFileTypes, clearOnSuccess, emptyText = t(($) => $.ui.fileUpload.emptyText), uploadText = t(($_0) => $_0.ui.fileUpload.uploadText), browseText = t(($_1) => $_1.ui.fileUpload.browse), fileUpload, fileRemove, children, listRenderer, onInvalidFileType, defaultState, ...rest } = props;
|
|
21
|
+
const { ref: _ref, label, tooltipText, variant = "vertical", as = "button", helperText, isRequired, isDisabled, headerClassName, errorClassName, isHeaderHidden, error, className, allowsMultiple = false, hideLabel, acceptedFileTypes, clearOnSuccess, emptyText = t(($) => $.ui.fileUpload.emptyText), uploadText = t(($_0) => $_0.ui.fileUpload.uploadText), browseText = t(($_1) => $_1.ui.fileUpload.browse), fileUpload, fileRemove, children, listRenderer, browseButtonProps, cancelButtonProps, onInvalidFileType, defaultState, ...rest } = props;
|
|
22
22
|
const ui = UIConfig.useConfig();
|
|
23
23
|
const fileUploadDropZoneCva = UIOverrides.useCva("fileUpload.dropZoneCva", fileUploadDropZoneDefinition);
|
|
24
24
|
const getInitialState = () => {
|
|
@@ -155,6 +155,7 @@ var FileUploadBase = (props) => {
|
|
|
155
155
|
title: emptyText,
|
|
156
156
|
uploadText,
|
|
157
157
|
browseText,
|
|
158
|
+
browseButtonProps,
|
|
158
159
|
className: "group-drop-target/file-upload-drop-zone:flex! absolute top-1/2 left-1/2 z-overlay-above hidden -translate-x-1/2 -translate-y-1/2 flex-col"
|
|
159
160
|
})] }) : /* @__PURE__ */ jsx(FileUploadContent, {
|
|
160
161
|
...rest,
|
|
@@ -164,6 +165,8 @@ var FileUploadBase = (props) => {
|
|
|
164
165
|
browseText,
|
|
165
166
|
uploadText,
|
|
166
167
|
emptyText,
|
|
168
|
+
browseButtonProps,
|
|
169
|
+
cancelButtonProps,
|
|
167
170
|
uploadState,
|
|
168
171
|
handleSelect,
|
|
169
172
|
handleCancelUpload,
|
|
@@ -180,6 +183,8 @@ var FileUploadBase = (props) => {
|
|
|
180
183
|
as,
|
|
181
184
|
uploadState,
|
|
182
185
|
isDisabled,
|
|
186
|
+
browseButtonProps,
|
|
187
|
+
cancelButtonProps,
|
|
183
188
|
onRemove: handleRemove,
|
|
184
189
|
onCancel: handleCancelUpload
|
|
185
190
|
}))]
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ReactNode, Ref } from 'react';
|
|
2
2
|
import { DropZoneProps, FileTriggerProps } from 'react-aria-components';
|
|
3
3
|
import { FieldValues } from 'react-hook-form';
|
|
4
|
+
import { ButtonVariantProps } from '../../buttons/Button/button.cva';
|
|
4
5
|
import { FormFieldProps } from '../FormField/FormField';
|
|
5
6
|
import { ControlProps } from '../shared/form.types';
|
|
6
7
|
import { ApplicationException, GeneralErrorCodes } from '../../../types/error-handling';
|
|
@@ -74,6 +75,9 @@ export interface FileUploadContainerChildrenProps {
|
|
|
74
75
|
onRemove: (id: string) => void;
|
|
75
76
|
onCancel: (index: number) => void;
|
|
76
77
|
}
|
|
78
|
+
export interface FileUploadButtonProps extends ButtonVariantProps {
|
|
79
|
+
className?: string;
|
|
80
|
+
}
|
|
77
81
|
export type FileUploadBaseProps = {
|
|
78
82
|
as?: "button" | "link";
|
|
79
83
|
ref?: Ref<HTMLElement>;
|
|
@@ -87,6 +91,8 @@ export type FileUploadBaseProps = {
|
|
|
87
91
|
clearOnSuccess?: boolean;
|
|
88
92
|
children?: (props: FileUploadContainerChildrenProps) => ReactNode;
|
|
89
93
|
listRenderer?: (props: FileUploadContainerChildrenProps) => ReactNode;
|
|
94
|
+
browseButtonProps?: FileUploadButtonProps;
|
|
95
|
+
cancelButtonProps?: FileUploadButtonProps;
|
|
90
96
|
} & FormFieldProps & FileUploadVariant & Omit<FileTriggerProps, "children" | "onSelect" | "allowsMultiple" | "value"> & Omit<DropZoneProps, "children" | "onDrop" | "value"> & GroupedFileUploadProps & FileUploadCallbacks;
|
|
91
97
|
export type FileUploadProps<TFieldValues extends FieldValues = FieldValues> = FileUploadBaseProps & GroupedFileUploadControlProps<TFieldValues>;
|
|
92
98
|
export type FileUploadContainerProps = (Omit<FileUploadBaseProps, "label" | "hideLabel" | "variant" | "as"> & SingleFileUploadProps) | (Omit<FileUploadBaseProps, "label" | "hideLabel" | "variant" | "as"> & MultipleFileUploadProps);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { FileUploadProps, FileUploadState } from '../FileUpload';
|
|
2
|
-
interface FileCardProps extends Pick<FileUploadProps, "as" | "isDisabled"> {
|
|
2
|
+
interface FileCardProps extends Pick<FileUploadProps, "as" | "isDisabled" | "browseButtonProps" | "cancelButtonProps"> {
|
|
3
3
|
index: number;
|
|
4
4
|
state: FileUploadState;
|
|
5
5
|
onRemove?: (id: string) => void;
|
|
6
6
|
onCancel?: (index: number) => void;
|
|
7
7
|
}
|
|
8
|
-
export declare const FileCard: ({ index, as, state, onRemove, isDisabled, onCancel }: FileCardProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare const FileCard: ({ index, as, state, onRemove, isDisabled, browseButtonProps, cancelButtonProps, onCancel, }: FileCardProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
9
|
export {};
|
|
@@ -6,8 +6,8 @@ import { jsx } from "react/jsx-runtime";
|
|
|
6
6
|
import { clsx } from "clsx";
|
|
7
7
|
//#region src/components/inputs/File/shared/FileCard.tsx
|
|
8
8
|
var FileCard = (t0) => {
|
|
9
|
-
const $ = c(
|
|
10
|
-
const { index, as, state, onRemove, isDisabled, onCancel } = t0;
|
|
9
|
+
const $ = c(31);
|
|
10
|
+
const { index, as, state, onRemove, isDisabled, browseButtonProps, cancelButtonProps, onCancel } = t0;
|
|
11
11
|
let t1;
|
|
12
12
|
bb0: {
|
|
13
13
|
if (state.state === "uploading") {
|
|
@@ -19,96 +19,102 @@ var FileCard = (t0) => {
|
|
|
19
19
|
$[2] = t2;
|
|
20
20
|
} else t2 = $[2];
|
|
21
21
|
let t3;
|
|
22
|
-
if ($[3] !== as || $[4] !==
|
|
22
|
+
if ($[3] !== as || $[4] !== cancelButtonProps || $[5] !== index || $[6] !== isDisabled || $[7] !== state || $[8] !== t2) {
|
|
23
23
|
t3 = /* @__PURE__ */ jsx(FileUploadContentLoading, {
|
|
24
24
|
index,
|
|
25
25
|
variant: "horizontal",
|
|
26
26
|
as,
|
|
27
27
|
isDisabled,
|
|
28
28
|
state,
|
|
29
|
+
cancelButtonProps,
|
|
29
30
|
onCancel: t2
|
|
30
31
|
});
|
|
31
32
|
$[3] = as;
|
|
32
|
-
$[4] =
|
|
33
|
-
$[5] =
|
|
34
|
-
$[6] =
|
|
35
|
-
$[7] =
|
|
36
|
-
$[8] =
|
|
37
|
-
|
|
33
|
+
$[4] = cancelButtonProps;
|
|
34
|
+
$[5] = index;
|
|
35
|
+
$[6] = isDisabled;
|
|
36
|
+
$[7] = state;
|
|
37
|
+
$[8] = t2;
|
|
38
|
+
$[9] = t3;
|
|
39
|
+
} else t3 = $[9];
|
|
38
40
|
t1 = t3;
|
|
39
41
|
break bb0;
|
|
40
42
|
}
|
|
41
43
|
if (state.state === "error") {
|
|
42
44
|
let t2;
|
|
43
|
-
if ($[
|
|
45
|
+
if ($[10] !== index || $[11] !== onCancel) {
|
|
44
46
|
t2 = () => {
|
|
45
47
|
onCancel?.(index);
|
|
46
48
|
};
|
|
47
|
-
$[
|
|
48
|
-
$[
|
|
49
|
-
$[
|
|
50
|
-
} else t2 = $[
|
|
49
|
+
$[10] = index;
|
|
50
|
+
$[11] = onCancel;
|
|
51
|
+
$[12] = t2;
|
|
52
|
+
} else t2 = $[12];
|
|
51
53
|
let t3;
|
|
52
|
-
if ($[
|
|
54
|
+
if ($[13] !== as || $[14] !== browseButtonProps || $[15] !== isDisabled || $[16] !== state || $[17] !== t2) {
|
|
53
55
|
t3 = /* @__PURE__ */ jsx(FileUploadContentError, {
|
|
54
56
|
as,
|
|
55
57
|
removeWithIcon: true,
|
|
56
58
|
variant: "horizontal",
|
|
57
59
|
isDisabled,
|
|
58
60
|
state,
|
|
61
|
+
browseButtonProps,
|
|
59
62
|
onRemove: t2
|
|
60
63
|
});
|
|
61
|
-
$[
|
|
62
|
-
$[
|
|
63
|
-
$[
|
|
64
|
-
$[
|
|
65
|
-
$[
|
|
66
|
-
|
|
64
|
+
$[13] = as;
|
|
65
|
+
$[14] = browseButtonProps;
|
|
66
|
+
$[15] = isDisabled;
|
|
67
|
+
$[16] = state;
|
|
68
|
+
$[17] = t2;
|
|
69
|
+
$[18] = t3;
|
|
70
|
+
} else t3 = $[18];
|
|
67
71
|
t1 = t3;
|
|
68
72
|
break bb0;
|
|
69
73
|
}
|
|
70
74
|
let t2;
|
|
71
|
-
if ($[
|
|
75
|
+
if ($[19] !== onRemove || $[20] !== state.id) {
|
|
72
76
|
t2 = () => {
|
|
73
77
|
onRemove?.(state.id ?? "");
|
|
74
78
|
};
|
|
75
|
-
$[
|
|
76
|
-
$[
|
|
77
|
-
$[
|
|
78
|
-
} else t2 = $[
|
|
79
|
+
$[19] = onRemove;
|
|
80
|
+
$[20] = state.id;
|
|
81
|
+
$[21] = t2;
|
|
82
|
+
} else t2 = $[21];
|
|
79
83
|
let t3;
|
|
80
|
-
if ($[
|
|
84
|
+
if ($[22] !== as || $[23] !== browseButtonProps || $[24] !== isDisabled || $[25] !== state || $[26] !== t2) {
|
|
81
85
|
t3 = /* @__PURE__ */ jsx(FileUploadContentFilled, {
|
|
82
86
|
as,
|
|
83
87
|
removeWithIcon: true,
|
|
84
88
|
variant: "horizontal",
|
|
85
89
|
isDisabled,
|
|
86
90
|
state,
|
|
91
|
+
browseButtonProps,
|
|
87
92
|
onRemove: t2
|
|
88
93
|
});
|
|
89
|
-
$[
|
|
90
|
-
$[
|
|
91
|
-
$[
|
|
92
|
-
$[
|
|
93
|
-
$[
|
|
94
|
-
|
|
94
|
+
$[22] = as;
|
|
95
|
+
$[23] = browseButtonProps;
|
|
96
|
+
$[24] = isDisabled;
|
|
97
|
+
$[25] = state;
|
|
98
|
+
$[26] = t2;
|
|
99
|
+
$[27] = t3;
|
|
100
|
+
} else t3 = $[27];
|
|
95
101
|
t1 = t3;
|
|
96
102
|
}
|
|
97
103
|
const content = t1;
|
|
98
104
|
let t2;
|
|
99
|
-
if ($[
|
|
105
|
+
if ($[28] === Symbol.for("react.memo_cache_sentinel")) {
|
|
100
106
|
t2 = clsx("flex items-center self-stretch", "bg-elevation-fill-default-1", "px-file-upload-file-card-side-default", "py-4", "rounded-file-upload-file-card-rounding-default border border-elevation-outline-default-1 border-solid");
|
|
101
|
-
$[
|
|
102
|
-
} else t2 = $[
|
|
107
|
+
$[28] = t2;
|
|
108
|
+
} else t2 = $[28];
|
|
103
109
|
let t3;
|
|
104
|
-
if ($[
|
|
110
|
+
if ($[29] !== content) {
|
|
105
111
|
t3 = /* @__PURE__ */ jsx("div", {
|
|
106
112
|
className: t2,
|
|
107
113
|
children: content
|
|
108
114
|
});
|
|
109
|
-
$[
|
|
110
|
-
$[
|
|
111
|
-
} else t3 = $[
|
|
115
|
+
$[29] = content;
|
|
116
|
+
$[30] = t3;
|
|
117
|
+
} else t3 = $[30];
|
|
112
118
|
return t3;
|
|
113
119
|
};
|
|
114
120
|
//#endregion
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { FileUploadProps, FileUploadState } from '../FileUpload';
|
|
2
|
-
interface FileCardListProps extends Pick<FileUploadProps, "isDisabled" | "as"> {
|
|
2
|
+
interface FileCardListProps extends Pick<FileUploadProps, "isDisabled" | "as" | "browseButtonProps" | "cancelButtonProps"> {
|
|
3
3
|
uploadState: FileUploadState[];
|
|
4
4
|
className?: string;
|
|
5
5
|
onRemove?: (id: string) => void;
|
|
6
6
|
onCancel?: (index: number) => void;
|
|
7
7
|
}
|
|
8
|
-
export declare const FileCardList: ({ uploadState, as, isDisabled, className, onRemove, onCancel }: FileCardListProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare const FileCardList: ({ uploadState, as, isDisabled, browseButtonProps, cancelButtonProps, className, onRemove, onCancel, }: FileCardListProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
9
|
export {};
|
|
@@ -4,8 +4,8 @@ import { jsx } from "react/jsx-runtime";
|
|
|
4
4
|
import { clsx } from "clsx";
|
|
5
5
|
//#region src/components/inputs/File/shared/FileCardList.tsx
|
|
6
6
|
var FileCardList = (t0) => {
|
|
7
|
-
const $ = c(
|
|
8
|
-
const { uploadState, as, isDisabled, className, onRemove, onCancel } = t0;
|
|
7
|
+
const $ = c(20);
|
|
8
|
+
const { uploadState, as, isDisabled, browseButtonProps, cancelButtonProps, className, onRemove, onCancel } = t0;
|
|
9
9
|
let t1;
|
|
10
10
|
if ($[0] !== className) {
|
|
11
11
|
t1 = clsx("mt-10 flex flex-col items-start gap-4 self-stretch", className);
|
|
@@ -13,41 +13,47 @@ var FileCardList = (t0) => {
|
|
|
13
13
|
$[1] = t1;
|
|
14
14
|
} else t1 = $[1];
|
|
15
15
|
let t2;
|
|
16
|
-
if ($[2] !== as || $[3] !==
|
|
16
|
+
if ($[2] !== as || $[3] !== browseButtonProps || $[4] !== cancelButtonProps || $[5] !== isDisabled || $[6] !== onCancel || $[7] !== onRemove || $[8] !== uploadState) {
|
|
17
17
|
let t3;
|
|
18
|
-
if ($[
|
|
18
|
+
if ($[10] !== as || $[11] !== browseButtonProps || $[12] !== cancelButtonProps || $[13] !== isDisabled || $[14] !== onCancel || $[15] !== onRemove) {
|
|
19
19
|
t3 = (state, index) => /* @__PURE__ */ jsx(FileCard, {
|
|
20
20
|
index,
|
|
21
21
|
as,
|
|
22
22
|
state,
|
|
23
23
|
isDisabled,
|
|
24
|
+
browseButtonProps,
|
|
25
|
+
cancelButtonProps,
|
|
24
26
|
onRemove,
|
|
25
27
|
onCancel
|
|
26
28
|
}, state.file?.name ?? state.displayName ?? state.id ?? state.src);
|
|
27
|
-
$[
|
|
28
|
-
$[
|
|
29
|
-
$[
|
|
30
|
-
$[
|
|
31
|
-
$[
|
|
32
|
-
|
|
29
|
+
$[10] = as;
|
|
30
|
+
$[11] = browseButtonProps;
|
|
31
|
+
$[12] = cancelButtonProps;
|
|
32
|
+
$[13] = isDisabled;
|
|
33
|
+
$[14] = onCancel;
|
|
34
|
+
$[15] = onRemove;
|
|
35
|
+
$[16] = t3;
|
|
36
|
+
} else t3 = $[16];
|
|
33
37
|
t2 = uploadState.map(t3);
|
|
34
38
|
$[2] = as;
|
|
35
|
-
$[3] =
|
|
36
|
-
$[4] =
|
|
37
|
-
$[5] =
|
|
38
|
-
$[6] =
|
|
39
|
-
$[7] =
|
|
40
|
-
|
|
39
|
+
$[3] = browseButtonProps;
|
|
40
|
+
$[4] = cancelButtonProps;
|
|
41
|
+
$[5] = isDisabled;
|
|
42
|
+
$[6] = onCancel;
|
|
43
|
+
$[7] = onRemove;
|
|
44
|
+
$[8] = uploadState;
|
|
45
|
+
$[9] = t2;
|
|
46
|
+
} else t2 = $[9];
|
|
41
47
|
let t3;
|
|
42
|
-
if ($[
|
|
48
|
+
if ($[17] !== t1 || $[18] !== t2) {
|
|
43
49
|
t3 = /* @__PURE__ */ jsx("div", {
|
|
44
50
|
className: t1,
|
|
45
51
|
children: t2
|
|
46
52
|
});
|
|
47
|
-
$[
|
|
48
|
-
$[
|
|
49
|
-
$[
|
|
50
|
-
} else t3 = $[
|
|
53
|
+
$[17] = t1;
|
|
54
|
+
$[18] = t2;
|
|
55
|
+
$[19] = t3;
|
|
56
|
+
} else t3 = $[19];
|
|
51
57
|
return t3;
|
|
52
58
|
};
|
|
53
59
|
//#endregion
|
|
@@ -6,5 +6,5 @@ type FileUploadContentProps = Omit<FileUploadBaseProps, "ref" | "children" | "em
|
|
|
6
6
|
handleCancelUpload: (index: number) => void;
|
|
7
7
|
handleRemove: (id: string) => void;
|
|
8
8
|
};
|
|
9
|
-
export declare const FileUploadContent: ({ variant, as, isDisabled, browseText, uploadText, emptyText, uploadState, handleCancelUpload, handleRemove, acceptedFileTypes, allowsMultiple, handleSelect, ...rest }: FileUploadContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare const FileUploadContent: ({ variant, as, isDisabled, browseText, uploadText, emptyText, uploadState, browseButtonProps, cancelButtonProps, handleCancelUpload, handleRemove, acceptedFileTypes, allowsMultiple, handleSelect, ...rest }: FileUploadContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
10
|
export {};
|