@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,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A set of expand/collapse sections built on {@link Disclosure}, stacked into
|
|
3
|
+
* one divider-separated list. Each section holds its state on its native
|
|
4
|
+
* `<details>` element; giving sibling {@link Accordion.Item}s the same `name`
|
|
5
|
+
* makes the set exclusive through the platform's `<details name>` behavior,
|
|
6
|
+
* closing whichever section was open as another opens.
|
|
7
|
+
*
|
|
8
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
9
|
+
* @copyright Sergio Xalambrí 2026
|
|
10
|
+
*/
|
|
11
|
+
import type { Handle, Props as TagProps, RemixNode } from "remix/ui";
|
|
12
|
+
import { Disclosure } from "./disclosure.js";
|
|
13
|
+
/**
|
|
14
|
+
* Prop types for {@link Accordion} and its compound parts.
|
|
15
|
+
*/
|
|
16
|
+
export declare namespace Accordion {
|
|
17
|
+
/**
|
|
18
|
+
* Props accepted by {@link Accordion}.
|
|
19
|
+
*/
|
|
20
|
+
interface Props extends TagProps<"div"> {
|
|
21
|
+
/** One or more {@link Accordion.Item} sections to stack into a list. */
|
|
22
|
+
children: RemixNode;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Every prop {@link Disclosure.Props} accepts, unchanged: the section's
|
|
26
|
+
* `open` state and, when set to the same value across siblings, the
|
|
27
|
+
* `name` that makes the group exclusive.
|
|
28
|
+
*/
|
|
29
|
+
interface ItemProps extends Disclosure.Props {
|
|
30
|
+
}
|
|
31
|
+
/** Every prop {@link Disclosure.TriggerProps} accepts, unchanged. */
|
|
32
|
+
interface TriggerProps extends Disclosure.TriggerProps {
|
|
33
|
+
}
|
|
34
|
+
/** Every prop {@link Disclosure.PanelProps} accepts, unchanged. */
|
|
35
|
+
interface ContentProps extends Disclosure.PanelProps {
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Renders the list's root host: a plain `<div>` that stacks
|
|
40
|
+
* {@link Accordion.Item} sections in normal block flow, each drawing its own
|
|
41
|
+
* divider so the whole list reads as one continuous group.
|
|
42
|
+
*
|
|
43
|
+
* @param handle Runtime handle carrying the host `<div>`'s props.
|
|
44
|
+
* @returns The render function producing the list's markup.
|
|
45
|
+
* @example
|
|
46
|
+
* <Accordion>
|
|
47
|
+
* <Accordion.Item>
|
|
48
|
+
* <Accordion.Trigger>
|
|
49
|
+
* {t("faq.refunds.question")}
|
|
50
|
+
* <ChevronDownIcon data-slot="icon" aria-hidden />
|
|
51
|
+
* </Accordion.Trigger>
|
|
52
|
+
* <Accordion.Content>
|
|
53
|
+
* <p>{t("faq.refunds.answer")}</p>
|
|
54
|
+
* </Accordion.Content>
|
|
55
|
+
* </Accordion.Item>
|
|
56
|
+
* <Accordion.Item>
|
|
57
|
+
* <Accordion.Trigger>
|
|
58
|
+
* {t("faq.shipping.question")}
|
|
59
|
+
* <ChevronDownIcon data-slot="icon" aria-hidden />
|
|
60
|
+
* </Accordion.Trigger>
|
|
61
|
+
* <Accordion.Content>
|
|
62
|
+
* <p>{t("faq.shipping.answer")}</p>
|
|
63
|
+
* </Accordion.Content>
|
|
64
|
+
* </Accordion.Item>
|
|
65
|
+
* </Accordion>
|
|
66
|
+
* @example
|
|
67
|
+
* <Accordion>
|
|
68
|
+
* <Accordion.Item name="faq" open>
|
|
69
|
+
* <Accordion.Trigger>
|
|
70
|
+
* {t("faq.refunds.question")}
|
|
71
|
+
* <ChevronDownIcon data-slot="icon" aria-hidden />
|
|
72
|
+
* </Accordion.Trigger>
|
|
73
|
+
* <Accordion.Content>
|
|
74
|
+
* <p>{t("faq.refunds.answer")}</p>
|
|
75
|
+
* </Accordion.Content>
|
|
76
|
+
* </Accordion.Item>
|
|
77
|
+
* <Accordion.Item name="faq">
|
|
78
|
+
* <Accordion.Trigger>
|
|
79
|
+
* {t("faq.shipping.question")}
|
|
80
|
+
* <ChevronDownIcon data-slot="icon" aria-hidden />
|
|
81
|
+
* </Accordion.Trigger>
|
|
82
|
+
* <Accordion.Content>
|
|
83
|
+
* <p>{t("faq.shipping.answer")}</p>
|
|
84
|
+
* </Accordion.Content>
|
|
85
|
+
* </Accordion.Item>
|
|
86
|
+
* </Accordion>
|
|
87
|
+
*/
|
|
88
|
+
export declare function Accordion(handle: Handle<Accordion.Props>): () => import("remix/ui").RemixElement;
|
|
89
|
+
export declare namespace Accordion {
|
|
90
|
+
var Item: (handle: Handle<Accordion.ItemProps>) => () => import("remix/ui").RemixElement;
|
|
91
|
+
var Trigger: (handle: Handle<Accordion.TriggerProps>) => () => import("remix/ui").RemixElement;
|
|
92
|
+
var Content: (handle: Handle<Accordion.ContentProps>) => () => import("remix/ui").RemixElement;
|
|
93
|
+
}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { jsx as _jsx } from "remix/ui/jsx-runtime";
|
|
2
|
+
import { bg, borderEdge, fg } from "@sdxc/u/color";
|
|
3
|
+
import { opacity, rounded, transition, transitionDuration } from "@sdxc/u/effects";
|
|
4
|
+
import { justify, shrink } from "@sdxc/u/layout";
|
|
5
|
+
import { media } from "@sdxc/u/responsive";
|
|
6
|
+
import { bs, is, pb, pbe, pi } from "@sdxc/u/size";
|
|
7
|
+
import { hover, open, when } from "@sdxc/u/state";
|
|
8
|
+
import { rotate } from "@sdxc/u/transform";
|
|
9
|
+
import { text, textDecoration } from "@sdxc/u/typography";
|
|
10
|
+
import { Disclosure } from "./disclosure.js";
|
|
11
|
+
/**
|
|
12
|
+
* Renders the list's root host: a plain `<div>` that stacks
|
|
13
|
+
* {@link Accordion.Item} sections in normal block flow, each drawing its own
|
|
14
|
+
* divider so the whole list reads as one continuous group.
|
|
15
|
+
*
|
|
16
|
+
* @param handle Runtime handle carrying the host `<div>`'s props.
|
|
17
|
+
* @returns The render function producing the list's markup.
|
|
18
|
+
* @example
|
|
19
|
+
* <Accordion>
|
|
20
|
+
* <Accordion.Item>
|
|
21
|
+
* <Accordion.Trigger>
|
|
22
|
+
* {t("faq.refunds.question")}
|
|
23
|
+
* <ChevronDownIcon data-slot="icon" aria-hidden />
|
|
24
|
+
* </Accordion.Trigger>
|
|
25
|
+
* <Accordion.Content>
|
|
26
|
+
* <p>{t("faq.refunds.answer")}</p>
|
|
27
|
+
* </Accordion.Content>
|
|
28
|
+
* </Accordion.Item>
|
|
29
|
+
* <Accordion.Item>
|
|
30
|
+
* <Accordion.Trigger>
|
|
31
|
+
* {t("faq.shipping.question")}
|
|
32
|
+
* <ChevronDownIcon data-slot="icon" aria-hidden />
|
|
33
|
+
* </Accordion.Trigger>
|
|
34
|
+
* <Accordion.Content>
|
|
35
|
+
* <p>{t("faq.shipping.answer")}</p>
|
|
36
|
+
* </Accordion.Content>
|
|
37
|
+
* </Accordion.Item>
|
|
38
|
+
* </Accordion>
|
|
39
|
+
* @example
|
|
40
|
+
* <Accordion>
|
|
41
|
+
* <Accordion.Item name="faq" open>
|
|
42
|
+
* <Accordion.Trigger>
|
|
43
|
+
* {t("faq.refunds.question")}
|
|
44
|
+
* <ChevronDownIcon data-slot="icon" aria-hidden />
|
|
45
|
+
* </Accordion.Trigger>
|
|
46
|
+
* <Accordion.Content>
|
|
47
|
+
* <p>{t("faq.refunds.answer")}</p>
|
|
48
|
+
* </Accordion.Content>
|
|
49
|
+
* </Accordion.Item>
|
|
50
|
+
* <Accordion.Item name="faq">
|
|
51
|
+
* <Accordion.Trigger>
|
|
52
|
+
* {t("faq.shipping.question")}
|
|
53
|
+
* <ChevronDownIcon data-slot="icon" aria-hidden />
|
|
54
|
+
* </Accordion.Trigger>
|
|
55
|
+
* <Accordion.Content>
|
|
56
|
+
* <p>{t("faq.shipping.answer")}</p>
|
|
57
|
+
* </Accordion.Content>
|
|
58
|
+
* </Accordion.Item>
|
|
59
|
+
* </Accordion>
|
|
60
|
+
*/
|
|
61
|
+
export function Accordion(handle) {
|
|
62
|
+
return () => {
|
|
63
|
+
let { children, mix, ...rest } = handle.props;
|
|
64
|
+
return (_jsx("div", { ...rest, mix: [is("full"), mix], children: children }));
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Renders one section as {@link Disclosure} restyled into a flush list row:
|
|
69
|
+
* only a shared block-end divider survives, restored block-start on the first
|
|
70
|
+
* section. A trigger marked `aria-disabled="true"` dims the whole section.
|
|
71
|
+
*
|
|
72
|
+
* @param handle Runtime handle carrying the host `<details>`'s props.
|
|
73
|
+
* @returns The render function producing the section's markup.
|
|
74
|
+
* @example
|
|
75
|
+
* <Accordion.Item>
|
|
76
|
+
* <Accordion.Trigger>
|
|
77
|
+
* {t("faq.refunds.question")}
|
|
78
|
+
* <ChevronDownIcon data-slot="icon" aria-hidden />
|
|
79
|
+
* </Accordion.Trigger>
|
|
80
|
+
* <Accordion.Content>
|
|
81
|
+
* <p>{t("faq.refunds.answer")}</p>
|
|
82
|
+
* </Accordion.Content>
|
|
83
|
+
* </Accordion.Item>
|
|
84
|
+
* @example
|
|
85
|
+
* <Accordion.Item name="faq" open>
|
|
86
|
+
* <Accordion.Trigger>
|
|
87
|
+
* {t("faq.refunds.question")}
|
|
88
|
+
* <ChevronDownIcon data-slot="icon" aria-hidden />
|
|
89
|
+
* </Accordion.Trigger>
|
|
90
|
+
* <Accordion.Content>
|
|
91
|
+
* <p>{t("faq.refunds.answer")}</p>
|
|
92
|
+
* </Accordion.Content>
|
|
93
|
+
* </Accordion.Item>
|
|
94
|
+
*/
|
|
95
|
+
Accordion.Item = function AccordionItem(handle) {
|
|
96
|
+
return () => {
|
|
97
|
+
let { mix, ...rest } = handle.props;
|
|
98
|
+
return (_jsx(Disclosure, { ...rest, mix: [
|
|
99
|
+
rounded("none"),
|
|
100
|
+
borderEdge("inline-start", { width: "0", noStyleDefault: true }),
|
|
101
|
+
borderEdge("inline-end", { width: "0", noStyleDefault: true }),
|
|
102
|
+
borderEdge("block-start", { width: "0", noStyleDefault: true }),
|
|
103
|
+
open(when('& summary [data-slot="icon"]', rotate(180))),
|
|
104
|
+
when("&:first-child", borderEdge("block-start", { width: 1 })),
|
|
105
|
+
when('&:has(> summary[aria-disabled="true"])', opacity(50)),
|
|
106
|
+
mix,
|
|
107
|
+
] }));
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
/**
|
|
111
|
+
* Renders {@link Accordion.TriggerProps.children} as the section's label row,
|
|
112
|
+
* spread to opposite ends and underlined on hover. An icon element carrying
|
|
113
|
+
* `data-slot="icon"` rotates 180 degrees while its section is open.
|
|
114
|
+
*
|
|
115
|
+
* @param handle Runtime handle carrying the host `<summary>`'s props.
|
|
116
|
+
* @returns The render function producing the label row's markup.
|
|
117
|
+
* @example
|
|
118
|
+
* <Accordion.Trigger>
|
|
119
|
+
* {t("faq.refunds.question")}
|
|
120
|
+
* <ChevronDownIcon data-slot="icon" aria-hidden />
|
|
121
|
+
* </Accordion.Trigger>
|
|
122
|
+
* @example
|
|
123
|
+
* <Accordion.Trigger aria-disabled="true">
|
|
124
|
+
* {t("faq.archived.question")}
|
|
125
|
+
* <ChevronDownIcon data-slot="icon" aria-hidden />
|
|
126
|
+
* </Accordion.Trigger>
|
|
127
|
+
*/
|
|
128
|
+
Accordion.Trigger = function AccordionTrigger(handle) {
|
|
129
|
+
return () => {
|
|
130
|
+
let { mix, ...rest } = handle.props;
|
|
131
|
+
return (_jsx(Disclosure.Trigger, { ...rest, mix: [
|
|
132
|
+
justify("between"),
|
|
133
|
+
pb(4),
|
|
134
|
+
pi(0),
|
|
135
|
+
rounded("none"),
|
|
136
|
+
hover([bg("transparent"), textDecoration("underline")]),
|
|
137
|
+
when('& [data-slot="icon"]', [
|
|
138
|
+
is(4),
|
|
139
|
+
bs(4),
|
|
140
|
+
shrink(),
|
|
141
|
+
transition("transform", { duration: "200ms" }),
|
|
142
|
+
]),
|
|
143
|
+
media("(prefers-reduced-motion: reduce)", when('& [data-slot="icon"]', transitionDuration("0s"))),
|
|
144
|
+
mix,
|
|
145
|
+
] }));
|
|
146
|
+
};
|
|
147
|
+
};
|
|
148
|
+
/**
|
|
149
|
+
* Renders {@link Accordion.ContentProps.children} as the section's revealed
|
|
150
|
+
* body: {@link Disclosure.Panel} restyled with block-end padding and small,
|
|
151
|
+
* muted text sized for supporting copy.
|
|
152
|
+
*
|
|
153
|
+
* @param handle Runtime handle carrying the host `<div>`'s props.
|
|
154
|
+
* @returns The render function producing the body's markup.
|
|
155
|
+
* @example
|
|
156
|
+
* <Accordion.Content>
|
|
157
|
+
* <p>{t("faq.refunds.answer")}</p>
|
|
158
|
+
* </Accordion.Content>
|
|
159
|
+
*/
|
|
160
|
+
Accordion.Content = function AccordionContent(handle) {
|
|
161
|
+
return () => {
|
|
162
|
+
let { mix, ...rest } = handle.props;
|
|
163
|
+
return _jsx(Disclosure.Panel, { ...rest, mix: [pbe(4), fg("neutral"), text("sm"), mix] });
|
|
164
|
+
};
|
|
165
|
+
};
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An interruptive modal surface that demands an explicit response before a
|
|
3
|
+
* page continues — confirming a destructive action, surfacing a blocking
|
|
4
|
+
* error — built on the native `<dialog>` host of {@link Dialog}, widened for
|
|
5
|
+
* its two-button layout and sealed against light dismiss. Its compound parts
|
|
6
|
+
* cover a header, title, description, and a two-control footer.
|
|
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 { Button } from "./button.js";
|
|
13
|
+
import { Dialog } from "./dialog.js";
|
|
14
|
+
/**
|
|
15
|
+
* Prop types for {@link AlertDialog} and its compound parts.
|
|
16
|
+
*/
|
|
17
|
+
export declare namespace AlertDialog {
|
|
18
|
+
/**
|
|
19
|
+
* Every prop {@link Dialog} accepts, minus the ones this component fixes:
|
|
20
|
+
* `role` is always `"alertdialog"` and `closedby`/`closedBy` always
|
|
21
|
+
* `"closerequest"`, so the panel closes only on an explicit close request.
|
|
22
|
+
*/
|
|
23
|
+
interface Props extends Omit<Dialog.Props, "role" | "closedby" | "closedBy"> {
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Props accepted by {@link AlertDialog.Header}.
|
|
27
|
+
*/
|
|
28
|
+
interface HeaderProps extends TagProps<"div"> {
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Props accepted by {@link AlertDialog.Title}. Every native heading-element
|
|
32
|
+
* attribute applies, since the rendered tag follows the nearest ambient
|
|
33
|
+
* heading level, falling back to `<h1>`.
|
|
34
|
+
*/
|
|
35
|
+
interface TitleProps extends TagProps<"h1"> {
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Props accepted by {@link AlertDialog.Description}.
|
|
39
|
+
*/
|
|
40
|
+
interface DescriptionProps extends TagProps<"p"> {
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Props accepted by {@link AlertDialog.Footer}.
|
|
44
|
+
*/
|
|
45
|
+
interface FooterProps extends TagProps<"div"> {
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Props accepted by {@link AlertDialog.Action}: every {@link Button.Props}
|
|
49
|
+
* field except `commandfor`/`command`, which this type narrows.
|
|
50
|
+
*/
|
|
51
|
+
interface ActionProps extends Omit<Button.Props, "commandfor" | "command"> {
|
|
52
|
+
/**
|
|
53
|
+
* `id` of the ancestor {@link AlertDialog} this action dismisses.
|
|
54
|
+
* Required for the default `type="button"` action; a `type="submit"`
|
|
55
|
+
* action ends the interruption by submitting its enclosing form.
|
|
56
|
+
*/
|
|
57
|
+
commandfor?: string;
|
|
58
|
+
/**
|
|
59
|
+
* Invoker Commands verb dispatched to the target AlertDialog. Defaults
|
|
60
|
+
* to `"close"`, and is dropped for a `"submit"` or `"reset"` action,
|
|
61
|
+
* which the platform drives as a form control instead of an invoker.
|
|
62
|
+
*/
|
|
63
|
+
command?: "close";
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Props accepted by {@link AlertDialog.Cancel}: every {@link Button.Props}
|
|
67
|
+
* field except `commandfor`/`command`/`type`, which this type narrows.
|
|
68
|
+
*/
|
|
69
|
+
interface CancelProps extends Omit<Button.Props, "commandfor" | "command" | "type"> {
|
|
70
|
+
/** `id` of the ancestor {@link AlertDialog} this cancel control dismisses. */
|
|
71
|
+
commandfor: string;
|
|
72
|
+
/** Invoker Commands verb dispatched to the target AlertDialog. Defaults to `"close"`. */
|
|
73
|
+
command?: "close";
|
|
74
|
+
/**
|
|
75
|
+
* Narrowed to the only value a cancel control carries, and always
|
|
76
|
+
* rendered, since the platform runs its close command only from a
|
|
77
|
+
* button typed `"button"`, including inside a `<form>`.
|
|
78
|
+
*/
|
|
79
|
+
type?: "button";
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Renders the alert panel through {@link Dialog}, widened to fit a two-button
|
|
84
|
+
* footer, with `role` fixed to `"alertdialog"` and `closedby` to
|
|
85
|
+
* `"closerequest"` so the interruption clears through an explicit response.
|
|
86
|
+
*
|
|
87
|
+
* @param handle Runtime handle carrying the host `<dialog>`'s props.
|
|
88
|
+
* @returns The render function producing the panel's markup.
|
|
89
|
+
* @example
|
|
90
|
+
* <Button commandfor="delete-project" command="show-modal" color="danger">{t("project.delete")}</Button>
|
|
91
|
+
* <AlertDialog id="delete-project" aria-labelledby="delete-project-title">
|
|
92
|
+
* <AlertDialog.Header>
|
|
93
|
+
* <AlertDialog.Title id="delete-project-title">{t("project.deleteTitle")}</AlertDialog.Title>
|
|
94
|
+
* <AlertDialog.Description>{t("project.deleteDescription")}</AlertDialog.Description>
|
|
95
|
+
* </AlertDialog.Header>
|
|
96
|
+
* <AlertDialog.Footer>
|
|
97
|
+
* <AlertDialog.Cancel commandfor="delete-project">{t("actions.cancel")}</AlertDialog.Cancel>
|
|
98
|
+
* <AlertDialog.Action commandfor="delete-project">{t("actions.delete")}</AlertDialog.Action>
|
|
99
|
+
* </AlertDialog.Footer>
|
|
100
|
+
* </AlertDialog>
|
|
101
|
+
*/
|
|
102
|
+
export declare function AlertDialog(handle: Handle<AlertDialog.Props>): () => import("remix/ui").RemixElement;
|
|
103
|
+
export declare namespace AlertDialog {
|
|
104
|
+
var Header: (handle: Handle<AlertDialog.HeaderProps>) => () => import("remix/ui").RemixElement;
|
|
105
|
+
var Title: (handle: Handle<AlertDialog.TitleProps>) => () => import("remix/ui").RemixElement;
|
|
106
|
+
var Description: (handle: Handle<AlertDialog.DescriptionProps>) => () => import("remix/ui").RemixElement;
|
|
107
|
+
var Footer: (handle: Handle<AlertDialog.FooterProps>) => () => import("remix/ui").RemixElement;
|
|
108
|
+
var Action: (handle: Handle<AlertDialog.ActionProps>) => () => import("remix/ui").RemixElement;
|
|
109
|
+
var Cancel: (handle: Handle<AlertDialog.CancelProps>) => () => import("remix/ui").RemixElement;
|
|
110
|
+
}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { jsx as _jsx } from "remix/ui/jsx-runtime";
|
|
2
|
+
import { fg } from "@sdxc/u/color";
|
|
3
|
+
import { flex, gap, justify, vstack } from "@sdxc/u/layout";
|
|
4
|
+
import { maxIs, mbs } from "@sdxc/u/size";
|
|
5
|
+
import { text, weight } from "@sdxc/u/typography";
|
|
6
|
+
import { Button } from "./button.js";
|
|
7
|
+
import { Dialog } from "./dialog.js";
|
|
8
|
+
import { resolveHeadingLevel, TAG_BY_LEVEL } from "./heading-scope.js";
|
|
9
|
+
/**
|
|
10
|
+
* Invoker Commands verb {@link AlertDialog.Action} and
|
|
11
|
+
* {@link AlertDialog.Cancel} fall back to when `command` is omitted,
|
|
12
|
+
* dismissing the ancestor AlertDialog named by `commandfor`.
|
|
13
|
+
*/
|
|
14
|
+
const DEFAULT_COMMAND = "close";
|
|
15
|
+
/**
|
|
16
|
+
* Native `button` `type` {@link AlertDialog.Action} and
|
|
17
|
+
* {@link AlertDialog.Cancel} always spell out, since the platform runs an
|
|
18
|
+
* Invoker Command only from a button typed `"button"`, `<form>` or not.
|
|
19
|
+
*/
|
|
20
|
+
const DEFAULT_TYPE = "button";
|
|
21
|
+
/** Semantic color role {@link AlertDialog.Action} falls back to when `color` is omitted. */
|
|
22
|
+
const DEFAULT_ACTION_COLOR = "danger";
|
|
23
|
+
/** Visual weight {@link AlertDialog.Cancel} falls back to when `variant` is omitted. */
|
|
24
|
+
const DEFAULT_CANCEL_VARIANT = "outline";
|
|
25
|
+
/** Semantic color role {@link AlertDialog.Cancel} falls back to when `color` is omitted. */
|
|
26
|
+
const DEFAULT_CANCEL_COLOR = "neutral";
|
|
27
|
+
/**
|
|
28
|
+
* Renders the alert panel through {@link Dialog}, widened to fit a two-button
|
|
29
|
+
* footer, with `role` fixed to `"alertdialog"` and `closedby` to
|
|
30
|
+
* `"closerequest"` so the interruption clears through an explicit response.
|
|
31
|
+
*
|
|
32
|
+
* @param handle Runtime handle carrying the host `<dialog>`'s props.
|
|
33
|
+
* @returns The render function producing the panel's markup.
|
|
34
|
+
* @example
|
|
35
|
+
* <Button commandfor="delete-project" command="show-modal" color="danger">{t("project.delete")}</Button>
|
|
36
|
+
* <AlertDialog id="delete-project" aria-labelledby="delete-project-title">
|
|
37
|
+
* <AlertDialog.Header>
|
|
38
|
+
* <AlertDialog.Title id="delete-project-title">{t("project.deleteTitle")}</AlertDialog.Title>
|
|
39
|
+
* <AlertDialog.Description>{t("project.deleteDescription")}</AlertDialog.Description>
|
|
40
|
+
* </AlertDialog.Header>
|
|
41
|
+
* <AlertDialog.Footer>
|
|
42
|
+
* <AlertDialog.Cancel commandfor="delete-project">{t("actions.cancel")}</AlertDialog.Cancel>
|
|
43
|
+
* <AlertDialog.Action commandfor="delete-project">{t("actions.delete")}</AlertDialog.Action>
|
|
44
|
+
* </AlertDialog.Footer>
|
|
45
|
+
* </AlertDialog>
|
|
46
|
+
*/
|
|
47
|
+
export function AlertDialog(handle) {
|
|
48
|
+
return () => {
|
|
49
|
+
let { children, mix, ...rest } = handle.props;
|
|
50
|
+
return (_jsx(Dialog, { ...rest, role: "alertdialog", closedby: "closerequest", mix: [maxIs("32rem"), mix], children: children }));
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Renders {@link AlertDialog.HeaderProps.children} as the panel's header
|
|
55
|
+
* slot: a column stacking {@link AlertDialog.Title} and
|
|
56
|
+
* {@link AlertDialog.Description} with a small gap between them.
|
|
57
|
+
*
|
|
58
|
+
* @param handle Runtime handle carrying the host `<div>`'s props.
|
|
59
|
+
* @returns The render function producing the header slot's markup.
|
|
60
|
+
* @example
|
|
61
|
+
* <AlertDialog.Header>
|
|
62
|
+
* <AlertDialog.Title>{t("project.deleteTitle")}</AlertDialog.Title>
|
|
63
|
+
* <AlertDialog.Description>{t("project.deleteDescription")}</AlertDialog.Description>
|
|
64
|
+
* </AlertDialog.Header>
|
|
65
|
+
*/
|
|
66
|
+
AlertDialog.Header = function AlertDialogHeader(handle) {
|
|
67
|
+
return () => {
|
|
68
|
+
let { mix, ...rest } = handle.props;
|
|
69
|
+
return _jsx("div", { ...rest, "data-slot": "header", mix: [vstack({ gap: 2 }), mix] });
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Renders {@link AlertDialog.TitleProps.children} as the panel's heading,
|
|
74
|
+
* inside the native heading element matching the nearest ancestor
|
|
75
|
+
* `HeadingScope`'s depth, or `<h1>` where no scope wraps it.
|
|
76
|
+
*
|
|
77
|
+
* @param handle Runtime handle carrying the host heading element's props.
|
|
78
|
+
* @returns The render function producing the heading's markup.
|
|
79
|
+
* @example
|
|
80
|
+
* <AlertDialog.Title>{t("project.deleteTitle")}</AlertDialog.Title>
|
|
81
|
+
*/
|
|
82
|
+
AlertDialog.Title = function AlertDialogTitle(handle) {
|
|
83
|
+
return () => {
|
|
84
|
+
let { mix, ...rest } = handle.props;
|
|
85
|
+
let resolved = resolveHeadingLevel(handle);
|
|
86
|
+
let Tag = TAG_BY_LEVEL[resolved];
|
|
87
|
+
return (_jsx(Tag, { ...rest, "data-slot": "title", mix: [fg("neutral.emphasis"), weight("semibold"), text("lg"), mix], children: rest.children }));
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* Renders {@link AlertDialog.DescriptionProps.children} as the panel's
|
|
92
|
+
* supporting copy, in a native `<p>` set to the panel's muted foreground
|
|
93
|
+
* color so it reads as secondary to {@link AlertDialog.Title}.
|
|
94
|
+
*
|
|
95
|
+
* @param handle Runtime handle carrying the host `<p>`'s props.
|
|
96
|
+
* @returns The render function producing the description's markup.
|
|
97
|
+
* @example
|
|
98
|
+
* <AlertDialog.Description>{t("project.deleteDescription")}</AlertDialog.Description>
|
|
99
|
+
*/
|
|
100
|
+
AlertDialog.Description = function AlertDialogDescription(handle) {
|
|
101
|
+
return () => {
|
|
102
|
+
let { mix, ...rest } = handle.props;
|
|
103
|
+
return (_jsx("p", { ...rest, "data-slot": "description", mix: [fg("neutral.muted"), text("sm"), mix], children: rest.children }));
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* Renders {@link AlertDialog.FooterProps.children} as an end-aligned action
|
|
108
|
+
* row. Compose {@link AlertDialog.Cancel} before {@link AlertDialog.Action}
|
|
109
|
+
* so the emphasized, potentially destructive control renders last.
|
|
110
|
+
*
|
|
111
|
+
* @param handle Runtime handle carrying the host `<div>`'s props.
|
|
112
|
+
* @returns The render function producing the action row's markup.
|
|
113
|
+
* @example
|
|
114
|
+
* <AlertDialog.Footer>
|
|
115
|
+
* <AlertDialog.Cancel commandfor="delete-project">{t("actions.cancel")}</AlertDialog.Cancel>
|
|
116
|
+
* <AlertDialog.Action commandfor="delete-project">{t("actions.delete")}</AlertDialog.Action>
|
|
117
|
+
* </AlertDialog.Footer>
|
|
118
|
+
*/
|
|
119
|
+
AlertDialog.Footer = function AlertDialogFooter(handle) {
|
|
120
|
+
return () => {
|
|
121
|
+
let { mix, ...rest } = handle.props;
|
|
122
|
+
return _jsx("div", { ...rest, "data-slot": "footer", mix: [gap(2), mbs(6), flex(), justify("end"), mix] });
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* Renders the panel's emphasized action as a danger-toned {@link Button},
|
|
127
|
+
* typed `"button"` so its `command="close"` reaches the {@link AlertDialog}
|
|
128
|
+
* named by `commandfor`; `type="submit"` submits the enclosing form instead.
|
|
129
|
+
*
|
|
130
|
+
* @param handle Runtime handle carrying the host button's props.
|
|
131
|
+
* @returns The render function producing the action's markup.
|
|
132
|
+
* @example
|
|
133
|
+
* <AlertDialog.Action commandfor="delete-project">{t("actions.delete")}</AlertDialog.Action>
|
|
134
|
+
* @example
|
|
135
|
+
* <AlertDialog.Action commandfor="publish-post" color="brand">{t("actions.publish")}</AlertDialog.Action>
|
|
136
|
+
* @example
|
|
137
|
+
* <AlertDialog.Action type="submit" name="intent" value="delete">{t("actions.delete")}</AlertDialog.Action>
|
|
138
|
+
*/
|
|
139
|
+
AlertDialog.Action = function AlertDialogAction(handle) {
|
|
140
|
+
return () => {
|
|
141
|
+
let { type, color, command, commandfor, ...rest } = handle.props;
|
|
142
|
+
let resolvedType = type ?? DEFAULT_TYPE;
|
|
143
|
+
let isInvoker = resolvedType === "button";
|
|
144
|
+
let resolvedColor = color ?? DEFAULT_ACTION_COLOR;
|
|
145
|
+
if (import.meta.env.DEV && isInvoker && !commandfor) {
|
|
146
|
+
console.warn('AlertDialog.Action: needs "commandfor" naming the panel it dismisses, or type="submit" to submit its enclosing form instead — as rendered, pressing it does nothing.');
|
|
147
|
+
}
|
|
148
|
+
return (_jsx(Button, { ...rest, type: resolvedType, color: resolvedColor, commandfor: isInvoker ? commandfor : undefined, command: isInvoker ? (command ?? DEFAULT_COMMAND) : undefined, "data-slot": "action" }));
|
|
149
|
+
};
|
|
150
|
+
};
|
|
151
|
+
/**
|
|
152
|
+
* Renders the panel's dismiss control as an outline, neutral {@link Button}
|
|
153
|
+
* with `type` fixed to `"button"`, so its `command="close"` reaches the
|
|
154
|
+
* {@link AlertDialog} named by `commandfor` from inside a `<form>` too.
|
|
155
|
+
*
|
|
156
|
+
* @param handle Runtime handle carrying the host button's props.
|
|
157
|
+
* @returns The render function producing the cancel control's markup.
|
|
158
|
+
* @example
|
|
159
|
+
* <AlertDialog.Cancel commandfor="delete-project">{t("actions.cancel")}</AlertDialog.Cancel>
|
|
160
|
+
*/
|
|
161
|
+
AlertDialog.Cancel = function AlertDialogCancel(handle) {
|
|
162
|
+
return () => {
|
|
163
|
+
let { variant, color, command, ...rest } = handle.props;
|
|
164
|
+
let resolvedVariant = variant ?? DEFAULT_CANCEL_VARIANT;
|
|
165
|
+
let resolvedColor = color ?? DEFAULT_CANCEL_COLOR;
|
|
166
|
+
let resolvedCommand = command ?? DEFAULT_COMMAND;
|
|
167
|
+
return (_jsx(Button, { ...rest, type: DEFAULT_TYPE, variant: resolvedVariant, color: resolvedColor, command: resolvedCommand, "data-slot": "cancel" }));
|
|
168
|
+
};
|
|
169
|
+
};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An inline status message rendered as a bordered, tinted panel, colored by
|
|
3
|
+
* one of five semantic tones and announced to assistive technology through
|
|
4
|
+
* `role="alert"` plus a configurable `aria-live` politeness. Compound parts
|
|
5
|
+
* cover an optional leading icon, a title/description content block, and a
|
|
6
|
+
* trailing action, so a page composes only the parts a given message needs.
|
|
7
|
+
*
|
|
8
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
9
|
+
* @copyright Sergio Xalambrí 2026
|
|
10
|
+
*/
|
|
11
|
+
import type { Handle, Props as TagProps, RemixNode } from "remix/ui";
|
|
12
|
+
import type { SemanticColor } from "../utils/semantic-color.js";
|
|
13
|
+
/**
|
|
14
|
+
* Prop types for {@link Alert} and its compound parts.
|
|
15
|
+
*/
|
|
16
|
+
export declare namespace Alert {
|
|
17
|
+
/**
|
|
18
|
+
* Semantic tone driving the host element's border, tint, and foreground
|
|
19
|
+
* color through the `--ui-*` variables for that color.
|
|
20
|
+
*/
|
|
21
|
+
type Color = SemanticColor;
|
|
22
|
+
/**
|
|
23
|
+
* `aria-live` politeness applied to the host element. `"off"` omits the
|
|
24
|
+
* `aria-live` attribute, leaving the element's implicit live-region
|
|
25
|
+
* behavior in place.
|
|
26
|
+
*/
|
|
27
|
+
type Live = "polite" | "assertive" | "off";
|
|
28
|
+
/**
|
|
29
|
+
* Props accepted by {@link Alert}.
|
|
30
|
+
*/
|
|
31
|
+
interface Props extends TagProps<"div"> {
|
|
32
|
+
/** Semantic tone of the alert. Default: `"neutral"`. */
|
|
33
|
+
color?: Color;
|
|
34
|
+
/** `aria-live` politeness for dynamic alerts. Default: `"polite"`. */
|
|
35
|
+
live?: Live;
|
|
36
|
+
/** The alert's compound parts: {@link Alert.Icon}, {@link Alert.Content}, {@link Alert.Action}, or any other content. */
|
|
37
|
+
children: RemixNode;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Props accepted by {@link Alert.Icon}.
|
|
41
|
+
*/
|
|
42
|
+
interface IconProps extends TagProps<"div"> {
|
|
43
|
+
/** The icon graphic, typically a single SVG icon. */
|
|
44
|
+
children: RemixNode;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Props accepted by {@link Alert.Content}.
|
|
48
|
+
*/
|
|
49
|
+
interface ContentProps extends TagProps<"div"> {
|
|
50
|
+
/** The alert's title, description, or other body content. */
|
|
51
|
+
children: RemixNode;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Props accepted by {@link Alert.Title}. Every native heading-element
|
|
55
|
+
* attribute applies, since the rendered tag follows the nearest ambient
|
|
56
|
+
* heading level, falling back to `<h1>`.
|
|
57
|
+
*/
|
|
58
|
+
interface TitleProps extends TagProps<"h1"> {
|
|
59
|
+
/** The alert's heading text. */
|
|
60
|
+
children: RemixNode;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Props accepted by {@link Alert.Description}.
|
|
64
|
+
*/
|
|
65
|
+
interface DescriptionProps extends TagProps<"p"> {
|
|
66
|
+
/** The alert's supporting message text. */
|
|
67
|
+
children: RemixNode;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Props accepted by {@link Alert.Action}.
|
|
71
|
+
*/
|
|
72
|
+
interface ActionProps extends TagProps<"div"> {
|
|
73
|
+
/** A button, link, or other control the alert offers, e.g. "Retry" or "Dismiss". */
|
|
74
|
+
children: RemixNode;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Renders an inline status panel tinted by {@link Alert.Props.color}, gaining
|
|
79
|
+
* inline-start padding through `:has()` when a direct {@link Alert.Icon}
|
|
80
|
+
* needs the room. `role`, `aria-atomic`, and `aria-live` stay overridable.
|
|
81
|
+
*
|
|
82
|
+
* @param handle Runtime handle carrying the host `<div>`'s props.
|
|
83
|
+
* @returns The render function producing the alert's markup.
|
|
84
|
+
* @example
|
|
85
|
+
* <Alert color="danger">
|
|
86
|
+
* <Alert.Icon><CircleAlertIcon /></Alert.Icon>
|
|
87
|
+
* <Alert.Content>
|
|
88
|
+
* <Alert.Title>{t("alerts.paymentFailed.title")}</Alert.Title>
|
|
89
|
+
* <Alert.Description>{t("alerts.paymentFailed.description")}</Alert.Description>
|
|
90
|
+
* </Alert.Content>
|
|
91
|
+
* <Alert.Action>
|
|
92
|
+
* <Button size="sm">{t("alerts.paymentFailed.retry")}</Button>
|
|
93
|
+
* </Alert.Action>
|
|
94
|
+
* </Alert>
|
|
95
|
+
* @example
|
|
96
|
+
* <Alert color="success" live="assertive">
|
|
97
|
+
* <Alert.Content>
|
|
98
|
+
* <Alert.Title>{t("alerts.saved.title")}</Alert.Title>
|
|
99
|
+
* </Alert.Content>
|
|
100
|
+
* </Alert>
|
|
101
|
+
*/
|
|
102
|
+
export declare function Alert(handle: Handle<Alert.Props>): () => import("remix/ui").RemixElement;
|
|
103
|
+
export declare namespace Alert {
|
|
104
|
+
var Icon: (handle: Handle<Alert.IconProps>) => () => import("remix/ui").RemixElement;
|
|
105
|
+
var Content: (handle: Handle<Alert.ContentProps>) => () => import("remix/ui").RemixElement;
|
|
106
|
+
var Title: (handle: Handle<Alert.TitleProps>) => () => import("remix/ui").RemixElement;
|
|
107
|
+
var Description: (handle: Handle<Alert.DescriptionProps>) => () => import("remix/ui").RemixElement;
|
|
108
|
+
var Action: (handle: Handle<Alert.ActionProps>) => () => import("remix/ui").RemixElement;
|
|
109
|
+
}
|