@sdxc/ui 2026.9.14 → 2026.9.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/dist/animations/keyframes.d.ts +6 -0
  2. package/dist/animations/keyframes.js +8 -4
  3. package/dist/components/accordion.js +5 -1
  4. package/dist/components/alert-dialog.js +2 -2
  5. package/dist/components/attachment.js +7 -2
  6. package/dist/components/bubble.js +14 -20
  7. package/dist/components/button.d.ts +0 -14
  8. package/dist/components/button.js +60 -19
  9. package/dist/components/calendar.js +12 -5
  10. package/dist/components/card.js +8 -1
  11. package/dist/components/carousel.js +9 -3
  12. package/dist/components/color-picker.js +23 -4
  13. package/dist/components/color-slider.js +11 -1
  14. package/dist/components/color-wheel.js +14 -4
  15. package/dist/components/command.js +34 -7
  16. package/dist/components/date-picker.d.ts +20 -53
  17. package/dist/components/date-picker.js +50 -108
  18. package/dist/components/date-range-picker.d.ts +22 -43
  19. package/dist/components/date-range-picker.js +8 -52
  20. package/dist/components/dialog.js +27 -4
  21. package/dist/components/disclosure.d.ts +4 -1
  22. package/dist/components/disclosure.js +52 -11
  23. package/dist/components/drawer.js +16 -0
  24. package/dist/components/drop-indicator.d.ts +9 -8
  25. package/dist/components/drop-indicator.js +19 -6
  26. package/dist/components/empty.js +18 -3
  27. package/dist/components/file-trigger.js +35 -15
  28. package/dist/components/form.d.ts +15 -1
  29. package/dist/components/form.js +16 -6
  30. package/dist/components/grid-list.js +23 -7
  31. package/dist/components/group.d.ts +6 -6
  32. package/dist/components/group.js +28 -6
  33. package/dist/components/hover-card.js +38 -2
  34. package/dist/components/image-placeholder.js +8 -2
  35. package/dist/components/input.js +22 -21
  36. package/dist/components/item.js +9 -1
  37. package/dist/components/keyboard.d.ts +7 -7
  38. package/dist/components/keyboard.js +33 -7
  39. package/dist/components/link-button.js +32 -18
  40. package/dist/components/listbox.js +10 -1
  41. package/dist/components/menu.js +8 -2
  42. package/dist/components/message-scroller.js +19 -6
  43. package/dist/components/meter.js +17 -8
  44. package/dist/components/number-field.js +9 -3
  45. package/dist/components/overlay-arrow.js +16 -2
  46. package/dist/components/popover.js +31 -8
  47. package/dist/components/range-calendar.js +18 -4
  48. package/dist/components/search-field.d.ts +26 -1
  49. package/dist/components/search-field.js +84 -4
  50. package/dist/components/select.d.ts +7 -1
  51. package/dist/components/select.js +33 -29
  52. package/dist/components/sidebar.js +32 -11
  53. package/dist/components/slider.js +10 -6
  54. package/dist/components/table.js +2 -2
  55. package/dist/components/toggle-button.js +39 -15
  56. package/dist/components/tree.d.ts +6 -6
  57. package/dist/components/tree.js +25 -9
  58. package/dist/components/typeset.js +12 -1
  59. package/dist/mixins/calendar-keys.d.ts +6 -6
  60. package/dist/mixins/calendar-keys.js +35 -6
  61. package/dist/mixins/carousel-controls.d.ts +4 -2
  62. package/dist/mixins/carousel-controls.js +71 -20
  63. package/dist/mixins/clear-field.d.ts +9 -7
  64. package/dist/mixins/clear-field.js +25 -8
  65. package/dist/mixins/command-keys.js +22 -7
  66. package/dist/mixins/context-menu.d.ts +2 -0
  67. package/dist/mixins/context-menu.js +27 -1
  68. package/dist/mixins/copy-to-clipboard.js +15 -1
  69. package/dist/mixins/grid-list-keys.d.ts +6 -6
  70. package/dist/mixins/grid-list-keys.js +28 -6
  71. package/dist/mixins/hotkey.js +16 -9
  72. package/dist/mixins/index.d.ts +1 -0
  73. package/dist/mixins/index.js +1 -0
  74. package/dist/mixins/listbox-keys.js +20 -2
  75. package/dist/mixins/message-follow.js +50 -12
  76. package/dist/mixins/mirror-selected-option.d.ts +24 -0
  77. package/dist/mixins/mirror-selected-option.js +35 -0
  78. package/dist/mixins/treeKeys.d.ts +3 -2
  79. package/dist/mixins/treeKeys.js +53 -6
  80. package/dist/mixins/validate.d.ts +1 -1
  81. package/package.json +5 -5
  82. package/src/reset.css +6 -4
  83. package/src/theme.css +33 -3
