@povio/ui 3.3.0-rc.4 → 3.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/README.md +15 -1
  2. package/dist/components/Breadcrumbs/Breadcrumbs.js +55 -206
  3. package/dist/components/buttons/InlineIconButton/InlineIconButton.js +9 -34
  4. package/dist/components/buttons/shared/ButtonContent.js +22 -80
  5. package/dist/components/inputs/Checkbox/CheckboxCheckmark.js +10 -24
  6. package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +93 -227
  7. package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +84 -202
  8. package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +60 -132
  9. package/dist/components/inputs/DateTime/shared/Calendar.js +139 -339
  10. package/dist/components/inputs/DateTime/shared/CalendarCell.js +114 -308
  11. package/dist/components/inputs/DateTime/shared/CalendarGrid.js +35 -150
  12. package/dist/components/inputs/DateTime/shared/CalendarHeader.js +95 -229
  13. package/dist/components/inputs/DateTime/shared/CalendarSelectHeader.js +115 -296
  14. package/dist/components/inputs/DateTime/shared/DateField.js +135 -306
  15. package/dist/components/inputs/DateTime/shared/DatePickerInput.js +140 -338
  16. package/dist/components/inputs/DateTime/shared/DateTimeDialogFooter.js +10 -59
  17. package/dist/components/inputs/File/FileUpload.js +1 -1
  18. package/dist/components/inputs/File/InputUpload.js +65 -261
  19. package/dist/components/inputs/File/shared/FileUploadContentEmpty.js +48 -180
  20. package/dist/components/inputs/File/shared/FileUploadContentError.js +95 -265
  21. package/dist/components/inputs/File/shared/FileUploadContentFilled.js +99 -261
  22. package/dist/components/inputs/File/shared/FileUploadContentLoading.js +56 -234
  23. package/dist/components/inputs/File/shared/ProgressBar.js +15 -102
  24. package/dist/components/inputs/FormField/FormField.js +34 -47
  25. package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.js +75 -313
  26. package/dist/components/inputs/Selection/Autocomplete/Autocomplete.js +23 -83
  27. package/dist/components/inputs/Selection/Select/QuerySelect.js +30 -96
  28. package/dist/components/inputs/Selection/Select/Select.js +3 -3
  29. package/dist/components/inputs/Selection/shared/SelectInput.js +1 -0
  30. package/dist/components/inputs/Selection/shared/SelectListBox.js +51 -163
  31. package/dist/components/inputs/Selection/shared/useSelectItems.js +48 -108
  32. package/dist/components/inputs/Skeleton/InputFrame.js +177 -552
  33. package/dist/components/inputs/TextEditor/TextEditor.js +87 -389
  34. package/dist/components/inputs/shared/InputClear.js +24 -40
  35. package/dist/components/navigation/Accordion/Accordion.js +22 -69
  36. package/dist/components/navigation/Accordion/AccordionItem.js +41 -86
  37. package/dist/components/navigation/Stepper/Stepper.js +22 -67
  38. package/dist/components/overlays/ActionModal/ActionModal.js +35 -169
  39. package/dist/components/overlays/ResponsivePopover/ResponsivePopover.js +29 -110
  40. package/dist/components/shared/pagination/Pagination.js +22 -108
  41. package/dist/components/status/Alert/Alert.js +30 -97
  42. package/dist/components/table/InfiniteTable.js +16 -67
  43. package/dist/components/table/Table.d.ts +2 -8
  44. package/dist/components/table/Table.js +33 -55
  45. package/dist/components/text/Typography/Typography.js +8 -23
  46. package/dist/config/confirmation.context.js +1 -1
  47. package/dist/config/theme.context.js +45 -98
  48. package/dist/config/uiConfig.context.js +8 -39
  49. package/dist/config/uiOverrides.context.d.ts +0 -1
  50. package/dist/hooks/useDebounceCallback.js +17 -51
  51. package/dist/hooks/useFormAutosave.js +33 -120
  52. package/dist/hooks/useLongPressRepeat.js +20 -55
  53. package/dist/index.d.ts +0 -1
  54. package/dist/index.js +1 -2
  55. package/package.json +2 -2
  56. package/dist/components/inputs/FormField/formField.cva.d.ts +0 -11
  57. package/dist/components/inputs/FormField/formField.cva.js +0 -16
  58. package/dist/components/table/TableColumnFilterInput.d.ts +0 -9
  59. package/dist/components/table/TableColumnFilterInput.js +0 -108
  60. package/dist/components/table/TableColumnFilterPlaceholder.d.ts +0 -5
  61. package/dist/components/table/TableColumnFilterPlaceholder.js +0 -41
  62. package/dist/components/table/TableColumnFilterRow.d.ts +0 -16
  63. package/dist/components/table/TableColumnFilterRow.js +0 -68
