@povio/ui 3.1.1 → 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/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/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 +87 -44
- package/dist/components/inputs/File/FileUploadContainer.js +15 -7
- package/dist/components/inputs/File/InputUpload.js +317 -79
- 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/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/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/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 +19 -0
- 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 +17 -2
- package/dist/index.js +14 -4
- 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
|
@@ -1,15 +1,43 @@
|
|
|
1
1
|
import { CalendarDate, CalendarDateTime, DateValue, ZonedDateTime } from '@internationalized/date';
|
|
2
2
|
export declare namespace DateTimeUtils {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
interface LocalizedDateFormatOptions {
|
|
4
|
+
shouldForceLeadingZeros?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export interface LocalizedDatePart {
|
|
7
|
+
type: Intl.DateTimeFormatPartTypes;
|
|
8
|
+
value: string;
|
|
9
|
+
placeholder: string;
|
|
10
|
+
isPlaceholder: boolean;
|
|
11
|
+
}
|
|
12
|
+
export function getDatePlaceholder(locale?: string, options?: LocalizedDateFormatOptions): string;
|
|
13
|
+
export function getTimePlaceholder(locale?: string): string;
|
|
14
|
+
export function getDateTimePlaceholder(locale?: string, options?: LocalizedDateFormatOptions): string;
|
|
15
|
+
export function getDateRangePlaceholder(locale?: string, options?: LocalizedDateFormatOptions): string;
|
|
16
|
+
export function formatCalendarDateLocalized(calendarDate: CalendarDate, locale?: string, options?: LocalizedDateFormatOptions): string;
|
|
17
|
+
export function formatCalendarDatePartsLocalized(calendarDate?: CalendarDate | null, locale?: string, options?: LocalizedDateFormatOptions): LocalizedDatePart[];
|
|
18
|
+
export function formatCalendarDateTimePartsLocalized(calendarDateTime?: Pick<CalendarDateTime, "day" | "month" | "year" | "hour" | "minute"> | null, locale?: string, options?: LocalizedDateFormatOptions): LocalizedDatePart[];
|
|
19
|
+
export function formatTimeLocalized(timeValue: {
|
|
20
|
+
hour: number;
|
|
21
|
+
minute: number;
|
|
22
|
+
}, locale?: string, options?: LocalizedDateFormatOptions): string;
|
|
23
|
+
export function formatTimePartsLocalized(timeValue?: {
|
|
24
|
+
hour: number;
|
|
25
|
+
minute: number;
|
|
26
|
+
} | null, locale?: string, options?: LocalizedDateFormatOptions): LocalizedDatePart[];
|
|
27
|
+
export function formatCalendarDateTimeLocalized(calendarDateTime: Pick<CalendarDateTime, "day" | "month" | "year" | "hour" | "minute">, locale?: string, options?: LocalizedDateFormatOptions): string;
|
|
28
|
+
export function fromISOtoZonedDateTime(isoString: string, timeZone?: string): ZonedDateTime;
|
|
29
|
+
export function fromDateValueToISO(dateValue: DateValue, timeZone?: string): string;
|
|
30
|
+
export function fromDateValueFieldsToUTCISO(dateValue: DateValue): string;
|
|
31
|
+
export function getCurrentWallClockCalendarDateTime(): CalendarDateTime;
|
|
32
|
+
export function fromDateValueToOffsetISO(dateValue: DateValue, timeZone?: string): string;
|
|
33
|
+
export function fromLocalToZonedDateTime(date: Date, timeZone?: string): ZonedDateTime;
|
|
34
|
+
export function fromDateValueToLocal(dateValue: DateValue, timeZone?: string): Date;
|
|
35
|
+
export function fromCalendarDateToUTCISO(calendarDate: CalendarDate, options?: {
|
|
9
36
|
endOfDay?: boolean;
|
|
10
37
|
}): string;
|
|
11
|
-
function fromUTCISOToCalendarDate(isoString: string): CalendarDate;
|
|
12
|
-
function fromCalendarDateTimeToUTCISO(calendarDateTime: CalendarDateTime): string;
|
|
13
|
-
function fromUTCISOToCalendarDateTime(isoString: string, timeZone?: string): CalendarDateTime;
|
|
14
|
-
function formatTextDateToCalendarDateTime(textDate: string | null, timeZone?: string, locale?: string): CalendarDateTime | null;
|
|
38
|
+
export function fromUTCISOToCalendarDate(isoString: string): CalendarDate;
|
|
39
|
+
export function fromCalendarDateTimeToUTCISO(calendarDateTime: CalendarDateTime): string;
|
|
40
|
+
export function fromUTCISOToCalendarDateTime(isoString: string, timeZone?: string): CalendarDateTime;
|
|
41
|
+
export function formatTextDateToCalendarDateTime(textDate: string | null, timeZone?: string, locale?: string): CalendarDateTime | null;
|
|
42
|
+
export {};
|
|
15
43
|
}
|
|
@@ -1,33 +1,137 @@
|
|
|
1
|
-
import { CalendarDate, CalendarDateTime, fromDate, getLocalTimeZone, parseAbsolute } from "@internationalized/date";
|
|
1
|
+
import { CalendarDate, CalendarDateTime, DateFormatter, fromDate, getLocalTimeZone, parseAbsolute } from "@internationalized/date";
|
|
2
2
|
import { DateTime } from "luxon";
|
|
3
3
|
//#region src/utils/date-time.utils.ts
|
|
4
4
|
var DateTimeUtils;
|
|
5
5
|
(function(_DateTimeUtils) {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
const DATE_SAMPLE_DATE_UTC = new Date(Date.UTC(2e3, 10, 22));
|
|
7
|
+
const TIME_SAMPLE_DATE_UTC = new Date(Date.UTC(2e3, 10, 22, 6, 45));
|
|
8
|
+
const getDayMonthFormat = (shouldForceLeadingZeros = false) => shouldForceLeadingZeros ? "2-digit" : "numeric";
|
|
9
|
+
const getTimeHourFormat = (shouldForceLeadingZeros = false) => shouldForceLeadingZeros ? "2-digit" : "numeric";
|
|
10
|
+
const getDatePlaceholderFormatter = (locale, options) => new Intl.DateTimeFormat(locale, {
|
|
11
|
+
day: getDayMonthFormat(options?.shouldForceLeadingZeros),
|
|
12
|
+
month: getDayMonthFormat(options?.shouldForceLeadingZeros),
|
|
13
|
+
year: "numeric"
|
|
14
|
+
});
|
|
15
|
+
const getTimePlaceholderFormatter = (locale) => new Intl.DateTimeFormat(locale, {
|
|
16
|
+
hour: "2-digit",
|
|
17
|
+
minute: "2-digit"
|
|
18
|
+
});
|
|
19
|
+
const getResolvedLocale = (locale) => {
|
|
20
|
+
if (locale) return locale;
|
|
21
|
+
return new Intl.DateTimeFormat().resolvedOptions().locale;
|
|
22
|
+
};
|
|
23
|
+
const getDateFormatter = (locale, options) => new Intl.DateTimeFormat(getResolvedLocale(locale), {
|
|
24
|
+
day: getDayMonthFormat(options?.shouldForceLeadingZeros),
|
|
25
|
+
month: getDayMonthFormat(options?.shouldForceLeadingZeros),
|
|
26
|
+
year: "numeric",
|
|
27
|
+
timeZone: "UTC"
|
|
28
|
+
});
|
|
29
|
+
const getTimeFormatter = (locale, options) => new DateFormatter(getResolvedLocale(locale), {
|
|
30
|
+
hour: getTimeHourFormat(options?.shouldForceLeadingZeros),
|
|
31
|
+
minute: "2-digit",
|
|
32
|
+
timeZone: "UTC"
|
|
33
|
+
});
|
|
34
|
+
const getDateTimeFormatter = (locale, options) => new Intl.DateTimeFormat(getResolvedLocale(locale), {
|
|
35
|
+
day: getDayMonthFormat(options?.shouldForceLeadingZeros),
|
|
36
|
+
month: getDayMonthFormat(options?.shouldForceLeadingZeros),
|
|
37
|
+
year: "numeric",
|
|
38
|
+
hour: getTimeHourFormat(options?.shouldForceLeadingZeros),
|
|
39
|
+
minute: "2-digit",
|
|
40
|
+
timeZone: "UTC"
|
|
41
|
+
});
|
|
42
|
+
const getLocaleDateFormat = (locale) => {
|
|
43
|
+
const sampleDate = new Date(Date.UTC(2e3, 10, 22));
|
|
44
|
+
return new Intl.DateTimeFormat(locale, {
|
|
8
45
|
day: "2-digit",
|
|
9
46
|
month: "2-digit",
|
|
10
|
-
year: "numeric"
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
if (part.type === "
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
47
|
+
year: "numeric",
|
|
48
|
+
timeZone: "UTC"
|
|
49
|
+
}).formatToParts(sampleDate).map((part) => {
|
|
50
|
+
if (part.type === "day") return "dd";
|
|
51
|
+
if (part.type === "month") return "MM";
|
|
52
|
+
if (part.type === "year") return "yyyy";
|
|
53
|
+
return part.value;
|
|
54
|
+
}).join("");
|
|
55
|
+
};
|
|
56
|
+
const repeatLocalizedFieldLabel = (type, length, locale) => {
|
|
57
|
+
const placeholderChar = new Intl.DisplayNames(getResolvedLocale(locale), { type: "dateTimeField" }).of(type)?.trim().charAt(0).toLocaleLowerCase(getResolvedLocale(locale));
|
|
58
|
+
if (!placeholderChar) return null;
|
|
59
|
+
return placeholderChar.repeat(length);
|
|
60
|
+
};
|
|
61
|
+
const mapTypeToPlaceholder = (type, locale) => {
|
|
62
|
+
switch (type) {
|
|
63
|
+
case "day": return repeatLocalizedFieldLabel(type, 2, locale);
|
|
64
|
+
case "month": return repeatLocalizedFieldLabel(type, 2, locale);
|
|
65
|
+
case "year": return repeatLocalizedFieldLabel(type, 4, locale);
|
|
66
|
+
case "hour": return "hh";
|
|
67
|
+
case "minute": return "mm";
|
|
68
|
+
default: return null;
|
|
27
69
|
}
|
|
28
|
-
|
|
29
|
-
|
|
70
|
+
};
|
|
71
|
+
const formatPlaceholder = (formatter, sampleDate) => {
|
|
72
|
+
return formatter.formatToParts(sampleDate).map((part) => mapTypeToPlaceholder(part.type, formatter.resolvedOptions().locale) ?? part.value).join("");
|
|
73
|
+
};
|
|
74
|
+
const removeDateSeparatorSpacing = (value) => value.replace(/([./-])\s+(?=[\p{Letter}\p{Number}])/gu, "$1");
|
|
75
|
+
const formatLocalizedDateParts = (formatter, date) => {
|
|
76
|
+
return removeDateSeparatorSpacing(formatter.format(date));
|
|
77
|
+
};
|
|
78
|
+
const formatLocalizedDatePartList = (formatter, date, isPlaceholder) => {
|
|
79
|
+
const locale = formatter.resolvedOptions().locale;
|
|
80
|
+
return formatter.formatToParts(date).map((part) => {
|
|
81
|
+
const value = part.type === "literal" ? part.value.replace(/([./-])\s+/gu, "$1") : part.value.replace(/\s+/gu, "");
|
|
82
|
+
return {
|
|
83
|
+
type: part.type,
|
|
84
|
+
value,
|
|
85
|
+
placeholder: mapTypeToPlaceholder(part.type, locale) ?? value,
|
|
86
|
+
isPlaceholder
|
|
87
|
+
};
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
function getDatePlaceholder(locale, options) {
|
|
91
|
+
return removeDateSeparatorSpacing(formatPlaceholder(getDatePlaceholderFormatter(locale, options), DATE_SAMPLE_DATE_UTC));
|
|
30
92
|
}
|
|
93
|
+
_DateTimeUtils.getDatePlaceholder = getDatePlaceholder;
|
|
94
|
+
function getTimePlaceholder(locale) {
|
|
95
|
+
return formatPlaceholder(getTimePlaceholderFormatter(locale), TIME_SAMPLE_DATE_UTC);
|
|
96
|
+
}
|
|
97
|
+
_DateTimeUtils.getTimePlaceholder = getTimePlaceholder;
|
|
98
|
+
function getDateTimePlaceholder(locale, options) {
|
|
99
|
+
return `${getDatePlaceholder(locale, options)}, ${getTimePlaceholder(locale)}`;
|
|
100
|
+
}
|
|
101
|
+
_DateTimeUtils.getDateTimePlaceholder = getDateTimePlaceholder;
|
|
102
|
+
function getDateRangePlaceholder(locale, options) {
|
|
103
|
+
const datePlaceholder = getDatePlaceholder(locale, options);
|
|
104
|
+
return `${datePlaceholder} – ${datePlaceholder}`;
|
|
105
|
+
}
|
|
106
|
+
_DateTimeUtils.getDateRangePlaceholder = getDateRangePlaceholder;
|
|
107
|
+
function formatCalendarDateLocalized(calendarDate, locale, options) {
|
|
108
|
+
return formatLocalizedDateParts(getDateFormatter(locale, options), calendarDate.toDate("UTC"));
|
|
109
|
+
}
|
|
110
|
+
_DateTimeUtils.formatCalendarDateLocalized = formatCalendarDateLocalized;
|
|
111
|
+
function formatCalendarDatePartsLocalized(calendarDate, locale, options) {
|
|
112
|
+
return formatLocalizedDatePartList(getDateFormatter(locale, options), calendarDate?.toDate("UTC") ?? DATE_SAMPLE_DATE_UTC, !calendarDate);
|
|
113
|
+
}
|
|
114
|
+
_DateTimeUtils.formatCalendarDatePartsLocalized = formatCalendarDatePartsLocalized;
|
|
115
|
+
function formatCalendarDateTimePartsLocalized(calendarDateTime, locale, options) {
|
|
116
|
+
const normalizedValue = calendarDateTime ? new CalendarDateTime(calendarDateTime.year, calendarDateTime.month, calendarDateTime.day, calendarDateTime.hour, calendarDateTime.minute) : null;
|
|
117
|
+
return formatLocalizedDatePartList(getDateTimeFormatter(locale, options), normalizedValue?.toDate("UTC") ?? TIME_SAMPLE_DATE_UTC, !calendarDateTime);
|
|
118
|
+
}
|
|
119
|
+
_DateTimeUtils.formatCalendarDateTimePartsLocalized = formatCalendarDateTimePartsLocalized;
|
|
120
|
+
function formatTimeLocalized(timeValue, locale, options) {
|
|
121
|
+
const dateTime = new CalendarDateTime(2e3, 11, 22, timeValue.hour, timeValue.minute);
|
|
122
|
+
return getTimeFormatter(locale, options).format(dateTime.toDate("UTC"));
|
|
123
|
+
}
|
|
124
|
+
_DateTimeUtils.formatTimeLocalized = formatTimeLocalized;
|
|
125
|
+
function formatTimePartsLocalized(timeValue, locale, options) {
|
|
126
|
+
const normalizedValue = new CalendarDateTime(2e3, 11, 22, timeValue?.hour ?? 6, timeValue?.minute ?? 45);
|
|
127
|
+
return formatLocalizedDatePartList(getTimeFormatter(locale, options), normalizedValue.toDate("UTC"), !timeValue);
|
|
128
|
+
}
|
|
129
|
+
_DateTimeUtils.formatTimePartsLocalized = formatTimePartsLocalized;
|
|
130
|
+
function formatCalendarDateTimeLocalized(calendarDateTime, locale, options) {
|
|
131
|
+
const normalizedValue = new CalendarDateTime(calendarDateTime.year, calendarDateTime.month, calendarDateTime.day, calendarDateTime.hour, calendarDateTime.minute);
|
|
132
|
+
return formatLocalizedDateParts(getDateTimeFormatter(locale, options), normalizedValue.toDate("UTC"));
|
|
133
|
+
}
|
|
134
|
+
_DateTimeUtils.formatCalendarDateTimeLocalized = formatCalendarDateTimeLocalized;
|
|
31
135
|
function resolveTimeZone(timeZone) {
|
|
32
136
|
if (timeZone) return timeZone;
|
|
33
137
|
return getLocalTimeZone();
|
|
@@ -41,6 +145,16 @@ var DateTimeUtils;
|
|
|
41
145
|
return dateValue.toDate(resolvedTimeZone).toISOString();
|
|
42
146
|
}
|
|
43
147
|
_DateTimeUtils.fromDateValueToISO = fromDateValueToISO;
|
|
148
|
+
function fromDateValueFieldsToUTCISO(dateValue) {
|
|
149
|
+
const dateTimeFields = dateValue;
|
|
150
|
+
return new CalendarDateTime(dateValue.year, dateValue.month, dateValue.day, dateTimeFields.hour ?? 0, dateTimeFields.minute ?? 0, dateTimeFields.second ?? 0, dateTimeFields.millisecond ?? 0).toDate("UTC").toISOString();
|
|
151
|
+
}
|
|
152
|
+
_DateTimeUtils.fromDateValueFieldsToUTCISO = fromDateValueFieldsToUTCISO;
|
|
153
|
+
function getCurrentWallClockCalendarDateTime() {
|
|
154
|
+
const date = /* @__PURE__ */ new Date();
|
|
155
|
+
return new CalendarDateTime(date.getFullYear(), date.getMonth() + 1, date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds());
|
|
156
|
+
}
|
|
157
|
+
_DateTimeUtils.getCurrentWallClockCalendarDateTime = getCurrentWallClockCalendarDateTime;
|
|
44
158
|
function fromDateValueToOffsetISO(dateValue, timeZone) {
|
|
45
159
|
const resolvedTimeZone = resolveTimeZone(timeZone);
|
|
46
160
|
const date = dateValue.toDate(resolvedTimeZone);
|
|
@@ -14,5 +14,7 @@ export declare namespace ZodUtils {
|
|
|
14
14
|
type ZodType<T> = IsZodType<T, z.ZodBoolean> extends true ? "boolean" : IsZodNumber<T> extends true ? "number" : IsZodEnum<T> extends true ? "enum" : IsZodDateTime<T> extends true ? "datetime" : IsZodUUID<T> extends true ? "uuid" : IsZodString<T> extends true ? "string" : IsZodEmail<T> extends true ? "email" : IsZodDateRange<T> extends true ? "dateRange" : IsZodObject<T> extends true ? "object" : IsZodArray<T> extends true ? "array" : never;
|
|
15
15
|
type ZodTypeSwitch<TZodType extends z.ZodType, T extends Record<ZodType<TZodType> | "unknown", unknown>> = ZodType<TZodType> extends never ? never : T[ZodType<TZodType>];
|
|
16
16
|
const unwrapZodType: (schemaType: z.core.$ZodType) => z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
17
|
+
/** After stripping optional/nullable wrappers, the inner schema must be a `ZodObject` (e.g. for `.shape`, forms, dynamicInputs). */
|
|
18
|
+
const unwrapToZodObject: (schema: z.ZodType) => z.ZodObject<any>;
|
|
17
19
|
const isDateRange: (schemaType: z.core.$ZodType) => boolean;
|
|
18
20
|
}
|
package/dist/utils/zod.utils.js
CHANGED
|
@@ -7,6 +7,11 @@ var ZodUtils;
|
|
|
7
7
|
while (unwrappedType instanceof z.ZodNullable || unwrappedType instanceof z.ZodOptional) unwrappedType = unwrappedType.unwrap();
|
|
8
8
|
return unwrappedType;
|
|
9
9
|
};
|
|
10
|
+
_ZodUtils.unwrapToZodObject = (schema) => {
|
|
11
|
+
const inner = unwrapZodType(schema);
|
|
12
|
+
if (!(inner instanceof z.ZodObject)) throw new Error("ZodUtils.unwrapToZodObject: expected a Zod object, or optional/nullable wrapping a Zod object.");
|
|
13
|
+
return inner;
|
|
14
|
+
};
|
|
10
15
|
const hasZodObjectProperty = (schemaType, property, type) => {
|
|
11
16
|
return property in schemaType.shape && schemaType.shape[property] instanceof z.core.$ZodType && unwrapZodType(schemaType.shape[property]) instanceof type;
|
|
12
17
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@povio/ui",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"module": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"axios": "^1.13.2",
|
|
36
36
|
"class-variance-authority": "^0.7.1",
|
|
37
37
|
"clsx": "^2.1.1",
|
|
38
|
-
"i18next": "
|
|
38
|
+
"i18next": "25.10.10",
|
|
39
39
|
"loglevel": "^1.9.2",
|
|
40
40
|
"loglevel-plugin-prefix": "^0.8.4",
|
|
41
41
|
"luxon": "^3.7.2",
|