@povio/ui 3.1.0 → 3.2.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/assets/icons/AlignCenter.js +26 -11
- package/dist/assets/icons/AlignLeft.js +26 -11
- package/dist/assets/icons/AlignLeftRight.js +26 -11
- package/dist/assets/icons/AlignRight.js +26 -11
- package/dist/assets/icons/ArrowDropDown.js +26 -11
- package/dist/assets/icons/ArrowDropUp.js +26 -11
- package/dist/assets/icons/ArrowLeft.js +26 -11
- package/dist/assets/icons/ArrowRight.js +26 -11
- package/dist/assets/icons/Bold.js +26 -11
- package/dist/assets/icons/BulletedList.js +26 -11
- package/dist/assets/icons/Calendar.js +28 -13
- package/dist/assets/icons/Check.js +28 -13
- package/dist/assets/icons/CheckCircle.js +26 -11
- package/dist/assets/icons/CheckboxCheckmark.js +29 -14
- package/dist/assets/icons/CheckboxIndeterminate.js +29 -14
- package/dist/assets/icons/ChevronDown.js +28 -13
- package/dist/assets/icons/ChevronLeft.js +28 -13
- package/dist/assets/icons/ChevronRight.js +28 -13
- package/dist/assets/icons/ChevronUp.js +28 -13
- package/dist/assets/icons/ChevronsLeft.js +28 -13
- package/dist/assets/icons/ChevronsRight.js +28 -13
- package/dist/assets/icons/Clock.js +26 -11
- package/dist/assets/icons/Close.js +26 -11
- package/dist/assets/icons/DateTime.js +35 -14
- package/dist/assets/icons/DragIndicator.js +26 -11
- package/dist/assets/icons/File.js +28 -13
- package/dist/assets/icons/Highlight.js +26 -11
- package/dist/assets/icons/HighlightOn.js +49 -15
- package/dist/assets/icons/Home.js +26 -11
- package/dist/assets/icons/Info.js +37 -16
- package/dist/assets/icons/Italic.js +26 -11
- package/dist/assets/icons/Link.js +26 -11
- package/dist/assets/icons/Menu.js +26 -11
- package/dist/assets/icons/NumberedList.js +26 -11
- package/dist/assets/icons/PointerHorizontal.js +26 -11
- package/dist/assets/icons/PointerVertical.js +26 -11
- package/dist/assets/icons/Search.js +26 -11
- package/dist/assets/icons/Send.js +28 -13
- package/dist/assets/icons/Strikethrough.js +26 -11
- package/dist/assets/icons/TextColor.js +48 -14
- package/dist/assets/icons/Today.js +26 -11
- package/dist/assets/icons/Underlined.js +28 -13
- package/dist/assets/icons/Upload.js +35 -14
- package/dist/assets/icons/Visibility.js +26 -11
- package/dist/assets/icons/VisibilityOff.js +26 -11
- package/dist/assets/icons/WarningFilled.js +28 -13
- package/dist/components/Breadcrumbs/Breadcrumbs.js +207 -56
- package/dist/components/Menu/Menu.js +18 -2
- package/dist/components/Menu/MenuDesktop.js +41 -7
- package/dist/components/Menu/MenuItem.js +32 -9
- package/dist/components/Menu/MenuMobile.js +102 -39
- package/dist/components/Menu/MenuPopover.js +105 -29
- package/dist/components/buttons/Button/button.cva.d.ts +3 -3
- package/dist/components/buttons/IconButton/IconButton.js +40 -8
- package/dist/components/buttons/InlineIconButton/InlineIconButton.d.ts +2 -1
- package/dist/components/buttons/InlineIconButton/InlineIconButton.js +34 -9
- package/dist/components/buttons/PillButton/PillButton.js +55 -17
- package/dist/components/buttons/PillButton/pillButton.cva.d.ts +1 -1
- package/dist/components/buttons/SplitButton/SplitButton.js +103 -18
- package/dist/components/buttons/TextButton/TextButton.js +30 -8
- package/dist/components/buttons/ToggleButton/ToggleButton.js +28 -8
- package/dist/components/buttons/shared/ButtonContent.js +80 -22
- package/dist/components/inputs/Checkbox/Checkbox.d.ts +1 -0
- package/dist/components/inputs/Checkbox/Checkbox.js +201 -35
- package/dist/components/inputs/Checkbox/CheckboxCheckmark.js +24 -10
- package/dist/components/inputs/Checkbox/checkbox.cva.d.ts +3 -0
- package/dist/components/inputs/Checkbox/checkbox.cva.js +2 -1
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.d.ts +12 -5
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +380 -75
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +12 -5
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +499 -186
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.d.ts +14 -5
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +280 -46
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.d.ts +7 -3
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +616 -121
- package/dist/components/inputs/DateTime/shared/Calendar.d.ts +5 -2
- package/dist/components/inputs/DateTime/shared/Calendar.js +342 -119
- package/dist/components/inputs/DateTime/shared/CalendarCell.d.ts +4 -2
- package/dist/components/inputs/DateTime/shared/CalendarCell.js +310 -103
- package/dist/components/inputs/DateTime/shared/CalendarGrid.d.ts +4 -2
- package/dist/components/inputs/DateTime/shared/CalendarGrid.js +150 -33
- package/dist/components/inputs/DateTime/shared/CalendarHeader.js +233 -98
- package/dist/components/inputs/DateTime/shared/CalendarSelectHeader.js +318 -137
- package/dist/components/inputs/DateTime/shared/DateField.d.ts +2 -1
- package/dist/components/inputs/DateTime/shared/DateField.js +288 -112
- package/dist/components/inputs/DateTime/shared/DatePickerInput.d.ts +14 -3
- package/dist/components/inputs/DateTime/shared/DatePickerInput.js +359 -129
- package/dist/components/inputs/DateTime/shared/DateSegmentItem.d.ts +18 -1
- package/dist/components/inputs/DateTime/shared/DateSegmentItem.js +104 -11
- package/dist/components/inputs/DateTime/shared/DateTimeDialog.js +83 -28
- package/dist/components/inputs/DateTime/shared/DateTimeDialogFooter.js +59 -10
- package/dist/components/inputs/DateTime/shared/MonthPicker.js +103 -58
- package/dist/components/inputs/DateTime/shared/RangeCalendar.js +193 -82
- package/dist/components/inputs/DateTime/shared/TimeField.js +27 -8
- package/dist/components/inputs/DateTime/shared/TimePickerForm.js +279 -110
- package/dist/components/inputs/DateTime/shared/TimePickerInput.d.ts +4 -1
- package/dist/components/inputs/DateTime/shared/TimePickerInput.js +211 -65
- package/dist/components/inputs/DateTime/shared/YearPicker.js +119 -68
- package/dist/components/inputs/DateTime/shared/datePicker.types.d.ts +5 -0
- package/dist/components/inputs/DateTime/shared/datePickerInput.cva.d.ts +16 -0
- package/dist/components/inputs/DateTime/shared/datePickerInput.cva.js +16 -0
- package/dist/components/inputs/DateTime/shared/datePickerTodayIcon.d.ts +15 -0
- package/dist/components/inputs/DateTime/shared/datePickerTodayIcon.js +32 -0
- package/dist/components/inputs/DateTime/shared/dateSegment.utils.d.ts +2 -0
- package/dist/components/inputs/DateTime/shared/dateSegment.utils.spec.d.ts +1 -0
- package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.d.ts +41 -0
- package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.js +99 -0
- package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.spec.d.ts +1 -0
- package/dist/components/inputs/File/FileUpload.js +91 -46
- package/dist/components/inputs/File/FileUploadContainer.js +15 -7
- package/dist/components/inputs/File/InputUpload.js +317 -79
- package/dist/components/inputs/File/index.d.ts +1 -1
- package/dist/components/inputs/File/shared/FileCard.js +104 -41
- package/dist/components/inputs/File/shared/FileCardList.js +47 -12
- package/dist/components/inputs/File/shared/FileUploadContent.js +175 -44
- package/dist/components/inputs/File/shared/FileUploadContentEmpty.js +149 -46
- package/dist/components/inputs/File/shared/FileUploadContentError.js +234 -93
- package/dist/components/inputs/File/shared/FileUploadContentFilled.js +230 -97
- package/dist/components/inputs/File/shared/FileUploadContentLoading.js +199 -55
- package/dist/components/inputs/File/shared/InputUploadContent.js +148 -34
- package/dist/components/inputs/File/shared/InputUploadFilled.js +49 -8
- package/dist/components/inputs/File/shared/ProgressBar.js +102 -15
- package/dist/components/inputs/File/shared/fileUpload.cva.d.ts +0 -11
- package/dist/components/inputs/File/shared/fileUpload.cva.js +1 -18
- package/dist/components/inputs/FormField/FormField.d.ts +3 -3
- package/dist/components/inputs/FormField/FormField.js +119 -37
- package/dist/components/inputs/FormField/FormFieldError.js +25 -5
- package/dist/components/inputs/FormField/FormFieldHeader.d.ts +2 -2
- package/dist/components/inputs/FormField/FormFieldHeader.js +81 -22
- package/dist/components/inputs/FormField/FormFieldHeaderClose.js +31 -7
- package/dist/components/inputs/FormField/FormFieldHelper.js +26 -6
- package/dist/components/inputs/FormField/FormFieldLabel.d.ts +2 -2
- package/dist/components/inputs/FormField/FormFieldLabel.js +40 -9
- package/dist/components/inputs/FormField/formFieldHeader.cva.d.ts +13 -0
- package/dist/components/inputs/FormField/formFieldHeader.cva.js +14 -0
- package/dist/components/inputs/Input/NumberInput/NumberInput.d.ts +5 -2
- package/dist/components/inputs/Input/NumberInput/NumberInput.js +446 -97
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeField.d.ts +45 -0
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeField.js +571 -0
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.d.ts +35 -0
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.js +574 -0
- package/dist/components/inputs/Input/PasswordInput/PasswordInput.js +48 -9
- package/dist/components/inputs/Input/TextArea/TextArea.cva.d.ts +8 -0
- package/dist/components/inputs/Input/TextArea/TextArea.cva.js +5 -0
- package/dist/components/inputs/Input/TextArea/TextArea.js +305 -90
- package/dist/components/inputs/Input/TextInput/TextInput.d.ts +3 -1
- package/dist/components/inputs/Input/TextInput/TextInput.js +429 -90
- package/dist/components/inputs/Input/shared/InputContent.js +193 -59
- package/dist/components/inputs/Input/shared/numberStatic.utils.d.ts +1 -0
- package/dist/components/inputs/Input/shared/numberStatic.utils.js +7 -0
- package/dist/components/inputs/Inputs/Form.js +40 -11
- package/dist/components/inputs/Inputs/InputItem.d.ts +15 -21
- package/dist/components/inputs/Inputs/InputItem.js +69 -14
- package/dist/components/inputs/Inputs/Inputs.js +37 -11
- package/dist/components/inputs/RadioGroup/RadioGroup.d.ts +3 -1
- package/dist/components/inputs/RadioGroup/RadioGroup.js +353 -61
- package/dist/components/inputs/RadioGroup/radio.cva.d.ts +45 -0
- package/dist/components/inputs/RadioGroup/radio.cva.js +48 -1
- package/dist/components/inputs/Selection/Autocomplete/Autocomplete.d.ts +6 -2
- package/dist/components/inputs/Selection/Autocomplete/Autocomplete.js +217 -22
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.d.ts +3 -18
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.js +107 -8
- package/dist/components/inputs/Selection/Autocomplete/queryAutocomplete.types.d.ts +37 -0
- package/dist/components/inputs/Selection/Select/QuerySelect.d.ts +14 -0
- package/dist/components/inputs/Selection/Select/QuerySelect.js +178 -0
- package/dist/components/inputs/Selection/Select/Select.d.ts +7 -3
- package/dist/components/inputs/Selection/Select/Select.js +227 -18
- package/dist/components/inputs/Selection/shared/SelectBase.d.ts +8 -1
- package/dist/components/inputs/Selection/shared/SelectBase.js +69 -18
- package/dist/components/inputs/Selection/shared/SelectDesktop.d.ts +1 -1
- package/dist/components/inputs/Selection/shared/SelectDesktop.js +393 -138
- package/dist/components/inputs/Selection/shared/SelectInput.d.ts +2 -2
- package/dist/components/inputs/Selection/shared/SelectInput.js +397 -116
- package/dist/components/inputs/Selection/shared/SelectInputTags.js +99 -25
- package/dist/components/inputs/Selection/shared/SelectListBox.d.ts +2 -2
- package/dist/components/inputs/Selection/shared/SelectListBox.js +164 -52
- package/dist/components/inputs/Selection/shared/SelectListBoxItem.js +85 -35
- package/dist/components/inputs/Selection/shared/SelectListBoxItemSelectAll.js +69 -16
- package/dist/components/inputs/Selection/shared/SelectListBoxLoadingItem.js +70 -21
- package/dist/components/inputs/Selection/shared/SelectListBoxSelectionBar.js +58 -9
- package/dist/components/inputs/Selection/shared/SelectMobile.d.ts +1 -1
- package/dist/components/inputs/Selection/shared/SelectMobile.js +9 -3
- package/dist/components/inputs/Selection/shared/StaticSelectTrailingContent.d.ts +9 -0
- package/dist/components/inputs/Selection/shared/StaticSelectTrailingContent.js +47 -0
- package/dist/components/inputs/Selection/shared/querySelect.utils.d.ts +14 -0
- package/dist/components/inputs/Selection/shared/querySelect.utils.js +43 -0
- package/dist/components/inputs/Selection/shared/select.context.d.ts +3 -2
- package/dist/components/inputs/Selection/shared/select.context.js +67 -36
- package/dist/components/inputs/Selection/shared/select.types.d.ts +3 -2
- package/dist/components/inputs/Selection/shared/selectDesktop.cva.d.ts +6 -0
- package/dist/components/inputs/Selection/shared/selectDesktop.cva.js +5 -0
- package/dist/components/inputs/Selection/shared/selectInput.cva.d.ts +12 -0
- package/dist/components/inputs/Selection/shared/selectInput.cva.js +8 -0
- package/dist/components/inputs/Selection/shared/staticSelect.utils.d.ts +23 -0
- package/dist/components/inputs/Selection/shared/staticSelect.utils.js +54 -0
- package/dist/components/inputs/Selection/shared/staticSelect.utils.spec.d.ts +1 -0
- package/dist/components/inputs/Selection/shared/useSelectItems.js +109 -49
- package/dist/components/inputs/Skeleton/InputFrame.d.ts +83 -0
- package/dist/components/inputs/Skeleton/InputFrame.js +612 -0
- package/dist/components/inputs/Slider/Slider.d.ts +2 -1
- package/dist/components/inputs/Slider/Slider.js +265 -76
- package/dist/components/inputs/TextEditor/TextEditor.d.ts +1 -0
- package/dist/components/inputs/TextEditor/TextEditor.js +447 -98
- package/dist/components/inputs/TextEditor/Toolbar/ColorPicker.js +37 -11
- package/dist/components/inputs/TextEditor/Toolbar/ColorPickerDropdown.js +102 -30
- package/dist/components/inputs/TextEditor/Toolbar/HyperlinkAction.js +194 -45
- package/dist/components/inputs/TextEditor/Toolbar/TextAlignSelect.js +88 -28
- package/dist/components/inputs/TextEditor/Toolbar/TextColorSelect.js +48 -14
- package/dist/components/inputs/TextEditor/Toolbar/TextEditorToolbar.js +66 -19
- package/dist/components/inputs/TextEditor/Toolbar/TextHighlightSelect.js +49 -15
- package/dist/components/inputs/TextEditor/Toolbar/TextListActions.js +92 -32
- package/dist/components/inputs/TextEditor/Toolbar/TextMarksActions.js +126 -54
- package/dist/components/inputs/TextEditor/Toolbar/TextStyleSelect.js +141 -38
- package/dist/components/inputs/Toggle/Toggle.d.ts +1 -0
- package/dist/components/inputs/Toggle/Toggle.js +214 -37
- package/dist/components/inputs/Toggle/toggle.cva.d.ts +3 -0
- package/dist/components/inputs/Toggle/toggle.cva.js +2 -1
- package/dist/components/inputs/shared/CheckContent.d.ts +2 -1
- package/dist/components/inputs/shared/CheckContent.js +21 -11
- package/dist/components/inputs/shared/InputClear.d.ts +2 -1
- package/dist/components/inputs/shared/InputClear.js +88 -12
- package/dist/components/inputs/shared/TooltipWrapper.js +50 -11
- package/dist/components/inputs/shared/input.cva.d.ts +28 -0
- package/dist/components/inputs/shared/input.cva.js +38 -4
- package/dist/components/inputs/shared/tooltipWrapper.cva.d.ts +8 -0
- package/dist/components/inputs/shared/tooltipWrapper.cva.js +5 -0
- package/dist/components/inputs/shared/useStaticInputHandoff.d.ts +15 -0
- package/dist/components/inputs/shared/useStaticInputHandoff.js +112 -0
- package/dist/components/navigation/Accordion/Accordion.js +69 -22
- package/dist/components/navigation/Accordion/AccordionItem.js +86 -41
- package/dist/components/navigation/Stepper/Stepper.js +67 -22
- package/dist/components/navigation/Stepper/StepperItem.js +104 -31
- package/dist/components/navigation/Stepper/StepperSeparator.js +23 -5
- package/dist/components/overlays/ActionModal/ActionModal.js +169 -35
- package/dist/components/overlays/BottomSheet/BottomSheet.js +96 -23
- package/dist/components/overlays/BottomSheet/BottomSheetHeader.js +48 -8
- package/dist/components/overlays/Drawer/Drawer.js +62 -20
- package/dist/components/overlays/ResponsivePopover/ResponsivePopover.js +85 -28
- package/dist/components/overlays/Tooltip/Tooltip.js +137 -28
- package/dist/components/overlays/Tooltip/TooltipEllipsis.js +37 -12
- package/dist/components/segment/Segment.js +218 -57
- package/dist/components/segment/SegmentItem.js +67 -10
- package/dist/components/shared/pagination/Pagination.js +108 -22
- package/dist/components/shared/pagination/PaginationList.js +167 -64
- package/dist/components/shared/pagination/minWidth.cva.d.ts +1 -1
- package/dist/components/status/Alert/Alert.js +97 -30
- package/dist/components/status/Loader/Loader.js +77 -22
- package/dist/components/status/Toast/Toast.js +28 -14
- package/dist/components/status/Toast/toast.cva.d.ts +1 -1
- package/dist/components/status/Toast/useToast.js +62 -57
- package/dist/components/table/ColumnConfig.js +158 -54
- package/dist/components/table/InfiniteTable.js +67 -16
- package/dist/components/table/PaginatedTable.js +84 -18
- package/dist/components/table/Table.js +28 -27
- package/dist/components/text/Link/Link.js +19 -7
- package/dist/components/text/Typography/Typography.js +23 -8
- package/dist/config/confirmation.context.js +1 -1
- package/dist/config/link.context.js +23 -9
- package/dist/config/router.context.js +42 -16
- package/dist/config/theme.context.js +98 -45
- package/dist/config/uiConfig.context.d.ts +20 -6
- package/dist/config/uiConfig.context.js +68 -14
- package/dist/config/uiOverrides.context.d.ts +30 -11
- package/dist/config/uiOverrides.context.js +54 -14
- package/dist/helpers/dynamicInputs.d.ts +12 -9
- package/dist/helpers/dynamicInputs.js +13 -8
- package/dist/hooks/useAutosave.d.ts +2 -1
- package/dist/hooks/useAutosave.js +12 -4
- package/dist/hooks/useAutosave.spec.d.ts +1 -0
- package/dist/hooks/useBreakpoint.js +16 -3
- package/dist/hooks/useDebounceCallback.js +51 -17
- package/dist/hooks/useFilters.js +125 -64
- package/dist/hooks/useForm.js +42 -8
- package/dist/hooks/useFormAutosave.d.ts +3 -1
- package/dist/hooks/useFormAutosave.js +122 -30
- package/dist/hooks/useFormAutosave.spec.d.ts +1 -0
- package/dist/hooks/useIntersectionObserver.d.ts +1 -1
- package/dist/hooks/useIntersectionObserver.js +91 -24
- package/dist/hooks/useKeyInteractions.d.ts +20 -0
- package/dist/hooks/useKeyInteractions.js +54 -0
- package/dist/hooks/useKeyInteractions.spec.d.ts +1 -0
- package/dist/hooks/useLocalStorage.js +43 -10
- package/dist/hooks/useLongPressRepeat.js +55 -20
- package/dist/hooks/usePagination.js +49 -19
- package/dist/hooks/useQueryAutocomplete.d.ts +14 -0
- package/dist/hooks/useQueryAutocomplete.js +72 -0
- package/dist/hooks/useScrollableListBox.js +37 -16
- package/dist/hooks/useSorting.js +69 -28
- package/dist/hooks/useStateAndRef.js +21 -7
- package/dist/hooks/useTableColumnConfig.js +124 -31
- package/dist/hooks/useTranslationMemo.js +25 -5
- package/dist/index.d.ts +18 -3
- package/dist/index.js +15 -5
- package/dist/tw-ui-plugin.js +6 -0
- package/dist/utils/date-time.utils.d.ts +38 -10
- package/dist/utils/date-time.utils.js +136 -22
- package/dist/utils/query.utils.d.ts +4 -0
- package/dist/utils/query.utils.js +8 -0
- package/dist/utils/zod.utils.d.ts +2 -0
- package/dist/utils/zod.utils.js +5 -0
- package/package.json +2 -2
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { Typography } from "../../../text/Typography/Typography.js";
|
|
2
|
+
import { DateSegmentItemView } from "./DateSegmentItem.js";
|
|
3
|
+
import { DateTimeUtils } from "../../../../utils/date-time.utils.js";
|
|
4
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/inputs/DateTime/shared/staticDateTimeSegments.tsx
|
|
6
|
+
var getStaticCalendarDateSegments = ({ value, locale, shouldForceLeadingZeros, isDisabled, hidePlaceholder, disableManualEntry, placeholder, dateGranularity = "day" }) => {
|
|
7
|
+
if (disableManualEntry && placeholder && !value) return getStaticDateTimePlaceholder(placeholder);
|
|
8
|
+
return renderStaticDateTimeParts(DateTimeUtils.formatCalendarDatePartsLocalized(value, locale, { shouldForceLeadingZeros }), {
|
|
9
|
+
isDisabled,
|
|
10
|
+
hidePlaceholder,
|
|
11
|
+
dateGranularity
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
var getStaticCalendarDateTimeSegments = ({ value, locale, shouldForceLeadingZeros, isDisabled, hidePlaceholder, disableManualEntry, placeholder }) => {
|
|
15
|
+
const hasValue = !!(value && "hour" in value);
|
|
16
|
+
if (disableManualEntry && placeholder && !hasValue) return getStaticDateTimePlaceholder(placeholder);
|
|
17
|
+
return renderStaticDateTimeParts(DateTimeUtils.formatCalendarDateTimePartsLocalized(hasValue ? value : null, locale, { shouldForceLeadingZeros }), {
|
|
18
|
+
isDisabled,
|
|
19
|
+
hidePlaceholder,
|
|
20
|
+
segmentRole: "spinbutton"
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
var getStaticDateRangeSegments = ({ start, end, locale, shouldForceLeadingZeros, isDisabled, hidePlaceholder, disableManualEntry, placeholder }) => {
|
|
24
|
+
if (disableManualEntry && placeholder && !start && !end) return getStaticDateTimePlaceholder(placeholder);
|
|
25
|
+
const showSeparator = !hidePlaceholder;
|
|
26
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
27
|
+
renderStaticDateTimeParts(DateTimeUtils.formatCalendarDatePartsLocalized(start, locale, { shouldForceLeadingZeros }), {
|
|
28
|
+
isDisabled,
|
|
29
|
+
hidePlaceholder: hidePlaceholder && !start,
|
|
30
|
+
segmentGroup: "start"
|
|
31
|
+
}),
|
|
32
|
+
showSeparator && /* @__PURE__ */ jsx("span", {
|
|
33
|
+
className: isDisabled ? "pointer-events-none select-none text-interactive-text-secondary-disabled" : "pointer-events-none select-none",
|
|
34
|
+
children: "–"
|
|
35
|
+
}),
|
|
36
|
+
renderStaticDateTimeParts(DateTimeUtils.formatCalendarDatePartsLocalized(end, locale, { shouldForceLeadingZeros }), {
|
|
37
|
+
isDisabled,
|
|
38
|
+
hidePlaceholder: hidePlaceholder && !end,
|
|
39
|
+
segmentGroup: "end"
|
|
40
|
+
})
|
|
41
|
+
] });
|
|
42
|
+
};
|
|
43
|
+
var getStaticTimeSegments = ({ value, locale, shouldForceLeadingZeros, isDisabled, hidePlaceholder, disableManualEntry, placeholder }) => {
|
|
44
|
+
if (disableManualEntry && placeholder && !value) return getStaticDateTimePlaceholder(placeholder);
|
|
45
|
+
return renderStaticDateTimeParts(DateTimeUtils.formatTimePartsLocalized(value, locale, { shouldForceLeadingZeros }), {
|
|
46
|
+
isDisabled,
|
|
47
|
+
hidePlaceholder,
|
|
48
|
+
timePickerOnly: true
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
var getStaticDateTimePlaceholder = (placeholder) => /* @__PURE__ */ jsx(Typography, {
|
|
52
|
+
size: "label-1",
|
|
53
|
+
className: "text-text-default-3",
|
|
54
|
+
children: placeholder
|
|
55
|
+
});
|
|
56
|
+
var getStaticDateTimeFocusTarget = (container, staticTarget) => {
|
|
57
|
+
const staticSegment = staticTarget instanceof Element ? staticTarget.closest("[data-static-segment-type]") : null;
|
|
58
|
+
const segmentType = staticSegment?.dataset.staticSegmentType;
|
|
59
|
+
if (segmentType) {
|
|
60
|
+
const segmentGroup = staticSegment.dataset.staticSegmentGroup;
|
|
61
|
+
const groupSelector = segmentGroup ? `[data-static-segment-group="${segmentGroup}"]` : "";
|
|
62
|
+
const matchingSegment = container.querySelector(`${groupSelector}[data-static-segment-type="${segmentType}"]`);
|
|
63
|
+
if (matchingSegment) return matchingSegment;
|
|
64
|
+
}
|
|
65
|
+
return container.querySelector("input, button, [tabindex]:not([tabindex='-1'])");
|
|
66
|
+
};
|
|
67
|
+
var renderStaticDateTimeParts = (parts, options) => {
|
|
68
|
+
return /* @__PURE__ */ jsx("div", {
|
|
69
|
+
className: "flex",
|
|
70
|
+
children: getStaticDateTimePartsToRender(parts, options.dateGranularity).map((part, index) => /* @__PURE__ */ jsx(DateSegmentItemView, {
|
|
71
|
+
type: part.type,
|
|
72
|
+
text: part.value,
|
|
73
|
+
placeholder: part.placeholder,
|
|
74
|
+
isPlaceholder: part.isPlaceholder && part.type !== "literal",
|
|
75
|
+
segmentGroup: options.segmentGroup,
|
|
76
|
+
isInputEmpty: parts.some((item) => item.type !== "literal" && item.isPlaceholder),
|
|
77
|
+
isDisabled: options.isDisabled,
|
|
78
|
+
timePickerOnly: options.timePickerOnly,
|
|
79
|
+
hidePlaceholder: options.hidePlaceholder,
|
|
80
|
+
role: part.type === "literal" ? void 0 : options.segmentRole
|
|
81
|
+
}, index))
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
var getStaticDateTimePartsToRender = (parts, dateGranularity = "day") => {
|
|
85
|
+
const segments = [];
|
|
86
|
+
for (const part of parts) if (part.type !== "literal") {
|
|
87
|
+
if (isStaticDatePartVisible(part.type, dateGranularity)) segments.push(part);
|
|
88
|
+
} else if (segments.length > 0 && segments.at(-1)?.type !== "literal") segments.push(part);
|
|
89
|
+
if (segments.at(-1)?.type === "literal") segments.pop();
|
|
90
|
+
return segments;
|
|
91
|
+
};
|
|
92
|
+
var isStaticDatePartVisible = (type, dateGranularity) => {
|
|
93
|
+
if (dateGranularity === "day") return true;
|
|
94
|
+
if (dateGranularity === "month") return type !== "day";
|
|
95
|
+
if (dateGranularity === "year") return type === "year";
|
|
96
|
+
return true;
|
|
97
|
+
};
|
|
98
|
+
//#endregion
|
|
99
|
+
export { getStaticCalendarDateSegments, getStaticCalendarDateTimeSegments, getStaticDateRangeSegments, getStaticDateTimeFocusTarget, getStaticTimeSegments };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { UIOverrides } from "../../../config/uiOverrides.context.js";
|
|
1
2
|
import { UIConfig } from "../../../config/uiConfig.context.js";
|
|
2
3
|
import "../../../config/i18n.js";
|
|
3
4
|
import { FormField } from "../FormField/FormField.js";
|
|
@@ -5,7 +6,8 @@ import { FileUtils } from "../../../utils/file.utils.js";
|
|
|
5
6
|
import { FileCardList } from "./shared/FileCardList.js";
|
|
6
7
|
import { FileUploadContentEmpty } from "./shared/FileUploadContentEmpty.js";
|
|
7
8
|
import { FileUploadContent } from "./shared/FileUploadContent.js";
|
|
8
|
-
import {
|
|
9
|
+
import { fileUploadDropZoneDefinition } from "./shared/fileUpload.cva.js";
|
|
10
|
+
import { c } from "react/compiler-runtime";
|
|
9
11
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
10
12
|
import { clsx } from "clsx";
|
|
11
13
|
import { useCallback, useState } from "react";
|
|
@@ -16,8 +18,9 @@ import { Controller } from "react-hook-form";
|
|
|
16
18
|
//#region src/components/inputs/File/FileUpload.tsx
|
|
17
19
|
var FileUploadBase = (props) => {
|
|
18
20
|
const { t } = useTranslation("ui");
|
|
19
|
-
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(($) =>
|
|
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;
|
|
20
22
|
const ui = UIConfig.useConfig();
|
|
23
|
+
const fileUploadDropZoneCva = UIOverrides.useCva("fileUpload.dropZoneCva", fileUploadDropZoneDefinition);
|
|
21
24
|
const getInitialState = () => {
|
|
22
25
|
if (props.value != null && props.value.length > 0) return props.value;
|
|
23
26
|
if (!defaultState?.length) return [];
|
|
@@ -46,76 +49,76 @@ var FileUploadBase = (props) => {
|
|
|
46
49
|
const labelProps = useLabels({ "aria-label": label });
|
|
47
50
|
const handleUpload = async (inputFiles) => {
|
|
48
51
|
const acceptedFiles = inputFiles.filter((file) => FileUtils.isFileTypeAccepted(file, acceptedFileTypes));
|
|
49
|
-
const invalidFiles = inputFiles.filter((
|
|
50
|
-
if (invalidFiles.length > 0) if (allowsMultiple) onInvalidFileType?.(invalidFiles.map((
|
|
52
|
+
const invalidFiles = inputFiles.filter((file_0) => !FileUtils.isFileTypeAccepted(file_0, acceptedFileTypes));
|
|
53
|
+
if (invalidFiles.length > 0) if (allowsMultiple) onInvalidFileType?.(invalidFiles.map((file_1) => file_1.name));
|
|
51
54
|
else onInvalidFileType?.(invalidFiles[0].name);
|
|
52
55
|
if (acceptedFiles.length === 0 || !fileUpload) return;
|
|
53
56
|
if (!allowsMultiple) setUploadState([]);
|
|
54
57
|
const newUploadState = [];
|
|
55
|
-
acceptedFiles.forEach((
|
|
58
|
+
acceptedFiles.forEach((file_2) => {
|
|
56
59
|
newUploadState.push({
|
|
57
60
|
state: "uploading",
|
|
58
61
|
progress: 0,
|
|
59
|
-
file,
|
|
62
|
+
file: file_2,
|
|
60
63
|
abortController: new AbortController()
|
|
61
64
|
});
|
|
62
65
|
});
|
|
63
66
|
const startIndex = allowsMultiple ? uploadState.length : 0;
|
|
64
67
|
setUploadState((prev) => [...prev, ...newUploadState]);
|
|
65
68
|
const promises = [];
|
|
66
|
-
acceptedFiles.forEach(async (
|
|
69
|
+
acceptedFiles.forEach(async (file_3, index_0) => {
|
|
67
70
|
promises.push(fileUpload({ data: {
|
|
68
|
-
resourceName:
|
|
69
|
-
fileName:
|
|
70
|
-
fileSize:
|
|
71
|
+
resourceName: file_3.name,
|
|
72
|
+
fileName: file_3.name,
|
|
73
|
+
fileSize: file_3.size,
|
|
71
74
|
method: "put"
|
|
72
|
-
} },
|
|
75
|
+
} }, file_3, {
|
|
73
76
|
onUploadProgress: ({ loaded, total }) => {
|
|
74
77
|
if (total == null) return;
|
|
75
78
|
const progress = Math.round(loaded / total * 100);
|
|
76
|
-
setUploadState((
|
|
79
|
+
setUploadState((prev_0) => prev_0.map((state, i) => i === startIndex + index_0 ? {
|
|
77
80
|
...state,
|
|
78
81
|
progress
|
|
79
82
|
} : state));
|
|
80
83
|
},
|
|
81
|
-
abortController: newUploadState[
|
|
84
|
+
abortController: newUploadState[index_0]?.abortController
|
|
82
85
|
}));
|
|
83
86
|
});
|
|
84
87
|
try {
|
|
85
|
-
(await Promise.all(promises)).forEach((res,
|
|
86
|
-
setUploadState((
|
|
87
|
-
...
|
|
88
|
+
(await Promise.all(promises)).forEach((res, index_1) => {
|
|
89
|
+
setUploadState((prev_2) => prev_2.map((state_0, i_1) => i_1 === startIndex + index_1 ? {
|
|
90
|
+
...state_0,
|
|
88
91
|
state: "uploaded",
|
|
89
92
|
id: res.id
|
|
90
|
-
} :
|
|
93
|
+
} : state_0));
|
|
91
94
|
});
|
|
92
95
|
if (clearOnSuccess) setUploadState([]);
|
|
93
|
-
} catch (
|
|
94
|
-
setUploadState((
|
|
95
|
-
throw
|
|
96
|
+
} catch (error_0) {
|
|
97
|
+
setUploadState((prev_1) => prev_1.filter((_, i_0) => i_0 < startIndex));
|
|
98
|
+
throw error_0;
|
|
96
99
|
}
|
|
97
100
|
};
|
|
98
|
-
const handleSelect = (
|
|
99
|
-
if (!
|
|
100
|
-
handleUpload(Array.from(
|
|
101
|
+
const handleSelect = (inputFiles_0) => {
|
|
102
|
+
if (!inputFiles_0) return;
|
|
103
|
+
handleUpload(Array.from(inputFiles_0));
|
|
101
104
|
};
|
|
102
105
|
const handleDrop = async (e) => {
|
|
103
106
|
if (!e.items) return;
|
|
104
|
-
const
|
|
105
|
-
e.items.forEach((
|
|
106
|
-
if (
|
|
107
|
+
const promises_0 = [];
|
|
108
|
+
e.items.forEach((item_0) => {
|
|
109
|
+
if (item_0.kind === "file") promises_0.push(item_0.getFile());
|
|
107
110
|
});
|
|
108
|
-
handleUpload(await Promise.all(
|
|
111
|
+
handleUpload(await Promise.all(promises_0));
|
|
109
112
|
};
|
|
110
113
|
const handleRemove = useCallback((id) => {
|
|
111
114
|
fileRemove?.({ id });
|
|
112
|
-
setUploadState((
|
|
115
|
+
setUploadState((prev_3) => prev_3.filter((state_1) => state_1.id !== id));
|
|
113
116
|
}, [fileRemove]);
|
|
114
|
-
const handleCancelUpload = useCallback((
|
|
115
|
-
const findState = uploadState[
|
|
117
|
+
const handleCancelUpload = useCallback((index_2) => {
|
|
118
|
+
const findState = uploadState[index_2];
|
|
116
119
|
if (findState) {
|
|
117
120
|
findState.abortController?.abort("canceled by user");
|
|
118
|
-
setUploadState((
|
|
121
|
+
setUploadState((prev_4) => prev_4.filter((__0, i_2) => i_2 !== index_2));
|
|
119
122
|
}
|
|
120
123
|
}, [uploadState]);
|
|
121
124
|
return /* @__PURE__ */ jsxs(FormField, {
|
|
@@ -128,12 +131,13 @@ var FileUploadBase = (props) => {
|
|
|
128
131
|
...rest,
|
|
129
132
|
"data-rac": "",
|
|
130
133
|
"data-disabled": isDisabled || void 0,
|
|
134
|
+
"data-is-disabled": isDisabled || void 0,
|
|
131
135
|
"data-invalid": !!error || void 0,
|
|
132
136
|
"data-multiple": allowsMultiple || void 0,
|
|
133
137
|
"data-has-files": uploadState.length > 0 || void 0,
|
|
134
138
|
isDisabled,
|
|
135
139
|
onDrop: handleDrop,
|
|
136
|
-
className:
|
|
140
|
+
className: fileUploadDropZoneCva({
|
|
137
141
|
variant,
|
|
138
142
|
isContainer: !!children,
|
|
139
143
|
className: "group/file-upload-drop-zone"
|
|
@@ -182,22 +186,63 @@ var FileUploadBase = (props) => {
|
|
|
182
186
|
});
|
|
183
187
|
};
|
|
184
188
|
var FileUpload = (props) => {
|
|
189
|
+
const $ = c(15);
|
|
185
190
|
if ("formControl" in props && props.formControl) {
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
191
|
+
let formControl;
|
|
192
|
+
let innerProps;
|
|
193
|
+
let ref;
|
|
194
|
+
if ($[0] !== props) {
|
|
195
|
+
({formControl, ref, ...innerProps} = props);
|
|
196
|
+
$[0] = props;
|
|
197
|
+
$[1] = formControl;
|
|
198
|
+
$[2] = innerProps;
|
|
199
|
+
$[3] = ref;
|
|
200
|
+
} else {
|
|
201
|
+
formControl = $[1];
|
|
202
|
+
innerProps = $[2];
|
|
203
|
+
ref = $[3];
|
|
204
|
+
}
|
|
205
|
+
let t0;
|
|
206
|
+
if ($[4] !== innerProps || $[5] !== props.error || $[6] !== props.isDisabled || $[7] !== ref) {
|
|
207
|
+
t0 = (t1) => {
|
|
208
|
+
const { field, fieldState: t2 } = t1;
|
|
209
|
+
const { error } = t2;
|
|
210
|
+
return /* @__PURE__ */ jsx(FileUploadBase, {
|
|
211
|
+
...innerProps,
|
|
212
|
+
ref: mergeRefs(ref, field.ref),
|
|
213
|
+
value: field.value,
|
|
214
|
+
onChange: field.onChange,
|
|
215
|
+
isDisabled: field.disabled || props.isDisabled,
|
|
216
|
+
error: props.error ?? error?.message
|
|
217
|
+
});
|
|
218
|
+
};
|
|
219
|
+
$[4] = innerProps;
|
|
220
|
+
$[5] = props.error;
|
|
221
|
+
$[6] = props.isDisabled;
|
|
222
|
+
$[7] = ref;
|
|
223
|
+
$[8] = t0;
|
|
224
|
+
} else t0 = $[8];
|
|
225
|
+
let t1;
|
|
226
|
+
if ($[9] !== formControl.control || $[10] !== formControl.name || $[11] !== t0) {
|
|
227
|
+
t1 = /* @__PURE__ */ jsx(Controller, {
|
|
228
|
+
control: formControl.control,
|
|
229
|
+
name: formControl.name,
|
|
230
|
+
render: t0
|
|
231
|
+
});
|
|
232
|
+
$[9] = formControl.control;
|
|
233
|
+
$[10] = formControl.name;
|
|
234
|
+
$[11] = t0;
|
|
235
|
+
$[12] = t1;
|
|
236
|
+
} else t1 = $[12];
|
|
237
|
+
return t1;
|
|
199
238
|
}
|
|
200
|
-
|
|
239
|
+
let t0;
|
|
240
|
+
if ($[13] !== props) {
|
|
241
|
+
t0 = /* @__PURE__ */ jsx(FileUploadBase, { ...props });
|
|
242
|
+
$[13] = props;
|
|
243
|
+
$[14] = t0;
|
|
244
|
+
} else t0 = $[14];
|
|
245
|
+
return t0;
|
|
201
246
|
};
|
|
202
247
|
//#endregion
|
|
203
248
|
export { FileUpload };
|
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
import { FileUpload } from "./FileUpload.js";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
2
3
|
import { jsx } from "react/jsx-runtime";
|
|
3
4
|
//#region src/components/inputs/File/FileUploadContainer.tsx
|
|
4
5
|
var FileUploadContainer = (props) => {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
const $ = c(2);
|
|
7
|
+
let t0;
|
|
8
|
+
if ($[0] !== props) {
|
|
9
|
+
t0 = /* @__PURE__ */ jsx(FileUpload, {
|
|
10
|
+
label: "",
|
|
11
|
+
hideLabel: true,
|
|
12
|
+
variant: "vertical",
|
|
13
|
+
as: "button",
|
|
14
|
+
...props
|
|
15
|
+
});
|
|
16
|
+
$[0] = props;
|
|
17
|
+
$[1] = t0;
|
|
18
|
+
} else t0 = $[1];
|
|
19
|
+
return t0;
|
|
12
20
|
};
|
|
13
21
|
//#endregion
|
|
14
22
|
export { FileUploadContainer };
|