@refraktor/dates 0.0.1
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/.turbo/turbo-build.log +4 -0
- package/LICENSE +21 -0
- package/README.md +21 -0
- package/build/components/date-input/date-input.d.ts +4 -0
- package/build/components/date-input/date-input.d.ts.map +1 -0
- package/build/components/date-input/date-input.js +164 -0
- package/build/components/date-input/date-input.types.d.ts +96 -0
- package/build/components/date-input/date-input.types.d.ts.map +1 -0
- package/build/components/date-input/date-input.types.js +1 -0
- package/build/components/date-input/index.d.ts +3 -0
- package/build/components/date-input/index.d.ts.map +1 -0
- package/build/components/date-input/index.js +1 -0
- package/build/components/date-picker/date-picker.d.ts +4 -0
- package/build/components/date-picker/date-picker.d.ts.map +1 -0
- package/build/components/date-picker/date-picker.js +307 -0
- package/build/components/date-picker/date-picker.types.d.ts +86 -0
- package/build/components/date-picker/date-picker.types.d.ts.map +1 -0
- package/build/components/date-picker/date-picker.types.js +1 -0
- package/build/components/date-picker/index.d.ts +3 -0
- package/build/components/date-picker/index.d.ts.map +1 -0
- package/build/components/date-picker/index.js +1 -0
- package/build/components/dates-provider/context.d.ts +4 -0
- package/build/components/dates-provider/context.d.ts.map +1 -0
- package/build/components/dates-provider/context.js +10 -0
- package/build/components/dates-provider/dates-provider.d.ts +7 -0
- package/build/components/dates-provider/dates-provider.d.ts.map +1 -0
- package/build/components/dates-provider/dates-provider.js +65 -0
- package/build/components/dates-provider/index.d.ts +5 -0
- package/build/components/dates-provider/index.d.ts.map +1 -0
- package/build/components/dates-provider/index.js +3 -0
- package/build/components/dates-provider/types.d.ts +26 -0
- package/build/components/dates-provider/types.d.ts.map +1 -0
- package/build/components/dates-provider/types.js +1 -0
- package/build/components/dates-provider/use-dates.d.ts +2 -0
- package/build/components/dates-provider/use-dates.d.ts.map +1 -0
- package/build/components/dates-provider/use-dates.js +4 -0
- package/build/components/index.d.ts +8 -0
- package/build/components/index.d.ts.map +1 -0
- package/build/components/index.js +7 -0
- package/build/components/month-input/index.d.ts +3 -0
- package/build/components/month-input/index.d.ts.map +1 -0
- package/build/components/month-input/index.js +1 -0
- package/build/components/month-input/month-input.d.ts +4 -0
- package/build/components/month-input/month-input.d.ts.map +1 -0
- package/build/components/month-input/month-input.js +161 -0
- package/build/components/month-input/month-input.types.d.ts +85 -0
- package/build/components/month-input/month-input.types.d.ts.map +1 -0
- package/build/components/month-input/month-input.types.js +1 -0
- package/build/components/month-picker/index.d.ts +3 -0
- package/build/components/month-picker/index.d.ts.map +1 -0
- package/build/components/month-picker/index.js +1 -0
- package/build/components/month-picker/month-picker.d.ts +4 -0
- package/build/components/month-picker/month-picker.d.ts.map +1 -0
- package/build/components/month-picker/month-picker.js +229 -0
- package/build/components/month-picker/month-picker.types.d.ts +69 -0
- package/build/components/month-picker/month-picker.types.d.ts.map +1 -0
- package/build/components/month-picker/month-picker.types.js +1 -0
- package/build/components/picker-shared/index.d.ts +5 -0
- package/build/components/picker-shared/index.d.ts.map +1 -0
- package/build/components/picker-shared/index.js +2 -0
- package/build/components/picker-shared/picker-header.d.ts +4 -0
- package/build/components/picker-shared/picker-header.d.ts.map +1 -0
- package/build/components/picker-shared/picker-header.js +27 -0
- package/build/components/picker-shared/picker-header.types.d.ts +36 -0
- package/build/components/picker-shared/picker-header.types.d.ts.map +1 -0
- package/build/components/picker-shared/picker-header.types.js +1 -0
- package/build/components/picker-shared/picker.styles.d.ts +12 -0
- package/build/components/picker-shared/picker.styles.d.ts.map +1 -0
- package/build/components/picker-shared/picker.styles.js +53 -0
- package/build/components/picker-shared/picker.types.d.ts +4 -0
- package/build/components/picker-shared/picker.types.d.ts.map +1 -0
- package/build/components/picker-shared/picker.types.js +1 -0
- package/build/components/year-input/index.d.ts +3 -0
- package/build/components/year-input/index.d.ts.map +1 -0
- package/build/components/year-input/index.js +1 -0
- package/build/components/year-input/year-input.d.ts +4 -0
- package/build/components/year-input/year-input.d.ts.map +1 -0
- package/build/components/year-input/year-input.js +157 -0
- package/build/components/year-input/year-input.types.d.ts +74 -0
- package/build/components/year-input/year-input.types.d.ts.map +1 -0
- package/build/components/year-input/year-input.types.js +1 -0
- package/build/components/year-picker/index.d.ts +3 -0
- package/build/components/year-picker/index.d.ts.map +1 -0
- package/build/components/year-picker/index.js +1 -0
- package/build/components/year-picker/year-picker.d.ts +4 -0
- package/build/components/year-picker/year-picker.d.ts.map +1 -0
- package/build/components/year-picker/year-picker.js +236 -0
- package/build/components/year-picker/year-picker.types.d.ts +70 -0
- package/build/components/year-picker/year-picker.types.d.ts.map +1 -0
- package/build/components/year-picker/year-picker.types.js +1 -0
- package/build/index.d.ts +3 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +2 -0
- package/build/style.css +2 -0
- package/package.json +38 -0
- package/refraktor-dates-0.0.1-alpha.0.tgz +0 -0
- package/src/components/date-input/date-input.tsx +376 -0
- package/src/components/date-input/date-input.types.ts +161 -0
- package/src/components/date-input/index.ts +13 -0
- package/src/components/date-picker/date-picker.tsx +649 -0
- package/src/components/date-picker/date-picker.types.ts +145 -0
- package/src/components/date-picker/index.ts +15 -0
- package/src/components/dates-provider/context.ts +18 -0
- package/src/components/dates-provider/dates-provider.tsx +136 -0
- package/src/components/dates-provider/index.ts +10 -0
- package/src/components/dates-provider/types.ts +33 -0
- package/src/components/dates-provider/use-dates.ts +5 -0
- package/src/components/index.ts +7 -0
- package/src/components/month-input/index.ts +13 -0
- package/src/components/month-input/month-input.tsx +363 -0
- package/src/components/month-input/month-input.types.ts +139 -0
- package/src/components/month-picker/index.ts +14 -0
- package/src/components/month-picker/month-picker.tsx +458 -0
- package/src/components/month-picker/month-picker.types.ts +117 -0
- package/src/components/picker-shared/index.ts +7 -0
- package/src/components/picker-shared/picker-header.tsx +178 -0
- package/src/components/picker-shared/picker-header.types.ts +49 -0
- package/src/components/picker-shared/picker.styles.ts +69 -0
- package/src/components/picker-shared/picker.types.ts +4 -0
- package/src/components/year-input/index.ts +13 -0
- package/src/components/year-input/year-input.tsx +347 -0
- package/src/components/year-input/year-input.types.ts +118 -0
- package/src/components/year-picker/index.ts +15 -0
- package/src/components/year-picker/year-picker.tsx +504 -0
- package/src/components/year-picker/year-picker.types.ts +108 -0
- package/src/index.ts +3 -0
- package/src/style.css +1 -0
- package/tsconfig.json +13 -0
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useId, useUncontrolled } from "@refraktor/utils";
|
|
3
|
+
import { useEffect, useMemo, useState } from "react";
|
|
4
|
+
import { createClassNamesConfig, createComponentConfig, factory, useTheme, useClassNames, useProps } from "@refraktor/core";
|
|
5
|
+
import { getGridColumns, getPickerSizeStyles, PickerHeader } from "../picker-shared";
|
|
6
|
+
import { useDates } from "../dates-provider";
|
|
7
|
+
import { YearPicker } from "../year-picker";
|
|
8
|
+
const DEFAULT_COLUMNS = 3;
|
|
9
|
+
const DEFAULT_YEAR_PICKER_YEARS_PER_PAGE = 9;
|
|
10
|
+
const DEFAULT_YEAR_PICKER_COLUMNS = 3;
|
|
11
|
+
const MONTHS_IN_YEAR = 12;
|
|
12
|
+
const defaultProps = {
|
|
13
|
+
columns: DEFAULT_COLUMNS,
|
|
14
|
+
yearPickerYearsPerPage: DEFAULT_YEAR_PICKER_YEARS_PER_PAGE,
|
|
15
|
+
yearPickerColumns: DEFAULT_YEAR_PICKER_COLUMNS,
|
|
16
|
+
disabled: false,
|
|
17
|
+
size: "md",
|
|
18
|
+
radius: "default"
|
|
19
|
+
};
|
|
20
|
+
const isValidDate = (value) => value instanceof Date && !Number.isNaN(value.getTime());
|
|
21
|
+
const toSafeInteger = (value, fallback) => {
|
|
22
|
+
if (!Number.isFinite(value)) {
|
|
23
|
+
return fallback;
|
|
24
|
+
}
|
|
25
|
+
return Math.trunc(value);
|
|
26
|
+
};
|
|
27
|
+
const clamp = (value, min, max) => Math.min(max, Math.max(min, value));
|
|
28
|
+
const getBounds = (minYear, maxYear) => {
|
|
29
|
+
const hasMin = Number.isFinite(minYear);
|
|
30
|
+
const hasMax = Number.isFinite(maxYear);
|
|
31
|
+
const min = hasMin
|
|
32
|
+
? Math.trunc(minYear)
|
|
33
|
+
: Number.MIN_SAFE_INTEGER;
|
|
34
|
+
const max = hasMax
|
|
35
|
+
? Math.trunc(maxYear)
|
|
36
|
+
: Number.MAX_SAFE_INTEGER;
|
|
37
|
+
if (min <= max) {
|
|
38
|
+
return { min, max, hasMin, hasMax };
|
|
39
|
+
}
|
|
40
|
+
return {
|
|
41
|
+
min: max,
|
|
42
|
+
max: min,
|
|
43
|
+
hasMin,
|
|
44
|
+
hasMax
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
const createMonthValue = (baseDate, year, month) => {
|
|
48
|
+
const nextDate = new Date(baseDate);
|
|
49
|
+
nextDate.setFullYear(year, month, 1);
|
|
50
|
+
nextDate.setHours(0, 0, 0, 0);
|
|
51
|
+
return nextDate;
|
|
52
|
+
};
|
|
53
|
+
const isSameMonth = (first, second) => first.getFullYear() === second.getFullYear() &&
|
|
54
|
+
first.getMonth() === second.getMonth();
|
|
55
|
+
const MonthPicker = factory((_props, ref) => {
|
|
56
|
+
const { cx, getRadius } = useTheme();
|
|
57
|
+
const { createDate } = useDates();
|
|
58
|
+
const { id, value, defaultValue, onChange, minYear, maxYear, columns, yearPickerYearsPerPage, yearPickerColumns, disabled, size, radius, getMonthLabel, getMonthAriaLabel, getHeaderLabel, getNavigationAriaLabel, className, classNames, ...props } = useProps("MonthPicker", defaultProps, _props);
|
|
59
|
+
const classes = useClassNames("MonthPicker", classNames);
|
|
60
|
+
const _id = useId(id);
|
|
61
|
+
const today = new Date();
|
|
62
|
+
const currentYear = today.getFullYear();
|
|
63
|
+
const bounds = useMemo(() => getBounds(minYear, maxYear), [minYear, maxYear]);
|
|
64
|
+
const safeColumns = clamp(toSafeInteger(columns, DEFAULT_COLUMNS), 1, Math.min(6, MONTHS_IN_YEAR));
|
|
65
|
+
const safeYearPickerYearsPerPage = Math.max(1, toSafeInteger(yearPickerYearsPerPage, DEFAULT_YEAR_PICKER_YEARS_PER_PAGE));
|
|
66
|
+
const safeYearPickerColumns = clamp(toSafeInteger(yearPickerColumns, DEFAULT_YEAR_PICKER_COLUMNS), 1, Math.min(6, safeYearPickerYearsPerPage));
|
|
67
|
+
const [selectedDateState, setSelectedDate] = useUncontrolled({
|
|
68
|
+
value,
|
|
69
|
+
defaultValue,
|
|
70
|
+
finalValue: undefined,
|
|
71
|
+
onChange: (nextDate) => {
|
|
72
|
+
if (nextDate !== undefined) {
|
|
73
|
+
onChange?.(nextDate);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
const selectedDate = isValidDate(selectedDateState)
|
|
78
|
+
? selectedDateState
|
|
79
|
+
: undefined;
|
|
80
|
+
const selectedYear = selectedDate?.getFullYear();
|
|
81
|
+
const [displayedYear, setDisplayedYear] = useState(() => clamp(selectedYear ?? currentYear, bounds.min, bounds.max));
|
|
82
|
+
const [view, setView] = useState("month");
|
|
83
|
+
useEffect(() => {
|
|
84
|
+
setDisplayedYear((previousYear) => clamp(previousYear, bounds.min, bounds.max));
|
|
85
|
+
}, [bounds.max, bounds.min]);
|
|
86
|
+
useEffect(() => {
|
|
87
|
+
if (selectedYear === undefined) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
const normalizedYear = clamp(selectedYear, bounds.min, bounds.max);
|
|
91
|
+
setDisplayedYear((previousYear) => {
|
|
92
|
+
if (previousYear === normalizedYear) {
|
|
93
|
+
return previousYear;
|
|
94
|
+
}
|
|
95
|
+
return normalizedYear;
|
|
96
|
+
});
|
|
97
|
+
}, [bounds.max, bounds.min, selectedYear]);
|
|
98
|
+
const canGoPrevious = !disabled && (!bounds.hasMin || displayedYear > bounds.min);
|
|
99
|
+
const canGoNext = !disabled && (!bounds.hasMax || displayedYear < bounds.max);
|
|
100
|
+
const sizeStyles = getPickerSizeStyles(size);
|
|
101
|
+
const resolveNavigationLabel = (direction) => {
|
|
102
|
+
if (getNavigationAriaLabel) {
|
|
103
|
+
return getNavigationAriaLabel(direction, displayedYear);
|
|
104
|
+
}
|
|
105
|
+
return direction === "previous"
|
|
106
|
+
? `Show previous year (${displayedYear - 1})`
|
|
107
|
+
: `Show next year (${displayedYear + 1})`;
|
|
108
|
+
};
|
|
109
|
+
const monthItems = useMemo(() => Array.from({ length: MONTHS_IN_YEAR }, (_, month) => {
|
|
110
|
+
const dayjsMonth = createDate(new Date(displayedYear, month, 1));
|
|
111
|
+
return {
|
|
112
|
+
month,
|
|
113
|
+
label: getMonthLabel
|
|
114
|
+
? getMonthLabel(month, displayedYear, dayjsMonth.toDate())
|
|
115
|
+
: dayjsMonth.format("MMM"),
|
|
116
|
+
fullLabel: dayjsMonth.format("MMMM")
|
|
117
|
+
};
|
|
118
|
+
}), [createDate, displayedYear, getMonthLabel]);
|
|
119
|
+
const selectedMonth = selectedDate !== undefined && selectedDate.getFullYear() === displayedYear
|
|
120
|
+
? selectedDate.getMonth()
|
|
121
|
+
: undefined;
|
|
122
|
+
const resolveMonthAriaLabel = (month, isSelected) => {
|
|
123
|
+
if (getMonthAriaLabel) {
|
|
124
|
+
return getMonthAriaLabel(month, displayedYear, isSelected);
|
|
125
|
+
}
|
|
126
|
+
const fullMonthLabel = monthItems[month]?.fullLabel ?? `Month ${month + 1}`;
|
|
127
|
+
return isSelected
|
|
128
|
+
? `${fullMonthLabel} ${displayedYear}, selected`
|
|
129
|
+
: `Choose ${fullMonthLabel} ${displayedYear}`;
|
|
130
|
+
};
|
|
131
|
+
const handleMonthSelect = (month, year = displayedYear) => {
|
|
132
|
+
if (disabled) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
const normalizedMonth = clamp(month, 0, MONTHS_IN_YEAR - 1);
|
|
136
|
+
const normalizedYear = clamp(year, bounds.min, bounds.max);
|
|
137
|
+
setDisplayedYear(normalizedYear);
|
|
138
|
+
const baseDate = selectedDate ?? today;
|
|
139
|
+
const nextDate = createMonthValue(baseDate, normalizedYear, normalizedMonth);
|
|
140
|
+
if (selectedDate && isSameMonth(selectedDate, nextDate)) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
setSelectedDate(nextDate);
|
|
144
|
+
};
|
|
145
|
+
const shiftYear = (direction) => {
|
|
146
|
+
setDisplayedYear((previousYear) => clamp(previousYear + direction, bounds.min, bounds.max));
|
|
147
|
+
};
|
|
148
|
+
const handlePrevious = () => {
|
|
149
|
+
if (!canGoPrevious) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
shiftYear(-1);
|
|
153
|
+
};
|
|
154
|
+
const handleNext = () => {
|
|
155
|
+
if (!canGoNext) {
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
shiftYear(1);
|
|
159
|
+
};
|
|
160
|
+
const handleGridKeyDown = (event) => {
|
|
161
|
+
if (disabled) {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
const keyboardBaseMonth = selectedMonth ?? 0;
|
|
165
|
+
const keyboardSteps = {
|
|
166
|
+
ArrowLeft: -1,
|
|
167
|
+
ArrowRight: 1,
|
|
168
|
+
ArrowUp: -safeColumns,
|
|
169
|
+
ArrowDown: safeColumns
|
|
170
|
+
};
|
|
171
|
+
const step = keyboardSteps[event.key];
|
|
172
|
+
if (step !== undefined) {
|
|
173
|
+
event.preventDefault();
|
|
174
|
+
handleMonthSelect(keyboardBaseMonth + step);
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
if (event.key === "Home") {
|
|
178
|
+
event.preventDefault();
|
|
179
|
+
handleMonthSelect(0);
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
if (event.key === "End") {
|
|
183
|
+
event.preventDefault();
|
|
184
|
+
handleMonthSelect(MONTHS_IN_YEAR - 1);
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
if (event.key === "PageUp") {
|
|
188
|
+
event.preventDefault();
|
|
189
|
+
handleMonthSelect(keyboardBaseMonth, displayedYear - 1);
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
if (event.key === "PageDown") {
|
|
193
|
+
event.preventDefault();
|
|
194
|
+
handleMonthSelect(keyboardBaseMonth, displayedYear + 1);
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
const handleHeaderLabelClick = () => {
|
|
198
|
+
if (disabled) {
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
setView("year");
|
|
202
|
+
};
|
|
203
|
+
const handleYearSelect = (year) => {
|
|
204
|
+
setDisplayedYear(clamp(year, bounds.min, bounds.max));
|
|
205
|
+
setView("month");
|
|
206
|
+
};
|
|
207
|
+
const hasVisibleSelection = selectedMonth !== undefined;
|
|
208
|
+
return (_jsx("div", { ref: ref, id: _id, className: cx("inline-flex w-full flex-col gap-2 bg-[var(--refraktor-bg)] p-2", getRadius(radius), classes.root, className), ...props, children: view === "year" ? (_jsx(YearPicker, { value: displayedYear, onChange: handleYearSelect, minYear: minYear, maxYear: maxYear, yearsPerPage: safeYearPickerYearsPerPage, columns: safeYearPickerColumns, disabled: disabled, size: size, radius: radius, className: cx("bg-transparent p-0", classes.yearPicker) })) : (_jsxs(_Fragment, { children: [_jsx(PickerHeader, { label: getHeaderLabel ? getHeaderLabel(displayedYear) : displayedYear, onPrevious: handlePrevious, onNext: handleNext, onLabelClick: disabled ? undefined : handleHeaderLabelClick, previousDisabled: !canGoPrevious, nextDisabled: !canGoNext, previousLabel: resolveNavigationLabel("previous"), nextLabel: resolveNavigationLabel("next"), size: size, radius: radius, classNames: {
|
|
209
|
+
root: classes.header,
|
|
210
|
+
controls: classes.headerControls,
|
|
211
|
+
control: classes.headerControl,
|
|
212
|
+
previousControl: classes.headerPreviousControl,
|
|
213
|
+
nextControl: classes.headerNextControl,
|
|
214
|
+
label: classes.headerLabel
|
|
215
|
+
} }), _jsx("div", { role: "grid", "aria-label": `Month picker, ${displayedYear}`, className: cx("grid", getGridColumns(safeColumns), sizeStyles.gridGap, classes.grid), onKeyDown: handleGridKeyDown, children: monthItems.map(({ month, label }) => {
|
|
216
|
+
const isSelected = month === selectedMonth;
|
|
217
|
+
const tabIndex = isSelected || (!hasVisibleSelection && month === 0)
|
|
218
|
+
? 0
|
|
219
|
+
: -1;
|
|
220
|
+
return (_jsx("button", { type: "button", role: "gridcell", "aria-selected": isSelected, "aria-label": resolveMonthAriaLabel(month, isSelected), tabIndex: tabIndex, "data-active": isSelected, "data-disabled": disabled, disabled: disabled, className: cx("inline-flex items-center justify-center font-medium text-[var(--refraktor-text)] transition-colors", isSelected
|
|
221
|
+
? "bg-[var(--refraktor-primary)] text-[var(--refraktor-primary-text)]"
|
|
222
|
+
: "hover:bg-[var(--refraktor-bg-hover)]", disabled &&
|
|
223
|
+
"pointer-events-none cursor-not-allowed opacity-50 data-[disabled=true]:pointer-events-none", sizeStyles.cell, getRadius(radius), classes.month, isSelected && classes.monthActive), onClick: () => handleMonthSelect(month), children: label }, month));
|
|
224
|
+
}) })] })) }));
|
|
225
|
+
});
|
|
226
|
+
MonthPicker.displayName = "@refraktor/dates/MonthPicker";
|
|
227
|
+
MonthPicker.configure = createComponentConfig();
|
|
228
|
+
MonthPicker.classNames = createClassNamesConfig();
|
|
229
|
+
export default MonthPicker;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef, ReactNode } from "react";
|
|
2
|
+
import { RefraktorRadius, RefraktorSize, createClassNamesConfig, createComponentConfig, FactoryPayload } from "@refraktor/core";
|
|
3
|
+
export type MonthPickerValue = Date;
|
|
4
|
+
export type MonthPickerSize = RefraktorSize;
|
|
5
|
+
export type MonthPickerRadius = RefraktorRadius;
|
|
6
|
+
export type MonthPickerNavigationDirection = "previous" | "next";
|
|
7
|
+
export type MonthPickerOnChange = (value: MonthPickerValue) => void;
|
|
8
|
+
export type MonthPickerGetMonthLabel = (month: number, year: number, value: Date) => ReactNode;
|
|
9
|
+
export type MonthPickerGetMonthAriaLabel = (month: number, year: number, selected: boolean) => string;
|
|
10
|
+
export type MonthPickerGetHeaderLabel = (year: number) => ReactNode;
|
|
11
|
+
export type MonthPickerGetNavigationAriaLabel = (direction: MonthPickerNavigationDirection, year: number) => string;
|
|
12
|
+
export type MonthPickerClassNames = {
|
|
13
|
+
root?: string;
|
|
14
|
+
header?: string;
|
|
15
|
+
headerControls?: string;
|
|
16
|
+
headerControl?: string;
|
|
17
|
+
headerPreviousControl?: string;
|
|
18
|
+
headerNextControl?: string;
|
|
19
|
+
headerLabel?: string;
|
|
20
|
+
grid?: string;
|
|
21
|
+
month?: string;
|
|
22
|
+
monthActive?: string;
|
|
23
|
+
yearPicker?: string;
|
|
24
|
+
};
|
|
25
|
+
export interface MonthPickerProps extends Omit<ComponentPropsWithoutRef<"div">, "onChange" | "value" | "defaultValue"> {
|
|
26
|
+
/** Active month (controlled). */
|
|
27
|
+
value?: MonthPickerValue;
|
|
28
|
+
/** Initial active month (uncontrolled). */
|
|
29
|
+
defaultValue?: MonthPickerValue;
|
|
30
|
+
/** Callback called when active month changes. */
|
|
31
|
+
onChange?: MonthPickerOnChange;
|
|
32
|
+
/** Minimum available year in month and year views. */
|
|
33
|
+
minYear?: number;
|
|
34
|
+
/** Maximum available year in month and year views. */
|
|
35
|
+
maxYear?: number;
|
|
36
|
+
/** Grid columns used by the month list @default `3` */
|
|
37
|
+
columns?: number;
|
|
38
|
+
/** Year picker years rendered in one page @default `9` */
|
|
39
|
+
yearPickerYearsPerPage?: number;
|
|
40
|
+
/** Year picker columns @default `3` */
|
|
41
|
+
yearPickerColumns?: number;
|
|
42
|
+
/** Whether all controls are disabled @default `false` */
|
|
43
|
+
disabled?: boolean;
|
|
44
|
+
/** Component size @default `md` */
|
|
45
|
+
size?: MonthPickerSize;
|
|
46
|
+
/** Border radius @default `default` */
|
|
47
|
+
radius?: MonthPickerRadius;
|
|
48
|
+
/** Custom month label renderer. */
|
|
49
|
+
getMonthLabel?: MonthPickerGetMonthLabel;
|
|
50
|
+
/** Custom aria-label generator for month buttons. */
|
|
51
|
+
getMonthAriaLabel?: MonthPickerGetMonthAriaLabel;
|
|
52
|
+
/** Custom header label renderer for visible year. */
|
|
53
|
+
getHeaderLabel?: MonthPickerGetHeaderLabel;
|
|
54
|
+
/** Custom aria-label generator for previous/next controls. */
|
|
55
|
+
getNavigationAriaLabel?: MonthPickerGetNavigationAriaLabel;
|
|
56
|
+
/** Used for editing root class name. */
|
|
57
|
+
className?: string;
|
|
58
|
+
/** Used for styling different parts of the component. */
|
|
59
|
+
classNames?: MonthPickerClassNames;
|
|
60
|
+
}
|
|
61
|
+
export interface MonthPickerFactoryPayload extends FactoryPayload {
|
|
62
|
+
props: MonthPickerProps;
|
|
63
|
+
ref: HTMLDivElement;
|
|
64
|
+
compound: {
|
|
65
|
+
configure: ReturnType<typeof createComponentConfig<MonthPickerProps>>;
|
|
66
|
+
classNames: ReturnType<typeof createClassNamesConfig<MonthPickerClassNames>>;
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=month-picker.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"month-picker.types.d.ts","sourceRoot":"","sources":["../../../src/components/month-picker/month-picker.types.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as PickerHeader } from "./picker-header";
|
|
2
|
+
export type { PickerHeaderClassNames, PickerHeaderProps } from "./picker-header.types";
|
|
3
|
+
export { getGridColumns, getPickerSizeStyles } from "./picker.styles";
|
|
4
|
+
export type { PickerRadius, PickerSize } from "./picker.types";
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/picker-shared/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC1D,YAAY,EACR,sBAAsB,EACtB,iBAAiB,EACpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtE,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"picker-header.d.ts","sourceRoot":"","sources":["../../../src/components/picker-shared/picker-header.tsx"],"names":[],"mappings":"AASA,OAAO,EAEH,0BAA0B,EAE7B,MAAM,uBAAuB,CAAC;AAoC/B,QAAA,MAAM,YAAY,0EA0HhB,CAAC;AAMH,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { createClassNamesConfig, createComponentConfig, factory, useTheme, useClassNames, useProps } from "@refraktor/core";
|
|
3
|
+
import { getPickerSizeStyles } from "./picker.styles";
|
|
4
|
+
const defaultProps = {
|
|
5
|
+
previousDisabled: false,
|
|
6
|
+
nextDisabled: false,
|
|
7
|
+
previousLabel: "Show previous period",
|
|
8
|
+
nextLabel: "Show next period",
|
|
9
|
+
size: "md",
|
|
10
|
+
radius: "default"
|
|
11
|
+
};
|
|
12
|
+
const ChevronIcon = ({ direction, size }) => (_jsx("svg", { "aria-hidden": "true", viewBox: "0 0 16 16", fill: "none", width: size, height: size, className: direction === "right" ? "rotate-180" : undefined, children: _jsx("path", { d: "M9.5 3.5L5 8l4.5 4.5", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
13
|
+
const PickerHeader = factory((_props, ref) => {
|
|
14
|
+
const { cx, getRadius } = useTheme();
|
|
15
|
+
const { label, onPrevious, onNext, onLabelClick, previousDisabled, nextDisabled, previousLabel, nextLabel, size, radius, className, classNames, ...props } = useProps("PickerHeader", defaultProps, _props);
|
|
16
|
+
const classes = useClassNames("PickerHeader", classNames);
|
|
17
|
+
const sizeStyles = getPickerSizeStyles(size);
|
|
18
|
+
const radiusStyles = getRadius(radius);
|
|
19
|
+
const isPreviousDisabled = previousDisabled || !onPrevious;
|
|
20
|
+
const isNextDisabled = nextDisabled || !onNext;
|
|
21
|
+
const getStyles = (part) => classes[part];
|
|
22
|
+
return (_jsxs("div", { ref: ref, className: cx("flex items-center justify-between gap-2", getStyles("root"), className), ...props, children: [_jsx("div", { className: cx("inline-flex shrink-0 items-center gap-1", getStyles("controls")), children: _jsx("button", { type: "button", "aria-label": previousLabel, "aria-disabled": isPreviousDisabled, "data-disabled": isPreviousDisabled, disabled: isPreviousDisabled, onClick: onPrevious, className: cx("inline-flex items-center justify-center cursor-pointer", "text-[var(--refraktor-text)] transition-colors hover:bg-[var(--refraktor-bg-hover)]", "data-[disabled=true]:pointer-events-none data-[disabled=true]:cursor-not-allowed data-[disabled=true]:opacity-50", sizeStyles.control, radiusStyles, getStyles("control"), getStyles("previousControl")), children: _jsx(ChevronIcon, { direction: "left", size: sizeStyles.iconSize }) }) }), _jsx("div", { className: cx("min-w-0 flex-1 truncate text-center font-medium text-[var(--refraktor-text)]", sizeStyles.label, getStyles("label")), children: onLabelClick ? (_jsx("button", { type: "button", onClick: onLabelClick, className: cx("inline-flex w-full cursor-pointer items-center justify-center text-center transition-colors hover:bg-[var(--refraktor-bg-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--refraktor-primary)]", sizeStyles.labelButton, radiusStyles, getStyles("labelButton")), children: _jsx("span", { className: cx("truncate", getStyles("labelText")), children: label }) })) : (_jsx("span", { className: cx("truncate", getStyles("labelText")), children: label })) }), _jsx("div", { className: cx("inline-flex shrink-0 items-center gap-1", getStyles("controls")), children: _jsx("button", { type: "button", "aria-label": nextLabel, "aria-disabled": isNextDisabled, "data-disabled": isNextDisabled, disabled: isNextDisabled, onClick: onNext, className: cx("inline-flex items-center justify-center cursor-pointer", "text-[var(--refraktor-text)] transition-colors hover:bg-[var(--refraktor-bg-hover)]", "data-[disabled=true]:pointer-events-none data-[disabled=true]:cursor-not-allowed data-[disabled=true]:opacity-50", sizeStyles.control, radiusStyles, getStyles("control"), getStyles("nextControl")), children: _jsx(ChevronIcon, { direction: "right", size: sizeStyles.iconSize }) }) })] }));
|
|
23
|
+
});
|
|
24
|
+
PickerHeader.displayName = "@refraktor/dates/PickerHeader";
|
|
25
|
+
PickerHeader.configure = createComponentConfig();
|
|
26
|
+
PickerHeader.classNames = createClassNamesConfig();
|
|
27
|
+
export default PickerHeader;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef, MouseEventHandler, ReactNode } from "react";
|
|
2
|
+
import { createClassNamesConfig, createComponentConfig, FactoryPayload } from "@refraktor/core";
|
|
3
|
+
import { PickerRadius, PickerSize } from "./picker.types";
|
|
4
|
+
export type PickerHeaderClassNames = {
|
|
5
|
+
root?: string;
|
|
6
|
+
controls?: string;
|
|
7
|
+
control?: string;
|
|
8
|
+
previousControl?: string;
|
|
9
|
+
nextControl?: string;
|
|
10
|
+
label?: string;
|
|
11
|
+
labelButton?: string;
|
|
12
|
+
labelText?: string;
|
|
13
|
+
};
|
|
14
|
+
export interface PickerHeaderProps extends Omit<ComponentPropsWithoutRef<"div">, "children"> {
|
|
15
|
+
label: ReactNode;
|
|
16
|
+
onPrevious?: () => void;
|
|
17
|
+
onNext?: () => void;
|
|
18
|
+
onLabelClick?: MouseEventHandler<HTMLButtonElement>;
|
|
19
|
+
previousDisabled?: boolean;
|
|
20
|
+
nextDisabled?: boolean;
|
|
21
|
+
previousLabel?: string;
|
|
22
|
+
nextLabel?: string;
|
|
23
|
+
size?: PickerSize;
|
|
24
|
+
radius?: PickerRadius;
|
|
25
|
+
className?: string;
|
|
26
|
+
classNames?: PickerHeaderClassNames;
|
|
27
|
+
}
|
|
28
|
+
export interface PickerHeaderFactoryPayload extends FactoryPayload {
|
|
29
|
+
props: PickerHeaderProps;
|
|
30
|
+
ref: HTMLDivElement;
|
|
31
|
+
compound: {
|
|
32
|
+
configure: ReturnType<typeof createComponentConfig<PickerHeaderProps>>;
|
|
33
|
+
classNames: ReturnType<typeof createClassNamesConfig<PickerHeaderClassNames>>;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=picker-header.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"picker-header.types.d.ts","sourceRoot":"","sources":["../../../src/components/picker-shared/picker-header.types.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,wBAAwB,EACxB,iBAAiB,EACjB,SAAS,EACZ,MAAM,OAAO,CAAC;AACf,OAAO,EACH,sBAAsB,EACtB,qBAAqB,EACrB,cAAc,EACjB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE1D,MAAM,MAAM,sBAAsB,GAAG;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,WAAW,iBACb,SAAQ,IAAI,CAAC,wBAAwB,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC;IACzD,KAAK,EAAE,SAAS,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,YAAY,CAAC,EAAE,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IACpD,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,sBAAsB,CAAC;CACvC;AAED,MAAM,WAAW,0BAA2B,SAAQ,cAAc;IAC9D,KAAK,EAAE,iBAAiB,CAAC;IACzB,GAAG,EAAE,cAAc,CAAC;IACpB,QAAQ,EAAE;QACN,SAAS,EAAE,UAAU,CAAC,OAAO,qBAAqB,CAAC,iBAAiB,CAAC,CAAC,CAAC;QACvE,UAAU,EAAE,UAAU,CAClB,OAAO,sBAAsB,CAAC,sBAAsB,CAAC,CACxD,CAAC;KACL,CAAC;CACL"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { PickerSize } from "./picker.types";
|
|
2
|
+
export type PickerSizeStyles = {
|
|
3
|
+
control: string;
|
|
4
|
+
label: string;
|
|
5
|
+
labelButton: string;
|
|
6
|
+
cell: string;
|
|
7
|
+
gridGap: string;
|
|
8
|
+
iconSize: number;
|
|
9
|
+
};
|
|
10
|
+
export declare const getPickerSizeStyles: (size?: PickerSize) => PickerSizeStyles;
|
|
11
|
+
export declare const getGridColumns: (columns: number) => string;
|
|
12
|
+
//# sourceMappingURL=picker.styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"picker.styles.d.ts","sourceRoot":"","sources":["../../../src/components/picker-shared/picker.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,MAAM,MAAM,gBAAgB,GAAG;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CACpB,CAAC;AAuDF,eAAO,MAAM,mBAAmB,GAAI,OAAM,UAAiB,qBACpB,CAAC;AAExC,eAAO,MAAM,cAAc,GAAI,SAAS,MAAM,WACJ,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
const pickerSizes = {
|
|
2
|
+
xs: {
|
|
3
|
+
control: "size-6 text-xs",
|
|
4
|
+
label: "text-xs",
|
|
5
|
+
labelButton: "py-0.5 px-1",
|
|
6
|
+
cell: "h-7 px-1 text-xs",
|
|
7
|
+
gridGap: "gap-1",
|
|
8
|
+
iconSize: 12
|
|
9
|
+
},
|
|
10
|
+
sm: {
|
|
11
|
+
control: "size-7 text-xs",
|
|
12
|
+
label: "text-xs",
|
|
13
|
+
labelButton: "py-0.5 px-1",
|
|
14
|
+
cell: "h-8 px-1.5 text-xs",
|
|
15
|
+
gridGap: "gap-1",
|
|
16
|
+
iconSize: 14
|
|
17
|
+
},
|
|
18
|
+
md: {
|
|
19
|
+
control: "size-8 text-sm",
|
|
20
|
+
label: "text-sm",
|
|
21
|
+
labelButton: "py-1 px-1.5",
|
|
22
|
+
cell: "h-9 px-2 text-sm",
|
|
23
|
+
gridGap: "gap-1.5",
|
|
24
|
+
iconSize: 16
|
|
25
|
+
},
|
|
26
|
+
lg: {
|
|
27
|
+
control: "size-9 text-base",
|
|
28
|
+
label: "text-base",
|
|
29
|
+
labelButton: "py-1 px-2",
|
|
30
|
+
cell: "h-10 px-2.5 text-base",
|
|
31
|
+
gridGap: "gap-2",
|
|
32
|
+
iconSize: 18
|
|
33
|
+
},
|
|
34
|
+
xl: {
|
|
35
|
+
control: "size-10 text-lg",
|
|
36
|
+
label: "text-lg",
|
|
37
|
+
labelButton: "py-1.5 px-2.5",
|
|
38
|
+
cell: "h-11 px-3 text-lg",
|
|
39
|
+
gridGap: "gap-2",
|
|
40
|
+
iconSize: 20
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
const gridColumns = {
|
|
44
|
+
1: "grid-cols-1",
|
|
45
|
+
2: "grid-cols-2",
|
|
46
|
+
3: "grid-cols-3",
|
|
47
|
+
4: "grid-cols-4",
|
|
48
|
+
5: "grid-cols-5",
|
|
49
|
+
6: "grid-cols-6",
|
|
50
|
+
7: "grid-cols-7"
|
|
51
|
+
};
|
|
52
|
+
export const getPickerSizeStyles = (size = "md") => pickerSizes[size] ?? pickerSizes.md;
|
|
53
|
+
export const getGridColumns = (columns) => gridColumns[columns] ?? gridColumns[4];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"picker.types.d.ts","sourceRoot":"","sources":["../../../src/components/picker-shared/picker.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEtE,MAAM,MAAM,YAAY,GAAG,eAAe,CAAC;AAC3C,MAAM,MAAM,UAAU,GAAG,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { default as YearInput } from "./year-input";
|
|
2
|
+
export type { YearInputClassNames, YearInputFactoryPayload, YearInputMiddlewares, YearInputOnChange, YearInputPositioning, YearInputProps, YearInputRadius, YearInputSize, YearInputValue, YearInputValueFormat } from "./year-input.types";
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/year-input/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,cAAc,CAAC;AACpD,YAAY,EACR,mBAAmB,EACnB,uBAAuB,EACvB,oBAAoB,EACpB,iBAAiB,EACjB,oBAAoB,EACpB,cAAc,EACd,eAAe,EACf,aAAa,EACb,cAAc,EACd,oBAAoB,EACvB,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as YearInput } from "./year-input";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"year-input.d.ts","sourceRoot":"","sources":["../../../src/components/year-input/year-input.tsx"],"names":[],"mappings":"AA6BA,OAAO,EAEH,uBAAuB,EAE1B,MAAM,oBAAoB,CAAC;AAkC5B,QAAA,MAAM,SAAS,uEAiRb,CAAC;AAMH,eAAe,SAAS,CAAC"}
|