@sdxc/ui 0.0.0-pre.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +21 -0
- package/README.md +812 -0
- package/dist/animations/index.d.ts +12 -0
- package/dist/animations/index.js +12 -0
- package/dist/animations/keyframes.d.ts +162 -0
- package/dist/animations/keyframes.js +297 -0
- package/dist/animations/scroll.d.ts +154 -0
- package/dist/animations/scroll.js +228 -0
- package/dist/animations/tokens.d.ts +47 -0
- package/dist/animations/tokens.js +47 -0
- package/dist/animations/transitions.d.ts +143 -0
- package/dist/animations/transitions.js +147 -0
- package/dist/behaviors/announcer.d.ts +90 -0
- package/dist/behaviors/announcer.js +93 -0
- package/dist/behaviors/calendar-model.d.ts +218 -0
- package/dist/behaviors/calendar-model.js +376 -0
- package/dist/behaviors/drag-session.d.ts +119 -0
- package/dist/behaviors/drag-session.js +110 -0
- package/dist/behaviors/filter-model.d.ts +117 -0
- package/dist/behaviors/filter-model.js +185 -0
- package/dist/behaviors/index.d.ts +16 -0
- package/dist/behaviors/index.js +16 -0
- package/dist/behaviors/resize-session.d.ts +115 -0
- package/dist/behaviors/resize-session.js +157 -0
- package/dist/behaviors/scroll-follow-model.d.ts +180 -0
- package/dist/behaviors/scroll-follow-model.js +197 -0
- package/dist/behaviors/selection-model.d.ts +129 -0
- package/dist/behaviors/selection-model.js +259 -0
- package/dist/behaviors/toaster.d.ts +144 -0
- package/dist/behaviors/toaster.js +228 -0
- package/dist/components/accordion.d.ts +93 -0
- package/dist/components/accordion.js +165 -0
- package/dist/components/alert-dialog.d.ts +110 -0
- package/dist/components/alert-dialog.js +169 -0
- package/dist/components/alert.d.ts +109 -0
- package/dist/components/alert.js +160 -0
- package/dist/components/aspect-ratio.d.ts +44 -0
- package/dist/components/aspect-ratio.js +35 -0
- package/dist/components/attachment.d.ts +146 -0
- package/dist/components/attachment.js +320 -0
- package/dist/components/avatar.d.ts +118 -0
- package/dist/components/avatar.js +89 -0
- package/dist/components/badge.d.ts +66 -0
- package/dist/components/badge.js +129 -0
- package/dist/components/breadcrumbs.d.ts +67 -0
- package/dist/components/breadcrumbs.js +121 -0
- package/dist/components/bubble.d.ts +91 -0
- package/dist/components/bubble.js +216 -0
- package/dist/components/button.d.ts +78 -0
- package/dist/components/button.js +207 -0
- package/dist/components/calendar.d.ts +166 -0
- package/dist/components/calendar.js +320 -0
- package/dist/components/card.d.ts +82 -0
- package/dist/components/card.js +126 -0
- package/dist/components/carousel.d.ts +96 -0
- package/dist/components/carousel.js +214 -0
- package/dist/components/chart.d.ts +485 -0
- package/dist/components/chart.js +563 -0
- package/dist/components/checkbox-group.d.ts +58 -0
- package/dist/components/checkbox-group.js +53 -0
- package/dist/components/checkbox.d.ts +61 -0
- package/dist/components/checkbox.js +81 -0
- package/dist/components/color-area.d.ts +83 -0
- package/dist/components/color-area.js +251 -0
- package/dist/components/color-field.d.ts +128 -0
- package/dist/components/color-field.js +73 -0
- package/dist/components/color-picker.d.ts +132 -0
- package/dist/components/color-picker.js +183 -0
- package/dist/components/color-slider.d.ts +103 -0
- package/dist/components/color-slider.js +198 -0
- package/dist/components/color-swatch-picker.d.ts +106 -0
- package/dist/components/color-swatch-picker.js +75 -0
- package/dist/components/color-swatch.d.ts +57 -0
- package/dist/components/color-swatch.js +82 -0
- package/dist/components/color-wheel.d.ts +58 -0
- package/dist/components/color-wheel.js +160 -0
- package/dist/components/combobox.d.ts +73 -0
- package/dist/components/combobox.js +108 -0
- package/dist/components/command.d.ts +80 -0
- package/dist/components/command.js +151 -0
- package/dist/components/confirm.d.ts +124 -0
- package/dist/components/confirm.js +56 -0
- package/dist/components/context-menu.d.ts +108 -0
- package/dist/components/context-menu.js +200 -0
- package/dist/components/date-field.d.ts +110 -0
- package/dist/components/date-field.js +49 -0
- package/dist/components/date-picker.d.ts +136 -0
- package/dist/components/date-picker.js +155 -0
- package/dist/components/date-range-picker.d.ts +152 -0
- package/dist/components/date-range-picker.js +106 -0
- package/dist/components/description.d.ts +36 -0
- package/dist/components/description.js +21 -0
- package/dist/components/dialog.d.ts +97 -0
- package/dist/components/dialog.js +203 -0
- package/dist/components/disclosure.d.ts +85 -0
- package/dist/components/disclosure.js +180 -0
- package/dist/components/drawer.d.ts +82 -0
- package/dist/components/drawer.js +162 -0
- package/dist/components/drop-indicator.d.ts +43 -0
- package/dist/components/drop-indicator.js +47 -0
- package/dist/components/drop-zone.d.ts +73 -0
- package/dist/components/drop-zone.js +54 -0
- package/dist/components/empty.d.ts +89 -0
- package/dist/components/empty.js +129 -0
- package/dist/components/field-error.d.ts +41 -0
- package/dist/components/field-error.js +36 -0
- package/dist/components/file-trigger.d.ts +84 -0
- package/dist/components/file-trigger.js +169 -0
- package/dist/components/form.d.ts +118 -0
- package/dist/components/form.js +113 -0
- package/dist/components/grid-list.d.ts +112 -0
- package/dist/components/grid-list.js +220 -0
- package/dist/components/group.d.ts +45 -0
- package/dist/components/group.js +44 -0
- package/dist/components/header.d.ts +33 -0
- package/dist/components/header.js +29 -0
- package/dist/components/heading-scope.d.ts +83 -0
- package/dist/components/heading-scope.js +82 -0
- package/dist/components/heading.d.ts +50 -0
- package/dist/components/heading.js +31 -0
- package/dist/components/hover-card.d.ts +77 -0
- package/dist/components/hover-card.js +151 -0
- package/dist/components/image-placeholder.d.ts +105 -0
- package/dist/components/image-placeholder.js +212 -0
- package/dist/components/index.d.ts +109 -0
- package/dist/components/index.js +109 -0
- package/dist/components/input.d.ts +53 -0
- package/dist/components/input.js +76 -0
- package/dist/components/item.d.ts +97 -0
- package/dist/components/item.js +185 -0
- package/dist/components/keyboard.d.ts +33 -0
- package/dist/components/keyboard.js +20 -0
- package/dist/components/label.d.ts +38 -0
- package/dist/components/label.js +24 -0
- package/dist/components/link-button.d.ts +59 -0
- package/dist/components/link-button.js +174 -0
- package/dist/components/link.d.ts +43 -0
- package/dist/components/link.js +85 -0
- package/dist/components/listbox.d.ts +119 -0
- package/dist/components/listbox.js +114 -0
- package/dist/components/logo.d.ts +117 -0
- package/dist/components/logo.js +89 -0
- package/dist/components/marker.d.ts +82 -0
- package/dist/components/marker.js +163 -0
- package/dist/components/menu.d.ts +90 -0
- package/dist/components/menu.js +146 -0
- package/dist/components/menubar.d.ts +54 -0
- package/dist/components/menubar.js +118 -0
- package/dist/components/message-scroller.d.ts +109 -0
- package/dist/components/message-scroller.js +180 -0
- package/dist/components/message.d.ts +104 -0
- package/dist/components/message.js +200 -0
- package/dist/components/meter.d.ts +60 -0
- package/dist/components/meter.js +110 -0
- package/dist/components/modal.d.ts +71 -0
- package/dist/components/modal.js +120 -0
- package/dist/components/nav-link.d.ts +53 -0
- package/dist/components/nav-link.js +83 -0
- package/dist/components/navigation-menu.d.ts +150 -0
- package/dist/components/navigation-menu.js +381 -0
- package/dist/components/number-field.d.ts +76 -0
- package/dist/components/number-field.js +190 -0
- package/dist/components/otp-field.d.ts +68 -0
- package/dist/components/otp-field.js +46 -0
- package/dist/components/overlay-arrow.d.ts +51 -0
- package/dist/components/overlay-arrow.js +77 -0
- package/dist/components/pagination.d.ts +67 -0
- package/dist/components/pagination.js +164 -0
- package/dist/components/popover.d.ts +69 -0
- package/dist/components/popover.js +68 -0
- package/dist/components/progress-bar.d.ts +53 -0
- package/dist/components/progress-bar.js +90 -0
- package/dist/components/radio-group.d.ts +102 -0
- package/dist/components/radio-group.js +114 -0
- package/dist/components/range-calendar.d.ts +169 -0
- package/dist/components/range-calendar.js +216 -0
- package/dist/components/resizable.d.ts +98 -0
- package/dist/components/resizable.js +151 -0
- package/dist/components/scroll-area.d.ts +54 -0
- package/dist/components/scroll-area.js +89 -0
- package/dist/components/search-field.d.ts +55 -0
- package/dist/components/search-field.js +49 -0
- package/dist/components/section.d.ts +37 -0
- package/dist/components/section.js +22 -0
- package/dist/components/select.d.ts +96 -0
- package/dist/components/select.js +285 -0
- package/dist/components/selection-indicator.d.ts +47 -0
- package/dist/components/selection-indicator.js +50 -0
- package/dist/components/sentinel-row.d.ts +22 -0
- package/dist/components/sentinel-row.js +29 -0
- package/dist/components/separator.d.ts +35 -0
- package/dist/components/separator.js +48 -0
- package/dist/components/shared-element.d.ts +45 -0
- package/dist/components/shared-element.js +48 -0
- package/dist/components/sheet.d.ts +78 -0
- package/dist/components/sheet.js +167 -0
- package/dist/components/sidebar.d.ts +288 -0
- package/dist/components/sidebar.js +1068 -0
- package/dist/components/skeleton.d.ts +36 -0
- package/dist/components/skeleton.js +38 -0
- package/dist/components/slider.d.ts +102 -0
- package/dist/components/slider.js +179 -0
- package/dist/components/spinner.d.ts +55 -0
- package/dist/components/spinner.js +51 -0
- package/dist/components/switch.d.ts +47 -0
- package/dist/components/switch.js +82 -0
- package/dist/components/table.d.ts +139 -0
- package/dist/components/table.js +216 -0
- package/dist/components/tabs.d.ts +124 -0
- package/dist/components/tabs.js +246 -0
- package/dist/components/tag-group.d.ts +83 -0
- package/dist/components/tag-group.js +157 -0
- package/dist/components/text-field.d.ts +119 -0
- package/dist/components/text-field.js +51 -0
- package/dist/components/text.d.ts +34 -0
- package/dist/components/text.js +19 -0
- package/dist/components/textarea.d.ts +52 -0
- package/dist/components/textarea.js +82 -0
- package/dist/components/time-field.d.ts +110 -0
- package/dist/components/time-field.js +48 -0
- package/dist/components/toast.d.ts +149 -0
- package/dist/components/toast.js +365 -0
- package/dist/components/toggle-button.d.ts +115 -0
- package/dist/components/toggle-button.js +237 -0
- package/dist/components/toolbar.d.ts +47 -0
- package/dist/components/toolbar.js +54 -0
- package/dist/components/tooltip.d.ts +52 -0
- package/dist/components/tooltip.js +92 -0
- package/dist/components/tree.d.ts +123 -0
- package/dist/components/tree.js +239 -0
- package/dist/components/typeset.d.ts +53 -0
- package/dist/components/typeset.js +271 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +8 -0
- package/dist/mixins/aria-checked.d.ts +42 -0
- package/dist/mixins/aria-checked.js +127 -0
- package/dist/mixins/attachment-trigger.d.ts +64 -0
- package/dist/mixins/attachment-trigger.js +190 -0
- package/dist/mixins/calendar-keys.d.ts +27 -0
- package/dist/mixins/calendar-keys.js +113 -0
- package/dist/mixins/carousel-controls.d.ts +30 -0
- package/dist/mixins/carousel-controls.js +222 -0
- package/dist/mixins/chart-tooltip.d.ts +118 -0
- package/dist/mixins/chart-tooltip.js +323 -0
- package/dist/mixins/clear-field.d.ts +60 -0
- package/dist/mixins/clear-field.js +100 -0
- package/dist/mixins/color-area-drag.d.ts +58 -0
- package/dist/mixins/color-area-drag.js +162 -0
- package/dist/mixins/color-channel-sync.d.ts +73 -0
- package/dist/mixins/color-channel-sync.js +169 -0
- package/dist/mixins/color-preview.d.ts +28 -0
- package/dist/mixins/color-preview.js +77 -0
- package/dist/mixins/color-wheel-drag.d.ts +58 -0
- package/dist/mixins/color-wheel-drag.js +139 -0
- package/dist/mixins/combobox-filter.d.ts +59 -0
- package/dist/mixins/combobox-filter.js +81 -0
- package/dist/mixins/command-filter.d.ts +55 -0
- package/dist/mixins/command-filter.js +121 -0
- package/dist/mixins/command-keys.d.ts +31 -0
- package/dist/mixins/command-keys.js +116 -0
- package/dist/mixins/context-menu.d.ts +24 -0
- package/dist/mixins/context-menu.js +64 -0
- package/dist/mixins/copy-to-clipboard.d.ts +64 -0
- package/dist/mixins/copy-to-clipboard.js +109 -0
- package/dist/mixins/dismiss.d.ts +77 -0
- package/dist/mixins/dismiss.js +151 -0
- package/dist/mixins/drag-reorder.d.ts +88 -0
- package/dist/mixins/drag-reorder.js +214 -0
- package/dist/mixins/drop-zone.d.ts +52 -0
- package/dist/mixins/drop-zone.js +132 -0
- package/dist/mixins/dual-range.d.ts +60 -0
- package/dist/mixins/dual-range.js +100 -0
- package/dist/mixins/grid-list-keys.d.ts +34 -0
- package/dist/mixins/grid-list-keys.js +260 -0
- package/dist/mixins/heading-level-fallback.d.ts +81 -0
- package/dist/mixins/heading-level-fallback.js +112 -0
- package/dist/mixins/hotkey.d.ts +26 -0
- package/dist/mixins/hotkey.js +132 -0
- package/dist/mixins/image-fallback.d.ts +57 -0
- package/dist/mixins/image-fallback.js +86 -0
- package/dist/mixins/index.d.ts +48 -0
- package/dist/mixins/index.js +48 -0
- package/dist/mixins/listbox-keys.d.ts +52 -0
- package/dist/mixins/listbox-keys.js +63 -0
- package/dist/mixins/long-press.d.ts +76 -0
- package/dist/mixins/long-press.js +130 -0
- package/dist/mixins/menu-keys.d.ts +40 -0
- package/dist/mixins/menu-keys.js +117 -0
- package/dist/mixins/menubar-keys.d.ts +59 -0
- package/dist/mixins/menubar-keys.js +230 -0
- package/dist/mixins/message-follow.d.ts +56 -0
- package/dist/mixins/message-follow.js +368 -0
- package/dist/mixins/otp-slots.d.ts +53 -0
- package/dist/mixins/otp-slots.js +175 -0
- package/dist/mixins/persist.d.ts +36 -0
- package/dist/mixins/persist.js +78 -0
- package/dist/mixins/press-toggle.d.ts +43 -0
- package/dist/mixins/press-toggle.js +61 -0
- package/dist/mixins/range-preview.d.ts +26 -0
- package/dist/mixins/range-preview.js +120 -0
- package/dist/mixins/resize-handle.d.ts +101 -0
- package/dist/mixins/resize-handle.js +288 -0
- package/dist/mixins/stepper.d.ts +81 -0
- package/dist/mixins/stepper.js +194 -0
- package/dist/mixins/tab-keys.d.ts +30 -0
- package/dist/mixins/tab-keys.js +63 -0
- package/dist/mixins/theme-toggle.d.ts +82 -0
- package/dist/mixins/theme-toggle.js +158 -0
- package/dist/mixins/track-host-node.d.ts +34 -0
- package/dist/mixins/track-host-node.js +42 -0
- package/dist/mixins/treeKeys.d.ts +57 -0
- package/dist/mixins/treeKeys.js +266 -0
- package/dist/mixins/validate.d.ts +65 -0
- package/dist/mixins/validate.js +139 -0
- package/dist/mixins/view-transition.d.ts +56 -0
- package/dist/mixins/view-transition.js +111 -0
- package/dist/styles/chart-palette.d.ts +34 -0
- package/dist/styles/chart-palette.js +27 -0
- package/dist/styles/field-stack-layout.d.ts +27 -0
- package/dist/styles/field-stack-layout.js +16 -0
- package/dist/styles/floating-surface.d.ts +32 -0
- package/dist/styles/floating-surface.js +30 -0
- package/dist/styles/graphic-host.d.ts +25 -0
- package/dist/styles/graphic-host.js +18 -0
- package/dist/styles/index.d.ts +20 -0
- package/dist/styles/index.js +20 -0
- package/dist/styles/interactive-transition.d.ts +32 -0
- package/dist/styles/interactive-transition.js +32 -0
- package/dist/styles/legend-toggle.d.ts +29 -0
- package/dist/styles/legend-toggle.js +24 -0
- package/dist/styles/output-caption-text.d.ts +22 -0
- package/dist/styles/output-caption-text.js +15 -0
- package/dist/styles/panel-chrome.d.ts +34 -0
- package/dist/styles/panel-chrome.js +26 -0
- package/dist/styles/range-thumb-appearance.d.ts +36 -0
- package/dist/styles/range-thumb-appearance.js +76 -0
- package/dist/styles/rtl-aware-gradient-direction.d.ts +28 -0
- package/dist/styles/rtl-aware-gradient-direction.js +28 -0
- package/dist/styles/semantic-color-panel.d.ts +35 -0
- package/dist/styles/semantic-color-panel.js +41 -0
- package/dist/utils/chart-marker-indices.d.ts +22 -0
- package/dist/utils/chart-marker-indices.js +45 -0
- package/dist/utils/chart-path.d.ts +86 -0
- package/dist/utils/chart-path.js +122 -0
- package/dist/utils/chart-scale.d.ts +182 -0
- package/dist/utils/chart-scale.js +221 -0
- package/dist/utils/color-math.d.ts +252 -0
- package/dist/utils/color-math.js +480 -0
- package/dist/utils/command-event.d.ts +24 -0
- package/dist/utils/command-event.js +26 -0
- package/dist/utils/css-styles.d.ts +21 -0
- package/dist/utils/css-styles.js +11 -0
- package/dist/utils/decorative-icon.d.ts +15 -0
- package/dist/utils/decorative-icon.js +15 -0
- package/dist/utils/disabled-selector.d.ts +22 -0
- package/dist/utils/disabled-selector.js +22 -0
- package/dist/utils/dispatch-change.d.ts +17 -0
- package/dist/utils/dispatch-change.js +19 -0
- package/dist/utils/field-parts.d.ts +26 -0
- package/dist/utils/field-parts.js +12 -0
- package/dist/utils/full-turn-radians.d.ts +16 -0
- package/dist/utils/full-turn-radians.js +16 -0
- package/dist/utils/geometry.d.ts +14 -0
- package/dist/utils/geometry.js +9 -0
- package/dist/utils/has-accessible-text.d.ts +19 -0
- package/dist/utils/has-accessible-text.js +30 -0
- package/dist/utils/hue-spectrum.d.ts +19 -0
- package/dist/utils/hue-spectrum.js +19 -0
- package/dist/utils/index.d.ts +35 -0
- package/dist/utils/index.js +35 -0
- package/dist/utils/is-new-primary-press.d.ts +29 -0
- package/dist/utils/is-new-primary-press.js +31 -0
- package/dist/utils/keyboard-nav.d.ts +64 -0
- package/dist/utils/keyboard-nav.js +79 -0
- package/dist/utils/merge-style.d.ts +33 -0
- package/dist/utils/merge-style.js +30 -0
- package/dist/utils/paired-range-inputs.d.ts +26 -0
- package/dist/utils/paired-range-inputs.js +29 -0
- package/dist/utils/placement.d.ts +18 -0
- package/dist/utils/placement.js +12 -0
- package/dist/utils/prefers-reduced-motion.d.ts +17 -0
- package/dist/utils/prefers-reduced-motion.js +19 -0
- package/dist/utils/resolve-field-wiring.d.ts +83 -0
- package/dist/utils/resolve-field-wiring.js +53 -0
- package/dist/utils/resolve-fill-percent.d.ts +28 -0
- package/dist/utils/resolve-fill-percent.js +34 -0
- package/dist/utils/round-precision.d.ts +22 -0
- package/dist/utils/round-precision.js +25 -0
- package/dist/utils/semantic-color-panel.d.ts +35 -0
- package/dist/utils/semantic-color-panel.js +28 -0
- package/dist/utils/semantic-color.d.ts +17 -0
- package/dist/utils/semantic-color.js +11 -0
- package/dist/utils/warn-if-no-accessible-name.d.ts +52 -0
- package/dist/utils/warn-if-no-accessible-name.js +55 -0
- package/dist/utils/write-cookie.d.ts +35 -0
- package/dist/utils/write-cookie.js +37 -0
- package/package.json +32 -0
- package/src/reset.css +223 -0
- package/src/theme.css +146 -0
|
@@ -0,0 +1,136 @@
|
|
|
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.
|
|
10
|
+
*
|
|
11
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
12
|
+
* @copyright Sergio Xalambrí 2026
|
|
13
|
+
*/
|
|
14
|
+
import type { Handle, Props as TagProps, RemixNode } from "remix/ui";
|
|
15
|
+
import { DateField } from "./date-field.js";
|
|
16
|
+
import { Popover } from "./popover.js";
|
|
17
|
+
/**
|
|
18
|
+
* Prop types for {@link DatePicker} and its compound parts.
|
|
19
|
+
*/
|
|
20
|
+
export declare namespace DatePicker {
|
|
21
|
+
/**
|
|
22
|
+
* Semantic color role for the fallback field's keyboard focus ring. Read
|
|
23
|
+
* only by the fallback field — {@link DatePicker.Group}'s composed
|
|
24
|
+
* control carries no `color` prop of its own.
|
|
25
|
+
*/
|
|
26
|
+
type Color = DateField.Color;
|
|
27
|
+
/**
|
|
28
|
+
* 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.
|
|
31
|
+
*/
|
|
32
|
+
interface PartsProps extends DateField.PartsProps {
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
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.
|
|
38
|
+
*/
|
|
39
|
+
interface Props extends Omit<TagProps<"div">, "children"> {
|
|
40
|
+
/** Semantic color role for the fallback field's focus ring. Read only when `children` is unset. */
|
|
41
|
+
color?: Color;
|
|
42
|
+
/** The fallback field's caption, rendered through {@link DateField}. Read only when `children` is unset. */
|
|
43
|
+
label?: RemixNode;
|
|
44
|
+
/** Supporting copy beneath the fallback field. Read only when `children` is unset. */
|
|
45
|
+
description?: RemixNode;
|
|
46
|
+
/** Validation message beneath the fallback field. Read only when `children` is unset. */
|
|
47
|
+
errorMessage?: RemixNode;
|
|
48
|
+
/** Native `name` submitted with an enclosing form, read only by the fallback field. */
|
|
49
|
+
name?: string;
|
|
50
|
+
/** Current value, in `YYYY-MM-DD` form, for a fallback field a consumer tracks itself. */
|
|
51
|
+
value?: string;
|
|
52
|
+
/** Initial value, in `YYYY-MM-DD` form, for a fallback field left to the platform's own uncontrolled state. */
|
|
53
|
+
defaultValue?: string;
|
|
54
|
+
/** Earliest accepted date, in `YYYY-MM-DD` form, read only by the fallback field. */
|
|
55
|
+
min?: string;
|
|
56
|
+
/** Latest accepted date, in `YYYY-MM-DD` form, read only by the fallback field. */
|
|
57
|
+
max?: string;
|
|
58
|
+
/** Granularity, in days, the fallback field's value must fall on. */
|
|
59
|
+
step?: number;
|
|
60
|
+
/** Marks the fallback field required for its enclosing form. */
|
|
61
|
+
required?: boolean;
|
|
62
|
+
/** Marks the fallback field inert and excluded from the tab order. */
|
|
63
|
+
disabled?: boolean;
|
|
64
|
+
/** Marks the fallback field's value fixed, while keeping it focusable and included in form submission. */
|
|
65
|
+
readOnly?: boolean;
|
|
66
|
+
/** Native autofill hint for the fallback field, e.g. `"bday"`. */
|
|
67
|
+
autoComplete?: string;
|
|
68
|
+
/** Per-part styling for the fallback field's internally composed parts. Read only when `children` is unset. */
|
|
69
|
+
parts?: PartsProps;
|
|
70
|
+
/**
|
|
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.
|
|
74
|
+
*/
|
|
75
|
+
children?: RemixNode;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* 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.
|
|
81
|
+
*/
|
|
82
|
+
interface GroupProps extends TagProps<"div"> {
|
|
83
|
+
}
|
|
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
|
+
}
|
|
99
|
+
/**
|
|
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.
|
|
103
|
+
*
|
|
104
|
+
* @param handle Runtime handle carrying the root element's props.
|
|
105
|
+
* @returns The render function producing the date picker's markup.
|
|
106
|
+
* @example
|
|
107
|
+
* <DatePicker label={t("form.birthday.label")} name="birthday" autoComplete="bday" />
|
|
108
|
+
* @example
|
|
109
|
+
* <DatePicker>
|
|
110
|
+
* <Label htmlFor="startDate">{t("form.startDate.label")}</Label>
|
|
111
|
+
* <DatePicker.Group>
|
|
112
|
+
* <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
|
+
* </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
|
+
* </DatePicker>
|
|
130
|
+
*/
|
|
131
|
+
export declare function DatePicker(handle: Handle<DatePicker.Props>): () => import("remix/ui").RemixElement;
|
|
132
|
+
export declare namespace DatePicker {
|
|
133
|
+
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
|
+
}
|
|
@@ -0,0 +1,155 @@
|
|
|
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";
|
|
11
|
+
import { DateField } from "./date-field.js";
|
|
12
|
+
import { Popover } from "./popover.js";
|
|
13
|
+
/**
|
|
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.
|
|
35
|
+
*
|
|
36
|
+
* @param handle Runtime handle carrying the root element's props.
|
|
37
|
+
* @returns The render function producing the date picker's markup.
|
|
38
|
+
* @example
|
|
39
|
+
* <DatePicker label={t("form.birthday.label")} name="birthday" autoComplete="bday" />
|
|
40
|
+
* @example
|
|
41
|
+
* <DatePicker>
|
|
42
|
+
* <Label htmlFor="startDate">{t("form.startDate.label")}</Label>
|
|
43
|
+
* <DatePicker.Group>
|
|
44
|
+
* <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
|
+
* </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
|
+
* </DatePicker>
|
|
62
|
+
*/
|
|
63
|
+
export function DatePicker(handle) {
|
|
64
|
+
return () => {
|
|
65
|
+
let { color, label, description, errorMessage, name, value, defaultValue, min, max, step, required, disabled, readOnly, autoComplete, parts, children, mix, ...rest } = handle.props;
|
|
66
|
+
if (import.meta.env.DEV && !children && !label) {
|
|
67
|
+
console.warn('DatePicker: falling back to DateField\'s plain "input type=date" needs a "label" describing what it collects for assistive technology.');
|
|
68
|
+
}
|
|
69
|
+
if (!children) {
|
|
70
|
+
return (_jsx(DateField, { ...rest, color: color, label: label, description: description, errorMessage: errorMessage, name: name, value: value, defaultValue: defaultValue, min: min, max: max, step: step, required: required, disabled: disabled, readOnly: readOnly, autoComplete: autoComplete, parts: parts, mix: mix }));
|
|
71
|
+
}
|
|
72
|
+
return (_jsx("div", { ...rest, "data-slot": "date-picker", mix: [flex(), flexCol(), gap(1), mix], children: children }));
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
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.
|
|
79
|
+
*
|
|
80
|
+
* @param handle Runtime handle carrying the host `<div>`'s props.
|
|
81
|
+
* @returns The render function producing the row's markup.
|
|
82
|
+
* @example
|
|
83
|
+
* <DatePicker.Group>
|
|
84
|
+
* <Input id="startDate" type="date" name="startDate" />
|
|
85
|
+
* <DatePicker.Button commandfor="startDate-calendar" command="toggle-popover" aria-label={t("form.startDate.toggle")} />
|
|
86
|
+
* </DatePicker.Group>
|
|
87
|
+
*/
|
|
88
|
+
DatePicker.Group = function DatePickerGroup(handle) {
|
|
89
|
+
return () => {
|
|
90
|
+
let { mix, ...rest } = handle.props;
|
|
91
|
+
return (_jsx("div", { ...rest, "data-slot": "group", mix: [
|
|
92
|
+
flex(),
|
|
93
|
+
items("center"),
|
|
94
|
+
when("&:focus-within", outline({ color: "brand.ring", offset: 2 })),
|
|
95
|
+
mix,
|
|
96
|
+
] }));
|
|
97
|
+
};
|
|
98
|
+
};
|
|
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
|
+
};
|
|
@@ -0,0 +1,152 @@
|
|
|
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.
|
|
10
|
+
*
|
|
11
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
12
|
+
* @copyright Sergio Xalambrí 2026
|
|
13
|
+
*/
|
|
14
|
+
import type { Handle, Props as TagProps, RemixNode } from "remix/ui";
|
|
15
|
+
import { DateField } from "./date-field.js";
|
|
16
|
+
import { DatePicker } from "./date-picker.js";
|
|
17
|
+
/**
|
|
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.
|
|
21
|
+
*/
|
|
22
|
+
export declare namespace DateRangePicker {
|
|
23
|
+
/**
|
|
24
|
+
* Semantic color role for the fallback pair's keyboard focus rings. Read
|
|
25
|
+
* only by the fallback fields — {@link DateRangePicker.Group}'s composed
|
|
26
|
+
* control carries no `color` prop of its own.
|
|
27
|
+
*/
|
|
28
|
+
type Color = DateField.Color;
|
|
29
|
+
/**
|
|
30
|
+
* Per-part styling for the two {@link DateField} instances the fallback
|
|
31
|
+
* pair composes, each forwarded to that field's own `parts`. Read only
|
|
32
|
+
* when `children` is unset; the composed layout styles its own parts individually instead.
|
|
33
|
+
*/
|
|
34
|
+
interface PartsProps {
|
|
35
|
+
/** Per-part styling for the fallback pair's start-date field. */
|
|
36
|
+
start?: DateField.PartsProps;
|
|
37
|
+
/** Per-part styling for the fallback pair's end-date field. */
|
|
38
|
+
end?: DateField.PartsProps;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Props accepted by {@link DateRangePicker}. Leaving `children` unset
|
|
42
|
+
* 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.
|
|
44
|
+
*/
|
|
45
|
+
interface Props extends Omit<TagProps<"div">, "children"> {
|
|
46
|
+
/** Semantic color role for the fallback pair's focus rings. Read only when `children` is unset. */
|
|
47
|
+
color?: Color;
|
|
48
|
+
/** The start-date field's caption, rendered through {@link DateField}. Read only when `children` is unset. */
|
|
49
|
+
startLabel?: RemixNode;
|
|
50
|
+
/** The end-date field's caption, rendered through {@link DateField}. Read only when `children` is unset. */
|
|
51
|
+
endLabel?: RemixNode;
|
|
52
|
+
/** Supporting copy beneath the start-date field. Read only when `children` is unset. */
|
|
53
|
+
startDescription?: RemixNode;
|
|
54
|
+
/** Supporting copy beneath the end-date field. Read only when `children` is unset. */
|
|
55
|
+
endDescription?: RemixNode;
|
|
56
|
+
/** Validation message beneath the start-date field. Read only when `children` is unset. */
|
|
57
|
+
startErrorMessage?: RemixNode;
|
|
58
|
+
/** Validation message beneath the end-date field. Read only when `children` is unset. */
|
|
59
|
+
endErrorMessage?: RemixNode;
|
|
60
|
+
/** Native `name` submitted with an enclosing form for the start-date field. */
|
|
61
|
+
startName?: string;
|
|
62
|
+
/** Native `name` submitted with an enclosing form for the end-date field. */
|
|
63
|
+
endName?: string;
|
|
64
|
+
/** Current start-of-range value, in `YYYY-MM-DD` form, for a fallback pair a consumer tracks itself. */
|
|
65
|
+
startValue?: string;
|
|
66
|
+
/** Current end-of-range value, in `YYYY-MM-DD` form, for a fallback pair a consumer tracks itself. */
|
|
67
|
+
endValue?: string;
|
|
68
|
+
/** Initial start-of-range value, in `YYYY-MM-DD` form, for a fallback pair left to the platform's own uncontrolled state. */
|
|
69
|
+
startDefaultValue?: string;
|
|
70
|
+
/** Initial end-of-range value, in `YYYY-MM-DD` form, for a fallback pair left to the platform's own uncontrolled state. */
|
|
71
|
+
endDefaultValue?: string;
|
|
72
|
+
/** Earliest accepted date, in `YYYY-MM-DD` form, read by both of the fallback pair's fields. */
|
|
73
|
+
min?: string;
|
|
74
|
+
/** Latest accepted date, in `YYYY-MM-DD` form, read by both of the fallback pair's fields. */
|
|
75
|
+
max?: string;
|
|
76
|
+
/** Granularity, in days, both of the fallback pair's values must fall on. */
|
|
77
|
+
step?: number;
|
|
78
|
+
/** Marks both of the fallback pair's fields required for their enclosing form. */
|
|
79
|
+
required?: boolean;
|
|
80
|
+
/** Marks both of the fallback pair's fields inert and excluded from the tab order. */
|
|
81
|
+
disabled?: boolean;
|
|
82
|
+
/** Marks both of the fallback pair's fields' values fixed, while keeping them focusable and included in form submission. */
|
|
83
|
+
readOnly?: boolean;
|
|
84
|
+
/** Native autofill hint for both of the fallback pair's fields. */
|
|
85
|
+
autoComplete?: string;
|
|
86
|
+
/** Per-part styling for the fallback pair's internally composed {@link DateField} instances. Read only when `children` is unset. */
|
|
87
|
+
parts?: PartsProps;
|
|
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.
|
|
92
|
+
*/
|
|
93
|
+
children?: RemixNode;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
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.
|
|
99
|
+
*/
|
|
100
|
+
interface GroupProps extends DatePicker.GroupProps {
|
|
101
|
+
}
|
|
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
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Renders {@link DateRangePicker}'s root. Leaving `children` unset renders
|
|
111
|
+
* 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.
|
|
113
|
+
*
|
|
114
|
+
* @param handle Runtime handle carrying the root element's props.
|
|
115
|
+
* @returns The render function producing the date range picker's markup.
|
|
116
|
+
* @example
|
|
117
|
+
* <DateRangePicker
|
|
118
|
+
* startLabel={t("form.stay.checkIn")}
|
|
119
|
+
* endLabel={t("form.stay.checkOut")}
|
|
120
|
+
* startName="checkIn"
|
|
121
|
+
* endName="checkOut"
|
|
122
|
+
* />
|
|
123
|
+
* @example
|
|
124
|
+
* <DateRangePicker>
|
|
125
|
+
* <Label htmlFor="tripStart">{t("form.trip.label")}</Label>
|
|
126
|
+
* <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
|
+
* />
|
|
134
|
+
* </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
|
+
* </DateRangePicker>
|
|
146
|
+
*/
|
|
147
|
+
export declare function DateRangePicker(handle: Handle<DateRangePicker.Props>): () => import("remix/ui").RemixElement;
|
|
148
|
+
export declare namespace DateRangePicker {
|
|
149
|
+
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
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "remix/ui/jsx-runtime";
|
|
2
|
+
import { flex, flexCol, gap, items } from "@sdxc/u/layout";
|
|
3
|
+
import { attrs } from "remix/ui";
|
|
4
|
+
import { DateField } from "./date-field.js";
|
|
5
|
+
import { DatePicker } from "./date-picker.js";
|
|
6
|
+
/**
|
|
7
|
+
* Renders {@link DateRangePicker}'s root. Leaving `children` unset renders
|
|
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.
|
|
10
|
+
*
|
|
11
|
+
* @param handle Runtime handle carrying the root element's props.
|
|
12
|
+
* @returns The render function producing the date range picker's markup.
|
|
13
|
+
* @example
|
|
14
|
+
* <DateRangePicker
|
|
15
|
+
* startLabel={t("form.stay.checkIn")}
|
|
16
|
+
* endLabel={t("form.stay.checkOut")}
|
|
17
|
+
* startName="checkIn"
|
|
18
|
+
* endName="checkOut"
|
|
19
|
+
* />
|
|
20
|
+
* @example
|
|
21
|
+
* <DateRangePicker>
|
|
22
|
+
* <Label htmlFor="tripStart">{t("form.trip.label")}</Label>
|
|
23
|
+
* <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
|
+
* />
|
|
31
|
+
* </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
|
+
* </DateRangePicker>
|
|
43
|
+
*/
|
|
44
|
+
export function DateRangePicker(handle) {
|
|
45
|
+
return () => {
|
|
46
|
+
let { color, startLabel, endLabel, startDescription, endDescription, startErrorMessage, endErrorMessage, startName, endName, startValue, endValue, startDefaultValue, endDefaultValue, min, max, step, required, disabled, readOnly, autoComplete, parts, children, mix, ...rest } = handle.props;
|
|
47
|
+
if (import.meta.env.DEV && !children) {
|
|
48
|
+
if (!startLabel) {
|
|
49
|
+
console.warn('DateRangePicker: falling back to paired "input type=date" fields needs a "startLabel" describing the range\'s start for assistive technology.');
|
|
50
|
+
}
|
|
51
|
+
if (!endLabel) {
|
|
52
|
+
console.warn('DateRangePicker: falling back to paired "input type=date" fields needs an "endLabel" describing the range\'s end for assistive technology.');
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (!children) {
|
|
56
|
+
return (_jsxs("div", { ...rest, "data-slot": "fields", mix: [attrs({ role: "group" }), flex(), gap(2), items("start"), mix], children: [_jsx(DateField, { color: color, label: startLabel, description: startDescription, errorMessage: startErrorMessage, name: startName, value: startValue, defaultValue: startDefaultValue, min: min, max: max, step: step, required: required, disabled: disabled, readOnly: readOnly, autoComplete: autoComplete, parts: parts?.start }), _jsx(DateField, { color: color, label: endLabel, description: endDescription, errorMessage: endErrorMessage, name: endName, value: endValue, defaultValue: endDefaultValue, min: min, max: max, step: step, required: required, disabled: disabled, readOnly: readOnly, autoComplete: autoComplete, parts: parts?.end })] }));
|
|
57
|
+
}
|
|
58
|
+
return (_jsx("div", { ...rest, "data-slot": "date-range-picker", mix: [flex(), flexCol(), gap(1), mix], children: children }));
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Renders {@link DateRangePicker}'s control row: identical to
|
|
63
|
+
* {@link DatePicker.Group}'s markup and focus-within outline. `children`
|
|
64
|
+
* composes the range's start and end controls with {@link DateRangePicker.Button}, and the row gains a keyboard focus ring whenever focus lands anywhere inside it.
|
|
65
|
+
*
|
|
66
|
+
* @param handle Runtime handle carrying the host `<div>`'s props.
|
|
67
|
+
* @returns The render function producing the row's markup.
|
|
68
|
+
* @example
|
|
69
|
+
* <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")} />
|
|
73
|
+
* </DateRangePicker.Group>
|
|
74
|
+
*/
|
|
75
|
+
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;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A short passage of supporting copy beneath a form control, styled at the
|
|
3
|
+
* library's default text size and the neutral muted foreground color. It
|
|
4
|
+
* renders as a native `<p>` so a consumer can wire its `id` into the
|
|
5
|
+
* control's `aria-describedby`, giving assistive technology a spoken hint,
|
|
6
|
+
* format requirement, or constraint alongside the control's label.
|
|
7
|
+
*
|
|
8
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
9
|
+
* @copyright Sergio Xalambrí 2026
|
|
10
|
+
*/
|
|
11
|
+
import type { Handle, Props as TagProps } from "remix/ui";
|
|
12
|
+
/**
|
|
13
|
+
* Prop types for {@link Description}.
|
|
14
|
+
*/
|
|
15
|
+
export declare namespace Description {
|
|
16
|
+
/**
|
|
17
|
+
* Every native `<p>` attribute, unchanged, plus the `mix` passthrough,
|
|
18
|
+
* always rendering at the library's default body-copy size and muted
|
|
19
|
+
* foreground color. Give it an `id` referenced by the paired control's `aria-describedby` to associate the two.
|
|
20
|
+
*/
|
|
21
|
+
interface Props extends TagProps<"p"> {
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Renders its children inside a `<p>` sized and colored as a small run of
|
|
26
|
+
* supporting copy: the library's default text size paired with the neutral
|
|
27
|
+
* muted foreground color, placed after a control inside a field wrapper as a format hint or constraint note.
|
|
28
|
+
*
|
|
29
|
+
* @param handle Runtime handle carrying the host `<p>`'s props.
|
|
30
|
+
* @returns The render function producing the description's markup.
|
|
31
|
+
* @example
|
|
32
|
+
* <Description id="password-hint">
|
|
33
|
+
* {t("field.password.hint")}
|
|
34
|
+
* </Description>
|
|
35
|
+
*/
|
|
36
|
+
export declare function Description(handle: Handle<Description.Props>): () => import("remix/ui").RemixElement;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as _jsx } from "remix/ui/jsx-runtime";
|
|
2
|
+
import { fg } from "@sdxc/u/color";
|
|
3
|
+
import { text } from "@sdxc/u/typography";
|
|
4
|
+
/**
|
|
5
|
+
* Renders its children inside a `<p>` sized and colored as a small run of
|
|
6
|
+
* supporting copy: the library's default text size paired with the neutral
|
|
7
|
+
* muted foreground color, placed after a control inside a field wrapper as a format hint or constraint note.
|
|
8
|
+
*
|
|
9
|
+
* @param handle Runtime handle carrying the host `<p>`'s props.
|
|
10
|
+
* @returns The render function producing the description's markup.
|
|
11
|
+
* @example
|
|
12
|
+
* <Description id="password-hint">
|
|
13
|
+
* {t("field.password.hint")}
|
|
14
|
+
* </Description>
|
|
15
|
+
*/
|
|
16
|
+
export function Description(handle) {
|
|
17
|
+
return () => {
|
|
18
|
+
let { mix, ...rest } = handle.props;
|
|
19
|
+
return _jsx("p", { ...rest, mix: [fg("neutral.muted"), text("sm"), mix] });
|
|
20
|
+
};
|
|
21
|
+
}
|