@chayns-ui/core 0.9.4 → 0.11.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.
- package/dist/accordion.css +3 -1
- package/dist/badge.css +28 -3
- package/dist/banner.css +2 -0
- package/dist/breadcrumb.css +63 -0
- package/dist/button.css +103 -35
- package/dist/card.css +42 -1
- package/dist/checkbox.css +3 -3
- package/dist/combo-box.css +2 -0
- package/dist/components/accordion/Accordion.d.ts +3 -4
- package/dist/components/accordion/Accordion.d.ts.map +1 -1
- package/dist/components/accordion/Accordion.js +43 -26
- package/dist/components/accordion/Accordion.js.map +1 -1
- package/dist/components/accordion/Accordion.types.d.ts +11 -3
- package/dist/components/accordion/Accordion.types.d.ts.map +1 -1
- package/dist/components/accordion/Accordion.types.js +7 -1
- package/dist/components/accordion/Accordion.types.js.map +1 -1
- package/dist/components/accordion/AccordionContext.d.ts +3 -0
- package/dist/components/accordion/AccordionContext.d.ts.map +1 -1
- package/dist/components/accordion/AccordionContext.js.map +1 -1
- package/dist/components/accordion-group/AccordionGroup.d.ts.map +1 -1
- package/dist/components/accordion-group/AccordionGroup.js +1 -0
- package/dist/components/accordion-group/AccordionGroup.js.map +1 -1
- package/dist/components/avatar/Avatar.d.ts.map +1 -1
- package/dist/components/avatar/Avatar.js +1 -0
- package/dist/components/avatar/Avatar.js.map +1 -1
- package/dist/components/avatar/Avatar.types.d.ts +9 -1
- package/dist/components/avatar/Avatar.types.d.ts.map +1 -1
- package/dist/components/avatar/Avatar.types.js +17 -0
- package/dist/components/avatar/Avatar.types.js.map +1 -0
- package/dist/components/avatar-group/AvatarGroup.d.ts.map +1 -1
- package/dist/components/avatar-group/AvatarGroup.js +4 -3
- package/dist/components/avatar-group/AvatarGroup.js.map +1 -1
- package/dist/components/badge/Badge.d.ts.map +1 -1
- package/dist/components/badge/Badge.js +1 -0
- package/dist/components/badge/Badge.js.map +1 -1
- package/dist/components/badge/Badge.types.d.ts +13 -0
- package/dist/components/badge/Badge.types.d.ts.map +1 -1
- package/dist/components/badge/Badge.types.js +16 -1
- package/dist/components/badge/Badge.types.js.map +1 -1
- package/dist/components/banner/Banner.d.ts.map +1 -1
- package/dist/components/banner/Banner.js +1 -0
- package/dist/components/banner/Banner.js.map +1 -1
- package/dist/components/banner/Banner.types.d.ts +7 -0
- package/dist/components/banner/Banner.types.d.ts.map +1 -1
- package/dist/components/banner/Banner.types.js +9 -1
- package/dist/components/banner/Banner.types.js.map +1 -1
- package/dist/components/breadcrumb/Breadcrumb.d.ts +4 -0
- package/dist/components/breadcrumb/Breadcrumb.d.ts.map +1 -0
- package/dist/components/breadcrumb/Breadcrumb.js +35 -0
- package/dist/components/breadcrumb/Breadcrumb.js.map +1 -0
- package/dist/components/breadcrumb/Breadcrumb.types.d.ts +13 -0
- package/dist/components/breadcrumb/Breadcrumb.types.d.ts.map +1 -0
- package/dist/components/button/Button.d.ts.map +1 -1
- package/dist/components/button/Button.js +1 -0
- package/dist/components/button/Button.js.map +1 -1
- package/dist/components/button/Button.types.d.ts +7 -0
- package/dist/components/button/Button.types.d.ts.map +1 -1
- package/dist/components/button/Button.types.js +9 -1
- package/dist/components/button/Button.types.js.map +1 -1
- package/dist/components/button/button-icon/ButtonIcon.d.ts.map +1 -1
- package/dist/components/button/button-icon/ButtonIcon.js +7 -3
- package/dist/components/button/button-icon/ButtonIcon.js.map +1 -1
- package/dist/components/card/Card.d.ts.map +1 -1
- package/dist/components/card/Card.js +8 -2
- package/dist/components/card/Card.js.map +1 -1
- package/dist/components/card/Card.types.d.ts +5 -0
- package/dist/components/card/Card.types.d.ts.map +1 -1
- package/dist/components/checkbox/Checkbox.d.ts.map +1 -1
- package/dist/components/checkbox/Checkbox.js +1 -0
- package/dist/components/checkbox/Checkbox.js.map +1 -1
- package/dist/components/combo-box/ComboBox.d.ts.map +1 -1
- package/dist/components/combo-box/ComboBox.js +27 -8
- package/dist/components/combo-box/ComboBox.js.map +1 -1
- package/dist/components/date-time-picker/DateTimePicker.d.ts.map +1 -1
- package/dist/components/date-time-picker/DateTimePicker.js +63 -243
- package/dist/components/date-time-picker/DateTimePicker.js.map +1 -1
- package/dist/components/date-time-picker/DateTimePicker.types.d.ts +12 -0
- package/dist/components/date-time-picker/DateTimePicker.types.d.ts.map +1 -1
- package/dist/components/date-time-picker/DateTimePicker.types.js +15 -1
- package/dist/components/date-time-picker/DateTimePicker.types.js.map +1 -1
- package/dist/components/date-time-picker/date-time-picker-utils.d.ts +4 -0
- package/dist/components/date-time-picker/date-time-picker-utils.d.ts.map +1 -0
- package/dist/components/date-time-picker/date-time-picker-utils.js +19 -0
- package/dist/components/date-time-picker/date-time-picker-utils.js.map +1 -0
- package/dist/components/date-time-picker/hooks/useDateTimePickerValue.d.ts +37 -0
- package/dist/components/date-time-picker/hooks/useDateTimePickerValue.d.ts.map +1 -0
- package/dist/components/date-time-picker/hooks/useDateTimePickerValue.js +175 -0
- package/dist/components/date-time-picker/hooks/useDateTimePickerValue.js.map +1 -0
- package/dist/components/date-time-picker/sizer/PickerSizer.d.ts +7 -0
- package/dist/components/date-time-picker/sizer/PickerSizer.d.ts.map +1 -0
- package/dist/components/date-time-picker/sizer/PickerSizer.js +15 -0
- package/dist/components/date-time-picker/sizer/PickerSizer.js.map +1 -0
- package/dist/components/date-time-picker/wheel/Wheel.d.ts +14 -0
- package/dist/components/date-time-picker/wheel/Wheel.d.ts.map +1 -0
- package/dist/components/date-time-picker/wheel/Wheel.js +143 -0
- package/dist/components/date-time-picker/wheel/Wheel.js.map +1 -0
- package/dist/components/icon-button/IconButton.d.ts.map +1 -1
- package/dist/components/icon-button/IconButton.js +1 -0
- package/dist/components/icon-button/IconButton.js.map +1 -1
- package/dist/components/list/List.d.ts +15 -10
- package/dist/components/list/List.d.ts.map +1 -1
- package/dist/components/list/List.js +19 -7
- package/dist/components/list/List.js.map +1 -1
- package/dist/components/list/List.types.d.ts +2 -2
- package/dist/components/list/List.types.d.ts.map +1 -1
- package/dist/components/pagination/Pagination.d.ts +4 -0
- package/dist/components/pagination/Pagination.d.ts.map +1 -0
- package/dist/components/pagination/Pagination.js +57 -0
- package/dist/components/pagination/Pagination.js.map +1 -0
- package/dist/components/pagination/Pagination.types.d.ts +15 -0
- package/dist/components/pagination/Pagination.types.d.ts.map +1 -0
- package/dist/components/pagination/pagination-pages.d.ts +2 -0
- package/dist/components/pagination/pagination-pages.d.ts.map +1 -0
- package/dist/components/pagination/pagination-pages.js +35 -0
- package/dist/components/pagination/pagination-pages.js.map +1 -0
- package/dist/components/popup/Popup.d.ts +4 -1
- package/dist/components/popup/Popup.d.ts.map +1 -1
- package/dist/components/popup/Popup.js +25 -18
- package/dist/components/popup/Popup.js.map +1 -1
- package/dist/components/popup/PopupList.d.ts +4 -1
- package/dist/components/popup/PopupList.d.ts.map +1 -1
- package/dist/components/popup/PopupList.js +7 -1
- package/dist/components/popup/PopupList.js.map +1 -1
- package/dist/components/progress/Progress.d.ts.map +1 -1
- package/dist/components/progress/Progress.js +1 -0
- package/dist/components/progress/Progress.js.map +1 -1
- package/dist/components/progress/Progress.types.d.ts +1 -1
- package/dist/components/progress/Progress.types.d.ts.map +1 -1
- package/dist/components/radio-group/RadioGroup.d.ts.map +1 -1
- package/dist/components/radio-group/RadioGroup.js +2 -0
- package/dist/components/radio-group/RadioGroup.js.map +1 -1
- package/dist/components/segmented-control/SegmentedControl.d.ts.map +1 -1
- package/dist/components/segmented-control/SegmentedControl.js +78 -25
- package/dist/components/segmented-control/SegmentedControl.js.map +1 -1
- package/dist/components/segmented-control/SegmentedControl.types.d.ts +1 -1
- package/dist/components/segmented-control/SegmentedControl.types.d.ts.map +1 -1
- package/dist/components/segmented-control/SegmentedControlContext.d.ts +2 -0
- package/dist/components/segmented-control/SegmentedControlContext.d.ts.map +1 -1
- package/dist/components/segmented-control/SegmentedControlContext.js.map +1 -1
- package/dist/components/skeleton/Skeleton.d.ts.map +1 -1
- package/dist/components/skeleton/Skeleton.js +1 -0
- package/dist/components/skeleton/Skeleton.js.map +1 -1
- package/dist/components/skeleton/Skeleton.types.d.ts +6 -0
- package/dist/components/skeleton/Skeleton.types.d.ts.map +1 -1
- package/dist/components/skeleton/Skeleton.types.js +8 -1
- package/dist/components/skeleton/Skeleton.types.js.map +1 -1
- package/dist/components/slider/Slider.d.ts +4 -0
- package/dist/components/slider/Slider.d.ts.map +1 -0
- package/dist/components/slider/Slider.js +61 -0
- package/dist/components/slider/Slider.js.map +1 -0
- package/dist/components/slider/Slider.types.d.ts +10 -0
- package/dist/components/slider/Slider.types.d.ts.map +1 -0
- package/dist/components/spinner/Spinner.d.ts.map +1 -1
- package/dist/components/spinner/Spinner.js +1 -0
- package/dist/components/spinner/Spinner.js.map +1 -1
- package/dist/components/split-button/SplitButton.d.ts.map +1 -1
- package/dist/components/split-button/SplitButton.js +2 -1
- package/dist/components/split-button/SplitButton.js.map +1 -1
- package/dist/components/stepper/Stepper.d.ts +4 -0
- package/dist/components/stepper/Stepper.d.ts.map +1 -0
- package/dist/components/stepper/Stepper.js +60 -0
- package/dist/components/stepper/Stepper.js.map +1 -0
- package/dist/components/stepper/Stepper.types.d.ts +27 -0
- package/dist/components/stepper/Stepper.types.d.ts.map +1 -0
- package/dist/components/stepper/Stepper.types.js +25 -0
- package/dist/components/stepper/Stepper.types.js.map +1 -0
- package/dist/components/stepper/stepper-values.d.ts +6 -0
- package/dist/components/stepper/stepper-values.d.ts.map +1 -0
- package/dist/components/stepper/stepper-values.js +26 -0
- package/dist/components/stepper/stepper-values.js.map +1 -0
- package/dist/components/switch/Switch.d.ts.map +1 -1
- package/dist/components/switch/Switch.js +1 -0
- package/dist/components/switch/Switch.js.map +1 -1
- package/dist/components/text-area/TextArea.d.ts.map +1 -1
- package/dist/components/text-area/TextArea.js +1 -0
- package/dist/components/text-area/TextArea.js.map +1 -1
- package/dist/components/text-field/TextField.d.ts.map +1 -1
- package/dist/components/text-field/TextField.js +1 -0
- package/dist/components/text-field/TextField.js.map +1 -1
- package/dist/components/tooltip/Tooltip.d.ts +4 -0
- package/dist/components/tooltip/Tooltip.d.ts.map +1 -0
- package/dist/components/tooltip/Tooltip.js +75 -0
- package/dist/components/tooltip/Tooltip.js.map +1 -0
- package/dist/components/tooltip/Tooltip.types.d.ts +12 -0
- package/dist/components/tooltip/Tooltip.types.d.ts.map +1 -0
- package/dist/components/tooltip/hooks/useTooltipInteraction.d.ts +11 -0
- package/dist/components/tooltip/hooks/useTooltipInteraction.d.ts.map +1 -0
- package/dist/components/tooltip/hooks/useTooltipInteraction.js +59 -0
- package/dist/components/tooltip/hooks/useTooltipInteraction.js.map +1 -0
- package/dist/components/tooltip/tooltip-trigger-props.d.ts +4 -0
- package/dist/components/tooltip/tooltip-trigger-props.d.ts.map +1 -0
- package/dist/components/tooltip/tooltip-trigger-props.js +25 -0
- package/dist/components/tooltip/tooltip-trigger-props.js.map +1 -0
- package/dist/date-time-picker.css +50 -4
- package/dist/hooks/useOverlayPosition.d.ts +4 -0
- package/dist/hooks/useOverlayPosition.d.ts.map +1 -0
- package/dist/hooks/useOverlayPosition.js +62 -0
- package/dist/hooks/useOverlayPosition.js.map +1 -0
- package/dist/index.d.ts +21 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -7
- package/dist/pagination.css +54 -0
- package/dist/popup.css +4 -0
- package/dist/progress.css +1 -1
- package/dist/segmented-control.css +2 -0
- package/dist/slider.css +109 -0
- package/dist/split-button.css +2 -79
- package/dist/stepper.css +77 -0
- package/dist/styles.css +5 -0
- package/dist/tooltip.css +68 -0
- package/dist/utils/native-ref.d.ts +4 -0
- package/dist/utils/native-ref.d.ts.map +1 -0
- package/dist/utils/native-ref.js +24 -0
- package/dist/utils/native-ref.js.map +1 -0
- package/package.json +7 -2
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { clampDate, dateAtMidnight, normalizeMinute } from "../date-time-picker-utils.js";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
//#region src/components/date-time-picker/hooks/useDateTimePickerValue.ts
|
|
4
|
+
function useDateTimePickerValue({ value, locale, maxDate, minDate, onChange, placeholder, wheelLabels, minuteStep, mode }) {
|
|
5
|
+
const { hourFormatter, monthFormatter, timeFormatter, dateFormatter, dateOrderFormatter } = useMemo(() => ({
|
|
6
|
+
hourFormatter: new Intl.DateTimeFormat(locale, { hour: "numeric" }),
|
|
7
|
+
monthFormatter: new Intl.DateTimeFormat(locale, { month: "long" }),
|
|
8
|
+
timeFormatter: new Intl.DateTimeFormat(locale, {
|
|
9
|
+
hour: "numeric",
|
|
10
|
+
minute: "2-digit"
|
|
11
|
+
}),
|
|
12
|
+
dateFormatter: new Intl.DateTimeFormat(locale, {
|
|
13
|
+
day: "numeric",
|
|
14
|
+
month: "long",
|
|
15
|
+
year: "numeric"
|
|
16
|
+
}),
|
|
17
|
+
dateOrderFormatter: new Intl.DateTimeFormat(locale, {
|
|
18
|
+
day: "numeric",
|
|
19
|
+
month: "numeric",
|
|
20
|
+
year: "numeric"
|
|
21
|
+
})
|
|
22
|
+
}), [locale]);
|
|
23
|
+
let displayValue = value;
|
|
24
|
+
if (value !== null) displayValue = mode === "date" ? clampDate(value, minDate, maxDate) : normalizeMinute(value, minuteStep);
|
|
25
|
+
const activeValue = displayValue ?? /* @__PURE__ */ new Date();
|
|
26
|
+
const isTwelveHour = hourFormatter.resolvedOptions().hour12 === true;
|
|
27
|
+
const years = useMemo(() => {
|
|
28
|
+
const today = (/* @__PURE__ */ new Date()).getFullYear();
|
|
29
|
+
const first = minDate?.getFullYear() ?? today - 100;
|
|
30
|
+
const last = maxDate?.getFullYear() ?? today + 100;
|
|
31
|
+
return Array.from({ length: last - first + 1 }, (_, index) => first + index);
|
|
32
|
+
}, [maxDate, minDate]);
|
|
33
|
+
function emit(nextValue) {
|
|
34
|
+
onChange(mode === "date" ? clampDate(nextValue, minDate, maxDate) : nextValue);
|
|
35
|
+
}
|
|
36
|
+
function updateTime(part, nextValue) {
|
|
37
|
+
const next = new Date(activeValue);
|
|
38
|
+
if (part === "hours") {
|
|
39
|
+
const hour = isTwelveHour ? nextValue % 12 + (next.getHours() >= 12 ? 12 : 0) : nextValue;
|
|
40
|
+
next.setHours(hour);
|
|
41
|
+
} else next.setMinutes(nextValue);
|
|
42
|
+
emit(next);
|
|
43
|
+
}
|
|
44
|
+
function updatePeriod(period) {
|
|
45
|
+
const next = new Date(activeValue);
|
|
46
|
+
next.setHours(next.getHours() % 12 + period * 12);
|
|
47
|
+
emit(next);
|
|
48
|
+
}
|
|
49
|
+
function updateDate(part, nextValue) {
|
|
50
|
+
const next = new Date(activeValue);
|
|
51
|
+
const originalDay = next.getDate();
|
|
52
|
+
next.setDate(1);
|
|
53
|
+
if (part === "fullYear") next.setFullYear(nextValue);
|
|
54
|
+
if (part === "month") next.setMonth(nextValue);
|
|
55
|
+
if (part === "date") next.setDate(nextValue);
|
|
56
|
+
if (part !== "date") next.setDate(Math.min(originalDay, new Date(next.getFullYear(), next.getMonth() + 1, 0).getDate()));
|
|
57
|
+
emit(next);
|
|
58
|
+
}
|
|
59
|
+
let formattedValue = placeholder;
|
|
60
|
+
if (displayValue !== null) {
|
|
61
|
+
if (mode === "time") formattedValue = `${timeFormatter.format(displayValue)}${locale.toLowerCase().startsWith("de") ? " Uhr" : ""}`;
|
|
62
|
+
else formattedValue = dateFormatter.format(displayValue);
|
|
63
|
+
}
|
|
64
|
+
const timeSizingValues = useMemo(() => {
|
|
65
|
+
if (mode !== "time") return [];
|
|
66
|
+
return Array.from({ length: 24 * (60 / minuteStep) }, (_, index) => {
|
|
67
|
+
const candidate = new Date(2026, 0, 1);
|
|
68
|
+
candidate.setHours(Math.floor(index / (60 / minuteStep)));
|
|
69
|
+
candidate.setMinutes(index % (60 / minuteStep) * minuteStep);
|
|
70
|
+
return `${timeFormatter.format(candidate)}${locale.toLowerCase().startsWith("de") ? " Uhr" : ""}`;
|
|
71
|
+
});
|
|
72
|
+
}, [
|
|
73
|
+
locale,
|
|
74
|
+
minuteStep,
|
|
75
|
+
mode,
|
|
76
|
+
timeFormatter
|
|
77
|
+
]);
|
|
78
|
+
const dateSizingValues = useMemo(() => {
|
|
79
|
+
if (mode !== "date") return [];
|
|
80
|
+
return years.flatMap((year) => {
|
|
81
|
+
return Array.from({ length: 12 }, (_, month) => {
|
|
82
|
+
const first = new Date(year, month, 1);
|
|
83
|
+
const last = new Date(year, month + 1, 0);
|
|
84
|
+
if (minDate !== void 0 && last < dateAtMidnight(minDate) || maxDate !== void 0 && first > dateAtMidnight(maxDate)) return;
|
|
85
|
+
const candidate = new Date(last);
|
|
86
|
+
if (minDate !== void 0 && candidate < dateAtMidnight(minDate)) candidate.setDate(minDate.getDate());
|
|
87
|
+
if (maxDate !== void 0 && candidate > dateAtMidnight(maxDate)) candidate.setDate(maxDate.getDate());
|
|
88
|
+
return dateFormatter.format(candidate);
|
|
89
|
+
}).filter((value) => value !== void 0);
|
|
90
|
+
});
|
|
91
|
+
}, [
|
|
92
|
+
dateFormatter,
|
|
93
|
+
maxDate,
|
|
94
|
+
minDate,
|
|
95
|
+
mode,
|
|
96
|
+
years
|
|
97
|
+
]);
|
|
98
|
+
const sizingValues = mode === "time" ? timeSizingValues : dateSizingValues;
|
|
99
|
+
const hours = Array.from({ length: isTwelveHour ? 12 : 24 }, (_, index) => isTwelveHour ? index + 1 : index).map((hour) => ({
|
|
100
|
+
label: String(hour).padStart(2, "0"),
|
|
101
|
+
value: hour
|
|
102
|
+
}));
|
|
103
|
+
const minutes = Array.from({ length: 60 / minuteStep }, (_, index) => {
|
|
104
|
+
const minute = index * minuteStep;
|
|
105
|
+
return {
|
|
106
|
+
label: String(minute).padStart(2, "0"),
|
|
107
|
+
value: minute
|
|
108
|
+
};
|
|
109
|
+
});
|
|
110
|
+
const months = Array.from({ length: 12 }, (_, month) => ({
|
|
111
|
+
label: monthFormatter.format(new Date(2026, month, 1)),
|
|
112
|
+
value: month
|
|
113
|
+
})).filter((month) => {
|
|
114
|
+
const first = new Date(activeValue.getFullYear(), month.value, 1);
|
|
115
|
+
const last = new Date(activeValue.getFullYear(), month.value + 1, 0);
|
|
116
|
+
return (minDate === void 0 || last >= dateAtMidnight(minDate)) && (maxDate === void 0 || first <= dateAtMidnight(maxDate));
|
|
117
|
+
});
|
|
118
|
+
const days = Array.from({ length: new Date(activeValue.getFullYear(), activeValue.getMonth() + 1, 0).getDate() }, (_, index) => ({
|
|
119
|
+
label: String(index + 1).padStart(2, "0"),
|
|
120
|
+
value: index + 1
|
|
121
|
+
})).filter((day) => {
|
|
122
|
+
const candidate = new Date(activeValue.getFullYear(), activeValue.getMonth(), day.value);
|
|
123
|
+
return (minDate === void 0 || candidate >= dateAtMidnight(minDate)) && (maxDate === void 0 || candidate <= dateAtMidnight(maxDate));
|
|
124
|
+
});
|
|
125
|
+
const datePartOrder = dateOrderFormatter.formatToParts(activeValue).flatMap((part) => {
|
|
126
|
+
if (part.type === "day") return ["date"];
|
|
127
|
+
if (part.type === "month") return ["month"];
|
|
128
|
+
if (part.type === "year") return ["fullYear"];
|
|
129
|
+
return [];
|
|
130
|
+
});
|
|
131
|
+
const yearOptions = years.map((year) => ({
|
|
132
|
+
label: String(year),
|
|
133
|
+
value: year
|
|
134
|
+
}));
|
|
135
|
+
function dateOptions(part) {
|
|
136
|
+
if (part === "date") return days;
|
|
137
|
+
if (part === "month") return months;
|
|
138
|
+
return yearOptions;
|
|
139
|
+
}
|
|
140
|
+
function dateValue(part) {
|
|
141
|
+
if (part === "date") return activeValue.getDate();
|
|
142
|
+
if (part === "month") return activeValue.getMonth();
|
|
143
|
+
return activeValue.getFullYear();
|
|
144
|
+
}
|
|
145
|
+
const dayPeriods = [0, 1].map((period) => ({
|
|
146
|
+
label: hourFormatter.formatToParts(new Date(2026, 0, 1, period === 0 ? 1 : 13)).find((part) => part.type === "dayPeriod")?.value ?? (period === 0 ? "AM" : "PM"),
|
|
147
|
+
value: period
|
|
148
|
+
}));
|
|
149
|
+
function dateLabel(part) {
|
|
150
|
+
if (part === "date") return wheelLabels.day;
|
|
151
|
+
if (part === "month") return wheelLabels.month;
|
|
152
|
+
return wheelLabels.year;
|
|
153
|
+
}
|
|
154
|
+
return {
|
|
155
|
+
displayValue,
|
|
156
|
+
sizingValues,
|
|
157
|
+
formattedValue,
|
|
158
|
+
activeValue,
|
|
159
|
+
isTwelveHour,
|
|
160
|
+
hours,
|
|
161
|
+
minutes,
|
|
162
|
+
dayPeriods,
|
|
163
|
+
datePartOrder,
|
|
164
|
+
dateOptions,
|
|
165
|
+
dateValue,
|
|
166
|
+
dateLabel,
|
|
167
|
+
updateDate,
|
|
168
|
+
updateTime,
|
|
169
|
+
updatePeriod
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
//#endregion
|
|
173
|
+
export { useDateTimePickerValue };
|
|
174
|
+
|
|
175
|
+
//# sourceMappingURL=useDateTimePickerValue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDateTimePickerValue.js","names":[],"sources":["../../../../src/components/date-time-picker/hooks/useDateTimePickerValue.ts"],"sourcesContent":["import { useMemo } from 'react';\nimport { clampDate, dateAtMidnight, normalizeMinute } from '../date-time-picker-utils.js';\nimport type { DateTimePickerProps } from '../DateTimePicker.types.js';\ntype DatePart = 'date' | 'fullYear' | 'month';\ntype ValueProps = Pick<\n DateTimePickerProps,\n 'value' | 'locale' | 'onChange' | 'placeholder' | 'wheelLabels'\n> &\n Required<Pick<DateTimePickerProps, 'minuteStep' | 'mode'>> & {\n minDate: Date | undefined;\n maxDate: Date | undefined;\n };\n\nexport function useDateTimePickerValue({\n value,\n locale,\n maxDate,\n minDate,\n onChange,\n placeholder,\n wheelLabels,\n minuteStep,\n mode,\n}: ValueProps) {\n const { hourFormatter, monthFormatter, timeFormatter, dateFormatter, dateOrderFormatter } =\n useMemo(\n () => ({\n hourFormatter: new Intl.DateTimeFormat(locale, { hour: 'numeric' }),\n monthFormatter: new Intl.DateTimeFormat(locale, { month: 'long' }),\n timeFormatter: new Intl.DateTimeFormat(locale, { hour: 'numeric', minute: '2-digit' }),\n dateFormatter: new Intl.DateTimeFormat(locale, {\n day: 'numeric',\n month: 'long',\n year: 'numeric',\n }),\n dateOrderFormatter: new Intl.DateTimeFormat(locale, {\n day: 'numeric',\n month: 'numeric',\n year: 'numeric',\n }),\n }),\n [locale],\n );\n let displayValue = value;\n if (value !== null) {\n displayValue =\n mode === 'date' ? clampDate(value, minDate, maxDate) : normalizeMinute(value, minuteStep);\n }\n const activeValue = displayValue ?? new Date();\n const isTwelveHour = hourFormatter.resolvedOptions().hour12 === true;\n\n const years = useMemo(() => {\n const today = new Date().getFullYear();\n const first = minDate?.getFullYear() ?? today - 100;\n const last = maxDate?.getFullYear() ?? today + 100;\n return Array.from({ length: last - first + 1 }, (_, index) => first + index);\n }, [maxDate, minDate]);\n\n function emit(nextValue: Date) {\n onChange(mode === 'date' ? clampDate(nextValue, minDate, maxDate) : nextValue);\n }\n\n function updateTime(part: 'hours' | 'minutes', nextValue: number) {\n const next = new Date(activeValue);\n if (part === 'hours') {\n const hour = isTwelveHour ? (nextValue % 12) + (next.getHours() >= 12 ? 12 : 0) : nextValue;\n next.setHours(hour);\n } else {\n next.setMinutes(nextValue);\n }\n emit(next);\n }\n\n function updatePeriod(period: number) {\n const next = new Date(activeValue);\n next.setHours((next.getHours() % 12) + period * 12);\n emit(next);\n }\n\n function updateDate(part: DatePart, nextValue: number) {\n const next = new Date(activeValue);\n const originalDay = next.getDate();\n next.setDate(1);\n if (part === 'fullYear') next.setFullYear(nextValue);\n if (part === 'month') next.setMonth(nextValue);\n if (part === 'date') next.setDate(nextValue);\n if (part !== 'date') {\n next.setDate(\n Math.min(originalDay, new Date(next.getFullYear(), next.getMonth() + 1, 0).getDate()),\n );\n }\n emit(next);\n }\n\n let formattedValue = placeholder;\n if (displayValue !== null) {\n if (mode === 'time')\n formattedValue = `${timeFormatter.format(displayValue)}${locale.toLowerCase().startsWith('de') ? ' Uhr' : ''}`;\n else formattedValue = dateFormatter.format(displayValue);\n }\n const timeSizingValues = useMemo(() => {\n if (mode !== 'time') return [];\n return Array.from({ length: 24 * (60 / minuteStep) }, (_, index) => {\n const candidate = new Date(2026, 0, 1);\n candidate.setHours(Math.floor(index / (60 / minuteStep)));\n candidate.setMinutes((index % (60 / minuteStep)) * minuteStep);\n return `${timeFormatter.format(candidate)}${locale.toLowerCase().startsWith('de') ? ' Uhr' : ''}`;\n });\n }, [locale, minuteStep, mode, timeFormatter]);\n const dateSizingValues = useMemo(() => {\n if (mode !== 'date') return [];\n\n return years.flatMap((year) => {\n const values = Array.from({ length: 12 }, (_, month) => {\n const first = new Date(year, month, 1);\n const last = new Date(year, month + 1, 0);\n if (\n (minDate !== undefined && last < dateAtMidnight(minDate)) ||\n (maxDate !== undefined && first > dateAtMidnight(maxDate))\n ) {\n return undefined;\n }\n\n const candidate = new Date(last);\n if (minDate !== undefined && candidate < dateAtMidnight(minDate)) {\n candidate.setDate(minDate.getDate());\n }\n if (maxDate !== undefined && candidate > dateAtMidnight(maxDate)) {\n candidate.setDate(maxDate.getDate());\n }\n return dateFormatter.format(candidate);\n });\n return values.filter((value): value is string => value !== undefined);\n });\n }, [dateFormatter, maxDate, minDate, mode, years]);\n const sizingValues = mode === 'time' ? timeSizingValues : dateSizingValues;\n\n const hours = Array.from({ length: isTwelveHour ? 12 : 24 }, (_, index) =>\n isTwelveHour ? index + 1 : index,\n ).map((hour) => ({ label: String(hour).padStart(2, '0'), value: hour }));\n const minutes = Array.from({ length: 60 / minuteStep }, (_, index) => {\n const minute = index * minuteStep;\n return { label: String(minute).padStart(2, '0'), value: minute };\n });\n const months = Array.from({ length: 12 }, (_, month) => ({\n label: monthFormatter.format(new Date(2026, month, 1)),\n value: month,\n })).filter((month) => {\n const first = new Date(activeValue.getFullYear(), month.value, 1);\n const last = new Date(activeValue.getFullYear(), month.value + 1, 0);\n return (\n (minDate === undefined || last >= dateAtMidnight(minDate)) &&\n (maxDate === undefined || first <= dateAtMidnight(maxDate))\n );\n });\n const days = Array.from(\n { length: new Date(activeValue.getFullYear(), activeValue.getMonth() + 1, 0).getDate() },\n (_, index) => ({ label: String(index + 1).padStart(2, '0'), value: index + 1 }),\n ).filter((day) => {\n const candidate = new Date(activeValue.getFullYear(), activeValue.getMonth(), day.value);\n return (\n (minDate === undefined || candidate >= dateAtMidnight(minDate)) &&\n (maxDate === undefined || candidate <= dateAtMidnight(maxDate))\n );\n });\n const datePartOrder = dateOrderFormatter.formatToParts(activeValue).flatMap<DatePart>((part) => {\n if (part.type === 'day') return ['date'];\n if (part.type === 'month') return ['month'];\n if (part.type === 'year') return ['fullYear'];\n return [];\n });\n const yearOptions = years.map((year) => ({ label: String(year), value: year }));\n\n function dateOptions(part: DatePart) {\n if (part === 'date') return days;\n if (part === 'month') return months;\n return yearOptions;\n }\n\n function dateValue(part: DatePart) {\n if (part === 'date') return activeValue.getDate();\n if (part === 'month') return activeValue.getMonth();\n return activeValue.getFullYear();\n }\n const dayPeriods = [0, 1].map((period) => ({\n label:\n hourFormatter\n .formatToParts(new Date(2026, 0, 1, period === 0 ? 1 : 13))\n .find((part) => part.type === 'dayPeriod')?.value ?? (period === 0 ? 'AM' : 'PM'),\n value: period,\n }));\n function dateLabel(part: DatePart) {\n if (part === 'date') return wheelLabels.day;\n if (part === 'month') return wheelLabels.month;\n return wheelLabels.year;\n }\n return {\n displayValue,\n sizingValues,\n formattedValue,\n activeValue,\n isTwelveHour,\n hours,\n minutes,\n dayPeriods,\n datePartOrder,\n dateOptions,\n dateValue,\n dateLabel,\n updateDate,\n updateTime,\n updatePeriod,\n };\n}\n"],"mappings":";;;AAaA,SAAgB,uBAAuB,EACrC,OACA,QACA,SACA,SACA,UACA,aACA,aACA,YACA,QACa;CACb,MAAM,EAAE,eAAe,gBAAgB,eAAe,eAAe,uBACnE,eACS;EACL,eAAe,IAAI,KAAK,eAAe,QAAQ,EAAE,MAAM,UAAU,CAAC;EAClE,gBAAgB,IAAI,KAAK,eAAe,QAAQ,EAAE,OAAO,OAAO,CAAC;EACjE,eAAe,IAAI,KAAK,eAAe,QA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zC,OACE,cACG,cAAc,IAAI,KAAK,MAAM,GAAG,GAAG,WAAW,IAAI,IAAI,EAAE,CAAC,CAAC,CAC1D,MAAM,SAAS,KAAK,SAAS,WAAW,CAAC,EAAE,UAAU,WAAW,IAAI,OAAO;EAChF,OAAO;CACT,EAAE;CACF,SAAS,UAAU,MAAgB;EACjC,IAAI,SAAS,QAAQ,OAAO,YAAY;EACxC,IAAI,SAAS,SAAS,OAAO,YAAY;EACzC,OAAO,YAAY;CACrB;CACA,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;AACF"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
interface PickerSizerProps {
|
|
2
|
+
values: readonly string[];
|
|
3
|
+
placeholder: string | null;
|
|
4
|
+
}
|
|
5
|
+
declare const PickerSizer: import("react").MemoExoticComponent<({ values, placeholder }: PickerSizerProps) => import("react").JSX.Element>;
|
|
6
|
+
export default PickerSizer;
|
|
7
|
+
//# sourceMappingURL=PickerSizer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PickerSizer.d.ts","sourceRoot":"","sources":["../../../../src/components/date-time-picker/sizer/PickerSizer.tsx"],"names":[],"mappings":"AAEA,UAAU,gBAAgB;IACxB,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED,QAAA,MAAM,WAAW,gEAAsD,gBAAgB,iCASrF,CAAC;AAEH,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { memo } from "react";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
//#region src/components/date-time-picker/sizer/PickerSizer.tsx
|
|
4
|
+
var PickerSizer = memo(function PickerSizer({ values, placeholder }) {
|
|
5
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
6
|
+
"aria-hidden": "true",
|
|
7
|
+
className: "chayns-date-time-picker__sizer",
|
|
8
|
+
children: [placeholder === null ? null : /* @__PURE__ */ jsx("span", { children: placeholder }), values.map((value) => /* @__PURE__ */ jsx("span", { children: value }, value))]
|
|
9
|
+
});
|
|
10
|
+
});
|
|
11
|
+
PickerSizer.displayName = "DateTimePicker.Sizer";
|
|
12
|
+
//#endregion
|
|
13
|
+
export { PickerSizer as default };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=PickerSizer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PickerSizer.js","names":[],"sources":["../../../../src/components/date-time-picker/sizer/PickerSizer.tsx"],"sourcesContent":["import { memo } from 'react';\n\ninterface PickerSizerProps {\n values: readonly string[];\n placeholder: string | null;\n}\n\nconst PickerSizer = memo(function PickerSizer({ values, placeholder }: PickerSizerProps) {\n return (\n <span aria-hidden=\"true\" className=\"chayns-date-time-picker__sizer\">\n {placeholder === null ? null : <span>{placeholder}</span>}\n {values.map((value) => (\n <span key={value}>{value}</span>\n ))}\n </span>\n );\n});\nPickerSizer.displayName = 'DateTimePicker.Sizer';\nexport default PickerSizer;\n"],"mappings":";;;AAOA,IAAM,cAAc,KAAK,SAAS,YAAY,EAAE,QAAQ,eAAiC;CACvF,OACE,qBAAC,QAAD;EAAM,eAAY;EAAO,WAAU;EAAnC,UAAA,CACG,gBAAgB,OAAO,OAAO,oBAAC,QAAD,EAAA,UAAO,YAAkB,CAAA,GACvD,OAAO,KAAK,UACX,oBAAC,QAAD,EAAA,UAAmB,MAAY,GAApB,KAAoB,CAChC,CACG;;AAEV,CAAC;AACD,YAAY,cAAc"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
interface WheelOption {
|
|
2
|
+
label: string;
|
|
3
|
+
value: number;
|
|
4
|
+
}
|
|
5
|
+
interface WheelProps {
|
|
6
|
+
ariaLabel: string;
|
|
7
|
+
onEscape: () => void;
|
|
8
|
+
onSelect: (value: number) => void;
|
|
9
|
+
options: readonly WheelOption[];
|
|
10
|
+
selected: number;
|
|
11
|
+
}
|
|
12
|
+
declare function Wheel({ ariaLabel, onEscape, onSelect, options, selected }: WheelProps): import("react").JSX.Element;
|
|
13
|
+
export default Wheel;
|
|
14
|
+
//# sourceMappingURL=Wheel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Wheel.d.ts","sourceRoot":"","sources":["../../../../src/components/date-time-picker/wheel/Wheel.tsx"],"names":[],"mappings":"AAMA,UAAU,WAAW;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,UAAU,UAAU;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,OAAO,EAAE,SAAS,WAAW,EAAE,CAAC;IAChC,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,iBAAS,KAAK,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,UAAU,+BA0K9E;AAGD,eAAe,KAAK,CAAC"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { useId, useLayoutEffect, useRef } from "react";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
//#region src/components/date-time-picker/wheel/Wheel.tsx
|
|
4
|
+
var WHEEL_LOOP_CYCLES = 11;
|
|
5
|
+
var WHEEL_CENTER_CYCLE = Math.floor(WHEEL_LOOP_CYCLES / 2);
|
|
6
|
+
function Wheel({ ariaLabel, onEscape, onSelect, options, selected }) {
|
|
7
|
+
const wheelId = useId();
|
|
8
|
+
const wheelRef = useRef(null);
|
|
9
|
+
const selectedRef = useRef(null);
|
|
10
|
+
const dragRef = useRef(void 0);
|
|
11
|
+
const ignoreClickRef = useRef(false);
|
|
12
|
+
useLayoutEffect(() => {
|
|
13
|
+
const wheel = wheelRef.current;
|
|
14
|
+
const itemHeight = selectedRef.current?.offsetHeight;
|
|
15
|
+
const selectedIndex = options.findIndex((option) => option.value === selected);
|
|
16
|
+
if (!wheel || !itemHeight || selectedIndex < 0) return;
|
|
17
|
+
wheel.scrollTop = (WHEEL_CENTER_CYCLE * options.length + selectedIndex) * itemHeight;
|
|
18
|
+
applyPerspective();
|
|
19
|
+
}, [options, selected]);
|
|
20
|
+
function applyPerspective() {
|
|
21
|
+
const wheel = wheelRef.current;
|
|
22
|
+
const itemHeight = selectedRef.current?.offsetHeight;
|
|
23
|
+
if (!wheel || !itemHeight) return;
|
|
24
|
+
const position = wheel.scrollTop / itemHeight;
|
|
25
|
+
for (const option of wheel.querySelectorAll(".chayns-date-time-picker__wheel-option")) {
|
|
26
|
+
const index = Number(option.dataset.wheelIndex);
|
|
27
|
+
const distance = Math.max(-2.5, Math.min(2.5, index - position));
|
|
28
|
+
const progress = Math.min(1, Math.abs(distance) / 2.5);
|
|
29
|
+
option.style.color = progress < .2 ? "var(--text)" : "var(--text-3)";
|
|
30
|
+
option.style.fontWeight = progress < .2 ? "600" : "400";
|
|
31
|
+
option.style.opacity = String(1 - progress * .7);
|
|
32
|
+
option.style.transform = `rotateX(${distance * 22}deg) scale(${1 - progress * .24})`;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function selectCenteredValue() {
|
|
36
|
+
const wheel = wheelRef.current;
|
|
37
|
+
const itemHeight = selectedRef.current?.offsetHeight;
|
|
38
|
+
if (!wheel || !itemHeight) return;
|
|
39
|
+
const option = options[(Math.round(wheel.scrollTop / itemHeight) % options.length + options.length) % options.length];
|
|
40
|
+
if (option !== void 0 && option.value !== selected) onSelect(option.value);
|
|
41
|
+
}
|
|
42
|
+
function handleScroll() {
|
|
43
|
+
const wheel = wheelRef.current;
|
|
44
|
+
const itemHeight = selectedRef.current?.offsetHeight;
|
|
45
|
+
if (!wheel || !itemHeight) return;
|
|
46
|
+
const index = Math.round(wheel.scrollTop / itemHeight);
|
|
47
|
+
const normalizedIndex = (index % options.length + options.length) % options.length;
|
|
48
|
+
if (index < options.length * 2 || index >= options.length * 9) wheel.scrollTop = (WHEEL_CENTER_CYCLE * options.length + normalizedIndex) * itemHeight;
|
|
49
|
+
applyPerspective();
|
|
50
|
+
selectCenteredValue();
|
|
51
|
+
}
|
|
52
|
+
function handleKeyDown(event) {
|
|
53
|
+
if (event.key === "Escape") {
|
|
54
|
+
event.preventDefault();
|
|
55
|
+
onEscape();
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
const index = options.findIndex((option) => option.value === selected);
|
|
59
|
+
let nextIndex = index;
|
|
60
|
+
if (event.key === "ArrowDown") nextIndex = Math.min(index + 1, options.length - 1);
|
|
61
|
+
if (event.key === "ArrowUp") nextIndex = Math.max(index - 1, 0);
|
|
62
|
+
if (event.key === "Home") nextIndex = 0;
|
|
63
|
+
if (event.key === "End") nextIndex = options.length - 1;
|
|
64
|
+
const nextOption = options[nextIndex];
|
|
65
|
+
if (nextIndex !== index && nextOption !== void 0) {
|
|
66
|
+
event.preventDefault();
|
|
67
|
+
onSelect(nextOption.value);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
function handlePointerDown(event) {
|
|
71
|
+
if (event.button !== 0) return;
|
|
72
|
+
event.preventDefault();
|
|
73
|
+
if (typeof event.currentTarget.setPointerCapture === "function") event.currentTarget.setPointerCapture(event.pointerId);
|
|
74
|
+
dragRef.current = {
|
|
75
|
+
pointerId: event.pointerId,
|
|
76
|
+
scrollTop: event.currentTarget.scrollTop,
|
|
77
|
+
startY: event.clientY
|
|
78
|
+
};
|
|
79
|
+
ignoreClickRef.current = false;
|
|
80
|
+
}
|
|
81
|
+
function handlePointerMove(event) {
|
|
82
|
+
const drag = dragRef.current;
|
|
83
|
+
if (drag?.pointerId !== event.pointerId) return;
|
|
84
|
+
const distance = event.clientY - drag.startY;
|
|
85
|
+
if (Math.abs(distance) > 3) {
|
|
86
|
+
ignoreClickRef.current = true;
|
|
87
|
+
event.currentTarget.scrollTop = drag.scrollTop - distance;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
function handlePointerUp(event) {
|
|
91
|
+
if (dragRef.current?.pointerId !== event.pointerId) return;
|
|
92
|
+
dragRef.current = void 0;
|
|
93
|
+
if (typeof event.currentTarget.releasePointerCapture === "function") event.currentTarget.releasePointerCapture(event.pointerId);
|
|
94
|
+
selectCenteredValue();
|
|
95
|
+
}
|
|
96
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
97
|
+
"aria-activedescendant": `${wheelId}-${selected}`,
|
|
98
|
+
"aria-label": ariaLabel,
|
|
99
|
+
className: "chayns-date-time-picker__wheel",
|
|
100
|
+
onKeyDown: handleKeyDown,
|
|
101
|
+
onPointerDown: handlePointerDown,
|
|
102
|
+
onPointerMove: handlePointerMove,
|
|
103
|
+
onPointerCancel: handlePointerUp,
|
|
104
|
+
onPointerUp: handlePointerUp,
|
|
105
|
+
onScroll: handleScroll,
|
|
106
|
+
ref: wheelRef,
|
|
107
|
+
role: "listbox",
|
|
108
|
+
tabIndex: 0,
|
|
109
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
110
|
+
"aria-hidden": "true",
|
|
111
|
+
className: "chayns-date-time-picker__wheel-sizer",
|
|
112
|
+
children: options.map((option) => /* @__PURE__ */ jsx("span", {
|
|
113
|
+
className: "chayns-date-time-picker__wheel-sizer-option",
|
|
114
|
+
children: option.label
|
|
115
|
+
}, option.value))
|
|
116
|
+
}), Array.from({ length: WHEEL_LOOP_CYCLES }, (_, cycle) => options.map((option, optionIndex) => /* @__PURE__ */ jsx("button", {
|
|
117
|
+
"aria-hidden": cycle !== WHEEL_CENTER_CYCLE || void 0,
|
|
118
|
+
"aria-selected": option.value === selected,
|
|
119
|
+
id: cycle === WHEEL_CENTER_CYCLE ? `${wheelId}-${option.value}` : void 0,
|
|
120
|
+
className: "chayns-date-time-picker__wheel-option",
|
|
121
|
+
"data-wheel-index": cycle * options.length + optionIndex,
|
|
122
|
+
onClick: (event) => {
|
|
123
|
+
if (ignoreClickRef.current) {
|
|
124
|
+
event.preventDefault();
|
|
125
|
+
event.stopPropagation();
|
|
126
|
+
ignoreClickRef.current = false;
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
onSelect(option.value);
|
|
130
|
+
},
|
|
131
|
+
ref: cycle === WHEEL_CENTER_CYCLE && option.value === selected ? selectedRef : void 0,
|
|
132
|
+
role: "option",
|
|
133
|
+
tabIndex: -1,
|
|
134
|
+
type: "button",
|
|
135
|
+
children: option.label
|
|
136
|
+
}, `${cycle}-${option.value}`)))]
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
Object.assign(Wheel, { displayName: "DateTimePicker.Wheel" });
|
|
140
|
+
//#endregion
|
|
141
|
+
export { Wheel as default };
|
|
142
|
+
|
|
143
|
+
//# sourceMappingURL=Wheel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Wheel.js","names":[],"sources":["../../../../src/components/date-time-picker/wheel/Wheel.tsx"],"sourcesContent":["import { useLayoutEffect, useId, useRef } from 'react';\nimport type { KeyboardEvent, PointerEvent as ReactPointerEvent } from 'react';\n\nconst WHEEL_LOOP_CYCLES = 11;\nconst WHEEL_CENTER_CYCLE = Math.floor(WHEEL_LOOP_CYCLES / 2);\n\ninterface WheelOption {\n label: string;\n value: number;\n}\n\ninterface WheelProps {\n ariaLabel: string;\n onEscape: () => void;\n onSelect: (value: number) => void;\n options: readonly WheelOption[];\n selected: number;\n}\n\nfunction Wheel({ ariaLabel, onEscape, onSelect, options, selected }: WheelProps) {\n const wheelId = useId();\n const wheelRef = useRef<HTMLDivElement>(null);\n const selectedRef = useRef<HTMLButtonElement>(null);\n const dragRef = useRef<{ pointerId: number; scrollTop: number; startY: number } | undefined>(\n undefined,\n );\n const ignoreClickRef = useRef(false);\n\n useLayoutEffect(() => {\n const wheel = wheelRef.current;\n const itemHeight = selectedRef.current?.offsetHeight;\n const selectedIndex = options.findIndex((option) => option.value === selected);\n if (!wheel || !itemHeight || selectedIndex < 0) return;\n\n wheel.scrollTop = (WHEEL_CENTER_CYCLE * options.length + selectedIndex) * itemHeight;\n applyPerspective();\n }, [options, selected]);\n\n function applyPerspective() {\n const wheel = wheelRef.current;\n const itemHeight = selectedRef.current?.offsetHeight;\n if (!wheel || !itemHeight) return;\n\n const position = wheel.scrollTop / itemHeight;\n for (const option of wheel.querySelectorAll<HTMLButtonElement>(\n '.chayns-date-time-picker__wheel-option',\n )) {\n const index = Number(option.dataset.wheelIndex);\n const distance = Math.max(-2.5, Math.min(2.5, index - position));\n const progress = Math.min(1, Math.abs(distance) / 2.5);\n\n option.style.color = progress < 0.2 ? 'var(--text)' : 'var(--text-3)';\n option.style.fontWeight = progress < 0.2 ? '600' : '400';\n option.style.opacity = String(1 - progress * 0.7);\n option.style.transform = `rotateX(${distance * 22}deg) scale(${1 - progress * 0.24})`;\n }\n }\n\n function selectCenteredValue() {\n const wheel = wheelRef.current;\n const itemHeight = selectedRef.current?.offsetHeight;\n if (!wheel || !itemHeight) return;\n\n const index = Math.round(wheel.scrollTop / itemHeight);\n const option = options[((index % options.length) + options.length) % options.length];\n if (option !== undefined && option.value !== selected) onSelect(option.value);\n }\n\n function handleScroll() {\n const wheel = wheelRef.current;\n const itemHeight = selectedRef.current?.offsetHeight;\n if (!wheel || !itemHeight) return;\n\n const index = Math.round(wheel.scrollTop / itemHeight);\n const normalizedIndex = ((index % options.length) + options.length) % options.length;\n if (index < options.length * 2 || index >= options.length * (WHEEL_LOOP_CYCLES - 2)) {\n wheel.scrollTop = (WHEEL_CENTER_CYCLE * options.length + normalizedIndex) * itemHeight;\n }\n\n applyPerspective();\n selectCenteredValue();\n }\n\n function handleKeyDown(event: KeyboardEvent<HTMLDivElement>) {\n if (event.key === 'Escape') {\n event.preventDefault();\n onEscape();\n return;\n }\n\n const index = options.findIndex((option) => option.value === selected);\n let nextIndex = index;\n if (event.key === 'ArrowDown') nextIndex = Math.min(index + 1, options.length - 1);\n if (event.key === 'ArrowUp') nextIndex = Math.max(index - 1, 0);\n if (event.key === 'Home') nextIndex = 0;\n if (event.key === 'End') nextIndex = options.length - 1;\n const nextOption = options[nextIndex];\n if (nextIndex !== index && nextOption !== undefined) {\n event.preventDefault();\n onSelect(nextOption.value);\n }\n }\n\n function handlePointerDown(event: ReactPointerEvent<HTMLDivElement>) {\n if (event.button !== 0) return;\n event.preventDefault();\n if (typeof event.currentTarget.setPointerCapture === 'function') {\n event.currentTarget.setPointerCapture(event.pointerId);\n }\n dragRef.current = {\n pointerId: event.pointerId,\n scrollTop: event.currentTarget.scrollTop,\n startY: event.clientY,\n };\n ignoreClickRef.current = false;\n }\n\n function handlePointerMove(event: ReactPointerEvent<HTMLDivElement>) {\n const drag = dragRef.current;\n if (drag?.pointerId !== event.pointerId) return;\n const distance = event.clientY - drag.startY;\n if (Math.abs(distance) > 3) {\n ignoreClickRef.current = true;\n event.currentTarget.scrollTop = drag.scrollTop - distance;\n }\n }\n\n function handlePointerUp(event: ReactPointerEvent<HTMLDivElement>) {\n if (dragRef.current?.pointerId !== event.pointerId) return;\n dragRef.current = undefined;\n if (typeof event.currentTarget.releasePointerCapture === 'function') {\n event.currentTarget.releasePointerCapture(event.pointerId);\n }\n selectCenteredValue();\n }\n\n return (\n <div\n aria-activedescendant={`${wheelId}-${selected}`}\n aria-label={ariaLabel}\n className=\"chayns-date-time-picker__wheel\"\n onKeyDown={handleKeyDown}\n onPointerDown={handlePointerDown}\n onPointerMove={handlePointerMove}\n onPointerCancel={handlePointerUp}\n onPointerUp={handlePointerUp}\n onScroll={handleScroll}\n ref={wheelRef}\n role=\"listbox\"\n tabIndex={0}\n >\n <span aria-hidden=\"true\" className=\"chayns-date-time-picker__wheel-sizer\">\n {options.map((option) => (\n <span className=\"chayns-date-time-picker__wheel-sizer-option\" key={option.value}>\n {option.label}\n </span>\n ))}\n </span>\n {Array.from({ length: WHEEL_LOOP_CYCLES }, (_, cycle) =>\n options.map((option, optionIndex) => (\n <button\n aria-hidden={cycle !== WHEEL_CENTER_CYCLE || undefined}\n aria-selected={option.value === selected}\n id={cycle === WHEEL_CENTER_CYCLE ? `${wheelId}-${option.value}` : undefined}\n className=\"chayns-date-time-picker__wheel-option\"\n data-wheel-index={cycle * options.length + optionIndex}\n key={`${cycle}-${option.value}`}\n onClick={(event) => {\n if (ignoreClickRef.current) {\n event.preventDefault();\n event.stopPropagation();\n ignoreClickRef.current = false;\n return;\n }\n onSelect(option.value);\n }}\n ref={\n cycle === WHEEL_CENTER_CYCLE && option.value === selected ? selectedRef : undefined\n }\n role=\"option\"\n tabIndex={-1}\n type=\"button\"\n >\n {option.label}\n </button>\n )),\n )}\n </div>\n );\n}\n\nObject.assign(Wheel, { displayName: 'DateTimePicker.Wheel' });\nexport default Wheel;\n"],"mappings":";;;AAGA,IAAM,oBAAoB;AAC1B,IAAM,qBAAqB,KAAK,MAAM,oBAAoB,CAAC;AAe3D,SAAS,MAAM,EAAE,WAAW,UAAU,UAAU,SAAS,YAAwB;CAC/E,MAAM,UAAU,MAAM;CACtB,MAAM,WAAW,OAAuB,IAAI;CAC5C,MAAM,cAAc,OAA0B,IAAI;CAClD,MAAM,UAAU,OACd,KAAA,CACF;CACA,MAAM,iBAAiB,OAAO,KAAK;CAEnC,sBAAsB;EACpB,MAAM,QAAQ,SAAS;EACvB,MAAM,aAAa,YAAY,SAAS;EACxC,MAAM,gBAAgB,QAAQ,WAAW,WAAW,OAAO,UAAU,QAAQ;EAC7E,IAAI,CAAC,SAAS,CAAC,cAAc,gBAAgB,GAAG;EAEhD,MAAM,aAAa,qBAAqB,QAAQ,SAAS,iBAAiB;EAC1E,iBAAiB;CACnB,GAAG,CAAC,SAAS,QAAQ,CAAC;CAEtB,SAAS,mBAAmB;EAC1B,MAAM,QAAQ,SAAS;EACvB,MAAM,aAAa,YAAY,SAAS;EACxC,IAAI,CAAC,SAAS,CAAC,YAAY;EAE3B,MAAM,WAAW,MAA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iB;EACjB,aAAa;EACb,UAAU;EACV,KAAK;EACL,MAAK;EACL,UAAU;EAZZ,UAAA,CAcE,oBAAC,QAAD;GAAM,eAAY;GAAO,WAAU;GAChC,UAAA,QAAQ,KAAK,WACZ,oBAAC,QAAD;IAAM,WAAU;IACb,UAAA,OAAO;GACJ,GAF6D,OAAO,KAEpE,CACP;EACG,CAAA,GACL,MAAM,KAAK,EAAE,QAAQ,kBAAkB,IAAI,GAAG,UAC7C,QAAQ,KAAK,QAAQ,gBACnB,oBAAC,UAAD;GACE,eAAa,UAAU,sBAAsB,KAAA;GAC7C,iBAAe,OAAO,UAAU;GAChC,IAAI,UAAU,qBAAqB,GAAG,QAAQ,GAAG,OAAO,UAAU,KAAA;GAClE,WAAU;GACV,oBAAkB,QAAQ,QAAQ,SAAS;GAE3C,UAAU,UAAU;IAClB,IAAI,eAAe,SAAS;KAC1B,MAAM,eAAe;KACrB,MAAM,gBAAgB;KACtB,eAAe,UAAU;KACzB;IACF;IACA,SAAS,OAAO,KAAK;GACvB;GACA,KACE,UAAU,sBAAsB,OAAO,UAAU,WAAW,cAAc,KAAA;GAE5E,MAAK;GACL,UAAU;GACV,MAAK;GAEJ,UAAA,OAAO;EACF,GAlBD,GAAG,MAAM,GAAG,OAAO,OAkBlB,CACT,CACH,CACG;;AAET;AAEA,OAAO,OAAO,OAAO,EAAE,aAAa,uBAAuB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconButton.d.ts","sourceRoot":"","sources":["../../../src/components/icon-button/IconButton.tsx"],"names":[],"mappings":"AAKA,QAAA,MAAM,UAAU;;;;;;8DAkCd,CAAC;
|
|
1
|
+
{"version":3,"file":"IconButton.d.ts","sourceRoot":"","sources":["../../../src/components/icon-button/IconButton.tsx"],"names":[],"mappings":"AAKA,QAAA,MAAM,UAAU;;;;;;8DAkCd,CAAC;AAIH,eAAe,UAAU,CAAC"}
|
|
@@ -19,6 +19,7 @@ var IconButton = forwardRef(function IconButton({ "aria-busy": ariaBusy, classNa
|
|
|
19
19
|
children: /* @__PURE__ */ jsx(ButtonIcon, { icon: loading ? "fa-spinner" : icon })
|
|
20
20
|
});
|
|
21
21
|
});
|
|
22
|
+
IconButton.displayName = "IconButton";
|
|
22
23
|
//#endregion
|
|
23
24
|
export { IconButton as default };
|
|
24
25
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconButton.js","names":[],"sources":["../../../src/components/icon-button/IconButton.tsx"],"sourcesContent":["import { forwardRef } from 'react';\n\nimport type { IconButtonProps } from './IconButton.types.js';\nimport ButtonIcon from '../button/button-icon/ButtonIcon.js';\n\nconst IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(function IconButton(\n {\n 'aria-busy': ariaBusy,\n className,\n disabled,\n icon,\n loading = false,\n type = 'button',\n variant,\n ...buttonProps\n },\n ref,\n) {\n const resolvedClassName = [\n 'chayns-icon-button',\n `chayns-icon-button--${variant}`,\n loading ? 'chayns-icon-button--loading' : '',\n className,\n ]\n .filter(Boolean)\n .join(' ');\n\n return (\n <button\n {...buttonProps}\n aria-busy={loading ? true : ariaBusy}\n className={resolvedClassName}\n disabled={loading || disabled}\n ref={ref}\n type={type}\n >\n <ButtonIcon icon={loading ? 'fa-spinner' : icon} />\n </button>\n );\n});\n\nexport default IconButton;\n"],"mappings":";;;;AAKA,IAAM,aAAa,WAA+C,SAAS,WACzE,EACE,aAAa,UACb,WACA,UACA,MACA,UAAU,OACV,OAAO,UACP,SACA,GAAG,eAEL,KACA;CACA,MAAM,oBAAoB;EACxB;EACA,uBAAuB;EACvB,UAAU,gCAAgC;EAC1C;CACF,CAAC,CACE,OAAO,OAAO,CAAC,CACf,KAAK,GAAG;CAEX,OACE,oBAAC,UAAD;EACE,GAAI;EACJ,aAAW,UAAU,OAAO;EAC5B,WAAW;EACX,UAAU,WAAW;EAChB;EACC;EAEN,UAAA,oBAAC,YAAD,EAAY,MAAM,UAAU,eAAe,KAAO,CAAA;CAC5C,CAAA;AAEZ,CAAC"}
|
|
1
|
+
{"version":3,"file":"IconButton.js","names":[],"sources":["../../../src/components/icon-button/IconButton.tsx"],"sourcesContent":["import { forwardRef } from 'react';\n\nimport type { IconButtonProps } from './IconButton.types.js';\nimport ButtonIcon from '../button/button-icon/ButtonIcon.js';\n\nconst IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(function IconButton(\n {\n 'aria-busy': ariaBusy,\n className,\n disabled,\n icon,\n loading = false,\n type = 'button',\n variant,\n ...buttonProps\n },\n ref,\n) {\n const resolvedClassName = [\n 'chayns-icon-button',\n `chayns-icon-button--${variant}`,\n loading ? 'chayns-icon-button--loading' : '',\n className,\n ]\n .filter(Boolean)\n .join(' ');\n\n return (\n <button\n {...buttonProps}\n aria-busy={loading ? true : ariaBusy}\n className={resolvedClassName}\n disabled={loading || disabled}\n ref={ref}\n type={type}\n >\n <ButtonIcon icon={loading ? 'fa-spinner' : icon} />\n </button>\n );\n});\n\nIconButton.displayName = 'IconButton';\n\nexport default IconButton;\n"],"mappings":";;;;AAKA,IAAM,aAAa,WAA+C,SAAS,WACzE,EACE,aAAa,UACb,WACA,UACA,MACA,UAAU,OACV,OAAO,UACP,SACA,GAAG,eAEL,KACA;CACA,MAAM,oBAAoB;EACxB;EACA,uBAAuB;EACvB,UAAU,gCAAgC;EAC1C;CACF,CAAC,CACE,OAAO,OAAO,CAAC,CACf,KAAK,GAAG;CAEX,OACE,oBAAC,UAAD;EACE,GAAI;EACJ,aAAW,UAAU,OAAO;EAC5B,WAAW;EACX,UAAU,WAAW;EAChB;EACC;EAEN,UAAA,oBAAC,YAAD,EAAY,MAAM,UAAU,eAAe,KAAO,CAAA;CAC5C,CAAA;AAEZ,CAAC;AAED,WAAW,cAAc"}
|
|
@@ -1,15 +1,20 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
declare function Action(props: ListItemActionProps): import("react").JSX.Element;
|
|
3
|
-
declare function Status({ label }: ListItemStatusProps): import("react").JSX.Element;
|
|
1
|
+
import type { ListItemPartProps, ListItemStatusProps } from './List.types.js';
|
|
4
2
|
declare const List: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLUListElement>, HTMLUListElement>, "ref"> & import("react").RefAttributes<HTMLUListElement>> & {
|
|
5
3
|
Item: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "ref"> & import("react").RefAttributes<HTMLLIElement>> & {
|
|
6
|
-
Action:
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
4
|
+
Action: import("react").ForwardRefExoticComponent<(Omit<Omit<import("react").DetailedHTMLProps<import("react").AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "children"> & {
|
|
5
|
+
children: import("react").ReactNode;
|
|
6
|
+
href: string;
|
|
7
|
+
}, "ref"> | Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "children" | "type"> & {
|
|
8
|
+
children: import("react").ReactNode;
|
|
9
|
+
href?: never;
|
|
10
|
+
type?: never;
|
|
11
|
+
}, "ref">) & import("react").RefAttributes<HTMLButtonElement | HTMLAnchorElement>>;
|
|
12
|
+
Body: import("react").ForwardRefExoticComponent<Omit<ListItemPartProps, "ref"> & import("react").RefAttributes<HTMLSpanElement>>;
|
|
13
|
+
Description: import("react").ForwardRefExoticComponent<Omit<ListItemPartProps, "ref"> & import("react").RefAttributes<HTMLSpanElement>>;
|
|
14
|
+
Leading: import("react").ForwardRefExoticComponent<Omit<ListItemPartProps, "ref"> & import("react").RefAttributes<HTMLSpanElement>>;
|
|
15
|
+
Status: import("react").ForwardRefExoticComponent<Omit<ListItemStatusProps, "ref"> & import("react").RefAttributes<HTMLSpanElement>>;
|
|
16
|
+
Title: import("react").ForwardRefExoticComponent<Omit<ListItemPartProps, "ref"> & import("react").RefAttributes<HTMLSpanElement>>;
|
|
17
|
+
Trailing: import("react").ForwardRefExoticComponent<Omit<ListItemPartProps, "ref"> & import("react").RefAttributes<HTMLSpanElement>>;
|
|
13
18
|
};
|
|
14
19
|
};
|
|
15
20
|
export default List;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"List.d.ts","sourceRoot":"","sources":["../../../src/components/list/List.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"List.d.ts","sourceRoot":"","sources":["../../../src/components/list/List.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAEV,iBAAiB,EAEjB,mBAAmB,EAEpB,MAAM,iBAAiB,CAAC;AA4GzB,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;CAUR,CAAC;AAOH,eAAe,IAAI,CAAC"}
|
|
@@ -15,7 +15,7 @@ var Item = forwardRef(function Item({ children, className, ...itemProps }, ref)
|
|
|
15
15
|
})
|
|
16
16
|
});
|
|
17
17
|
});
|
|
18
|
-
function Action(props) {
|
|
18
|
+
var Action = forwardRef(function Action(props, ref) {
|
|
19
19
|
useListItemContext("Action");
|
|
20
20
|
if (props.href !== void 0) {
|
|
21
21
|
const { children, className, href, ...anchorProps } = props;
|
|
@@ -24,6 +24,7 @@ function Action(props) {
|
|
|
24
24
|
...anchorProps,
|
|
25
25
|
className: resolvedClassName,
|
|
26
26
|
href,
|
|
27
|
+
ref,
|
|
27
28
|
children
|
|
28
29
|
});
|
|
29
30
|
}
|
|
@@ -32,25 +33,32 @@ function Action(props) {
|
|
|
32
33
|
return /* @__PURE__ */ jsx("button", {
|
|
33
34
|
...buttonProps,
|
|
34
35
|
className: resolvedClassName,
|
|
36
|
+
ref,
|
|
35
37
|
type: "button",
|
|
36
38
|
children
|
|
37
39
|
});
|
|
38
|
-
}
|
|
40
|
+
});
|
|
39
41
|
function createPart(name) {
|
|
40
42
|
const className = `chayns-list-item__${name.toLowerCase()}`;
|
|
41
|
-
|
|
43
|
+
const ListItemPart = forwardRef(function ListItemPart({ children, className: consumerClassName, ...spanProps }, ref) {
|
|
42
44
|
useListItemContext(name);
|
|
43
45
|
const resolvedClassName = [className, consumerClassName].filter(Boolean).join(" ");
|
|
44
46
|
return /* @__PURE__ */ jsx("span", {
|
|
47
|
+
...spanProps,
|
|
45
48
|
className: resolvedClassName,
|
|
49
|
+
ref,
|
|
46
50
|
children
|
|
47
51
|
});
|
|
48
|
-
};
|
|
52
|
+
});
|
|
53
|
+
ListItemPart.displayName = `List.Item.${name}`;
|
|
54
|
+
return ListItemPart;
|
|
49
55
|
}
|
|
50
|
-
function Status({ label }) {
|
|
56
|
+
var Status = forwardRef(function Status({ label, className, ...spanProps }, ref) {
|
|
51
57
|
useListItemContext("Status");
|
|
52
58
|
return /* @__PURE__ */ jsxs("span", {
|
|
53
|
-
|
|
59
|
+
...spanProps,
|
|
60
|
+
className: ["chayns-list-item__status", className].filter(Boolean).join(" "),
|
|
61
|
+
ref,
|
|
54
62
|
children: [/* @__PURE__ */ jsx("span", {
|
|
55
63
|
"aria-hidden": "true",
|
|
56
64
|
className: "chayns-list-item__status-dot"
|
|
@@ -59,7 +67,7 @@ function Status({ label }) {
|
|
|
59
67
|
children: label
|
|
60
68
|
})]
|
|
61
69
|
});
|
|
62
|
-
}
|
|
70
|
+
});
|
|
63
71
|
var ListRoot = forwardRef(function List({ children, className, ...listProps }, ref) {
|
|
64
72
|
const resolvedClassName = ["chayns-list", className].filter(Boolean).join(" ");
|
|
65
73
|
return /* @__PURE__ */ jsx(ListContext.Provider, {
|
|
@@ -81,6 +89,10 @@ var List = Object.assign(ListRoot, { Item: Object.assign(Item, {
|
|
|
81
89
|
Title: createPart("Title"),
|
|
82
90
|
Trailing: createPart("Trailing")
|
|
83
91
|
}) });
|
|
92
|
+
Item.displayName = "List.Item";
|
|
93
|
+
Object.assign(Action, { displayName: "List.Item.Action" });
|
|
94
|
+
Object.assign(Status, { displayName: "List.Item.Status" });
|
|
95
|
+
ListRoot.displayName = "List";
|
|
84
96
|
//#endregion
|
|
85
97
|
export { List as default };
|
|
86
98
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"List.js","names":[],"sources":["../../../src/components/list/List.tsx"],"sourcesContent":["import { forwardRef } from 'react';\n\nimport { ListContext, ListItemContext, useListContext, useListItemContext } from './ListContext.js';\nimport type {\n ListItemActionProps,\n ListItemPartProps,\n ListItemProps,\n ListItemStatusProps,\n ListProps,\n} from './List.types.js';\n\nconst Item = forwardRef<HTMLLIElement, ListItemProps>(function Item(\n { children, className, ...itemProps },\n ref,\n) {\n useListContext();\n const resolvedClassName = ['chayns-list-item', className].filter(Boolean).join(' ');\n\n return (\n <ListItemContext.Provider value>\n <li {...itemProps} className={resolvedClassName} ref={ref}>\n {children}\n </li>\n </ListItemContext.Provider>\n );\n});\n\
|
|
1
|
+
{"version":3,"file":"List.js","names":[],"sources":["../../../src/components/list/List.tsx"],"sourcesContent":["import { forwardRef, type Ref } from 'react';\n\nimport { ListContext, ListItemContext, useListContext, useListItemContext } from './ListContext.js';\nimport type {\n ListItemActionProps,\n ListItemPartProps,\n ListItemProps,\n ListItemStatusProps,\n ListProps,\n} from './List.types.js';\n\nconst Item = forwardRef<HTMLLIElement, ListItemProps>(function Item(\n { children, className, ...itemProps },\n ref,\n) {\n useListContext();\n const resolvedClassName = ['chayns-list-item', className].filter(Boolean).join(' ');\n\n return (\n <ListItemContext.Provider value>\n <li {...itemProps} className={resolvedClassName} ref={ref}>\n {children}\n </li>\n </ListItemContext.Provider>\n );\n});\n\nconst Action = forwardRef<HTMLAnchorElement | HTMLButtonElement, ListItemActionProps>(\n function Action(props, ref) {\n useListItemContext('Action');\n\n if (props.href !== undefined) {\n const { children, className, href, ...anchorProps } = props;\n const resolvedClassName = ['chayns-list-item__action', className].filter(Boolean).join(' ');\n\n return (\n <a\n {...anchorProps}\n className={resolvedClassName}\n href={href}\n ref={ref as Ref<HTMLAnchorElement>}\n >\n {children}\n </a>\n );\n }\n\n const { children, className, ...buttonProps } = props;\n const resolvedClassName = ['chayns-list-item__action', className].filter(Boolean).join(' ');\n\n return (\n <button\n {...buttonProps}\n className={resolvedClassName}\n ref={ref as Ref<HTMLButtonElement>}\n type=\"button\"\n >\n {children}\n </button>\n );\n },\n);\n\nfunction createPart(name: 'Leading' | 'Body' | 'Title' | 'Description' | 'Trailing') {\n const className = `chayns-list-item__${name.toLowerCase()}`;\n\n const ListItemPart = forwardRef<HTMLSpanElement, ListItemPartProps>(function ListItemPart(\n { children, className: consumerClassName, ...spanProps },\n ref,\n ) {\n useListItemContext(name);\n const resolvedClassName = [className, consumerClassName].filter(Boolean).join(' ');\n\n return (\n <span {...spanProps} className={resolvedClassName} ref={ref}>\n {children}\n </span>\n );\n });\n\n ListItemPart.displayName = `List.Item.${name}`;\n return ListItemPart;\n}\n\nconst Status = forwardRef<HTMLSpanElement, ListItemStatusProps>(function Status(\n { label, className, ...spanProps },\n ref,\n) {\n useListItemContext('Status');\n\n return (\n <span\n {...spanProps}\n className={['chayns-list-item__status', className].filter(Boolean).join(' ')}\n ref={ref}\n >\n <span aria-hidden=\"true\" className=\"chayns-list-item__status-dot\" />\n <span className=\"chayns-visually-hidden\">{label}</span>\n </span>\n );\n});\n\nconst ListRoot = forwardRef<HTMLUListElement, ListProps>(function List(\n { children, className, ...listProps },\n ref,\n) {\n const resolvedClassName = ['chayns-list', className].filter(Boolean).join(' ');\n\n return (\n <ListContext.Provider value>\n <ul {...listProps} className={resolvedClassName} ref={ref}>\n {children}\n </ul>\n </ListContext.Provider>\n );\n});\n\nconst List = Object.assign(ListRoot, {\n Item: Object.assign(Item, {\n Action,\n Body: createPart('Body'),\n Description: createPart('Description'),\n Leading: createPart('Leading'),\n Status,\n Title: createPart('Title'),\n Trailing: createPart('Trailing'),\n }),\n});\n\nItem.displayName = 'List.Item';\nObject.assign(Action, { displayName: 'List.Item.Action' });\nObject.assign(Status, { displayName: 'List.Item.Status' });\nListRoot.displayName = 'List';\n\nexport default List;\n"],"mapp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,cAAc,aAAa;CACxC,OAAO;AACT;AAEA,IAAM,SAAS,WAAiD,SAAS,OACvE,EAAE,OAAO,WAAW,GAAG,aACvB,KACA;CACA,mBAAmB,QAAQ;CAE3B,OACE,qBAAC,QAAD;EACE,GAAI;EACJ,WAAW,CAAC,4BAA4B,SAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;EACtE;EAHP,UAAA,CAKE,oBAAC,QAAD;GAAM,eAAY;GAAO,WAAU;EAAgC,CAAA,GACnE,oBAAC,QAAD;GAAM,WAAU;GAA0B,UAAA;EAAY,CAAA,CAClD;;AAEV,CAAC;AAED,IAAM,WAAW,WAAwC,SAAS,KAChE,EAAE,UAAU,WAAW,GAAG,aAC1B,KACA;CACA,MAAM,oBAAoB,CAAC,eAAe,SAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;CAE7E,OACE,oBAAC,YAAY,UAAb;EAAsB,OAAA;EACpB,UAAA,oBAAC,MAAD;GAAI,GAAI;GAAW,WAAW;GAAwB;GACnD;EACC,CAAA;CACgB,CAAA;AAE1B,CAAC;AAED,IAAM,OAAO,OAAO,OAAO,UAAU,EACnC,MAAM,OAAO,OAAO,MAAM;CACxB;CACA,MAAM,WAAW,MAAM;CACvB,aAAa,WAAW,aAAa;CACrC,SAAS,WAAW,SAAS;CAC7B;CACA,OAAO,WAAW,OAAO;CACzB,UAAU,WAAW,UAAU;AACjC,CAAC,EACH,CAAC;AAED,KAAK,cAAc;AACnB,OAAO,OAAO,QAAQ,EAAE,aAAa,mBAAmB,CAAC;AACzD,OAAO,OAAO,QAAQ,EAAE,aAAa,mBAAmB,CAAC;AACzD,SAAS,cAAc"}
|
|
@@ -9,11 +9,11 @@ export type ListItemActionProps = (Omit<ComponentPropsWithRef<'a'>, 'children'>
|
|
|
9
9
|
href?: never;
|
|
10
10
|
type?: never;
|
|
11
11
|
});
|
|
12
|
-
export interface ListItemPartProps {
|
|
12
|
+
export interface ListItemPartProps extends ComponentPropsWithRef<'span'> {
|
|
13
13
|
children: ReactNode;
|
|
14
14
|
className?: string;
|
|
15
15
|
}
|
|
16
|
-
export interface ListItemStatusProps {
|
|
16
|
+
export interface ListItemStatusProps extends Omit<ComponentPropsWithRef<'span'>, 'children'> {
|
|
17
17
|
/** Localized description of the otherwise colour-only status dot. */
|
|
18
18
|
label: Exclude<ReactNode, boolean | null | undefined>;
|
|
19
19
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"List.types.d.ts","sourceRoot":"","sources":["../../../src/components/list/List.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE9D,MAAM,MAAM,SAAS,GAAG,qBAAqB,CAAC,IAAI,CAAC,CAAC;AACpD,MAAM,MAAM,aAAa,GAAG,qBAAqB,CAAC,IAAI,CAAC,CAAC;AAExD,MAAM,MAAM,mBAAmB,GAC3B,CAAC,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,EAAE,UAAU,CAAC,GAAG;IAAE,QAAQ,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,GACtF,CAAC,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC,GAAG;IAC5D,QAAQ,EAAE,SAAS,CAAC;IACpB,IAAI,CAAC,EAAE,KAAK,CAAC;IACb,IAAI,CAAC,EAAE,KAAK,CAAC;CACd,CAAC,CAAC;AAEP,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"List.types.d.ts","sourceRoot":"","sources":["../../../src/components/list/List.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE9D,MAAM,MAAM,SAAS,GAAG,qBAAqB,CAAC,IAAI,CAAC,CAAC;AACpD,MAAM,MAAM,aAAa,GAAG,qBAAqB,CAAC,IAAI,CAAC,CAAC;AAExD,MAAM,MAAM,mBAAmB,GAC3B,CAAC,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,EAAE,UAAU,CAAC,GAAG;IAAE,QAAQ,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,GACtF,CAAC,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC,GAAG;IAC5D,QAAQ,EAAE,SAAS,CAAC;IACpB,IAAI,CAAC,EAAE,KAAK,CAAC;IACb,IAAI,CAAC,EAAE,KAAK,CAAC;CACd,CAAC,CAAC;AAEP,MAAM,WAAW,iBAAkB,SAAQ,qBAAqB,CAAC,MAAM,CAAC;IACtE,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAAC,qBAAqB,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC;IAC1F,qEAAqE;IACrE,KAAK,EAAE,OAAO,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC;CACvD"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { PaginationProps } from './Pagination.types.js';
|
|
2
|
+
declare const Pagination: import("react").ForwardRefExoticComponent<Omit<PaginationProps, "ref"> & import("react").RefAttributes<HTMLElement>>;
|
|
3
|
+
export default Pagination;
|
|
4
|
+
//# sourceMappingURL=Pagination.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Pagination.d.ts","sourceRoot":"","sources":["../../../src/components/pagination/Pagination.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D,QAAA,MAAM,UAAU,sHA0Ed,CAAC;AAEH,eAAe,UAAU,CAAC"}
|