@povio/ui 2.2.9-rc.2 → 2.2.9-rc.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/dist/components/buttons/InlineIconButton/InlineIconButton.d.ts +1 -1
  2. package/dist/components/buttons/InlineIconButton/InlineIconButton.js +2 -2
  3. package/dist/components/inputs/Checkbox/Checkbox.js +6 -1
  4. package/dist/components/inputs/Checkbox/checkbox.cva.d.ts +3 -0
  5. package/dist/components/inputs/Checkbox/checkbox.cva.js +2 -1
  6. package/dist/components/inputs/DateTime/DatePicker/DatePicker.d.ts +9 -4
  7. package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +97 -9
  8. package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +9 -4
  9. package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +116 -7
  10. package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.d.ts +10 -4
  11. package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +92 -7
  12. package/dist/components/inputs/DateTime/TimePicker/TimePicker.d.ts +5 -3
  13. package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +80 -6
  14. package/dist/components/inputs/DateTime/shared/Calendar.d.ts +5 -2
  15. package/dist/components/inputs/DateTime/shared/Calendar.js +23 -6
  16. package/dist/components/inputs/DateTime/shared/CalendarCell.d.ts +1 -1
  17. package/dist/components/inputs/DateTime/shared/CalendarCell.js +3 -3
  18. package/dist/components/inputs/DateTime/shared/CalendarGrid.d.ts +1 -1
  19. package/dist/components/inputs/DateTime/shared/DatePickerInput.d.ts +5 -2
  20. package/dist/components/inputs/DateTime/shared/DatePickerInput.js +21 -12
  21. package/dist/components/inputs/DateTime/shared/TimePickerInput.js +7 -3
  22. package/dist/components/inputs/DateTime/shared/datePicker.types.d.ts +3 -0
  23. package/dist/components/inputs/DateTime/shared/datePickerInput.cva.d.ts +7 -0
  24. package/dist/components/inputs/DateTime/shared/datePickerInput.cva.js +13 -0
  25. package/dist/components/inputs/DateTime/shared/datePickerTodayIcon.d.ts +6 -0
  26. package/dist/components/inputs/DateTime/shared/datePickerTodayIcon.js +20 -0
  27. package/dist/components/inputs/FormField/FormField.d.ts +3 -3
  28. package/dist/components/inputs/FormField/FormFieldHeader.js +3 -1
  29. package/dist/components/inputs/FormField/formFieldHeader.cva.d.ts +6 -0
  30. package/dist/components/inputs/FormField/formFieldHeader.cva.js +11 -0
  31. package/dist/components/inputs/Input/NumberInput/NumberInput.d.ts +5 -2
  32. package/dist/components/inputs/Input/NumberInput/NumberInput.js +92 -8
  33. package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.d.ts +38 -0
  34. package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.js +318 -0
  35. package/dist/components/inputs/Input/TextInput/TextInput.d.ts +3 -1
  36. package/dist/components/inputs/Input/TextInput/TextInput.js +95 -8
  37. package/dist/components/inputs/Inputs/InputItem.d.ts +15 -18
  38. package/dist/components/inputs/Inputs/InputItem.js +2 -0
  39. package/dist/components/inputs/RadioGroup/RadioGroup.js +17 -9
  40. package/dist/components/inputs/RadioGroup/radio.cva.d.ts +3 -0
  41. package/dist/components/inputs/RadioGroup/radio.cva.js +2 -1
  42. package/dist/components/inputs/Selection/Autocomplete/Autocomplete.d.ts +6 -2
  43. package/dist/components/inputs/Selection/Autocomplete/Autocomplete.js +87 -6
  44. package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.d.ts +1 -1
  45. package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.js +15 -10
  46. package/dist/components/inputs/Selection/Autocomplete/queryAutocomplete.types.d.ts +25 -19
  47. package/dist/components/inputs/Selection/Select/QuerySelect.d.ts +1 -2
  48. package/dist/components/inputs/Selection/Select/QuerySelect.js +5 -3
  49. package/dist/components/inputs/Selection/Select/Select.d.ts +7 -3
  50. package/dist/components/inputs/Selection/Select/Select.js +86 -4
  51. package/dist/components/inputs/Selection/shared/SelectBase.d.ts +4 -1
  52. package/dist/components/inputs/Selection/shared/SelectBase.js +3 -2
  53. package/dist/components/inputs/Selection/shared/SelectDesktop.d.ts +1 -1
  54. package/dist/components/inputs/Selection/shared/SelectDesktop.js +8 -4
  55. package/dist/components/inputs/Selection/shared/SelectInput.d.ts +2 -2
  56. package/dist/components/inputs/Selection/shared/SelectInput.js +12 -2
  57. package/dist/components/inputs/Selection/shared/SelectListBox.d.ts +2 -2
  58. package/dist/components/inputs/Selection/shared/SelectListBox.js +3 -3
  59. package/dist/components/inputs/Selection/shared/SelectMobile.d.ts +1 -1
  60. package/dist/components/inputs/Selection/shared/SelectMobile.js +5 -3
  61. package/dist/components/inputs/Selection/shared/select.context.d.ts +3 -2
  62. package/dist/components/inputs/Selection/shared/select.context.js +22 -4
  63. package/dist/components/inputs/Selection/shared/select.types.d.ts +3 -2
  64. package/dist/components/inputs/Selection/shared/selectDesktop.cva.d.ts +3 -0
  65. package/dist/components/inputs/Selection/shared/selectDesktop.cva.js +5 -0
  66. package/dist/components/inputs/Selection/shared/staticSelect.utils.d.ts +23 -0
  67. package/dist/components/inputs/Selection/shared/staticSelect.utils.js +35 -0
  68. package/dist/components/inputs/Toggle/Toggle.js +6 -1
  69. package/dist/components/inputs/Toggle/toggle.cva.d.ts +3 -0
  70. package/dist/components/inputs/Toggle/toggle.cva.js +2 -1
  71. package/dist/components/inputs/shared/CheckContent.d.ts +2 -1
  72. package/dist/components/inputs/shared/CheckContent.js +3 -4
  73. package/dist/components/inputs/shared/StaticInput.d.ts +37 -0
  74. package/dist/components/inputs/shared/StaticInput.js +91 -0
  75. package/dist/components/inputs/shared/TooltipWrapper.js +5 -1
  76. package/dist/components/inputs/shared/input.cva.d.ts +5 -0
  77. package/dist/components/inputs/shared/input.cva.js +10 -1
  78. package/dist/components/inputs/shared/tooltipWrapper.cva.d.ts +4 -0
  79. package/dist/components/inputs/shared/tooltipWrapper.cva.js +5 -0
  80. package/dist/config/uiConfig.context.d.ts +8 -2
  81. package/dist/config/uiConfig.context.js +11 -1
  82. package/dist/config/uiStyle.context.d.ts +19 -3
  83. package/dist/helpers/dynamicInputs.d.ts +5 -5
  84. package/dist/helpers/dynamicInputs.js +3 -0
  85. package/dist/hooks/useIntersectionObserver.d.ts +1 -1
  86. package/dist/hooks/useIntersectionObserver.js +29 -10
  87. package/dist/hooks/useQueryAutocomplete.d.ts +5 -16
  88. package/dist/hooks/useQueryAutocomplete.js +13 -3
  89. package/dist/index.d.ts +7 -0
  90. package/dist/index.js +4 -2
  91. package/dist/utils/date-time.utils.d.ts +23 -9
  92. package/dist/utils/date-time.utils.js +97 -1
  93. package/dist/utils/query.utils.d.ts +4 -0
  94. package/dist/utils/query.utils.js +8 -0
  95. package/package.json +1 -1
