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

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);
@@ -102,8 +102,8 @@ 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 closeComboBoxRef = useRef(null);
107
107
  const [popoverWidth, setPopoverWidth] = useState(void 0);
108
108
  const { fieldState, isOpen, setIsOpen, onInputChange, onChange, onClear, onSelectAll, listItems, selectableListItems, selectedIds, isMultiple } = SelectContext.useSelect();
109
109
  const t4 = !isOpen;
@@ -348,7 +348,13 @@ var SelectDesktop = (t0) => {
348
348
  isOpen,
349
349
  onOpenChange: setIsOpen,
350
350
  className: selectPopoverCva({}),
351
- style: { width: !ignoreTriggerWidth ? popoverWidth : void 0 },
351
+ style: (t23) => {
352
+ const { isExiting } = t23;
353
+ return {
354
+ width: !ignoreTriggerWidth ? popoverWidth : void 0,
355
+ pointerEvents: isExiting ? "none" : void 0
356
+ };
357
+ },
352
358
  offset: 0,
353
359
  children: /* @__PURE__ */ jsx(SelectListBox, {
354
360
  ...props,
@@ -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.7",
4
4
  "type": "module",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",