@uxf/ui 11.112.1 → 11.114.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/avatar-file-input/avatar-file-input.stories.js +0 -2
- package/button/button.stories.js +0 -2
- package/button-group/button-group.stories.js +0 -1
- package/button-list/button-list.js +1 -1
- package/button-list/button-list.stories.js +0 -6
- package/date-picker/date-picker-content.js +0 -1
- package/date-picker/date-picker.spec.js +1 -1
- package/date-picker/date-picker.stories.d.ts +42 -1
- package/date-picker/date-picker.stories.js +205 -49
- package/date-range-picker/date-range-picker-content.js +0 -1
- package/date-range-picker/date-range-picker.spec.js +1 -1
- package/date-range-picker/date-range-picker.stories.d.ts +57 -1
- package/date-range-picker/date-range-picker.stories.js +223 -26
- package/dropdown/dropdown.js +0 -1
- package/file-input/file-input.stories.js +0 -1
- package/icon-button/icon-button.js +0 -1
- package/icon-button/icon-button.stories.js +0 -1
- package/input/input.js +1 -0
- package/list-item/list-item.js +0 -1
- package/list-item/list-item.stories.js +0 -1
- package/message/message.stories.js +0 -3
- package/multi-combobox/multi-combobox.stories.js +0 -2
- package/multi-select/multi-select.stories.js +0 -1
- package/package.json +11 -11
- package/select/select.stories.js +0 -1
- package/text-link/text-link.js +0 -1
- package/text-link/text-link.stories.js +0 -1
- package/time-picker/time-picker-hour.js +0 -1
- package/time-picker/time-picker-minute.js +0 -1
|
@@ -42,13 +42,11 @@ function Default() {
|
|
|
42
42
|
const [value, setValue] = (0, react_1.useState)(null);
|
|
43
43
|
const onChange = (0, action_1.action)("onChange", (v) => {
|
|
44
44
|
return new Promise(() => {
|
|
45
|
-
// eslint-disable-next-line no-console
|
|
46
45
|
console.log("Changed:", v);
|
|
47
46
|
setValue(v);
|
|
48
47
|
});
|
|
49
48
|
});
|
|
50
49
|
const onUploadError = (err) => {
|
|
51
|
-
// eslint-disable-next-line no-console
|
|
52
50
|
console.log("Upload error", err);
|
|
53
51
|
};
|
|
54
52
|
return (react_1.default.createElement("div", { className: "space-y-4 p-20" },
|
package/button/button.stories.js
CHANGED
|
@@ -45,7 +45,6 @@ function Basic() {
|
|
|
45
45
|
const [isDisabled, setIsDisabled] = (0, react_1.useState)(false);
|
|
46
46
|
const [isLoading, setIsLoading] = (0, react_1.useState)(false);
|
|
47
47
|
const config = (0, storybook_config_1.useStorybookConfig)("Button");
|
|
48
|
-
// eslint-disable-next-line no-console
|
|
49
48
|
const onClick = console.log;
|
|
50
49
|
const gridColumnsCount = config.variants.length * config.sizes.length + 1;
|
|
51
50
|
const gridTemplateColumns = `repeat(${gridColumnsCount}, 180px)`;
|
|
@@ -73,7 +72,6 @@ function Basic() {
|
|
|
73
72
|
}
|
|
74
73
|
function Default() {
|
|
75
74
|
const config = (0, storybook_config_1.useStorybookConfig)("Button");
|
|
76
|
-
// eslint-disable-next-line no-console
|
|
77
75
|
const onClick = console.log;
|
|
78
76
|
return (react_1.default.createElement("div", { className: "space-y-2 p-20" }, config.variants.map((variant) => (react_1.default.createElement(react_1.Fragment, { key: variant }, config.colors.map((color) => (react_1.default.createElement(react_1.Fragment, { key: color }, config.sizes.map((size) => (react_1.default.createElement("div", { className: "space-y-2 pb-4", key: `${size}${color}${variant}` },
|
|
79
77
|
react_1.default.createElement("div", { className: "text-sm dark:text-gray-100" },
|
|
@@ -10,7 +10,6 @@ const icon_1 = require("../icon");
|
|
|
10
10
|
const tooltip_1 = require("../tooltip");
|
|
11
11
|
const index_1 = require("./index");
|
|
12
12
|
function Default() {
|
|
13
|
-
// eslint-disable-next-line no-console
|
|
14
13
|
const onClick = console.log;
|
|
15
14
|
const component = (react_1.default.createElement(react_1.default.Fragment, null,
|
|
16
15
|
react_1.default.createElement(index_1.ButtonGroup, null,
|
|
@@ -46,7 +46,7 @@ const button_1 = require("../button");
|
|
|
46
46
|
const use_dropdown_1 = require("../hooks/use-dropdown");
|
|
47
47
|
const icon_1 = require("../icon");
|
|
48
48
|
const MenuButton = (0, react_3.forwardRef)((props, ref) => {
|
|
49
|
-
// eslint-disable-next-line
|
|
49
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
50
50
|
const { as = "a", variant, color, isIconButton, isFullWidth, size, icon, label, className, ...restProps } = props;
|
|
51
51
|
const Component = as;
|
|
52
52
|
const anchorProps = (0, use_anchor_props_1.useAnchorProps)({
|
|
@@ -30,27 +30,21 @@ function Default() {
|
|
|
30
30
|
], variant: "secondary", visibleButtonsCount: 4 }),
|
|
31
31
|
react_1.default.createElement(index_1.ButtonList, { buttons: [
|
|
32
32
|
{ label: "IconButton", isIconButton: true, icon: "camera" },
|
|
33
|
-
// eslint-disable-next-line no-console
|
|
34
33
|
{ label: "First item", onClick: console.log },
|
|
35
34
|
{ label: "Second item", color: "positive" },
|
|
36
35
|
{ label: "Third item" },
|
|
37
|
-
// eslint-disable-next-line no-console
|
|
38
36
|
{ label: "Fourth item", onClick: console.log },
|
|
39
37
|
], visibleButtonsCount: 3 }),
|
|
40
38
|
react_1.default.createElement(index_1.ButtonList, { buttons: [
|
|
41
|
-
// eslint-disable-next-line no-console
|
|
42
39
|
{ icon: "check", label: "First item", onClick: console.log },
|
|
43
40
|
{ icon: "user", label: "Second item", color: "positive" },
|
|
44
41
|
{ icon: "cloud", label: "Third item" },
|
|
45
|
-
// eslint-disable-next-line no-console
|
|
46
42
|
{ icon: "xmarkLarge", label: "Fourth item", onClick: console.log },
|
|
47
43
|
], color: "negative", openButton: empty_object_1.EMPTY_OBJECT, size: "sm", variant: "secondary", visibleButtonsCount: 1 }),
|
|
48
44
|
react_1.default.createElement(index_1.ButtonList, { buttons: [
|
|
49
|
-
// eslint-disable-next-line no-console
|
|
50
45
|
{ icon: "check", label: "First item", onClick: console.log, color: "negative" },
|
|
51
46
|
{ icon: "user", label: "Second item", color: "positive", size: "default" },
|
|
52
47
|
{ icon: "cloud", label: "Third item" },
|
|
53
|
-
// eslint-disable-next-line no-console
|
|
54
48
|
{ icon: "xmarkLarge", label: "Fourth item", onClick: console.log },
|
|
55
49
|
], color: "positive", openButton: { variant: "secondary", color: "default" }, size: "sm", visibleButtonsCount: 3 })));
|
|
56
50
|
return (react_1.default.createElement("div", { className: "flex flex-col lg:flex-row" },
|
|
@@ -40,7 +40,6 @@ const date_picker_decade_1 = require("./date-picker-decade");
|
|
|
40
40
|
const date_picker_month_1 = require("./date-picker-month");
|
|
41
41
|
const date_picker_year_1 = require("./date-picker-year");
|
|
42
42
|
const DatePickerContent = (props) => {
|
|
43
|
-
// eslint-disable-next-line react/destructuring-assignment
|
|
44
43
|
const { goToDate, activeMonths } = (0, react_1.useContext)(date_picker_context_1.DatePickerContext);
|
|
45
44
|
const onMonthChange = props.onMonthChange;
|
|
46
45
|
const [viewMode, setViewMode] = (0, react_1.useState)("month");
|
|
@@ -6,4 +6,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const react_1 = __importDefault(require("react"));
|
|
7
7
|
const snap_test_1 = require("../utils/snap-test");
|
|
8
8
|
const date_picker_stories_1 = require("./date-picker.stories");
|
|
9
|
-
(0, snap_test_1.snapTest)("render stories", react_1.default.createElement(date_picker_stories_1.
|
|
9
|
+
(0, snap_test_1.snapTest)("render stories", react_1.default.createElement(date_picker_stories_1.Basic, null));
|
|
@@ -1,2 +1,43 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
|
|
2
|
+
/** Minimal date picker with no constraints. Select any date and it is logged to console. */
|
|
3
|
+
export declare function Basic(): React.JSX.Element;
|
|
4
|
+
/** Opens with today pre-selected so the user can see the highlighted state immediately. */
|
|
5
|
+
export declare function PreSelected(): React.JSX.Element;
|
|
6
|
+
/**
|
|
7
|
+
* Only dates within the selectable range are available.
|
|
8
|
+
* Dates outside appear dimmed and cannot be chosen.
|
|
9
|
+
*/
|
|
10
|
+
export declare function MinMaxDates(): React.JSX.Element;
|
|
11
|
+
/**
|
|
12
|
+
* Today and a cluster of dates next week are marked as unavailable.
|
|
13
|
+
* They appear crossed-out and cannot be selected even though they are within min/max.
|
|
14
|
+
*/
|
|
15
|
+
export declare function UnavailableDates(): React.JSX.Element;
|
|
16
|
+
/**
|
|
17
|
+
* datesConfig lets you attach custom CSS flags to date cells and disable whole groups.
|
|
18
|
+
*
|
|
19
|
+
* - flag-1 (selectable): +1 / +2
|
|
20
|
+
* - flag-2 (disabled): +4 / +5
|
|
21
|
+
* - no flag (disabled): +8
|
|
22
|
+
*/
|
|
23
|
+
export declare function DatesConfigFlags(): React.JSX.Element;
|
|
24
|
+
/**
|
|
25
|
+
* Combines a tight date window with several unavailable dates inside that window.
|
|
26
|
+
* Useful for availability calendars where only a handful of slots remain.
|
|
27
|
+
*/
|
|
28
|
+
export declare function MinMaxWithUnavailable(): React.JSX.Element;
|
|
29
|
+
/**
|
|
30
|
+
* The `bottomContent` prop renders arbitrary JSX below the calendar grid.
|
|
31
|
+
* Useful for legends, CTAs, or pricing summaries.
|
|
32
|
+
*/
|
|
33
|
+
export declare function WithBottomContent(): React.JSX.Element;
|
|
34
|
+
/**
|
|
35
|
+
* `onMonthChange` fires whenever the user navigates to a different month.
|
|
36
|
+
* The currently visible month is displayed below the description.
|
|
37
|
+
*/
|
|
38
|
+
export declare function OnMonthChange(): React.JSX.Element;
|
|
39
|
+
/**
|
|
40
|
+
* Kitchen-sink story combining min/max, unavailable dates, datesConfig flags,
|
|
41
|
+
* bottom content, and onMonthChange — useful for regression testing the full API.
|
|
42
|
+
*/
|
|
43
|
+
export declare function AllFeatures(): React.JSX.Element;
|
|
@@ -33,57 +33,213 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.
|
|
37
|
-
|
|
36
|
+
exports.Basic = Basic;
|
|
37
|
+
exports.PreSelected = PreSelected;
|
|
38
|
+
exports.MinMaxDates = MinMaxDates;
|
|
39
|
+
exports.UnavailableDates = UnavailableDates;
|
|
40
|
+
exports.DatesConfigFlags = DatesConfigFlags;
|
|
41
|
+
exports.MinMaxWithUnavailable = MinMaxWithUnavailable;
|
|
42
|
+
exports.WithBottomContent = WithBottomContent;
|
|
43
|
+
exports.OnMonthChange = OnMonthChange;
|
|
44
|
+
exports.AllFeatures = AllFeatures;
|
|
45
|
+
const date_string_1 = require("@uxf/datepicker/utils/date-string");
|
|
38
46
|
const react_1 = __importStar(require("react"));
|
|
39
47
|
const action_1 = require("../utils/action");
|
|
40
48
|
const date_picker_1 = require("./date-picker");
|
|
41
|
-
|
|
42
|
-
const
|
|
43
|
-
const
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
today.add(7, "days").toDate(),
|
|
49
|
-
today.add(11, "days").toDate(),
|
|
50
|
-
today.add(12, "days").toDate(),
|
|
51
|
-
];
|
|
52
|
-
const datesConfig = [
|
|
53
|
-
{
|
|
54
|
-
flag: "flag-1",
|
|
55
|
-
dates: [today.add(5, "days").toDate(), today.add(6, "days").toDate()],
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
flag: "flag-2",
|
|
59
|
-
dates: [today.add(3, "days").toDate(), today.add(4, "days").toDate()],
|
|
60
|
-
isDisabled: true,
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
dates: [today.add(8, "days").toDate()],
|
|
64
|
-
isDisabled: true,
|
|
65
|
-
},
|
|
66
|
-
];
|
|
67
|
-
function Default() {
|
|
49
|
+
// Build all demo dates relative to today using timezone-safe arithmetic
|
|
50
|
+
const todayStr = (0, date_string_1.todayDateString)();
|
|
51
|
+
const d = (n) => (0, date_string_1.fromDateString)((0, date_string_1.addDays)(todayStr, n));
|
|
52
|
+
const s = (n) => (0, date_string_1.addDays)(todayStr, n); // DateString for use in descriptions
|
|
53
|
+
// ─── Basic usage ───────────────────────────────────────────────────────────────
|
|
54
|
+
/** Minimal date picker with no constraints. Select any date and it is logged to console. */
|
|
55
|
+
function Basic() {
|
|
68
56
|
const [value, setValue] = (0, react_1.useState)(null);
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
react_1.default.createElement(date_picker_1.DatePicker, {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
57
|
+
return (react_1.default.createElement("div", { className: "space-y-2 p-8" },
|
|
58
|
+
react_1.default.createElement("p", { className: "text-sm text-gray-500" }, "Select any date \u2014 no constraints applied."),
|
|
59
|
+
react_1.default.createElement(date_picker_1.DatePicker, { onChange: (0, action_1.action)("onChange", setValue), selectedDate: value })));
|
|
60
|
+
}
|
|
61
|
+
// ─── Pre-selected date ─────────────────────────────────────────────────────────
|
|
62
|
+
/** Opens with today pre-selected so the user can see the highlighted state immediately. */
|
|
63
|
+
function PreSelected() {
|
|
64
|
+
const [value, setValue] = (0, react_1.useState)(d(0));
|
|
65
|
+
return (react_1.default.createElement("div", { className: "space-y-2 p-8" },
|
|
66
|
+
react_1.default.createElement("p", { className: "text-sm text-gray-500" },
|
|
67
|
+
s(0),
|
|
68
|
+
" (today) is pre-selected on mount."),
|
|
69
|
+
react_1.default.createElement(date_picker_1.DatePicker, { onChange: (0, action_1.action)("onChange", setValue), selectedDate: value })));
|
|
70
|
+
}
|
|
71
|
+
// ─── Min / max date constraints ────────────────────────────────────────────────
|
|
72
|
+
/**
|
|
73
|
+
* Only dates within the selectable range are available.
|
|
74
|
+
* Dates outside appear dimmed and cannot be chosen.
|
|
75
|
+
*/
|
|
76
|
+
function MinMaxDates() {
|
|
77
|
+
const [value, setValue] = (0, react_1.useState)(null);
|
|
78
|
+
return (react_1.default.createElement("div", { className: "space-y-2 p-8" },
|
|
79
|
+
react_1.default.createElement("p", { className: "text-sm text-gray-500" },
|
|
80
|
+
"Selectable range: ",
|
|
81
|
+
s(-2),
|
|
82
|
+
" \u2192 ",
|
|
83
|
+
s(28),
|
|
84
|
+
". Dates outside are dimmed."),
|
|
85
|
+
react_1.default.createElement(date_picker_1.DatePicker, { maxDate: d(28), minDate: d(-2), onChange: (0, action_1.action)("onChange", setValue), selectedDate: value })));
|
|
86
|
+
}
|
|
87
|
+
// ─── Unavailable (blocked) dates ───────────────────────────────────────────────
|
|
88
|
+
/**
|
|
89
|
+
* Today and a cluster of dates next week are marked as unavailable.
|
|
90
|
+
* They appear crossed-out and cannot be selected even though they are within min/max.
|
|
91
|
+
*/
|
|
92
|
+
function UnavailableDates() {
|
|
93
|
+
const [value, setValue] = (0, react_1.useState)(null);
|
|
94
|
+
const unavailableDates = [d(0), d(5), d(6), d(7), d(11), d(12)];
|
|
95
|
+
return (react_1.default.createElement("div", { className: "space-y-2 p-8" },
|
|
96
|
+
react_1.default.createElement("p", { className: "text-sm text-gray-500" },
|
|
97
|
+
"Blocked dates: ",
|
|
98
|
+
s(0),
|
|
99
|
+
", ",
|
|
100
|
+
s(5),
|
|
101
|
+
", ",
|
|
102
|
+
s(6),
|
|
103
|
+
", ",
|
|
104
|
+
s(7),
|
|
105
|
+
", ",
|
|
106
|
+
s(11),
|
|
107
|
+
", ",
|
|
108
|
+
s(12),
|
|
109
|
+
"."),
|
|
110
|
+
react_1.default.createElement(date_picker_1.DatePicker, { onChange: (0, action_1.action)("onChange", setValue), selectedDate: value, unavailableDates: unavailableDates })));
|
|
111
|
+
}
|
|
112
|
+
// ─── DatesConfig — custom flags and disabled groups ───────────────────────────
|
|
113
|
+
/**
|
|
114
|
+
* datesConfig lets you attach custom CSS flags to date cells and disable whole groups.
|
|
115
|
+
*
|
|
116
|
+
* - flag-1 (selectable): +1 / +2
|
|
117
|
+
* - flag-2 (disabled): +4 / +5
|
|
118
|
+
* - no flag (disabled): +8
|
|
119
|
+
*/
|
|
120
|
+
function DatesConfigFlags() {
|
|
121
|
+
const [value, setValue] = (0, react_1.useState)(null);
|
|
122
|
+
const datesConfig = [
|
|
123
|
+
{
|
|
124
|
+
flag: "flag-1",
|
|
125
|
+
dates: [d(1), d(2)],
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
flag: "flag-2",
|
|
129
|
+
dates: [d(4), d(5)],
|
|
130
|
+
isDisabled: true,
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
dates: [d(8)],
|
|
134
|
+
isDisabled: true,
|
|
135
|
+
},
|
|
136
|
+
];
|
|
137
|
+
return (react_1.default.createElement("div", { className: "space-y-2 p-8" },
|
|
138
|
+
react_1.default.createElement("p", { className: "text-sm text-gray-500" },
|
|
139
|
+
react_1.default.createElement("code", null, "flag-1"),
|
|
140
|
+
" (selectable): ",
|
|
141
|
+
s(1),
|
|
142
|
+
", ",
|
|
143
|
+
s(2),
|
|
144
|
+
" \u00B7 ",
|
|
145
|
+
react_1.default.createElement("code", null, "flag-2"),
|
|
146
|
+
" (disabled): ",
|
|
147
|
+
s(4),
|
|
148
|
+
", ",
|
|
149
|
+
s(5),
|
|
150
|
+
" \u00B7",
|
|
151
|
+
" ",
|
|
152
|
+
"disabled (no flag): ",
|
|
153
|
+
s(8)),
|
|
154
|
+
react_1.default.createElement(date_picker_1.DatePicker, { datesConfig: datesConfig, onChange: (0, action_1.action)("onChange", setValue), selectedDate: value })));
|
|
155
|
+
}
|
|
156
|
+
// ─── Min / max + unavailable combined ─────────────────────────────────────────
|
|
157
|
+
/**
|
|
158
|
+
* Combines a tight date window with several unavailable dates inside that window.
|
|
159
|
+
* Useful for availability calendars where only a handful of slots remain.
|
|
160
|
+
*/
|
|
161
|
+
function MinMaxWithUnavailable() {
|
|
162
|
+
const [value, setValue] = (0, react_1.useState)(null);
|
|
163
|
+
return (react_1.default.createElement("div", { className: "space-y-2 p-8" },
|
|
164
|
+
react_1.default.createElement("p", { className: "text-sm text-gray-500" },
|
|
165
|
+
"Window: ",
|
|
166
|
+
s(-5),
|
|
167
|
+
" \u2192 ",
|
|
168
|
+
s(20),
|
|
169
|
+
". Additionally blocked: ",
|
|
170
|
+
s(0),
|
|
171
|
+
", ",
|
|
172
|
+
s(3),
|
|
173
|
+
", ",
|
|
174
|
+
s(9),
|
|
175
|
+
", ",
|
|
176
|
+
s(15),
|
|
177
|
+
"."),
|
|
178
|
+
react_1.default.createElement(date_picker_1.DatePicker, { maxDate: d(20), minDate: d(-5), onChange: (0, action_1.action)("onChange", setValue), selectedDate: value, unavailableDates: [d(0), d(3), d(9), d(15)] })));
|
|
179
|
+
}
|
|
180
|
+
// ─── Bottom content slot ───────────────────────────────────────────────────────
|
|
181
|
+
/**
|
|
182
|
+
* The `bottomContent` prop renders arbitrary JSX below the calendar grid.
|
|
183
|
+
* Useful for legends, CTAs, or pricing summaries.
|
|
184
|
+
*/
|
|
185
|
+
function WithBottomContent() {
|
|
186
|
+
const [value, setValue] = (0, react_1.useState)(null);
|
|
187
|
+
return (react_1.default.createElement("div", { className: "space-y-2 p-8" },
|
|
188
|
+
react_1.default.createElement("p", { className: "text-sm text-gray-500" }, "Custom content rendered below the calendar grid."),
|
|
189
|
+
react_1.default.createElement(date_picker_1.DatePicker, { bottomContent: react_1.default.createElement("div", { className: "border-t pt-2 text-sm text-gray-600" },
|
|
190
|
+
react_1.default.createElement("p", null, "Legend: highlighted = special offer")), onChange: (0, action_1.action)("onChange", setValue), selectedDate: value })));
|
|
191
|
+
}
|
|
192
|
+
// ─── onMonthChange callback ────────────────────────────────────────────────────
|
|
193
|
+
/**
|
|
194
|
+
* `onMonthChange` fires whenever the user navigates to a different month.
|
|
195
|
+
* The currently visible month is displayed below the description.
|
|
196
|
+
*/
|
|
197
|
+
function OnMonthChange() {
|
|
198
|
+
const [value, setValue] = (0, react_1.useState)(null);
|
|
199
|
+
const [lastMonth, setLastMonth] = (0, react_1.useState)("—");
|
|
200
|
+
return (react_1.default.createElement("div", { className: "space-y-2 p-8" },
|
|
201
|
+
react_1.default.createElement("p", { className: "text-sm text-gray-500" },
|
|
202
|
+
"Navigate with the arrows. Last reported month: ",
|
|
203
|
+
react_1.default.createElement("strong", null, lastMonth)),
|
|
204
|
+
react_1.default.createElement(date_picker_1.DatePicker, { onChange: (0, action_1.action)("onChange", setValue), onMonthChange: (months) => {
|
|
205
|
+
const m = months.at(0);
|
|
206
|
+
setLastMonth(m ? `${m.year}-${String(m.month + 1).padStart(2, "0")}` : "—");
|
|
207
|
+
}, selectedDate: value })));
|
|
208
|
+
}
|
|
209
|
+
// ─── All features together ─────────────────────────────────────────────────────
|
|
210
|
+
/**
|
|
211
|
+
* Kitchen-sink story combining min/max, unavailable dates, datesConfig flags,
|
|
212
|
+
* bottom content, and onMonthChange — useful for regression testing the full API.
|
|
213
|
+
*/
|
|
214
|
+
function AllFeatures() {
|
|
215
|
+
const [value, setValue] = (0, react_1.useState)(null);
|
|
216
|
+
const datesConfig = [
|
|
217
|
+
{ flag: "flag-1", dates: [d(3), d(4)] },
|
|
218
|
+
{ flag: "flag-2", dates: [d(6), d(7)], isDisabled: true },
|
|
219
|
+
];
|
|
220
|
+
return (react_1.default.createElement("div", { className: "space-y-2 p-8" },
|
|
221
|
+
react_1.default.createElement("p", { className: "text-sm text-gray-500" },
|
|
222
|
+
"Window: ",
|
|
223
|
+
s(-3),
|
|
224
|
+
" \u2192 ",
|
|
225
|
+
s(25),
|
|
226
|
+
". Blocked: ",
|
|
227
|
+
s(0),
|
|
228
|
+
", ",
|
|
229
|
+
s(10),
|
|
230
|
+
". ",
|
|
231
|
+
react_1.default.createElement("code", null, "flag-1"),
|
|
232
|
+
": ",
|
|
233
|
+
s(3),
|
|
234
|
+
", ",
|
|
235
|
+
s(4),
|
|
236
|
+
".",
|
|
237
|
+
" ",
|
|
238
|
+
react_1.default.createElement("code", null, "flag-2"),
|
|
239
|
+
" (disabled): ",
|
|
240
|
+
s(6),
|
|
241
|
+
", ",
|
|
242
|
+
s(7),
|
|
243
|
+
"."),
|
|
244
|
+
react_1.default.createElement(date_picker_1.DatePicker, { bottomContent: react_1.default.createElement("div", { className: "border-t pt-2 text-xs text-gray-500" }, "flag-1 = highlighted \u00B7 flag-2 = disabled highlight"), datesConfig: datesConfig, maxDate: d(25), minDate: d(-3), onChange: (0, action_1.action)("onChange", setValue), onMonthChange: (months) => { var _a; return console.log("month changed", (_a = months.at(0)) === null || _a === void 0 ? void 0 : _a.month); }, selectedDate: value, unavailableDates: [d(0), d(10)] })));
|
|
89
245
|
}
|
|
@@ -40,7 +40,6 @@ const date_range_picker_decade_1 = require("./date-range-picker-decade");
|
|
|
40
40
|
const date_range_picker_month_1 = require("./date-range-picker-month");
|
|
41
41
|
const date_range_picker_year_1 = require("./date-range-picker-year");
|
|
42
42
|
const DateRangePickerContent = (props) => {
|
|
43
|
-
// eslint-disable-next-line react/destructuring-assignment
|
|
44
43
|
const { goToDate, activeMonths } = (0, react_1.useContext)(date_range_picker_context_1.DateRangePickerContext);
|
|
45
44
|
const [viewMode, setViewMode] = (0, react_1.useState)("month");
|
|
46
45
|
const onYearSelect = (0, react_1.useCallback)(() => setViewMode("decade"), [setViewMode]);
|
|
@@ -6,4 +6,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const react_1 = __importDefault(require("react"));
|
|
7
7
|
const snap_test_1 = require("../utils/snap-test");
|
|
8
8
|
const date_range_picker_stories_1 = require("./date-range-picker.stories");
|
|
9
|
-
(0, snap_test_1.snapTest)("render stories", react_1.default.createElement(date_range_picker_stories_1.
|
|
9
|
+
(0, snap_test_1.snapTest)("render stories", react_1.default.createElement(date_range_picker_stories_1.Basic, null));
|
|
@@ -1,2 +1,58 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
|
|
2
|
+
/** Minimal range picker with no constraints. Click start date then end date. */
|
|
3
|
+
export declare function Basic(): React.JSX.Element;
|
|
4
|
+
/** Opens with a range already selected. Shows the highlighted band immediately. */
|
|
5
|
+
export declare function PreSelected(): React.JSX.Element;
|
|
6
|
+
/**
|
|
7
|
+
* Only dates within a fixed window are selectable.
|
|
8
|
+
* Useful for short-stay booking forms with a specific availability window.
|
|
9
|
+
*/
|
|
10
|
+
export declare function MinMaxDates(): React.JSX.Element;
|
|
11
|
+
/**
|
|
12
|
+
* A cluster of dates is marked unavailable.
|
|
13
|
+
* The user cannot start or end a range on those dates.
|
|
14
|
+
*/
|
|
15
|
+
export declare function UnavailableDates(): React.JSX.Element;
|
|
16
|
+
/**
|
|
17
|
+
* `minSelectedDays` enforces a minimum stay of 3 days.
|
|
18
|
+
* The end date cannot be selected closer than 3 days after the start date.
|
|
19
|
+
*/
|
|
20
|
+
export declare function MinStayDays(): React.JSX.Element;
|
|
21
|
+
/**
|
|
22
|
+
* `exactSelectedDays` pins the stay to exactly 5 days.
|
|
23
|
+
* Selecting a start date automatically highlights the fixed-length range.
|
|
24
|
+
*/
|
|
25
|
+
export declare function ExactStayDays(): React.JSX.Element;
|
|
26
|
+
/**
|
|
27
|
+
* `numberOfMonths={2}` shows the current and next month side-by-side.
|
|
28
|
+
* Handy when users typically book multi-week stays spanning a month boundary.
|
|
29
|
+
*/
|
|
30
|
+
export declare function TwoMonthView(): React.JSX.Element;
|
|
31
|
+
/**
|
|
32
|
+
* `datesConfig` lets you style and disable arbitrary date groups independently of
|
|
33
|
+
* the global `unavailableDates` list.
|
|
34
|
+
*/
|
|
35
|
+
export declare function DatesConfigFlags(): React.JSX.Element;
|
|
36
|
+
/**
|
|
37
|
+
* `bottomContent` renders arbitrary JSX below the calendar.
|
|
38
|
+
* Typical uses: price summary, legend, or action buttons.
|
|
39
|
+
*/
|
|
40
|
+
export declare function WithBottomContent(): React.JSX.Element;
|
|
41
|
+
/**
|
|
42
|
+
* Regression story for the DST off-by-one bug.
|
|
43
|
+
*
|
|
44
|
+
* In Europe, clocks go back on the night of 2026-10-25 → 2026-10-26 (CEST → CET).
|
|
45
|
+
* Before the fix, `toDateString()` would misread a UTC-midnight Date in a UTC+ timezone
|
|
46
|
+
* and shift it one day back, making Oct 26 appear as Oct 25 in the calendar.
|
|
47
|
+
*
|
|
48
|
+
* This story opens on October 2026 with minSelectedDays=2 so you can verify that:
|
|
49
|
+
* - Oct 25 and Oct 26 are both visible as distinct, correct cells
|
|
50
|
+
* - Selecting Oct 25 as start date allows Oct 26 as the earliest valid end date
|
|
51
|
+
* - The highlighted range 2026-10-25 → 2026-10-26 renders without off-by-one shift
|
|
52
|
+
*/
|
|
53
|
+
export declare function DstBoundaryOct2026(): React.JSX.Element;
|
|
54
|
+
/**
|
|
55
|
+
* Kitchen-sink story: two months, min/max window, blocked dates, datesConfig flags,
|
|
56
|
+
* minimum 2-day stay, and a bottom content footer. Good for regression testing.
|
|
57
|
+
*/
|
|
58
|
+
export declare function AllFeatures(): React.JSX.Element;
|
|
@@ -33,35 +33,232 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.
|
|
36
|
+
exports.Basic = Basic;
|
|
37
|
+
exports.PreSelected = PreSelected;
|
|
38
|
+
exports.MinMaxDates = MinMaxDates;
|
|
39
|
+
exports.UnavailableDates = UnavailableDates;
|
|
40
|
+
exports.MinStayDays = MinStayDays;
|
|
41
|
+
exports.ExactStayDays = ExactStayDays;
|
|
42
|
+
exports.TwoMonthView = TwoMonthView;
|
|
43
|
+
exports.DatesConfigFlags = DatesConfigFlags;
|
|
44
|
+
exports.WithBottomContent = WithBottomContent;
|
|
45
|
+
exports.DstBoundaryOct2026 = DstBoundaryOct2026;
|
|
46
|
+
exports.AllFeatures = AllFeatures;
|
|
37
47
|
const noop_1 = require("@uxf/core/utils/noop");
|
|
38
|
-
const
|
|
48
|
+
const date_string_1 = require("@uxf/datepicker/utils/date-string");
|
|
39
49
|
const react_1 = __importStar(require("react"));
|
|
40
50
|
const action_1 = require("../utils/action");
|
|
41
51
|
const date_range_picker_1 = require("./date-range-picker");
|
|
42
|
-
|
|
43
|
-
const
|
|
44
|
-
const
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
today.add(7, "days").toDate(),
|
|
50
|
-
today.add(11, "days").toDate(),
|
|
51
|
-
today.add(12, "days").toDate(),
|
|
52
|
-
];
|
|
53
|
-
function Default() {
|
|
52
|
+
// Build all demo dates relative to today using timezone-safe arithmetic
|
|
53
|
+
const todayStr = (0, date_string_1.todayDateString)();
|
|
54
|
+
const d = (n) => (0, date_string_1.fromDateString)((0, date_string_1.addDays)(todayStr, n));
|
|
55
|
+
const s = (n) => (0, date_string_1.addDays)(todayStr, n); // DateString for use in descriptions
|
|
56
|
+
// ─── Basic usage ───────────────────────────────────────────────────────────────
|
|
57
|
+
/** Minimal range picker with no constraints. Click start date then end date. */
|
|
58
|
+
function Basic() {
|
|
54
59
|
const [value, setValue] = (0, react_1.useState)(null);
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
react_1.default.createElement(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
60
|
+
return (react_1.default.createElement("div", { className: "space-y-2 p-8" },
|
|
61
|
+
react_1.default.createElement("p", { className: "text-sm text-gray-500" }, "Click a start date, then an end date. No constraints applied."),
|
|
62
|
+
react_1.default.createElement(date_range_picker_1.DateRangePicker, { onChange: (0, action_1.action)("onChange", setValue), onClosePopover: noop_1.noop, selectedDates: value })));
|
|
63
|
+
}
|
|
64
|
+
// ─── Pre-selected range ────────────────────────────────────────────────────────
|
|
65
|
+
/** Opens with a range already selected. Shows the highlighted band immediately. */
|
|
66
|
+
function PreSelected() {
|
|
67
|
+
const [value, setValue] = (0, react_1.useState)({
|
|
68
|
+
from: d(0),
|
|
69
|
+
to: d(7),
|
|
70
|
+
});
|
|
71
|
+
return (react_1.default.createElement("div", { className: "space-y-2 p-8" },
|
|
72
|
+
react_1.default.createElement("p", { className: "text-sm text-gray-500" },
|
|
73
|
+
"Pre-selected range: ",
|
|
74
|
+
s(0),
|
|
75
|
+
" \u2192 ",
|
|
76
|
+
s(7),
|
|
77
|
+
"."),
|
|
78
|
+
react_1.default.createElement(date_range_picker_1.DateRangePicker, { onChange: (0, action_1.action)("onChange", setValue), onClosePopover: noop_1.noop, selectedDates: value })));
|
|
79
|
+
}
|
|
80
|
+
// ─── Min / max date constraints ────────────────────────────────────────────────
|
|
81
|
+
/**
|
|
82
|
+
* Only dates within a fixed window are selectable.
|
|
83
|
+
* Useful for short-stay booking forms with a specific availability window.
|
|
84
|
+
*/
|
|
85
|
+
function MinMaxDates() {
|
|
86
|
+
const [value, setValue] = (0, react_1.useState)(null);
|
|
87
|
+
return (react_1.default.createElement("div", { className: "space-y-2 p-8" },
|
|
88
|
+
react_1.default.createElement("p", { className: "text-sm text-gray-500" },
|
|
89
|
+
"Bookable window: ",
|
|
90
|
+
s(2),
|
|
91
|
+
" \u2192 ",
|
|
92
|
+
s(16),
|
|
93
|
+
". Dates outside are dimmed."),
|
|
94
|
+
react_1.default.createElement(date_range_picker_1.DateRangePicker, { maxDate: d(16), minDate: d(2), onChange: (0, action_1.action)("onChange", setValue), onClosePopover: noop_1.noop, selectedDates: value })));
|
|
95
|
+
}
|
|
96
|
+
// ─── Unavailable dates ─────────────────────────────────────────────────────────
|
|
97
|
+
/**
|
|
98
|
+
* A cluster of dates is marked unavailable.
|
|
99
|
+
* The user cannot start or end a range on those dates.
|
|
100
|
+
*/
|
|
101
|
+
function UnavailableDates() {
|
|
102
|
+
const [value, setValue] = (0, react_1.useState)(null);
|
|
103
|
+
const unavailableDates = [d(0), d(5), d(6), d(7), d(11), d(12)];
|
|
104
|
+
return (react_1.default.createElement("div", { className: "space-y-2 p-8" },
|
|
105
|
+
react_1.default.createElement("p", { className: "text-sm text-gray-500" },
|
|
106
|
+
"Blocked dates: ",
|
|
107
|
+
s(0),
|
|
108
|
+
", ",
|
|
109
|
+
s(5),
|
|
110
|
+
", ",
|
|
111
|
+
s(6),
|
|
112
|
+
", ",
|
|
113
|
+
s(7),
|
|
114
|
+
", ",
|
|
115
|
+
s(11),
|
|
116
|
+
", ",
|
|
117
|
+
s(12),
|
|
118
|
+
". A range cannot cross them."),
|
|
119
|
+
react_1.default.createElement(date_range_picker_1.DateRangePicker, { onChange: (0, action_1.action)("onChange", setValue), onClosePopover: noop_1.noop, selectedDates: value, unavailableDates: unavailableDates })));
|
|
120
|
+
}
|
|
121
|
+
// ─── Minimum stay length ───────────────────────────────────────────────────────
|
|
122
|
+
/**
|
|
123
|
+
* `minSelectedDays` enforces a minimum stay of 3 days.
|
|
124
|
+
* The end date cannot be selected closer than 3 days after the start date.
|
|
125
|
+
*/
|
|
126
|
+
function MinStayDays() {
|
|
127
|
+
const [value, setValue] = (0, react_1.useState)(null);
|
|
128
|
+
return (react_1.default.createElement("div", { className: "space-y-2 p-8" },
|
|
129
|
+
react_1.default.createElement("p", { className: "text-sm text-gray-500" },
|
|
130
|
+
"Minimum 3 days \u2014 if start is ",
|
|
131
|
+
s(0),
|
|
132
|
+
", earliest end is ",
|
|
133
|
+
s(2),
|
|
134
|
+
"."),
|
|
135
|
+
react_1.default.createElement(date_range_picker_1.DateRangePicker, { minSelectedDays: 3, onChange: (0, action_1.action)("onChange", setValue), onClosePopover: noop_1.noop, selectedDates: value })));
|
|
136
|
+
}
|
|
137
|
+
// ─── Exact stay length ─────────────────────────────────────────────────────────
|
|
138
|
+
/**
|
|
139
|
+
* `exactSelectedDays` pins the stay to exactly 5 days.
|
|
140
|
+
* Selecting a start date automatically highlights the fixed-length range.
|
|
141
|
+
*/
|
|
142
|
+
function ExactStayDays() {
|
|
143
|
+
const [value, setValue] = (0, react_1.useState)(null);
|
|
144
|
+
return (react_1.default.createElement("div", { className: "space-y-2 p-8" },
|
|
145
|
+
react_1.default.createElement("p", { className: "text-sm text-gray-500" },
|
|
146
|
+
"Exactly 5 days \u2014 if start is ",
|
|
147
|
+
s(0),
|
|
148
|
+
", end is locked to ",
|
|
149
|
+
s(4),
|
|
150
|
+
"."),
|
|
151
|
+
react_1.default.createElement(date_range_picker_1.DateRangePicker, { exactSelectedDays: 5, onChange: (0, action_1.action)("onChange", setValue), onClosePopover: noop_1.noop, selectedDates: value })));
|
|
152
|
+
}
|
|
153
|
+
// ─── Two-month view ────────────────────────────────────────────────────────────
|
|
154
|
+
/**
|
|
155
|
+
* `numberOfMonths={2}` shows the current and next month side-by-side.
|
|
156
|
+
* Handy when users typically book multi-week stays spanning a month boundary.
|
|
157
|
+
*/
|
|
158
|
+
function TwoMonthView() {
|
|
159
|
+
const [value, setValue] = (0, react_1.useState)(null);
|
|
160
|
+
return (react_1.default.createElement("div", { className: "space-y-2 p-8" },
|
|
161
|
+
react_1.default.createElement("p", { className: "text-sm text-gray-500" }, "Two months displayed side-by-side for easier range selection."),
|
|
162
|
+
react_1.default.createElement(date_range_picker_1.DateRangePicker, { numberOfMonths: 2, onChange: (0, action_1.action)("onChange", setValue), onClosePopover: noop_1.noop, selectedDates: value })));
|
|
163
|
+
}
|
|
164
|
+
// ─── DatesConfig — flags and disabled groups ───────────────────────────────────
|
|
165
|
+
/**
|
|
166
|
+
* `datesConfig` lets you style and disable arbitrary date groups independently of
|
|
167
|
+
* the global `unavailableDates` list.
|
|
168
|
+
*/
|
|
169
|
+
function DatesConfigFlags() {
|
|
170
|
+
const [value, setValue] = (0, react_1.useState)(null);
|
|
171
|
+
const datesConfig = [
|
|
172
|
+
{ flag: "flag-promo", dates: [d(2), d(3)] },
|
|
173
|
+
{ flag: "flag-sold-out", dates: [d(6), d(7)], isDisabled: true },
|
|
174
|
+
];
|
|
175
|
+
return (react_1.default.createElement("div", { className: "space-y-2 p-8" },
|
|
176
|
+
react_1.default.createElement("p", { className: "text-sm text-gray-500" },
|
|
177
|
+
react_1.default.createElement("code", null, "flag-promo"),
|
|
178
|
+
" (selectable): ",
|
|
179
|
+
s(2),
|
|
180
|
+
", ",
|
|
181
|
+
s(3),
|
|
182
|
+
" \u00B7 ",
|
|
183
|
+
react_1.default.createElement("code", null, "flag-sold-out"),
|
|
184
|
+
" (disabled): ",
|
|
185
|
+
s(6),
|
|
186
|
+
",",
|
|
187
|
+
" ",
|
|
188
|
+
s(7),
|
|
189
|
+
"."),
|
|
190
|
+
react_1.default.createElement(date_range_picker_1.DateRangePicker, { datesConfig: datesConfig, onChange: (0, action_1.action)("onChange", setValue), onClosePopover: noop_1.noop, selectedDates: value })));
|
|
191
|
+
}
|
|
192
|
+
// ─── Bottom content slot ───────────────────────────────────────────────────────
|
|
193
|
+
/**
|
|
194
|
+
* `bottomContent` renders arbitrary JSX below the calendar.
|
|
195
|
+
* Typical uses: price summary, legend, or action buttons.
|
|
196
|
+
*/
|
|
197
|
+
function WithBottomContent() {
|
|
198
|
+
const [value, setValue] = (0, react_1.useState)(null);
|
|
199
|
+
return (react_1.default.createElement("div", { className: "space-y-2 p-8" },
|
|
200
|
+
react_1.default.createElement("p", { className: "text-sm text-gray-500" }, "Custom footer rendered below the calendar grid."),
|
|
201
|
+
react_1.default.createElement(date_range_picker_1.DateRangePicker, { bottomContent: react_1.default.createElement("div", { className: "border-t pt-2 text-sm text-gray-600" },
|
|
202
|
+
react_1.default.createElement("p", null,
|
|
203
|
+
"Average nightly rate: ",
|
|
204
|
+
react_1.default.createElement("strong", null, "\u20AC120"))), onChange: (0, action_1.action)("onChange", setValue), onClosePopover: noop_1.noop, selectedDates: value })));
|
|
205
|
+
}
|
|
206
|
+
// ─── DST boundary — Oct 25/26 2026 ────────────────────────────────────────────
|
|
207
|
+
/**
|
|
208
|
+
* Regression story for the DST off-by-one bug.
|
|
209
|
+
*
|
|
210
|
+
* In Europe, clocks go back on the night of 2026-10-25 → 2026-10-26 (CEST → CET).
|
|
211
|
+
* Before the fix, `toDateString()` would misread a UTC-midnight Date in a UTC+ timezone
|
|
212
|
+
* and shift it one day back, making Oct 26 appear as Oct 25 in the calendar.
|
|
213
|
+
*
|
|
214
|
+
* This story opens on October 2026 with minSelectedDays=2 so you can verify that:
|
|
215
|
+
* - Oct 25 and Oct 26 are both visible as distinct, correct cells
|
|
216
|
+
* - Selecting Oct 25 as start date allows Oct 26 as the earliest valid end date
|
|
217
|
+
* - The highlighted range 2026-10-25 → 2026-10-26 renders without off-by-one shift
|
|
218
|
+
*/
|
|
219
|
+
function DstBoundaryOct2026() {
|
|
220
|
+
const [value, setValue] = (0, react_1.useState)({
|
|
221
|
+
from: (0, date_string_1.fromDateString)("2026-10-25"),
|
|
222
|
+
to: null,
|
|
223
|
+
});
|
|
224
|
+
return (react_1.default.createElement("div", { className: "space-y-2 p-8" },
|
|
225
|
+
react_1.default.createElement("p", { className: "text-sm text-gray-500" }, "DST regression: Europe clocks go back on 2026-10-25 \u2192 2026-10-26. Start is pre-set to 2026-10-25; select 2026-10-26 as end (minSelectedDays=2). Both cells must appear on the correct day without any off-by-one shift."),
|
|
226
|
+
react_1.default.createElement(date_range_picker_1.DateRangePicker, { maxDate: (0, date_string_1.fromDateString)("2026-11-05"), minDate: (0, date_string_1.fromDateString)("2026-10-20"), minSelectedDays: 2, onChange: (0, action_1.action)("onChange", setValue), onClosePopover: noop_1.noop, selectedDates: value })));
|
|
227
|
+
}
|
|
228
|
+
// ─── All features together ─────────────────────────────────────────────────────
|
|
229
|
+
/**
|
|
230
|
+
* Kitchen-sink story: two months, min/max window, blocked dates, datesConfig flags,
|
|
231
|
+
* minimum 2-day stay, and a bottom content footer. Good for regression testing.
|
|
232
|
+
*/
|
|
233
|
+
function AllFeatures() {
|
|
234
|
+
const [value, setValue] = (0, react_1.useState)(null);
|
|
235
|
+
const datesConfig = [
|
|
236
|
+
{ flag: "flag-promo", dates: [d(3), d(4)] },
|
|
237
|
+
{ flag: "flag-sold-out", dates: [d(9), d(10)], isDisabled: true },
|
|
238
|
+
];
|
|
239
|
+
return (react_1.default.createElement("div", { className: "space-y-2 p-8" },
|
|
240
|
+
react_1.default.createElement("p", { className: "text-sm text-gray-500" },
|
|
241
|
+
"2 months \u00B7 window ",
|
|
242
|
+
s(-1),
|
|
243
|
+
" \u2192 ",
|
|
244
|
+
s(30),
|
|
245
|
+
" \u00B7 blocked: ",
|
|
246
|
+
s(0),
|
|
247
|
+
", ",
|
|
248
|
+
s(15),
|
|
249
|
+
" \u00B7 ",
|
|
250
|
+
react_1.default.createElement("code", null, "flag-promo"),
|
|
251
|
+
": ",
|
|
252
|
+
s(3),
|
|
253
|
+
", ",
|
|
254
|
+
s(4),
|
|
255
|
+
" ",
|
|
256
|
+
"\u00B7 ",
|
|
257
|
+
react_1.default.createElement("code", null, "flag-sold-out"),
|
|
258
|
+
": ",
|
|
259
|
+
s(9),
|
|
260
|
+
", ",
|
|
261
|
+
s(10),
|
|
262
|
+
" \u00B7 min 2 days."),
|
|
263
|
+
react_1.default.createElement(date_range_picker_1.DateRangePicker, { bottomContent: react_1.default.createElement("div", { className: "border-t pt-2 text-xs text-gray-500" }, "Promo = discounted rate \u00B7 Sold-out = unavailable"), datesConfig: datesConfig, maxDate: d(30), minDate: d(-1), minSelectedDays: 2, numberOfMonths: 2, onChange: (0, action_1.action)("onChange", setValue), onClosePopover: noop_1.noop, selectedDates: value, unavailableDates: [d(0), d(15)] })));
|
|
67
264
|
}
|
package/dropdown/dropdown.js
CHANGED
|
@@ -39,7 +39,6 @@ const use_anchor_props_1 = require("@uxf/core-react/clickable/use-anchor-props")
|
|
|
39
39
|
const cx_1 = require("@uxf/core/utils/cx");
|
|
40
40
|
const react_1 = __importStar(require("react"));
|
|
41
41
|
const Item = (0, react_1.forwardRef)((props, ref) => {
|
|
42
|
-
// eslint-disable-next-line react/destructuring-assignment
|
|
43
42
|
const { as = "a", children, className, ...restProps } = props;
|
|
44
43
|
const Component = as;
|
|
45
44
|
const anchorProps = (0, use_anchor_props_1.useAnchorProps)({
|
|
@@ -42,7 +42,6 @@ function Default() {
|
|
|
42
42
|
const [value, setValue] = (0, react_1.useState)(null);
|
|
43
43
|
const onChange = (0, action_1.action)("onChange", setValue);
|
|
44
44
|
const onUploadError = (err) => {
|
|
45
|
-
// eslint-disable-next-line no-console
|
|
46
45
|
console.log("Upload error", err);
|
|
47
46
|
};
|
|
48
47
|
return (react_1.default.createElement("div", { className: "max-w-screen-sm space-y-2 p-20" },
|
|
@@ -38,7 +38,6 @@ const button_1 = require("@uxf/ui/button");
|
|
|
38
38
|
const icon_1 = require("@uxf/ui/icon");
|
|
39
39
|
const react_1 = __importStar(require("react"));
|
|
40
40
|
exports.IconButton = (0, react_1.forwardRef)((props, ref) => {
|
|
41
|
-
// eslint-disable-next-line react/destructuring-assignment
|
|
42
41
|
const { className, iconName, iconSize, label, ...buttonProps } = props;
|
|
43
42
|
return (react_1.default.createElement(button_1.Button, { className: `uxf-icon-button ${className !== null && className !== void 0 ? className : ""}`, ref: ref, ...buttonProps },
|
|
44
43
|
react_1.default.createElement(icon_1.Icon, { "aria-label": label, name: iconName, size: iconSize })));
|
|
@@ -42,7 +42,6 @@ function Default() {
|
|
|
42
42
|
const [isDisabled, setIsDisabled] = (0, react_1.useState)(false);
|
|
43
43
|
const [isLoading, setIsLoading] = (0, react_1.useState)(false);
|
|
44
44
|
const config = (0, storybook_config_1.useStorybookConfig)("IconButton");
|
|
45
|
-
// eslint-disable-next-line no-console
|
|
46
45
|
const onClick = console.log;
|
|
47
46
|
const gridColumnsCount = config.variants.length * config.sizes.length + 1;
|
|
48
47
|
const gridTemplateColumns = `repeat(${gridColumnsCount}, 100px)`;
|
package/input/input.js
CHANGED
|
@@ -48,6 +48,7 @@ function getChildrenById(children, componentName) {
|
|
|
48
48
|
.filter(react_1.isValidElement)
|
|
49
49
|
.find((ch) => ch.type.displayName === componentName);
|
|
50
50
|
}
|
|
51
|
+
// eslint-disable-next-line complexity
|
|
51
52
|
exports.Input = (0, react_1.forwardRef)((props, ref) => {
|
|
52
53
|
var _a, _b;
|
|
53
54
|
const innerInputRef = (0, react_1.useRef)(null);
|
package/list-item/list-item.js
CHANGED
|
@@ -39,7 +39,6 @@ const cx_1 = require("@uxf/core/utils/cx");
|
|
|
39
39
|
const react_1 = __importStar(require("react"));
|
|
40
40
|
const icon_1 = require("../icon");
|
|
41
41
|
exports.ListItem = (0, react_1.forwardRef)((props, ref) => {
|
|
42
|
-
// eslint-disable-next-line react/destructuring-assignment
|
|
43
42
|
const { as = "a", className, children, endElement, endIcon, ...restProps } = props;
|
|
44
43
|
const Component = as;
|
|
45
44
|
const anchorProps = (0, use_anchor_props_1.useAnchorProps)({
|
|
@@ -8,7 +8,6 @@ const react_1 = __importDefault(require("react"));
|
|
|
8
8
|
const icon_1 = require("../icon");
|
|
9
9
|
const index_1 = require("./index");
|
|
10
10
|
function Default() {
|
|
11
|
-
// eslint-disable-next-line no-console
|
|
12
11
|
const onClick = console.log;
|
|
13
12
|
const storyListItem = (react_1.default.createElement("div", { className: "dark:text-white" },
|
|
14
13
|
react_1.default.createElement(index_1.ListItem, { endIcon: "chevronRight", onClick: onClick }, "Jm\u00E9no p\u0159\u00EDjmen\u00ED"),
|
|
@@ -15,7 +15,6 @@ const getConfirmForSize = (variant, colors) => {
|
|
|
15
15
|
cancelLabel: "Zrušit",
|
|
16
16
|
title: "Title",
|
|
17
17
|
description: "Description",
|
|
18
|
-
/* eslint-disable no-console */
|
|
19
18
|
onAccept: () => console.log("accepted"),
|
|
20
19
|
onCancel: () => console.log("canceled"),
|
|
21
20
|
color,
|
|
@@ -30,7 +29,6 @@ const getConfirmForSize = (variant, colors) => {
|
|
|
30
29
|
cancelLabel: "Rozumím",
|
|
31
30
|
title: "Title",
|
|
32
31
|
description: "Description",
|
|
33
|
-
/* eslint-disable no-console */
|
|
34
32
|
onCancel: () => console.log("canceled"),
|
|
35
33
|
color,
|
|
36
34
|
variant,
|
|
@@ -46,7 +44,6 @@ const getConfirmForSize = (variant, colors) => {
|
|
|
46
44
|
cancelLabel: "Zrušit",
|
|
47
45
|
title: "Title",
|
|
48
46
|
description: "Description",
|
|
49
|
-
/* eslint-disable no-console */
|
|
50
47
|
onAccept: () => console.log("accepted"),
|
|
51
48
|
onCancel: () => console.log("canceled"),
|
|
52
49
|
color,
|
|
@@ -55,7 +55,6 @@ const options = [
|
|
|
55
55
|
function Default() {
|
|
56
56
|
const [value, setValue] = (0, react_1.useState)(null);
|
|
57
57
|
const onChange = (0, action_1.action)("onChange", (v) => {
|
|
58
|
-
// eslint-disable-next-line no-console
|
|
59
58
|
console.log("Select values: ", v);
|
|
60
59
|
setValue(v);
|
|
61
60
|
});
|
|
@@ -72,7 +71,6 @@ function Default() {
|
|
|
72
71
|
function Async() {
|
|
73
72
|
const [value, setValue] = (0, react_1.useState)(null);
|
|
74
73
|
const onChange = (0, action_1.action)("onChange", (v) => {
|
|
75
|
-
// eslint-disable-next-line no-console
|
|
76
74
|
console.log("Select values: ", v);
|
|
77
75
|
setValue(v);
|
|
78
76
|
});
|
|
@@ -54,7 +54,6 @@ const options = [
|
|
|
54
54
|
function Default() {
|
|
55
55
|
const [value, setValue] = (0, react_1.useState)(null);
|
|
56
56
|
const onChange = (0, action_1.action)("onChange", (v) => {
|
|
57
|
-
// eslint-disable-next-line no-console
|
|
58
57
|
console.log("Select values: ", v);
|
|
59
58
|
setValue(v);
|
|
60
59
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uxf/ui",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.114.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -23,11 +23,11 @@
|
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"@floating-ui/react": "^0.27.17",
|
|
25
25
|
"@headlessui/react": "1.7.19",
|
|
26
|
-
"@uxf/core": "11.
|
|
27
|
-
"@uxf/core-react": "11.
|
|
28
|
-
"@uxf/datepicker": "11.
|
|
29
|
-
"@uxf/localize": "11.
|
|
30
|
-
"@uxf/styles": "11.
|
|
26
|
+
"@uxf/core": "11.114.0",
|
|
27
|
+
"@uxf/core-react": "11.114.0",
|
|
28
|
+
"@uxf/datepicker": "11.114.0",
|
|
29
|
+
"@uxf/localize": "11.114.0",
|
|
30
|
+
"@uxf/styles": "11.114.0",
|
|
31
31
|
"dayjs": "^1.11.19",
|
|
32
32
|
"react": ">= 18.2.0",
|
|
33
33
|
"react-dom": ">= 18.2.0",
|
|
@@ -39,11 +39,11 @@
|
|
|
39
39
|
"@types/node": "24",
|
|
40
40
|
"@types/react": "18.3.27",
|
|
41
41
|
"@types/react-dom": "18.3.7",
|
|
42
|
-
"@uxf/core": "11.
|
|
43
|
-
"@uxf/core-react": "11.
|
|
44
|
-
"@uxf/datepicker": "11.
|
|
45
|
-
"@uxf/localize": "11.
|
|
46
|
-
"@uxf/styles": "11.
|
|
42
|
+
"@uxf/core": "11.114.0",
|
|
43
|
+
"@uxf/core-react": "11.114.0",
|
|
44
|
+
"@uxf/datepicker": "11.114.0",
|
|
45
|
+
"@uxf/localize": "11.114.0",
|
|
46
|
+
"@uxf/styles": "11.114.0",
|
|
47
47
|
"dayjs": "^1.11.19",
|
|
48
48
|
"react-dropzone": "^14.4.0"
|
|
49
49
|
}
|
package/select/select.stories.js
CHANGED
|
@@ -57,7 +57,6 @@ const options = [
|
|
|
57
57
|
function Default() {
|
|
58
58
|
const [value, setValue] = (0, react_1.useState)(null);
|
|
59
59
|
const onChange = (0, action_1.action)("onChange", (v) => {
|
|
60
|
-
// eslint-disable-next-line no-console
|
|
61
60
|
console.log("Select value: ", v);
|
|
62
61
|
setValue(v);
|
|
63
62
|
});
|
package/text-link/text-link.js
CHANGED
|
@@ -39,7 +39,6 @@ const use_anchor_props_1 = require("@uxf/core-react/clickable/use-anchor-props")
|
|
|
39
39
|
const cx_1 = require("@uxf/core/utils/cx");
|
|
40
40
|
const react_1 = __importStar(require("react"));
|
|
41
41
|
exports.TextLink = (0, react_1.forwardRef)((props, ref) => {
|
|
42
|
-
// eslint-disable-next-line react/destructuring-assignment
|
|
43
42
|
const { as = "a", className, children, variant, ...restProps } = props;
|
|
44
43
|
const Component = as;
|
|
45
44
|
const anchorProps = (0, use_anchor_props_1.useAnchorProps)({
|
|
@@ -7,7 +7,6 @@ exports.Default = Default;
|
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const index_1 = require("./index");
|
|
9
9
|
function Default() {
|
|
10
|
-
// eslint-disable-next-line no-console
|
|
11
10
|
const onClick = console.log;
|
|
12
11
|
return (react_1.default.createElement("div", { className: "flex" },
|
|
13
12
|
react_1.default.createElement("div", { className: "flex gap-4 p-20" },
|
|
@@ -41,7 +41,6 @@ const use_hour_1 = require("@uxf/datepicker/hooks/use-hour");
|
|
|
41
41
|
const react_1 = __importStar(require("react"));
|
|
42
42
|
const TimePickerHour = (props) => {
|
|
43
43
|
const hourRef = (0, react_1.useRef)(null);
|
|
44
|
-
// eslint-disable-next-line react/destructuring-assignment
|
|
45
44
|
const { focusedHour, isHourFocused, isHourSelected, onHourSelect, onHourFocus, preventScroll } = (0, react_1.useContext)(time_picker_context_1.TimePickerContext);
|
|
46
45
|
const { onClick, onKeyDown, tabIndex, isSelected } = (0, use_hour_1.useHour)({
|
|
47
46
|
hour: props.hour,
|
|
@@ -41,7 +41,6 @@ const use_minute_1 = require("@uxf/datepicker/hooks/use-minute");
|
|
|
41
41
|
const react_1 = __importStar(require("react"));
|
|
42
42
|
const TimePickerMinute = (props) => {
|
|
43
43
|
const minuteRef = (0, react_1.useRef)(null);
|
|
44
|
-
// eslint-disable-next-line react/destructuring-assignment
|
|
45
44
|
const { focusedMinute, isMinuteFocused, isMinuteSelected, onMinuteSelect, onMinuteFocus, preventScroll } = (0, react_1.useContext)(time_picker_context_1.TimePickerContext);
|
|
46
45
|
const { isSelected, onClick, onKeyDown, tabIndex } = (0, use_minute_1.useMinute)({
|
|
47
46
|
minute: props.minute,
|