@@ -7,65 +7,59 @@ import { InlineIconButton } from "../../../buttons/InlineIconButton/InlineIconBu
7
7
  import { PillButton } from "../../../buttons/PillButton/PillButton.js";
8
8
  import "../../../../config/i18n.js";
9
9
  import { Select } from "../../Selection/Select/Select.js";
10
- import { c } from "react/compiler-runtime";
11
10
  import { jsx, jsxs } from "react/jsx-runtime";
11
+ import { useMemo } from "react";
12
12
  import { useTranslation } from "react-i18next";
13
13
  import { useDateFormatter } from "@react-aria/i18n";
14
14
  //#region src/components/inputs/DateTime/shared/CalendarSelectHeader.tsx
15
- var CalendarSelectHeader = (t0) => {
16
- const $ = c(67);
17
- const { state, isPrevMonthDisabled, isPrevYearDisabled, isNextMonthDisabled, isNextYearDisabled, offset: t1, onNavigate, maxDate, minDate } = t0;
18
- const offset = t1 === void 0 ? { months: 0 } : t1;
15
+ var CalendarSelectHeader = ({ state, isPrevMonthDisabled, isPrevYearDisabled, isNextMonthDisabled, isNextYearDisabled, offset = { months: 0 }, onNavigate, maxDate, minDate }) => {
19
16
  const { t } = useTranslation("ui");
20
17
  const displayDate = state.visibleRange.start.add(offset);
21
18
  const currentMonth = displayDate.month - 1;
22
19
  const currentYear = displayDate.year;
23
- let t2;
24
- if ($[0] !== state.timeZone) {
25
- t2 = {
26
- month: "long",
27
- timeZone: state.timeZone
28
- };
29
- $[0] = state.timeZone;
30
- $[1] = t2;
31
- } else t2 = $[1];
32
- const formatter = useDateFormatter(t2);
20
+ const formatter = useDateFormatter({
21
+ month: "long",
22
+ timeZone: state.timeZone
23
+ });
33
24
  const numMonths = state.focusedDate.calendar.getMonthsInYear(state.focusedDate);
34
- let months;
35
- if ($[2] !== formatter || $[3] !== numMonths || $[4] !== state.focusedDate || $[5] !== state.timeZone) {
36
- months = [];
25
+ const MONTHS = useMemo(() => {
26
+ const months = [];
37
27
  for (let i = 1; i <= numMonths; i++) {
38
28
  const date = state.focusedDate.set({ month: i });
39
29
  months.push(formatter.format(date.toDate(state.timeZone)));
40
30
  }
41
- $[2] = formatter;
42
- $[3] = numMonths;
43
- $[4] = state.focusedDate;
44
- $[5] = state.timeZone;
45
- $[6] = months;
46
- } else months = $[6];
47
- const MONTHS = months;
31
+ return months;
32
+ }, [
33
+ formatter,
34
+ numMonths,
35
+ state.focusedDate,
36
+ state.timeZone
37
+ ]);
48
38
  const years = Array.from({ length: 201 }, (_, i_0) => currentYear - 100 + i_0);
49
- const getAvailableMonths = () => MONTHS.map((month, i_1) => {
50
- const monthDate = displayDate.set({ month: i_1 + 1 });
51
- let isDisabled = false;
52
- if (maxDate) isDisabled = monthDate.year > maxDate.year || monthDate.year === maxDate.year && monthDate.month >= maxDate.month;
53
- if (minDate) isDisabled = monthDate.year < minDate.year || monthDate.year === minDate.year && monthDate.month <= minDate.month;
54
- return {
55
- month,
56
- value: i_1,
57
- isDisabled
58
- };
59
- });
60
- const getAvailableYears = () => years.map((year) => {
61
- let isDisabled_0 = false;
62
- if (maxDate) isDisabled_0 = year > maxDate.year || year === maxDate.year && displayDate.month >= maxDate.month;
63
- if (minDate && !isDisabled_0) isDisabled_0 = year < minDate.year || year === minDate.year && displayDate.month <= minDate.month;
64
- return {
65
- year,
66
- isDisabled: isDisabled_0
67
- };
68
- });
39
+ const getAvailableMonths = () => {
40
+ return MONTHS.map((month, i_1) => {
41
+ const monthDate = displayDate.set({ month: i_1 + 1 });
42
+ let isDisabled = false;
43
+ if (maxDate) isDisabled = monthDate.year > maxDate.year || monthDate.year === maxDate.year && monthDate.month >= maxDate.month;
44
+ if (minDate) isDisabled = monthDate.year < minDate.year || monthDate.year === minDate.year && monthDate.month <= minDate.month;
45
+ return {
46
+ month,
47
+ value: i_1,
48
+ isDisabled
49
+ };
50
+ });
51
+ };
52
+ const getAvailableYears = () => {
53
+ return years.map((year) => {
54
+ let isDisabled_0 = false;
55
+ if (maxDate) isDisabled_0 = year > maxDate.year || year === maxDate.year && displayDate.month >= maxDate.month;
56
+ if (minDate && !isDisabled_0) isDisabled_0 = year < minDate.year || year === minDate.year && displayDate.month <= minDate.month;
57
+ return {
58
+ year,
59
+ isDisabled: isDisabled_0
60
+ };
61
+ });
62
+ };
69
63
  const availableMonths = getAvailableMonths();
70
64
  const availableYears = getAvailableYears();
71
65
  const handleMonthChange = (value) => {
@@ -102,257 +96,82 @@ var CalendarSelectHeader = (t0) => {
102
96
  const newDate_4 = displayDate.add({ years: 1 });
103
97
  onNavigate?.(newDate_4);
104
98
  };
105
- const t3 = "flex w-full items-center justify-between gap-3 border-elevation-outline-default-1 border-b border-solid px-3 py-2-5";
106
- let t4;
107
- if ($[7] !== t) {
108
- t4 = t(_temp);
109
- $[7] = t;
110
- $[8] = t4;
111
- } else t4 = $[8];
112
- let t5;
113
- if ($[9] !== handlePrevYear || $[10] !== isPrevYearDisabled || $[11] !== t4) {
114
- t5 = /* @__PURE__ */ jsx(InlineIconButton, {
115
- color: "secondary",
116
- isDisabled: isPrevYearDisabled,
117
- onClick: handlePrevYear,
118
- icon: ChevronsLeftIcon,
119
- label: t4
120
- });
121
- $[9] = handlePrevYear;
122
- $[10] = isPrevYearDisabled;
123
- $[11] = t4;
124
- $[12] = t5;
125
- } else t5 = $[12];
126
- let t6;
127
- if ($[13] !== t) {
128
- t6 = t(_temp2);
129
- $[13] = t;
130
- $[14] = t6;
131
- } else t6 = $[14];
132
- let t7;
133
- if ($[15] !== handlePrevMonth || $[16] !== isPrevMonthDisabled || $[17] !== t6) {
134
- t7 = /* @__PURE__ */ jsx(InlineIconButton, {
135
- color: "secondary",
136
- isDisabled: isPrevMonthDisabled,
137
- onClick: handlePrevMonth,
138
- icon: ChevronLeftIcon,
139
- label: t6
140
- });
141
- $[15] = handlePrevMonth;
142
- $[16] = isPrevMonthDisabled;
143
- $[17] = t6;
144
- $[18] = t7;
145
- } else t7 = $[18];
146
- let t8;
147
- if ($[19] !== t5 || $[20] !== t7) {
148
- t8 = /* @__PURE__ */ jsxs("div", {
149
- className: "flex items-center",
150
- children: [t5, t7]
151
- });
152
- $[19] = t5;
153
- $[20] = t7;
154
- $[21] = t8;
155
- } else t8 = $[21];
156
- const t9 = "flex gap-2";
157
- const t10 = MONTHS[currentMonth];
158
- let t11;
159
- if ($[22] !== t10) {
160
- t11 = t10.slice(0, 3);
161
- $[22] = t10;
162
- $[23] = t11;
163
- } else t11 = $[23];
164
- let t12;
165
- if ($[24] !== t11) {
166
- t12 = /* @__PURE__ */ jsx(PillButton, {
167
- color: "secondary",
168
- variant: "subtle",
169
- iconPosition: "right",
170
- icon: ArrowDropDownIcon,
171
- children: t11
172
- });
173
- $[24] = t11;
174
- $[25] = t12;
175
- } else t12 = $[25];
176
- let t13;
177
- if ($[26] !== availableMonths) {
178
- t13 = availableMonths.map(_temp3).filter(_temp4);
179
- $[26] = availableMonths;
180
- $[27] = t13;
181
- } else t13 = $[27];
182
- let t14;
183
- if ($[28] !== currentMonth || $[29] !== handleMonthChange || $[30] !== t12 || $[31] !== t13) {
184
- t14 = /* @__PURE__ */ jsx(Select, {
185
- label: "Month",
186
- hideLabel: true,
187
- customTrigger: t12,
188
- ignoreTriggerWidth: true,
189
- items: t13,
190
- value: currentMonth,
191
- onChange: handleMonthChange
192
- });
193
- $[28] = currentMonth;
194
- $[29] = handleMonthChange;
195
- $[30] = t12;
196
- $[31] = t13;
197
- $[32] = t14;
198
- } else t14 = $[32];
199
- const T0 = Select;
200
- const t15 = "Year";
201
- const t16 = true;
202
- let t17;
203
- if ($[33] !== currentYear) {
204
- t17 = currentYear.toString();
205
- $[33] = currentYear;
206
- $[34] = t17;
207
- } else t17 = $[34];
208
- let t18;
209
- if ($[35] !== t17) {
210
- t18 = /* @__PURE__ */ jsx(PillButton, {
211
- color: "secondary",
212
- variant: "subtle",
213
- iconPosition: "right",
214
- icon: ArrowDropDownIcon,
215
- children: t17
216
- });
217
- $[35] = t17;
218
- $[36] = t18;
219
- } else t18 = $[36];
220
- const t19 = availableYears.map(_temp5);
221
- let t20;
222
- if ($[37] !== t19) {
223
- t20 = t19.filter(_temp6);
224
- $[37] = t19;
225
- $[38] = t20;
226
- } else t20 = $[38];
227
- let t21;
228
- if ($[39] !== T0 || $[40] !== currentYear || $[41] !== handleYearChange || $[42] !== t18 || $[43] !== t20) {
229
- t21 = /* @__PURE__ */ jsx(T0, {
230
- label: t15,
231
- hideLabel: t16,
232
- customTrigger: t18,
233
- items: t20,
234
- value: currentYear,
235
- onChange: handleYearChange
236
- });
237
- $[39] = T0;
238
- $[40] = currentYear;
239
- $[41] = handleYearChange;
240
- $[42] = t18;
241
- $[43] = t20;
242
- $[44] = t21;
243
- } else t21 = $[44];
244
- let t22;
245
- if ($[45] !== t14 || $[46] !== t21) {
246
- t22 = /* @__PURE__ */ jsxs("div", {
247
- className: t9,
248
- children: [t14, t21]
249
- });
250
- $[45] = t14;
251
- $[46] = t21;
252
- $[47] = t22;
253
- } else t22 = $[47];
254
- let t23;
255
- if ($[48] !== t) {
256
- t23 = t(_temp7);
257
- $[48] = t;
258
- $[49] = t23;
259
- } else t23 = $[49];
260
- let t24;
261
- if ($[50] !== handleNextMonth || $[51] !== isNextMonthDisabled || $[52] !== t23) {
262
- t24 = /* @__PURE__ */ jsx(InlineIconButton, {
263
- color: "secondary",
264
- isDisabled: isNextMonthDisabled,
265
- onClick: handleNextMonth,
266
- icon: ChevronRightIcon,
267
- label: t23
268
- });
269
- $[50] = handleNextMonth;
270
- $[51] = isNextMonthDisabled;
271
- $[52] = t23;
272
- $[53] = t24;
273
- } else t24 = $[53];
274
- let t25;
275
- if ($[54] !== t) {
276
- t25 = t(_temp8);
277
- $[54] = t;
278
- $[55] = t25;
279
- } else t25 = $[55];
280
- let t26;
281
- if ($[56] !== handleNextYear || $[57] !== isNextYearDisabled || $[58] !== t25) {
282
- t26 = /* @__PURE__ */ jsx(InlineIconButton, {
283
- color: "secondary",
284
- isDisabled: isNextYearDisabled,
285
- onClick: handleNextYear,
286
- icon: ChevronsRightIcon,
287
- label: t25
288
- });
289
- $[56] = handleNextYear;
290
- $[57] = isNextYearDisabled;
291
- $[58] = t25;
292
- $[59] = t26;
293
- } else t26 = $[59];
294
- let t27;
295
- if ($[60] !== t24 || $[61] !== t26) {
296
- t27 = /* @__PURE__ */ jsxs("div", {
297
- className: "flex items-center",
298
- children: [t24, t26]
299
- });
300
- $[60] = t24;
301
- $[61] = t26;
302
- $[62] = t27;
303
- } else t27 = $[62];
304
- let t28;
305
- if ($[63] !== t22 || $[64] !== t27 || $[65] !== t8) {
306
- t28 = /* @__PURE__ */ jsxs("div", {
307
- className: t3,
308
- children: [
309
- t8,
310
- t22,
311
- t27
312
- ]
313
- });
314
- $[63] = t22;
315
- $[64] = t27;
316
- $[65] = t8;
317
- $[66] = t28;
318
- } else t28 = $[66];
319
- return t28;
99
+ return /* @__PURE__ */ jsxs("div", {
100
+ className: "flex w-full items-center justify-between gap-3 border-elevation-outline-default-1 border-b border-solid px-3 py-2-5",
101
+ children: [
102
+ /* @__PURE__ */ jsxs("div", {
103
+ className: "flex items-center",
104
+ children: [/* @__PURE__ */ jsx(InlineIconButton, {
105
+ color: "secondary",
106
+ isDisabled: isPrevYearDisabled,
107
+ onClick: handlePrevYear,
108
+ icon: ChevronsLeftIcon,
109
+ label: t(($) => $.ui.datePicker.navigation.previousYear)
110
+ }), /* @__PURE__ */ jsx(InlineIconButton, {
111
+ color: "secondary",
112
+ isDisabled: isPrevMonthDisabled,
113
+ onClick: handlePrevMonth,
114
+ icon: ChevronLeftIcon,
115
+ label: t(($_0) => $_0.ui.datePicker.navigation.previousMonth)
116
+ })]
117
+ }),
118
+ /* @__PURE__ */ jsxs("div", {
119
+ className: "flex gap-2",
120
+ children: [/* @__PURE__ */ jsx(Select, {
121
+ label: "Month",
122
+ hideLabel: true,
123
+ customTrigger: /* @__PURE__ */ jsx(PillButton, {
124
+ color: "secondary",
125
+ variant: "subtle",
126
+ iconPosition: "right",
127
+ icon: ArrowDropDownIcon,
128
+ children: MONTHS[currentMonth].slice(0, 3)
129
+ }),
130
+ ignoreTriggerWidth: true,
131
+ items: availableMonths.map(({ month: month_0, value: value_1, isDisabled: isDisabled_1 }) => ({
132
+ label: month_0,
133
+ id: value_1,
134
+ isDisabled: isDisabled_1
135
+ })).filter(({ isDisabled: isDisabled_2 }) => !isDisabled_2),
136
+ value: currentMonth,
137
+ onChange: handleMonthChange
138
+ }), /* @__PURE__ */ jsx(Select, {
139
+ label: "Year",
140
+ hideLabel: true,
141
+ customTrigger: /* @__PURE__ */ jsx(PillButton, {
142
+ color: "secondary",
143
+ variant: "subtle",
144
+ iconPosition: "right",
145
+ icon: ArrowDropDownIcon,
146
+ children: currentYear.toString()
147
+ }),
148
+ items: availableYears.map(({ year: year_0, isDisabled: isDisabled_3 }) => ({
149
+ label: year_0.toString(),
150
+ id: year_0,
151
+ isDisabled: isDisabled_3
152
+ })).filter(({ isDisabled: isDisabled_4 }) => !isDisabled_4),
153
+ value: currentYear,
154
+ onChange: handleYearChange
155
+ })]
156
+ }),
157
+ /* @__PURE__ */ jsxs("div", {
158
+ className: "flex items-center",
159
+ children: [/* @__PURE__ */ jsx(InlineIconButton, {
160
+ color: "secondary",
161
+ isDisabled: isNextMonthDisabled,
162
+ onClick: handleNextMonth,
163
+ icon: ChevronRightIcon,
164
+ label: t(($_1) => $_1.ui.datePicker.navigation.nextMonth)
165
+ }), /* @__PURE__ */ jsx(InlineIconButton, {
166
+ color: "secondary",
167
+ isDisabled: isNextYearDisabled,
168
+ onClick: handleNextYear,
169
+ icon: ChevronsRightIcon,
170
+ label: t(($_2) => $_2.ui.datePicker.navigation.nextYear)
171
+ })]
172
+ })
173
+ ]
174
+ });
320
175
  };
321
- function _temp($) {
322
- return $.ui.datePicker.navigation.previousYear;
323
- }
324
- function _temp2($_0) {
325
- return $_0.ui.datePicker.navigation.previousMonth;
326
- }
327
- function _temp3(t0) {
328
- const { month: month_0, value: value_1, isDisabled: isDisabled_1 } = t0;
329
- return {
330
- label: month_0,
331
- id: value_1,
332
- isDisabled: isDisabled_1
333
- };
334
- }
335
- function _temp4(t0) {
336
- const { isDisabled: isDisabled_2 } = t0;
337
- return !isDisabled_2;
338
- }
339
- function _temp5(t0) {
340
- const { year: year_0, isDisabled: isDisabled_3 } = t0;
341
- return {
342
- label: year_0.toString(),
343
- id: year_0,
344
- isDisabled: isDisabled_3
345
- };
346
- }
347
- function _temp6(t0) {
348
- const { isDisabled: isDisabled_4 } = t0;
349
- return !isDisabled_4;
350
- }
351
- function _temp7($_1) {
352
- return $_1.ui.datePicker.navigation.nextMonth;
353
- }
354
- function _temp8($_2) {
355
- return $_2.ui.datePicker.navigation.nextYear;
356
- }
357
176
  //#endregion
358
177
  export { CalendarSelectHeader };