@povio/ui 2.2.9-rc.3 → 2.2.9-rc.30

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.
Files changed (116) hide show
  1. package/dist/components/buttons/Button/Button.d.ts +2 -1
  2. package/dist/components/buttons/Button/Button.js +41 -32
  3. package/dist/components/buttons/InlineIconButton/InlineIconButton.d.ts +2 -1
  4. package/dist/components/buttons/InlineIconButton/InlineIconButton.js +2 -2
  5. package/dist/components/inputs/Checkbox/Checkbox.js +6 -1
  6. package/dist/components/inputs/Checkbox/checkbox.cva.d.ts +3 -0
  7. package/dist/components/inputs/Checkbox/checkbox.cva.js +2 -1
  8. package/dist/components/inputs/DateTime/DatePicker/DatePicker.d.ts +8 -3
  9. package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +88 -6
  10. package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +7 -2
  11. package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +91 -6
  12. package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.d.ts +8 -2
  13. package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +91 -7
  14. package/dist/components/inputs/DateTime/TimePicker/TimePicker.d.ts +2 -1
  15. package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +73 -4
  16. package/dist/components/inputs/DateTime/shared/Calendar.d.ts +5 -2
  17. package/dist/components/inputs/DateTime/shared/Calendar.js +23 -6
  18. package/dist/components/inputs/DateTime/shared/CalendarCell.d.ts +1 -1
  19. package/dist/components/inputs/DateTime/shared/CalendarCell.js +3 -3
  20. package/dist/components/inputs/DateTime/shared/CalendarGrid.d.ts +1 -1
  21. package/dist/components/inputs/DateTime/shared/DateField.js +3 -10
  22. package/dist/components/inputs/DateTime/shared/DatePickerInput.d.ts +6 -2
  23. package/dist/components/inputs/DateTime/shared/DatePickerInput.js +65 -55
  24. package/dist/components/inputs/DateTime/shared/DateSegmentItem.d.ts +14 -0
  25. package/dist/components/inputs/DateTime/shared/DateSegmentItem.js +19 -6
  26. package/dist/components/inputs/DateTime/shared/TimePickerInput.js +4 -2
  27. package/dist/components/inputs/DateTime/shared/datePicker.types.d.ts +4 -0
  28. package/dist/components/inputs/DateTime/shared/datePickerInput.cva.d.ts +7 -0
  29. package/dist/components/inputs/DateTime/shared/datePickerInput.cva.js +13 -0
  30. package/dist/components/inputs/DateTime/shared/datePickerTodayIcon.d.ts +6 -0
  31. package/dist/components/inputs/DateTime/shared/datePickerTodayIcon.js +21 -0
  32. package/dist/components/inputs/DateTime/shared/dateSegment.utils.d.ts +2 -0
  33. package/dist/components/inputs/DateTime/shared/dateSegment.utils.js +9 -0
  34. package/dist/components/inputs/DateTime/shared/dateSegment.utils.spec.d.ts +1 -0
  35. package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.d.ts +35 -0
  36. package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.js +80 -0
  37. package/dist/components/inputs/File/FileUpload.js +1 -0
  38. package/dist/components/inputs/File/shared/InputUploadContent.js +1 -0
  39. package/dist/components/inputs/FormField/FormField.d.ts +3 -3
  40. package/dist/components/inputs/FormField/FormFieldHeader.js +3 -1
  41. package/dist/components/inputs/FormField/formFieldHeader.cva.d.ts +6 -0
  42. package/dist/components/inputs/FormField/formFieldHeader.cva.js +11 -0
  43. package/dist/components/inputs/Input/NumberInput/NumberInput.d.ts +5 -2
  44. package/dist/components/inputs/Input/NumberInput/NumberInput.js +85 -7
  45. package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.d.ts +38 -0
  46. package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.js +318 -0
  47. package/dist/components/inputs/Input/TextInput/TextInput.d.ts +3 -1
  48. package/dist/components/inputs/Input/TextInput/TextInput.js +88 -7
  49. package/dist/components/inputs/Input/shared/InputContent.js +7 -6
  50. package/dist/components/inputs/Input/shared/numberStatic.utils.d.ts +1 -0
  51. package/dist/components/inputs/Input/shared/numberStatic.utils.js +7 -0
  52. package/dist/components/inputs/Inputs/InputItem.d.ts +15 -18
  53. package/dist/components/inputs/Inputs/InputItem.js +2 -0
  54. package/dist/components/inputs/RadioGroup/RadioGroup.js +17 -9
  55. package/dist/components/inputs/RadioGroup/radio.cva.d.ts +3 -0
  56. package/dist/components/inputs/RadioGroup/radio.cva.js +2 -1
  57. package/dist/components/inputs/Selection/Autocomplete/Autocomplete.d.ts +6 -2
  58. package/dist/components/inputs/Selection/Autocomplete/Autocomplete.js +104 -6
  59. package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.d.ts +1 -1
  60. package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.js +15 -10
  61. package/dist/components/inputs/Selection/Autocomplete/queryAutocomplete.types.d.ts +25 -19
  62. package/dist/components/inputs/Selection/Select/QuerySelect.d.ts +3 -4
  63. package/dist/components/inputs/Selection/Select/QuerySelect.js +8 -35
  64. package/dist/components/inputs/Selection/Select/Select.d.ts +7 -3
  65. package/dist/components/inputs/Selection/Select/Select.js +119 -4
  66. package/dist/components/inputs/Selection/shared/SelectBase.d.ts +4 -1
  67. package/dist/components/inputs/Selection/shared/SelectBase.js +3 -2
  68. package/dist/components/inputs/Selection/shared/SelectDesktop.d.ts +1 -1
  69. package/dist/components/inputs/Selection/shared/SelectDesktop.js +8 -4
  70. package/dist/components/inputs/Selection/shared/SelectInput.d.ts +2 -2
  71. package/dist/components/inputs/Selection/shared/SelectInput.js +13 -2
  72. package/dist/components/inputs/Selection/shared/SelectListBox.d.ts +2 -2
  73. package/dist/components/inputs/Selection/shared/SelectListBox.js +3 -3
  74. package/dist/components/inputs/Selection/shared/SelectMobile.d.ts +1 -1
  75. package/dist/components/inputs/Selection/shared/SelectMobile.js +5 -3
  76. package/dist/components/inputs/Selection/shared/select.context.d.ts +3 -2
  77. package/dist/components/inputs/Selection/shared/select.context.js +27 -4
  78. package/dist/components/inputs/Selection/shared/select.types.d.ts +3 -2
  79. package/dist/components/inputs/Selection/shared/selectDesktop.cva.d.ts +3 -0
  80. package/dist/components/inputs/Selection/shared/selectDesktop.cva.js +5 -0
  81. package/dist/components/inputs/Selection/shared/staticSelect.utils.d.ts +23 -0
  82. package/dist/components/inputs/Selection/shared/staticSelect.utils.js +37 -0
  83. package/dist/components/inputs/Selection/shared/staticSelect.utils.spec.d.ts +1 -0
  84. package/dist/components/inputs/Skeleton/InputFrame.d.ts +68 -0
  85. package/dist/components/inputs/Skeleton/InputFrame.js +171 -0
  86. package/dist/components/inputs/TextEditor/TextEditor.js +1 -0
  87. package/dist/components/inputs/Toggle/Toggle.js +6 -1
  88. package/dist/components/inputs/Toggle/toggle.cva.d.ts +3 -0
  89. package/dist/components/inputs/Toggle/toggle.cva.js +2 -1
  90. package/dist/components/inputs/shared/CheckContent.d.ts +2 -1
  91. package/dist/components/inputs/shared/CheckContent.js +3 -4
  92. package/dist/components/inputs/shared/InputClear.d.ts +2 -1
  93. package/dist/components/inputs/shared/InputClear.js +13 -1
  94. package/dist/components/inputs/shared/StaticInput.d.ts +38 -0
  95. package/dist/components/inputs/shared/StaticInput.js +104 -0
  96. package/dist/components/inputs/shared/TooltipWrapper.js +5 -1
  97. package/dist/components/inputs/shared/input.cva.d.ts +10 -0
  98. package/dist/components/inputs/shared/input.cva.js +19 -1
  99. package/dist/components/inputs/shared/tooltipWrapper.cva.d.ts +4 -0
  100. package/dist/components/inputs/shared/tooltipWrapper.cva.js +5 -0
  101. package/dist/config/uiConfig.context.d.ts +8 -2
  102. package/dist/config/uiConfig.context.js +12 -1
  103. package/dist/config/uiStyle.context.d.ts +20 -3
  104. package/dist/helpers/dynamicInputs.d.ts +1 -1
  105. package/dist/helpers/dynamicInputs.js +3 -0
  106. package/dist/hooks/useIntersectionObserver.d.ts +1 -1
  107. package/dist/hooks/useIntersectionObserver.js +29 -10
  108. package/dist/hooks/useQueryAutocomplete.d.ts +5 -16
  109. package/dist/hooks/useQueryAutocomplete.js +13 -3
  110. package/dist/index.d.ts +7 -0
  111. package/dist/index.js +4 -2
  112. package/dist/utils/date-time.utils.d.ts +30 -9
  113. package/dist/utils/date-time.utils.js +113 -1
  114. package/dist/utils/query.utils.d.ts +4 -0
  115. package/dist/utils/query.utils.js +8 -0
  116. package/package.json +1 -1