@@ -1,19 +1,16 @@
1
1
  /**
2
- * A labeled date field building on {@link DateField} for its plain fallback,
3
- * extended with a {@link DatePicker.Group} row and a trigger
4
- * {@link DatePicker.Button} for composing a {@link DatePicker.Dialog} —
5
- * a Popover-hosted calendar surface — alongside it. Composing
6
- * {@link DatePicker.Group} and {@link DatePicker.Dialog} as children swaps in
7
- * that richer trigger-and-calendar layout in place of the plain fallback
8
- * field; leaving `children` unset keeps the fallback on its own, a complete,
9
- * keyboard-operable control with no composed surface at all.
2
+ * A labeled date field built on {@link DateField}, with a
3
+ * {@link DatePicker.Group} row for composing more than one field into a single
4
+ * control. The calendar is the platform's: the field is a native date input, so
5
+ * the picker, its keyboard handling and its locale all come from the browser and
6
+ * all of it works before any script loads. Leaving `children` unset renders the
7
+ * field on its own.
10
8
  *
11
9
  * @author [Sergio Xalambrí](https://sergiodxa.com)
12
10
  * @copyright Sergio Xalambrí 2026
13
11
  */
14
12
  import type { Handle, Props as TagProps, RemixNode } from "remix/ui";
15
13
  import { DateField } from "./date-field.js";
16
- import { Popover } from "./popover.js";
17
14
  /**
18
15
  * Prop types for {@link DatePicker} and its compound parts.
19
16
  */
