@povio/ui 2.2.8-rc → 2.2.9-rc.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/components/Breadcrumbs/Breadcrumbs.d.ts +2 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.js +2 -2
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +3 -60
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +3 -89
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +3 -60
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +5 -57
- package/dist/components/inputs/DateTime/shared/DatePickerInput.js +1 -0
- package/dist/components/inputs/DateTime/shared/TimePickerInput.d.ts +2 -1
- package/dist/components/inputs/DateTime/shared/TimePickerInput.js +3 -1
- package/dist/components/inputs/File/InputUpload.js +5 -3
- package/dist/components/inputs/File/inputUpload.types.d.ts +4 -1
- package/dist/components/inputs/File/inputUpload.types.js +9 -0
- package/dist/components/inputs/File/shared/FileUploadContentFilled.js +3 -1
- package/dist/components/inputs/File/shared/InputUploadContent.d.ts +2 -1
- package/dist/components/inputs/File/shared/InputUploadContent.js +4 -3
- package/dist/components/inputs/File/shared/InputUploadFilled.d.ts +3 -2
- package/dist/components/inputs/File/shared/InputUploadFilled.js +2 -2
- package/dist/components/inputs/Input/NumberInput/NumberInput.d.ts +0 -1
- package/dist/components/inputs/Input/NumberInput/NumberInput.js +9 -80
- package/dist/components/inputs/Input/TextInput/TextInput.d.ts +0 -1
- package/dist/components/inputs/Input/TextInput/TextInput.js +9 -83
- package/dist/components/inputs/Selection/Autocomplete/Autocomplete.js +4 -63
- package/dist/components/inputs/Selection/Select/Select.js +4 -64
- package/dist/components/inputs/Selection/shared/SelectBase.d.ts +2 -0
- package/dist/components/inputs/Selection/shared/SelectBase.js +2 -1
- package/dist/components/inputs/Selection/shared/SelectDesktop.js +3 -1
- package/dist/components/inputs/Selection/shared/SelectInput.d.ts +2 -2
- package/dist/components/inputs/Selection/shared/SelectInput.js +13 -3
- package/dist/components/inputs/Selection/shared/SelectListBoxItem.d.ts +0 -1
- package/dist/components/inputs/Selection/shared/SelectListBoxItem.js +8 -4
- package/dist/components/inputs/Selection/shared/SelectListBoxItemSelectAll.js +5 -3
- package/dist/components/inputs/Selection/shared/SelectListBoxLoadingItem.js +4 -2
- package/dist/components/inputs/Selection/shared/SelectMobile.js +5 -2
- package/dist/components/inputs/Selection/shared/selectItem.cva.d.ts +6 -0
- package/dist/components/inputs/Selection/shared/selectItem.cva.js +21 -0
- package/dist/components/inputs/TextEditor/TextEditor.d.ts +1 -0
- package/dist/components/inputs/TextEditor/TextEditor.js +7 -3
- package/dist/config/uiConfig.context.d.ts +1 -2
- package/dist/config/uiConfig.context.js +2 -2
- package/dist/config/uiStyle.context.d.ts +4 -0
- package/dist/utils/date-time.utils.d.ts +0 -10
- package/dist/utils/date-time.utils.js +1 -82
- package/package.json +1 -1
- package/dist/components/inputs/shared/StaticInput.d.ts +0 -18
- package/dist/components/inputs/shared/StaticInput.js +0 -69
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { FC, SVGProps } from 'react';
|
|
2
2
|
import { Key } from 'react-aria-components';
|
|
3
|
+
import { LinkNavigationProps } from '../text/Link/Link';
|
|
3
4
|
export interface BreadcrumbItem {
|
|
4
5
|
id: Key;
|
|
5
6
|
label: string;
|
|
6
|
-
|
|
7
|
+
link?: LinkNavigationProps;
|
|
7
8
|
icon?: FC<SVGProps<SVGSVGElement>>;
|
|
8
9
|
}
|
|
9
10
|
export interface BreadcrumbsProps {
|
|
@@ -37,7 +37,7 @@ var Breadcrumbs$1 = ({ items, className, onAction, iconOnly = false }) => {
|
|
|
37
37
|
const lastItem = items[items.length - 1];
|
|
38
38
|
const LinkComponent = LinkContext.useLinkContext()?.LinkComponent ?? Link;
|
|
39
39
|
const renderBreadcrumbLink = (item, isCurrent, iconOnly) => /* @__PURE__ */ jsxs(LinkComponent, {
|
|
40
|
-
|
|
40
|
+
...item.link,
|
|
41
41
|
className: breadcrumbItem$1({ isCurrent }),
|
|
42
42
|
children: [item.icon && /* @__PURE__ */ jsx(item.icon, {
|
|
43
43
|
className: breadcrumbIconCva({}),
|
|
@@ -52,7 +52,7 @@ var Breadcrumbs$1 = ({ items, className, onAction, iconOnly = false }) => {
|
|
|
52
52
|
const menuItems = hiddenItems.map((item) => ({
|
|
53
53
|
id: item.id,
|
|
54
54
|
label: item.label,
|
|
55
|
-
|
|
55
|
+
link: item.link
|
|
56
56
|
}));
|
|
57
57
|
const renderEllipsis = () => /* @__PURE__ */ jsx(MenuDesktop, {
|
|
58
58
|
trigger: /* @__PURE__ */ jsx(Tooltip$1, {
|
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
import { CalendarIcon } from "../../../../assets/icons/Calendar.js";
|
|
2
1
|
import { UIConfig } from "../../../../config/uiConfig.context.js";
|
|
3
|
-
import { TodayIcon } from "../../../../assets/icons/Today.js";
|
|
4
2
|
import { Calendar } from "../shared/Calendar.js";
|
|
5
3
|
import { DatePickerInput } from "../shared/DatePickerInput.js";
|
|
6
4
|
import { DateTimeDialog } from "../shared/DateTimeDialog.js";
|
|
7
5
|
import { DateTimeDialogFooter } from "../shared/DateTimeDialogFooter.js";
|
|
8
6
|
import { FormField } from "../../FormField/FormField.js";
|
|
9
|
-
import { StaticInput } from "../../shared/StaticInput.js";
|
|
10
7
|
import { TooltipWrapper } from "../../shared/TooltipWrapper.js";
|
|
11
8
|
import { DateTimeUtils } from "../../../../utils/date-time.utils.js";
|
|
12
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
10
|
import { clsx } from "clsx";
|
|
14
|
-
import {
|
|
11
|
+
import { useImperativeHandle, useMemo, useRef } from "react";
|
|
15
12
|
import { useDatePicker, useLocale } from "react-aria";
|
|
16
13
|
import { mergeRefs } from "@react-aria/utils";
|
|
17
|
-
import { Controller
|
|
14
|
+
import { Controller } from "react-hook-form";
|
|
18
15
|
import { createCalendar, getLocalTimeZone, toCalendarDate, today } from "@internationalized/date";
|
|
19
16
|
import { DateTime } from "luxon";
|
|
20
17
|
import { useCalendarState, useDatePickerState } from "react-stately";
|
|
@@ -154,18 +151,6 @@ var DatePickerBase = (props) => {
|
|
|
154
151
|
});
|
|
155
152
|
};
|
|
156
153
|
var DatePicker = ({ fullIso = true, minValue, maxValue, ...props }) => {
|
|
157
|
-
const ui = UIConfig.useConfig();
|
|
158
|
-
const { locale } = useLocale();
|
|
159
|
-
const [renderInput, setRenderInput] = useState(!ui.renderStaticInput);
|
|
160
|
-
const [shouldFocus, setShouldFocus] = useState(false);
|
|
161
|
-
const inputRef = useRef(null);
|
|
162
|
-
const watchedValue = "formControl" in props && props.formControl ? useWatch({
|
|
163
|
-
control: props.formControl.control,
|
|
164
|
-
name: props.formControl.name
|
|
165
|
-
}) : props.value;
|
|
166
|
-
let isFormControlDisabled = false;
|
|
167
|
-
if ("formControl" in props && props.formControl) isFormControlDisabled = !!props.formControl.control._options?.disabled;
|
|
168
|
-
const rawValue = watchedValue ?? props.value ?? null;
|
|
169
154
|
const formatCalendarDate = (calendarDate) => {
|
|
170
155
|
if (calendarDate === null) return null;
|
|
171
156
|
if (fullIso) return DateTimeUtils.fromCalendarDateToUTCISO(calendarDate);
|
|
@@ -182,47 +167,6 @@ var DatePicker = ({ fullIso = true, minValue, maxValue, ...props }) => {
|
|
|
182
167
|
minValue: typeof minValue === "string" ? parseCalendarDate(minValue) : minValue,
|
|
183
168
|
maxValue: typeof maxValue === "string" ? parseCalendarDate(maxValue) : maxValue
|
|
184
169
|
};
|
|
185
|
-
useEffect(() => {
|
|
186
|
-
if (!renderInput || !shouldFocus) return;
|
|
187
|
-
requestAnimationFrame(() => {
|
|
188
|
-
((inputRef.current?.getContainer?.() ?? inputRef.current)?.querySelector("input, button, [tabindex]:not([tabindex='-1'])"))?.focus();
|
|
189
|
-
});
|
|
190
|
-
setShouldFocus(false);
|
|
191
|
-
}, [renderInput, shouldFocus]);
|
|
192
|
-
if (!renderInput) {
|
|
193
|
-
const as = props.as ?? ui.input.as;
|
|
194
|
-
const size = props.size ?? ui.input.size;
|
|
195
|
-
const variant = props.variant ?? ui.input.variant;
|
|
196
|
-
const hideLabel = props.hideLabel ?? ui.input.hideLabel;
|
|
197
|
-
const isHeaderHidden = props.isHeaderHidden || as === "inline" || as === "filter" || as === "floating";
|
|
198
|
-
let isDisabled = !!props.isDisabled;
|
|
199
|
-
if (isFormControlDisabled) isDisabled = true;
|
|
200
|
-
const todayIcon = props.todayIcon ?? ui.dateInput.todayIcon;
|
|
201
|
-
const disableManualEntry = props.disableManualEntry ?? ui.dateInput.disableManualEntry;
|
|
202
|
-
const showDropdown = !props.disableDropdown || disableManualEntry;
|
|
203
|
-
const staticPlaceholder = props.placeholder ?? DateTimeUtils.getDatePlaceholder(locale);
|
|
204
|
-
const staticDateValue = rawValue ? parseCalendarDate(rawValue) : null;
|
|
205
|
-
const displayValue = staticDateValue ? DateTimeUtils.formatCalendarDateLocalized(staticDateValue, locale) : "";
|
|
206
|
-
return /* @__PURE__ */ jsx(StaticInput, {
|
|
207
|
-
...props,
|
|
208
|
-
onInteract: (focus) => {
|
|
209
|
-
setShouldFocus(focus);
|
|
210
|
-
setRenderInput(true);
|
|
211
|
-
},
|
|
212
|
-
className: clsx("relative inline-flex w-full flex-col text-left", props.className),
|
|
213
|
-
as,
|
|
214
|
-
size,
|
|
215
|
-
variant,
|
|
216
|
-
hideLabel,
|
|
217
|
-
isHeaderHidden,
|
|
218
|
-
isDisabled,
|
|
219
|
-
placeholder: staticPlaceholder,
|
|
220
|
-
displayValue,
|
|
221
|
-
isEmpty: !displayValue,
|
|
222
|
-
leadingVisual: todayIcon ? /* @__PURE__ */ jsx(TodayIcon, { className: "size-6 text-interactive-text-secondary-idle" }) : void 0,
|
|
223
|
-
trailingVisual: showDropdown ? /* @__PURE__ */ jsx(CalendarIcon, { className: "size-6 text-interactive-text-secondary-idle" }) : void 0
|
|
224
|
-
});
|
|
225
|
-
}
|
|
226
170
|
if ("formControl" in props && props.formControl) {
|
|
227
171
|
const { formControl, ref, ...innerProps } = props;
|
|
228
172
|
return /* @__PURE__ */ jsx(Controller, {
|
|
@@ -231,7 +175,7 @@ var DatePicker = ({ fullIso = true, minValue, maxValue, ...props }) => {
|
|
|
231
175
|
render: ({ field, fieldState: { error, isDirty } }) => /* @__PURE__ */ jsx(DatePickerBase, {
|
|
232
176
|
...innerProps,
|
|
233
177
|
...dateLimits,
|
|
234
|
-
ref: mergeRefs(ref, field.ref
|
|
178
|
+
ref: mergeRefs(ref, field.ref),
|
|
235
179
|
value: parseCalendarDate(field.value),
|
|
236
180
|
onChange: (value) => field.onChange(formatCalendarDate(value)),
|
|
237
181
|
onBlur: field.onBlur,
|
|
@@ -244,7 +188,6 @@ var DatePicker = ({ fullIso = true, minValue, maxValue, ...props }) => {
|
|
|
244
188
|
return /* @__PURE__ */ jsx(DatePickerBase, {
|
|
245
189
|
...props,
|
|
246
190
|
...dateLimits,
|
|
247
|
-
ref: mergeRefs(props.ref, inputRef),
|
|
248
191
|
value: parseCalendarDate(props.value),
|
|
249
192
|
onChange: (value) => props.onChange?.(formatCalendarDate(value))
|
|
250
193
|
});
|
|
@@ -1,24 +1,21 @@
|
|
|
1
|
-
import { CalendarIcon } from "../../../../assets/icons/Calendar.js";
|
|
2
1
|
import { Typography } from "../../../text/Typography/Typography.js";
|
|
3
2
|
import { UIConfig } from "../../../../config/uiConfig.context.js";
|
|
4
3
|
import "../../../../config/i18n.js";
|
|
5
|
-
import { TodayIcon } from "../../../../assets/icons/Today.js";
|
|
6
4
|
import { DatePickerInput } from "../shared/DatePickerInput.js";
|
|
7
5
|
import { DateTimeDialog } from "../shared/DateTimeDialog.js";
|
|
8
6
|
import { DateTimeDialogFooter } from "../shared/DateTimeDialogFooter.js";
|
|
9
7
|
import { FormField } from "../../FormField/FormField.js";
|
|
10
|
-
import { StaticInput } from "../../shared/StaticInput.js";
|
|
11
8
|
import { TooltipWrapper } from "../../shared/TooltipWrapper.js";
|
|
12
9
|
import { DateTimeUtils } from "../../../../utils/date-time.utils.js";
|
|
13
10
|
import { RangeCalendar } from "../shared/RangeCalendar.js";
|
|
14
11
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
15
12
|
import { clsx } from "clsx";
|
|
16
|
-
import { useCallback,
|
|
13
|
+
import { useCallback, useImperativeHandle, useMemo, useRef, useState } from "react";
|
|
17
14
|
import { Button } from "react-aria-components";
|
|
18
15
|
import { useDateRangePicker, useLocale as useLocale$1 } from "react-aria";
|
|
19
16
|
import { mergeRefs } from "@react-aria/utils";
|
|
20
17
|
import { useTranslation } from "react-i18next";
|
|
21
|
-
import { Controller
|
|
18
|
+
import { Controller } from "react-hook-form";
|
|
22
19
|
import { createCalendar, endOfMonth, endOfWeek, endOfYear, getLocalTimeZone, startOfMonth, startOfWeek, startOfYear, toCalendarDate, today } from "@internationalized/date";
|
|
23
20
|
import { DateTime } from "luxon";
|
|
24
21
|
import { useDateRangePickerState, useRangeCalendarState } from "react-stately";
|
|
@@ -533,18 +530,6 @@ var DateRangePickerBase = (props) => {
|
|
|
533
530
|
});
|
|
534
531
|
};
|
|
535
532
|
var DateRangePicker = ({ fullIso = true, minValue, maxValue, ...props }) => {
|
|
536
|
-
const ui = UIConfig.useConfig();
|
|
537
|
-
const { locale } = useLocale$1();
|
|
538
|
-
const [renderInput, setRenderInput] = useState(!ui.renderStaticInput);
|
|
539
|
-
const [shouldFocus, setShouldFocus] = useState(false);
|
|
540
|
-
const inputRef = useRef(null);
|
|
541
|
-
const watchedValue = "formControl" in props && props.formControl ? useWatch({
|
|
542
|
-
control: props.formControl.control,
|
|
543
|
-
name: props.formControl.name
|
|
544
|
-
}) : props.value;
|
|
545
|
-
let isFormControlDisabled = false;
|
|
546
|
-
if ("formControl" in props && props.formControl) isFormControlDisabled = !!props.formControl.control._options?.disabled;
|
|
547
|
-
const rawValue = watchedValue ?? props.value ?? null;
|
|
548
533
|
const formatDateRange = (range) => {
|
|
549
534
|
if (!range?.start || !range?.end) return null;
|
|
550
535
|
if (fullIso) return {
|
|
@@ -583,76 +568,6 @@ var DateRangePicker = ({ fullIso = true, minValue, maxValue, ...props }) => {
|
|
|
583
568
|
minValue: typeof minValue === "string" ? parseCalendarDate(minValue) : minValue,
|
|
584
569
|
maxValue: typeof maxValue === "string" ? parseCalendarDate(maxValue) : maxValue
|
|
585
570
|
};
|
|
586
|
-
useEffect(() => {
|
|
587
|
-
if (!renderInput || !shouldFocus) return;
|
|
588
|
-
requestAnimationFrame(() => {
|
|
589
|
-
((inputRef.current?.getContainer?.() ?? inputRef.current)?.querySelector("input, button, [tabindex]:not([tabindex='-1'])"))?.focus();
|
|
590
|
-
});
|
|
591
|
-
setShouldFocus(false);
|
|
592
|
-
}, [renderInput, shouldFocus]);
|
|
593
|
-
if (!renderInput) {
|
|
594
|
-
const as = props.as ?? ui.input.as;
|
|
595
|
-
const size = props.size ?? ui.input.size;
|
|
596
|
-
const variant = props.variant ?? ui.input.variant;
|
|
597
|
-
const hideLabel = props.hideLabel ?? ui.input.hideLabel;
|
|
598
|
-
const isHeaderHidden = props.isHeaderHidden || as === "inline" || as === "filter" || as === "floating";
|
|
599
|
-
let isDisabled = !!props.isDisabled;
|
|
600
|
-
if (isFormControlDisabled) isDisabled = true;
|
|
601
|
-
const todayIcon = props.todayIcon ?? ui.dateInput.todayIcon;
|
|
602
|
-
const disableManualEntry = props.disableManualEntry ?? ui.dateInput.disableManualEntry;
|
|
603
|
-
const showDropdown = !props.disableDropdown || disableManualEntry;
|
|
604
|
-
const defaultDatePlaceholder = DateTimeUtils.getDatePlaceholder(locale);
|
|
605
|
-
const staticPlaceholder = props.placeholder ?? /* @__PURE__ */ jsxs("span", {
|
|
606
|
-
className: "inline-flex items-center gap-input-gap-input-text-to-elements",
|
|
607
|
-
children: [
|
|
608
|
-
/* @__PURE__ */ jsx("span", { children: defaultDatePlaceholder }),
|
|
609
|
-
/* @__PURE__ */ jsx("span", {
|
|
610
|
-
className: "pointer-events-none select-none",
|
|
611
|
-
children: "–"
|
|
612
|
-
}),
|
|
613
|
-
/* @__PURE__ */ jsx("span", { children: defaultDatePlaceholder })
|
|
614
|
-
]
|
|
615
|
-
});
|
|
616
|
-
const formatStaticDate = (value) => {
|
|
617
|
-
if (!value) return "";
|
|
618
|
-
const parsedDate = parseCalendarDate(value);
|
|
619
|
-
if (!parsedDate) return "";
|
|
620
|
-
return DateTimeUtils.formatCalendarDateLocalized(parsedDate, locale);
|
|
621
|
-
};
|
|
622
|
-
const start = formatStaticDate(rawValue?.start ?? null);
|
|
623
|
-
const end = formatStaticDate(rawValue?.end ?? null);
|
|
624
|
-
const hasRangeValue = !!(start && end);
|
|
625
|
-
const displayValue = hasRangeValue ? /* @__PURE__ */ jsxs("span", {
|
|
626
|
-
className: "inline-flex items-center gap-input-gap-input-text-to-elements",
|
|
627
|
-
children: [
|
|
628
|
-
/* @__PURE__ */ jsx("span", { children: start }),
|
|
629
|
-
/* @__PURE__ */ jsx("span", {
|
|
630
|
-
className: "pointer-events-none select-none",
|
|
631
|
-
children: "–"
|
|
632
|
-
}),
|
|
633
|
-
/* @__PURE__ */ jsx("span", { children: end })
|
|
634
|
-
]
|
|
635
|
-
}) : void 0;
|
|
636
|
-
return /* @__PURE__ */ jsx(StaticInput, {
|
|
637
|
-
...props,
|
|
638
|
-
onInteract: (focus) => {
|
|
639
|
-
setShouldFocus(focus);
|
|
640
|
-
setRenderInput(true);
|
|
641
|
-
},
|
|
642
|
-
className: clsx("relative inline-flex w-full flex-col text-left", props.className),
|
|
643
|
-
as,
|
|
644
|
-
size,
|
|
645
|
-
variant,
|
|
646
|
-
hideLabel,
|
|
647
|
-
isHeaderHidden,
|
|
648
|
-
isDisabled,
|
|
649
|
-
placeholder: staticPlaceholder,
|
|
650
|
-
displayValue,
|
|
651
|
-
isEmpty: !hasRangeValue,
|
|
652
|
-
leadingVisual: todayIcon ? /* @__PURE__ */ jsx(TodayIcon, { className: "size-6 text-interactive-text-secondary-idle" }) : void 0,
|
|
653
|
-
trailingVisual: showDropdown ? /* @__PURE__ */ jsx(CalendarIcon, { className: "size-6 text-interactive-text-secondary-idle" }) : void 0
|
|
654
|
-
});
|
|
655
|
-
}
|
|
656
571
|
if ("formControl" in props && props.formControl) {
|
|
657
572
|
const { formControl, ref, ...innerProps } = props;
|
|
658
573
|
return /* @__PURE__ */ jsx(Controller, {
|
|
@@ -661,7 +576,7 @@ var DateRangePicker = ({ fullIso = true, minValue, maxValue, ...props }) => {
|
|
|
661
576
|
render: ({ field, fieldState: { error, isDirty } }) => /* @__PURE__ */ jsx(DateRangePickerBase, {
|
|
662
577
|
...innerProps,
|
|
663
578
|
...dateLimits,
|
|
664
|
-
ref: mergeRefs(ref, field.ref
|
|
579
|
+
ref: mergeRefs(ref, field.ref),
|
|
665
580
|
value: parseDateRange(field.value),
|
|
666
581
|
onChange: (value) => field.onChange(formatDateRange(value)),
|
|
667
582
|
onBlur: field.onBlur,
|
|
@@ -674,7 +589,6 @@ var DateRangePicker = ({ fullIso = true, minValue, maxValue, ...props }) => {
|
|
|
674
589
|
return /* @__PURE__ */ jsx(DateRangePickerBase, {
|
|
675
590
|
...props,
|
|
676
591
|
...dateLimits,
|
|
677
|
-
ref: mergeRefs(props.ref, inputRef),
|
|
678
592
|
value: parseDateRange(props.value),
|
|
679
593
|
onChange: (value) => props.onChange?.(formatDateRange(value))
|
|
680
594
|
});
|
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
import { DateTimeIcon } from "../../../../assets/icons/DateTime.js";
|
|
2
1
|
import { UIConfig } from "../../../../config/uiConfig.context.js";
|
|
3
|
-
import { TodayIcon } from "../../../../assets/icons/Today.js";
|
|
4
2
|
import { Calendar } from "../shared/Calendar.js";
|
|
5
3
|
import { DatePickerInput } from "../shared/DatePickerInput.js";
|
|
6
4
|
import { DateTimeDialog } from "../shared/DateTimeDialog.js";
|
|
7
5
|
import { DateTimeDialogFooter } from "../shared/DateTimeDialogFooter.js";
|
|
8
6
|
import { FormField } from "../../FormField/FormField.js";
|
|
9
|
-
import { StaticInput } from "../../shared/StaticInput.js";
|
|
10
7
|
import { TooltipWrapper } from "../../shared/TooltipWrapper.js";
|
|
11
8
|
import { DateTimeUtils } from "../../../../utils/date-time.utils.js";
|
|
12
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
-
import { useEffect, useImperativeHandle, useMemo, useRef
|
|
10
|
+
import { useEffect, useImperativeHandle, useMemo, useRef } from "react";
|
|
14
11
|
import { useDatePicker, useLocale } from "react-aria";
|
|
15
12
|
import { mergeRefs } from "@react-aria/utils";
|
|
16
|
-
import { Controller
|
|
13
|
+
import { Controller } from "react-hook-form";
|
|
17
14
|
import { Time, createCalendar, getLocalTimeZone, now, toCalendarDateTime, today } from "@internationalized/date";
|
|
18
15
|
import { useCalendarState, useDatePickerState } from "react-stately";
|
|
19
16
|
//#region src/components/inputs/DateTime/DateTimePicker/DateTimePicker.tsx
|
|
@@ -177,18 +174,6 @@ var DateTimePickerBase = (props) => {
|
|
|
177
174
|
});
|
|
178
175
|
};
|
|
179
176
|
var DateTimePicker = ({ fullIso = true, ...props }) => {
|
|
180
|
-
const ui = UIConfig.useConfig();
|
|
181
|
-
const { locale } = useLocale();
|
|
182
|
-
const [renderInput, setRenderInput] = useState(!ui.renderStaticInput);
|
|
183
|
-
const [shouldFocus, setShouldFocus] = useState(false);
|
|
184
|
-
const inputRef = useRef(null);
|
|
185
|
-
const watchedValue = "formControl" in props && props.formControl ? useWatch({
|
|
186
|
-
control: props.formControl.control,
|
|
187
|
-
name: props.formControl.name
|
|
188
|
-
}) : props.value;
|
|
189
|
-
let isFormControlDisabled = false;
|
|
190
|
-
if ("formControl" in props && props.formControl) isFormControlDisabled = !!props.formControl.control._options?.disabled;
|
|
191
|
-
const rawValue = watchedValue ?? props.value ?? null;
|
|
192
177
|
const formatDateValue = (dateValue) => {
|
|
193
178
|
if (dateValue === null) return null;
|
|
194
179
|
if (fullIso) return DateTimeUtils.fromCalendarDateTimeToUTCISO(dateValue);
|
|
@@ -198,47 +183,6 @@ var DateTimePicker = ({ fullIso = true, ...props }) => {
|
|
|
198
183
|
if (isoString == null) return isoString;
|
|
199
184
|
return DateTimeUtils.fromUTCISOToCalendarDateTime(isoString);
|
|
200
185
|
};
|
|
201
|
-
useEffect(() => {
|
|
202
|
-
if (!renderInput || !shouldFocus) return;
|
|
203
|
-
requestAnimationFrame(() => {
|
|
204
|
-
((inputRef.current?.getContainer?.() ?? inputRef.current)?.querySelector("input, button, [tabindex]:not([tabindex='-1'])"))?.focus();
|
|
205
|
-
});
|
|
206
|
-
setShouldFocus(false);
|
|
207
|
-
}, [renderInput, shouldFocus]);
|
|
208
|
-
if (!renderInput) {
|
|
209
|
-
const as = props.as ?? ui.input.as;
|
|
210
|
-
const size = props.size ?? ui.input.size;
|
|
211
|
-
const variant = props.variant ?? ui.input.variant;
|
|
212
|
-
const hideLabel = props.hideLabel ?? ui.input.hideLabel;
|
|
213
|
-
const isHeaderHidden = props.isHeaderHidden || as === "inline" || as === "filter" || as === "floating";
|
|
214
|
-
let isDisabled = !!props.isDisabled;
|
|
215
|
-
if (isFormControlDisabled) isDisabled = true;
|
|
216
|
-
const todayIcon = props.todayIcon ?? ui.dateInput.todayIcon;
|
|
217
|
-
const disableManualEntry = props.disableManualEntry ?? ui.dateInput.disableManualEntry;
|
|
218
|
-
const showDropdown = !props.disableDropdown || disableManualEntry;
|
|
219
|
-
const staticPlaceholder = props.placeholder ?? DateTimeUtils.getDateTimePlaceholder(locale);
|
|
220
|
-
const staticDateTimeValue = rawValue ? parseDateValue(rawValue) : null;
|
|
221
|
-
const displayValue = staticDateTimeValue && "hour" in staticDateTimeValue ? DateTimeUtils.formatCalendarDateTimeLocalized(staticDateTimeValue, locale) : "";
|
|
222
|
-
return /* @__PURE__ */ jsx(StaticInput, {
|
|
223
|
-
...props,
|
|
224
|
-
onInteract: (focus) => {
|
|
225
|
-
setShouldFocus(focus);
|
|
226
|
-
setRenderInput(true);
|
|
227
|
-
},
|
|
228
|
-
className: props.className ? `relative inline-flex w-full flex-col text-left ${props.className}` : "relative inline-flex w-full flex-col text-left",
|
|
229
|
-
as,
|
|
230
|
-
size,
|
|
231
|
-
variant,
|
|
232
|
-
hideLabel,
|
|
233
|
-
isHeaderHidden,
|
|
234
|
-
isDisabled,
|
|
235
|
-
placeholder: staticPlaceholder,
|
|
236
|
-
displayValue,
|
|
237
|
-
isEmpty: !displayValue,
|
|
238
|
-
leadingVisual: todayIcon ? /* @__PURE__ */ jsx(TodayIcon, { className: "size-6 text-interactive-text-secondary-idle" }) : void 0,
|
|
239
|
-
trailingVisual: showDropdown ? /* @__PURE__ */ jsx(DateTimeIcon, { className: "size-6 text-interactive-text-secondary-idle" }) : void 0
|
|
240
|
-
});
|
|
241
|
-
}
|
|
242
186
|
if ("formControl" in props && props.formControl) {
|
|
243
187
|
const { formControl, ref, ...innerProps } = props;
|
|
244
188
|
return /* @__PURE__ */ jsx(Controller, {
|
|
@@ -246,7 +190,7 @@ var DateTimePicker = ({ fullIso = true, ...props }) => {
|
|
|
246
190
|
name: formControl.name,
|
|
247
191
|
render: ({ field, fieldState: { error, isDirty } }) => /* @__PURE__ */ jsx(DateTimePickerBase, {
|
|
248
192
|
...innerProps,
|
|
249
|
-
ref: mergeRefs(ref, field.ref
|
|
193
|
+
ref: mergeRefs(ref, field.ref),
|
|
250
194
|
value: parseDateValue(field.value),
|
|
251
195
|
onChange: (value) => field.onChange(formatDateValue(value)),
|
|
252
196
|
onBlur: field.onBlur,
|
|
@@ -258,7 +202,6 @@ var DateTimePicker = ({ fullIso = true, ...props }) => {
|
|
|
258
202
|
}
|
|
259
203
|
return /* @__PURE__ */ jsx(DateTimePickerBase, {
|
|
260
204
|
...props,
|
|
261
|
-
ref: mergeRefs(props.ref, inputRef),
|
|
262
205
|
value: parseDateValue(props.value),
|
|
263
206
|
onChange: (value) => props.onChange?.(formatDateValue(value))
|
|
264
207
|
});
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { ClockIcon } from "../../../../assets/icons/Clock.js";
|
|
2
1
|
import { UIConfig } from "../../../../config/uiConfig.context.js";
|
|
3
2
|
import { TimePickerForm } from "../shared/TimePickerForm.js";
|
|
4
3
|
import { DateTimeDialog } from "../shared/DateTimeDialog.js";
|
|
5
4
|
import { DateTimeDialogFooter } from "../shared/DateTimeDialogFooter.js";
|
|
6
5
|
import { FormField } from "../../FormField/FormField.js";
|
|
7
|
-
import { StaticInput } from "../../shared/StaticInput.js";
|
|
8
6
|
import { TooltipWrapper } from "../../shared/TooltipWrapper.js";
|
|
9
7
|
import { DateTimeUtils } from "../../../../utils/date-time.utils.js";
|
|
10
8
|
import { TimePickerInput } from "../shared/TimePickerInput.js";
|
|
@@ -13,7 +11,7 @@ import { clsx } from "clsx";
|
|
|
13
11
|
import { useEffect, useRef, useState } from "react";
|
|
14
12
|
import { useLocale, useTimeField } from "react-aria";
|
|
15
13
|
import { mergeRefs } from "@react-aria/utils";
|
|
16
|
-
import { Controller
|
|
14
|
+
import { Controller } from "react-hook-form";
|
|
17
15
|
import { getLocalTimeZone, now, toTime } from "@internationalized/date";
|
|
18
16
|
import { DateTime } from "luxon";
|
|
19
17
|
import { useTimeFieldState } from "react-stately";
|
|
@@ -103,6 +101,7 @@ var TimePickerBase = (props) => {
|
|
|
103
101
|
onPress: onOpen,
|
|
104
102
|
isDisabled,
|
|
105
103
|
isDirty,
|
|
104
|
+
isRequired,
|
|
106
105
|
isInvalid: !!error,
|
|
107
106
|
disableDropdown,
|
|
108
107
|
variant,
|
|
@@ -128,18 +127,6 @@ var TimePickerBase = (props) => {
|
|
|
128
127
|
});
|
|
129
128
|
};
|
|
130
129
|
var TimePicker = (props) => {
|
|
131
|
-
const ui = UIConfig.useConfig();
|
|
132
|
-
const { locale } = useLocale();
|
|
133
|
-
const [renderInput, setRenderInput] = useState(!ui.renderStaticInput);
|
|
134
|
-
const [shouldFocus, setShouldFocus] = useState(false);
|
|
135
|
-
const inputRef = useRef(null);
|
|
136
|
-
const watchedValue = "formControl" in props && props.formControl ? useWatch({
|
|
137
|
-
control: props.formControl.control,
|
|
138
|
-
name: props.formControl.name
|
|
139
|
-
}) : props.value;
|
|
140
|
-
let isFormControlDisabled = false;
|
|
141
|
-
if ("formControl" in props && props.formControl) isFormControlDisabled = !!props.formControl.control._options?.disabled;
|
|
142
|
-
const rawValue = watchedValue ?? props.value ?? null;
|
|
143
130
|
const formatTimeValue = (timeValue) => {
|
|
144
131
|
if (timeValue === null) return null;
|
|
145
132
|
const parsedDate = props.date ? DateTime.fromISO(props.date).toJSDate() : void 0;
|
|
@@ -150,56 +137,18 @@ var TimePicker = (props) => {
|
|
|
150
137
|
if (isoString == null) return isoString;
|
|
151
138
|
return toTime(DateTimeUtils.fromISOtoZonedDateTime(isoString));
|
|
152
139
|
};
|
|
153
|
-
useEffect(() => {
|
|
154
|
-
if (!renderInput || !shouldFocus) return;
|
|
155
|
-
requestAnimationFrame(() => {
|
|
156
|
-
(inputRef.current?.querySelector("input, button, [tabindex]:not([tabindex='-1'])"))?.focus();
|
|
157
|
-
});
|
|
158
|
-
setShouldFocus(false);
|
|
159
|
-
}, [renderInput, shouldFocus]);
|
|
160
|
-
if (!renderInput) {
|
|
161
|
-
const as = props.as ?? ui.input.as;
|
|
162
|
-
const size = props.size ?? ui.input.size;
|
|
163
|
-
const variant = props.variant ?? ui.input.variant;
|
|
164
|
-
const hideLabel = props.hideLabel ?? ui.input.hideLabel;
|
|
165
|
-
const isHeaderHidden = props.isHeaderHidden || as === "inline" || as === "filter" || as === "floating";
|
|
166
|
-
let isDisabled = !!props.isDisabled;
|
|
167
|
-
if (isFormControlDisabled) isDisabled = true;
|
|
168
|
-
const disableManualEntry = props.disableManualEntry ?? ui.dateInput.disableManualEntry;
|
|
169
|
-
const showDropdown = !props.disableDropdown || disableManualEntry;
|
|
170
|
-
const staticPlaceholder = props.placeholder ?? DateTimeUtils.getTimePlaceholder(locale);
|
|
171
|
-
const staticTimeValue = rawValue ? parseTimeValue(rawValue) : null;
|
|
172
|
-
const displayValue = staticTimeValue ? DateTimeUtils.formatTimeLocalized(staticTimeValue, locale) : "";
|
|
173
|
-
return /* @__PURE__ */ jsx(StaticInput, {
|
|
174
|
-
...props,
|
|
175
|
-
onInteract: (focus) => {
|
|
176
|
-
setShouldFocus(focus);
|
|
177
|
-
setRenderInput(true);
|
|
178
|
-
},
|
|
179
|
-
className: clsx("relative inline-flex w-full flex-col text-left", props.className),
|
|
180
|
-
as,
|
|
181
|
-
size,
|
|
182
|
-
variant,
|
|
183
|
-
hideLabel,
|
|
184
|
-
isHeaderHidden,
|
|
185
|
-
isDisabled,
|
|
186
|
-
placeholder: staticPlaceholder,
|
|
187
|
-
displayValue,
|
|
188
|
-
isEmpty: !displayValue,
|
|
189
|
-
trailingVisual: showDropdown ? /* @__PURE__ */ jsx(ClockIcon, { className: "size-6 text-interactive-text-secondary-idle" }) : void 0
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
140
|
if ("formControl" in props && props.formControl) {
|
|
193
141
|
const { formControl, ref, ...innerProps } = props;
|
|
194
142
|
return /* @__PURE__ */ jsx(Controller, {
|
|
195
143
|
control: formControl.control,
|
|
196
144
|
name: formControl.name,
|
|
197
|
-
render: ({ field, fieldState: { error } }) => /* @__PURE__ */ jsx(TimePickerBase, {
|
|
145
|
+
render: ({ field, fieldState: { error, isDirty } }) => /* @__PURE__ */ jsx(TimePickerBase, {
|
|
198
146
|
...innerProps,
|
|
199
|
-
ref: mergeRefs(ref, field.ref
|
|
147
|
+
ref: mergeRefs(ref, field.ref),
|
|
200
148
|
value: parseTimeValue(field.value),
|
|
201
149
|
onChange: (value) => field.onChange(formatTimeValue(value)),
|
|
202
150
|
onBlur: field.onBlur,
|
|
151
|
+
isDirty,
|
|
203
152
|
isDisabled: field.disabled || props.isDisabled,
|
|
204
153
|
error: props.error ?? error?.message
|
|
205
154
|
})
|
|
@@ -207,7 +156,6 @@ var TimePicker = (props) => {
|
|
|
207
156
|
}
|
|
208
157
|
return /* @__PURE__ */ jsx(TimePickerBase, {
|
|
209
158
|
...props,
|
|
210
|
-
ref: mergeRefs(props.ref, inputRef),
|
|
211
159
|
value: parseTimeValue(props.value),
|
|
212
160
|
onChange: (value) => props.onChange?.(formatTimeValue(value))
|
|
213
161
|
});
|
|
@@ -82,6 +82,7 @@ var DatePickerInput = ({ ref, as, groupProps, fieldProps, endFieldProps, buttonP
|
|
|
82
82
|
"data-has-selection": fieldProps.value !== null || void 0,
|
|
83
83
|
"data-is-dirty": isDirty || void 0,
|
|
84
84
|
"data-is-required": isRequired || void 0,
|
|
85
|
+
"data-is-filled": fieldProps.value !== null || void 0,
|
|
85
86
|
...groupProps,
|
|
86
87
|
...focusWithinProps,
|
|
87
88
|
...hoverProps,
|
|
@@ -9,6 +9,7 @@ interface DatePickerInputProps extends InputVariantProps {
|
|
|
9
9
|
state: TimeFieldState;
|
|
10
10
|
isDisabled?: boolean;
|
|
11
11
|
isDirty?: boolean;
|
|
12
|
+
isRequired?: boolean;
|
|
12
13
|
isInvalid?: boolean;
|
|
13
14
|
disableDropdown?: boolean;
|
|
14
15
|
headerProps?: FormFieldHeaderProps;
|
|
@@ -18,5 +19,5 @@ interface DatePickerInputProps extends InputVariantProps {
|
|
|
18
19
|
className?: string;
|
|
19
20
|
onPress: () => void;
|
|
20
21
|
}
|
|
21
|
-
export declare const TimePickerInput: ({ ref, as, fieldProps, state, isDisabled, isDirty, isInvalid, disableDropdown, variant, size, isClearable, headerProps, disableManualEntry, placeholder, className, onPress, ...props }: DatePickerInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export declare const TimePickerInput: ({ ref, as, fieldProps, state, isDisabled, isDirty, isRequired, isInvalid, disableDropdown, variant, size, isClearable, headerProps, disableManualEntry, placeholder, className, onPress, ...props }: DatePickerInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
22
23
|
export {};
|
|
@@ -12,7 +12,7 @@ import { useState } from "react";
|
|
|
12
12
|
import { Button } from "react-aria-components";
|
|
13
13
|
import { useFocusVisible, useFocusWithin, useHover } from "react-aria";
|
|
14
14
|
//#region src/components/inputs/DateTime/shared/TimePickerInput.tsx
|
|
15
|
-
var TimePickerInput = ({ ref, as, fieldProps, state, isDisabled, isDirty, isInvalid, disableDropdown, variant, size, isClearable, headerProps, disableManualEntry, placeholder, className, onPress, ...props }) => {
|
|
15
|
+
var TimePickerInput = ({ ref, as, fieldProps, state, isDisabled, isDirty, isRequired, isInvalid, disableDropdown, variant, size, isClearable, headerProps, disableManualEntry, placeholder, className, onPress, ...props }) => {
|
|
16
16
|
const inputBaseCva = UIStyle.useCva("input.baseCva", inputBase);
|
|
17
17
|
const inputSizeCva = UIStyle.useCva("input.sizeCva", inputSize);
|
|
18
18
|
const { hoverProps, isHovered } = useHover({ isDisabled });
|
|
@@ -38,6 +38,8 @@ var TimePickerInput = ({ ref, as, fieldProps, state, isDisabled, isDirty, isInva
|
|
|
38
38
|
"data-focus-visible": isFocused && isFocusVisible || void 0,
|
|
39
39
|
"data-has-selection": state.value !== null || void 0,
|
|
40
40
|
"data-is-dirty": isDirty || void 0,
|
|
41
|
+
"data-is-required": isRequired || void 0,
|
|
42
|
+
"data-is-filled": state.value !== null || void 0,
|
|
41
43
|
...fieldProps,
|
|
42
44
|
...focusWithinProps,
|
|
43
45
|
...hoverProps,
|
|
@@ -9,7 +9,7 @@ import { useState } from "react";
|
|
|
9
9
|
import { mergeRefs, useLabels } from "@react-aria/utils";
|
|
10
10
|
import { Controller } from "react-hook-form";
|
|
11
11
|
//#region src/components/inputs/File/InputUpload.tsx
|
|
12
|
-
var InputUploadBase = ({ ref: _ref, label, tooltipText, variant, helperText, isRequired, isDisabled, headerClassName, errorClassName, isHeaderHidden, error, className, onChange, onInvalidFileType, value, defaultValue, allowsMultiple = false, hideLabel, acceptedFileTypes, ...rest }) => {
|
|
12
|
+
var InputUploadBase = ({ ref: _ref, label, tooltipText, variant, helperText, isRequired, isDisabled, headerClassName, errorClassName, isHeaderHidden, error, className, onChange, onInvalidFileType, value, defaultValue, allowsMultiple = false, hideLabel, acceptedFileTypes, size, ...rest }) => {
|
|
13
13
|
const ui = UIConfig.useConfig();
|
|
14
14
|
const [internalFiles, setInternalFiles] = useState(() => {
|
|
15
15
|
if (value !== void 0) {
|
|
@@ -77,7 +77,8 @@ var InputUploadBase = ({ ref: _ref, label, tooltipText, variant, helperText, isR
|
|
|
77
77
|
children: files.length > 0 ? /* @__PURE__ */ jsx(InputUploadFilled, {
|
|
78
78
|
files,
|
|
79
79
|
onRemove: handleRemove,
|
|
80
|
-
isDisabled
|
|
80
|
+
isDisabled,
|
|
81
|
+
size
|
|
81
82
|
}) : /* @__PURE__ */ jsx(InputUploadContent, {
|
|
82
83
|
...rest,
|
|
83
84
|
label,
|
|
@@ -87,7 +88,8 @@ var InputUploadBase = ({ ref: _ref, label, tooltipText, variant, helperText, isR
|
|
|
87
88
|
variant,
|
|
88
89
|
isDisabled,
|
|
89
90
|
onSelect: handleSelect,
|
|
90
|
-
onDrop: handleDrop
|
|
91
|
+
onDrop: handleDrop,
|
|
92
|
+
size
|
|
91
93
|
})
|
|
92
94
|
});
|
|
93
95
|
};
|
|
@@ -4,6 +4,8 @@ import { FieldValues } from 'react-hook-form';
|
|
|
4
4
|
import { FormFieldProps } from '../FormField/FormField';
|
|
5
5
|
import { ControlProps } from '../shared/form.types';
|
|
6
6
|
import { InputUploadButtonProps } from './shared/inputUploadButton.cva';
|
|
7
|
+
import { InputSizeProps } from '../shared/input.cva';
|
|
8
|
+
import { ButtonVariantProps } from '../../buttons/Button/button.cva.js';
|
|
7
9
|
export interface SingleFileUploadProps {
|
|
8
10
|
allowsMultiple?: false;
|
|
9
11
|
value?: File | null;
|
|
@@ -30,5 +32,6 @@ export type InputUploadBaseProps = {
|
|
|
30
32
|
className?: string;
|
|
31
33
|
placeholder?: string;
|
|
32
34
|
buttonText?: string;
|
|
33
|
-
} & FormFieldProps & InputUploadButtonProps & Omit<FileTriggerProps, "children" | "onSelect" | "allowsMultiple"> & Omit<DropZoneProps, "children" | "onDrop"> & GroupedFileUploadProps
|
|
35
|
+
} & FormFieldProps & InputUploadButtonProps & Omit<FileTriggerProps, "children" | "onSelect" | "allowsMultiple"> & Omit<DropZoneProps, "children" | "onDrop"> & GroupedFileUploadProps & Pick<InputSizeProps, "size">;
|
|
34
36
|
export type InputUploadProps<TFieldValues extends FieldValues = FieldValues> = InputUploadBaseProps & GroupedFileUploadControlProps<TFieldValues>;
|
|
37
|
+
export declare const inputButtonSizeMapping: Record<NonNullable<InputSizeProps["size"]>, ButtonVariantProps["size"]>;
|
|
@@ -97,12 +97,14 @@ var FileUploadContentFilled = ({ variant, as, isDisabled, state, browseText, fil
|
|
|
97
97
|
onPress: () => {
|
|
98
98
|
onRemove(state.id ?? "");
|
|
99
99
|
},
|
|
100
|
-
icon: CloseIcon
|
|
100
|
+
icon: CloseIcon,
|
|
101
|
+
isDisabled
|
|
101
102
|
}) : /* @__PURE__ */ jsx(TextButton, {
|
|
102
103
|
color: "secondary",
|
|
103
104
|
onPress: () => {
|
|
104
105
|
onRemove(state.id ?? "");
|
|
105
106
|
},
|
|
107
|
+
isDisabled,
|
|
106
108
|
children: t(($) => $.ui.fileUpload.removeFile)
|
|
107
109
|
})]
|
|
108
110
|
})
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { DropZoneProps, FileTriggerProps } from 'react-aria-components';
|
|
2
2
|
import { InputUploadBaseProps } from '../inputUpload.types';
|
|
3
|
-
|
|
3
|
+
import { InputSizeProps } from '../../shared/input.cva';
|
|
4
|
+
interface InputUploadContentProps extends Omit<InputUploadBaseProps, "ref">, Pick<InputSizeProps, "size"> {
|
|
4
5
|
onSelect: FileTriggerProps["onSelect"];
|
|
5
6
|
onDrop: DropZoneProps["onDrop"];
|
|
6
7
|
}
|
|
@@ -5,6 +5,7 @@ import "../../../../config/i18n.js";
|
|
|
5
5
|
import { TextButton } from "../../../buttons/TextButton/TextButton.js";
|
|
6
6
|
import { inputSize } from "../../shared/input.cva.js";
|
|
7
7
|
import { UploadIcon } from "../../../../assets/icons/Upload.js";
|
|
8
|
+
import { inputButtonSizeMapping } from "../inputUpload.types.js";
|
|
8
9
|
import { inputUploadButton, inputUploadDropZone } from "./inputUploadButton.cva.js";
|
|
9
10
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
11
|
import { clsx } from "clsx";
|
|
@@ -12,7 +13,7 @@ import { DropZone, FileTrigger } from "react-aria-components";
|
|
|
12
13
|
import { useTranslation } from "react-i18next";
|
|
13
14
|
//#region src/components/inputs/File/shared/InputUploadContent.tsx
|
|
14
15
|
var InputUploadContent = (props) => {
|
|
15
|
-
const { variant, isDisabled, error, placeholder, buttonText, ...rest } = props;
|
|
16
|
+
const { variant, isDisabled, error, placeholder, buttonText, size, ...rest } = props;
|
|
16
17
|
const { t } = useTranslation("ui");
|
|
17
18
|
const inputSizeCva = UIStyle.useCva("input.sizeCva", inputSize);
|
|
18
19
|
return /* @__PURE__ */ jsx(FileTrigger, {
|
|
@@ -28,7 +29,7 @@ var InputUploadContent = (props) => {
|
|
|
28
29
|
children: [/* @__PURE__ */ jsxs(DropZone, {
|
|
29
30
|
...rest,
|
|
30
31
|
isDisabled,
|
|
31
|
-
className: clsx(inputUploadDropZone({ variant }), inputSizeCva({ size
|
|
32
|
+
className: clsx(inputUploadDropZone({ variant }), inputSizeCva({ size })),
|
|
32
33
|
children: [/* @__PURE__ */ jsx(Typography, {
|
|
33
34
|
variant: "default",
|
|
34
35
|
size: "label-1",
|
|
@@ -41,7 +42,7 @@ var InputUploadContent = (props) => {
|
|
|
41
42
|
children: buttonText ?? t(($) => $.ui.fileUpload.upload)
|
|
42
43
|
})]
|
|
43
44
|
}), variant !== "nested" && /* @__PURE__ */ jsx(Button$1, {
|
|
44
|
-
size: "
|
|
45
|
+
size: inputButtonSizeMapping[size ?? "default"],
|
|
45
46
|
width: "hug",
|
|
46
47
|
isDisabled,
|
|
47
48
|
className: "truncate",
|