@@ -1,7 +1,103 @@
1
- import { CalendarDate, CalendarDateTime, fromDate, getLocalTimeZone, parseAbsolute, parseAbsoluteToLocal } from "@internationalized/date";
1
+ import { CalendarDate, CalendarDateTime, DateFormatter, fromDate, getLocalTimeZone, parseAbsolute, parseAbsoluteToLocal } from "@internationalized/date";
2
2
  //#region src/utils/date-time.utils.ts
3
3
  var DateTimeUtils;
4
4
  (function(_DateTimeUtils) {
5
+ const DATE_SAMPLE_DATE_UTC = new Date(Date.UTC(2e3, 10, 22));
6
+ const TIME_SAMPLE_DATE_UTC = new Date(Date.UTC(2e3, 10, 22, 13, 45));
7
+ const getDayMonthFormat = (shouldForceLeadingZeros = false) => shouldForceLeadingZeros ? "2-digit" : "numeric";
8
+ const getDatePlaceholderFormatter = (locale, options) => new Intl.DateTimeFormat(locale, {
9
+ day: getDayMonthFormat(options?.shouldForceLeadingZeros),
10
+ month: getDayMonthFormat(options?.shouldForceLeadingZeros),
11
+ year: "numeric"
12
+ });
13
+ const getTimePlaceholderFormatter = (locale) => new Intl.DateTimeFormat(locale, {
14
+ hour: "2-digit",
15
+ minute: "2-digit",
16
+ hourCycle: "h23"
17
+ });
18
+ const getResolvedLocale = (locale) => {
19
+ if (locale) return locale;
20
+ return new Intl.DateTimeFormat().resolvedOptions().locale;
21
+ };
22
+ const getDateFormatter = (locale, options) => new Intl.DateTimeFormat(getResolvedLocale(locale), {
23
+ day: getDayMonthFormat(options?.shouldForceLeadingZeros),
24
+ month: getDayMonthFormat(options?.shouldForceLeadingZeros),
25
+ year: "numeric",
26
+ timeZone: "UTC"
27
+ });
28
+ const getTimeFormatter = (locale) => new DateFormatter(getResolvedLocale(locale), {
29
+ hour: "2-digit",
30
+ minute: "2-digit",
31
+ hourCycle: "h23",
32
+ timeZone: "UTC"
33
+ });
34
+ const getDateTimeFormatter = (locale, options) => new Intl.DateTimeFormat(getResolvedLocale(locale), {
35
+ day: getDayMonthFormat(options?.shouldForceLeadingZeros),
36
+ month: getDayMonthFormat(options?.shouldForceLeadingZeros),
37
+ year: "numeric",
38
+ hour: "2-digit",
39
+ minute: "2-digit",
40
+ hourCycle: "h23",
41
+ timeZone: "UTC"
42
+ });
43
+ const repeatLocalizedFieldLabel = (type, length, locale) => {
44
+ const placeholderChar = new Intl.DisplayNames(getResolvedLocale(locale), { type: "dateTimeField" }).of(type)?.trim().charAt(0).toLocaleLowerCase(getResolvedLocale(locale));
45
+ if (!placeholderChar) return null;
46
+ return placeholderChar.repeat(length);
47
+ };
48
+ const mapTypeToPlaceholder = (type, locale) => {
49
+ switch (type) {
50
+ case "day": return repeatLocalizedFieldLabel(type, 2, locale);
51
+ case "month": return repeatLocalizedFieldLabel(type, 2, locale);
52
+ case "year": return repeatLocalizedFieldLabel(type, 4, locale);
53
+ case "hour": return "hh";
54
+ case "minute": return "mm";
55
+ default: return null;
56
+ }
57
+ };
58
+ const formatPlaceholder = (formatter, sampleDate) => {
59
+ return formatter.formatToParts(sampleDate).map((part) => mapTypeToPlaceholder(part.type, formatter.resolvedOptions().locale) ?? part.value.replace(/\s+/gu, "")).join("");
60
+ };
61
+ const removeLeadingZero = (value) => value.replace(/^0+(?=\d)/u, "");
62
+ const removeDateSeparatorSpacing = (value) => value.replace(/([./-])\s+(?=\d)/gu, "$1");
63
+ const formatLocalizedDateParts = (formatter, date, options) => {
64
+ if (options?.shouldForceLeadingZeros !== false) return removeDateSeparatorSpacing(formatter.format(date));
65
+ return removeDateSeparatorSpacing(formatter.formatToParts(date).map((part) => {
66
+ if (part.type === "day" || part.type === "month") return removeLeadingZero(part.value);
67
+ return part.value;
68
+ }).join(""));
69
+ };
70
+ function getDatePlaceholder(locale, options) {
71
+ return formatPlaceholder(getDatePlaceholderFormatter(locale, options), DATE_SAMPLE_DATE_UTC);
72
+ }
73
+ _DateTimeUtils.getDatePlaceholder = getDatePlaceholder;
74
+ function getTimePlaceholder(locale) {
75
+ return formatPlaceholder(getTimePlaceholderFormatter(locale), TIME_SAMPLE_DATE_UTC);
76
+ }
77
+ _DateTimeUtils.getTimePlaceholder = getTimePlaceholder;
78
+ function getDateTimePlaceholder(locale, options) {
79
+ return `${getDatePlaceholder(locale, options)}, ${getTimePlaceholder(locale)}`;
80
+ }
81
+ _DateTimeUtils.getDateTimePlaceholder = getDateTimePlaceholder;
82
+ function getDateRangePlaceholder(locale, options) {
83
+ const datePlaceholder = getDatePlaceholder(locale, options);
84
+ return `${datePlaceholder} – ${datePlaceholder}`;
85
+ }
86
+ _DateTimeUtils.getDateRangePlaceholder = getDateRangePlaceholder;
87
+ function formatCalendarDateLocalized(calendarDate, locale, options) {
88
+ return formatLocalizedDateParts(getDateFormatter(locale, options), calendarDate.toDate("UTC"), options);
89
+ }
90
+ _DateTimeUtils.formatCalendarDateLocalized = formatCalendarDateLocalized;
91
+ function formatTimeLocalized(timeValue, locale) {
92
+ const dateTime = new CalendarDateTime(2e3, 11, 22, timeValue.hour, timeValue.minute);
93
+ return getTimeFormatter(locale).format(dateTime.toDate("UTC"));
94
+ }
95
+ _DateTimeUtils.formatTimeLocalized = formatTimeLocalized;
96
+ function formatCalendarDateTimeLocalized(calendarDateTime, locale, options) {
97
+ const normalizedValue = new CalendarDateTime(calendarDateTime.year, calendarDateTime.month, calendarDateTime.day, calendarDateTime.hour, calendarDateTime.minute);
98
+ return formatLocalizedDateParts(getDateTimeFormatter(locale, options), normalizedValue.toDate("UTC"), options);
99
+ }
100
+ _DateTimeUtils.formatCalendarDateTimeLocalized = formatCalendarDateTimeLocalized;
5
101
  function fromISOtoZonedDateTime(isoString) {
6
102
  return parseAbsoluteToLocal(isoString);
7
103
  }
@@ -0,0 +1,4 @@
1
+ export declare namespace ApiQueryUtils {
2
+ const DEFAULT_LIMIT = 20;
3
+ const DEFAULT_PAGE = 1;
4
+ }
@@ -0,0 +1,8 @@
1
+ //#region src/utils/query.utils.ts
2
+ var ApiQueryUtils;
3
+ (function(_ApiQueryUtils) {
4
+ _ApiQueryUtils.DEFAULT_LIMIT = 20;
5
+ _ApiQueryUtils.DEFAULT_PAGE = 1;
6
+ })(ApiQueryUtils || (ApiQueryUtils = {}));
7
+ //#endregion
8
+ export { ApiQueryUtils };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@povio/ui",
3
- "version": "2.2.9-rc.2",
3
+ "version": "2.2.9-rc.21",
4
4
  "type": "module",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",