@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,214 @@
|
|
|
1
|
+
import { jsx as _jsx } from "remix/ui/jsx-runtime";
|
|
2
|
+
import { ChevronLeftIcon, ChevronRightIcon } from "@sdxc/icons";
|
|
3
|
+
import { outline } from "@sdxc/u/color";
|
|
4
|
+
import { raw, vars } from "@sdxc/u/general";
|
|
5
|
+
import { flex, flexCol, gap, grow, items, justify, shrink } from "@sdxc/u/layout";
|
|
6
|
+
import { media } from "@sdxc/u/responsive";
|
|
7
|
+
import { bs, is, minIs, pi } from "@sdxc/u/size";
|
|
8
|
+
import { when } from "@sdxc/u/state";
|
|
9
|
+
import { attrs } from "remix/ui";
|
|
10
|
+
import { Button } from "./button.js";
|
|
11
|
+
/** Native ARIA role applied to {@link Carousel.Viewport} unless a consumer overrides it. */
|
|
12
|
+
const DEFAULT_VIEWPORT_ROLE = "group";
|
|
13
|
+
/**
|
|
14
|
+
* Native tab-stop index applied to {@link Carousel.Viewport} unless a consumer
|
|
15
|
+
* overrides it, so the scrollable region is reachable by keyboard even before
|
|
16
|
+
* any control is wired up.
|
|
17
|
+
*/
|
|
18
|
+
const DEFAULT_VIEWPORT_TAB_INDEX = 0;
|
|
19
|
+
/** Native ARIA role applied to {@link Carousel.Slide} unless a consumer overrides it. */
|
|
20
|
+
const DEFAULT_SLIDE_ROLE = "group";
|
|
21
|
+
/**
|
|
22
|
+
* Visual weight {@link Carousel.Previous} and {@link Carousel.Next} fall back
|
|
23
|
+
* to when `variant` is omitted.
|
|
24
|
+
*/
|
|
25
|
+
const DEFAULT_CONTROL_VARIANT = "ghost";
|
|
26
|
+
/**
|
|
27
|
+
* Semantic color role {@link Carousel.Previous} and {@link Carousel.Next} fall
|
|
28
|
+
* back to when `color` is omitted.
|
|
29
|
+
*/
|
|
30
|
+
const DEFAULT_CONTROL_COLOR = "neutral";
|
|
31
|
+
/**
|
|
32
|
+
* Size variant {@link Carousel.Previous} and {@link Carousel.Next} fall back to
|
|
33
|
+
* when `size` is omitted.
|
|
34
|
+
*/
|
|
35
|
+
const DEFAULT_CONTROL_SIZE = "sm";
|
|
36
|
+
/** Invoker Commands verb {@link Carousel.Previous} falls back to when `command` is omitted. */
|
|
37
|
+
const DEFAULT_PREVIOUS_COMMAND = "--ui-prev";
|
|
38
|
+
/** Invoker Commands verb {@link Carousel.Next} falls back to when `command` is omitted. */
|
|
39
|
+
const DEFAULT_NEXT_COMMAND = "--ui-next";
|
|
40
|
+
/**
|
|
41
|
+
* The carousel root: a `<section>` stacking {@link Carousel.Viewport} and
|
|
42
|
+
* {@link Carousel.Controls} in a column, declaring the `--ui-carousel-*`
|
|
43
|
+
* custom properties its descendants read with per-instance defaults.
|
|
44
|
+
*
|
|
45
|
+
* @param handle Runtime handle carrying the host `<section>`'s props.
|
|
46
|
+
* @returns The render function producing the carousel's markup.
|
|
47
|
+
* @example
|
|
48
|
+
* <Carousel aria-label={t("gallery.label")}>
|
|
49
|
+
* <Carousel.Viewport id="gallery-viewport">
|
|
50
|
+
* <Carousel.Track>
|
|
51
|
+
* <Carousel.Slide><img src={photo.src} alt={photo.alt} /></Carousel.Slide>
|
|
52
|
+
* </Carousel.Track>
|
|
53
|
+
* </Carousel.Viewport>
|
|
54
|
+
* <Carousel.Controls>
|
|
55
|
+
* <Carousel.Previous commandfor="gallery-viewport" aria-label={t("gallery.previous")} />
|
|
56
|
+
* <Carousel.Next commandfor="gallery-viewport" aria-label={t("gallery.next")} />
|
|
57
|
+
* </Carousel.Controls>
|
|
58
|
+
* </Carousel>
|
|
59
|
+
*/
|
|
60
|
+
export function Carousel(handle) {
|
|
61
|
+
return () => {
|
|
62
|
+
let { mix, ...rest } = handle.props;
|
|
63
|
+
return (_jsx("section", { ...rest, "data-slot": "carousel", mix: [
|
|
64
|
+
flex(),
|
|
65
|
+
flexCol(),
|
|
66
|
+
gap(3),
|
|
67
|
+
vars({
|
|
68
|
+
"ui-carousel-gap": "1rem",
|
|
69
|
+
"ui-carousel-slide-size": "18rem",
|
|
70
|
+
"ui-carousel-padding": "0px",
|
|
71
|
+
}),
|
|
72
|
+
mix,
|
|
73
|
+
] }));
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* A `<div>` scrolling {@link Carousel.Track} along the inline axis via logical
|
|
78
|
+
* properties for correct writing direction, with mandatory scroll-snap stops;
|
|
79
|
+
* scroll padding reads `--ui-carousel-padding` to clear the track's own padding.
|
|
80
|
+
*
|
|
81
|
+
* @param handle Runtime handle carrying the host `<div>`'s props.
|
|
82
|
+
* @returns The render function producing the viewport's markup.
|
|
83
|
+
* @example
|
|
84
|
+
* <Carousel.Viewport id="gallery-viewport">
|
|
85
|
+
* <Carousel.Track>{slides}</Carousel.Track>
|
|
86
|
+
* </Carousel.Viewport>
|
|
87
|
+
*/
|
|
88
|
+
Carousel.Viewport = function CarouselViewport(handle) {
|
|
89
|
+
return () => {
|
|
90
|
+
let { mix, ...rest } = handle.props;
|
|
91
|
+
return (_jsx("div", { ...rest, "data-slot": "viewport", mix: [
|
|
92
|
+
attrs({ role: DEFAULT_VIEWPORT_ROLE, tabIndex: DEFAULT_VIEWPORT_TAB_INDEX }),
|
|
93
|
+
when("&:focus-visible", outline({ color: "brand.ring", offset: 2 })),
|
|
94
|
+
raw({
|
|
95
|
+
overflowInline: "auto",
|
|
96
|
+
overflowBlock: "hidden",
|
|
97
|
+
scrollBehavior: "smooth",
|
|
98
|
+
scrollSnapType: "inline mandatory",
|
|
99
|
+
scrollPaddingInline: "var(--ui-carousel-padding, 0px)",
|
|
100
|
+
"-webkit-overflow-scrolling": "touch",
|
|
101
|
+
}),
|
|
102
|
+
media("(prefers-reduced-motion: reduce)", raw({ scrollBehavior: "auto" })),
|
|
103
|
+
mix,
|
|
104
|
+
] }));
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* The carousel's slide row: a `<div>` laying its {@link Carousel.Slide}
|
|
109
|
+
* children out in one inline row, gapped by `--ui-carousel-gap` and padded by
|
|
110
|
+
* `--ui-carousel-padding` so the first and last slide can still center.
|
|
111
|
+
*
|
|
112
|
+
* @param handle Runtime handle carrying the host `<div>`'s props.
|
|
113
|
+
* @returns The render function producing the track's markup.
|
|
114
|
+
* @example
|
|
115
|
+
* <Carousel.Track>
|
|
116
|
+
* <Carousel.Slide>{firstSlide}</Carousel.Slide>
|
|
117
|
+
* <Carousel.Slide>{secondSlide}</Carousel.Slide>
|
|
118
|
+
* </Carousel.Track>
|
|
119
|
+
*/
|
|
120
|
+
Carousel.Track = function CarouselTrack(handle) {
|
|
121
|
+
return () => {
|
|
122
|
+
let { mix, ...rest } = handle.props;
|
|
123
|
+
return (_jsx("div", { ...rest, "data-slot": "track", mix: [
|
|
124
|
+
flex(),
|
|
125
|
+
gap("var(--ui-carousel-gap, 1rem)"),
|
|
126
|
+
pi("var(--ui-carousel-padding, 0px)"),
|
|
127
|
+
mix,
|
|
128
|
+
] }));
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
/**
|
|
132
|
+
* A single slide: a `<div>` held at `--ui-carousel-slide-size` along the
|
|
133
|
+
* inline axis, with a mandatory snap stop at its inline-start edge so the
|
|
134
|
+
* viewport settles on a slide boundary.
|
|
135
|
+
*
|
|
136
|
+
* @param handle Runtime handle carrying the host `<div>`'s props.
|
|
137
|
+
* @returns The render function producing the slide's markup.
|
|
138
|
+
* @example
|
|
139
|
+
* <Carousel.Slide><img src={photo.src} alt={photo.alt} /></Carousel.Slide>
|
|
140
|
+
*/
|
|
141
|
+
Carousel.Slide = function CarouselSlide(handle) {
|
|
142
|
+
return () => {
|
|
143
|
+
let { mix, ...rest } = handle.props;
|
|
144
|
+
return (_jsx("div", { ...rest, "data-slot": "slide", mix: [
|
|
145
|
+
attrs({ role: DEFAULT_SLIDE_ROLE }),
|
|
146
|
+
grow(0),
|
|
147
|
+
shrink(0),
|
|
148
|
+
raw({
|
|
149
|
+
flexBasis: "var(--ui-carousel-slide-size, 18rem)",
|
|
150
|
+
scrollSnapAlign: "start",
|
|
151
|
+
scrollSnapStop: "always",
|
|
152
|
+
}),
|
|
153
|
+
mix,
|
|
154
|
+
] }));
|
|
155
|
+
};
|
|
156
|
+
};
|
|
157
|
+
/**
|
|
158
|
+
* The carousel's control row: a `<div>` laying {@link Carousel.Previous} and
|
|
159
|
+
* {@link Carousel.Next} out as an end-aligned, vertically centered row.
|
|
160
|
+
*
|
|
161
|
+
* @param handle Runtime handle carrying the host `<div>`'s props.
|
|
162
|
+
* @returns The render function producing the control row's markup.
|
|
163
|
+
* @example
|
|
164
|
+
* <Carousel.Controls>
|
|
165
|
+
* <Carousel.Previous commandfor="gallery-viewport" aria-label={t("gallery.previous")} />
|
|
166
|
+
* <Carousel.Next commandfor="gallery-viewport" aria-label={t("gallery.next")} />
|
|
167
|
+
* </Carousel.Controls>
|
|
168
|
+
*/
|
|
169
|
+
Carousel.Controls = function CarouselControls(handle) {
|
|
170
|
+
return () => {
|
|
171
|
+
let { mix, ...rest } = handle.props;
|
|
172
|
+
return (_jsx("div", { ...rest, "data-slot": "controls", mix: [flex(), items("center"), gap(2), justify("end"), mix] }));
|
|
173
|
+
};
|
|
174
|
+
};
|
|
175
|
+
/**
|
|
176
|
+
* A static control scrolling {@link Carousel.Viewport} named by `commandfor` back
|
|
177
|
+
* one slide when a hydrated `carouselControls()` mixin handles `"--ui-prev"`; custom
|
|
178
|
+
* `children` replacing the chevron still need their own `aria-label`.
|
|
179
|
+
*
|
|
180
|
+
* @param handle Runtime handle carrying the host button's props.
|
|
181
|
+
* @returns The render function producing the control's markup.
|
|
182
|
+
* @example
|
|
183
|
+
* <Carousel.Previous commandfor="gallery-viewport" aria-label={t("gallery.previous")} />
|
|
184
|
+
*/
|
|
185
|
+
Carousel.Previous = function CarouselPrevious(handle) {
|
|
186
|
+
return () => {
|
|
187
|
+
let { variant, color, size, command, children, mix, ...rest } = handle.props;
|
|
188
|
+
let resolvedVariant = variant ?? DEFAULT_CONTROL_VARIANT;
|
|
189
|
+
let resolvedColor = color ?? DEFAULT_CONTROL_COLOR;
|
|
190
|
+
let resolvedSize = size ?? DEFAULT_CONTROL_SIZE;
|
|
191
|
+
let resolvedCommand = command ?? DEFAULT_PREVIOUS_COMMAND;
|
|
192
|
+
return (_jsx(Button, { ...rest, type: "button", variant: resolvedVariant, color: resolvedColor, size: resolvedSize, command: resolvedCommand, "data-slot": "previous", mix: [minIs(0), when("& > svg", [is(4), bs(4)]), mix], children: children ?? _jsx(ChevronLeftIcon, {}) }));
|
|
193
|
+
};
|
|
194
|
+
};
|
|
195
|
+
/**
|
|
196
|
+
* A static control scrolling {@link Carousel.Viewport} named by `commandfor` forward
|
|
197
|
+
* one slide when a hydrated `carouselControls()` mixin handles `"--ui-next"`; custom
|
|
198
|
+
* `children` replacing the chevron still need their own `aria-label`.
|
|
199
|
+
*
|
|
200
|
+
* @param handle Runtime handle carrying the host button's props.
|
|
201
|
+
* @returns The render function producing the control's markup.
|
|
202
|
+
* @example
|
|
203
|
+
* <Carousel.Next commandfor="gallery-viewport" aria-label={t("gallery.next")} />
|
|
204
|
+
*/
|
|
205
|
+
Carousel.Next = function CarouselNext(handle) {
|
|
206
|
+
return () => {
|
|
207
|
+
let { variant, color, size, command, children, mix, ...rest } = handle.props;
|
|
208
|
+
let resolvedVariant = variant ?? DEFAULT_CONTROL_VARIANT;
|
|
209
|
+
let resolvedColor = color ?? DEFAULT_CONTROL_COLOR;
|
|
210
|
+
let resolvedSize = size ?? DEFAULT_CONTROL_SIZE;
|
|
211
|
+
let resolvedCommand = command ?? DEFAULT_NEXT_COMMAND;
|
|
212
|
+
return (_jsx(Button, { ...rest, type: "button", variant: resolvedVariant, color: resolvedColor, size: resolvedSize, command: resolvedCommand, "data-slot": "next", mix: [minIs(0), when("& > svg", [is(4), bs(4)]), mix], children: children ?? _jsx(ChevronRightIcon, {}) }));
|
|
213
|
+
};
|
|
214
|
+
};
|