@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,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A numeric field pairing a native `<input type="number">` control with a
|
|
3
|
+
* decrement and an increment button, all three sharing one bordered,
|
|
4
|
+
* rounded frame. The frame draws its own box styling and keyboard focus
|
|
5
|
+
* ring, so the input inside sits flush against its neighboring buttons
|
|
6
|
+
* instead of carrying a competing border of its own.
|
|
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 { Input } from "./input.js";
|
|
13
|
+
/**
|
|
14
|
+
* Prop types for {@link NumberField} and its compound parts.
|
|
15
|
+
*/
|
|
16
|
+
export declare namespace NumberField {
|
|
17
|
+
/**
|
|
18
|
+
* Every native `<div>` attribute, unchanged, plus the `mix` passthrough.
|
|
19
|
+
* `children` composes this field's parts — typically a caption, the
|
|
20
|
+
* {@link NumberField.Group} row, and any supporting or validation copy.
|
|
21
|
+
*/
|
|
22
|
+
interface Props extends TagProps<"div"> {
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Every native `<div>` attribute, unchanged, plus the `mix` passthrough.
|
|
26
|
+
* `children` composes {@link NumberField.DecrementButton},
|
|
27
|
+
* {@link NumberField.Input}, and {@link NumberField.IncrementButton}.
|
|
28
|
+
*/
|
|
29
|
+
interface GroupProps extends TagProps<"div"> {
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Every prop {@link Input.Props} accepts except `type` and `role`, fixed to
|
|
33
|
+
* `"number"` and the platform's own `spinbutton` role, and `color`, unexposed
|
|
34
|
+
* since the keyboard focus ring is deferred to {@link NumberField.Group}.
|
|
35
|
+
*/
|
|
36
|
+
interface InputProps extends Omit<Input.Props, "type" | "role" | "color"> {
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Every native `<button>` attribute except `children`, which stays fixed
|
|
40
|
+
* to this button's own decrement glyph, plus the `mix` passthrough.
|
|
41
|
+
* `type` defaults to {@link DEFAULT_BUTTON_TYPE}.
|
|
42
|
+
*/
|
|
43
|
+
interface DecrementButtonProps extends Omit<TagProps<"button">, "children"> {
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Every native `<button>` attribute except `children`, which stays fixed
|
|
47
|
+
* to this button's own increment glyph, plus the `mix` passthrough.
|
|
48
|
+
* `type` defaults to {@link DEFAULT_BUTTON_TYPE}.
|
|
49
|
+
*/
|
|
50
|
+
interface IncrementButtonProps extends Omit<TagProps<"button">, "children"> {
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Renders a plain host stacking this field's compound parts in a single
|
|
55
|
+
* column with a small gap between them: typically a caption, the
|
|
56
|
+
* {@link NumberField.Group} row, and any supporting or validation copy.
|
|
57
|
+
*
|
|
58
|
+
* @param handle Runtime handle carrying the host `<div>`'s props.
|
|
59
|
+
* @returns The render function producing the field's markup.
|
|
60
|
+
* @example
|
|
61
|
+
* <NumberField>
|
|
62
|
+
* <Label htmlFor="quantity">{t("form.quantity.label")}</Label>
|
|
63
|
+
* <NumberField.Group>
|
|
64
|
+
* <NumberField.DecrementButton aria-label={t("stepper.decrement")} />
|
|
65
|
+
* <NumberField.Input id="quantity" name="quantity" min={0} max={10} defaultValue={1} />
|
|
66
|
+
* <NumberField.IncrementButton aria-label={t("stepper.increment")} />
|
|
67
|
+
* </NumberField.Group>
|
|
68
|
+
* </NumberField>
|
|
69
|
+
*/
|
|
70
|
+
export declare function NumberField(handle: Handle<NumberField.Props>): () => import("remix/ui").RemixElement;
|
|
71
|
+
export declare namespace NumberField {
|
|
72
|
+
var Group: (handle: Handle<NumberField.GroupProps>) => () => import("remix/ui").RemixElement;
|
|
73
|
+
var Input: (handle: Handle<NumberField.InputProps>) => () => import("remix/ui").RemixElement;
|
|
74
|
+
var DecrementButton: (handle: Handle<NumberField.DecrementButtonProps>) => () => import("remix/ui").RemixElement;
|
|
75
|
+
var IncrementButton: (handle: Handle<NumberField.IncrementButtonProps>) => () => import("remix/ui").RemixElement;
|
|
76
|
+
}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { jsx as _jsx } from "remix/ui/jsx-runtime";
|
|
2
|
+
import { MinusIcon, PlusIcon } from "@sdxc/icons";
|
|
3
|
+
import { bg, border, borderEdge, fg, outline, outlineWidth } from "@sdxc/u/color";
|
|
4
|
+
import { opacity, rounded } from "@sdxc/u/effects";
|
|
5
|
+
import { cursor, raw } from "@sdxc/u/general";
|
|
6
|
+
import { basis, flex, grow, inlineFlex, items, justify, shrink } from "@sdxc/u/layout";
|
|
7
|
+
import { bs, is } from "@sdxc/u/size";
|
|
8
|
+
import { active, focusVisible, hover, invalid, when } from "@sdxc/u/state";
|
|
9
|
+
import { textAlign } from "@sdxc/u/typography";
|
|
10
|
+
import { attrs } from "remix/ui";
|
|
11
|
+
import { fieldStackLayout } from "../styles/field-stack-layout.js";
|
|
12
|
+
import { interactiveTransition } from "../styles/interactive-transition.js";
|
|
13
|
+
import { Input } from "./input.js";
|
|
14
|
+
/**
|
|
15
|
+
* ARIA role applied to {@link NumberField.Group} through {@link attrs}
|
|
16
|
+
* unless a consumer supplies its own `role`, announcing the frame as one
|
|
17
|
+
* related unit to assistive technology.
|
|
18
|
+
*/
|
|
19
|
+
const DEFAULT_ROLE = "group";
|
|
20
|
+
/**
|
|
21
|
+
* Native `<button>` `type` {@link NumberField.DecrementButton} and
|
|
22
|
+
* {@link NumberField.IncrementButton} fall back to when a consumer doesn't
|
|
23
|
+
* supply one, keeping a click on either from submitting a surrounding `<form>`.
|
|
24
|
+
*/
|
|
25
|
+
const DEFAULT_BUTTON_TYPE = "button";
|
|
26
|
+
/**
|
|
27
|
+
* Shared box, color, and interaction-state styling for
|
|
28
|
+
* {@link NumberField.DecrementButton} and {@link NumberField.IncrementButton},
|
|
29
|
+
* differing only in which inline edge carries the divider border.
|
|
30
|
+
*
|
|
31
|
+
* @param dividerEdge Which inline edge carries the divider border: `"end"` for the control preceding the input, `"start"` for the one following it.
|
|
32
|
+
* @returns The mixins shared by both stepper buttons.
|
|
33
|
+
*/
|
|
34
|
+
function stepperButtonMix(dividerEdge) {
|
|
35
|
+
return [
|
|
36
|
+
interactiveTransition(),
|
|
37
|
+
flex(),
|
|
38
|
+
items("center"),
|
|
39
|
+
justify("center"),
|
|
40
|
+
is("2.5rem"),
|
|
41
|
+
fg("neutral"),
|
|
42
|
+
border("neutral"),
|
|
43
|
+
borderEdge(dividerEdge === "start" ? "inline-start" : "inline-end", { width: 1 }),
|
|
44
|
+
hover(bg("neutral.bg-tint-hover")),
|
|
45
|
+
active(bg("neutral.bg-tint-pressed")),
|
|
46
|
+
when("&:focus-visible", outline({ color: "brand.ring", offset: 2 })),
|
|
47
|
+
rounded("none"),
|
|
48
|
+
bg("transparent"),
|
|
49
|
+
when("& svg", [is("1rem"), bs("1rem")]),
|
|
50
|
+
when("&:disabled", [cursor("not-allowed"), opacity(50)]),
|
|
51
|
+
];
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Renders a plain host stacking this field's compound parts in a single
|
|
55
|
+
* column with a small gap between them: typically a caption, the
|
|
56
|
+
* {@link NumberField.Group} row, and any supporting or validation copy.
|
|
57
|
+
*
|
|
58
|
+
* @param handle Runtime handle carrying the host `<div>`'s props.
|
|
59
|
+
* @returns The render function producing the field's markup.
|
|
60
|
+
* @example
|
|
61
|
+
* <NumberField>
|
|
62
|
+
* <Label htmlFor="quantity">{t("form.quantity.label")}</Label>
|
|
63
|
+
* <NumberField.Group>
|
|
64
|
+
* <NumberField.DecrementButton aria-label={t("stepper.decrement")} />
|
|
65
|
+
* <NumberField.Input id="quantity" name="quantity" min={0} max={10} defaultValue={1} />
|
|
66
|
+
* <NumberField.IncrementButton aria-label={t("stepper.increment")} />
|
|
67
|
+
* </NumberField.Group>
|
|
68
|
+
* </NumberField>
|
|
69
|
+
*/
|
|
70
|
+
export function NumberField(handle) {
|
|
71
|
+
return () => {
|
|
72
|
+
let { mix, ...rest } = handle.props;
|
|
73
|
+
return _jsx("div", { ...rest, "data-slot": "number-field", mix: [fieldStackLayout(), mix] });
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Renders {@link NumberField}'s frame: a `role="group"` `<div>` drawing a
|
|
78
|
+
* bordered, rounded, tinted-background box that reads as one seamless
|
|
79
|
+
* control, ringing the whole frame via `:focus-within` when a child gains focus.
|
|
80
|
+
*
|
|
81
|
+
* @param handle Runtime handle carrying the host `<div>`'s props.
|
|
82
|
+
* @returns The render function producing the frame's markup.
|
|
83
|
+
* @example
|
|
84
|
+
* <NumberField.Group>
|
|
85
|
+
* <NumberField.DecrementButton aria-label={t("stepper.decrement")} />
|
|
86
|
+
* <NumberField.Input aria-label={t("form.quantity.label")} />
|
|
87
|
+
* <NumberField.IncrementButton aria-label={t("stepper.increment")} />
|
|
88
|
+
* </NumberField.Group>
|
|
89
|
+
*/
|
|
90
|
+
NumberField.Group = function NumberFieldGroup(handle) {
|
|
91
|
+
return () => {
|
|
92
|
+
let { mix, ...rest } = handle.props;
|
|
93
|
+
return (_jsx("div", { ...rest, "data-slot": "group", mix: [
|
|
94
|
+
attrs({ role: DEFAULT_ROLE }),
|
|
95
|
+
inlineFlex(),
|
|
96
|
+
items("stretch"),
|
|
97
|
+
is("full"),
|
|
98
|
+
rounded("md"),
|
|
99
|
+
border({ color: "neutral", width: 1 }),
|
|
100
|
+
bg("neutral.tint"),
|
|
101
|
+
fg("neutral.emphasis"),
|
|
102
|
+
hover(border("neutral.strong")),
|
|
103
|
+
when("&:focus-within", [
|
|
104
|
+
outline({ color: "brand.ring", offset: 0 }),
|
|
105
|
+
border("brand.ring"),
|
|
106
|
+
]),
|
|
107
|
+
mix,
|
|
108
|
+
] }));
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* Renders {@link NumberField}'s control: a native `<input type="number">`
|
|
113
|
+
* built on {@link Input}. The stepper buttons need a separately wired
|
|
114
|
+
* `stepUp()`/`stepDown()` for press-and-hold repeat; typed entry works without it.
|
|
115
|
+
*
|
|
116
|
+
* @param handle Runtime handle carrying the host `<input>`'s props.
|
|
117
|
+
* @returns The render function producing the control's markup.
|
|
118
|
+
* @example
|
|
119
|
+
* <NumberField.Input aria-label={t("form.quantity.label")} min={0} max={10} defaultValue={1} />
|
|
120
|
+
* @example
|
|
121
|
+
* <NumberField.Input id="price" name="price" step={0.01} aria-invalid="true" />
|
|
122
|
+
*/
|
|
123
|
+
NumberField.Input = function NumberFieldInput(handle) {
|
|
124
|
+
return () => {
|
|
125
|
+
let { mix, ...rest } = handle.props;
|
|
126
|
+
return (_jsx(Input, { type: "number", ...rest, mix: [
|
|
127
|
+
textAlign("center"),
|
|
128
|
+
rounded("none"),
|
|
129
|
+
grow(),
|
|
130
|
+
shrink(1),
|
|
131
|
+
basis("0%"),
|
|
132
|
+
border({ width: "0", noStyleDefault: true }),
|
|
133
|
+
raw({
|
|
134
|
+
"-moz-appearance": "textfield",
|
|
135
|
+
"&::-webkit-inner-spin-button, &::-webkit-outer-spin-button": {
|
|
136
|
+
"-webkit-appearance": "none",
|
|
137
|
+
margin: "0",
|
|
138
|
+
},
|
|
139
|
+
}),
|
|
140
|
+
bg("transparent"),
|
|
141
|
+
fg("inherit"),
|
|
142
|
+
when("&:disabled", bg("transparent")),
|
|
143
|
+
focusVisible(outlineWidth("0")),
|
|
144
|
+
invalid([outlineWidth("0"), fg("danger")]),
|
|
145
|
+
mix,
|
|
146
|
+
] }));
|
|
147
|
+
};
|
|
148
|
+
};
|
|
149
|
+
/**
|
|
150
|
+
* Renders a native `<button>` decrementing {@link NumberField.Input}'s
|
|
151
|
+
* value; its glyph is `aria-hidden`, so callers must supply an `aria-label`.
|
|
152
|
+
* In dev mode, a missing `aria-label`/`aria-labelledby` logs a `console.warn`.
|
|
153
|
+
*
|
|
154
|
+
* @param handle Runtime handle carrying the host `<button>`'s props.
|
|
155
|
+
* @returns The render function producing the control's markup.
|
|
156
|
+
* @example
|
|
157
|
+
* <NumberField.DecrementButton aria-label={t("stepper.decrement")} />
|
|
158
|
+
* @example
|
|
159
|
+
* <NumberField.DecrementButton aria-label={t("stepper.decrement")} disabled={quantity <= 0} />
|
|
160
|
+
*/
|
|
161
|
+
NumberField.DecrementButton = function NumberFieldDecrementButton(handle) {
|
|
162
|
+
return () => {
|
|
163
|
+
let { type, mix, ...rest } = handle.props;
|
|
164
|
+
if (import.meta.env.DEV && !handle.props["aria-label"] && !handle.props["aria-labelledby"]) {
|
|
165
|
+
console.warn("NumberField.DecrementButton: needs an `aria-label` describing what it does — its content is a decorative glyph with no accessible name of its own.");
|
|
166
|
+
}
|
|
167
|
+
return (_jsx("button", { type: type ?? DEFAULT_BUTTON_TYPE, ...rest, "data-slot": "decrement", mix: [stepperButtonMix("end"), mix], children: _jsx(MinusIcon, {}) }));
|
|
168
|
+
};
|
|
169
|
+
};
|
|
170
|
+
/**
|
|
171
|
+
* Renders a native `<button>` incrementing {@link NumberField.Input}'s
|
|
172
|
+
* value; its glyph is `aria-hidden`, so callers must supply an `aria-label`.
|
|
173
|
+
* In dev mode, a missing `aria-label`/`aria-labelledby` logs a `console.warn`.
|
|
174
|
+
*
|
|
175
|
+
* @param handle Runtime handle carrying the host `<button>`'s props.
|
|
176
|
+
* @returns The render function producing the control's markup.
|
|
177
|
+
* @example
|
|
178
|
+
* <NumberField.IncrementButton aria-label={t("stepper.increment")} />
|
|
179
|
+
* @example
|
|
180
|
+
* <NumberField.IncrementButton aria-label={t("stepper.increment")} disabled={quantity >= 10} />
|
|
181
|
+
*/
|
|
182
|
+
NumberField.IncrementButton = function NumberFieldIncrementButton(handle) {
|
|
183
|
+
return () => {
|
|
184
|
+
let { type, mix, ...rest } = handle.props;
|
|
185
|
+
if (import.meta.env.DEV && !handle.props["aria-label"] && !handle.props["aria-labelledby"]) {
|
|
186
|
+
console.warn("NumberField.IncrementButton: needs an `aria-label` describing what it does — its content is a decorative glyph with no accessible name of its own.");
|
|
187
|
+
}
|
|
188
|
+
return (_jsx("button", { type: type ?? DEFAULT_BUTTON_TYPE, ...rest, "data-slot": "increment", mix: [stepperButtonMix("start"), mix], children: _jsx(PlusIcon, {}) }));
|
|
189
|
+
};
|
|
190
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A one-time-code field: a native `<input>` defaulting to a numeric virtual
|
|
3
|
+
* keyboard and the platform's SMS/email autofill hint for one-time codes,
|
|
4
|
+
* built on {@link Input} for its box, color, and interaction-state styling.
|
|
5
|
+
*
|
|
6
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
7
|
+
* @copyright Sergio Xalambrí 2026
|
|
8
|
+
*/
|
|
9
|
+
import type { Handle } from "remix/ui";
|
|
10
|
+
import { Input } from "./input.js";
|
|
11
|
+
/**
|
|
12
|
+
* Prop types for {@link OtpField}.
|
|
13
|
+
*/
|
|
14
|
+
export declare namespace OtpField {
|
|
15
|
+
/**
|
|
16
|
+
* Every {@link Input} prop except `type`, `list`, `role`, `inputMode`,
|
|
17
|
+
* `autoComplete`, and `maxLength`, fixed to a plain text control with
|
|
18
|
+
* `inputMode`/`autoComplete`/`length` read from the fields below instead.
|
|
19
|
+
*/
|
|
20
|
+
interface Props extends Omit<Input.Props, "type" | "list" | "role" | "inputMode" | "autoComplete" | "maxLength"> {
|
|
21
|
+
/**
|
|
22
|
+
* The one-time code's character count, applied as the control's native
|
|
23
|
+
* `maxLength`. Defaults to {@link DEFAULT_LENGTH}.
|
|
24
|
+
*/
|
|
25
|
+
length?: number;
|
|
26
|
+
/**
|
|
27
|
+
* Virtual-keyboard hint passed straight through to the native `inputMode`
|
|
28
|
+
* attribute. Defaults to {@link DEFAULT_INPUT_MODE}, requesting the
|
|
29
|
+
* numeric keypad; set it to `"text"` for a code that mixes in letters.
|
|
30
|
+
*/
|
|
31
|
+
inputMode?: Input.Props["inputMode"];
|
|
32
|
+
/**
|
|
33
|
+
* Platform autofill hint passed straight through to the native
|
|
34
|
+
* `autoComplete` attribute. Defaults to {@link DEFAULT_AUTO_COMPLETE}, which
|
|
35
|
+
* a browser or OS keyboard looks for to offer an SMS or email code inline.
|
|
36
|
+
*/
|
|
37
|
+
autoComplete?: Input.Props["autoComplete"];
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Renders a single native `<input>` for entering a one-time verification
|
|
42
|
+
* code, built on {@link Input}, sized as one full-width control since a
|
|
43
|
+
* single `<input>` is what carries `autoComplete="one-time-code"` reliably.
|
|
44
|
+
*
|
|
45
|
+
* @param handle Runtime handle carrying the host `<input>`'s props.
|
|
46
|
+
* @returns The render function producing the field's markup.
|
|
47
|
+
* @example
|
|
48
|
+
* <Label htmlFor="otp">{t("auth.otp.label")}</Label>
|
|
49
|
+
* <OtpField id="otp" name="code" autoFocus />
|
|
50
|
+
* @example
|
|
51
|
+
* <OtpField
|
|
52
|
+
* id="otp"
|
|
53
|
+
* name="code"
|
|
54
|
+
* aria-describedby="otp-error"
|
|
55
|
+
* aria-invalid="true"
|
|
56
|
+
* />
|
|
57
|
+
* <FieldError id="otp-error">{t("auth.otp.invalid")}</FieldError>
|
|
58
|
+
* @example
|
|
59
|
+
* <OtpField
|
|
60
|
+
* id="invite-code"
|
|
61
|
+
* name="inviteCode"
|
|
62
|
+
* length={8}
|
|
63
|
+
* inputMode="text"
|
|
64
|
+
* autoComplete="off"
|
|
65
|
+
* pattern="[A-Za-z0-9]*"
|
|
66
|
+
* />
|
|
67
|
+
*/
|
|
68
|
+
export declare function OtpField(handle: Handle<OtpField.Props>): () => import("remix/ui").RemixElement;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx as _jsx } from "remix/ui/jsx-runtime";
|
|
2
|
+
import { tabularNums, text, textAlign, weight } from "@sdxc/u/typography";
|
|
3
|
+
import { Input } from "./input.js";
|
|
4
|
+
/** Maximum code length {@link OtpField} falls back to when `length` is omitted. */
|
|
5
|
+
const DEFAULT_LENGTH = 6;
|
|
6
|
+
/** Virtual-keyboard hint {@link OtpField} falls back to when `inputMode` is omitted. */
|
|
7
|
+
const DEFAULT_INPUT_MODE = "numeric";
|
|
8
|
+
/** Platform autofill hint {@link OtpField} falls back to when `autoComplete` is omitted. */
|
|
9
|
+
const DEFAULT_AUTO_COMPLETE = "one-time-code";
|
|
10
|
+
/**
|
|
11
|
+
* Renders a single native `<input>` for entering a one-time verification
|
|
12
|
+
* code, built on {@link Input}, sized as one full-width control since a
|
|
13
|
+
* single `<input>` is what carries `autoComplete="one-time-code"` reliably.
|
|
14
|
+
*
|
|
15
|
+
* @param handle Runtime handle carrying the host `<input>`'s props.
|
|
16
|
+
* @returns The render function producing the field's markup.
|
|
17
|
+
* @example
|
|
18
|
+
* <Label htmlFor="otp">{t("auth.otp.label")}</Label>
|
|
19
|
+
* <OtpField id="otp" name="code" autoFocus />
|
|
20
|
+
* @example
|
|
21
|
+
* <OtpField
|
|
22
|
+
* id="otp"
|
|
23
|
+
* name="code"
|
|
24
|
+
* aria-describedby="otp-error"
|
|
25
|
+
* aria-invalid="true"
|
|
26
|
+
* />
|
|
27
|
+
* <FieldError id="otp-error">{t("auth.otp.invalid")}</FieldError>
|
|
28
|
+
* @example
|
|
29
|
+
* <OtpField
|
|
30
|
+
* id="invite-code"
|
|
31
|
+
* name="inviteCode"
|
|
32
|
+
* length={8}
|
|
33
|
+
* inputMode="text"
|
|
34
|
+
* autoComplete="off"
|
|
35
|
+
* pattern="[A-Za-z0-9]*"
|
|
36
|
+
* />
|
|
37
|
+
*/
|
|
38
|
+
export function OtpField(handle) {
|
|
39
|
+
return () => {
|
|
40
|
+
let { length, inputMode, autoComplete, mix, ...rest } = handle.props;
|
|
41
|
+
let resolvedLength = length ?? DEFAULT_LENGTH;
|
|
42
|
+
let resolvedInputMode = inputMode ?? DEFAULT_INPUT_MODE;
|
|
43
|
+
let resolvedAutoComplete = autoComplete ?? DEFAULT_AUTO_COMPLETE;
|
|
44
|
+
return (_jsx(Input, { ...rest, type: "text", inputMode: resolvedInputMode, autoComplete: resolvedAutoComplete, maxLength: resolvedLength, "data-slot": "otp-field", mix: [textAlign("center"), weight(500), tabularNums(), text("base"), mix] }));
|
|
45
|
+
};
|
|
46
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A small pointer glyph anchoring an overlay surface — a popover, a menu, a
|
|
3
|
+
* tooltip — visually back to the trigger it floats beside. It renders as an
|
|
4
|
+
* absolutely positioned host holding whatever arrow shape a consumer draws
|
|
5
|
+
* as its child (typically an inline `<svg>`), oriented and offset by the
|
|
6
|
+
* `data-placement` attribute contract.
|
|
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 OverlayArrow}.
|
|
14
|
+
*/
|
|
15
|
+
export declare namespace OverlayArrow {
|
|
16
|
+
/**
|
|
17
|
+
* Side (and, for the four corner variants, alignment) of the trigger an
|
|
18
|
+
* overlay renders relative to. {@link OverlayArrow} reads only the leading
|
|
19
|
+
* segment; the `-start`/`-end` suffix carries no visual effect on the arrow.
|
|
20
|
+
*/
|
|
21
|
+
type Placement = "top" | "top-start" | "top-end" | "bottom" | "bottom-start" | "bottom-end" | "left" | "left-start" | "left-end" | "right" | "right-start" | "right-end";
|
|
22
|
+
/**
|
|
23
|
+
* Every native `<div>` attribute, plus the `mix` passthrough, plus the
|
|
24
|
+
* `placement` that drives which edge of the overlay the arrow attaches to.
|
|
25
|
+
*/
|
|
26
|
+
interface Props extends TagProps<"div"> {
|
|
27
|
+
/**
|
|
28
|
+
* Side of the trigger the overlay renders on. Defaults to
|
|
29
|
+
* {@link DEFAULT_PLACEMENT}.
|
|
30
|
+
*/
|
|
31
|
+
placement?: Placement;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Renders a decorative pointer glyph, rotating to point back at the trigger
|
|
36
|
+
* from whichever edge the overlay attaches to. `"left"`/`"right"` name a
|
|
37
|
+
* physical viewport side, so the arrow keeps attaching there under any `dir`.
|
|
38
|
+
*
|
|
39
|
+
* @param handle Runtime handle carrying the host `<div>`'s props.
|
|
40
|
+
* @returns The render function producing the arrow's markup.
|
|
41
|
+
* @example
|
|
42
|
+
* <Popover>
|
|
43
|
+
* <OverlayArrow placement="bottom">
|
|
44
|
+
* <svg width={12} height={12} viewBox="0 0 12 12">
|
|
45
|
+
* <path d="M0 0 L6 6 L12 0" />
|
|
46
|
+
* </svg>
|
|
47
|
+
* </OverlayArrow>
|
|
48
|
+
* {content}
|
|
49
|
+
* </Popover>
|
|
50
|
+
*/
|
|
51
|
+
export declare function OverlayArrow(handle: Handle<OverlayArrow.Props>): () => import("remix/ui").RemixElement;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { jsx as _jsx } from "remix/ui/jsx-runtime";
|
|
2
|
+
import { fill } from "@sdxc/u/color";
|
|
3
|
+
import { calc, pointerEvents, var as varUtility } from "@sdxc/u/general";
|
|
4
|
+
import { absolute, insBe, insBs, insIe, insIs, insLeft, insRight } from "@sdxc/u/layout";
|
|
5
|
+
import { mb, mi } from "@sdxc/u/size";
|
|
6
|
+
import { when } from "@sdxc/u/state";
|
|
7
|
+
import { rotate } from "@sdxc/u/transform";
|
|
8
|
+
import { attrs } from "remix/ui";
|
|
9
|
+
/**
|
|
10
|
+
* Side of the overlay {@link OverlayArrow} attaches to when `placement` is
|
|
11
|
+
* left unset. Matches the side an overlay renders on when its own placement
|
|
12
|
+
* request goes unanswered by the positioning engine.
|
|
13
|
+
*/
|
|
14
|
+
const DEFAULT_PLACEMENT = "bottom";
|
|
15
|
+
/**
|
|
16
|
+
* `aria-hidden="true"` applied through {@link attrs} unless a consumer
|
|
17
|
+
* overrides it, keeping the purely decorative pointer glyph out of the
|
|
18
|
+
* accessibility tree.
|
|
19
|
+
*/
|
|
20
|
+
const DEFAULT_ARIA_HIDDEN = "true";
|
|
21
|
+
/**
|
|
22
|
+
* Renders a decorative pointer glyph, rotating to point back at the trigger
|
|
23
|
+
* from whichever edge the overlay attaches to. `"left"`/`"right"` name a
|
|
24
|
+
* physical viewport side, so the arrow keeps attaching there under any `dir`.
|
|
25
|
+
*
|
|
26
|
+
* @param handle Runtime handle carrying the host `<div>`'s props.
|
|
27
|
+
* @returns The render function producing the arrow's markup.
|
|
28
|
+
* @example
|
|
29
|
+
* <Popover>
|
|
30
|
+
* <OverlayArrow placement="bottom">
|
|
31
|
+
* <svg width={12} height={12} viewBox="0 0 12 12">
|
|
32
|
+
* <path d="M0 0 L6 6 L12 0" />
|
|
33
|
+
* </svg>
|
|
34
|
+
* </OverlayArrow>
|
|
35
|
+
* {content}
|
|
36
|
+
* </Popover>
|
|
37
|
+
*/
|
|
38
|
+
export function OverlayArrow(handle) {
|
|
39
|
+
return () => {
|
|
40
|
+
let { placement, mix, ...rest } = handle.props;
|
|
41
|
+
let resolvedPlacement = placement ?? DEFAULT_PLACEMENT;
|
|
42
|
+
return (_jsx("div", { "data-placement": resolvedPlacement, ...rest, mix: [
|
|
43
|
+
attrs({ "aria-hidden": DEFAULT_ARIA_HIDDEN }),
|
|
44
|
+
absolute(),
|
|
45
|
+
fill("neutral.tint"),
|
|
46
|
+
pointerEvents(),
|
|
47
|
+
when('&[data-placement^="bottom"]', [
|
|
48
|
+
mi("auto"),
|
|
49
|
+
rotate(180),
|
|
50
|
+
insBs(calc(`${varUtility("ui-overlay-arrow-offset", "0.5rem")} * -1`)),
|
|
51
|
+
insIs("0"),
|
|
52
|
+
insIe("0"),
|
|
53
|
+
]),
|
|
54
|
+
when('&[data-placement^="top"]', [
|
|
55
|
+
mi("auto"),
|
|
56
|
+
insBe(calc(`${varUtility("ui-overlay-arrow-offset", "0.5rem")} * -1`)),
|
|
57
|
+
insIs("0"),
|
|
58
|
+
insIe("0"),
|
|
59
|
+
]),
|
|
60
|
+
when('&[data-placement^="left"]', [
|
|
61
|
+
mb("auto"),
|
|
62
|
+
rotate(-90),
|
|
63
|
+
insLeft("100%"),
|
|
64
|
+
insBs("0"),
|
|
65
|
+
insBe("0"),
|
|
66
|
+
]),
|
|
67
|
+
when('&[data-placement^="right"]', [
|
|
68
|
+
mb("auto"),
|
|
69
|
+
rotate(90),
|
|
70
|
+
insRight("100%"),
|
|
71
|
+
insBs("0"),
|
|
72
|
+
insBe("0"),
|
|
73
|
+
]),
|
|
74
|
+
mix,
|
|
75
|
+
] }));
|
|
76
|
+
};
|
|
77
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A navigation landmark for moving between pages of results, composing a
|
|
3
|
+
* `<nav>` root, an `<ul>` list, and `<li>` items around two interactive
|
|
4
|
+
* parts: {@link Pagination.Link} for page-number destinations and
|
|
5
|
+
* {@link Pagination.Button} for previous/next controls. The active page reads
|
|
6
|
+
* straight from the native `aria-current` attribute a consumer sets while
|
|
7
|
+
* rendering the current page's link server-side, with no client-tracked
|
|
8
|
+
* route state anywhere in this module.
|
|
9
|
+
*
|
|
10
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
11
|
+
* @copyright Sergio Xalambrí 2026
|
|
12
|
+
*/
|
|
13
|
+
import type { Handle, Props as TagProps } from "remix/ui";
|
|
14
|
+
/**
|
|
15
|
+
* Prop types for {@link Pagination} and its compound parts.
|
|
16
|
+
*/
|
|
17
|
+
export declare namespace Pagination {
|
|
18
|
+
/**
|
|
19
|
+
* Every native `<nav>` attribute, unchanged, plus the `mix` passthrough.
|
|
20
|
+
*/
|
|
21
|
+
interface Props extends TagProps<"nav"> {
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Every native `<ul>` attribute, unchanged, plus the `mix` passthrough.
|
|
25
|
+
*/
|
|
26
|
+
interface ListProps extends TagProps<"ul"> {
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Every native `<li>` attribute, unchanged, plus the `mix` passthrough.
|
|
30
|
+
*/
|
|
31
|
+
interface ItemProps extends TagProps<"li"> {
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Every native `<a>` attribute, plus the `mix` passthrough. A type alias
|
|
35
|
+
* rather than an interface, since native anchor props resolve through a
|
|
36
|
+
* conditional type an `interface extends` clause can't statically extend.
|
|
37
|
+
*/
|
|
38
|
+
type LinkProps = TagProps<"a">;
|
|
39
|
+
/**
|
|
40
|
+
* Every native `<button>` attribute, unchanged, plus the `mix` passthrough.
|
|
41
|
+
*/
|
|
42
|
+
interface ButtonProps extends TagProps<"button"> {
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Renders the pagination's `<nav>` root, laying its single {@link
|
|
47
|
+
* Pagination.List} child out as a centered row. In dev mode, a root missing
|
|
48
|
+
* `aria-label`/`aria-labelledby` logs a `console.warn` for assistive tech.
|
|
49
|
+
*
|
|
50
|
+
* @param handle Runtime handle carrying the host `<nav>`'s props.
|
|
51
|
+
* @returns The render function producing the navigation landmark's markup.
|
|
52
|
+
* @example
|
|
53
|
+
* <Pagination aria-label={t("pagination.label")}>
|
|
54
|
+
* <Pagination.List>
|
|
55
|
+
* <Pagination.Item>
|
|
56
|
+
* <Pagination.Link href="?page=1" aria-current="page">1</Pagination.Link>
|
|
57
|
+
* </Pagination.Item>
|
|
58
|
+
* </Pagination.List>
|
|
59
|
+
* </Pagination>
|
|
60
|
+
*/
|
|
61
|
+
export declare function Pagination(handle: Handle<Pagination.Props>): () => import("remix/ui").RemixElement;
|
|
62
|
+
export declare namespace Pagination {
|
|
63
|
+
var List: (handle: Handle<Pagination.ListProps>) => () => import("remix/ui").RemixElement;
|
|
64
|
+
var Item: (handle: Handle<Pagination.ItemProps>) => () => import("remix/ui").RemixElement;
|
|
65
|
+
var Link: (handle: Handle<Pagination.LinkProps>) => () => import("remix/ui").RemixElement;
|
|
66
|
+
var Button: (handle: Handle<Pagination.ButtonProps>) => () => import("remix/ui").RemixElement;
|
|
67
|
+
}
|