@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,320 @@
|
|
|
1
|
+
import { jsx as _jsx } from "remix/ui/jsx-runtime";
|
|
2
|
+
import { ChevronLeftIcon, ChevronRightIcon } from "@sdxc/icons";
|
|
3
|
+
import { bg, fg, outline } from "@sdxc/u/color";
|
|
4
|
+
import { opacity, rounded } from "@sdxc/u/effects";
|
|
5
|
+
import { cursor } from "@sdxc/u/general";
|
|
6
|
+
import { basis, borderCollapse, borderSpacing, flex, grow, inlineBlock, items, justify, shrink, } from "@sdxc/u/layout";
|
|
7
|
+
import { bs, is, mbe, p, pbe } from "@sdxc/u/size";
|
|
8
|
+
import { hover, when } from "@sdxc/u/state";
|
|
9
|
+
import { scaleX } from "@sdxc/u/transform";
|
|
10
|
+
import { text, textAlign, textDecoration, weight } from "@sdxc/u/typography";
|
|
11
|
+
import { attrs } from "remix/ui";
|
|
12
|
+
import { interactiveTransition } from "../styles/interactive-transition.js";
|
|
13
|
+
import { warnIfNoAccessibleLabel, warnIfNoAccessibleName, } from "../utils/warn-if-no-accessible-name.js";
|
|
14
|
+
import { Heading } from "./heading.js";
|
|
15
|
+
import { Input } from "./input.js";
|
|
16
|
+
const DEFAULT_COLOR = "neutral";
|
|
17
|
+
/**
|
|
18
|
+
* `type` for {@link Calendar.PreviousButton} and {@link Calendar.NextButton}
|
|
19
|
+
* when a consumer supplies none, keeping a click on either control a plain
|
|
20
|
+
* month change inside a surrounding `<form>`.
|
|
21
|
+
*/
|
|
22
|
+
const DEFAULT_NAV_BUTTON_TYPE = "button";
|
|
23
|
+
/**
|
|
24
|
+
* Renders a rounded, padded surface around whichever children a consumer
|
|
25
|
+
* composes; `children` left unset renders a native `<input type="date">`
|
|
26
|
+
* through {@link Input}, the one part the platform itself operates.
|
|
27
|
+
*
|
|
28
|
+
* @param handle Runtime handle carrying the root element's props.
|
|
29
|
+
* @returns The render function producing the calendar's markup.
|
|
30
|
+
* @example
|
|
31
|
+
* <Calendar aria-label={t("form.startDate.label")} name="startDate" />
|
|
32
|
+
* @example
|
|
33
|
+
* <Calendar aria-label={t("calendar.label")}>
|
|
34
|
+
* <Calendar.Header>
|
|
35
|
+
* <Calendar.PreviousButton aria-label={t("calendar.previous")} />
|
|
36
|
+
* <Calendar.Heading>{monthLabel}</Calendar.Heading>
|
|
37
|
+
* <Calendar.NextButton aria-label={t("calendar.next")} />
|
|
38
|
+
* </Calendar.Header>
|
|
39
|
+
* <Calendar.Grid aria-label={monthLabel}>
|
|
40
|
+
* <Calendar.GridHeader>
|
|
41
|
+
* <Calendar.Row>
|
|
42
|
+
* {weekdayLabels.map((day) => (
|
|
43
|
+
* <Calendar.HeaderCell key={day}>{day}</Calendar.HeaderCell>
|
|
44
|
+
* ))}
|
|
45
|
+
* </Calendar.Row>
|
|
46
|
+
* </Calendar.GridHeader>
|
|
47
|
+
* <Calendar.GridBody>
|
|
48
|
+
* {weeks.map((week) => (
|
|
49
|
+
* <Calendar.Row key={week[0].iso}>
|
|
50
|
+
* {week.map((day) => (
|
|
51
|
+
* <Calendar.Cell
|
|
52
|
+
* key={day.iso}
|
|
53
|
+
* aria-selected={day.iso === selected ? "true" : undefined}
|
|
54
|
+
* data-outside-month={day.outsideMonth ? "" : undefined}
|
|
55
|
+
* >
|
|
56
|
+
* {day.label}
|
|
57
|
+
* </Calendar.Cell>
|
|
58
|
+
* ))}
|
|
59
|
+
* </Calendar.Row>
|
|
60
|
+
* ))}
|
|
61
|
+
* </Calendar.GridBody>
|
|
62
|
+
* </Calendar.Grid>
|
|
63
|
+
* </Calendar>
|
|
64
|
+
*/
|
|
65
|
+
export function Calendar(handle) {
|
|
66
|
+
return () => {
|
|
67
|
+
let { color, name, value, defaultValue, min, max, step, required, disabled, readOnly, autoComplete, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, children, mix, ...rest } = handle.props;
|
|
68
|
+
let resolvedColor = color ?? DEFAULT_COLOR;
|
|
69
|
+
if (import.meta.env.DEV && !children && !ariaLabel && !ariaLabelledBy) {
|
|
70
|
+
console.warn('Calendar: falling back to a plain "input type=date" needs an "aria-label" or "aria-labelledby" describing what it collects for assistive technology.');
|
|
71
|
+
}
|
|
72
|
+
return (_jsx("div", { ...rest, "data-slot": "calendar", mix: [inlineBlock(), rounded("lg"), p(3), bg("neutral.tint"), mix], children: children ?? (_jsx(Input, { type: "date", color: resolvedColor, name: name, value: value, defaultValue: defaultValue, min: min, max: max, step: step, required: required, disabled: disabled, readOnly: readOnly, autoComplete: autoComplete, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy })) }));
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Renders {@link Calendar}'s nav row: a flex row spacing
|
|
77
|
+
* {@link Calendar.PreviousButton}, {@link Calendar.Heading}, and
|
|
78
|
+
* {@link Calendar.NextButton} apart, the heading centered between the controls.
|
|
79
|
+
*
|
|
80
|
+
* @param handle Runtime handle carrying the host `<header>`'s props.
|
|
81
|
+
* @returns The render function producing the nav row's markup.
|
|
82
|
+
* @example
|
|
83
|
+
* <Calendar.Header>
|
|
84
|
+
* <Calendar.PreviousButton aria-label={t("calendar.previous")} />
|
|
85
|
+
* <Calendar.Heading>{monthLabel}</Calendar.Heading>
|
|
86
|
+
* <Calendar.NextButton aria-label={t("calendar.next")} />
|
|
87
|
+
* </Calendar.Header>
|
|
88
|
+
*/
|
|
89
|
+
Calendar.Header = function CalendarHeader(handle) {
|
|
90
|
+
return () => {
|
|
91
|
+
let { mix, ...rest } = handle.props;
|
|
92
|
+
return (_jsx("header", { ...rest, "data-slot": "header", mix: [flex(), items("center"), justify("between"), mbe(4), mix] }));
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Renders a round icon control standing for "show the previous month", sized
|
|
97
|
+
* to match {@link Calendar.NextButton}. Its default chevron flips under
|
|
98
|
+
* `dir="rtl"` through CSS. A `calendarKeys()` mixin drives the behavior.
|
|
99
|
+
*
|
|
100
|
+
* @param handle Runtime handle carrying the host `<button>`'s props.
|
|
101
|
+
* @returns The render function producing the control's markup.
|
|
102
|
+
* @example
|
|
103
|
+
* <Calendar.PreviousButton aria-label={t("calendar.previous")} />
|
|
104
|
+
*/
|
|
105
|
+
Calendar.PreviousButton = function CalendarPreviousButton(handle) {
|
|
106
|
+
return () => {
|
|
107
|
+
let { type, children, mix, ...rest } = handle.props;
|
|
108
|
+
warnIfNoAccessibleName(handle.props, children, 'Calendar.PreviousButton: an icon-only control needs an "aria-label" describing what it does — assistive technology has no accessible text to announce otherwise.');
|
|
109
|
+
return (_jsx("button", { type: type ?? DEFAULT_NAV_BUTTON_TYPE, ...rest, "data-slot": "previous-button", mix: [
|
|
110
|
+
interactiveTransition(),
|
|
111
|
+
when("&:focus-visible", outline({ color: "brand.ring", offset: 2 })),
|
|
112
|
+
flex(),
|
|
113
|
+
items("center"),
|
|
114
|
+
justify("center"),
|
|
115
|
+
is(8),
|
|
116
|
+
bs(8),
|
|
117
|
+
rounded("full"),
|
|
118
|
+
fg("neutral"),
|
|
119
|
+
hover(bg("neutral.bg-tint-hover")),
|
|
120
|
+
when("&:disabled", [cursor("not-allowed"), opacity(50)]),
|
|
121
|
+
when("& svg", [is(4), bs(4)]),
|
|
122
|
+
when("&:dir(rtl) svg", scaleX(-1)),
|
|
123
|
+
mix,
|
|
124
|
+
], children: children ?? _jsx(ChevronLeftIcon, {}) }));
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
/**
|
|
128
|
+
* Renders a round icon control standing for "show the following month", with
|
|
129
|
+
* the rendering, focus, and disabled-state contract of
|
|
130
|
+
* {@link Calendar.PreviousButton} and a trailing chevron by default.
|
|
131
|
+
*
|
|
132
|
+
* @param handle Runtime handle carrying the host `<button>`'s props.
|
|
133
|
+
* @returns The render function producing the control's markup.
|
|
134
|
+
* @example
|
|
135
|
+
* <Calendar.NextButton aria-label={t("calendar.next")} />
|
|
136
|
+
*/
|
|
137
|
+
Calendar.NextButton = function CalendarNextButton(handle) {
|
|
138
|
+
return () => {
|
|
139
|
+
let { type, children, mix, ...rest } = handle.props;
|
|
140
|
+
warnIfNoAccessibleName(handle.props, children, 'Calendar.NextButton: an icon-only control needs an "aria-label" describing what it does — assistive technology has no accessible text to announce otherwise.');
|
|
141
|
+
return (_jsx("button", { type: type ?? DEFAULT_NAV_BUTTON_TYPE, ...rest, "data-slot": "next-button", mix: [
|
|
142
|
+
interactiveTransition(),
|
|
143
|
+
when("&:focus-visible", outline({ color: "brand.ring", offset: 2 })),
|
|
144
|
+
flex(),
|
|
145
|
+
items("center"),
|
|
146
|
+
justify("center"),
|
|
147
|
+
is(8),
|
|
148
|
+
bs(8),
|
|
149
|
+
rounded("full"),
|
|
150
|
+
fg("neutral"),
|
|
151
|
+
hover(bg("neutral.bg-tint-hover")),
|
|
152
|
+
when("&:disabled", [cursor("not-allowed"), opacity(50)]),
|
|
153
|
+
when("& svg", [is(4), bs(4)]),
|
|
154
|
+
when("&:dir(rtl) svg", scaleX(-1)),
|
|
155
|
+
mix,
|
|
156
|
+
], children: children ?? _jsx(ChevronRightIcon, {}) }));
|
|
157
|
+
};
|
|
158
|
+
};
|
|
159
|
+
/**
|
|
160
|
+
* Renders the consumer-formatted month/year caption through {@link Heading},
|
|
161
|
+
* centered between the nav controls at a small semibold size layered after
|
|
162
|
+
* {@link Heading}'s own defaults, so this size and alignment win over them.
|
|
163
|
+
*
|
|
164
|
+
* @param handle Runtime handle carrying the host heading element's props.
|
|
165
|
+
* @returns The render function producing the caption's markup.
|
|
166
|
+
* @example
|
|
167
|
+
* <Calendar.Heading>{new Intl.DateTimeFormat(locale, { month: "long", year: "numeric" }).format(visibleMonth)}</Calendar.Heading>
|
|
168
|
+
*/
|
|
169
|
+
Calendar.Heading = function CalendarHeading(handle) {
|
|
170
|
+
return () => {
|
|
171
|
+
let { mix, ...rest } = handle.props;
|
|
172
|
+
return (_jsx(Heading, { ...rest, "data-slot": "heading", mix: [
|
|
173
|
+
grow(),
|
|
174
|
+
shrink(1),
|
|
175
|
+
basis("0%"),
|
|
176
|
+
textAlign("center"),
|
|
177
|
+
weight("semibold"),
|
|
178
|
+
fg("neutral.emphasis"),
|
|
179
|
+
text("sm"),
|
|
180
|
+
mix,
|
|
181
|
+
] }));
|
|
182
|
+
};
|
|
183
|
+
};
|
|
184
|
+
/**
|
|
185
|
+
* Renders the day grid's native `<table>` host, rows and cells set apart by a
|
|
186
|
+
* small gap on every side. Its `aria-label`/`aria-labelledby` — typically the
|
|
187
|
+
* visible month label — names the whole grid; dev mode warns when it is absent.
|
|
188
|
+
*
|
|
189
|
+
* @param handle Runtime handle carrying the host `<table>`'s props.
|
|
190
|
+
* @returns The render function producing the grid's markup.
|
|
191
|
+
* @example
|
|
192
|
+
* <Calendar.Grid aria-label={monthLabel}>
|
|
193
|
+
* <Calendar.GridHeader>...</Calendar.GridHeader>
|
|
194
|
+
* <Calendar.GridBody>...</Calendar.GridBody>
|
|
195
|
+
* </Calendar.Grid>
|
|
196
|
+
*/
|
|
197
|
+
Calendar.Grid = function CalendarGrid(handle) {
|
|
198
|
+
return () => {
|
|
199
|
+
let { mix, ...rest } = handle.props;
|
|
200
|
+
warnIfNoAccessibleLabel(handle.props, 'Calendar.Grid: needs an "aria-label" or "aria-labelledby" identifying which month it shows for assistive technology.');
|
|
201
|
+
return (_jsx("table", { ...rest, "data-slot": "grid", mix: [borderCollapse("separate"), borderSpacing("0.25rem"), mix] }));
|
|
202
|
+
};
|
|
203
|
+
};
|
|
204
|
+
/**
|
|
205
|
+
* Renders the grid's `<thead>` host: a plain wrapper for the weekday
|
|
206
|
+
* {@link Calendar.Row}.
|
|
207
|
+
*
|
|
208
|
+
* @param handle Runtime handle carrying the host `<thead>`'s props.
|
|
209
|
+
* @returns The render function producing the header section's markup.
|
|
210
|
+
* @example
|
|
211
|
+
* <Calendar.GridHeader>
|
|
212
|
+
* <Calendar.Row>
|
|
213
|
+
* <Calendar.HeaderCell>{t("calendar.weekdays.sun")}</Calendar.HeaderCell>
|
|
214
|
+
* </Calendar.Row>
|
|
215
|
+
* </Calendar.GridHeader>
|
|
216
|
+
*/
|
|
217
|
+
Calendar.GridHeader = function CalendarGridHeader(handle) {
|
|
218
|
+
return () => {
|
|
219
|
+
let { mix, ...rest } = handle.props;
|
|
220
|
+
return _jsx("thead", { ...rest, "data-slot": "grid-header", mix: [mix] });
|
|
221
|
+
};
|
|
222
|
+
};
|
|
223
|
+
/**
|
|
224
|
+
* Renders a native `<tr>` host: one row of {@link Calendar.HeaderCell} inside
|
|
225
|
+
* {@link Calendar.GridHeader}, or one week of {@link Calendar.Cell} inside
|
|
226
|
+
* {@link Calendar.GridBody}.
|
|
227
|
+
*
|
|
228
|
+
* @param handle Runtime handle carrying the host `<tr>`'s props.
|
|
229
|
+
* @returns The render function producing the row's markup.
|
|
230
|
+
* @example
|
|
231
|
+
* <Calendar.Row>
|
|
232
|
+
* <Calendar.Cell>{day.label}</Calendar.Cell>
|
|
233
|
+
* </Calendar.Row>
|
|
234
|
+
*/
|
|
235
|
+
Calendar.Row = function CalendarRow(handle) {
|
|
236
|
+
return () => {
|
|
237
|
+
let { mix, ...rest } = handle.props;
|
|
238
|
+
return _jsx("tr", { ...rest, "data-slot": "row", mix: [mix] });
|
|
239
|
+
};
|
|
240
|
+
};
|
|
241
|
+
/**
|
|
242
|
+
* Renders a weekday abbreviation inside a native `<th scope="col">`, sized
|
|
243
|
+
* small and muted beneath {@link Calendar.Cell}'s own larger day numbers.
|
|
244
|
+
*
|
|
245
|
+
* @param handle Runtime handle carrying the host `<th>`'s props.
|
|
246
|
+
* @returns The render function producing the weekday header's markup.
|
|
247
|
+
* @example
|
|
248
|
+
* <Calendar.HeaderCell>{t("calendar.weekdays.sun")}</Calendar.HeaderCell>
|
|
249
|
+
*/
|
|
250
|
+
Calendar.HeaderCell = function CalendarHeaderCell(handle) {
|
|
251
|
+
return () => {
|
|
252
|
+
let { mix, ...rest } = handle.props;
|
|
253
|
+
return (_jsx("th", { ...rest, "data-slot": "header-cell", mix: [
|
|
254
|
+
attrs({ scope: "col" }),
|
|
255
|
+
pbe(2),
|
|
256
|
+
weight("medium"),
|
|
257
|
+
fg("neutral.muted"),
|
|
258
|
+
text("xs"),
|
|
259
|
+
mix,
|
|
260
|
+
] }));
|
|
261
|
+
};
|
|
262
|
+
};
|
|
263
|
+
/**
|
|
264
|
+
* Renders the grid's `<tbody>` host: a plain wrapper for one
|
|
265
|
+
* {@link Calendar.Row} per week.
|
|
266
|
+
*
|
|
267
|
+
* @param handle Runtime handle carrying the host `<tbody>`'s props.
|
|
268
|
+
* @returns The render function producing the body section's markup.
|
|
269
|
+
* @example
|
|
270
|
+
* <Calendar.GridBody>
|
|
271
|
+
* {weeks.map((week) => (
|
|
272
|
+
* <Calendar.Row key={week[0].iso}>...</Calendar.Row>
|
|
273
|
+
* ))}
|
|
274
|
+
* </Calendar.GridBody>
|
|
275
|
+
*/
|
|
276
|
+
Calendar.GridBody = function CalendarGridBody(handle) {
|
|
277
|
+
return () => {
|
|
278
|
+
let { mix, ...rest } = handle.props;
|
|
279
|
+
return _jsx("tbody", { ...rest, "data-slot": "grid-body", mix: [mix] });
|
|
280
|
+
};
|
|
281
|
+
};
|
|
282
|
+
/**
|
|
283
|
+
* Renders one calendar day inside a native `<td>`, a fixed round pill around
|
|
284
|
+
* its number. `aria-selected`, `aria-disabled`, `data-unavailable`,
|
|
285
|
+
* `data-outside-month`, and `aria-invalid` each drive their own visual state.
|
|
286
|
+
*
|
|
287
|
+
* @param handle Runtime handle carrying the host `<td>`'s props.
|
|
288
|
+
* @returns The render function producing the day's markup.
|
|
289
|
+
* @example
|
|
290
|
+
* <Calendar.Cell aria-selected={day.iso === selected ? "true" : undefined}>
|
|
291
|
+
* {day.label}
|
|
292
|
+
* </Calendar.Cell>
|
|
293
|
+
* @example
|
|
294
|
+
* <Calendar.Cell data-outside-month="">{day.label}</Calendar.Cell>
|
|
295
|
+
*/
|
|
296
|
+
Calendar.Cell = function CalendarCell(handle) {
|
|
297
|
+
return () => {
|
|
298
|
+
let { mix, ...rest } = handle.props;
|
|
299
|
+
return (_jsx("td", { ...rest, "data-slot": "cell", mix: [
|
|
300
|
+
interactiveTransition(),
|
|
301
|
+
when("&:focus-visible", outline({ color: "brand.ring", offset: 2 })),
|
|
302
|
+
flex(),
|
|
303
|
+
items("center"),
|
|
304
|
+
justify("center"),
|
|
305
|
+
is(9),
|
|
306
|
+
bs(9),
|
|
307
|
+
cursor("default"),
|
|
308
|
+
rounded("full"),
|
|
309
|
+
fg("neutral.emphasis"),
|
|
310
|
+
text("sm"),
|
|
311
|
+
hover(bg("neutral.bg-tint-hover")),
|
|
312
|
+
when('&[aria-selected="true"]', [bg("brand.solid"), fg("brand.onSolid")]),
|
|
313
|
+
when('&[aria-disabled="true"]', [cursor("not-allowed"), opacity(30)]),
|
|
314
|
+
when("&[data-unavailable]", [fg("neutral.muted"), textDecoration("line-through")]),
|
|
315
|
+
when("&[data-outside-month]", fg("neutral.muted")),
|
|
316
|
+
when('&[aria-invalid="true"]', [bg("danger.solid"), fg("danger.onSolid")]),
|
|
317
|
+
mix,
|
|
318
|
+
] }));
|
|
319
|
+
};
|
|
320
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A bounded container grouping a header, body content, and footer actions
|
|
3
|
+
* into one bordered, softly shadowed panel tinted by a semantic color role.
|
|
4
|
+
* The role colors border, background, and text together, so {@link Card.Title}
|
|
5
|
+
* and {@link Card.Description} inherit their text color from the root through
|
|
6
|
+
* ordinary CSS inheritance.
|
|
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
|
+
import type { SemanticColor } from "../utils/semantic-color.js";
|
|
13
|
+
/**
|
|
14
|
+
* Prop types for {@link Card} and its compound parts.
|
|
15
|
+
*/
|
|
16
|
+
export declare namespace Card {
|
|
17
|
+
/**
|
|
18
|
+
* Semantic color role, each mapped to its matching `--ui-*` border,
|
|
19
|
+
* background, and foreground variables.
|
|
20
|
+
*/
|
|
21
|
+
type Color = SemanticColor;
|
|
22
|
+
/**
|
|
23
|
+
* Every native `<section>` attribute, unchanged, plus the `color` role that
|
|
24
|
+
* tints the panel.
|
|
25
|
+
*/
|
|
26
|
+
interface Props extends TagProps<"section"> {
|
|
27
|
+
/** Semantic color role. Defaults to {@link DEFAULT_COLOR}. */
|
|
28
|
+
color?: Color;
|
|
29
|
+
}
|
|
30
|
+
/** Every native `<header>` attribute, unchanged, plus the `mix` passthrough. */
|
|
31
|
+
interface HeaderProps extends TagProps<"header"> {
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Every native heading-element attribute, unchanged: the rendered tag
|
|
35
|
+
* follows the nearest ambient heading level, falling back to `<h1>` where
|
|
36
|
+
* nothing supplies one.
|
|
37
|
+
*/
|
|
38
|
+
interface TitleProps extends TagProps<"h1"> {
|
|
39
|
+
}
|
|
40
|
+
/** Every native `<p>` attribute, unchanged, plus the `mix` passthrough. */
|
|
41
|
+
interface DescriptionProps extends TagProps<"p"> {
|
|
42
|
+
}
|
|
43
|
+
/** Every native `<div>` attribute, unchanged, plus the `mix` passthrough. */
|
|
44
|
+
interface ContentProps extends TagProps<"div"> {
|
|
45
|
+
}
|
|
46
|
+
/** Every native `<footer>` attribute, unchanged, plus the `mix` passthrough. */
|
|
47
|
+
interface FooterProps extends TagProps<"footer"> {
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* The card panel: a rounded, bordered, softly shadowed `<section>` tinted
|
|
52
|
+
* through the `data-color` attribute contract. Compose {@link Card.Header},
|
|
53
|
+
* {@link Card.Content}, and {@link Card.Footer} inside it.
|
|
54
|
+
*
|
|
55
|
+
* @param handle Runtime handle carrying the host `<section>`'s props.
|
|
56
|
+
* @returns The render function producing the panel's markup.
|
|
57
|
+
* @example
|
|
58
|
+
* <Card>
|
|
59
|
+
* <Card.Header>
|
|
60
|
+
* <Card.Title>{t("plan.title")}</Card.Title>
|
|
61
|
+
* <Card.Description>{t("plan.description")}</Card.Description>
|
|
62
|
+
* </Card.Header>
|
|
63
|
+
* <Card.Content>{t("plan.body")}</Card.Content>
|
|
64
|
+
* <Card.Footer>
|
|
65
|
+
* <Button>{t("plan.upgrade")}</Button>
|
|
66
|
+
* </Card.Footer>
|
|
67
|
+
* </Card>
|
|
68
|
+
* @example
|
|
69
|
+
* <Card color="danger">
|
|
70
|
+
* <Card.Header>
|
|
71
|
+
* <Card.Title>{t("errors.billing.title")}</Card.Title>
|
|
72
|
+
* </Card.Header>
|
|
73
|
+
* </Card>
|
|
74
|
+
*/
|
|
75
|
+
export declare function Card(handle: Handle<Card.Props>): () => import("remix/ui").RemixElement;
|
|
76
|
+
export declare namespace Card {
|
|
77
|
+
var Header: (handle: Handle<Card.HeaderProps>) => () => import("remix/ui").RemixElement;
|
|
78
|
+
var Title: (handle: Handle<Card.TitleProps>) => () => import("remix/ui").RemixElement;
|
|
79
|
+
var Description: (handle: Handle<Card.DescriptionProps>) => () => import("remix/ui").RemixElement;
|
|
80
|
+
var Content: (handle: Handle<Card.ContentProps>) => () => import("remix/ui").RemixElement;
|
|
81
|
+
var Footer: (handle: Handle<Card.FooterProps>) => () => import("remix/ui").RemixElement;
|
|
82
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { jsx as _jsx } from "remix/ui/jsx-runtime";
|
|
2
|
+
import { border } from "@sdxc/u/color";
|
|
3
|
+
import { opacity, rounded, shadow } from "@sdxc/u/effects";
|
|
4
|
+
import { flex, flexCol, gap, items } from "@sdxc/u/layout";
|
|
5
|
+
import { p, pbe, pbs, pi } from "@sdxc/u/size";
|
|
6
|
+
import { fontSize, leading, tracking, weight } from "@sdxc/u/typography";
|
|
7
|
+
import { semanticColorPanel } from "../styles/semantic-color-panel.js";
|
|
8
|
+
import { resolveHeadingLevel, TAG_BY_LEVEL } from "./heading-scope.js";
|
|
9
|
+
/** Semantic color role {@link Card} falls back to when `color` is omitted. */
|
|
10
|
+
const DEFAULT_COLOR = "neutral";
|
|
11
|
+
/**
|
|
12
|
+
* The card panel: a rounded, bordered, softly shadowed `<section>` tinted
|
|
13
|
+
* through the `data-color` attribute contract. Compose {@link Card.Header},
|
|
14
|
+
* {@link Card.Content}, and {@link Card.Footer} inside it.
|
|
15
|
+
*
|
|
16
|
+
* @param handle Runtime handle carrying the host `<section>`'s props.
|
|
17
|
+
* @returns The render function producing the panel's markup.
|
|
18
|
+
* @example
|
|
19
|
+
* <Card>
|
|
20
|
+
* <Card.Header>
|
|
21
|
+
* <Card.Title>{t("plan.title")}</Card.Title>
|
|
22
|
+
* <Card.Description>{t("plan.description")}</Card.Description>
|
|
23
|
+
* </Card.Header>
|
|
24
|
+
* <Card.Content>{t("plan.body")}</Card.Content>
|
|
25
|
+
* <Card.Footer>
|
|
26
|
+
* <Button>{t("plan.upgrade")}</Button>
|
|
27
|
+
* </Card.Footer>
|
|
28
|
+
* </Card>
|
|
29
|
+
* @example
|
|
30
|
+
* <Card color="danger">
|
|
31
|
+
* <Card.Header>
|
|
32
|
+
* <Card.Title>{t("errors.billing.title")}</Card.Title>
|
|
33
|
+
* </Card.Header>
|
|
34
|
+
* </Card>
|
|
35
|
+
*/
|
|
36
|
+
export function Card(handle) {
|
|
37
|
+
return () => {
|
|
38
|
+
let { color, mix, ...rest } = handle.props;
|
|
39
|
+
let resolvedColor = color ?? DEFAULT_COLOR;
|
|
40
|
+
return (_jsx("section", { "data-color": resolvedColor, ...rest, mix: [semanticColorPanel(), rounded("lg"), border({ width: 1 }), shadow("base"), mix] }));
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Renders the card's header slot: a `<header>` stacking its children in a
|
|
45
|
+
* column with a small gap, padded on every side. Nest {@link Card.Title} and
|
|
46
|
+
* {@link Card.Description} inside it.
|
|
47
|
+
*
|
|
48
|
+
* @param handle Runtime handle carrying the host `<header>`'s props.
|
|
49
|
+
* @returns The render function producing the header slot's markup.
|
|
50
|
+
* @example
|
|
51
|
+
* <Card.Header>
|
|
52
|
+
* <Card.Title>{t("plan.title")}</Card.Title>
|
|
53
|
+
* </Card.Header>
|
|
54
|
+
*/
|
|
55
|
+
Card.Header = function CardHeader(handle) {
|
|
56
|
+
return () => {
|
|
57
|
+
let { mix, ...rest } = handle.props;
|
|
58
|
+
return _jsx("header", { ...rest, mix: [flex(), flexCol(), p(6, 6), gap("0.375rem"), mix] });
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* The card's heading, in the native heading element matching the nearest
|
|
63
|
+
* ambient heading level — `<h1>` where nothing supplies one. Its text color
|
|
64
|
+
* inherits from the card root's `color` value.
|
|
65
|
+
*
|
|
66
|
+
* @param handle Runtime handle carrying the host heading element's props.
|
|
67
|
+
* @returns The render function producing the heading's markup.
|
|
68
|
+
* @example
|
|
69
|
+
* <Card.Title>{t("plan.title")}</Card.Title>
|
|
70
|
+
*/
|
|
71
|
+
Card.Title = function CardTitle(handle) {
|
|
72
|
+
return () => {
|
|
73
|
+
let { mix, ...rest } = handle.props;
|
|
74
|
+
let resolved = resolveHeadingLevel(handle);
|
|
75
|
+
let Tag = TAG_BY_LEVEL[resolved];
|
|
76
|
+
return (_jsx(Tag, { ...rest, "data-heading-level": resolved, mix: [fontSize("2xl"), leading(1), weight("semibold"), tracking("tight"), mix], children: rest.children }));
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* Renders the card's supporting copy inside a native `<p>`, muted to
|
|
81
|
+
* seventy percent opacity so it reads as secondary to {@link Card.Title}.
|
|
82
|
+
*
|
|
83
|
+
* @param handle Runtime handle carrying the host `<p>`'s props.
|
|
84
|
+
* @returns The render function producing the description's markup.
|
|
85
|
+
* @example
|
|
86
|
+
* <Card.Description>{t("plan.description")}</Card.Description>
|
|
87
|
+
*/
|
|
88
|
+
Card.Description = function CardDescription(handle) {
|
|
89
|
+
return () => {
|
|
90
|
+
let { mix, ...rest } = handle.props;
|
|
91
|
+
return _jsx("p", { ...rest, mix: [fontSize("sm"), opacity(70), mix] });
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* The card's main body slot: a `<div>` padded on its inline and block-end
|
|
96
|
+
* edges, leaving its block-start edge flush against {@link Card.Header}.
|
|
97
|
+
*
|
|
98
|
+
* @param handle Runtime handle carrying the host `<div>`'s props.
|
|
99
|
+
* @returns The render function producing the body slot's markup.
|
|
100
|
+
* @example
|
|
101
|
+
* <Card.Content>{t("plan.body")}</Card.Content>
|
|
102
|
+
*/
|
|
103
|
+
Card.Content = function CardContent(handle) {
|
|
104
|
+
return () => {
|
|
105
|
+
let { mix, ...rest } = handle.props;
|
|
106
|
+
return _jsx("div", { ...rest, mix: [pbs(0), pbe(6), pi(6), mix] });
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* The card's footer slot: a `<footer>` laying its children out in a
|
|
111
|
+
* vertically centered row, padded on its inline and block-end edges so it
|
|
112
|
+
* sits flush against the content above.
|
|
113
|
+
*
|
|
114
|
+
* @param handle Runtime handle carrying the host `<footer>`'s props.
|
|
115
|
+
* @returns The render function producing the footer slot's markup.
|
|
116
|
+
* @example
|
|
117
|
+
* <Card.Footer>
|
|
118
|
+
* <Button>{t("plan.upgrade")}</Button>
|
|
119
|
+
* </Card.Footer>
|
|
120
|
+
*/
|
|
121
|
+
Card.Footer = function CardFooter(handle) {
|
|
122
|
+
return () => {
|
|
123
|
+
let { mix, ...rest } = handle.props;
|
|
124
|
+
return _jsx("footer", { ...rest, mix: [flex(), items("center"), pbs(0), pbe(6), pi(6), mix] });
|
|
125
|
+
};
|
|
126
|
+
};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A horizontally scrolling collection of slides riding native CSS scroll snap,
|
|
3
|
+
* so swiping or scrolling advances between slides with no script in the
|
|
4
|
+
* baseline. {@link Carousel.Viewport} is the scrolling surface,
|
|
5
|
+
* {@link Carousel.Track} rows up its {@link Carousel.Slide} children, and
|
|
6
|
+
* {@link Carousel.Previous}/{@link Carousel.Next} are invoker buttons a paired
|
|
7
|
+
* mixin wires into working controls.
|
|
8
|
+
*
|
|
9
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
10
|
+
* @copyright Sergio Xalambrí 2026
|
|
11
|
+
*/
|
|
12
|
+
import type { Handle, Props as TagProps } from "remix/ui";
|
|
13
|
+
import { Button } from "./button.js";
|
|
14
|
+
/**
|
|
15
|
+
* Prop types for {@link Carousel} and its compound parts.
|
|
16
|
+
*/
|
|
17
|
+
export declare namespace Carousel {
|
|
18
|
+
/**
|
|
19
|
+
* Every native `<section>` attribute, unchanged, plus the `mix`
|
|
20
|
+
* passthrough. Override `--ui-carousel-gap`, `--ui-carousel-slide-size`, or
|
|
21
|
+
* `--ui-carousel-padding` per instance through the inherited `style` prop.
|
|
22
|
+
*/
|
|
23
|
+
interface Props extends TagProps<"section"> {
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Every native `<div>` attribute, unchanged, plus the `mix` passthrough.
|
|
27
|
+
* Give it an `id` for the controls' `commandfor` prop to target, and pair a
|
|
28
|
+
* `carouselControls()` mixin on it to make those controls scroll it.
|
|
29
|
+
*/
|
|
30
|
+
interface ViewportProps extends TagProps<"div"> {
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Every native `<div>` attribute, unchanged, plus the `mix` passthrough.
|
|
34
|
+
*/
|
|
35
|
+
interface TrackProps extends TagProps<"div"> {
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Every native `<div>` attribute, unchanged, plus the `mix` passthrough.
|
|
39
|
+
*/
|
|
40
|
+
interface SlideProps extends TagProps<"div"> {
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Every native `<div>` attribute, unchanged, plus the `mix` passthrough.
|
|
44
|
+
*/
|
|
45
|
+
interface ControlsProps extends TagProps<"div"> {
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Every {@link Button.Props} field, with `commandfor` required and `command`
|
|
49
|
+
* narrowed to the verb the paired mixin listens for.
|
|
50
|
+
*/
|
|
51
|
+
interface PreviousProps extends Omit<Button.Props, "commandfor" | "command"> {
|
|
52
|
+
/** `id` of the {@link Carousel.Viewport} this control scrolls back through. */
|
|
53
|
+
commandfor: string;
|
|
54
|
+
/** Invoker Commands verb a `carouselControls()` mixin listens for. Defaults to `"--ui-prev"`. */
|
|
55
|
+
command?: "--ui-prev";
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Every {@link Button.Props} field, with `commandfor` required and `command`
|
|
59
|
+
* narrowed to the verb the paired mixin listens for.
|
|
60
|
+
*/
|
|
61
|
+
interface NextProps extends Omit<Button.Props, "commandfor" | "command"> {
|
|
62
|
+
/** `id` of the {@link Carousel.Viewport} this control scrolls forward through. */
|
|
63
|
+
commandfor: string;
|
|
64
|
+
/** Invoker Commands verb a `carouselControls()` mixin listens for. Defaults to `"--ui-next"`. */
|
|
65
|
+
command?: "--ui-next";
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* The carousel root: a `<section>` stacking {@link Carousel.Viewport} and
|
|
70
|
+
* {@link Carousel.Controls} in a column, declaring the `--ui-carousel-*`
|
|
71
|
+
* custom properties its descendants read with per-instance defaults.
|
|
72
|
+
*
|
|
73
|
+
* @param handle Runtime handle carrying the host `<section>`'s props.
|
|
74
|
+
* @returns The render function producing the carousel's markup.
|
|
75
|
+
* @example
|
|
76
|
+
* <Carousel aria-label={t("gallery.label")}>
|
|
77
|
+
* <Carousel.Viewport id="gallery-viewport">
|
|
78
|
+
* <Carousel.Track>
|
|
79
|
+
* <Carousel.Slide><img src={photo.src} alt={photo.alt} /></Carousel.Slide>
|
|
80
|
+
* </Carousel.Track>
|
|
81
|
+
* </Carousel.Viewport>
|
|
82
|
+
* <Carousel.Controls>
|
|
83
|
+
* <Carousel.Previous commandfor="gallery-viewport" aria-label={t("gallery.previous")} />
|
|
84
|
+
* <Carousel.Next commandfor="gallery-viewport" aria-label={t("gallery.next")} />
|
|
85
|
+
* </Carousel.Controls>
|
|
86
|
+
* </Carousel>
|
|
87
|
+
*/
|
|
88
|
+
export declare function Carousel(handle: Handle<Carousel.Props>): () => import("remix/ui").RemixElement;
|
|
89
|
+
export declare namespace Carousel {
|
|
90
|
+
var Viewport: (handle: Handle<Carousel.ViewportProps>) => () => import("remix/ui").RemixElement;
|
|
91
|
+
var Track: (handle: Handle<Carousel.TrackProps>) => () => import("remix/ui").RemixElement;
|
|
92
|
+
var Slide: (handle: Handle<Carousel.SlideProps>) => () => import("remix/ui").RemixElement;
|
|
93
|
+
var Controls: (handle: Handle<Carousel.ControlsProps>) => () => import("remix/ui").RemixElement;
|
|
94
|
+
var Previous: (handle: Handle<Carousel.PreviousProps>) => () => import("remix/ui").RemixElement;
|
|
95
|
+
var Next: (handle: Handle<Carousel.NextProps>) => () => import("remix/ui").RemixElement;
|
|
96
|
+
}
|