@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,162 @@
|
|
|
1
|
+
import { jsx as _jsx } from "remix/ui/jsx-runtime";
|
|
2
|
+
import { rounded, transition, transitionBehavior, transitionProperty } from "@sdxc/u/effects";
|
|
3
|
+
import { willChange } from "@sdxc/u/general";
|
|
4
|
+
import { fixed, insBe, insBs, insIe, insIs, insLeft, insRight } from "@sdxc/u/layout";
|
|
5
|
+
import { media, startingStyle } from "@sdxc/u/responsive";
|
|
6
|
+
import { bs, is, m, maxBs, maxIs } from "@sdxc/u/size";
|
|
7
|
+
import { data, when } from "@sdxc/u/state";
|
|
8
|
+
import { translateX, translateY } from "@sdxc/u/transform";
|
|
9
|
+
import { durations, easings } from "../animations/tokens.js";
|
|
10
|
+
import { Dialog } from "./dialog.js";
|
|
11
|
+
/**
|
|
12
|
+
* Physical edge of the viewport {@link Drawer} docks against when
|
|
13
|
+
* `placement` is left unset.
|
|
14
|
+
*/
|
|
15
|
+
const DEFAULT_PLACEMENT = "bottom";
|
|
16
|
+
/**
|
|
17
|
+
* Renders {@link Dialog} pinned to one edge of the viewport, animating a
|
|
18
|
+
* `transform` off the native `open` attribute so `@starting-style` can
|
|
19
|
+
* animate the close; a `mix` prop composes alongside this placement styling.
|
|
20
|
+
*
|
|
21
|
+
* @param handle Runtime handle carrying the host `<dialog>`'s props, plus `placement`.
|
|
22
|
+
* @returns The render function producing the docked panel's markup.
|
|
23
|
+
* @example
|
|
24
|
+
* <Button commandfor="cart" command="show-modal">{t("cart.open")}</Button>
|
|
25
|
+
* <Drawer id="cart" placement="right" aria-labelledby="cart-title">
|
|
26
|
+
* <Drawer.Header>
|
|
27
|
+
* <Drawer.Title id="cart-title">{t("cart.title")}</Drawer.Title>
|
|
28
|
+
* </Drawer.Header>
|
|
29
|
+
* <Drawer.Close commandfor="cart" aria-label={t("actions.close")} />
|
|
30
|
+
* </Drawer>
|
|
31
|
+
* @example
|
|
32
|
+
* <Drawer id="filters" placement="bottom" aria-labelledby="filters-title">
|
|
33
|
+
* <Drawer.Header>
|
|
34
|
+
* <Drawer.Title id="filters-title">{t("filters.title")}</Drawer.Title>
|
|
35
|
+
* </Drawer.Header>
|
|
36
|
+
* <Drawer.Footer>
|
|
37
|
+
* <Button commandfor="filters" command="close">{t("actions.apply")}</Button>
|
|
38
|
+
* </Drawer.Footer>
|
|
39
|
+
* </Drawer>
|
|
40
|
+
*/
|
|
41
|
+
export function Drawer(handle) {
|
|
42
|
+
return () => {
|
|
43
|
+
let { placement, mix, ...rest } = handle.props;
|
|
44
|
+
let resolvedPlacement = placement ?? DEFAULT_PLACEMENT;
|
|
45
|
+
return (_jsx(Dialog, { ...rest, "data-placement": resolvedPlacement, mix: [
|
|
46
|
+
fixed(),
|
|
47
|
+
m(0),
|
|
48
|
+
rounded("none"),
|
|
49
|
+
transition("transform, display, overlay", {
|
|
50
|
+
duration: `${durations.slow}ms`,
|
|
51
|
+
easing: easings.decelerate,
|
|
52
|
+
}),
|
|
53
|
+
willChange("transform"),
|
|
54
|
+
transitionBehavior("allow-discrete"),
|
|
55
|
+
data("placement", "top", [
|
|
56
|
+
insBs("0"),
|
|
57
|
+
insIs("0"),
|
|
58
|
+
insIe("0"),
|
|
59
|
+
bs("24rem"),
|
|
60
|
+
maxBs("90vh"),
|
|
61
|
+
is("full"),
|
|
62
|
+
maxIs("none"),
|
|
63
|
+
translateY("-100%"),
|
|
64
|
+
when("&[open]", translateY(0)),
|
|
65
|
+
]),
|
|
66
|
+
data("placement", "bottom", [
|
|
67
|
+
insBe("0"),
|
|
68
|
+
insIs("0"),
|
|
69
|
+
insIe("0"),
|
|
70
|
+
bs("24rem"),
|
|
71
|
+
maxBs("90vh"),
|
|
72
|
+
is("full"),
|
|
73
|
+
maxIs("none"),
|
|
74
|
+
translateY("100%"),
|
|
75
|
+
when("&[open]", translateY(0)),
|
|
76
|
+
]),
|
|
77
|
+
data("placement", "left", [
|
|
78
|
+
insBs("0"),
|
|
79
|
+
insBe("0"),
|
|
80
|
+
insLeft("0"),
|
|
81
|
+
is("22rem"),
|
|
82
|
+
maxIs("90vw"),
|
|
83
|
+
maxBs("none"),
|
|
84
|
+
translateX("-100%"),
|
|
85
|
+
when("&[open]", translateX(0)),
|
|
86
|
+
]),
|
|
87
|
+
data("placement", "right", [
|
|
88
|
+
insBs("0"),
|
|
89
|
+
insBe("0"),
|
|
90
|
+
insRight("0"),
|
|
91
|
+
is("22rem"),
|
|
92
|
+
maxIs("90vw"),
|
|
93
|
+
maxBs("none"),
|
|
94
|
+
translateX("100%"),
|
|
95
|
+
when("&[open]", translateX(0)),
|
|
96
|
+
]),
|
|
97
|
+
startingStyle([
|
|
98
|
+
when('&[data-placement="top"][open]', translateY("-100%")),
|
|
99
|
+
when('&[data-placement="bottom"][open]', translateY("100%")),
|
|
100
|
+
when('&[data-placement="left"][open]', translateX("-100%")),
|
|
101
|
+
when('&[data-placement="right"][open]', translateX("100%")),
|
|
102
|
+
]),
|
|
103
|
+
media("(prefers-reduced-motion: reduce)", transitionProperty("none")),
|
|
104
|
+
mix,
|
|
105
|
+
] }));
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Renders {@link Drawer.HeaderProps.children} as the panel's header slot,
|
|
110
|
+
* routed straight through to {@link Dialog.Header}'s markup.
|
|
111
|
+
*
|
|
112
|
+
* @param handle Runtime handle carrying the host `<div>`'s props.
|
|
113
|
+
* @returns The render function producing the header slot's markup.
|
|
114
|
+
* @example
|
|
115
|
+
* <Drawer.Header>
|
|
116
|
+
* <Drawer.Title>{t("cart.title")}</Drawer.Title>
|
|
117
|
+
* </Drawer.Header>
|
|
118
|
+
*/
|
|
119
|
+
Drawer.Header = Dialog.Header;
|
|
120
|
+
/**
|
|
121
|
+
* Renders {@link Drawer.TitleProps.children} as the panel's heading:
|
|
122
|
+
* identical to {@link Dialog.Title}.
|
|
123
|
+
*
|
|
124
|
+
* @param handle Runtime handle carrying the host `<h2>`'s props.
|
|
125
|
+
* @returns The render function producing the heading's markup.
|
|
126
|
+
* @example
|
|
127
|
+
* <Drawer.Title>{t("cart.title")}</Drawer.Title>
|
|
128
|
+
*/
|
|
129
|
+
Drawer.Title = Dialog.Title;
|
|
130
|
+
/**
|
|
131
|
+
* Renders {@link Drawer.DescriptionProps.children} as the panel's supporting
|
|
132
|
+
* copy: identical to {@link Dialog.Description}.
|
|
133
|
+
*
|
|
134
|
+
* @param handle Runtime handle carrying the host `<p>`'s props.
|
|
135
|
+
* @returns The render function producing the description's markup.
|
|
136
|
+
* @example
|
|
137
|
+
* <Drawer.Description>{t("cart.description")}</Drawer.Description>
|
|
138
|
+
*/
|
|
139
|
+
Drawer.Description = Dialog.Description;
|
|
140
|
+
/**
|
|
141
|
+
* Renders {@link Drawer.FooterProps.children} as the panel's action row:
|
|
142
|
+
* identical to {@link Dialog.Footer}.
|
|
143
|
+
*
|
|
144
|
+
* @param handle Runtime handle carrying the host `<div>`'s props.
|
|
145
|
+
* @returns The render function producing the action row's markup.
|
|
146
|
+
* @example
|
|
147
|
+
* <Drawer.Footer>
|
|
148
|
+
* <Button commandfor="cart" command="close" variant="outline">{t("actions.cancel")}</Button>
|
|
149
|
+
* <Button commandfor="cart" command="close">{t("actions.checkout")}</Button>
|
|
150
|
+
* </Drawer.Footer>
|
|
151
|
+
*/
|
|
152
|
+
Drawer.Footer = Dialog.Footer;
|
|
153
|
+
/**
|
|
154
|
+
* Renders a dismiss control for the ancestor {@link Drawer} named by
|
|
155
|
+
* `commandfor`: identical to {@link Dialog.Close}.
|
|
156
|
+
*
|
|
157
|
+
* @param handle Runtime handle carrying the host button's props.
|
|
158
|
+
* @returns The render function producing the dismiss control's markup.
|
|
159
|
+
* @example
|
|
160
|
+
* <Drawer.Close commandfor="cart" aria-label={t("actions.close")} />
|
|
161
|
+
*/
|
|
162
|
+
Drawer.Close = Dialog.Close;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A thin bar rendered in the gap between two items of a reorderable list,
|
|
3
|
+
* marking where a dragged item will land. It sits in a muted ring tone at
|
|
4
|
+
* rest and switches to the primary solid color once it becomes the
|
|
5
|
+
* pointer's current drop target, with the surrounding list's own reorder
|
|
6
|
+
* interaction deciding when it appears and which gap it marks.
|
|
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 DropIndicator}.
|
|
14
|
+
*/
|
|
15
|
+
export declare namespace DropIndicator {
|
|
16
|
+
/**
|
|
17
|
+
* Props accepted by {@link DropIndicator}.
|
|
18
|
+
*/
|
|
19
|
+
interface Props extends TagProps<"div"> {
|
|
20
|
+
/**
|
|
21
|
+
* Whether this bar marks the pointer's current drop target. Renders
|
|
22
|
+
* the host's `data-drop-target` attribute when `true`, switching the
|
|
23
|
+
* bar to its active color. Defaults to {@link DEFAULT_IS_DROP_TARGET}.
|
|
24
|
+
*/
|
|
25
|
+
isDropTarget?: boolean;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Renders a full-width, hairline-thick, fully rounded bar shaped for the gap
|
|
30
|
+
* between two items in a reorderable list. Its color follows the host's
|
|
31
|
+
* `data-drop-target` attribute: muted at rest, solid as the active target.
|
|
32
|
+
*
|
|
33
|
+
* @param handle Runtime handle carrying the host `<div>`'s props.
|
|
34
|
+
* @returns The render function producing the bar's markup.
|
|
35
|
+
* @example
|
|
36
|
+
* <DropIndicator isDropTarget={dropTargetKey === item.id} />
|
|
37
|
+
* @example
|
|
38
|
+
* <DropIndicator
|
|
39
|
+
* isDropTarget={isCurrentTarget}
|
|
40
|
+
* mix={css({ position: "absolute", insetInline: "0", insetBlockStart: "-1px" })}
|
|
41
|
+
* />
|
|
42
|
+
*/
|
|
43
|
+
export declare function DropIndicator(handle: Handle<DropIndicator.Props>): () => import("remix/ui").RemixElement;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { jsx as _jsx } from "remix/ui/jsx-runtime";
|
|
2
|
+
import { bg } from "@sdxc/u/color";
|
|
3
|
+
import { rounded } from "@sdxc/u/effects";
|
|
4
|
+
import { bs, is } from "@sdxc/u/size";
|
|
5
|
+
import { when } from "@sdxc/u/state";
|
|
6
|
+
import { attrs } from "remix/ui";
|
|
7
|
+
/**
|
|
8
|
+
* Default {@link DropIndicator.Props.isDropTarget}, rendering the bar in
|
|
9
|
+
* its muted resting tone until a consumer marks it as the active target.
|
|
10
|
+
*/
|
|
11
|
+
const DEFAULT_IS_DROP_TARGET = false;
|
|
12
|
+
/**
|
|
13
|
+
* Default `aria-hidden` value applied through {@link attrs} unless a
|
|
14
|
+
* consumer overrides it. Assistive technology already hears the drop
|
|
15
|
+
* position through the reorder interaction's own live region.
|
|
16
|
+
*/
|
|
17
|
+
const DEFAULT_ARIA_HIDDEN = "true";
|
|
18
|
+
/**
|
|
19
|
+
* Renders a full-width, hairline-thick, fully rounded bar shaped for the gap
|
|
20
|
+
* between two items in a reorderable list. Its color follows the host's
|
|
21
|
+
* `data-drop-target` attribute: muted at rest, solid as the active target.
|
|
22
|
+
*
|
|
23
|
+
* @param handle Runtime handle carrying the host `<div>`'s props.
|
|
24
|
+
* @returns The render function producing the bar's markup.
|
|
25
|
+
* @example
|
|
26
|
+
* <DropIndicator isDropTarget={dropTargetKey === item.id} />
|
|
27
|
+
* @example
|
|
28
|
+
* <DropIndicator
|
|
29
|
+
* isDropTarget={isCurrentTarget}
|
|
30
|
+
* mix={css({ position: "absolute", insetInline: "0", insetBlockStart: "-1px" })}
|
|
31
|
+
* />
|
|
32
|
+
*/
|
|
33
|
+
export function DropIndicator(handle) {
|
|
34
|
+
return () => {
|
|
35
|
+
let { isDropTarget, mix, ...rest } = handle.props;
|
|
36
|
+
let resolvedIsDropTarget = isDropTarget ?? DEFAULT_IS_DROP_TARGET;
|
|
37
|
+
return (_jsx("div", { ...rest, "data-drop-target": resolvedIsDropTarget ? "" : undefined, mix: [
|
|
38
|
+
attrs({ "aria-hidden": DEFAULT_ARIA_HIDDEN }),
|
|
39
|
+
is("full"),
|
|
40
|
+
bs("0.125rem"),
|
|
41
|
+
rounded("full"),
|
|
42
|
+
bg("brand.ring"),
|
|
43
|
+
when("&[data-drop-target]", bg("brand.solid")),
|
|
44
|
+
mix,
|
|
45
|
+
] }));
|
|
46
|
+
};
|
|
47
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A styled drop target for files: a dashed, centered surface wrapping a
|
|
3
|
+
* native `<input type="file">`, so picking a file through the platform's own
|
|
4
|
+
* file picker works the moment the markup renders, with no script involved.
|
|
5
|
+
* Its decorative content — an icon, an instructional caption, or both —
|
|
6
|
+
* renders inside the same `<label>` that wraps the input, giving the input
|
|
7
|
+
* its accessible name through the platform's own label association.
|
|
8
|
+
*
|
|
9
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
10
|
+
* @copyright Sergio Xalambrí 2026
|
|
11
|
+
*/
|
|
12
|
+
import type { Handle, Props as TagProps, RemixNode } from "remix/ui";
|
|
13
|
+
/**
|
|
14
|
+
* Prop types for {@link DropZone}.
|
|
15
|
+
*/
|
|
16
|
+
export declare namespace DropZone {
|
|
17
|
+
/**
|
|
18
|
+
* Per-part styling for the elements this component composes besides its
|
|
19
|
+
* own host `<label>`.
|
|
20
|
+
*/
|
|
21
|
+
interface PartsProps {
|
|
22
|
+
/** Styling for the native `<input type="file">` nested inside the zone. */
|
|
23
|
+
input?: TagProps<"input">["mix"];
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Props accepted by {@link DropZone}. `mix` styles the outer `<label>` —
|
|
27
|
+
* the visible drop surface a hydrated drag-and-drop mixin attaches to —
|
|
28
|
+
* while `parts.input` styles the nested file input.
|
|
29
|
+
*/
|
|
30
|
+
interface Props extends TagProps<"label"> {
|
|
31
|
+
/** Native `name` submitted with an enclosing form. */
|
|
32
|
+
name?: string;
|
|
33
|
+
/** Comma-separated list of accepted MIME types or file extensions. */
|
|
34
|
+
accept?: string;
|
|
35
|
+
/** Whether more than one file may be chosen at once. */
|
|
36
|
+
multiple?: boolean;
|
|
37
|
+
/** Requests a specific camera where a mobile browser's picker offers one. */
|
|
38
|
+
capture?: TagProps<"input">["capture"];
|
|
39
|
+
/** Marks the control required for its enclosing form. */
|
|
40
|
+
required?: boolean;
|
|
41
|
+
/** Marks the control inert and excluded from the tab order. */
|
|
42
|
+
disabled?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* The zone's visible content — an icon, an instructional caption, or both —
|
|
45
|
+
* rendered inside the `<label>` that wraps the file input, so clicking it
|
|
46
|
+
* opens the picker and names the input via label association.
|
|
47
|
+
*/
|
|
48
|
+
children?: RemixNode;
|
|
49
|
+
/** Per-part styling for this component's internally composed input. */
|
|
50
|
+
parts?: PartsProps;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Renders a native `<input type="file">` wrapped in a `<label>` styled as a
|
|
55
|
+
* dashed, centered drop surface; a paired drag-and-drop mixin toggles the
|
|
56
|
+
* `data-drop-target` attribute this surface's styling reacts to.
|
|
57
|
+
*
|
|
58
|
+
* @param handle Runtime handle carrying the host `<label>`'s props.
|
|
59
|
+
* @returns The render function producing the drop zone's markup.
|
|
60
|
+
* @example
|
|
61
|
+
* <DropZone name="attachments" multiple>
|
|
62
|
+
* {t("uploads.dropInstructions")}
|
|
63
|
+
* </DropZone>
|
|
64
|
+
* @example
|
|
65
|
+
* <DropZone name="avatar" accept="image/png, image/jpeg" aria-label={t("profile.chooseAvatar")}>
|
|
66
|
+
* <ImageIcon aria-hidden />
|
|
67
|
+
* </DropZone>
|
|
68
|
+
* @example
|
|
69
|
+
* <DropZone name="documents" multiple accept="application/pdf" required>
|
|
70
|
+
* <p>{t("uploads.dropHint")}</p>
|
|
71
|
+
* </DropZone>
|
|
72
|
+
*/
|
|
73
|
+
export declare function DropZone(handle: Handle<DropZone.Props>): () => import("remix/ui").RemixElement;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "remix/ui/jsx-runtime";
|
|
2
|
+
import { bg, border, fg, outline } from "@sdxc/u/color";
|
|
3
|
+
import { rounded } from "@sdxc/u/effects";
|
|
4
|
+
import { flex, flexCol, gap, items, justify } from "@sdxc/u/layout";
|
|
5
|
+
import { minBs, pb, pi } from "@sdxc/u/size";
|
|
6
|
+
import { when } from "@sdxc/u/state";
|
|
7
|
+
import { textAlign } from "@sdxc/u/typography";
|
|
8
|
+
import { interactiveTransition } from "../styles/interactive-transition.js";
|
|
9
|
+
import { warnIfNoAccessibleName } from "../utils/warn-if-no-accessible-name.js";
|
|
10
|
+
/**
|
|
11
|
+
* Renders a native `<input type="file">` wrapped in a `<label>` styled as a
|
|
12
|
+
* dashed, centered drop surface; a paired drag-and-drop mixin toggles the
|
|
13
|
+
* `data-drop-target` attribute this surface's styling reacts to.
|
|
14
|
+
*
|
|
15
|
+
* @param handle Runtime handle carrying the host `<label>`'s props.
|
|
16
|
+
* @returns The render function producing the drop zone's markup.
|
|
17
|
+
* @example
|
|
18
|
+
* <DropZone name="attachments" multiple>
|
|
19
|
+
* {t("uploads.dropInstructions")}
|
|
20
|
+
* </DropZone>
|
|
21
|
+
* @example
|
|
22
|
+
* <DropZone name="avatar" accept="image/png, image/jpeg" aria-label={t("profile.chooseAvatar")}>
|
|
23
|
+
* <ImageIcon aria-hidden />
|
|
24
|
+
* </DropZone>
|
|
25
|
+
* @example
|
|
26
|
+
* <DropZone name="documents" multiple accept="application/pdf" required>
|
|
27
|
+
* <p>{t("uploads.dropHint")}</p>
|
|
28
|
+
* </DropZone>
|
|
29
|
+
*/
|
|
30
|
+
export function DropZone(handle) {
|
|
31
|
+
return () => {
|
|
32
|
+
let { name, accept, multiple, capture, required, disabled, children, parts, mix, ...rest } = handle.props;
|
|
33
|
+
warnIfNoAccessibleName(handle.props, children, "DropZone: a zone with no visible instructional text needs an `aria-label` describing what it accepts — assistive technology has no accessible name to announce for its file input otherwise.");
|
|
34
|
+
return (_jsxs("label", { ...rest, "data-slot": "zone", mix: [
|
|
35
|
+
when("&:has(input:focus-visible)", outline({ color: "brand.ring", offset: 2 })),
|
|
36
|
+
flex(),
|
|
37
|
+
flexCol(),
|
|
38
|
+
items("center"),
|
|
39
|
+
justify("center"),
|
|
40
|
+
gap(2),
|
|
41
|
+
minBs("6rem"),
|
|
42
|
+
rounded("lg"),
|
|
43
|
+
border({ color: "neutral", width: "2px", style: "dashed" }),
|
|
44
|
+
pi(6),
|
|
45
|
+
pb(6),
|
|
46
|
+
textAlign("center"),
|
|
47
|
+
bg("neutral.tint"),
|
|
48
|
+
fg("neutral"),
|
|
49
|
+
when("&[data-drop-target]", [border("brand.ring"), bg("brand.tint")]),
|
|
50
|
+
interactiveTransition(),
|
|
51
|
+
mix,
|
|
52
|
+
], children: [children, _jsx("input", { type: "file", name: name, accept: accept, multiple: multiple, capture: capture, required: required, disabled: disabled, mix: parts?.input })] }));
|
|
53
|
+
};
|
|
54
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A placeholder for a section that currently has nothing to show — a
|
|
3
|
+
* dashed-bordered panel that composes an icon, a title, a description, and
|
|
4
|
+
* an action into one empty-state layout. The compound parts let a consumer
|
|
5
|
+
* include only the pieces a given empty state needs.
|
|
6
|
+
*
|
|
7
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
8
|
+
* @copyright Sergio Xalambrí 2026
|
|
9
|
+
*/
|
|
10
|
+
import type { Handle, Props as TagProps, RemixNode } from "remix/ui";
|
|
11
|
+
import type { SemanticColor } from "../utils/semantic-color.js";
|
|
12
|
+
/**
|
|
13
|
+
* Prop types for {@link Empty} and its compound parts.
|
|
14
|
+
*/
|
|
15
|
+
export declare namespace Empty {
|
|
16
|
+
/**
|
|
17
|
+
* Semantic tone driving the panel's border, tint, and foreground color
|
|
18
|
+
* through the `--ui-*` variables for that color. Every part below the
|
|
19
|
+
* root reads its own color from the inherited `currentcolor` this sets.
|
|
20
|
+
*/
|
|
21
|
+
type Color = SemanticColor;
|
|
22
|
+
/**
|
|
23
|
+
* Props accepted by {@link Empty}.
|
|
24
|
+
*/
|
|
25
|
+
interface Props extends TagProps<"div"> {
|
|
26
|
+
/** Semantic tone of the panel. Default: `"neutral"`. */
|
|
27
|
+
color?: Color;
|
|
28
|
+
/** The panel's compound parts: {@link Empty.Icon}, {@link Empty.Title}, {@link Empty.Description}, {@link Empty.Action}, or any other content. */
|
|
29
|
+
children: RemixNode;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Props accepted by {@link Empty.Icon}.
|
|
33
|
+
*/
|
|
34
|
+
interface IconProps extends TagProps<"div"> {
|
|
35
|
+
/** Icon graphic rendered inside the icon well. */
|
|
36
|
+
children: RemixNode;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Props accepted by {@link Empty.Title}. The rendered tag depends on the
|
|
40
|
+
* nearest ambient heading level, falling back to `<h1>` where nothing
|
|
41
|
+
* supplies one; every native heading-element attribute still applies.
|
|
42
|
+
*/
|
|
43
|
+
interface TitleProps extends TagProps<"h1"> {
|
|
44
|
+
/** Heading copy for the empty state. */
|
|
45
|
+
children: RemixNode;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Props accepted by {@link Empty.Description}.
|
|
49
|
+
*/
|
|
50
|
+
interface DescriptionProps extends TagProps<"p"> {
|
|
51
|
+
/** Supporting copy elaborating on the empty state. */
|
|
52
|
+
children: RemixNode;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Props accepted by {@link Empty.Action}.
|
|
56
|
+
*/
|
|
57
|
+
interface ActionProps extends TagProps<"div"> {
|
|
58
|
+
/** Call-to-action content, typically a button or link. */
|
|
59
|
+
children: RemixNode;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Renders the empty-state panel: a dashed-bordered column tinted to the
|
|
64
|
+
* color role in {@link Empty.Props.color}. Its compound parts inherit that
|
|
65
|
+
* color through `currentcolor`.
|
|
66
|
+
*
|
|
67
|
+
* @param handle Runtime handle carrying the host `<div>`'s props.
|
|
68
|
+
* @returns The render function producing the panel's markup.
|
|
69
|
+
* @example
|
|
70
|
+
* <Empty>
|
|
71
|
+
* <Empty.Icon><InboxIcon /></Empty.Icon>
|
|
72
|
+
* <Empty.Title>{t("inbox.empty.title")}</Empty.Title>
|
|
73
|
+
* <Empty.Description>{t("inbox.empty.description")}</Empty.Description>
|
|
74
|
+
* <Empty.Action>
|
|
75
|
+
* <Button>{t("inbox.empty.action")}</Button>
|
|
76
|
+
* </Empty.Action>
|
|
77
|
+
* </Empty>
|
|
78
|
+
* @example
|
|
79
|
+
* <Empty color="danger">
|
|
80
|
+
* <Empty.Title>{t("errors.notFound.title")}</Empty.Title>
|
|
81
|
+
* </Empty>
|
|
82
|
+
*/
|
|
83
|
+
export declare function Empty(handle: Handle<Empty.Props>): () => import("remix/ui").RemixElement;
|
|
84
|
+
export declare namespace Empty {
|
|
85
|
+
var Icon: (handle: Handle<Empty.IconProps>) => () => import("remix/ui").RemixElement;
|
|
86
|
+
var Title: (handle: Handle<Empty.TitleProps>) => () => import("remix/ui").RemixElement;
|
|
87
|
+
var Description: (handle: Handle<Empty.DescriptionProps>) => () => import("remix/ui").RemixElement;
|
|
88
|
+
var Action: (handle: Handle<Empty.ActionProps>) => () => import("remix/ui").RemixElement;
|
|
89
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { jsx as _jsx } from "remix/ui/jsx-runtime";
|
|
2
|
+
import { bg, border, colorMix, fg } from "@sdxc/u/color";
|
|
3
|
+
import { rounded } from "@sdxc/u/effects";
|
|
4
|
+
import { flex, flexCol, gap, items, justify } from "@sdxc/u/layout";
|
|
5
|
+
import { bs, is, mbs, p } from "@sdxc/u/size";
|
|
6
|
+
import { fontSize, leading, textAlign, tracking, weight } from "@sdxc/u/typography";
|
|
7
|
+
import { attrs } from "remix/ui";
|
|
8
|
+
import { semanticColorPanel } from "../styles/semantic-color-panel.js";
|
|
9
|
+
import { DEFAULT_ICON_ARIA_HIDDEN } from "../utils/decorative-icon.js";
|
|
10
|
+
import { resolveHeadingLevel, TAG_BY_LEVEL } from "./heading-scope.js";
|
|
11
|
+
/**
|
|
12
|
+
* Default {@link Empty.Props.color}, rendering the panel in the neutral
|
|
13
|
+
* tone when a consumer names no semantic color.
|
|
14
|
+
*/
|
|
15
|
+
const DEFAULT_COLOR = "neutral";
|
|
16
|
+
/**
|
|
17
|
+
* Renders the empty-state panel: a dashed-bordered column tinted to the
|
|
18
|
+
* color role in {@link Empty.Props.color}. Its compound parts inherit that
|
|
19
|
+
* color through `currentcolor`.
|
|
20
|
+
*
|
|
21
|
+
* @param handle Runtime handle carrying the host `<div>`'s props.
|
|
22
|
+
* @returns The render function producing the panel's markup.
|
|
23
|
+
* @example
|
|
24
|
+
* <Empty>
|
|
25
|
+
* <Empty.Icon><InboxIcon /></Empty.Icon>
|
|
26
|
+
* <Empty.Title>{t("inbox.empty.title")}</Empty.Title>
|
|
27
|
+
* <Empty.Description>{t("inbox.empty.description")}</Empty.Description>
|
|
28
|
+
* <Empty.Action>
|
|
29
|
+
* <Button>{t("inbox.empty.action")}</Button>
|
|
30
|
+
* </Empty.Action>
|
|
31
|
+
* </Empty>
|
|
32
|
+
* @example
|
|
33
|
+
* <Empty color="danger">
|
|
34
|
+
* <Empty.Title>{t("errors.notFound.title")}</Empty.Title>
|
|
35
|
+
* </Empty>
|
|
36
|
+
*/
|
|
37
|
+
export function Empty(handle) {
|
|
38
|
+
return () => {
|
|
39
|
+
let { color = DEFAULT_COLOR, children, mix, ...rest } = handle.props;
|
|
40
|
+
return (_jsx("div", { ...rest, "data-color": color, "data-slot": "empty", mix: [
|
|
41
|
+
semanticColorPanel(),
|
|
42
|
+
flex(),
|
|
43
|
+
flexCol(),
|
|
44
|
+
is("full"),
|
|
45
|
+
items("center"),
|
|
46
|
+
gap(3),
|
|
47
|
+
rounded("xl"),
|
|
48
|
+
border({ width: "1px", style: "dashed" }),
|
|
49
|
+
p(8),
|
|
50
|
+
textAlign("center"),
|
|
51
|
+
mix,
|
|
52
|
+
], children: children }));
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Renders {@link Empty.IconProps.children} as the icon well: a fully
|
|
57
|
+
* rounded, tinted badge framing an icon graphic hidden from assistive
|
|
58
|
+
* technology, since {@link Empty.Title}'s text already names the state.
|
|
59
|
+
*
|
|
60
|
+
* @param handle Runtime handle carrying the host `<div>`'s props.
|
|
61
|
+
* @returns The render function producing the icon well's markup.
|
|
62
|
+
*/
|
|
63
|
+
Empty.Icon = function EmptyIcon(handle) {
|
|
64
|
+
return () => {
|
|
65
|
+
let { children, mix, ...rest } = handle.props;
|
|
66
|
+
return (_jsx("div", { ...rest, "data-slot": "icon", mix: [
|
|
67
|
+
attrs({ "aria-hidden": DEFAULT_ICON_ARIA_HIDDEN }),
|
|
68
|
+
flex(),
|
|
69
|
+
bs("3rem"),
|
|
70
|
+
is("3rem"),
|
|
71
|
+
items("center"),
|
|
72
|
+
justify("center"),
|
|
73
|
+
rounded("full"),
|
|
74
|
+
border({ width: "1px", style: "solid" }),
|
|
75
|
+
fg("currentcolor"),
|
|
76
|
+
border(colorMix("oklab", { color: "currentcolor", weight: 20 }, "transparent")),
|
|
77
|
+
bg(colorMix("oklab", { color: "currentcolor", weight: 10 }, "transparent")),
|
|
78
|
+
mix,
|
|
79
|
+
], children: children }));
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Renders {@link Empty.TitleProps.children} as the empty state's heading,
|
|
84
|
+
* in the native heading element matching its ambient `HeadingScope` depth
|
|
85
|
+
* (or `<h1>` unscoped), sized as the panel's primary text regardless of level.
|
|
86
|
+
*
|
|
87
|
+
* @param handle Runtime handle carrying the host heading element's props.
|
|
88
|
+
* @returns The render function producing the heading's markup.
|
|
89
|
+
*/
|
|
90
|
+
Empty.Title = function EmptyTitle(handle) {
|
|
91
|
+
return () => {
|
|
92
|
+
let { children, mix, ...rest } = handle.props;
|
|
93
|
+
let level = resolveHeadingLevel(handle);
|
|
94
|
+
let Tag = TAG_BY_LEVEL[level];
|
|
95
|
+
return (_jsx(Tag, { ...rest, "data-slot": "title", mix: [weight("semibold"), tracking("tight"), fontSize("base"), leading("snug"), mix], children: children }));
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* Renders {@link Empty.DescriptionProps.children} as the empty state's
|
|
100
|
+
* supporting copy, in a native `<p>` set to seventy percent of the panel's
|
|
101
|
+
* current text color so it reads as secondary to {@link Empty.Title}.
|
|
102
|
+
*
|
|
103
|
+
* @param handle Runtime handle carrying the host `<p>`'s props.
|
|
104
|
+
* @returns The render function producing the description's markup.
|
|
105
|
+
*/
|
|
106
|
+
Empty.Description = function EmptyDescription(handle) {
|
|
107
|
+
return () => {
|
|
108
|
+
let { children, mix, ...rest } = handle.props;
|
|
109
|
+
return (_jsx("p", { ...rest, "data-slot": "description", mix: [
|
|
110
|
+
fontSize("sm"),
|
|
111
|
+
leading("relaxed"),
|
|
112
|
+
fg(colorMix("oklab", { color: "currentcolor", weight: 70 }, "transparent")),
|
|
113
|
+
mix,
|
|
114
|
+
], children: children }));
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* Renders {@link Empty.ActionProps.children} as the empty state's
|
|
119
|
+
* call-to-action slot, spaced a touch below the text above it.
|
|
120
|
+
*
|
|
121
|
+
* @param handle Runtime handle carrying the host `<div>`'s props.
|
|
122
|
+
* @returns The render function producing the action slot's markup.
|
|
123
|
+
*/
|
|
124
|
+
Empty.Action = function EmptyAction(handle) {
|
|
125
|
+
return () => {
|
|
126
|
+
let { children, mix, ...rest } = handle.props;
|
|
127
|
+
return (_jsx("div", { ...rest, "data-slot": "action", mix: [mbs(1), mix], children: children }));
|
|
128
|
+
};
|
|
129
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A native form field's validation message, styled at a small size in the
|
|
3
|
+
* danger foreground color. Its host carries a stable id — its own
|
|
4
|
+
* `handle.id` unless a consumer supplies one — ready for a field's control
|
|
5
|
+
* to reference through `aria-describedby`, and a `data-field-error` marker
|
|
6
|
+
* that lets a validation script locate this slot through that same
|
|
7
|
+
* `aria-describedby` list regardless of where it sits in the DOM. It
|
|
8
|
+
* is the foundational error slot every field wrapper composes alongside a
|
|
9
|
+
* label and a control.
|
|
10
|
+
*
|
|
11
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
12
|
+
* @copyright Sergio Xalambrí 2026
|
|
13
|
+
*/
|
|
14
|
+
import type { Handle, Props as TagProps } from "remix/ui";
|
|
15
|
+
/**
|
|
16
|
+
* Prop types for {@link FieldError}.
|
|
17
|
+
*/
|
|
18
|
+
export declare namespace FieldError {
|
|
19
|
+
/**
|
|
20
|
+
* Every native `<span>` attribute plus the `mix` passthrough. `children`
|
|
21
|
+
* holds the validation message the consumer supplies, and `id` defaults
|
|
22
|
+
* to this component's own `handle.id` when omitted.
|
|
23
|
+
*/
|
|
24
|
+
interface Props extends TagProps<"span"> {
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Renders a field's validation message. `id` falls back to `handle.id` so
|
|
29
|
+
* a sibling `aria-describedby` can target it via `data-field-error`; pass
|
|
30
|
+
* `hidden` to keep it out of layout until the field is invalid.
|
|
31
|
+
*
|
|
32
|
+
* @param handle Runtime handle carrying the host `<span>`'s props.
|
|
33
|
+
* @returns The render function producing the error message's markup.
|
|
34
|
+
* @example
|
|
35
|
+
* <input id="email" type="email" required aria-describedby="email-error" />
|
|
36
|
+
* <FieldError id="email-error">{t("fields.email.required")}</FieldError>
|
|
37
|
+
* @example
|
|
38
|
+
* <input type="email" required aria-describedby={handle.id} />
|
|
39
|
+
* <FieldError hidden={!errors.email}>{errors.email}</FieldError>
|
|
40
|
+
*/
|
|
41
|
+
export declare function FieldError(handle: Handle<FieldError.Props>): () => import("remix/ui").RemixElement;
|