@povio/ui 6.0.0-rc.2 → 6.0.0-rc.3

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 (59) hide show
  1. package/dist/{Autocomplete.bound-e5WbxlBm.js → Autocomplete.bound-DTKSW9Sb.js} +1 -1
  2. package/dist/{Calendar-ChmIflXX.js → Calendar-u-UcoZhB.js} +6 -156
  3. package/dist/Calendar.lazy-B9YqgHbn.js +131 -0
  4. package/dist/{DatePicker-Bc_E4UZ1.js → DatePicker-BaLQOOJJ.js} +7 -5
  5. package/dist/{DatePicker.bound-CtBL5w-8.js → DatePicker.bound-NquZAtFK.js} +1 -1
  6. package/dist/{DatePickerInput-TND0rEMc.js → DatePickerInput-B0e_huQt.js} +6 -250
  7. package/dist/{DateRangePicker-BNMTOQ2N.js → DateRangePicker-4CrjSCAx.js} +25 -287
  8. package/dist/{DateRangePicker.bound-GeRw9Iuj.js → DateRangePicker.bound-D530tUJL.js} +1 -1
  9. package/dist/{DateTimePicker-B3YjV4uj.js → DateTimePicker-CtU096IU.js} +7 -5
  10. package/dist/{DateTimePicker.bound-ByjHsAnf.js → DateTimePicker.bound-BJzw56_u.js} +1 -1
  11. package/dist/{Input.bound-CnqI-L-b.js → Input.bound-DCTT5J62.js} +1 -1
  12. package/dist/{NumberField.bound-DiDYEZM4.js → NumberField.bound-CQcKgZ--.js} +1 -1
  13. package/dist/{NumberRangeInput.bound-B0e7yUDI.js → NumberRangeInput.bound-D-Lj5_KL.js} +1 -1
  14. package/dist/{PasswordInput.bound-Bj3WO1zC.js → PasswordInput.bound-WJ_VYQpn.js} +1 -1
  15. package/dist/RangeCalendar-CXLwzK5Z.js +291 -0
  16. package/dist/{RichTextEditor-qoxzWBFP.js → RichTextEditor-DDGSNZyF.js} +3 -3
  17. package/dist/{Select-BAlYMh4h.js → Select-DbZOJ-0u.js} +33 -360
  18. package/dist/{Select.bound-CQPG2sWV.js → Select.bound-B9c9mP8o.js} +1 -1
  19. package/dist/SelectListBox-CFOH3brT.js +362 -0
  20. package/dist/{TimePicker-CmBGkxDC.js → TimePicker-BjWuzBv_.js} +4 -3
  21. package/dist/{TimePicker.bound-3i1DJgrU.js → TimePicker.bound-DBovZwLJ.js} +1 -1
  22. package/dist/{datePickerValue.utils-BxHR_BQZ.js → TimePickerForm-BReCXELG.js} +2 -5
  23. package/dist/components/autocomplete.js +1 -1
  24. package/dist/components/date-picker.js +1 -1
  25. package/dist/components/date-range-picker.js +1 -1
  26. package/dist/components/date-time-picker.js +1 -1
  27. package/dist/components/input.js +1 -1
  28. package/dist/components/number-field.js +1 -1
  29. package/dist/components/number-range-input.js +1 -1
  30. package/dist/components/pagination.js +1 -1
  31. package/dist/components/password-input.js +1 -1
  32. package/dist/components/select.js +1 -1
  33. package/dist/components/style-definitions.js +3 -3
  34. package/dist/components/time-picker.js +1 -1
  35. package/dist/datePickerValue.utils-CkmPaD6I.js +4 -0
  36. package/dist/import-DflE4Gl2.js +251 -0
  37. package/dist/index.js +20 -20
  38. package/dist/rich-text-editor.js +1 -1
  39. package/dist/tanstack/autocomplete.js +1 -1
  40. package/dist/tanstack/date-picker.js +1 -1
  41. package/dist/tanstack/date-range-picker.js +1 -1
  42. package/dist/tanstack/date-time-picker.js +1 -1
  43. package/dist/tanstack/input.js +1 -1
  44. package/dist/tanstack/number-field.js +1 -1
  45. package/dist/tanstack/number-range-input.js +1 -1
  46. package/dist/tanstack/password-input.js +1 -1
  47. package/dist/tanstack/rich-text-editor.js +1 -1
  48. package/dist/tanstack/select.js +1 -1
  49. package/dist/tanstack/table.js +1 -1
  50. package/dist/tanstack/time-picker.js +1 -1
  51. package/dist/tanstack.js +20 -20
  52. package/dist/useScrollableListBox-BfCLMZgv.js +47 -0
  53. package/package.json +1 -1
  54. package/dist/{Autocomplete-DSwAc7jF.js → Autocomplete-DuCidYx5.js} +1 -1
  55. package/dist/{Input-BdCci6BF.js → Input-CPPDOg7b.js} +1 -1
  56. package/dist/{NumberField-BLAwsjns.js → NumberField-BbeePjH2.js} +1 -1
  57. package/dist/{NumberRangeInput-al32ZeSy.js → NumberRangeInput-Cpqrom84.js} +1 -1
  58. package/dist/{staticDateTimeSegments-CA_lwN-O.js → staticDateTimeSegments-FE-F61iH.js} +2 -2
  59. package/dist/{useTableColumnConfig-DoTYVxqG.js → useTableColumnConfig-CGtkUBG8.js} +2 -2
