@povio/ui 3.2.4-rc.5 → 3.2.4-rc.6

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.
@@ -361,7 +361,6 @@ var DatePickerInner = (t0) => {
361
361
  const disableManualEntry = props.disableManualEntry ?? ui.dateInput.disableManualEntry;
362
362
  const showDropdown = !props.disableDropdown || disableManualEntry;
363
363
  const staticSegments = getStaticCalendarDateSegments({
364
- intl: ui.intl,
365
364
  value: dateValue,
366
365
  locale,
367
366
  shouldForceLeadingZeros,
@@ -817,7 +817,6 @@ var DateRangePickerInner = (t0) => {
817
817
  const disableManualEntry = props.disableManualEntry ?? ui.dateInput.disableManualEntry;
818
818
  const showDropdown = !props.disableDropdown || disableManualEntry;
819
819
  const staticSegments = getStaticDateRangeSegments({
820
- intl: ui.intl,
821
820
  start: startDateValue,
822
821
  end: endDateValue,
823
822
  locale,
@@ -285,7 +285,6 @@ var DateTimePickerInner = (t0) => {
285
285
  const disableManualEntry = props.disableManualEntry ?? ui.dateInput.disableManualEntry;
286
286
  const showDropdown = !props.disableDropdown || disableManualEntry;
287
287
  const staticSegments = getStaticCalendarDateTimeSegments({
288
- intl: ui.intl,
289
288
  value: dateTimeValue,
290
289
  locale,
291
290
  shouldForceLeadingZeros,
@@ -503,7 +503,6 @@ var TimePickerInner = (t0) => {
503
503
  const shouldForceLeadingZeros = props.shouldForceLeadingZeros ?? ui.dateInput.shouldForceLeadingZeros;
504
504
  const showDropdown = !props.disableDropdown || disableManualEntry;
505
505
  const staticSegments = getStaticTimeSegments({
506
- intl: ui.intl,
507
506
  value: timeValue_0,
508
507
  locale,
509
508
  shouldForceLeadingZeros,
@@ -1,11 +1,9 @@
1
1
  import { CalendarDate } from '@internationalized/date';
2
2
  import { ReactNode } from 'react';
3
3
  import { DateValue, TimeValue } from 'react-aria';
4
- import { IntlFormatters } from '../../../../utils/intl.utils';
5
4
  interface StaticSegmentProps {
6
5
  isDisabled?: boolean;
7
6
  hidePlaceholder?: boolean;
8
- intl?: IntlFormatters;
9
7
  }
10
8
  interface StaticManualEntryPlaceholderProps {
11
9
  disableManualEntry?: boolean;
@@ -34,10 +32,10 @@ interface StaticTimeSegmentsProps extends StaticSegmentProps, StaticManualEntryP
34
32
  locale: string;
35
33
  shouldForceLeadingZeros?: boolean;
36
34
  }
37
- export declare const getStaticCalendarDateSegments: ({ value, locale, shouldForceLeadingZeros, isDisabled, hidePlaceholder, disableManualEntry, placeholder, intl, dateGranularity, }: StaticCalendarDateSegmentsProps) => import("react/jsx-runtime").JSX.Element;
38
- export declare const getStaticCalendarDateTimeSegments: ({ value, locale, shouldForceLeadingZeros, isDisabled, hidePlaceholder, disableManualEntry, placeholder, intl, }: StaticCalendarDateTimeSegmentsProps) => import("react/jsx-runtime").JSX.Element;
39
- export declare const getStaticDateRangeSegments: ({ start, end, locale, shouldForceLeadingZeros, isDisabled, hidePlaceholder, disableManualEntry, placeholder, intl, }: StaticDateRangeSegmentsProps) => import("react/jsx-runtime").JSX.Element;
40
- export declare const getStaticTimeSegments: ({ value, locale, shouldForceLeadingZeros, isDisabled, hidePlaceholder, disableManualEntry, placeholder, intl, }: StaticTimeSegmentsProps) => import("react/jsx-runtime").JSX.Element;
35
+ export declare const getStaticCalendarDateSegments: ({ value, locale, shouldForceLeadingZeros, isDisabled, hidePlaceholder, disableManualEntry, placeholder, dateGranularity, }: StaticCalendarDateSegmentsProps) => import("react/jsx-runtime").JSX.Element;
36
+ export declare const getStaticCalendarDateTimeSegments: ({ value, locale, shouldForceLeadingZeros, isDisabled, hidePlaceholder, disableManualEntry, placeholder, }: StaticCalendarDateTimeSegmentsProps) => import("react/jsx-runtime").JSX.Element;
37
+ export declare const getStaticDateRangeSegments: ({ start, end, locale, shouldForceLeadingZeros, isDisabled, hidePlaceholder, disableManualEntry, placeholder, }: StaticDateRangeSegmentsProps) => import("react/jsx-runtime").JSX.Element;
38
+ export declare const getStaticTimeSegments: ({ value, locale, shouldForceLeadingZeros, isDisabled, hidePlaceholder, disableManualEntry, placeholder, }: StaticTimeSegmentsProps) => import("react/jsx-runtime").JSX.Element;
41
39
  export declare const getStaticDateTimePlaceholder: (placeholder: ReactNode) => import("react/jsx-runtime").JSX.Element;
42
40
  export declare const getStaticDateTimeFocusTarget: (container: HTMLElement, staticTarget: EventTarget | null) => HTMLElement | null;
43
41
  export {};
@@ -3,28 +3,28 @@ import { DateSegmentItemView } from "./DateSegmentItem.js";
3
3
  import { DateTimeUtils } from "../../../../utils/date-time.utils.js";
4
4
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
5
5
  //#region src/components/inputs/DateTime/shared/staticDateTimeSegments.tsx
6
- var getStaticCalendarDateSegments = ({ value, locale, shouldForceLeadingZeros, isDisabled, hidePlaceholder, disableManualEntry, placeholder, intl, dateGranularity = "day" }) => {
6
+ var getStaticCalendarDateSegments = ({ value, locale, shouldForceLeadingZeros, isDisabled, hidePlaceholder, disableManualEntry, placeholder, dateGranularity = "day" }) => {
7
7
  if (disableManualEntry && placeholder && !value) return getStaticDateTimePlaceholder(placeholder);
8
- return renderStaticDateTimeParts(DateTimeUtils.formatCalendarDatePartsLocalized(value, locale, { shouldForceLeadingZeros }, intl), {
8
+ return renderStaticDateTimeParts(DateTimeUtils.formatCalendarDatePartsLocalized(value, locale, { shouldForceLeadingZeros }), {
9
9
  isDisabled,
10
10
  hidePlaceholder,
11
11
  dateGranularity
12
12
  });
13
13
  };
14
- var getStaticCalendarDateTimeSegments = ({ value, locale, shouldForceLeadingZeros, isDisabled, hidePlaceholder, disableManualEntry, placeholder, intl }) => {
14
+ var getStaticCalendarDateTimeSegments = ({ value, locale, shouldForceLeadingZeros, isDisabled, hidePlaceholder, disableManualEntry, placeholder }) => {
15
15
  const hasValue = !!(value && "hour" in value);
16
16
  if (disableManualEntry && placeholder && !hasValue) return getStaticDateTimePlaceholder(placeholder);
17
- return renderStaticDateTimeParts(DateTimeUtils.formatCalendarDateTimePartsLocalized(hasValue ? value : null, locale, { shouldForceLeadingZeros }, intl), {
17
+ return renderStaticDateTimeParts(DateTimeUtils.formatCalendarDateTimePartsLocalized(hasValue ? value : null, locale, { shouldForceLeadingZeros }), {
18
18
  isDisabled,
19
19
  hidePlaceholder,
20
20
  segmentRole: "spinbutton"
21
21
  });
22
22
  };
23
- var getStaticDateRangeSegments = ({ start, end, locale, shouldForceLeadingZeros, isDisabled, hidePlaceholder, disableManualEntry, placeholder, intl }) => {
23
+ var getStaticDateRangeSegments = ({ start, end, locale, shouldForceLeadingZeros, isDisabled, hidePlaceholder, disableManualEntry, placeholder }) => {
24
24
  if (disableManualEntry && placeholder && !start && !end) return getStaticDateTimePlaceholder(placeholder);
25
25
  const showSeparator = !hidePlaceholder;
26
26
  return /* @__PURE__ */ jsxs(Fragment, { children: [
27
- renderStaticDateTimeParts(DateTimeUtils.formatCalendarDatePartsLocalized(start, locale, { shouldForceLeadingZeros }, intl), {
27
+ renderStaticDateTimeParts(DateTimeUtils.formatCalendarDatePartsLocalized(start, locale, { shouldForceLeadingZeros }), {
28
28
  isDisabled,
29
29
  hidePlaceholder: hidePlaceholder && !start,
30
30
  segmentGroup: "start"
@@ -33,16 +33,16 @@ var getStaticDateRangeSegments = ({ start, end, locale, shouldForceLeadingZeros,
33
33
  className: isDisabled ? "pointer-events-none select-none text-interactive-text-secondary-disabled" : "pointer-events-none select-none",
34
34
  children: "–"
35
35
  }),
36
- renderStaticDateTimeParts(DateTimeUtils.formatCalendarDatePartsLocalized(end, locale, { shouldForceLeadingZeros }, intl), {
36
+ renderStaticDateTimeParts(DateTimeUtils.formatCalendarDatePartsLocalized(end, locale, { shouldForceLeadingZeros }), {
37
37
  isDisabled,
38
38
  hidePlaceholder: hidePlaceholder && !end,
39
39
  segmentGroup: "end"
40
40
  })
41
41
  ] });
42
42
  };
43
- var getStaticTimeSegments = ({ value, locale, shouldForceLeadingZeros, isDisabled, hidePlaceholder, disableManualEntry, placeholder, intl }) => {
43
+ var getStaticTimeSegments = ({ value, locale, shouldForceLeadingZeros, isDisabled, hidePlaceholder, disableManualEntry, placeholder }) => {
44
44
  if (disableManualEntry && placeholder && !value) return getStaticDateTimePlaceholder(placeholder);
45
- return renderStaticDateTimeParts(DateTimeUtils.formatTimePartsLocalized(value, locale, { shouldForceLeadingZeros }, intl), {
45
+ return renderStaticDateTimeParts(DateTimeUtils.formatTimePartsLocalized(value, locale, { shouldForceLeadingZeros }), {
46
46
  isDisabled,
47
47
  hidePlaceholder,
48
48
  timePickerOnly: true
@@ -2,6 +2,7 @@ import { UIOverrides } from "../../../../config/uiOverrides.context.js";
2
2
  import { UIConfig } from "../../../../config/uiConfig.context.js";
3
3
  import { FormField } from "../../FormField/FormField.js";
4
4
  import { inputBaseDefinition } from "../../shared/input.cva.js";
5
+ import { IntlUtils } from "../../../../utils/intl.utils.js";
5
6
  import { TooltipWrapper } from "../../shared/TooltipWrapper.js";
6
7
  import { InputFrame } from "../../Skeleton/InputFrame.js";
7
8
  import { useStaticInputHandoff } from "../../shared/useStaticInputHandoff.js";
@@ -338,7 +339,7 @@ var NumberInputInner = (t0) => {
338
339
  if (!renderInput) {
339
340
  const staticValue = props.value ?? props.defaultValue;
340
341
  const formatOptions = props.formatOptions ?? ui.numberInput.formatOptions;
341
- const displayValue = getStaticNumberDisplayValue(staticValue, ui.intl.getNumberFormatter(locale, formatOptions)) ?? "";
342
+ const displayValue = getStaticNumberDisplayValue(staticValue, IntlUtils.getNumberFormatter(locale, formatOptions)) ?? "";
342
343
  const hasValue = displayValue !== "";
343
344
  const as = props.as ?? ui.input.as;
344
345
  let isDisabled = !!props.isDisabled;
@@ -2,6 +2,7 @@ import { UIOverrides } from "../../../../config/uiOverrides.context.js";
2
2
  import { UIConfig } from "../../../../config/uiConfig.context.js";
3
3
  import { FormFieldLabel } from "../../FormField/FormFieldLabel.js";
4
4
  import { inputBaseDefinition, inputSizeDefinition } from "../../shared/input.cva.js";
5
+ import { IntlUtils } from "../../../../utils/intl.utils.js";
5
6
  import { InputClear } from "../../shared/InputClear.js";
6
7
  import { InputFrame } from "../../Skeleton/InputFrame.js";
7
8
  import { useStaticInputHandoff } from "../../shared/useStaticInputHandoff.js";
@@ -381,7 +382,7 @@ var NumberRangeInputInner = (t0) => {
381
382
  if (!renderInput) {
382
383
  const staticValue = normalizeRangeValue(props.value, props.minValue, props.maxValue);
383
384
  const formatOptions = props.formatOptions ?? ui.numberInput.formatOptions;
384
- const formatter = ui.intl.getNumberFormatter(locale, formatOptions);
385
+ const formatter = IntlUtils.getNumberFormatter(locale, formatOptions);
385
386
  const minDisplay = getStaticNumberDisplayValue(staticValue.min, formatter);
386
387
  const maxDisplay = getStaticNumberDisplayValue(staticValue.max, formatter);
387
388
  const hasValue = minDisplay !== null || maxDisplay !== null;
@@ -20,6 +20,8 @@ var LoadedQueryAutocompleteContent = ({ query, queryParams, queryOptions, queryM
20
20
  mapInitialToSelectItem: props.mapInitialToSelectItem
21
21
  });
22
22
  const shouldEnableInitialQuery = selectedIdsToResolve.count > 0;
23
+ const isInitialQueryDisabled = props.isInitialQueryDisabled ?? ui.queryAutocomplete?.isInitialQueryDisabled;
24
+ const shouldDisableInitialQuery = !isQueryEnabledInitially && !shouldEnableInitialQuery && (selectedIdsToResolve.isResolvedByInitialSelection || isInitialQueryDisabled);
23
25
  const { items, totalItems, isLoading, handleEnableQuery, hasNextPage, fetchNextPage } = useQueryAutocomplete({
24
26
  query,
25
27
  queryParams,
@@ -27,7 +29,7 @@ var LoadedQueryAutocompleteContent = ({ query, queryParams, queryOptions, queryM
27
29
  mapItems: (data) => getQueryItems(data, queryMap),
28
30
  resolveSelectedItemsWithIds: resolveSelectedItemsWithIds ?? ui.queryAutocomplete?.resolveSelectedItemsWithIds,
29
31
  search,
30
- initialQueryState: isQueryEnabledInitially || shouldEnableInitialQuery ? false : selectedIdsToResolve.isResolvedByInitialSelection || (props.isInitialQueryDisabled ?? ui.queryAutocomplete?.isInitialQueryDisabled),
32
+ initialQueryState: shouldDisableInitialQuery,
31
33
  selectedIdsToResolve: selectedIdsToResolve.items
32
34
  });
33
35
  const handleChange = (value_0) => {
@@ -22,6 +22,8 @@ var LoadedQuerySelectContent = (t0) => {
22
22
  mapInitialToSelectItem: props.mapInitialToSelectItem
23
23
  });
24
24
  const shouldEnableInitialQuery = selectedIdsToResolve.count > 0;
25
+ const isInitialQueryDisabled = props.isInitialQueryDisabled ?? ui.querySelect?.isInitialQueryDisabled;
26
+ const shouldDisableInitialQuery = !isQueryEnabledInitially && !shouldEnableInitialQuery && (selectedIdsToResolve.isResolvedByInitialSelection || isInitialQueryDisabled);
25
27
  let t2;
26
28
  if ($[0] !== queryMap) {
27
29
  t2 = (data) => getQueryItems(data, queryMap);
@@ -30,36 +32,35 @@ var LoadedQuerySelectContent = (t0) => {
30
32
  } else t2 = $[1];
31
33
  const t3 = resolveSelectedItemsWithIds ?? ui.querySelect?.resolveSelectedItemsWithIds;
32
34
  const t4 = isSearchable ? search : void 0;
33
- const t5 = isQueryEnabledInitially || shouldEnableInitialQuery ? false : selectedIdsToResolve.isResolvedByInitialSelection || (props.isInitialQueryDisabled ?? ui.querySelect?.isInitialQueryDisabled);
34
- let t6;
35
- if ($[2] !== query || $[3] !== queryOptions || $[4] !== queryParams || $[5] !== selectedIdsToResolve.items || $[6] !== t2 || $[7] !== t3 || $[8] !== t4 || $[9] !== t5) {
36
- t6 = {
35
+ let t5;
36
+ if ($[2] !== query || $[3] !== queryOptions || $[4] !== queryParams || $[5] !== selectedIdsToResolve.items || $[6] !== shouldDisableInitialQuery || $[7] !== t2 || $[8] !== t3 || $[9] !== t4) {
37
+ t5 = {
37
38
  query,
38
39
  queryParams,
39
40
  queryOptions,
40
41
  mapItems: t2,
41
42
  resolveSelectedItemsWithIds: t3,
42
43
  search: t4,
43
- initialQueryState: t5,
44
+ initialQueryState: shouldDisableInitialQuery,
44
45
  selectedIdsToResolve: selectedIdsToResolve.items
45
46
  };
46
47
  $[2] = query;
47
48
  $[3] = queryOptions;
48
49
  $[4] = queryParams;
49
50
  $[5] = selectedIdsToResolve.items;
50
- $[6] = t2;
51
- $[7] = t3;
52
- $[8] = t4;
53
- $[9] = t5;
54
- $[10] = t6;
55
- } else t6 = $[10];
56
- const { items, totalItems, isLoading, handleEnableQuery, hasNextPage, fetchNextPage } = useQueryAutocomplete(t6);
51
+ $[6] = shouldDisableInitialQuery;
52
+ $[7] = t2;
53
+ $[8] = t3;
54
+ $[9] = t4;
55
+ $[10] = t5;
56
+ } else t5 = $[10];
57
+ const { items, totalItems, isLoading, handleEnableQuery, hasNextPage, fetchNextPage } = useQueryAutocomplete(t5);
57
58
  let onSearchChange;
58
59
  let selectProps;
59
60
  if ($[11] !== props) {
60
- const { isInitialQueryDisabled: _, onSearchChange: t7, ...t8 } = props;
61
- onSearchChange = t7;
62
- selectProps = t8;
61
+ const { isInitialQueryDisabled: _, onSearchChange: t6, ...t7 } = props;
62
+ onSearchChange = t6;
63
+ selectProps = t7;
63
64
  $[11] = props;
64
65
  $[12] = onSearchChange;
65
66
  $[13] = selectProps;
@@ -67,9 +68,9 @@ var LoadedQuerySelectContent = (t0) => {
67
68
  onSearchChange = $[12];
68
69
  selectProps = $[13];
69
70
  }
70
- let t7;
71
+ let t6;
71
72
  if ($[14] !== handleEnableQuery || $[15] !== onSearchChange || $[16] !== setSearch) {
72
- t7 = (value_0) => {
73
+ t6 = (value_0) => {
73
74
  setSearch(value_0);
74
75
  handleEnableQuery();
75
76
  onSearchChange?.(value_0);
@@ -77,33 +78,33 @@ var LoadedQuerySelectContent = (t0) => {
77
78
  $[14] = handleEnableQuery;
78
79
  $[15] = onSearchChange;
79
80
  $[16] = setSearch;
80
- $[17] = t7;
81
- } else t7 = $[17];
82
- const handleSearchChange = t7;
83
- const t8 = props.searchDebounceDelay ?? ui.querySelect?.searchDebounceDelay;
84
- let t9;
81
+ $[17] = t6;
82
+ } else t6 = $[17];
83
+ const handleSearchChange = t6;
84
+ const t7 = props.searchDebounceDelay ?? ui.querySelect?.searchDebounceDelay;
85
+ let t8;
85
86
  if ($[18] !== handleSearchChange || $[19] !== isSearchable) {
86
- t9 = isSearchable && {
87
+ t8 = isSearchable && {
87
88
  isClientSearchDisabled: true,
88
89
  onSearchChange: handleSearchChange
89
90
  };
90
91
  $[18] = handleSearchChange;
91
92
  $[19] = isSearchable;
92
- $[20] = t9;
93
- } else t9 = $[20];
94
- let t10;
95
- if ($[21] !== fetchNextPage || $[22] !== handleEnableQuery || $[23] !== hasNextPage || $[24] !== isLoading || $[25] !== items || $[26] !== selectProps || $[27] !== t8 || $[28] !== t9 || $[29] !== totalItems) {
96
- t10 = /* @__PURE__ */ jsx(Select, {
93
+ $[20] = t8;
94
+ } else t8 = $[20];
95
+ let t9;
96
+ if ($[21] !== fetchNextPage || $[22] !== handleEnableQuery || $[23] !== hasNextPage || $[24] !== isLoading || $[25] !== items || $[26] !== selectProps || $[27] !== t7 || $[28] !== t8 || $[29] !== totalItems) {
97
+ t9 = /* @__PURE__ */ jsx(Select, {
97
98
  ...selectProps,
98
99
  items,
99
100
  isLoading,
100
101
  totalItems,
101
102
  hasLoadMore: hasNextPage,
102
103
  onLoadMore: fetchNextPage,
103
- searchDebounceDelay: t8,
104
+ searchDebounceDelay: t7,
104
105
  onMouseEnter: handleEnableQuery,
105
106
  onFocusCapture: handleEnableQuery,
106
- ...t9
107
+ ...t8
107
108
  });
108
109
  $[21] = fetchNextPage;
109
110
  $[22] = handleEnableQuery;
@@ -111,12 +112,12 @@ var LoadedQuerySelectContent = (t0) => {
111
112
  $[24] = isLoading;
112
113
  $[25] = items;
113
114
  $[26] = selectProps;
114
- $[27] = t8;
115
- $[28] = t9;
115
+ $[27] = t7;
116
+ $[28] = t8;
116
117
  $[29] = totalItems;
117
- $[30] = t10;
118
- } else t10 = $[30];
119
- return t10;
118
+ $[30] = t9;
119
+ } else t9 = $[30];
120
+ return t9;
120
121
  };
121
122
  var QuerySelectContent = (props) => {
122
123
  const $ = c(9);
@@ -16,7 +16,7 @@ import { useLabel, usePreventScroll } from "react-aria";
16
16
  import { mergeRefs } from "@react-aria/utils";
17
17
  //#region src/components/inputs/Selection/shared/SelectDesktop.tsx
18
18
  var SelectDesktop = (t0) => {
19
- const $ = c(129);
19
+ const $ = c(132);
20
20
  let containerClassName;
21
21
  let customTrigger;
22
22
  let error;
@@ -102,8 +102,9 @@ var SelectDesktop = (t0) => {
102
102
  } else t3 = $[27];
103
103
  const { labelProps, fieldProps } = useLabel(t3);
104
104
  const triggerRef = useRef(null);
105
- const closeComboBoxRef = useRef(null);
106
105
  const wrapperRef = useRef(null);
106
+ const [portalContainer, setPortalContainer] = useState(null);
107
+ const closeComboBoxRef = useRef(null);
107
108
  const [popoverWidth, setPopoverWidth] = useState(void 0);
108
109
  const { fieldState, isOpen, setIsOpen, onInputChange, onChange, onClear, onSelectAll, listItems, selectableListItems, selectedIds, isMultiple } = SelectContext.useSelect();
109
110
  const t4 = !isOpen;
@@ -116,8 +117,22 @@ var SelectDesktop = (t0) => {
116
117
  usePreventScroll(t5);
117
118
  let t6;
118
119
  let t7;
119
- if ($[30] !== isOpen) {
120
+ if ($[30] === Symbol.for("react.memo_cache_sentinel")) {
120
121
  t6 = () => {
122
+ setPortalContainer(wrapperRef.current?.closest("dialog, [role='dialog']") ?? null);
123
+ };
124
+ t7 = [];
125
+ $[30] = t6;
126
+ $[31] = t7;
127
+ } else {
128
+ t6 = $[30];
129
+ t7 = $[31];
130
+ }
131
+ useLayoutEffect(t6, t7);
132
+ let t8;
133
+ let t9;
134
+ if ($[32] !== isOpen) {
135
+ t8 = () => {
121
136
  if (!isOpen || !wrapperRef.current) return;
122
137
  setPopoverWidth(wrapperRef.current.getBoundingClientRect().width);
123
138
  const observer = new ResizeObserver((entries) => {
@@ -128,18 +143,18 @@ var SelectDesktop = (t0) => {
128
143
  observer.disconnect();
129
144
  };
130
145
  };
131
- t7 = [isOpen];
132
- $[30] = isOpen;
133
- $[31] = t6;
134
- $[32] = t7;
146
+ t9 = [isOpen];
147
+ $[32] = isOpen;
148
+ $[33] = t8;
149
+ $[34] = t9;
135
150
  } else {
136
- t6 = $[31];
137
- t7 = $[32];
151
+ t8 = $[33];
152
+ t9 = $[34];
138
153
  }
139
- useLayoutEffect(t6, t7);
140
- let t8;
141
- if ($[33] !== fieldState.value || $[34] !== isMultiple || $[35] !== onChange || $[36] !== onClear || $[37] !== onSelectAll || $[38] !== selectableListItems || $[39] !== selectedIds) {
142
- t8 = (value) => {
154
+ useLayoutEffect(t8, t9);
155
+ let t10;
156
+ if ($[35] !== fieldState.value || $[36] !== isMultiple || $[37] !== onChange || $[38] !== onClear || $[39] !== onSelectAll || $[40] !== selectableListItems || $[41] !== selectedIds) {
157
+ t10 = (value) => {
143
158
  if (!value) return;
144
159
  if (value === "all-item-id") {
145
160
  if (selectedIds.length === selectableListItems.length) onClear();
@@ -157,131 +172,131 @@ var SelectDesktop = (t0) => {
157
172
  if (fieldState.value.includes(value)) onChange(fieldState.value.filter((id) => id !== value));
158
173
  else onChange(fieldState.value.concat(value));
159
174
  };
160
- $[33] = fieldState.value;
161
- $[34] = isMultiple;
162
- $[35] = onChange;
163
- $[36] = onClear;
164
- $[37] = onSelectAll;
165
- $[38] = selectableListItems;
166
- $[39] = selectedIds;
167
- $[40] = t8;
168
- } else t8 = $[40];
169
- const onSelectionChange = t8;
170
- let t9;
171
- if ($[41] !== setIsOpen) {
172
- t9 = (value_0) => {
175
+ $[35] = fieldState.value;
176
+ $[36] = isMultiple;
177
+ $[37] = onChange;
178
+ $[38] = onClear;
179
+ $[39] = onSelectAll;
180
+ $[40] = selectableListItems;
181
+ $[41] = selectedIds;
182
+ $[42] = t10;
183
+ } else t10 = $[42];
184
+ const onSelectionChange = t10;
185
+ let t11;
186
+ if ($[43] !== setIsOpen) {
187
+ t11 = (value_0) => {
173
188
  if (closeComboBoxRef.current && value_0) {
174
189
  closeComboBoxRef.current.setOpen(false);
175
190
  closeComboBoxRef.current = null;
176
191
  } else setIsOpen(value_0);
177
192
  };
178
- $[41] = setIsOpen;
179
- $[42] = t9;
180
- } else t9 = $[42];
181
- const openChangeHandler = t9;
193
+ $[43] = setIsOpen;
194
+ $[44] = t11;
195
+ } else t11 = $[44];
196
+ const openChangeHandler = t11;
182
197
  const WrapperComponent = isSearchable ? ComboBox : Fragment$1;
183
- const t10 = isMultiple ? null : fieldState.value;
184
- const t11 = fieldState.inputValue;
185
- const t12 = !!error;
186
- let t13;
187
- if ($[43] !== containerClassName) {
188
- t13 = clsx("group w-full", containerClassName);
189
- $[43] = containerClassName;
190
- $[44] = t13;
191
- } else t13 = $[44];
192
- let t14;
193
- if ($[45] !== fieldState.inputValue || $[46] !== isDisabled || $[47] !== listItems || $[48] !== onInputChange || $[49] !== onSelectionChange || $[50] !== openChangeHandler || $[51] !== t10 || $[52] !== t12 || $[53] !== t13) {
194
- t14 = {
198
+ const t12 = isMultiple ? null : fieldState.value;
199
+ const t13 = fieldState.inputValue;
200
+ const t14 = !!error;
201
+ let t15;
202
+ if ($[45] !== containerClassName) {
203
+ t15 = clsx("group w-full", containerClassName);
204
+ $[45] = containerClassName;
205
+ $[46] = t15;
206
+ } else t15 = $[46];
207
+ let t16;
208
+ if ($[47] !== fieldState.inputValue || $[48] !== isDisabled || $[49] !== listItems || $[50] !== onInputChange || $[51] !== onSelectionChange || $[52] !== openChangeHandler || $[53] !== t12 || $[54] !== t14 || $[55] !== t15) {
209
+ t16 = {
195
210
  items: listItems,
196
- selectedKey: t10,
211
+ selectedKey: t12,
197
212
  onSelectionChange,
198
- inputValue: t11,
213
+ inputValue: t13,
199
214
  onInputChange,
200
215
  onOpenChange: openChangeHandler,
201
216
  allowsEmptyCollection: true,
202
217
  isDisabled,
203
- isInvalid: t12,
218
+ isInvalid: t14,
204
219
  menuTrigger: "focus",
205
- className: t13
220
+ className: t15
206
221
  };
207
- $[45] = fieldState.inputValue;
208
- $[46] = isDisabled;
209
- $[47] = listItems;
210
- $[48] = onInputChange;
211
- $[49] = onSelectionChange;
212
- $[50] = openChangeHandler;
213
- $[51] = t10;
214
- $[52] = t12;
215
- $[53] = t13;
222
+ $[47] = fieldState.inputValue;
223
+ $[48] = isDisabled;
224
+ $[49] = listItems;
225
+ $[50] = onInputChange;
226
+ $[51] = onSelectionChange;
227
+ $[52] = openChangeHandler;
228
+ $[53] = t12;
216
229
  $[54] = t14;
217
- } else t14 = $[54];
218
- const comboBoxProps = t14;
219
- const t15 = hideLabel || isHeaderHidden;
220
- let t16;
221
- if ($[55] !== headerClassName || $[56] !== helperText || $[57] !== isDisabled || $[58] !== isRequired || $[59] !== label || $[60] !== labelProps || $[61] !== rightContent || $[62] !== t15 || $[63] !== tooltipText) {
222
- t16 = {
230
+ $[55] = t15;
231
+ $[56] = t16;
232
+ } else t16 = $[56];
233
+ const comboBoxProps = t16;
234
+ const t17 = hideLabel || isHeaderHidden;
235
+ let t18;
236
+ if ($[57] !== headerClassName || $[58] !== helperText || $[59] !== isDisabled || $[60] !== isRequired || $[61] !== label || $[62] !== labelProps || $[63] !== rightContent || $[64] !== t17 || $[65] !== tooltipText) {
237
+ t18 = {
223
238
  label,
224
239
  tooltipText,
225
240
  helperText,
226
241
  isRequired,
227
242
  rightContent,
228
- isHeaderHidden: t15,
243
+ isHeaderHidden: t17,
229
244
  isDisabled,
230
245
  className: headerClassName,
231
246
  labelProps
232
247
  };
233
- $[55] = headerClassName;
234
- $[56] = helperText;
235
- $[57] = isDisabled;
236
- $[58] = isRequired;
237
- $[59] = label;
238
- $[60] = labelProps;
239
- $[61] = rightContent;
240
- $[62] = t15;
241
- $[63] = tooltipText;
242
- $[64] = t16;
243
- } else t16 = $[64];
244
- const headerProps = t16;
245
- let t17;
246
- if ($[65] !== isOpen || $[66] !== setIsOpen) {
247
- t17 = {
248
+ $[57] = headerClassName;
249
+ $[58] = helperText;
250
+ $[59] = isDisabled;
251
+ $[60] = isRequired;
252
+ $[61] = label;
253
+ $[62] = labelProps;
254
+ $[63] = rightContent;
255
+ $[64] = t17;
256
+ $[65] = tooltipText;
257
+ $[66] = t18;
258
+ } else t18 = $[66];
259
+ const headerProps = t18;
260
+ let t19;
261
+ if ($[67] !== isOpen || $[68] !== setIsOpen) {
262
+ t19 = {
248
263
  isOpen,
249
264
  onOpenChange: setIsOpen
250
265
  };
251
- $[65] = isOpen;
252
- $[66] = setIsOpen;
253
- $[67] = t17;
254
- } else t17 = $[67];
255
- const dialogTriggerProps = t17;
256
- let t18;
257
- if ($[68] !== isLoading || $[69] !== listItems) {
258
- t18 = listItems.filter(_temp).length > 0 || isLoading;
259
- $[68] = isLoading;
260
- $[69] = listItems;
261
- $[70] = t18;
262
- } else t18 = $[70];
263
- const showPopover = t18;
264
- let t19;
265
- if ($[71] !== comboBoxProps || $[72] !== isSearchable) {
266
- t19 = isSearchable ? comboBoxProps : {};
267
- $[71] = comboBoxProps;
268
- $[72] = isSearchable;
269
- $[73] = t19;
270
- } else t19 = $[73];
266
+ $[67] = isOpen;
267
+ $[68] = setIsOpen;
268
+ $[69] = t19;
269
+ } else t19 = $[69];
270
+ const dialogTriggerProps = t19;
271
271
  let t20;
272
- if ($[74] !== containerClassName || $[75] !== isSearchable || $[76] !== labelProps) {
273
- t20 = !isSearchable && {
272
+ if ($[70] !== isLoading || $[71] !== listItems) {
273
+ t20 = listItems.filter(_temp).length > 0 || isLoading;
274
+ $[70] = isLoading;
275
+ $[71] = listItems;
276
+ $[72] = t20;
277
+ } else t20 = $[72];
278
+ const showPopover = t20;
279
+ let t21;
280
+ if ($[73] !== comboBoxProps || $[74] !== isSearchable) {
281
+ t21 = isSearchable ? comboBoxProps : {};
282
+ $[73] = comboBoxProps;
283
+ $[74] = isSearchable;
284
+ $[75] = t21;
285
+ } else t21 = $[75];
286
+ let t22;
287
+ if ($[76] !== containerClassName || $[77] !== isSearchable || $[78] !== labelProps) {
288
+ t22 = !isSearchable && {
274
289
  labelProps,
275
290
  className: clsx("group w-full", containerClassName)
276
291
  };
277
- $[74] = containerClassName;
278
- $[75] = isSearchable;
279
- $[76] = labelProps;
280
- $[77] = t20;
281
- } else t20 = $[77];
282
- let t21;
283
- if ($[78] !== as || $[79] !== className || $[80] !== collapseAfter || $[81] !== customTrigger || $[82] !== dialogTriggerProps || $[83] !== error || $[84] !== fieldProps || $[85] !== headerProps || $[86] !== hideDropdownIcon || $[87] !== inputClassName || $[88] !== isClearable || $[89] !== isDirty || $[90] !== isDisabled || $[91] !== isRequired || $[92] !== isSearchable || $[93] !== leadingContent || $[94] !== onBlur || $[95] !== placeholder || $[96] !== ref || $[97] !== selectedTagsType || $[98] !== showSelectionContent || $[99] !== size || $[100] !== trailingContent || $[101] !== variant) {
284
- t21 = customTrigger ? /* @__PURE__ */ jsx(DialogTrigger, {
292
+ $[76] = containerClassName;
293
+ $[77] = isSearchable;
294
+ $[78] = labelProps;
295
+ $[79] = t22;
296
+ } else t22 = $[79];
297
+ let t23;
298
+ if ($[80] !== as || $[81] !== className || $[82] !== collapseAfter || $[83] !== customTrigger || $[84] !== dialogTriggerProps || $[85] !== error || $[86] !== fieldProps || $[87] !== headerProps || $[88] !== hideDropdownIcon || $[89] !== inputClassName || $[90] !== isClearable || $[91] !== isDirty || $[92] !== isDisabled || $[93] !== isRequired || $[94] !== isSearchable || $[95] !== leadingContent || $[96] !== onBlur || $[97] !== placeholder || $[98] !== ref || $[99] !== selectedTagsType || $[100] !== showSelectionContent || $[101] !== size || $[102] !== trailingContent || $[103] !== variant) {
299
+ t23 = customTrigger ? /* @__PURE__ */ jsx(DialogTrigger, {
285
300
  ...dialogTriggerProps,
286
301
  children: /* @__PURE__ */ jsx("div", {
287
302
  ...fieldProps,
@@ -315,35 +330,36 @@ var SelectDesktop = (t0) => {
315
330
  fieldProps,
316
331
  headerProps
317
332
  });
318
- $[78] = as;
319
- $[79] = className;
320
- $[80] = collapseAfter;
321
- $[81] = customTrigger;
322
- $[82] = dialogTriggerProps;
323
- $[83] = error;
324
- $[84] = fieldProps;
325
- $[85] = headerProps;
326
- $[86] = hideDropdownIcon;
327
- $[87] = inputClassName;
328
- $[88] = isClearable;
329
- $[89] = isDirty;
330
- $[90] = isDisabled;
331
- $[91] = isRequired;
332
- $[92] = isSearchable;
333
- $[93] = leadingContent;
334
- $[94] = onBlur;
335
- $[95] = placeholder;
336
- $[96] = ref;
337
- $[97] = selectedTagsType;
338
- $[98] = showSelectionContent;
339
- $[99] = size;
340
- $[100] = trailingContent;
341
- $[101] = variant;
342
- $[102] = t21;
343
- } else t21 = $[102];
344
- let t22;
345
- if ($[103] !== ignoreTriggerWidth || $[104] !== isOpen || $[105] !== isSearchable || $[106] !== popoverCva || $[107] !== popoverWidth || $[108] !== props || $[109] !== selectPopoverCva || $[110] !== setIsOpen || $[111] !== showPopover) {
346
- t22 = (!isSearchable || showPopover) && /* @__PURE__ */ jsx(Popover, {
333
+ $[80] = as;
334
+ $[81] = className;
335
+ $[82] = collapseAfter;
336
+ $[83] = customTrigger;
337
+ $[84] = dialogTriggerProps;
338
+ $[85] = error;
339
+ $[86] = fieldProps;
340
+ $[87] = headerProps;
341
+ $[88] = hideDropdownIcon;
342
+ $[89] = inputClassName;
343
+ $[90] = isClearable;
344
+ $[91] = isDirty;
345
+ $[92] = isDisabled;
346
+ $[93] = isRequired;
347
+ $[94] = isSearchable;
348
+ $[95] = leadingContent;
349
+ $[96] = onBlur;
350
+ $[97] = placeholder;
351
+ $[98] = ref;
352
+ $[99] = selectedTagsType;
353
+ $[100] = showSelectionContent;
354
+ $[101] = size;
355
+ $[102] = trailingContent;
356
+ $[103] = variant;
357
+ $[104] = t23;
358
+ } else t23 = $[104];
359
+ let t24;
360
+ if ($[105] !== ignoreTriggerWidth || $[106] !== isOpen || $[107] !== isSearchable || $[108] !== popoverCva || $[109] !== popoverWidth || $[110] !== portalContainer || $[111] !== props || $[112] !== selectPopoverCva || $[113] !== setIsOpen || $[114] !== showPopover) {
361
+ t24 = (!isSearchable || showPopover) && /* @__PURE__ */ jsx(Popover, {
362
+ UNSTABLE_portalContainer: portalContainer ?? void 0,
347
363
  triggerRef,
348
364
  isOpen,
349
365
  onOpenChange: setIsOpen,
@@ -356,61 +372,62 @@ var SelectDesktop = (t0) => {
356
372
  autoFocus: !isSearchable
357
373
  })
358
374
  });
359
- $[103] = ignoreTriggerWidth;
360
- $[104] = isOpen;
361
- $[105] = isSearchable;
362
- $[106] = popoverCva;
363
- $[107] = popoverWidth;
364
- $[108] = props;
365
- $[109] = selectPopoverCva;
366
- $[110] = setIsOpen;
367
- $[111] = showPopover;
368
- $[112] = t22;
369
- } else t22 = $[112];
370
- let t23;
371
- if ($[113] !== as || $[114] !== formFieldProps || $[115] !== onFocusCapture || $[116] !== onMouseEnter || $[117] !== t20 || $[118] !== t21 || $[119] !== t22) {
372
- t23 = /* @__PURE__ */ jsxs(FormField, {
375
+ $[105] = ignoreTriggerWidth;
376
+ $[106] = isOpen;
377
+ $[107] = isSearchable;
378
+ $[108] = popoverCva;
379
+ $[109] = popoverWidth;
380
+ $[110] = portalContainer;
381
+ $[111] = props;
382
+ $[112] = selectPopoverCva;
383
+ $[113] = setIsOpen;
384
+ $[114] = showPopover;
385
+ $[115] = t24;
386
+ } else t24 = $[115];
387
+ let t25;
388
+ if ($[116] !== as || $[117] !== formFieldProps || $[118] !== onFocusCapture || $[119] !== onMouseEnter || $[120] !== t22 || $[121] !== t23 || $[122] !== t24) {
389
+ t25 = /* @__PURE__ */ jsxs(FormField, {
373
390
  ...formFieldProps,
374
- ...t20,
391
+ ...t22,
375
392
  as,
376
393
  onMouseEnter,
377
394
  onFocusCapture,
378
395
  ref: wrapperRef,
379
- children: [t21, t22]
396
+ children: [t23, t24]
380
397
  });
381
- $[113] = as;
382
- $[114] = formFieldProps;
383
- $[115] = onFocusCapture;
384
- $[116] = onMouseEnter;
385
- $[117] = t20;
386
- $[118] = t21;
387
- $[119] = t22;
388
- $[120] = t23;
389
- } else t23 = $[120];
390
- let t24;
391
- if ($[121] !== WrapperComponent || $[122] !== t19 || $[123] !== t23) {
392
- t24 = /* @__PURE__ */ jsx(WrapperComponent, {
393
- ...t19,
394
- children: t23
398
+ $[116] = as;
399
+ $[117] = formFieldProps;
400
+ $[118] = onFocusCapture;
401
+ $[119] = onMouseEnter;
402
+ $[120] = t22;
403
+ $[121] = t23;
404
+ $[122] = t24;
405
+ $[123] = t25;
406
+ } else t25 = $[123];
407
+ let t26;
408
+ if ($[124] !== WrapperComponent || $[125] !== t21 || $[126] !== t25) {
409
+ t26 = /* @__PURE__ */ jsx(WrapperComponent, {
410
+ ...t21,
411
+ children: t25
395
412
  });
396
- $[121] = WrapperComponent;
397
- $[122] = t19;
398
- $[123] = t23;
399
- $[124] = t24;
400
- } else t24 = $[124];
401
- let t25;
402
- if ($[125] !== as || $[126] !== error || $[127] !== t24) {
403
- t25 = /* @__PURE__ */ jsx(TooltipWrapper, {
413
+ $[124] = WrapperComponent;
414
+ $[125] = t21;
415
+ $[126] = t25;
416
+ $[127] = t26;
417
+ } else t26 = $[127];
418
+ let t27;
419
+ if ($[128] !== as || $[129] !== error || $[130] !== t26) {
420
+ t27 = /* @__PURE__ */ jsx(TooltipWrapper, {
404
421
  as,
405
422
  error,
406
- children: t24
423
+ children: t26
407
424
  });
408
- $[125] = as;
409
- $[126] = error;
410
- $[127] = t24;
411
- $[128] = t25;
412
- } else t25 = $[128];
413
- return t25;
425
+ $[128] = as;
426
+ $[129] = error;
427
+ $[130] = t26;
428
+ $[131] = t27;
429
+ } else t27 = $[131];
430
+ return t27;
414
431
  };
415
432
  function _temp(item) {
416
433
  return !item.isSelectAllItem;
@@ -15,13 +15,11 @@ import { ToastPosition } from 'react-toastify';
15
15
  import { CellTextProps } from '../components/table/CellText';
16
16
  import { HeaderTextProps } from '../components/table/HeaderText';
17
17
  import { TagProps } from '../components/text/Tag/Tag';
18
- import { IntlFormatters } from '../utils/intl.utils';
19
18
  export declare namespace UIConfig {
20
19
  type DeepRequired<T> = {
21
- [P in keyof T]-?: T[P] extends (...args: never[]) => unknown ? Exclude<T[P], null | undefined> : T[P] extends object ? DeepRequired<T[P]> : Exclude<T[P], null | undefined>;
20
+ [P in keyof T]-?: T[P] extends object ? DeepRequired<T[P]> : Exclude<T[P], null | undefined>;
22
21
  };
23
22
  export interface Options {
24
- intl: IntlFormatters;
25
23
  renderStaticInput: boolean;
26
24
  input: Pick<TextInputProps, "variant" | "isClearable" | "hideLabel" | "as" | "size"> & {
27
25
  alwaysShowClear?: boolean;
@@ -3,7 +3,6 @@ import { ClockIcon } from "../assets/icons/Clock.js";
3
3
  import { DateTimeIcon } from "../assets/icons/DateTime.js";
4
4
  import { ObjectUtils } from "../utils/object.utils.js";
5
5
  import { useDeepCompareMemo } from "../hooks/useDeepCompare.js";
6
- import { IntlUtils } from "../utils/intl.utils.js";
7
6
  import { c } from "react/compiler-runtime";
8
7
  import { jsx } from "react/jsx-runtime";
9
8
  import { createContext, use } from "react";
@@ -11,7 +10,6 @@ import { createContext, use } from "react";
11
10
  var UIConfig;
12
11
  (function(_UIConfig) {
13
12
  const DEFAULT_CONFIG = {
14
- intl: IntlUtils,
15
13
  renderStaticInput: true,
16
14
  input: {
17
15
  variant: "outlined",
package/dist/index.d.ts CHANGED
@@ -183,7 +183,6 @@ export { UIRouter } from './config/router.context';
183
183
  export { ThemeContext } from './config/theme.context';
184
184
  export { UIConfig } from './config/uiConfig.context';
185
185
  export { UIOverrides } from './config/uiOverrides.context';
186
- export type { IntlFormatters } from './utils/intl.utils';
187
186
  export { breadcrumbChevronDefinition, breadcrumbIconDefinition, breadcrumbItemDefinition, breadcrumbsDefinition, breadcrumbSegmentDefinition, } from './components/Breadcrumbs/breadcrumbs.cva';
188
187
  export { buttonContentDefinition, buttonDefinition, buttonIconSizeDefinition, buttonSizeDefinition, } from './components/buttons/Button/button.cva';
189
188
  export { pillButtonContentDefinition, pillButtonDefinition } from './components/buttons/PillButton/pillButton.cva';
package/dist/index.js CHANGED
@@ -53,7 +53,6 @@ import { Loader } from "./components/status/Loader/Loader.js";
53
53
  import { ObjectUtils } from "./utils/object.utils.js";
54
54
  import { isEqual } from "./utils/isEqual.js";
55
55
  import { useDeepCompareEffect, useDeepCompareLayoutEffect, useDeepCompareMemo } from "./hooks/useDeepCompare.js";
56
- import { IntlUtils } from "./utils/intl.utils.js";
57
56
  import { UIConfig } from "./config/uiConfig.context.js";
58
57
  import { uiOutlineClass } from "./components/outline.clsx.js";
59
58
  import { compoundMapper } from "./utils/compoundMapper.js";
@@ -83,6 +82,7 @@ import { inputBaseDefinition, inputClearClassDefinition, inputContentWrapperDefi
83
82
  import { CheckboxGroup } from "./components/inputs/Checkbox/CheckboxGroup.js";
84
83
  import { useLongPressRepeat } from "./hooks/useLongPressRepeat.js";
85
84
  import { useScrollableListBox } from "./hooks/useScrollableListBox.js";
85
+ import { IntlUtils } from "./utils/intl.utils.js";
86
86
  import { DateTimeUtils } from "./utils/date-time.utils.js";
87
87
  import { datePickerInputContentRowDefinition } from "./components/inputs/DateTime/shared/datePickerInput.cva.js";
88
88
  import { popoverDefinition } from "./components/shared/popover.cva.js";
@@ -1,5 +1,4 @@
1
1
  import { CalendarDate, CalendarDateTime, DateValue, ZonedDateTime } from '@internationalized/date';
2
- import { IntlFormatters } from './intl.utils';
3
2
  export declare namespace DateTimeUtils {
4
3
  interface LocalizedDateFormatOptions {
5
4
  shouldForceLeadingZeros?: boolean;
@@ -10,22 +9,22 @@ export declare namespace DateTimeUtils {
10
9
  placeholder: string;
11
10
  isPlaceholder: boolean;
12
11
  }
13
- export function getDatePlaceholder(locale?: string, options?: LocalizedDateFormatOptions, intl?: IntlFormatters): string;
14
- export function getTimePlaceholder(locale?: string, intl?: IntlFormatters): string;
12
+ export function getDatePlaceholder(locale?: string, options?: LocalizedDateFormatOptions): string;
13
+ export function getTimePlaceholder(locale?: string): string;
15
14
  export function getDateTimePlaceholder(locale?: string, options?: LocalizedDateFormatOptions): string;
16
15
  export function getDateRangePlaceholder(locale?: string, options?: LocalizedDateFormatOptions): string;
17
- export function formatCalendarDateLocalized(calendarDate: CalendarDate, locale?: string, options?: LocalizedDateFormatOptions, intl?: IntlFormatters): string;
18
- export function formatCalendarDatePartsLocalized(calendarDate?: CalendarDate | null, locale?: string, options?: LocalizedDateFormatOptions, intl?: IntlFormatters): LocalizedDatePart[];
19
- export function formatCalendarDateTimePartsLocalized(calendarDateTime?: Pick<CalendarDateTime, "day" | "month" | "year" | "hour" | "minute"> | null, locale?: string, options?: LocalizedDateFormatOptions, intl?: IntlFormatters): LocalizedDatePart[];
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[];
20
19
  export function formatTimeLocalized(timeValue: {
21
20
  hour: number;
22
21
  minute: number;
23
- }, locale?: string, options?: LocalizedDateFormatOptions, intl?: IntlFormatters): string;
22
+ }, locale?: string, options?: LocalizedDateFormatOptions): string;
24
23
  export function formatTimePartsLocalized(timeValue?: {
25
24
  hour: number;
26
25
  minute: number;
27
- } | null, locale?: string, options?: LocalizedDateFormatOptions, intl?: IntlFormatters): LocalizedDatePart[];
28
- export function formatCalendarDateTimeLocalized(calendarDateTime: Pick<CalendarDateTime, "day" | "month" | "year" | "hour" | "minute">, locale?: string, options?: LocalizedDateFormatOptions, intl?: IntlFormatters): string;
26
+ } | null, locale?: string, options?: LocalizedDateFormatOptions): LocalizedDatePart[];
27
+ export function formatCalendarDateTimeLocalized(calendarDateTime: Pick<CalendarDateTime, "day" | "month" | "year" | "hour" | "minute">, locale?: string, options?: LocalizedDateFormatOptions): string;
29
28
  export function fromISOtoZonedDateTime(isoString: string, timeZone?: string): ZonedDateTime;
30
29
  export function fromDateValueToISO(dateValue: DateValue, timeZone?: string): string;
31
30
  export function fromDateValueFieldsToUTCISO(dateValue: DateValue): string;
@@ -9,32 +9,27 @@ var DateTimeUtils;
9
9
  const timeFormatters = /* @__PURE__ */ new Map();
10
10
  const getDayMonthFormat = (shouldForceLeadingZeros = false) => shouldForceLeadingZeros ? "2-digit" : "numeric";
11
11
  const getTimeHourFormat = (shouldForceLeadingZeros = false) => shouldForceLeadingZeros ? "2-digit" : "numeric";
12
- const getDatePlaceholderFormatter = (locale, options, intl = IntlUtils) => intl.getDateTimeFormatter(locale, {
12
+ const getDatePlaceholderFormatter = (locale, options) => IntlUtils.getDateTimeFormatter(locale, {
13
13
  day: getDayMonthFormat(options?.shouldForceLeadingZeros),
14
14
  month: getDayMonthFormat(options?.shouldForceLeadingZeros),
15
15
  year: "numeric"
16
16
  });
17
- const getTimePlaceholderFormatter = (locale, intl = IntlUtils) => intl.getDateTimeFormatter(locale, {
17
+ const getTimePlaceholderFormatter = (locale) => IntlUtils.getDateTimeFormatter(locale, {
18
18
  hour: "2-digit",
19
19
  minute: "2-digit"
20
20
  });
21
- const getResolvedLocale = (locale, intl = IntlUtils) => {
21
+ const getResolvedLocale = (locale) => {
22
22
  if (locale) return locale;
23
- return intl.getDateTimeFormatter().resolvedOptions().locale;
23
+ return IntlUtils.getDateTimeFormatter().resolvedOptions().locale;
24
24
  };
25
- const getDateFormatter = (locale, options, intl = IntlUtils) => intl.getDateTimeFormatter(getResolvedLocale(locale, intl), {
25
+ const getDateFormatter = (locale, options) => IntlUtils.getDateTimeFormatter(getResolvedLocale(locale), {
26
26
  day: getDayMonthFormat(options?.shouldForceLeadingZeros),
27
27
  month: getDayMonthFormat(options?.shouldForceLeadingZeros),
28
28
  year: "numeric",
29
29
  timeZone: "UTC"
30
30
  });
31
- const getTimeFormatter = (locale, options, intl = IntlUtils) => {
32
- const resolvedLocale = getResolvedLocale(locale, intl);
33
- if (intl !== IntlUtils) return intl.getDateTimeFormatter(resolvedLocale, {
34
- hour: getTimeHourFormat(options?.shouldForceLeadingZeros),
35
- minute: "2-digit",
36
- timeZone: "UTC"
37
- });
31
+ const getTimeFormatter = (locale, options) => {
32
+ const resolvedLocale = getResolvedLocale(locale);
38
33
  const key = `${resolvedLocale}|${options?.shouldForceLeadingZeros ?? false}`;
39
34
  const cachedFormatter = timeFormatters.get(key);
40
35
  if (cachedFormatter) return cachedFormatter;
@@ -46,7 +41,7 @@ var DateTimeUtils;
46
41
  timeFormatters.set(key, formatter);
47
42
  return formatter;
48
43
  };
49
- const getDateTimeFormatter = (locale, options, intl = IntlUtils) => intl.getDateTimeFormatter(getResolvedLocale(locale, intl), {
44
+ const getDateTimeFormatter = (locale, options) => IntlUtils.getDateTimeFormatter(getResolvedLocale(locale), {
50
45
  day: getDayMonthFormat(options?.shouldForceLeadingZeros),
51
46
  month: getDayMonthFormat(options?.shouldForceLeadingZeros),
52
47
  year: "numeric",
@@ -54,47 +49,46 @@ var DateTimeUtils;
54
49
  minute: "2-digit",
55
50
  timeZone: "UTC"
56
51
  });
57
- const repeatLocalizedFieldLabel = (type, length, locale, intl = IntlUtils) => {
58
- const resolvedLocale = getResolvedLocale(locale, intl);
59
- const placeholderChar = intl.getDisplayNamesFormatter(resolvedLocale, { type: "dateTimeField" }).of(type)?.trim().charAt(0).toLocaleLowerCase(resolvedLocale);
52
+ const repeatLocalizedFieldLabel = (type, length, locale) => {
53
+ const placeholderChar = IntlUtils.getDisplayNamesFormatter(getResolvedLocale(locale), { type: "dateTimeField" }).of(type)?.trim().charAt(0).toLocaleLowerCase(getResolvedLocale(locale));
60
54
  if (!placeholderChar) return null;
61
55
  return placeholderChar.repeat(length);
62
56
  };
63
- const mapTypeToPlaceholder = (type, locale, intl = IntlUtils) => {
57
+ const mapTypeToPlaceholder = (type, locale) => {
64
58
  switch (type) {
65
- case "day": return repeatLocalizedFieldLabel(type, 2, locale, intl);
66
- case "month": return repeatLocalizedFieldLabel(type, 2, locale, intl);
67
- case "year": return repeatLocalizedFieldLabel(type, 4, locale, intl);
59
+ case "day": return repeatLocalizedFieldLabel(type, 2, locale);
60
+ case "month": return repeatLocalizedFieldLabel(type, 2, locale);
61
+ case "year": return repeatLocalizedFieldLabel(type, 4, locale);
68
62
  case "hour": return "hh";
69
63
  case "minute": return "mm";
70
64
  default: return null;
71
65
  }
72
66
  };
73
- const formatPlaceholder = (formatter, sampleDate, intl = IntlUtils) => {
74
- return formatter.formatToParts(sampleDate).map((part) => mapTypeToPlaceholder(part.type, formatter.resolvedOptions().locale, intl) ?? part.value).join("");
67
+ const formatPlaceholder = (formatter, sampleDate) => {
68
+ return formatter.formatToParts(sampleDate).map((part) => mapTypeToPlaceholder(part.type, formatter.resolvedOptions().locale) ?? part.value).join("");
75
69
  };
76
70
  const removeDateSeparatorSpacing = (value) => value.replace(/([./-])\s+(?=[\p{Letter}\p{Number}])/gu, "$1");
77
71
  const formatLocalizedDateParts = (formatter, date) => {
78
72
  return removeDateSeparatorSpacing(formatter.format(date));
79
73
  };
80
- const formatLocalizedDatePartList = (formatter, date, isPlaceholder, intl = IntlUtils) => {
74
+ const formatLocalizedDatePartList = (formatter, date, isPlaceholder) => {
81
75
  const locale = formatter.resolvedOptions().locale;
82
76
  return formatter.formatToParts(date).map((part) => {
83
77
  const value = part.type === "literal" ? part.value.replace(/([./-])\s+/gu, "$1") : part.value.replace(/\s+/gu, "");
84
78
  return {
85
79
  type: part.type,
86
80
  value,
87
- placeholder: mapTypeToPlaceholder(part.type, locale, intl) ?? value,
81
+ placeholder: mapTypeToPlaceholder(part.type, locale) ?? value,
88
82
  isPlaceholder
89
83
  };
90
84
  });
91
85
  };
92
- function getDatePlaceholder(locale, options, intl = IntlUtils) {
93
- return removeDateSeparatorSpacing(formatPlaceholder(getDatePlaceholderFormatter(locale, options, intl), DATE_SAMPLE_DATE_UTC, intl));
86
+ function getDatePlaceholder(locale, options) {
87
+ return removeDateSeparatorSpacing(formatPlaceholder(getDatePlaceholderFormatter(locale, options), DATE_SAMPLE_DATE_UTC));
94
88
  }
95
89
  _DateTimeUtils.getDatePlaceholder = getDatePlaceholder;
96
- function getTimePlaceholder(locale, intl = IntlUtils) {
97
- return formatPlaceholder(getTimePlaceholderFormatter(locale, intl), TIME_SAMPLE_DATE_UTC, intl);
90
+ function getTimePlaceholder(locale) {
91
+ return formatPlaceholder(getTimePlaceholderFormatter(locale), TIME_SAMPLE_DATE_UTC);
98
92
  }
99
93
  _DateTimeUtils.getTimePlaceholder = getTimePlaceholder;
100
94
  function getDateTimePlaceholder(locale, options) {
@@ -106,32 +100,32 @@ var DateTimeUtils;
106
100
  return `${datePlaceholder} – ${datePlaceholder}`;
107
101
  }
108
102
  _DateTimeUtils.getDateRangePlaceholder = getDateRangePlaceholder;
109
- function formatCalendarDateLocalized(calendarDate, locale, options, intl = IntlUtils) {
110
- return formatLocalizedDateParts(getDateFormatter(locale, options, intl), calendarDate.toDate("UTC"));
103
+ function formatCalendarDateLocalized(calendarDate, locale, options) {
104
+ return formatLocalizedDateParts(getDateFormatter(locale, options), calendarDate.toDate("UTC"));
111
105
  }
112
106
  _DateTimeUtils.formatCalendarDateLocalized = formatCalendarDateLocalized;
113
- function formatCalendarDatePartsLocalized(calendarDate, locale, options, intl = IntlUtils) {
114
- return formatLocalizedDatePartList(getDateFormatter(locale, options, intl), calendarDate?.toDate("UTC") ?? DATE_SAMPLE_DATE_UTC, !calendarDate, intl);
107
+ function formatCalendarDatePartsLocalized(calendarDate, locale, options) {
108
+ return formatLocalizedDatePartList(getDateFormatter(locale, options), calendarDate?.toDate("UTC") ?? DATE_SAMPLE_DATE_UTC, !calendarDate);
115
109
  }
116
110
  _DateTimeUtils.formatCalendarDatePartsLocalized = formatCalendarDatePartsLocalized;
117
- function formatCalendarDateTimePartsLocalized(calendarDateTime, locale, options, intl = IntlUtils) {
111
+ function formatCalendarDateTimePartsLocalized(calendarDateTime, locale, options) {
118
112
  const normalizedValue = calendarDateTime ? new CalendarDateTime(calendarDateTime.year, calendarDateTime.month, calendarDateTime.day, calendarDateTime.hour, calendarDateTime.minute) : null;
119
- return formatLocalizedDatePartList(getDateTimeFormatter(locale, options, intl), normalizedValue?.toDate("UTC") ?? TIME_SAMPLE_DATE_UTC, !calendarDateTime, intl);
113
+ return formatLocalizedDatePartList(getDateTimeFormatter(locale, options), normalizedValue?.toDate("UTC") ?? TIME_SAMPLE_DATE_UTC, !calendarDateTime);
120
114
  }
121
115
  _DateTimeUtils.formatCalendarDateTimePartsLocalized = formatCalendarDateTimePartsLocalized;
122
- function formatTimeLocalized(timeValue, locale, options, intl = IntlUtils) {
116
+ function formatTimeLocalized(timeValue, locale, options) {
123
117
  const dateTime = new CalendarDateTime(2e3, 11, 22, timeValue.hour, timeValue.minute);
124
- return getTimeFormatter(locale, options, intl).format(dateTime.toDate("UTC"));
118
+ return getTimeFormatter(locale, options).format(dateTime.toDate("UTC"));
125
119
  }
126
120
  _DateTimeUtils.formatTimeLocalized = formatTimeLocalized;
127
- function formatTimePartsLocalized(timeValue, locale, options, intl = IntlUtils) {
121
+ function formatTimePartsLocalized(timeValue, locale, options) {
128
122
  const normalizedValue = new CalendarDateTime(2e3, 11, 22, timeValue?.hour ?? 6, timeValue?.minute ?? 45);
129
- return formatLocalizedDatePartList(getTimeFormatter(locale, options, intl), normalizedValue.toDate("UTC"), !timeValue, intl);
123
+ return formatLocalizedDatePartList(getTimeFormatter(locale, options), normalizedValue.toDate("UTC"), !timeValue);
130
124
  }
131
125
  _DateTimeUtils.formatTimePartsLocalized = formatTimePartsLocalized;
132
- function formatCalendarDateTimeLocalized(calendarDateTime, locale, options, intl = IntlUtils) {
126
+ function formatCalendarDateTimeLocalized(calendarDateTime, locale, options) {
133
127
  const normalizedValue = new CalendarDateTime(calendarDateTime.year, calendarDateTime.month, calendarDateTime.day, calendarDateTime.hour, calendarDateTime.minute);
134
- return formatLocalizedDateParts(getDateTimeFormatter(locale, options, intl), normalizedValue.toDate("UTC"));
128
+ return formatLocalizedDateParts(getDateTimeFormatter(locale, options), normalizedValue.toDate("UTC"));
135
129
  }
136
130
  _DateTimeUtils.formatCalendarDateTimeLocalized = formatCalendarDateTimeLocalized;
137
131
  function resolveTimeZone(timeZone) {
@@ -1,9 +1,4 @@
1
1
  type IntlLocale = Intl.LocalesArgument;
2
- export interface IntlFormatters {
3
- getDateTimeFormatter: (locale?: IntlLocale, options?: Intl.DateTimeFormatOptions) => Intl.DateTimeFormat;
4
- getDisplayNamesFormatter: (locale: IntlLocale, options: Intl.DisplayNamesOptions) => Intl.DisplayNames;
5
- getNumberFormatter: (locale?: IntlLocale, options?: Intl.NumberFormatOptions) => Intl.NumberFormat;
6
- }
7
2
  export declare namespace IntlUtils {
8
3
  const getDateTimeFormatter: (locale?: IntlLocale, options?: Intl.DateTimeFormatOptions) => Intl.DateTimeFormat;
9
4
  const getDisplayNamesFormatter: (locale: IntlLocale, options: Intl.DisplayNamesOptions) => Intl.DisplayNames;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@povio/ui",
3
- "version": "3.2.4-rc.5",
3
+ "version": "3.2.4-rc.6",
4
4
  "type": "module",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",