@xds/react 0.0.0-stage → 0.2.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/LICENSE +21 -0
- package/README.md +19 -2
- package/dist/Accordion.d.ts +20 -0
- package/dist/Accordion.js +197 -0
- package/dist/Avatar.d.ts +9 -0
- package/dist/Avatar.js +69 -0
- package/dist/AvatarStack.d.ts +8 -0
- package/dist/AvatarStack.js +105 -0
- package/dist/Badge.d.ts +13 -0
- package/dist/Badge.js +66 -0
- package/dist/Banner.d.ts +23 -0
- package/dist/Banner.js +166 -0
- package/dist/Button.d.ts +14 -0
- package/dist/Button.js +159 -0
- package/dist/Card.d.ts +18 -0
- package/dist/Card.js +173 -0
- package/dist/Checkbox.d.ts +10 -0
- package/dist/Checkbox.js +140 -0
- package/dist/Chip.d.ts +12 -0
- package/dist/Chip.js +74 -0
- package/dist/ChipBar.d.ts +12 -0
- package/dist/ChipBar.js +38 -0
- package/dist/CountBadge.d.ts +12 -0
- package/dist/CountBadge.js +64 -0
- package/dist/DatePicker.d.ts +20 -0
- package/dist/DatePicker.js +429 -0
- package/dist/DateRangePicker.d.ts +24 -0
- package/dist/DateRangePicker.js +370 -0
- package/dist/Defaults.d.ts +17 -0
- package/dist/Defaults.js +48 -0
- package/dist/Dialog.d.ts +20 -0
- package/dist/Dialog.js +137 -0
- package/dist/Divider.d.ts +4 -0
- package/dist/Divider.js +31 -0
- package/dist/EmptyState.d.ts +12 -0
- package/dist/EmptyState.js +86 -0
- package/dist/Icon.d.ts +9 -0
- package/dist/Icon.js +79 -0
- package/dist/IconButton.d.ts +12 -0
- package/dist/IconButton.js +119 -0
- package/dist/ListRow.d.ts +21 -0
- package/dist/ListRow.js +185 -0
- package/dist/MediaCard.d.ts +20 -0
- package/dist/MediaCard.js +279 -0
- package/dist/Menu.d.ts +18 -0
- package/dist/Menu.js +244 -0
- package/dist/ProgressBar.d.ts +8 -0
- package/dist/ProgressBar.js +65 -0
- package/dist/RadioGroup.d.ts +15 -0
- package/dist/RadioGroup.js +176 -0
- package/dist/SearchField.d.ts +15 -0
- package/dist/SearchField.js +152 -0
- package/dist/SectionHeader.d.ts +14 -0
- package/dist/SectionHeader.js +124 -0
- package/dist/SegmentedControl.d.ts +12 -0
- package/dist/SegmentedControl.js +106 -0
- package/dist/Select.d.ts +18 -0
- package/dist/Select.js +318 -0
- package/dist/Sidebar.d.ts +21 -0
- package/dist/Sidebar.js +220 -0
- package/dist/Skeleton.d.ts +11 -0
- package/dist/Skeleton.js +64 -0
- package/dist/Slider.d.ts +13 -0
- package/dist/Slider.js +151 -0
- package/dist/Spinner.d.ts +9 -0
- package/dist/Spinner.js +97 -0
- package/dist/Switch.d.ts +13 -0
- package/dist/Switch.js +116 -0
- package/dist/Tabs.d.ts +14 -0
- package/dist/Tabs.js +137 -0
- package/dist/Text.d.ts +10 -0
- package/dist/Text.js +46 -0
- package/dist/TextField.d.ts +22 -0
- package/dist/TextField.js +213 -0
- package/dist/Thumbnail.d.ts +9 -0
- package/dist/Thumbnail.js +152 -0
- package/dist/Toast.d.ts +14 -0
- package/dist/Toast.js +121 -0
- package/dist/Tooltip.d.ts +26 -0
- package/dist/Tooltip.js +166 -0
- package/dist/base.d.ts +11 -0
- package/dist/base.js +10 -0
- package/dist/index.d.ts +39 -0
- package/dist/index.js +39 -0
- package/dist/modal-popover.d.ts +7 -0
- package/dist/modal-popover.js +37 -0
- package/dist/picture.d.ts +13 -0
- package/dist/picture.js +76 -0
- package/dist/portal.d.ts +9 -0
- package/dist/portal.js +27 -0
- package/dist/presence.d.ts +6 -0
- package/dist/presence.js +34 -0
- package/dist/preview.d.ts +17 -0
- package/dist/preview.js +126 -0
- package/dist/root.d.ts +12 -0
- package/dist/root.js +1 -0
- package/dist/trigger.d.ts +24 -0
- package/dist/trigger.js +47 -0
- package/eject/files/Accordion.tsx +157 -0
- package/eject/files/Avatar.tsx +41 -0
- package/eject/files/AvatarStack.tsx +47 -0
- package/eject/files/Badge.tsx +33 -0
- package/eject/files/Banner.tsx +70 -0
- package/eject/files/Button.tsx +88 -0
- package/eject/files/Card.tsx +85 -0
- package/eject/files/Checkbox.tsx +59 -0
- package/eject/files/Chip.tsx +43 -0
- package/eject/files/ChipBar.tsx +31 -0
- package/eject/files/CountBadge.tsx +50 -0
- package/eject/files/DatePicker.tsx +192 -0
- package/eject/files/DateRangePicker.tsx +271 -0
- package/eject/files/Dialog.tsx +108 -0
- package/eject/files/Divider.tsx +13 -0
- package/eject/files/EmptyState.tsx +39 -0
- package/eject/files/Icon.tsx +38 -0
- package/eject/files/IconButton.tsx +62 -0
- package/eject/files/ListRow.tsx +86 -0
- package/eject/files/MediaCard.tsx +111 -0
- package/eject/files/Menu.tsx +168 -0
- package/eject/files/ProgressBar.tsx +34 -0
- package/eject/files/RadioGroup.tsx +112 -0
- package/eject/files/SearchField.tsx +88 -0
- package/eject/files/SectionHeader.tsx +56 -0
- package/eject/files/SegmentedControl.tsx +57 -0
- package/eject/files/Select.tsx +228 -0
- package/eject/files/Sidebar.tsx +149 -0
- package/eject/files/Skeleton.tsx +28 -0
- package/eject/files/Slider.tsx +109 -0
- package/eject/files/Spinner.tsx +36 -0
- package/eject/files/Switch.tsx +53 -0
- package/eject/files/Tabs.tsx +71 -0
- package/eject/files/Text.tsx +31 -0
- package/eject/files/TextField.tsx +122 -0
- package/eject/files/Thumbnail.tsx +66 -0
- package/eject/files/Toast.tsx +88 -0
- package/eject/files/Tooltip.tsx +120 -0
- package/eject/files/accordion.css +89 -0
- package/eject/files/accordion.ts +67 -0
- package/eject/files/avatar-stack.ts +57 -0
- package/eject/files/avatar.ts +42 -0
- package/eject/files/badge.ts +30 -0
- package/eject/files/banner.ts +68 -0
- package/eject/files/base.css +38 -0
- package/eject/files/button.css +241 -0
- package/eject/files/button.ts +106 -0
- package/eject/files/card.ts +58 -0
- package/eject/files/checkbox.ts +32 -0
- package/eject/files/chip-bar.ts +16 -0
- package/eject/files/chip.ts +35 -0
- package/eject/files/count-badge.ts +32 -0
- package/eject/files/date-picker.css +352 -0
- package/eject/files/date-picker.ts +250 -0
- package/eject/files/date-range-picker.ts +323 -0
- package/eject/files/dialog.css +139 -0
- package/eject/files/dialog.ts +15 -0
- package/eject/files/divider.ts +5 -0
- package/eject/files/empty-state.ts +22 -0
- package/eject/files/icon.ts +36 -0
- package/eject/files/list-row.ts +66 -0
- package/eject/files/media-card.ts +66 -0
- package/eject/files/menu.css +176 -0
- package/eject/files/menu.ts +84 -0
- package/eject/files/parts.ts +17 -0
- package/eject/files/progress-bar.ts +23 -0
- package/eject/files/radio-group.css +160 -0
- package/eject/files/radio-group.ts +24 -0
- package/eject/files/section-header.ts +32 -0
- package/eject/files/segmented-control.ts +30 -0
- package/eject/files/select.css +285 -0
- package/eject/files/select.ts +36 -0
- package/eject/files/sidebar.ts +75 -0
- package/eject/files/skeleton.ts +51 -0
- package/eject/files/slider.css +136 -0
- package/eject/files/slider.ts +65 -0
- package/eject/files/spinner.ts +22 -0
- package/eject/files/switch.ts +34 -0
- package/eject/files/tabs.css +112 -0
- package/eject/files/tabs.ts +35 -0
- package/eject/files/text-field.css +229 -0
- package/eject/files/text-field.ts +48 -0
- package/eject/files/text.ts +38 -0
- package/eject/files/thumbnail.ts +51 -0
- package/eject/files/toast.ts +31 -0
- package/eject/files/tooltip.css +104 -0
- package/eject/files/tooltip.ts +21 -0
- package/eject/manifest.json +814 -0
- package/package.json +66 -4
- package/page.css +20 -0
- package/styles.css +3252 -0
- package/tailwind.css +2665 -0
package/dist/Chip.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
|
+
import { chipClass, chipIcon, classes, rootPart } from "@xds/core";
|
|
3
|
+
import { Icon } from "./Icon.js";
|
|
4
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
|
+
export function Chip(t0) {
|
|
6
|
+
const $ = _c(16);
|
|
7
|
+
const {
|
|
8
|
+
label,
|
|
9
|
+
selected: t1,
|
|
10
|
+
onPress,
|
|
11
|
+
iconStart,
|
|
12
|
+
disabled: t2,
|
|
13
|
+
className,
|
|
14
|
+
style
|
|
15
|
+
} = t0;
|
|
16
|
+
const selected = t1 === undefined ? false : t1;
|
|
17
|
+
const disabled = t2 === undefined ? false : t2;
|
|
18
|
+
let t3;
|
|
19
|
+
if ($[0] !== iconStart || $[1] !== selected) {
|
|
20
|
+
t3 = chipIcon({
|
|
21
|
+
selected,
|
|
22
|
+
iconStart
|
|
23
|
+
});
|
|
24
|
+
$[0] = iconStart;
|
|
25
|
+
$[1] = selected;
|
|
26
|
+
$[2] = t3;
|
|
27
|
+
} else {
|
|
28
|
+
t3 = $[2];
|
|
29
|
+
}
|
|
30
|
+
const icon = t3;
|
|
31
|
+
let t4;
|
|
32
|
+
if ($[3] !== className || $[4] !== selected) {
|
|
33
|
+
t4 = classes(rootPart("Chip"), chipClass(selected), className);
|
|
34
|
+
$[3] = className;
|
|
35
|
+
$[4] = selected;
|
|
36
|
+
$[5] = t4;
|
|
37
|
+
} else {
|
|
38
|
+
t4 = $[5];
|
|
39
|
+
}
|
|
40
|
+
let t5;
|
|
41
|
+
if ($[6] !== icon) {
|
|
42
|
+
t5 = icon && /*#__PURE__*/_jsx(Icon, {
|
|
43
|
+
name: icon,
|
|
44
|
+
size: "sm"
|
|
45
|
+
});
|
|
46
|
+
$[6] = icon;
|
|
47
|
+
$[7] = t5;
|
|
48
|
+
} else {
|
|
49
|
+
t5 = $[7];
|
|
50
|
+
}
|
|
51
|
+
let t6;
|
|
52
|
+
if ($[8] !== disabled || $[9] !== label || $[10] !== onPress || $[11] !== selected || $[12] !== style || $[13] !== t4 || $[14] !== t5) {
|
|
53
|
+
t6 = /*#__PURE__*/_jsxs("button", {
|
|
54
|
+
type: "button",
|
|
55
|
+
"aria-pressed": selected,
|
|
56
|
+
disabled: disabled,
|
|
57
|
+
onClick: onPress,
|
|
58
|
+
className: t4,
|
|
59
|
+
style: style,
|
|
60
|
+
children: [t5, label]
|
|
61
|
+
});
|
|
62
|
+
$[8] = disabled;
|
|
63
|
+
$[9] = label;
|
|
64
|
+
$[10] = onPress;
|
|
65
|
+
$[11] = selected;
|
|
66
|
+
$[12] = style;
|
|
67
|
+
$[13] = t4;
|
|
68
|
+
$[14] = t5;
|
|
69
|
+
$[15] = t6;
|
|
70
|
+
} else {
|
|
71
|
+
t6 = $[15];
|
|
72
|
+
}
|
|
73
|
+
return t6;
|
|
74
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type ChipBarBaseProps } from "@xds/core";
|
|
2
|
+
import type { ReactNode } from "react";
|
|
3
|
+
import type { RootProps } from "./root.ts";
|
|
4
|
+
export type ChipBarProps = ChipBarBaseProps & RootProps & {
|
|
5
|
+
/** The chips. Which of them are selected is the app's business: the bar holds no state. */
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* One row of chips. It scrolls sideways when the chips do not fit and never wraps, so the
|
|
10
|
+
* content under it stays where it is.
|
|
11
|
+
*/
|
|
12
|
+
export declare function ChipBar({ label, className, style, children }: ChipBarProps): import("react").JSX.Element;
|
package/dist/ChipBar.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
|
+
import { chipBarClass, classes, rootPart } from "@xds/core";
|
|
3
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
+
export function ChipBar(t0) {
|
|
5
|
+
const $ = _c(7);
|
|
6
|
+
const {
|
|
7
|
+
label,
|
|
8
|
+
className,
|
|
9
|
+
style,
|
|
10
|
+
children
|
|
11
|
+
} = t0;
|
|
12
|
+
let t1;
|
|
13
|
+
if ($[0] !== className) {
|
|
14
|
+
t1 = classes(rootPart("ChipBar"), chipBarClass, className);
|
|
15
|
+
$[0] = className;
|
|
16
|
+
$[1] = t1;
|
|
17
|
+
} else {
|
|
18
|
+
t1 = $[1];
|
|
19
|
+
}
|
|
20
|
+
let t2;
|
|
21
|
+
if ($[2] !== children || $[3] !== label || $[4] !== style || $[5] !== t1) {
|
|
22
|
+
t2 = /*#__PURE__*/_jsx("div", {
|
|
23
|
+
role: "group",
|
|
24
|
+
"aria-label": label,
|
|
25
|
+
className: t1,
|
|
26
|
+
style: style,
|
|
27
|
+
children: children
|
|
28
|
+
});
|
|
29
|
+
$[2] = children;
|
|
30
|
+
$[3] = label;
|
|
31
|
+
$[4] = style;
|
|
32
|
+
$[5] = t1;
|
|
33
|
+
$[6] = t2;
|
|
34
|
+
} else {
|
|
35
|
+
t2 = $[6];
|
|
36
|
+
}
|
|
37
|
+
return t2;
|
|
38
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type CountBadgeBaseProps } from "@xds/core";
|
|
2
|
+
import type { ReactNode } from "react";
|
|
3
|
+
import type { RootProps } from "./root.ts";
|
|
4
|
+
export type CountBadgeProps = CountBadgeBaseProps & RootProps & {
|
|
5
|
+
/** What the count belongs to: an icon, an avatar, a button. The badge sits on its corner. */
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* A count of something waiting: unread messages, items in a cart. On its own it is laid out
|
|
10
|
+
* inline; around a child it sits on the child's top end corner.
|
|
11
|
+
*/
|
|
12
|
+
export declare function CountBadge({ count, max, label, className, style, children }: CountBadgeProps): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
|
+
import { countBadgeAnchorClass, countBadgeClass, classes, countBadgeText, rootPart } from "@xds/core";
|
|
3
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
|
+
export function CountBadge(t0) {
|
|
5
|
+
const $ = _c(14);
|
|
6
|
+
const {
|
|
7
|
+
count,
|
|
8
|
+
max,
|
|
9
|
+
label,
|
|
10
|
+
className,
|
|
11
|
+
style,
|
|
12
|
+
children
|
|
13
|
+
} = t0;
|
|
14
|
+
const anchored = children !== undefined;
|
|
15
|
+
let t1;
|
|
16
|
+
if ($[0] !== anchored || $[1] !== className || $[2] !== count || $[3] !== label || $[4] !== max || $[5] !== style) {
|
|
17
|
+
t1 = count > 0 && /*#__PURE__*/_jsx("span", {
|
|
18
|
+
...(label ? {
|
|
19
|
+
role: "img",
|
|
20
|
+
"aria-label": label
|
|
21
|
+
} : {}),
|
|
22
|
+
className: anchored ? countBadgeClass(true) : classes(rootPart("CountBadge"), countBadgeClass(false), className),
|
|
23
|
+
style: anchored ? undefined : style,
|
|
24
|
+
children: countBadgeText(count, max)
|
|
25
|
+
});
|
|
26
|
+
$[0] = anchored;
|
|
27
|
+
$[1] = className;
|
|
28
|
+
$[2] = count;
|
|
29
|
+
$[3] = label;
|
|
30
|
+
$[4] = max;
|
|
31
|
+
$[5] = style;
|
|
32
|
+
$[6] = t1;
|
|
33
|
+
} else {
|
|
34
|
+
t1 = $[6];
|
|
35
|
+
}
|
|
36
|
+
const badge = t1;
|
|
37
|
+
if (!anchored) {
|
|
38
|
+
return badge || null;
|
|
39
|
+
}
|
|
40
|
+
let t2;
|
|
41
|
+
if ($[7] !== className) {
|
|
42
|
+
t2 = classes(rootPart("CountBadge"), countBadgeAnchorClass, className);
|
|
43
|
+
$[7] = className;
|
|
44
|
+
$[8] = t2;
|
|
45
|
+
} else {
|
|
46
|
+
t2 = $[8];
|
|
47
|
+
}
|
|
48
|
+
let t3;
|
|
49
|
+
if ($[9] !== badge || $[10] !== children || $[11] !== style || $[12] !== t2) {
|
|
50
|
+
t3 = /*#__PURE__*/_jsxs("span", {
|
|
51
|
+
className: t2,
|
|
52
|
+
style: style,
|
|
53
|
+
children: [children, badge]
|
|
54
|
+
});
|
|
55
|
+
$[9] = badge;
|
|
56
|
+
$[10] = children;
|
|
57
|
+
$[11] = style;
|
|
58
|
+
$[12] = t2;
|
|
59
|
+
$[13] = t3;
|
|
60
|
+
} else {
|
|
61
|
+
t3 = $[13];
|
|
62
|
+
}
|
|
63
|
+
return t3;
|
|
64
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type DatePickerBaseProps, type IsoDate } from "@xds/core";
|
|
2
|
+
import type { RootProps } from "./root.ts";
|
|
3
|
+
export type { IsoDate } from "@xds/core";
|
|
4
|
+
export type DatePickerProps = DatePickerBaseProps & RootProps & {
|
|
5
|
+
onChange: (value: IsoDate) => void;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* A field for choosing one day. Closed, it looks like a Select: the chosen day in the locale's
|
|
9
|
+
* medium form, or the placeholder. Pressed, it opens a calendar of one month under itself, on
|
|
10
|
+
* the chosen day, or on today while none is. A press on a day, or Enter on the focused one,
|
|
11
|
+
* calls `onChange` with the day as `YYYY-MM-DD` and closes the calendar; Escape or a press
|
|
12
|
+
* outside closes it without a choice.
|
|
13
|
+
*
|
|
14
|
+
* The field is a button that says it opens a dialog and whether it is open. In the calendar the
|
|
15
|
+
* arrow keys move a day or a week, Page Up and Page Down a month (a year with Shift), and Home
|
|
16
|
+
* and End to the first and the last day of the month, never past `min` or `max`. Tab goes round
|
|
17
|
+
* the month buttons and the focused day. The chosen day is selected for assistive technology,
|
|
18
|
+
* and today is the current date.
|
|
19
|
+
*/
|
|
20
|
+
export declare function DatePicker({ onChange, className, style, ...props }: DatePickerProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,429 @@
|
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
|
+
import { classes, DATE_PICKER_NAV_CLASS, datePickerContentAttrs, datePickerIds, datePickerLocale, datePickerMachineProps, datePickerTriggerAttrs, focusOpeningDay, formatDay, keepCalendarFocus, keepDayFocused } from "@xds/core";
|
|
3
|
+
import * as datePicker from "@zag-js/date-picker";
|
|
4
|
+
import { mergeProps, normalizeProps, useMachine } from "@zag-js/react";
|
|
5
|
+
import { useEffect, useId, useRef } from "react";
|
|
6
|
+
import { Icon } from "./Icon.js";
|
|
7
|
+
import { useModalPopover } from "./modal-popover.js";
|
|
8
|
+
import { Portal } from "./portal.js";
|
|
9
|
+
import { usePresence } from "./presence.js";
|
|
10
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
export function DatePicker(t0) {
|
|
12
|
+
const $ = _c(67);
|
|
13
|
+
const {
|
|
14
|
+
onChange,
|
|
15
|
+
className,
|
|
16
|
+
style,
|
|
17
|
+
...props
|
|
18
|
+
} = t0;
|
|
19
|
+
const {
|
|
20
|
+
label,
|
|
21
|
+
value,
|
|
22
|
+
placeholder,
|
|
23
|
+
description,
|
|
24
|
+
error,
|
|
25
|
+
name
|
|
26
|
+
} = props;
|
|
27
|
+
const id = useId();
|
|
28
|
+
const ids = datePickerIds(id);
|
|
29
|
+
const locale = datePickerLocale();
|
|
30
|
+
const service = useMachine(datePicker.machine, datePickerMachineProps(props, {
|
|
31
|
+
id,
|
|
32
|
+
locale,
|
|
33
|
+
onChange
|
|
34
|
+
}));
|
|
35
|
+
const api = datePicker.connect(service, normalizeProps);
|
|
36
|
+
const trigger = api.getTriggerProps();
|
|
37
|
+
const positioner = useRef(null);
|
|
38
|
+
const surface = useRef(null);
|
|
39
|
+
let t1;
|
|
40
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
41
|
+
t1 = () => positioner.current;
|
|
42
|
+
$[0] = t1;
|
|
43
|
+
} else {
|
|
44
|
+
t1 = $[0];
|
|
45
|
+
}
|
|
46
|
+
useModalPopover(api.open, t1);
|
|
47
|
+
let t2;
|
|
48
|
+
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
49
|
+
t2 = () => [surface.current];
|
|
50
|
+
$[1] = t2;
|
|
51
|
+
} else {
|
|
52
|
+
t2 = $[1];
|
|
53
|
+
}
|
|
54
|
+
const present = usePresence(api.open, t2);
|
|
55
|
+
const focused = api.focusedValue.toString();
|
|
56
|
+
const month = api.visibleRange.start.toString();
|
|
57
|
+
useEffect(() => keepDayFocused(api.open, surface.current), [api.open, focused, month]);
|
|
58
|
+
const invalid = error !== undefined;
|
|
59
|
+
const t3 = mergeProps(api.getRootProps(), {
|
|
60
|
+
className: classes("xds-date-picker", className),
|
|
61
|
+
style
|
|
62
|
+
});
|
|
63
|
+
let t4;
|
|
64
|
+
if ($[2] !== api) {
|
|
65
|
+
t4 = api.getControlProps();
|
|
66
|
+
$[2] = api;
|
|
67
|
+
$[3] = t4;
|
|
68
|
+
} else {
|
|
69
|
+
t4 = $[3];
|
|
70
|
+
}
|
|
71
|
+
let t5;
|
|
72
|
+
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
73
|
+
t5 = /*#__PURE__*/_jsx(Icon, {
|
|
74
|
+
name: "calendar",
|
|
75
|
+
size: "sm",
|
|
76
|
+
className: "text-xds-field-placeholder"
|
|
77
|
+
});
|
|
78
|
+
$[4] = t5;
|
|
79
|
+
} else {
|
|
80
|
+
t5 = $[4];
|
|
81
|
+
}
|
|
82
|
+
const T0 = Portal;
|
|
83
|
+
const t6 = api.open && /*#__PURE__*/_jsx("div", {
|
|
84
|
+
className: "xds-date-picker__underlay",
|
|
85
|
+
onMouseDown: _temp
|
|
86
|
+
});
|
|
87
|
+
let t7;
|
|
88
|
+
if ($[5] !== api) {
|
|
89
|
+
t7 = api.getPositionerProps();
|
|
90
|
+
$[5] = api;
|
|
91
|
+
$[6] = t7;
|
|
92
|
+
} else {
|
|
93
|
+
t7 = $[6];
|
|
94
|
+
}
|
|
95
|
+
const t8 = "xds-date-picker__positioner";
|
|
96
|
+
let t9;
|
|
97
|
+
if ($[7] !== api) {
|
|
98
|
+
t9 = api.getContentProps();
|
|
99
|
+
$[7] = api;
|
|
100
|
+
$[8] = t9;
|
|
101
|
+
} else {
|
|
102
|
+
t9 = $[8];
|
|
103
|
+
}
|
|
104
|
+
const t10 = datePickerContentAttrs(ids);
|
|
105
|
+
const t11 = !present;
|
|
106
|
+
let t12;
|
|
107
|
+
if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
|
|
108
|
+
t12 = event_1 => keepCalendarFocus(event_1, surface.current);
|
|
109
|
+
$[9] = t12;
|
|
110
|
+
} else {
|
|
111
|
+
t12 = $[9];
|
|
112
|
+
}
|
|
113
|
+
let t13;
|
|
114
|
+
if ($[10] !== api) {
|
|
115
|
+
t13 = api.getPreviousTriggerProps();
|
|
116
|
+
$[10] = api;
|
|
117
|
+
$[11] = t13;
|
|
118
|
+
} else {
|
|
119
|
+
t13 = $[11];
|
|
120
|
+
}
|
|
121
|
+
let t14;
|
|
122
|
+
if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
|
|
123
|
+
t14 = /*#__PURE__*/_jsx(Icon, {
|
|
124
|
+
name: "chevron-left",
|
|
125
|
+
size: "sm"
|
|
126
|
+
});
|
|
127
|
+
$[12] = t14;
|
|
128
|
+
} else {
|
|
129
|
+
t14 = $[12];
|
|
130
|
+
}
|
|
131
|
+
let t15;
|
|
132
|
+
if ($[13] !== t13) {
|
|
133
|
+
t15 = /*#__PURE__*/_jsx("button", {
|
|
134
|
+
...t13,
|
|
135
|
+
type: "button",
|
|
136
|
+
className: DATE_PICKER_NAV_CLASS,
|
|
137
|
+
children: t14
|
|
138
|
+
});
|
|
139
|
+
$[13] = t13;
|
|
140
|
+
$[14] = t15;
|
|
141
|
+
} else {
|
|
142
|
+
t15 = $[14];
|
|
143
|
+
}
|
|
144
|
+
let t16;
|
|
145
|
+
if ($[15] !== api) {
|
|
146
|
+
t16 = api.getRangeTextProps();
|
|
147
|
+
$[15] = api;
|
|
148
|
+
$[16] = t16;
|
|
149
|
+
} else {
|
|
150
|
+
t16 = $[16];
|
|
151
|
+
}
|
|
152
|
+
let t17;
|
|
153
|
+
if ($[17] !== api.visibleRangeText.start || $[18] !== t16) {
|
|
154
|
+
t17 = /*#__PURE__*/_jsx("span", {
|
|
155
|
+
...t16,
|
|
156
|
+
className: "xds-date-picker__heading",
|
|
157
|
+
children: api.visibleRangeText.start
|
|
158
|
+
});
|
|
159
|
+
$[17] = api.visibleRangeText.start;
|
|
160
|
+
$[18] = t16;
|
|
161
|
+
$[19] = t17;
|
|
162
|
+
} else {
|
|
163
|
+
t17 = $[19];
|
|
164
|
+
}
|
|
165
|
+
let t18;
|
|
166
|
+
if ($[20] !== api) {
|
|
167
|
+
t18 = api.getNextTriggerProps();
|
|
168
|
+
$[20] = api;
|
|
169
|
+
$[21] = t18;
|
|
170
|
+
} else {
|
|
171
|
+
t18 = $[21];
|
|
172
|
+
}
|
|
173
|
+
let t19;
|
|
174
|
+
if ($[22] === Symbol.for("react.memo_cache_sentinel")) {
|
|
175
|
+
t19 = /*#__PURE__*/_jsx(Icon, {
|
|
176
|
+
name: "chevron-right",
|
|
177
|
+
size: "sm"
|
|
178
|
+
});
|
|
179
|
+
$[22] = t19;
|
|
180
|
+
} else {
|
|
181
|
+
t19 = $[22];
|
|
182
|
+
}
|
|
183
|
+
let t20;
|
|
184
|
+
if ($[23] !== t18) {
|
|
185
|
+
t20 = /*#__PURE__*/_jsx("button", {
|
|
186
|
+
...t18,
|
|
187
|
+
type: "button",
|
|
188
|
+
className: DATE_PICKER_NAV_CLASS,
|
|
189
|
+
children: t19
|
|
190
|
+
});
|
|
191
|
+
$[23] = t18;
|
|
192
|
+
$[24] = t20;
|
|
193
|
+
} else {
|
|
194
|
+
t20 = $[24];
|
|
195
|
+
}
|
|
196
|
+
let t21;
|
|
197
|
+
if ($[25] !== t15 || $[26] !== t17 || $[27] !== t20) {
|
|
198
|
+
t21 = /*#__PURE__*/_jsxs("div", {
|
|
199
|
+
className: "xds-date-picker__header",
|
|
200
|
+
children: [t15, t17, t20]
|
|
201
|
+
});
|
|
202
|
+
$[25] = t15;
|
|
203
|
+
$[26] = t17;
|
|
204
|
+
$[27] = t20;
|
|
205
|
+
$[28] = t21;
|
|
206
|
+
} else {
|
|
207
|
+
t21 = $[28];
|
|
208
|
+
}
|
|
209
|
+
let t22;
|
|
210
|
+
if ($[29] !== api) {
|
|
211
|
+
t22 = api.getTableProps({
|
|
212
|
+
view: "day"
|
|
213
|
+
});
|
|
214
|
+
$[29] = api;
|
|
215
|
+
$[30] = t22;
|
|
216
|
+
} else {
|
|
217
|
+
t22 = $[30];
|
|
218
|
+
}
|
|
219
|
+
let t23;
|
|
220
|
+
if ($[31] !== api) {
|
|
221
|
+
t23 = api.getTableHeadProps({
|
|
222
|
+
view: "day"
|
|
223
|
+
});
|
|
224
|
+
$[31] = api;
|
|
225
|
+
$[32] = t23;
|
|
226
|
+
} else {
|
|
227
|
+
t23 = $[32];
|
|
228
|
+
}
|
|
229
|
+
let t24;
|
|
230
|
+
if ($[33] !== api) {
|
|
231
|
+
t24 = api.getTableRowProps({
|
|
232
|
+
view: "day"
|
|
233
|
+
});
|
|
234
|
+
$[33] = api;
|
|
235
|
+
$[34] = t24;
|
|
236
|
+
} else {
|
|
237
|
+
t24 = $[34];
|
|
238
|
+
}
|
|
239
|
+
let t25;
|
|
240
|
+
if ($[35] !== api.weekDays) {
|
|
241
|
+
t25 = api.weekDays.map(_temp2);
|
|
242
|
+
$[35] = api.weekDays;
|
|
243
|
+
$[36] = t25;
|
|
244
|
+
} else {
|
|
245
|
+
t25 = $[36];
|
|
246
|
+
}
|
|
247
|
+
let t26;
|
|
248
|
+
if ($[37] !== t24 || $[38] !== t25) {
|
|
249
|
+
t26 = /*#__PURE__*/_jsx("tr", {
|
|
250
|
+
...t24,
|
|
251
|
+
children: t25
|
|
252
|
+
});
|
|
253
|
+
$[37] = t24;
|
|
254
|
+
$[38] = t25;
|
|
255
|
+
$[39] = t26;
|
|
256
|
+
} else {
|
|
257
|
+
t26 = $[39];
|
|
258
|
+
}
|
|
259
|
+
let t27;
|
|
260
|
+
if ($[40] !== t23 || $[41] !== t26) {
|
|
261
|
+
t27 = /*#__PURE__*/_jsx("thead", {
|
|
262
|
+
...t23,
|
|
263
|
+
children: t26
|
|
264
|
+
});
|
|
265
|
+
$[40] = t23;
|
|
266
|
+
$[41] = t26;
|
|
267
|
+
$[42] = t27;
|
|
268
|
+
} else {
|
|
269
|
+
t27 = $[42];
|
|
270
|
+
}
|
|
271
|
+
let t28;
|
|
272
|
+
if ($[43] !== api) {
|
|
273
|
+
t28 = api.getTableBodyProps({
|
|
274
|
+
view: "day"
|
|
275
|
+
});
|
|
276
|
+
$[43] = api;
|
|
277
|
+
$[44] = t28;
|
|
278
|
+
} else {
|
|
279
|
+
t28 = $[44];
|
|
280
|
+
}
|
|
281
|
+
let t29;
|
|
282
|
+
if ($[45] !== api) {
|
|
283
|
+
t29 = api.weeks.map(week => /*#__PURE__*/_jsx("tr", {
|
|
284
|
+
...api.getTableRowProps({
|
|
285
|
+
view: "day"
|
|
286
|
+
}),
|
|
287
|
+
children: week.map(date => /*#__PURE__*/_jsx("td", {
|
|
288
|
+
...api.getDayTableCellProps({
|
|
289
|
+
value: date
|
|
290
|
+
}),
|
|
291
|
+
className: "xds-date-picker__cell",
|
|
292
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
293
|
+
...api.getDayTableCellTriggerProps({
|
|
294
|
+
value: date
|
|
295
|
+
}),
|
|
296
|
+
className: "xds-date-picker__day",
|
|
297
|
+
children: date.day
|
|
298
|
+
})
|
|
299
|
+
}, date.toString()))
|
|
300
|
+
}, week[0]?.toString()));
|
|
301
|
+
$[45] = api;
|
|
302
|
+
$[46] = t29;
|
|
303
|
+
} else {
|
|
304
|
+
t29 = $[46];
|
|
305
|
+
}
|
|
306
|
+
let t30;
|
|
307
|
+
if ($[47] !== t28 || $[48] !== t29) {
|
|
308
|
+
t30 = /*#__PURE__*/_jsx("tbody", {
|
|
309
|
+
...t28,
|
|
310
|
+
children: t29
|
|
311
|
+
});
|
|
312
|
+
$[47] = t28;
|
|
313
|
+
$[48] = t29;
|
|
314
|
+
$[49] = t30;
|
|
315
|
+
} else {
|
|
316
|
+
t30 = $[49];
|
|
317
|
+
}
|
|
318
|
+
let t31;
|
|
319
|
+
if ($[50] !== t22 || $[51] !== t27 || $[52] !== t30) {
|
|
320
|
+
t31 = /*#__PURE__*/_jsxs("table", {
|
|
321
|
+
...t22,
|
|
322
|
+
className: "xds-date-picker__grid",
|
|
323
|
+
children: [t27, t30]
|
|
324
|
+
});
|
|
325
|
+
$[50] = t22;
|
|
326
|
+
$[51] = t27;
|
|
327
|
+
$[52] = t30;
|
|
328
|
+
$[53] = t31;
|
|
329
|
+
} else {
|
|
330
|
+
t31 = $[53];
|
|
331
|
+
}
|
|
332
|
+
let t32;
|
|
333
|
+
if ($[54] !== t10 || $[55] !== t11 || $[56] !== t21 || $[57] !== t31 || $[58] !== t9) {
|
|
334
|
+
t32 = /*#__PURE__*/_jsxs("div", {
|
|
335
|
+
...t9,
|
|
336
|
+
...t10,
|
|
337
|
+
ref: surface,
|
|
338
|
+
hidden: t11,
|
|
339
|
+
onKeyDown: t12,
|
|
340
|
+
className: "xds-date-picker__content",
|
|
341
|
+
children: [t21, t31]
|
|
342
|
+
});
|
|
343
|
+
$[54] = t10;
|
|
344
|
+
$[55] = t11;
|
|
345
|
+
$[56] = t21;
|
|
346
|
+
$[57] = t31;
|
|
347
|
+
$[58] = t9;
|
|
348
|
+
$[59] = t32;
|
|
349
|
+
} else {
|
|
350
|
+
t32 = $[59];
|
|
351
|
+
}
|
|
352
|
+
let t33;
|
|
353
|
+
if ($[60] !== t32 || $[61] !== t7) {
|
|
354
|
+
t33 = /*#__PURE__*/_jsx("div", {
|
|
355
|
+
...t7,
|
|
356
|
+
ref: positioner,
|
|
357
|
+
className: t8,
|
|
358
|
+
children: t32
|
|
359
|
+
});
|
|
360
|
+
$[60] = t32;
|
|
361
|
+
$[61] = t7;
|
|
362
|
+
$[62] = t33;
|
|
363
|
+
} else {
|
|
364
|
+
t33 = $[62];
|
|
365
|
+
}
|
|
366
|
+
let t34;
|
|
367
|
+
if ($[63] !== T0 || $[64] !== t33 || $[65] !== t6) {
|
|
368
|
+
t34 = /*#__PURE__*/_jsxs(T0, {
|
|
369
|
+
children: [t6, t33]
|
|
370
|
+
});
|
|
371
|
+
$[63] = T0;
|
|
372
|
+
$[64] = t33;
|
|
373
|
+
$[65] = t6;
|
|
374
|
+
$[66] = t34;
|
|
375
|
+
} else {
|
|
376
|
+
t34 = $[66];
|
|
377
|
+
}
|
|
378
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
379
|
+
...t3,
|
|
380
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
381
|
+
id: ids.label,
|
|
382
|
+
className: "xds-date-picker__label",
|
|
383
|
+
children: label
|
|
384
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
385
|
+
...t4,
|
|
386
|
+
className: "xds-date-picker__control",
|
|
387
|
+
children: /*#__PURE__*/_jsxs("button", {
|
|
388
|
+
...trigger,
|
|
389
|
+
...datePickerTriggerAttrs(props, ids),
|
|
390
|
+
type: "button",
|
|
391
|
+
onClick: event => {
|
|
392
|
+
focusOpeningDay(api, props);
|
|
393
|
+
trigger.onClick?.(event);
|
|
394
|
+
},
|
|
395
|
+
className: "xds-date-picker__trigger",
|
|
396
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
397
|
+
id: ids.value,
|
|
398
|
+
className: "xds-date-picker__value",
|
|
399
|
+
children: value === undefined ? placeholder : formatDay(value, locale)
|
|
400
|
+
}), t5]
|
|
401
|
+
})
|
|
402
|
+
}), (invalid || description) && /*#__PURE__*/_jsx("div", {
|
|
403
|
+
className: "xds-date-picker__footer",
|
|
404
|
+
children: invalid ? /*#__PURE__*/_jsx("span", {
|
|
405
|
+
id: ids.error,
|
|
406
|
+
className: "xds-date-picker__error",
|
|
407
|
+
children: error
|
|
408
|
+
}) : /*#__PURE__*/_jsx("span", {
|
|
409
|
+
id: ids.description,
|
|
410
|
+
className: "xds-date-picker__description",
|
|
411
|
+
children: description
|
|
412
|
+
})
|
|
413
|
+
}), name !== undefined && /*#__PURE__*/_jsx("input", {
|
|
414
|
+
type: "hidden",
|
|
415
|
+
name: name,
|
|
416
|
+
value: value ?? ""
|
|
417
|
+
}), t34]
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
function _temp2(weekDay) {
|
|
421
|
+
return /*#__PURE__*/_jsx("th", {
|
|
422
|
+
scope: "col",
|
|
423
|
+
className: "xds-date-picker__weekday",
|
|
424
|
+
children: weekDay.narrow
|
|
425
|
+
}, weekDay.long);
|
|
426
|
+
}
|
|
427
|
+
function _temp(event_0) {
|
|
428
|
+
return event_0.preventDefault();
|
|
429
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type DateRange, type DateRangePickerBaseProps } from "@xds/core";
|
|
2
|
+
import type { RootProps } from "./root.ts";
|
|
3
|
+
export type { DateRange } from "@xds/core";
|
|
4
|
+
export type DateRangePickerProps = DateRangePickerBaseProps & RootProps & {
|
|
5
|
+
onChange: (value: DateRange) => void;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* A field for choosing a range of days, a start and an end, as for a stay. Closed, it looks like
|
|
9
|
+
* a DatePicker and shows both days in the locale's medium form ("Mar 10 – 14, 2026"), or the
|
|
10
|
+
* placeholder. Pressed, it opens a calendar under itself, two months side by side where the
|
|
11
|
+
* window has room and one where it does not, on the start's month, or on today's while nothing
|
|
12
|
+
* is chosen.
|
|
13
|
+
*
|
|
14
|
+
* The first day pressed starts the range, and the band previews it to the day under the pointer
|
|
15
|
+
* or the keyboard's focus. The second ends it, if the days between are at least `minLength` and
|
|
16
|
+
* at most `maxLength`, which leave the other days unavailable meanwhile: `onChange` gets the
|
|
17
|
+
* range and the calendar closes. A day before the start starts again from there. Escape or a
|
|
18
|
+
* press outside closes the calendar without a change.
|
|
19
|
+
*
|
|
20
|
+
* The keys are DatePicker's, and Page Up and Page Down move a month whether one or two are
|
|
21
|
+
* shown. Each month is a grid named by its month; every day of the range is selected, and the
|
|
22
|
+
* two ends are named by `startLabel` and `endLabel` before the day.
|
|
23
|
+
*/
|
|
24
|
+
export declare function DateRangePicker({ onChange, className, style, ...props }: DateRangePickerProps): import("react").JSX.Element;
|