@@ -0,0 +1,291 @@
1
+ import { t as ChevronDown } from "./chevron-down-B4Pr8bD3.js";
2
+ import { r as ChevronLeft } from "./Tooltip-CqbyoJhl.js";
3
+ import { t as ChevronRight } from "./chevron-right-3nKJR5Bb.js";
4
+ import { n as ChevronsLeft, t as ChevronsRight } from "./chevrons-right-DJPPn2fD.js";
5
+ import { t as Select } from "./Select-DbZOJ-0u.js";
6
+ import { t as clsx } from "./clsx-CnD0nOiA.js";
7
+ import { IconButton } from "./components/icon-button.js";
8
+ import { BadgeButton } from "./components/badge-button.js";
9
+ import "./i18n-BjNKHh_D.js";
10
+ import { n as CalendarGrid, t as $1697a7ad3db7b79f$re_export$useDateFormatter } from "./import-DflE4Gl2.js";
11
+ import { useMemo, useRef } from "react";
12
+ import { jsx, jsxs } from "react/jsx-runtime";
13
+ import { useTranslation } from "react-i18next";
14
+ import { useRangeCalendar } from "@react-aria/calendar";
15
+ //#region src/components/inputs/DateTime/shared/CalendarSelectHeader.tsx
16
+ const CalendarSelectHeader = ({ state, isPrevMonthDisabled, isPrevYearDisabled, isNextMonthDisabled, isNextYearDisabled, offset = { months: 0 }, onNavigate, maxDate, minDate }) => {
17
+ const { t } = useTranslation("ui");
18
+ const displayDate = state.visibleRange.start.add(offset);
19
+ const currentMonth = displayDate.month - 1;
20
+ const currentYear = displayDate.year;
21
+ const formatter = $1697a7ad3db7b79f$re_export$useDateFormatter({
22
+ month: "long",
23
+ timeZone: state.timeZone
24
+ });
25
+ const numMonths = state.focusedDate.calendar.getMonthsInYear(state.focusedDate);
26
+ const MONTHS = useMemo(() => {
27
+ const months = [];
28
+ for (let i = 1; i <= numMonths; i++) {
29
+ const date = state.focusedDate.set({ month: i });
30
+ months.push(formatter.format(date.toDate(state.timeZone)));
31
+ }
32
+ return months;
33
+ }, [
34
+ formatter,
35
+ numMonths,
36
+ state.focusedDate,
37
+ state.timeZone
38
+ ]);
39
+ const years = Array.from({ length: 201 }, (_, i) => currentYear - 100 + i);
40
+ const getAvailableMonths = () => {
41
+ return MONTHS.map((month, i) => {
42
+ const monthDate = displayDate.set({ month: i + 1 });
43
+ let isDisabled = false;
44
+ if (maxDate) isDisabled = monthDate.year > maxDate.year || monthDate.year === maxDate.year && monthDate.month >= maxDate.month;
45
+ if (minDate) isDisabled = monthDate.year < minDate.year || monthDate.year === minDate.year && monthDate.month <= minDate.month;
46
+ return {
47
+ month,
48
+ value: i,
49
+ isDisabled
50
+ };
51
+ });
52
+ };
53
+ const getAvailableYears = () => {
54
+ return years.map((year) => {
55
+ let isDisabled = false;
56
+ if (maxDate) isDisabled = year > maxDate.year || year === maxDate.year && displayDate.month >= maxDate.month;
57
+ if (minDate && !isDisabled) isDisabled = year < minDate.year || year === minDate.year && displayDate.month <= minDate.month;
58
+ return {
59
+ year,
60
+ isDisabled
61
+ };
62
+ });
63
+ };
64
+ const availableMonths = getAvailableMonths();
65
+ const availableYears = getAvailableYears();
66
+ const handleMonthChange = (value) => {
67
+ if (value === null) return;
68
+ const newDate = displayDate.set({ month: value + 1 });
69
+ onNavigate?.(newDate);
70
+ };
71
+ const handleYearChange = (value) => {
72
+ if (value === null) return;
73
+ const newDate = displayDate.set({ year: value });
74
+ onNavigate?.(newDate);
75
+ };
76
+ const handlePrevMonth = (e) => {
77
+ e.preventDefault();
78
+ e.stopPropagation();
79
+ const newDate = displayDate.subtract({ months: 1 });
80
+ onNavigate?.(newDate);
81
+ };
82
+ const handleNextMonth = (e) => {
83
+ e.preventDefault();
84
+ e.stopPropagation();
85
+ const newDate = displayDate.add({ months: 1 });
86
+ onNavigate?.(newDate);
87
+ };
88
+ const handlePrevYear = (e) => {
89
+ e.preventDefault();
90
+ e.stopPropagation();
91
+ const newDate = displayDate.subtract({ years: 1 });
92
+ onNavigate?.(newDate);
93
+ };
94
+ const handleNextYear = (e) => {
95
+ e.preventDefault();
96
+ e.stopPropagation();
97
+ const newDate = displayDate.add({ years: 1 });
98
+ onNavigate?.(newDate);
99
+ };
100
+ return /* @__PURE__ */ jsxs("div", {
101
+ className: "flex w-full items-center justify-between gap-3 p-3",
102
+ children: [
103
+ /* @__PURE__ */ jsxs("div", {
104
+ className: "flex items-center",
105
+ children: [/* @__PURE__ */ jsx(IconButton, {
106
+ color: "secondary",
107
+ isDisabled: isPrevYearDisabled,
108
+ onClick: handlePrevYear,
109
+ icon: ChevronsLeft,
110
+ label: t(($) => $.ui.datePicker.navigation.previousYear),
111
+ variant: "text",
112
+ width: "hug",
113
+ disableTooltip: true,
114
+ size: "sm"
115
+ }), /* @__PURE__ */ jsx(IconButton, {
116
+ color: "secondary",
117
+ isDisabled: isPrevMonthDisabled,
118
+ onClick: handlePrevMonth,
119
+ icon: ChevronLeft,
120
+ label: t(($) => $.ui.datePicker.navigation.previousMonth),
121
+ variant: "text",
122
+ width: "hug",
123
+ disableTooltip: true,
124
+ size: "sm"
125
+ })]
126
+ }),
127
+ /* @__PURE__ */ jsxs("div", {
128
+ className: "flex gap-2",
129
+ children: [/* @__PURE__ */ jsx(Select, {
130
+ label: "Month",
131
+ hideLabel: true,
132
+ customTrigger: /* @__PURE__ */ jsx(BadgeButton, {
133
+ color: "secondary",
134
+ variant: "subtle",
135
+ iconPosition: "right",
136
+ icon: ChevronDown,
137
+ children: MONTHS[currentMonth].slice(0, 3)
138
+ }),
139
+ ignoreTriggerWidth: true,
140
+ items: availableMonths.map(({ month, value, isDisabled }) => ({
141
+ label: month,
142
+ id: value,
143
+ isDisabled
144
+ })).filter(({ isDisabled }) => !isDisabled),
145
+ value: currentMonth,
146
+ onChange: handleMonthChange
147
+ }), /* @__PURE__ */ jsx(Select, {
148
+ label: "Year",
149
+ hideLabel: true,
150
+ customTrigger: /* @__PURE__ */ jsx(BadgeButton, {
151
+ color: "secondary",
152
+ variant: "subtle",
153
+ iconPosition: "right",
154
+ icon: ChevronDown,
155
+ children: currentYear.toString()
156
+ }),
157
+ items: availableYears.map(({ year, isDisabled }) => ({
158
+ label: year.toString(),
159
+ id: year,
160
+ isDisabled
161
+ })).filter(({ isDisabled }) => !isDisabled),
162
+ value: currentYear,
163
+ onChange: handleYearChange
164
+ })]
165
+ }),
166
+ /* @__PURE__ */ jsxs("div", {
167
+ className: "flex items-center",
168
+ children: [/* @__PURE__ */ jsx(IconButton, {
169
+ color: "secondary",
170
+ isDisabled: isNextMonthDisabled,
171
+ onClick: handleNextMonth,
172
+ icon: ChevronRight,
173
+ label: t(($) => $.ui.datePicker.navigation.nextMonth),
174
+ variant: "text",
175
+ width: "hug",
176
+ disableTooltip: true,
177
+ size: "sm"
178
+ }), /* @__PURE__ */ jsx(IconButton, {
179
+ color: "secondary",
180
+ isDisabled: isNextYearDisabled,
181
+ onClick: handleNextYear,
182
+ icon: ChevronsRight,
183
+ label: t(($) => $.ui.datePicker.navigation.nextYear),
184
+ variant: "text",
185
+ width: "hug",
186
+ disableTooltip: true,
187
+ size: "sm"
188
+ })]
189
+ })
190
+ ]
191
+ });
192
+ };
193
+ //#endregion
194
+ //#region src/components/inputs/DateTime/shared/RangeCalendar.tsx
195
+ const RangeCalendar = ({ showWeekNumbers, className, leftCalendarState, rightCalendarState, calendarProps, onApply, onRangeChange: _onRangeChange, onDateSelection, onDateHover, rangeSelection, hoverDate, onKeyboardNavigation, isRangeSelectionDisabled }) => {
196
+ const leftRef = useRef(null);
197
+ const rightRef = useRef(null);
198
+ const { calendarProps: leftCalendarAriaProps } = useRangeCalendar(calendarProps, leftCalendarState, leftRef);
199
+ const { calendarProps: rightCalendarAriaProps } = useRangeCalendar(calendarProps, rightCalendarState, rightRef);
200
+ const leftDate = leftCalendarState.visibleRange.start;
201
+ const rightDate = rightCalendarState.visibleRange.start;
202
+ const handleLeftKeyboardNavigation = (event, date) => {
203
+ return onKeyboardNavigation?.(event, date, "left") ?? false;
204
+ };
205
+ const handleRightKeyboardNavigation = (event, date) => {
206
+ return onKeyboardNavigation?.(event, date, "right") ?? false;
207
+ };
208
+ const handleLeftNavigate = (newDate) => {
209
+ const rightCurrentDate = rightCalendarState.visibleRange.start;
210
+ if (newDate.year < rightCurrentDate.year || newDate.year === rightCurrentDate.year && newDate.month < rightCurrentDate.month) leftCalendarState.setFocusedDate(newDate);
211
+ else {
212
+ const closestValidDate = rightCurrentDate.subtract({ months: 1 });
213
+ leftCalendarState.setFocusedDate(closestValidDate);
214
+ }
215
+ };
216
+ const handleRightNavigate = (newDate) => {
217
+ const leftCurrentDate = leftCalendarState.visibleRange.start;
218
+ if (newDate.year > leftCurrentDate.year || newDate.year === leftCurrentDate.year && newDate.month > leftCurrentDate.month) rightCalendarState.setFocusedDate(newDate);
219
+ else {
220
+ const closestValidDate = leftCurrentDate.add({ months: 1 });
221
+ rightCalendarState.setFocusedDate(closestValidDate);
222
+ }
223
+ };
224
+ const isNextDisabled = useMemo(() => {
225
+ const leftNextDate = leftDate.add({ months: 1 });
226
+ return leftNextDate.year > rightDate.year || leftNextDate.year === rightDate.year && leftNextDate.month === rightDate.month;
227
+ }, [leftDate, rightDate]);
228
+ const isPrevDisabled = useMemo(() => {
229
+ const rightPrevDate = rightDate.subtract({ months: 1 });
230
+ return rightPrevDate.year < leftDate.year || rightPrevDate.year === leftDate.year && rightPrevDate.month === leftDate.month;
231
+ }, [leftDate, rightDate]);
232
+ return /* @__PURE__ */ jsx("div", {
233
+ className: clsx("flex flex-col items-center bg-popover text-popover-foreground", showWeekNumbers ? "w-full max-w-[336px] md:w-fit md:max-w-none" : "w-fit", className),
234
+ children: /* @__PURE__ */ jsxs("div", {
235
+ className: clsx("flex", showWeekNumbers && "w-full"),
236
+ children: [/* @__PURE__ */ jsxs("div", {
237
+ ...leftCalendarAriaProps,
238
+ ref: leftRef,
239
+ className: clsx("flex flex-col items-center", showWeekNumbers && "w-full"),
240
+ children: [/* @__PURE__ */ jsx(CalendarSelectHeader, {
241
+ state: leftCalendarState,
242
+ isNextMonthDisabled: isNextDisabled,
243
+ isNextYearDisabled: isNextDisabled,
244
+ onNavigate: handleLeftNavigate,
245
+ maxDate: rightDate
246
+ }), /* @__PURE__ */ jsx(CalendarGrid, {
247
+ showWeekNumbers,
248
+ firstDayOfWeek: calendarProps.firstDayOfWeek,
249
+ state: leftCalendarState,
250
+ onApply,
251
+ shouldCloseOnSelect: false,
252
+ onDateSelection,
253
+ rangeSelection,
254
+ onDateHover,
255
+ hoverDate,
256
+ onKeyboardNavigation: handleLeftKeyboardNavigation,
257
+ className: clsx("h-64", showWeekNumbers ? "w-full md:w-[336px]!" : "w-[304px]!", isRangeSelectionDisabled && "pointer-events-none opacity-50"),
258
+ calendarSide: "left",
259
+ isSelectionDisabled: isRangeSelectionDisabled
260
+ })]
261
+ }), /* @__PURE__ */ jsxs("div", {
262
+ ...rightCalendarAriaProps,
263
+ ref: rightRef,
264
+ className: "hidden flex-col items-center md:flex",
265
+ children: [/* @__PURE__ */ jsx(CalendarSelectHeader, {
266
+ state: rightCalendarState,
267
+ isPrevMonthDisabled: isPrevDisabled,
268
+ isPrevYearDisabled: isPrevDisabled,
269
+ onNavigate: handleRightNavigate,
270
+ minDate: leftDate
271
+ }), /* @__PURE__ */ jsx(CalendarGrid, {
272
+ showWeekNumbers,
273
+ firstDayOfWeek: calendarProps.firstDayOfWeek,
274
+ state: rightCalendarState,
275
+ onApply,
276
+ shouldCloseOnSelect: false,
277
+ onDateSelection,
278
+ rangeSelection,
279
+ onDateHover,
280
+ hoverDate,
281
+ onKeyboardNavigation: handleRightKeyboardNavigation,
282
+ className: clsx("h-64", showWeekNumbers ? "w-full md:w-[336px]!" : "w-[304px]!", isRangeSelectionDisabled && "pointer-events-none opacity-50"),
283
+ calendarSide: "right",
284
+ isSelectionDisabled: isRangeSelectionDisabled
285
+ })]
286
+ })]
287
+ })
288
+ });
289
+ };
290
+ //#endregion
291
+ export { RangeCalendar };
@@ -1,6 +1,6 @@
1
1
  import { t as createLucideIcon } from "./createLucideIcon-LcezOE4z.js";