@@ -1,10 +1,19 @@
1
+ import { ApiQueryUtils } from "../utils/query.utils.js";
1
2
  import { useMemo, useState } from "react";
2
3
  //#region src/hooks/useQueryAutocomplete.ts
4
+ var isFilterSearchParams = (params) => {
5
+ return typeof params === "object" && params !== null && "filter" in params;
6
+ };
3
7
  var useQueryAutocomplete = ({ query, queryParams, queryOptions, mapItems, initialQueryState, search }) => {
4
8
  const [isQueryEnabled, setIsQueryEnabled] = useState(!initialQueryState);
5
9
  const queryResult = query(search === void 0 ? queryParams : {
10
+ ...queryParams,
11
+ limit: queryParams?.limit ?? ApiQueryUtils.DEFAULT_LIMIT,
6
12
  search,
7
- ...queryParams
13
+ ...isFilterSearchParams(queryParams) ? { filter: {
14
+ ...queryParams.filter,
15
+ search
16
+ } } : {}
8
17
  }, {
9
18
  ...queryOptions,
10
19
  enabled: isQueryEnabled && (queryOptions?.enabled ?? true)
@@ -14,14 +23,14 @@ var useQueryAutocomplete = ({ query, queryParams, queryOptions, mapItems, initia
14
23
  const isInfiniteQueryResult = (result) => {
15
24
  return "hasNextPage" in result && "fetchNextPage" in result;
16
25
  };
17
- const isInfiniteQuery = isInfiniteQueryResult(queryResult);
18
26
  const handleEnableQuery = () => {
19
27
  setIsQueryEnabled(true);
20
28
  };
21
- const infiniteQueryResult = isInfiniteQuery ? queryResult : void 0;
29
+ const infiniteQueryResult = isInfiniteQueryResult(queryResult) ? queryResult : void 0;
22
30
  const hasNextPage = infiniteQueryResult?.hasNextPage ?? false;
23
31
  const fetchNextPage = infiniteQueryResult?.fetchNextPage;
24
32
  const isFetchingNextPage = infiniteQueryResult?.isFetchingNextPage ?? false;
33
+ const totalItems = infiniteQueryResult?.data?.pages?.[0]?.totalItems;
25
34
  const items = useMemo(() => {
26
35
  if (!data) return [];
27
36
  return mapItems(data);
@@ -32,6 +41,7 @@ var useQueryAutocomplete = ({ query, queryParams, queryOptions, mapItems, initia
32
41
  isQueryEnabled,
33
42
  handleEnableQuery,
34
43
  items,
44
+ totalItems,
35
45
  hasNextPage,
36
46
  fetchNextPage,
37
47
  isFetchingNextPage
package/dist/index.d.ts CHANGED
@@ -78,6 +78,8 @@ export type { FormFieldProps } from './components/inputs/FormField/FormField';
78
78
  export { FormField } from './components/inputs/FormField/FormField';
79
79
  export type { ControlledNumberInputProps, NumberInputProps } from './components/inputs/Input/NumberInput/NumberInput';
80
80
  export { NumberInput } from './components/inputs/Input/NumberInput/NumberInput';
81
+ export type { ControlledNumberRangeInputProps, NumberRangeInputProps, NumberRangeValue, } from './components/inputs/Input/NumberRangeInput/NumberRangeInput';
82
+ export { NumberRangeInput } from './components/inputs/Input/NumberRangeInput/NumberRangeInput';
81
83
  export type { ControlledPasswordInputProps, PasswordInputProps, } from './components/inputs/Input/PasswordInput/PasswordInput';
82
84
  export { PasswordInput } from './components/inputs/Input/PasswordInput/PasswordInput';
83
85
  export type { ControlledTextAreaProps, TextAreaProps } from './components/inputs/Input/TextArea/TextArea';
@@ -94,11 +96,16 @@ export type { RadioVariantProps } from './components/inputs/RadioGroup/radio.cva
94
96
  export type { AutocompleteProps, ControlledAutocompleteProps, } from './components/inputs/Selection/Autocomplete/Autocomplete';
95
97
  export { Autocomplete } from './components/inputs/Selection/Autocomplete/Autocomplete';
96
98
  export { QueryAutocomplete } from './components/inputs/Selection/Autocomplete/QueryAutocomplete';
99
+ export type { SelectBaseProps } from './components/inputs/Selection/shared/SelectBase';
100
+ export type { DefaultInitialSelectItem, SelectAsyncProps, SelectItem, } from './components/inputs/Selection/shared/select.types';
101
+ export type { QuerySelectProps } from './components/inputs/Selection/Select/QuerySelect';
102
+ export { QuerySelect } from './components/inputs/Selection/Select/QuerySelect';
97
103
  export type { ControlledSelectProps, SelectProps } from './components/inputs/Selection/Select/Select';
98
104
  export { Select } from './components/inputs/Selection/Select/Select';
99
105
  export type { ControlledSliderProps, SliderProps } from './components/inputs/Slider/Slider';
100
106
  export { Slider } from './components/inputs/Slider/Slider';
101
107
  export type { InputVariantProps } from './components/inputs/shared/input.cva';
108
+ export type { TooltipWrapperTriggerVariantProps } from './components/inputs/shared/tooltipWrapper.cva';
102
109
  export type { ControlledToggleProps, ToggleProps } from './components/inputs/Toggle/Toggle';
103
110
  export { Toggle } from './components/inputs/Toggle/Toggle';
104
111
  export type { MenuProps } from './components/Menu/Menu';
package/dist/index.js CHANGED
@@ -67,9 +67,9 @@ import { ToggleButton } from "./components/buttons/ToggleButton/ToggleButton.js"
67
67
  import { Checkbox } from "./components/inputs/Checkbox/Checkbox.js";
68
68
  import { useLongPressRepeat } from "./hooks/useLongPressRepeat.js";
69
69
  import { useScrollableListBox } from "./hooks/useScrollableListBox.js";
70
+ import { DateTimeUtils } from "./utils/date-time.utils.js";
70
71
  import { FormField } from "./components/inputs/FormField/FormField.js";
71
72
  import { useDebounceCallback } from "./hooks/useDebounceCallback.js";
72
- import { DateTimeUtils } from "./utils/date-time.utils.js";
73
73
  import { DatePicker } from "./components/inputs/DateTime/DatePicker/DatePicker.js";
74
74
  import { Tag } from "./components/text/Tag/Tag.js";
75
75
  import { useIntersectionObserver } from "./hooks/useIntersectionObserver.js";
@@ -85,6 +85,7 @@ import { FileUpload } from "./components/inputs/File/FileUpload.js";
85
85
  import { FileUploadContainer } from "./components/inputs/File/FileUploadContainer.js";
86
86
  import { InputUpload } from "./components/inputs/File/InputUpload.js";
87
87
  import { NumberInput } from "./components/inputs/Input/NumberInput/NumberInput.js";
88
+ import { NumberRangeInput } from "./components/inputs/Input/NumberRangeInput/NumberRangeInput.js";
88
89
  import { PasswordInput } from "./components/inputs/Input/PasswordInput/PasswordInput.js";
89
90
  import { TextArea } from "./components/inputs/Input/TextArea/TextArea.js";
90
91
  import { Autocomplete } from "./components/inputs/Selection/Autocomplete/Autocomplete.js";
@@ -92,6 +93,7 @@ import { QueryAutocomplete } from "./components/inputs/Selection/Autocomplete/Qu
92
93
  import { Slider } from "./components/inputs/Slider/Slider.js";
93
94
  import { Toggle } from "./components/inputs/Toggle/Toggle.js";
94
95
  import { Segment } from "./components/segment/Segment.js";
96
+ import { QuerySelect } from "./components/inputs/Selection/Select/QuerySelect.js";
95
97
  import { ResponsivePopover } from "./components/overlays/ResponsivePopover/ResponsivePopover.js";
96
98
  import { StringUtils } from "./utils/string.utils.js";
97
99
  import { dynamicInputs } from "./helpers/dynamicInputs.js";
@@ -135,4 +137,4 @@ import { useTableColumnConfig } from "./hooks/useTableColumnConfig.js";
135
137
  import { ArrayUtils } from "./utils/array.utils.js";
136
138
  import { QueriesUtils } from "./utils/queries.utils.js";
137
139
  import { RoutingUtils } from "./utils/routing.utils.js";
138
- export { Accordion, ActionModal, Alert, AlignCenterIcon, AlignLeftIcon, AlignLeftRightIcon, AlignRightIcon, ArrayUtils, ArrowDropDownIcon, ArrowDropUpIcon, ArrowLeftIcon, ArrowRightIcon, Autocomplete, BoldIcon, BottomSheet, Breadcrumbs, BulletedListIcon, Button, CalendarIcon, CellText, CheckIcon, Checkbox, CheckboxCheckmarkIcon, CheckboxIndeterminateIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, ChevronsLeftIcon, ChevronsRightIcon, ClockIcon, CloseIcon, ColumnConfigModal, Confirmation, DatePicker, DateRangePicker, DateTimeIcon, DateTimePicker, DateTimeUtils, DateUtils, DomUtils, Drawer, FileUpload, FileUploadContainer, FileUtils, Form, FormField, HeaderText, HighlightIcon, HighlightOnIcon, HomeIcon, IconButton, InfiniteTable, InfoIcon, InlineIconButton, InputUpload, Inputs, ItalicIcon, Link, LinkContext, LinkIcon, Loader, Menu, MenuIcon, MenuItem, MenuPopover, Modal, NumberInput, NumberedListIcon, ObjectUtils, PaginatedTable, Pagination, PaginationList, PasswordInput, PillButton, PointerHorizontalIcon, PointerVerticalIcon, ProgressBar, QueriesUtils, QueryAutocomplete, RadioGroup, ResponsivePopover, RestUtils, RoutingUtils, Segment, Select, SendIcon, Slider, SplitButton, Stepper, StrikethroughIcon, StringUtils, Table, Tag, TextArea, TextButton, TextColorIcon, TextInput, ThemeContext, TimePicker, Toast, ToastContainer, Toggle, ToggleButton, Tooltip, TooltipEllipsis, Typography, UIConfig, UIRouter, UIStyle, UnderlinedIcon, VisibilityIcon, VisibilityOffIcon, compoundMapper, dynamicColumns, dynamicInputs, isEqual, logger, ns, resources, uiOutlineClass, useAutosave, useBreakpoint, useDebounceCallback, useDeepCompareEffect, useDeepCompareLayoutEffect, useDeepCompareMemo, useFilters, useForm, useFormAutosave, useIntersectionObserver, useLocalStorage, useLongPressRepeat, usePagination, useScrollableListBox, useSorting, useStateAndRef, useTableColumnConfig, useTableNav, useToast, useTranslationMemo };
140
+ export { Accordion, ActionModal, Alert, AlignCenterIcon, AlignLeftIcon, AlignLeftRightIcon, AlignRightIcon, ArrayUtils, ArrowDropDownIcon, ArrowDropUpIcon, ArrowLeftIcon, ArrowRightIcon, Autocomplete, BoldIcon, BottomSheet, Breadcrumbs, BulletedListIcon, Button, CalendarIcon, CellText, CheckIcon, Checkbox, CheckboxCheckmarkIcon, CheckboxIndeterminateIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, ChevronsLeftIcon, ChevronsRightIcon, ClockIcon, CloseIcon, ColumnConfigModal, Confirmation, DatePicker, DateRangePicker, DateTimeIcon, DateTimePicker, DateTimeUtils, DateUtils, DomUtils, Drawer, FileUpload, FileUploadContainer, FileUtils, Form, FormField, HeaderText, HighlightIcon, HighlightOnIcon, HomeIcon, IconButton, InfiniteTable, InfoIcon, InlineIconButton, InputUpload, Inputs, ItalicIcon, Link, LinkContext, LinkIcon, Loader, Menu, MenuIcon, MenuItem, MenuPopover, Modal, NumberInput, NumberRangeInput, NumberedListIcon, ObjectUtils, PaginatedTable, Pagination, PaginationList, PasswordInput, PillButton, PointerHorizontalIcon, PointerVerticalIcon, ProgressBar, QueriesUtils, QueryAutocomplete, QuerySelect, RadioGroup, ResponsivePopover, RestUtils, RoutingUtils, Segment, Select, SendIcon, Slider, SplitButton, Stepper, StrikethroughIcon, StringUtils, Table, Tag, TextArea, TextButton, TextColorIcon, TextInput, ThemeContext, TimePicker, Toast, ToastContainer, Toggle, ToggleButton, Tooltip, TooltipEllipsis, Typography, UIConfig, UIRouter, UIStyle, UnderlinedIcon, VisibilityIcon, VisibilityOffIcon, compoundMapper, dynamicColumns, dynamicInputs, isEqual, logger, ns, resources, uiOutlineClass, useAutosave, useBreakpoint, useDebounceCallback, useDeepCompareEffect, useDeepCompareLayoutEffect, useDeepCompareMemo, useFilters, useForm, useFormAutosave, useIntersectionObserver, useLocalStorage, useLongPressRepeat, usePagination, useScrollableListBox, useSorting, useStateAndRef, useTableColumnConfig, useTableNav, useToast, useTranslationMemo };
@@ -1,14 +1,35 @@
1
1
  import { CalendarDate, CalendarDateTime, DateValue, ZonedDateTime } from '@internationalized/date';
2
2
  export declare namespace DateTimeUtils {
3
- function fromISOtoZonedDateTime(isoString: string): ZonedDateTime;
4
- function fromDateValueToISO(dateValue: DateValue): string;
5
- function fromLocalToZonedDateTime(date: Date): ZonedDateTime;
6
- function fromDateValueToLocal(dateValue: DateValue): Date;
7
- function fromCalendarDateToUTCISO(calendarDate: CalendarDate, options?: {
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 formatTimeLocalized(timeValue: {
19
+ hour: number;
20
+ minute: number;
21
+ }, locale?: string): string;
22
+ export function formatCalendarDateTimeLocalized(calendarDateTime: Pick<CalendarDateTime, "day" | "month" | "year" | "hour" | "minute">, locale?: string, options?: LocalizedDateFormatOptions): string;
23
+ export function fromISOtoZonedDateTime(isoString: string): ZonedDateTime;
24
+ export function fromDateValueToISO(dateValue: DateValue): string;
25
+ export function fromLocalToZonedDateTime(date: Date): ZonedDateTime;
26
+ export function fromDateValueToLocal(dateValue: DateValue): Date;
27
+ export function fromCalendarDateToUTCISO(calendarDate: CalendarDate, options?: {
8
28
  endOfDay?: boolean;
9
29
  }): string;
10
- function fromUTCISOToCalendarDate(isoString: string): CalendarDate;
11
- function fromCalendarDateTimeToUTCISO(calendarDateTime: CalendarDateTime): string;
12
- function fromUTCISOToCalendarDateTime(isoString: string): CalendarDateTime;
13
- function formatTextDateToCalendarDateTime(textDate: string | null): CalendarDateTime | null;
30
+ export function fromUTCISOToCalendarDate(isoString: string): CalendarDate;
31
+ export function fromCalendarDateTimeToUTCISO(calendarDateTime: CalendarDateTime): string;
32
+ export function fromUTCISOToCalendarDateTime(isoString: string): CalendarDateTime;
33
+ export function formatTextDateToCalendarDateTime(textDate: string | null): CalendarDateTime | null;
34
+ export {};
14
35
  }
@@ -1,7 +1,119 @@
1
- import { CalendarDate, CalendarDateTime, fromDate, getLocalTimeZone, parseAbsolute, parseAbsoluteToLocal } from "@internationalized/date";
1
+ import { CalendarDate, CalendarDateTime, DateFormatter, fromDate, getLocalTimeZone, parseAbsolute, parseAbsoluteToLocal } from "@internationalized/date";
2
2
  //#region src/utils/date-time.utils.ts
3
3
  var DateTimeUtils;
4
4
  (function(_DateTimeUtils) {
5
+ const DATE_SAMPLE_DATE_UTC = new Date(Date.UTC(2e3, 10, 22));
6
+ const TIME_SAMPLE_DATE_UTC = new Date(Date.UTC(2e3, 10, 22, 13, 45));
7
+ const getDayMonthFormat = (shouldForceLeadingZeros = false) => shouldForceLeadingZeros ? "2-digit" : "numeric";
8
+ const getDatePlaceholderFormatter = (locale, options) => new Intl.DateTimeFormat(locale, {
9
+ day: getDayMonthFormat(options?.shouldForceLeadingZeros),
10
+ month: getDayMonthFormat(options?.shouldForceLeadingZeros),
11
+ year: "numeric"
12
+ });
13
+ const getTimePlaceholderFormatter = (locale) => new Intl.DateTimeFormat(locale, {
14
+ hour: "2-digit",
15
+ minute: "2-digit",
16
+ hourCycle: "h23"
17
+ });
18
+ const getResolvedLocale = (locale) => {
19
+ if (locale) return locale;
20
+ return new Intl.DateTimeFormat().resolvedOptions().locale;
21
+ };
22
+ const getDateFormatter = (locale, options) => new Intl.DateTimeFormat(getResolvedLocale(locale), {
23
+ day: getDayMonthFormat(options?.shouldForceLeadingZeros),
24
+ month: getDayMonthFormat(options?.shouldForceLeadingZeros),
25
+ year: "numeric",
26
+ timeZone: "UTC"
27
+ });
28
+ const getTimeFormatter = (locale) => new DateFormatter(getResolvedLocale(locale), {
29
+ hour: "2-digit",
30
+ minute: "2-digit",
31
+ hourCycle: "h23",
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: "2-digit",
39
+ minute: "2-digit",
40
+ hourCycle: "h23",
41
+ timeZone: "UTC"
42
+ });
43
+ const repeatLocalizedFieldLabel = (type, length, locale) => {
44
+ const placeholderChar = new Intl.DisplayNames(getResolvedLocale(locale), { type: "dateTimeField" }).of(type)?.trim().charAt(0).toLocaleLowerCase(getResolvedLocale(locale));
45
+ if (!placeholderChar) return null;
46
+ return placeholderChar.repeat(length);
47
+ };
48
+ const mapTypeToPlaceholder = (type, locale) => {
49
+ switch (type) {
50
+ case "day": return repeatLocalizedFieldLabel(type, 2, locale);
51
+ case "month": return repeatLocalizedFieldLabel(type, 2, locale);
52
+ case "year": return repeatLocalizedFieldLabel(type, 4, locale);
53
+ case "hour": return "hh";
54
+ case "minute": return "mm";
55
+ default: return null;
56
+ }
57
+ };
58
+ const formatPlaceholder = (formatter, sampleDate) => {
59
+ return formatter.formatToParts(sampleDate).map((part) => mapTypeToPlaceholder(part.type, formatter.resolvedOptions().locale) ?? part.value.replace(/\s+/gu, "")).join("");
60
+ };
61
+ const removeLeadingZero = (value) => value.replace(/^0+(?=\d)/u, "");
62
+ const removeDateSeparatorSpacing = (value) => value.replace(/([./-])\s+(?=\d)/gu, "$1");
63
+ const formatLocalizedDateParts = (formatter, date, options) => {
64
+ if (options?.shouldForceLeadingZeros !== false) return removeDateSeparatorSpacing(formatter.format(date));
65
+ return removeDateSeparatorSpacing(formatter.formatToParts(date).map((part) => {
66
+ if (part.type === "day" || part.type === "month") return removeLeadingZero(part.value);
67
+ return part.value;
68
+ }).join(""));
69
+ };
70
+ const formatLocalizedDatePartList = (formatter, date, isPlaceholder, options) => {
71
+ const locale = formatter.resolvedOptions().locale;
72
+ return formatter.formatToParts(date).map((part) => {
73
+ const value = options?.shouldForceLeadingZeros === false && (part.type === "day" || part.type === "month") ? removeLeadingZero(part.value) : part.value.replace(/\s+/gu, "");
74
+ return {
75
+ type: part.type,
76
+ value,
77
+ placeholder: mapTypeToPlaceholder(part.type, locale) ?? part.value.replace(/\s+/gu, ""),
78
+ isPlaceholder
79
+ };
80
+ });
81
+ };
82
+ function getDatePlaceholder(locale, options) {
83
+ return formatPlaceholder(getDatePlaceholderFormatter(locale, options), DATE_SAMPLE_DATE_UTC);
84
+ }
85
+ _DateTimeUtils.getDatePlaceholder = getDatePlaceholder;
86
+ function getTimePlaceholder(locale) {
87
+ return formatPlaceholder(getTimePlaceholderFormatter(locale), TIME_SAMPLE_DATE_UTC);
88
+ }
89
+ _DateTimeUtils.getTimePlaceholder = getTimePlaceholder;
90
+ function getDateTimePlaceholder(locale, options) {
91
+ return `${getDatePlaceholder(locale, options)}, ${getTimePlaceholder(locale)}`;
92
+ }
93
+ _DateTimeUtils.getDateTimePlaceholder = getDateTimePlaceholder;
94
+ function getDateRangePlaceholder(locale, options) {
95
+ const datePlaceholder = getDatePlaceholder(locale, options);
96
+ return `${datePlaceholder} – ${datePlaceholder}`;
97
+ }
98
+ _DateTimeUtils.getDateRangePlaceholder = getDateRangePlaceholder;
99
+ function formatCalendarDateLocalized(calendarDate, locale, options) {
100
+ return formatLocalizedDateParts(getDateFormatter(locale, options), calendarDate.toDate("UTC"), options);
101
+ }
102
+ _DateTimeUtils.formatCalendarDateLocalized = formatCalendarDateLocalized;
103
+ function formatCalendarDatePartsLocalized(calendarDate, locale, options) {
104
+ return formatLocalizedDatePartList(getDateFormatter(locale, options), calendarDate?.toDate("UTC") ?? DATE_SAMPLE_DATE_UTC, !calendarDate, options);
105
+ }
106
+ _DateTimeUtils.formatCalendarDatePartsLocalized = formatCalendarDatePartsLocalized;
107
+ function formatTimeLocalized(timeValue, locale) {
108
+ const dateTime = new CalendarDateTime(2e3, 11, 22, timeValue.hour, timeValue.minute);
109
+ return getTimeFormatter(locale).format(dateTime.toDate("UTC"));
110
+ }
111
+ _DateTimeUtils.formatTimeLocalized = formatTimeLocalized;
112
+ function formatCalendarDateTimeLocalized(calendarDateTime, locale, options) {
113
+ const normalizedValue = new CalendarDateTime(calendarDateTime.year, calendarDateTime.month, calendarDateTime.day, calendarDateTime.hour, calendarDateTime.minute);
114
+ return formatLocalizedDateParts(getDateTimeFormatter(locale, options), normalizedValue.toDate("UTC"), options);
115
+ }
116
+ _DateTimeUtils.formatCalendarDateTimeLocalized = formatCalendarDateTimeLocalized;
5
117
  function fromISOtoZonedDateTime(isoString) {
6
118
  return parseAbsoluteToLocal(isoString);
7
119
  }
@@ -0,0 +1,4 @@
1
+ export declare namespace ApiQueryUtils {
2
+ const DEFAULT_LIMIT = 20;
3
+ const DEFAULT_PAGE = 1;
4
+ }
@@ -0,0 +1,8 @@
1
+ //#region src/utils/query.utils.ts
2
+ var ApiQueryUtils;
3
+ (function(_ApiQueryUtils) {
4
+ _ApiQueryUtils.DEFAULT_LIMIT = 20;
5
+ _ApiQueryUtils.DEFAULT_PAGE = 1;
6
+ })(ApiQueryUtils || (ApiQueryUtils = {}));
7
+ //#endregion
8
+ export { ApiQueryUtils };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@povio/ui",
3
- "version": "2.2.9-rc.3",
3
+ "version": "2.2.9-rc.30",
4
4
  "type": "module",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",