@@ -26,15 +23,15 @@ export declare namespace DatePicker {
26
23
  type Color = DateField.Color;
27
24
  /**
28
25
  * Every prop {@link DateField.PartsProps} accepts, applied only to the
29
- * fallback field's internally composed parts; the composed layout styles
30
- * {@link DatePicker.Group} and {@link DatePicker.Button} individually.
26
+ * field's internally composed parts; a composed layout styles the controls
27
+ * inside {@link DatePicker.Group} individually.
31
28
  */
32
29
  interface PartsProps extends DateField.PartsProps {
33
30
  }
34
31
  /**
35
- * Props accepted by {@link DatePicker}. Leaving `children` unset renders
36
- * the plain fallback field using every prop below; composing
37
- * {@link DatePicker.Group} and {@link DatePicker.Dialog} instead renders the richer layout and leaves every prop below unread.
32
+ * Props accepted by {@link DatePicker}. Leaving `children` unset renders the
33
+ * field using every prop below; composing {@link DatePicker.Group} instead
34
+ * renders the joined row and leaves every prop below unread.
38
35
  */
39
36
  interface Props extends Omit<TagProps<"div">, "children"> {
40
37
  /** Semantic color role for the fallback field's focus ring. Read only when `children` is unset. */
@@ -68,38 +65,25 @@ export declare namespace DatePicker {
68
65
  /** Per-part styling for the fallback field's internally composed parts. Read only when `children` is unset. */
69
66
  parts?: PartsProps;
70
67
  /**
71
- * The trigger-and-calendar layout — typically a `Label`,
72
- * {@link DatePicker.Group}, and {@link DatePicker.Dialog} — rendered in
73
- * place of the plain fallback field, leaving every field above unread.
68
+ * The composed layout — typically a `Label` and a
69
+ * {@link DatePicker.Group} — rendered in place of the field, leaving every
70
+ * field above unread.
74
71
  */
75
72
  children?: RemixNode;
76
73
  }
77
74
  /**
78
75
  * Every native `<div>` attribute, unchanged, plus the `mix` passthrough.
79
- * `children` composes the field's own control and
80
- * {@link DatePicker.Button} into one visual row.
76
+ * `children` composes the field's own control, and a second one for a
77
+ * range, into one visual row.
81
78
  */
82
79
  interface GroupProps extends TagProps<"div"> {
83
80
  }
84
- /**
85
- * Every native `<button>` attribute except `children`, fixed to this
86
- * button's own calendar glyph, plus the `mix` passthrough. `type`
87
- * defaults to {@link DEFAULT_BUTTON_TYPE}; point `commandfor` at {@link DatePicker.Dialog}'s `id` with `command="toggle-popover"` to wire it up as the surface's invoker.
88
- */
89
- interface ButtonProps extends Omit<TagProps<"button">, "children"> {
90
- }
91
- /**
92
- * Every prop {@link Popover.Props} accepts, since {@link DatePicker.Dialog}
93
- * renders one directly as its host. `placement` defaults to
94
- * {@link DEFAULT_DIALOG_PLACEMENT}.
95
- */
96
- interface DialogProps extends Popover.Props {
97
- }
98
81
  }
99
82
  /**
100
- * Renders {@link DatePicker}'s root. Leaving `children` unset renders the
101
- * plain fallback field, passing every prop above through unchanged;
102
- * composing {@link DatePicker.Group} and {@link DatePicker.Dialog} as `children` instead renders the richer layout and leaves those props unread.
83
+ * Renders {@link DatePicker}'s root. Leaving `children` unset renders the field,
84
+ * passing every prop above through unchanged; composing
85
+ * {@link DatePicker.Group} as `children` instead renders the joined row and
86
+ * leaves those props unread.
103
87
  *
104
88
  * @param handle Runtime handle carrying the root element's props.
105
89
  * @returns The render function producing the date picker's markup.
@@ -110,27 +94,10 @@ export declare namespace DatePicker {
110
94
  * <Label htmlFor="startDate">{t("form.startDate.label")}</Label>
111
95
  * <DatePicker.Group>
112
96
  * <Input id="startDate" type="date" name="startDate" />
113
- * <DatePicker.Button
114
- * commandfor="startDate-calendar"
115
- * command="toggle-popover"
116
- * aria-label={t("form.startDate.toggle")}
117
- * />
118
97
  * </DatePicker.Group>
119
- * <DatePicker.Dialog id="startDate-calendar">
120
- * <Calendar aria-label={monthLabel}>
121
- * <Calendar.Header>
122
- * <Calendar.PreviousButton aria-label={t("calendar.previous")} />
123
- * <Calendar.Heading>{monthLabel}</Calendar.Heading>
124
- * <Calendar.NextButton aria-label={t("calendar.next")} />
125
- * </Calendar.Header>
126
- * <Calendar.Grid aria-label={monthLabel}>...</Calendar.Grid>
127
- * </Calendar>
128
- * </DatePicker.Dialog>
129
98
  * </DatePicker>
130
99
  */
131
100
  export declare function DatePicker(handle: Handle<DatePicker.Props>): () => import("remix/ui").RemixElement;
132
101
  export declare namespace DatePicker {
133
102
  var Group: (handle: Handle<DatePicker.GroupProps>) => () => import("remix/ui").RemixElement;
134
- var Button: (handle: Handle<DatePicker.ButtonProps>) => () => import("remix/ui").RemixElement;
135
- var Dialog: (handle: Handle<DatePicker.DialogProps>) => () => import("remix/ui").RemixElement;
136
103
  }
@@ -1,37 +1,17 @@
1
1
  import { jsx as _jsx } from "remix/ui/jsx-runtime";
2
- import { CalendarIcon } from "@sdxc/icons";
3
- import { bg, fg, outline } from "@sdxc/u/color";
4
- import { rounded } from "@sdxc/u/effects";
5
- import { flex, flexCol, gap, items, justify } from "@sdxc/u/layout";
6
- import { bs, is, mis, p } from "@sdxc/u/size";
7
- import { hover, when } from "@sdxc/u/state";
8
- import { attrs } from "remix/ui";
9
- import { interactiveTransition } from "../styles/interactive-transition.js";
10
- import { warnIfNoAccessibleLabel } from "../utils/warn-if-no-accessible-name.js";
2
+ import { outline } from "@sdxc/u/color";
3
+ import { roundedCorner } from "@sdxc/u/effects";
4
+ import { raw } from "@sdxc/u/general";
5
+ import { flex, flexCol, gap, items } from "@sdxc/u/layout";
6
+ import { mis } from "@sdxc/u/size";
7
+ import { z } from "@sdxc/u/stacking";
8
+ import { when } from "@sdxc/u/state";
11
9
  import { DateField } from "./date-field.js";
12
- import { Popover } from "./popover.js";
13
10
  /**
14
- * Default `type` for {@link DatePicker.Button}, keeping a click on the
15
- * trigger from submitting a surrounding `<form>` the way a bare `<button>`'s
16
- * implicit type otherwise would.
17
- */
18
- const DEFAULT_BUTTON_TYPE = "button";
19
- /**
20
- * `role` applied to {@link DatePicker.Dialog}'s host through {@link attrs}
21
- * unless a consumer supplies its own, identifying the surface as a
22
- * non-modal dialog layered above the page.
23
- */
24
- const DEFAULT_DIALOG_ROLE = "dialog";
25
- /**
26
- * Side of the trigger {@link DatePicker.Dialog} renders against when
27
- * `placement` is left unset, reading down and start-ward the way a dropdown
28
- * conventionally does.
29
- */
30
- const DEFAULT_DIALOG_PLACEMENT = "bottom-start";
31
- /**
32
- * Renders {@link DatePicker}'s root. Leaving `children` unset renders the
33
- * plain fallback field, passing every prop above through unchanged;
34
- * composing {@link DatePicker.Group} and {@link DatePicker.Dialog} as `children` instead renders the richer layout and leaves those props unread.
11
+ * Renders {@link DatePicker}'s root. Leaving `children` unset renders the field,
12
+ * passing every prop above through unchanged; composing
13
+ * {@link DatePicker.Group} as `children` instead renders the joined row and
14
+ * leaves those props unread.
35
15
  *
36
16
  * @param handle Runtime handle carrying the root element's props.
37
17
  * @returns The render function producing the date picker's markup.
@@ -42,22 +22,7 @@ const DEFAULT_DIALOG_PLACEMENT = "bottom-start";
42
22
  * <Label htmlFor="startDate">{t("form.startDate.label")}</Label>
43
23
  * <DatePicker.Group>
44
24
  * <Input id="startDate" type="date" name="startDate" />
45
- * <DatePicker.Button
46
- * commandfor="startDate-calendar"
47
- * command="toggle-popover"
48
- * aria-label={t("form.startDate.toggle")}
49
- * />
50
25
  * </DatePicker.Group>
51
- * <DatePicker.Dialog id="startDate-calendar">
52
- * <Calendar aria-label={monthLabel}>
53
- * <Calendar.Header>
54
- * <Calendar.PreviousButton aria-label={t("calendar.previous")} />
55
- * <Calendar.Heading>{monthLabel}</Calendar.Heading>
56
- * <Calendar.NextButton aria-label={t("calendar.next")} />
57
- * </Calendar.Header>
58
- * <Calendar.Grid aria-label={monthLabel}>...</Calendar.Grid>
59
- * </Calendar>
60
- * </DatePicker.Dialog>
61
26
  * </DatePicker>
62
27
  */
63
28
  export function DatePicker(handle) {
@@ -73,16 +38,16 @@ export function DatePicker(handle) {
73
38
  };
74
39
  }
75
40
  /**
76
- * Renders {@link DatePicker}'s control row: a plain flex host laying the
77
- * field's own control and {@link DatePicker.Button} out side by side. The
78
- * row gains a keyboard focus ring whenever focus lands anywhere inside it, since the trigger button sits outside the control's own tab stop.
41
+ * Renders {@link DatePicker}'s control row: a flex host laying one or more date
42
+ * controls side by side and joining their edges, so a pair reads as one field.
43
+ * Focus and validity are drawn the way `Group` draws them — focus by the control
44
+ * that holds it, validity once around the row.
79
45
  *
80
46
  * @param handle Runtime handle carrying the host `<div>`'s props.
81
47
  * @returns The render function producing the row's markup.
82
48
  * @example
83
49
  * <DatePicker.Group>
84
50
  * <Input id="startDate" type="date" name="startDate" />
85
- * <DatePicker.Button commandfor="startDate-calendar" command="toggle-popover" aria-label={t("form.startDate.toggle")} />
86
51
  * </DatePicker.Group>
87
52
  */
88
53
  DatePicker.Group = function DatePickerGroup(handle) {
@@ -91,65 +56,42 @@ DatePicker.Group = function DatePickerGroup(handle) {
91
56
  return (_jsx("div", { ...rest, "data-slot": "group", mix: [
92
57
  flex(),
93
58
  items("center"),
94
- when("&:focus-within", outline({ color: "brand.ring", offset: 2 })),
59
+ /*
60
+ * The fields compose into one control, so the pair keeps the rounding on its own
61
+ * outer corners and the seam the two share is drawn once.
62
+ */
63
+ when("& > *:not(:first-child)", [
64
+ roundedCorner("start-start", "none"),
65
+ roundedCorner("end-start", "none"),
66
+ mis("-1px"),
67
+ ]),
68
+ when("& > *:not(:last-child)", [
69
+ roundedCorner("start-end", "none"),
70
+ roundedCorner("end-end", "none"),
71
+ ]),
72
+ /*
73
+ * Focus is shown by the field that holds it, the way `Group` shows it: a ring
74
+ * around the pair says the group is focused without saying which of its two
75
+ * dates is. The focused one is raised so its own ring crosses the seam rather
76
+ * than being painted over by its neighbour.
77
+ */
78
+ when("& > *:focus-visible", z(1)),
79
+ /*
80
+ * Validity is the pair's, not either field's: a range is one value, and half of
81
+ * one is what makes it invalid. So the ring is drawn once around the group, and
82
+ * the ring each field would draw for itself is released — two of them meeting at
83
+ * the seam read as damage rather than as one field needing attention.
84
+ */
85
+ when('&:has(> :user-invalid), &:has(> [aria-invalid="true"])', outline({ color: "danger.ring", offset: 2 })),
86
+ when('& > :user-invalid:not(:focus-visible), & > [aria-invalid="true"]:not(:focus-visible)',
87
+ /*
88
+ * Marked important because the field's own invalid ring is stated by `Input`,
89
+ * in a cascade layer this one cannot be ordered against — importance is what
90
+ * reaches across the layers to release it. The selector stops short of
91
+ * `:focus-visible` so a field being filled in still shows its own focus ring.
92
+ */
93
+ raw({ outline: "none !important" })),
95
94
  mix,
96
95
  ] }));
97
96
  };
98
97
  };
99
- /**
100
- * Renders {@link DatePicker}'s trailing trigger: a native `<button>` pulled
101
- * back over the row's trailing space so it reads as part of the same field.
102
- * Point `commandfor` at {@link DatePicker.Dialog}'s `id` with `command="toggle-popover"` to wire it up as that surface's invoker, which both opens the surface and serves as its implicit CSS anchor.
103
- *
104
- * @param handle Runtime handle carrying the host `<button>`'s props.
105
- * @returns The render function producing the trigger's markup.
106
- * @example
107
- * <DatePicker.Button commandfor="startDate-calendar" command="toggle-popover" aria-label={t("form.startDate.toggle")} />
108
- */
109
- DatePicker.Button = function DatePickerButton(handle) {
110
- return () => {
111
- let { type, mix, ...rest } = handle.props;
112
- warnIfNoAccessibleLabel(handle.props, "DatePicker.Button: this button needs an `aria-label` describing what it does — its content is a decorative glyph with no accessible name of its own.");
113
- return (_jsx("button", { type: type ?? DEFAULT_BUTTON_TYPE, ...rest, "data-slot": "button", mix: [
114
- interactiveTransition(),
115
- flex(),
116
- items("center"),
117
- justify("center"),
118
- mis("-2.25rem"),
119
- is("2rem"),
120
- bs("2rem"),
121
- rounded("sm"),
122
- fg("neutral"),
123
- when("& svg", [is("1rem"), bs("1rem")]),
124
- hover(bg("neutral.bg-tint-hover")),
125
- when("&:focus-visible", outline({ color: "brand.ring", offset: 0 })),
126
- mix,
127
- ], children: _jsx(CalendarIcon, {}) }));
128
- };
129
- };
130
- /**
131
- * Renders {@link DatePicker}'s calendar surface: a {@link Popover} whose
132
- * `placement` defaults to reading down and start-ward from its invoker, and
133
- * whose `role` defaults to `"dialog"`. {@link DatePicker.Button}'s `commandfor`/`command="toggle-popover"` both opens this surface and becomes its implicit CSS anchor, with no positioning logic of its own; pair a `calendarKeys()`/`rangePreview()` mixin on the composed calendar for an arrow-key-driven picker.
134
- *
135
- * @param handle Runtime handle carrying the host's {@link Popover} props.
136
- * @returns The render function producing the surface's markup.
137
- * @example
138
- * <DatePicker.Dialog id="startDate-calendar">
139
- * <Calendar aria-label={monthLabel}>
140
- * <Calendar.Header>
141
- * <Calendar.PreviousButton aria-label={t("calendar.previous")} />
142
- * <Calendar.Heading>{monthLabel}</Calendar.Heading>
143
- * <Calendar.NextButton aria-label={t("calendar.next")} />
144
- * </Calendar.Header>
145
- * <Calendar.Grid aria-label={monthLabel}>...</Calendar.Grid>
146
- * </Calendar>
147
- * </DatePicker.Dialog>
148
- */
149
- DatePicker.Dialog = function DatePickerDialog(handle) {
150
- return () => {
151
- let { placement, children, mix, ...rest } = handle.props;
152
- let resolvedPlacement = placement ?? DEFAULT_DIALOG_PLACEMENT;
153
- return (_jsx(Popover, { ...rest, placement: resolvedPlacement, mix: [attrs({ role: DEFAULT_DIALOG_ROLE }), p(4), outline("none"), mix], children: children }));
154
- };
155
- };
@@ -1,12 +1,10 @@
1
1
  /**
2
- * A paired-field date range control building on {@link DateField} for its
3
- * plain fallback — independent start-date and end-date fields, each fully
4
- * labeled, described, and validated on its own — extended with a
5
- * {@link DateRangePicker.Group} row and a trigger
6
- * {@link DateRangePicker.Button} for composing a
7
- * {@link DateRangePicker.Dialog} calendar surface alongside it. Leaving
8
- * `children` unset keeps the fallback pair on its own, complete and
9
- * keyboard-operable with no composed surface at all.
2
+ * A paired-field date range control built on {@link DateField} — independent
3
+ * start-date and end-date fields, each fully labeled, described, and validated
4
+ * on its own — with a {@link DateRangePicker.Group} row for joining the two
5
+ * into one control. The calendar is the platform's, since each field is a
6
+ * native date input, so the whole range is pickable before any script loads.
7
+ * Leaving `children` unset renders the pair on its own.
10
8
  *
11
9
  * @author [Sergio Xalambrí](https://sergiodxa.com)
12
10
  * @copyright Sergio Xalambrí 2026
@@ -15,9 +13,9 @@ import type { Handle, Props as TagProps, RemixNode } from "remix/ui";
15
13
  import { DateField } from "./date-field.js";
16
14
  import { DatePicker } from "./date-picker.js";
17
15
  /**
18
- * Prop types for {@link DateRangePicker} and its compound parts. The
19
- * {@link DateRangePicker.Group}, {@link DateRangePicker.Button}, and
20
- * {@link DateRangePicker.Dialog} parts alias {@link DatePicker}'s matching parts directly, since the trigger row and calendar surface render identically for a range as for a single date.
16
+ * Prop types for {@link DateRangePicker} and its compound parts.
17
+ * {@link DateRangePicker.Group} aliases {@link DatePicker.Group} directly,
18
+ * since a row of fields reads the same for a range as for a single date.
21
19
  */
22
20
  export declare namespace DateRangePicker {
23
21
  /**
@@ -40,7 +38,9 @@ export declare namespace DateRangePicker {
40
38
  /**
41
39
  * Props accepted by {@link DateRangePicker}. Leaving `children` unset
42
40
  * renders two independent {@link DateField} instances — one per end of
43
- * the range — using every field below; composing {@link DateRangePicker.Group} and {@link DateRangePicker.Dialog} instead renders the richer layout and leaves every field below unread.
41
+ * the range — using every field below; composing
42
+ * {@link DateRangePicker.Group} instead renders the joined row and leaves
43
+ * every field below unread.
44
44
  */
45
45
  interface Props extends Omit<TagProps<"div">, "children"> {
46
46
  /** Semantic color role for the fallback pair's focus rings. Read only when `children` is unset. */
@@ -86,30 +86,26 @@ export declare namespace DateRangePicker {
86
86
  /** Per-part styling for the fallback pair's internally composed {@link DateField} instances. Read only when `children` is unset. */
87
87
  parts?: PartsProps;
88
88
  /**
89
- * The trigger-and-calendar layout — typically a `Label`,
90
- * {@link DateRangePicker.Group}, and {@link DateRangePicker.Dialog} —
91
- * rendered in place of the paired fallback fields, leaving every field above unread when set.
89
+ * The joined layout — typically a `Label` and a
90
+ * {@link DateRangePicker.Group} — rendered in place of the paired fields,
91
+ * leaving every field above unread when set.
92
92
  */
93
93
  children?: RemixNode;
94
94
  }
95
95
  /**
96
96
  * Every prop {@link DatePicker.GroupProps} accepts, unchanged. `children`
97
- * composes the range's own start and end controls and
98
- * {@link DateRangePicker.Button} into one visual row.
97
+ * composes the range's own start and end controls into one visual row.
99
98
  */
100
99
  interface GroupProps extends DatePicker.GroupProps {
101
100
  }
102
- /** Every prop {@link DatePicker.ButtonProps} accepts, unchanged. */
103
- interface ButtonProps extends DatePicker.ButtonProps {
104
- }
105
- /** Every prop {@link DatePicker.DialogProps} accepts, unchanged. */
106
- interface DialogProps extends DatePicker.DialogProps {
107
- }
108
101
  }
109
102
  /**
110
103
  * Renders {@link DateRangePicker}'s root. Leaving `children` unset renders
111
104
  * two independent {@link DateField} instances side by side under a native
112
- * `role="group"`, each aligned to its own start edge so a validation message under one never shifts the other's label; composing {@link DateRangePicker.Group} and {@link DateRangePicker.Dialog} as `children` instead renders the richer layout and leaves every field above unread.
105
+ * `role="group"`, each aligned to its own start edge so a validation message
106
+ * under one never shifts the other's label; composing
107
+ * {@link DateRangePicker.Group} as `children` instead joins the two fields into
108
+ * one row and leaves every field prop above unread.
113
109
  *
114
110
  * @param handle Runtime handle carrying the root element's props.
115
111
  * @returns The render function producing the date range picker's markup.
@@ -124,29 +120,12 @@ export declare namespace DateRangePicker {
124
120
  * <DateRangePicker>
125
121
  * <Label htmlFor="tripStart">{t("form.trip.label")}</Label>
126
122
  * <DateRangePicker.Group>
127
- * <Input id="tripStart" type="date" name="tripStart" />
128
- * <Input id="tripEnd" type="date" name="tripEnd" />
129
- * <DateRangePicker.Button
130
- * commandfor="trip-calendar"
131
- * command="toggle-popover"
132
- * aria-label={t("form.trip.toggle")}
133
- * />
123
+ * <Input id="tripStart" type="date" name="tripStart" aria-label={t("form.trip.start")} />
124
+ * <Input id="tripEnd" type="date" name="tripEnd" aria-label={t("form.trip.end")} />
134
125
  * </DateRangePicker.Group>
135
- * <DateRangePicker.Dialog id="trip-calendar">
136
- * <RangeCalendar aria-label={monthLabel}>
137
- * <RangeCalendar.Header>
138
- * <RangeCalendar.PreviousButton aria-label={t("calendar.previous")} />
139
- * <RangeCalendar.Heading>{monthLabel}</RangeCalendar.Heading>
140
- * <RangeCalendar.NextButton aria-label={t("calendar.next")} />
141
- * </RangeCalendar.Header>
142
- * <RangeCalendar.Grid aria-label={monthLabel}>...</RangeCalendar.Grid>
143
- * </RangeCalendar>
144
- * </DateRangePicker.Dialog>
145
126
  * </DateRangePicker>
146
127
  */
147
128
  export declare function DateRangePicker(handle: Handle<DateRangePicker.Props>): () => import("remix/ui").RemixElement;
148
129
  export declare namespace DateRangePicker {
149
130
  var Group: (handle: Handle<DatePicker.GroupProps>) => () => import("remix/ui").RemixElement;
150
- var Button: (handle: Handle<DatePicker.ButtonProps>) => () => import("remix/ui").RemixElement;
151
- var Dialog: (handle: Handle<DatePicker.DialogProps>) => () => import("remix/ui").RemixElement;
152
131
  }
@@ -6,7 +6,10 @@ import { DatePicker } from "./date-picker.js";
6
6
  /**
7
7
  * Renders {@link DateRangePicker}'s root. Leaving `children` unset renders
8
8
  * two independent {@link DateField} instances side by side under a native
9
- * `role="group"`, each aligned to its own start edge so a validation message under one never shifts the other's label; composing {@link DateRangePicker.Group} and {@link DateRangePicker.Dialog} as `children` instead renders the richer layout and leaves every field above unread.
9
+ * `role="group"`, each aligned to its own start edge so a validation message
10
+ * under one never shifts the other's label; composing
11
+ * {@link DateRangePicker.Group} as `children` instead joins the two fields into
12
+ * one row and leaves every field prop above unread.
10
13
  *
11
14
  * @param handle Runtime handle carrying the root element's props.
12
15
  * @returns The render function producing the date range picker's markup.
@@ -21,24 +24,9 @@ import { DatePicker } from "./date-picker.js";
21
24
  * <DateRangePicker>
22
25
  * <Label htmlFor="tripStart">{t("form.trip.label")}</Label>
23
26
  * <DateRangePicker.Group>
24
- * <Input id="tripStart" type="date" name="tripStart" />
25
- * <Input id="tripEnd" type="date" name="tripEnd" />
26
- * <DateRangePicker.Button
27
- * commandfor="trip-calendar"
28
- * command="toggle-popover"
29
- * aria-label={t("form.trip.toggle")}
30
- * />
27
+ * <Input id="tripStart" type="date" name="tripStart" aria-label={t("form.trip.start")} />
28
+ * <Input id="tripEnd" type="date" name="tripEnd" aria-label={t("form.trip.end")} />
31
29
  * </DateRangePicker.Group>
32
- * <DateRangePicker.Dialog id="trip-calendar">
33
- * <RangeCalendar aria-label={monthLabel}>
34
- * <RangeCalendar.Header>
35
- * <RangeCalendar.PreviousButton aria-label={t("calendar.previous")} />
36
- * <RangeCalendar.Heading>{monthLabel}</RangeCalendar.Heading>
37
- * <RangeCalendar.NextButton aria-label={t("calendar.next")} />
38
- * </RangeCalendar.Header>
39
- * <RangeCalendar.Grid aria-label={monthLabel}>...</RangeCalendar.Grid>
40
- * </RangeCalendar>
41
- * </DateRangePicker.Dialog>
42
30
  * </DateRangePicker>
43
31
  */
44
32
  export function DateRangePicker(handle) {
@@ -67,40 +55,8 @@ export function DateRangePicker(handle) {
67
55
  * @returns The render function producing the row's markup.
68
56
  * @example
69
57
  * <DateRangePicker.Group>
70
- * <Input id="tripStart" type="date" name="tripStart" />
71
- * <Input id="tripEnd" type="date" name="tripEnd" />
72
- * <DateRangePicker.Button commandfor="trip-calendar" command="toggle-popover" aria-label={t("form.trip.toggle")} />
58
+ * <Input id="tripStart" type="date" name="tripStart" aria-label={t("form.trip.start")} />
59
+ * <Input id="tripEnd" type="date" name="tripEnd" aria-label={t("form.trip.end")} />
73
60
  * </DateRangePicker.Group>
74
61
  */
75
62
  DateRangePicker.Group = DatePicker.Group;
76
- /**
77
- * Renders {@link DateRangePicker}'s trailing trigger: identical to
78
- * {@link DatePicker.Button}'s calendar glyph and hover/focus-visible
79
- * styling. Point `commandfor` at {@link DateRangePicker.Dialog}'s `id` with `command="toggle-popover"` to wire it up as that surface's invoker.
80
- *
81
- * @param handle Runtime handle carrying the host `<button>`'s props.
82
- * @returns The render function producing the trigger's markup.
83
- * @example
84
- * <DateRangePicker.Button commandfor="trip-calendar" command="toggle-popover" aria-label={t("form.trip.toggle")} />
85
- */
86
- DateRangePicker.Button = DatePicker.Button;
87
- /**
88
- * Renders {@link DateRangePicker}'s calendar surface: identical to
89
- * {@link DatePicker.Dialog}'s placement default, padding, and
90
- * `role="dialog"`, with only the calendar a consumer composes as `children` differing. {@link DateRangePicker.Button}'s `commandfor`/`command="toggle-popover"` both opens this surface and becomes its implicit CSS anchor; pair a `calendarKeys()`/`rangePreview()` mixin on the composed calendar for a live, arrow-key- or drag-extended range.
91
- *
92
- * @param handle Runtime handle carrying the host's {@link Popover} props.
93
- * @returns The render function producing the surface's markup.
94
- * @example
95
- * <DateRangePicker.Dialog id="trip-calendar">
96
- * <RangeCalendar aria-label={monthLabel}>
97
- * <RangeCalendar.Header>
98
- * <RangeCalendar.PreviousButton aria-label={t("calendar.previous")} />
99
- * <RangeCalendar.Heading>{monthLabel}</RangeCalendar.Heading>
100
- * <RangeCalendar.NextButton aria-label={t("calendar.next")} />
101
- * </RangeCalendar.Header>
102
- * <RangeCalendar.Grid aria-label={monthLabel}>...</RangeCalendar.Grid>
103
- * </RangeCalendar>
104
- * </DateRangePicker.Dialog>
105
- */
106
- DateRangePicker.Dialog = DatePicker.Dialog;
@@ -3,7 +3,7 @@ import { XIcon } from "@sdxc/icons";
3
3
  import { bg, fg, outline } from "@sdxc/u/color";
4
4
  import { backdropBlur, backdropSaturate, opacity, rounded, transition, transitionBehavior, } from "@sdxc/u/effects";
5
5
  import { raw } from "@sdxc/u/general";
6
- import { absolute, container, flex, flexCol, flexColReverse, flexRow, gap, inset, justify, relative, } from "@sdxc/u/layout";
6
+ import { absolute, container, fixed, flex, flexCol, flexColReverse, flexRow, gap, inset, justify, relative, } from "@sdxc/u/layout";
7
7
  import { overflow } from "@sdxc/u/overflow";
8
8
  import { at, media, startingStyle, supports } from "@sdxc/u/responsive";
9
9
  import { is, maxBs, maxIs, p } from "@sdxc/u/size";
@@ -18,6 +18,12 @@ import { resolveHeadingLevel, TAG_BY_LEVEL } from "./heading-scope.js";
18
18
  * width instead of the page's.
19
19
  */
20
20
  const CONTAINER_NAME = "ui-dialog";
21
+ /**
22
+ * Panel width from which {@link Dialog.Header} and {@link Dialog.Footer} lay out for a
23
+ * comfortable dialog: a leading title and a trailing row of actions. It is measured
24
+ * against the panel's own inline size, which a dialog keeps well under a viewport's.
25
+ */
26
+ const COMFORTABLE_WIDTH = "24rem";
21
27
  /**
22
28
  * Invoker Commands verb {@link Dialog.CloseProps.command} falls back to when
23
29
  * omitted, dismissing the ancestor Dialog named by `commandfor`.
@@ -56,12 +62,29 @@ export function Dialog(handle) {
56
62
  console.warn('Dialog rendered without an "id" — "commandfor" on a trigger or close control has nothing to target.');
57
63
  }
58
64
  return (_jsx("dialog", { ...rest, id: id, "data-slot": "dialog", mix: [
65
+ /**
66
+ * Establishes the containing block {@link Dialog.Close} pins itself to while
67
+ * the panel sits in the page's flow, which a dialog opened through its `open`
68
+ * attribute alone does.
69
+ */
59
70
  relative(),
71
+ /**
72
+ * Measures a modal panel against the viewport, so it stays centered on screen
73
+ * however far the page behind it is scrolled: the top layer resolves any other
74
+ * positioning scheme against the document's own coordinates.
75
+ */
76
+ when("&:modal", fixed()),
60
77
  bg("neutral.tint"),
61
78
  fg("neutral.emphasis"),
62
79
  rounded("lg"),
63
80
  is("full"),
64
- maxIs("28rem"),
81
+ /*
82
+ * Wide enough for the form a dialog usually carries: a field, its help text and
83
+ * a row of actions read as one column at this measure, where a narrower panel
84
+ * stacks them into a ribbon. A consumer with less to say narrows it through
85
+ * `mix`.
86
+ */
87
+ maxIs("32rem"),
65
88
  maxBs("90vh"),
66
89
  gap(6),
67
90
  p(6),
@@ -113,7 +136,7 @@ Dialog.Header = function DialogHeader(handle) {
113
136
  flexCol(),
114
137
  gap(1.5),
115
138
  textAlign("center"),
116
- at("40rem", CONTAINER_NAME, textAlign("start")),
139
+ at(COMFORTABLE_WIDTH, CONTAINER_NAME, textAlign("start")),
117
140
  mix,
118
141
  ] }));
119
142
  };
@@ -179,7 +202,7 @@ Dialog.Footer = function DialogFooter(handle) {
179
202
  flex(),
180
203
  gap(2),
181
204
  flexColReverse(),
182
- at("40rem", CONTAINER_NAME, [flexRow(), justify("end")]),
205
+ at(COMFORTABLE_WIDTH, CONTAINER_NAME, [flexRow(), justify("end")]),
183
206
  mix,
184
207
  ] }));
185
208
  };
@@ -63,7 +63,10 @@ export declare namespace Disclosure {
63
63
  * @returns The render function producing the section's markup.
64
64
  * @example
65
65
  * <Disclosure>
66
- * <Disclosure.Trigger>{t("faq.refunds.question")}</Disclosure.Trigger>
66
+ * <Disclosure.Trigger>
67
+ * {t("faq.refunds.question")}
68
+ * <ChevronDownIcon data-slot="icon" aria-hidden="true" />
69
+ * </Disclosure.Trigger>
67
70
  * <Disclosure.Panel>
68
71
  * <p>{t("faq.refunds.answer")}</p>
69
72
  * </Disclosure.Panel>