2
2
  import { t as ChevronDown } from "./chevron-down-B4Pr8bD3.js";
3
- import { t as Select } from "./Select-BAlYMh4h.js";
3
+ import { t as Select } from "./Select-DbZOJ-0u.js";
4
4
  import { t as clsx } from "./clsx-CnD0nOiA.js";
5
5
  import { t as UIOverrides } from "./uiOverrides.context-BTCH9y5a.js";
6
6
  import { t as IconSlot } from "./IconSlot-Cuvpj1gd.js";
@@ -19,7 +19,7 @@ import { n as FormFieldLabel, t as FormField } from "./FormField-DyqEbqx3.js";
19
19
  import { i as inputSideDefinition, o as useInputCva } from "./input.cva-AHLI_M3K.js";
20
20
  import "./i18n-BjNKHh_D.js";
21
21
  import { t as popoverDefinition } from "./popover.cva-Ciu9Ro5G.js";
22
- import { t as Input } from "./Input-BdCci6BF.js";
22
+ import { t as Input } from "./Input-CPPDOg7b.js";
23
23
  import { Popover } from "./components/popover.js";
24
24
  import $ahdqC$react, { createContext, forwardRef, memo, useContext, useEffect, useMemo, useRef, useState } from "react";
25
25
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -31,8 +31,8 @@ import { parseColor } from "react-stately/Color";
31
31
  import { useColorPickerState } from "react-stately/useColorPickerState";
32
32
  import { useLocalizedStringFormatter } from "react-aria/useLocalizedStringFormatter";
33
33
  import { useLabel } from "@react-aria/label";
34
- import { useTranslation } from "react-i18next";
35
34
  import { useFocusVisible, useFocusWithin, useHover } from "@react-aria/interactions";
35
+ import { useTranslation } from "react-i18next";
36
36
  import { Color } from "@tiptap/extension-color";
37
37
  import { Highlight } from "@tiptap/extension-highlight";
38
38
  import { Link } from "@tiptap/extension-link";