@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,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A single conversational turn in a message log: a row composing a
|
|
3
|
+
* bottom-anchored avatar, a header for the sender's identity and timing, a
|
|
4
|
+
* content slot for the message's own surface, and an optional footer for its
|
|
5
|
+
* actions. Compound parts lay out entirely through CSS grid areas keyed off
|
|
6
|
+
* each part's `data-slot`, so the avatar's vertical anchor and the footer's
|
|
7
|
+
* presence never need to be tracked as state.
|
|
8
|
+
*
|
|
9
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
10
|
+
* @copyright Sergio Xalambrí 2026
|
|
11
|
+
*/
|
|
12
|
+
import type { Handle, Props as TagProps, RemixNode } from "remix/ui";
|
|
13
|
+
/**
|
|
14
|
+
* Prop types for {@link Message} and its compound parts.
|
|
15
|
+
*/
|
|
16
|
+
export declare namespace Message {
|
|
17
|
+
/**
|
|
18
|
+
* Props accepted by {@link Message}.
|
|
19
|
+
*/
|
|
20
|
+
interface Props extends TagProps<"article"> {
|
|
21
|
+
/** The row's compound parts: {@link Message.Avatar}, {@link Message.Header}, {@link Message.Content}, and an optional {@link Message.Footer}. */
|
|
22
|
+
children: RemixNode;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Props accepted by {@link Message.Avatar}.
|
|
26
|
+
*/
|
|
27
|
+
interface AvatarProps extends TagProps<"div"> {
|
|
28
|
+
/** An Avatar instance identifying the message's sender. */
|
|
29
|
+
children: RemixNode;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Props accepted by {@link Message.Header}.
|
|
33
|
+
*/
|
|
34
|
+
interface HeaderProps extends TagProps<"header"> {
|
|
35
|
+
/** The sender's name, typically followed by a timestamp. */
|
|
36
|
+
children: RemixNode;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Props accepted by {@link Message.Content}.
|
|
40
|
+
*/
|
|
41
|
+
interface ContentProps extends TagProps<"div"> {
|
|
42
|
+
/** The message's own surface — a Bubble, an attachment card, or any other rendered turn content. */
|
|
43
|
+
children: RemixNode;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Props accepted by {@link Message.Footer}.
|
|
47
|
+
*/
|
|
48
|
+
interface FooterProps extends TagProps<"footer"> {
|
|
49
|
+
/** The row's actions, typically a copy Button and a like Button. */
|
|
50
|
+
children: RemixNode;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Props accepted by {@link Message.Group}.
|
|
54
|
+
*/
|
|
55
|
+
interface GroupProps extends TagProps<"div"> {
|
|
56
|
+
/** A run of consecutive {@link Message} rows sharing the same sender. */
|
|
57
|
+
children: RemixNode;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Renders the message row as a two-column grid whose `"avatar"` area spans only the
|
|
62
|
+
* header and content rows, anchoring {@link Message.Avatar} to the bottom edge
|
|
63
|
+
* of {@link Message.Content}, regardless of whether {@link Message.Footer} renders.
|
|
64
|
+
*
|
|
65
|
+
* @param handle Runtime handle carrying the host `<article>`'s props.
|
|
66
|
+
* @returns The render function producing the row's markup.
|
|
67
|
+
* @example
|
|
68
|
+
* <Message>
|
|
69
|
+
* <Message.Avatar>
|
|
70
|
+
* <Avatar>
|
|
71
|
+
* <Avatar.Image src={sender.avatarUrl} alt={sender.name} />
|
|
72
|
+
* <Avatar.Fallback>{sender.initials}</Avatar.Fallback>
|
|
73
|
+
* </Avatar>
|
|
74
|
+
* </Message.Avatar>
|
|
75
|
+
* <Message.Header>
|
|
76
|
+
* <strong>{sender.name}</strong>
|
|
77
|
+
* <time dateTime={message.sentAt}>{formattedTime}</time>
|
|
78
|
+
* </Message.Header>
|
|
79
|
+
* <Message.Content>
|
|
80
|
+
* <Bubble>{message.text}</Bubble>
|
|
81
|
+
* </Message.Content>
|
|
82
|
+
* <Message.Footer>
|
|
83
|
+
* <Button
|
|
84
|
+
* aria-label={t("message.copy")}
|
|
85
|
+
* commandfor={`${message.id}-text`}
|
|
86
|
+
* command={COPY_COMMAND}
|
|
87
|
+
* mix={copyToClipboard()}
|
|
88
|
+
* >
|
|
89
|
+
* <CopyIcon />
|
|
90
|
+
* </Button>
|
|
91
|
+
* <Button aria-label={t("message.like")} onClick={likeMessage}>
|
|
92
|
+
* <ThumbsUpIcon />
|
|
93
|
+
* </Button>
|
|
94
|
+
* </Message.Footer>
|
|
95
|
+
* </Message>
|
|
96
|
+
*/
|
|
97
|
+
export declare function Message(handle: Handle<Message.Props>): () => import("remix/ui").RemixElement;
|
|
98
|
+
export declare namespace Message {
|
|
99
|
+
var Avatar: (handle: Handle<Message.AvatarProps>) => () => import("remix/ui").RemixElement;
|
|
100
|
+
var Header: (handle: Handle<Message.HeaderProps>) => () => import("remix/ui").RemixElement;
|
|
101
|
+
var Content: (handle: Handle<Message.ContentProps>) => () => import("remix/ui").RemixElement;
|
|
102
|
+
var Footer: (handle: Handle<Message.FooterProps>) => () => import("remix/ui").RemixElement;
|
|
103
|
+
var Group: (handle: Handle<Message.GroupProps>) => () => import("remix/ui").RemixElement;
|
|
104
|
+
}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { jsx as _jsx } from "remix/ui/jsx-runtime";
|
|
2
|
+
import { fg } from "@sdxc/u/color";
|
|
3
|
+
import { container, flex, flexWrap, gap, grid, gridArea, gridTemplate, hstack, items, justify, relative, self, vstack, } from "@sdxc/u/layout";
|
|
4
|
+
import { at } from "@sdxc/u/responsive";
|
|
5
|
+
import { maxIs, minIs } from "@sdxc/u/size";
|
|
6
|
+
import { when } from "@sdxc/u/state";
|
|
7
|
+
import { fontSize, weight } from "@sdxc/u/typography";
|
|
8
|
+
/**
|
|
9
|
+
* Named container {@link Message} declares on its own host, so
|
|
10
|
+
* {@link Message.Header} can query the row's own width instead of the
|
|
11
|
+
* page's, matching whether it renders full-page or in a narrower panel.
|
|
12
|
+
*/
|
|
13
|
+
const CONTAINER_NAME = "ui-message";
|
|
14
|
+
/**
|
|
15
|
+
* Renders the message row as a two-column grid whose `"avatar"` area spans only the
|
|
16
|
+
* header and content rows, anchoring {@link Message.Avatar} to the bottom edge
|
|
17
|
+
* of {@link Message.Content}, regardless of whether {@link Message.Footer} renders.
|
|
18
|
+
*
|
|
19
|
+
* @param handle Runtime handle carrying the host `<article>`'s props.
|
|
20
|
+
* @returns The render function producing the row's markup.
|
|
21
|
+
* @example
|
|
22
|
+
* <Message>
|
|
23
|
+
* <Message.Avatar>
|
|
24
|
+
* <Avatar>
|
|
25
|
+
* <Avatar.Image src={sender.avatarUrl} alt={sender.name} />
|
|
26
|
+
* <Avatar.Fallback>{sender.initials}</Avatar.Fallback>
|
|
27
|
+
* </Avatar>
|
|
28
|
+
* </Message.Avatar>
|
|
29
|
+
* <Message.Header>
|
|
30
|
+
* <strong>{sender.name}</strong>
|
|
31
|
+
* <time dateTime={message.sentAt}>{formattedTime}</time>
|
|
32
|
+
* </Message.Header>
|
|
33
|
+
* <Message.Content>
|
|
34
|
+
* <Bubble>{message.text}</Bubble>
|
|
35
|
+
* </Message.Content>
|
|
36
|
+
* <Message.Footer>
|
|
37
|
+
* <Button
|
|
38
|
+
* aria-label={t("message.copy")}
|
|
39
|
+
* commandfor={`${message.id}-text`}
|
|
40
|
+
* command={COPY_COMMAND}
|
|
41
|
+
* mix={copyToClipboard()}
|
|
42
|
+
* >
|
|
43
|
+
* <CopyIcon />
|
|
44
|
+
* </Button>
|
|
45
|
+
* <Button aria-label={t("message.like")} onClick={likeMessage}>
|
|
46
|
+
* <ThumbsUpIcon />
|
|
47
|
+
* </Button>
|
|
48
|
+
* </Message.Footer>
|
|
49
|
+
* </Message>
|
|
50
|
+
*/
|
|
51
|
+
export function Message(handle) {
|
|
52
|
+
return () => {
|
|
53
|
+
let { children, mix, ...rest } = handle.props;
|
|
54
|
+
return (_jsx("article", { ...rest, "data-slot": "message", mix: [
|
|
55
|
+
relative(),
|
|
56
|
+
grid(),
|
|
57
|
+
gap("var(--ui-message-row-gap, 0.25rem)", "var(--ui-message-gap, 0.75rem)"),
|
|
58
|
+
container(CONTAINER_NAME),
|
|
59
|
+
gridTemplate({
|
|
60
|
+
columns: "auto 1fr",
|
|
61
|
+
areas: `"avatar header" "avatar content" ". footer"`,
|
|
62
|
+
}),
|
|
63
|
+
when('& > [data-slot="avatar"]', [gridArea("avatar"), self("end")]),
|
|
64
|
+
when('& > [data-slot="header"]', gridArea("header")),
|
|
65
|
+
when('& > [data-slot="content"]', gridArea("content")),
|
|
66
|
+
when('& > [data-slot="footer"]', gridArea("footer")),
|
|
67
|
+
mix,
|
|
68
|
+
], children: children }));
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Renders {@link Message.AvatarProps.children} as the row's avatar slot,
|
|
73
|
+
* aligned to the `"avatar"` area's block-end edge so it tracks the bottom
|
|
74
|
+
* edge of {@link Message.Content}. Nest an Avatar instance inside it.
|
|
75
|
+
*
|
|
76
|
+
* @param handle Runtime handle carrying the host `<div>`'s props.
|
|
77
|
+
* @returns The render function producing the avatar slot's markup.
|
|
78
|
+
* @example
|
|
79
|
+
* <Message.Avatar>
|
|
80
|
+
* <Avatar>
|
|
81
|
+
* <Avatar.Image src={sender.avatarUrl} alt={sender.name} />
|
|
82
|
+
* <Avatar.Fallback>{sender.initials}</Avatar.Fallback>
|
|
83
|
+
* </Avatar>
|
|
84
|
+
* </Message.Avatar>
|
|
85
|
+
*/
|
|
86
|
+
Message.Avatar = function MessageAvatar(handle) {
|
|
87
|
+
return () => {
|
|
88
|
+
let { children, mix, ...rest } = handle.props;
|
|
89
|
+
return (_jsx("div", { ...rest, "data-slot": "avatar", mix: [flex(), mix], children: children }));
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* Renders {@link Message.HeaderProps.children} as the row's identity line,
|
|
94
|
+
* wrapping until the `ui-message` container passes `26rem`, then settling
|
|
95
|
+
* onto one row with the sender's name first and later children as secondary metadata.
|
|
96
|
+
*
|
|
97
|
+
* @param handle Runtime handle carrying the host `<header>`'s props.
|
|
98
|
+
* @returns The render function producing the identity line's markup.
|
|
99
|
+
* @example
|
|
100
|
+
* <Message.Header>
|
|
101
|
+
* <strong>{sender.name}</strong>
|
|
102
|
+
* <time dateTime={message.sentAt}>{formattedTime}</time>
|
|
103
|
+
* </Message.Header>
|
|
104
|
+
*/
|
|
105
|
+
Message.Header = function MessageHeader(handle) {
|
|
106
|
+
return () => {
|
|
107
|
+
let { children, mix, ...rest } = handle.props;
|
|
108
|
+
return (_jsx("header", { ...rest, "data-slot": "header", mix: [
|
|
109
|
+
flex(),
|
|
110
|
+
flexWrap("wrap"),
|
|
111
|
+
items("baseline"),
|
|
112
|
+
gap("0.125rem", "0.5rem"),
|
|
113
|
+
when("& > :first-child", [fontSize("sm"), weight("semibold"), fg("neutral.emphasis")]),
|
|
114
|
+
when("& > :not(:first-child)", [fontSize("xs"), fg("neutral.muted")]),
|
|
115
|
+
at("26rem", CONTAINER_NAME, [flexWrap("nowrap"), justify("between")]),
|
|
116
|
+
mix,
|
|
117
|
+
], children: children }));
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* Renders {@link Message.ContentProps.children} as the row's content slot,
|
|
122
|
+
* capped to a comfortable reading measure and never narrower than its grid
|
|
123
|
+
* area. Nest a Bubble, attachment card, or other turn content inside it.
|
|
124
|
+
*
|
|
125
|
+
* @param handle Runtime handle carrying the host `<div>`'s props.
|
|
126
|
+
* @returns The render function producing the content slot's markup.
|
|
127
|
+
* @example
|
|
128
|
+
* <Message.Content>
|
|
129
|
+
* <Bubble>{message.text}</Bubble>
|
|
130
|
+
* </Message.Content>
|
|
131
|
+
*/
|
|
132
|
+
Message.Content = function MessageContent(handle) {
|
|
133
|
+
return () => {
|
|
134
|
+
let { children, mix, ...rest } = handle.props;
|
|
135
|
+
return (_jsx("div", { ...rest, "data-slot": "content", mix: [
|
|
136
|
+
vstack({ gap: "0.375rem" }),
|
|
137
|
+
minIs("0"),
|
|
138
|
+
maxIs("var(--ui-message-content-max-size, 36rem)"),
|
|
139
|
+
mix,
|
|
140
|
+
], children: children }));
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* Renders {@link Message.FooterProps.children} as the row's action slot,
|
|
145
|
+
* occupying the grid's `"footer"` area beneath {@link Message.Content} and
|
|
146
|
+
* never reached by {@link Message.Avatar}'s bottom anchor.
|
|
147
|
+
*
|
|
148
|
+
* @param handle Runtime handle carrying the host `<footer>`'s props.
|
|
149
|
+
* @returns The render function producing the action slot's markup.
|
|
150
|
+
* @example
|
|
151
|
+
* <Message.Footer>
|
|
152
|
+
* <Button
|
|
153
|
+
* aria-label={t("message.copy")}
|
|
154
|
+
* commandfor={`${message.id}-text`}
|
|
155
|
+
* command={COPY_COMMAND}
|
|
156
|
+
* mix={copyToClipboard()}
|
|
157
|
+
* >
|
|
158
|
+
* <CopyIcon />
|
|
159
|
+
* </Button>
|
|
160
|
+
* <Button aria-label={t("message.like")} onClick={likeMessage}>
|
|
161
|
+
* <ThumbsUpIcon />
|
|
162
|
+
* </Button>
|
|
163
|
+
* </Message.Footer>
|
|
164
|
+
*/
|
|
165
|
+
Message.Footer = function MessageFooter(handle) {
|
|
166
|
+
return () => {
|
|
167
|
+
let { children, mix, ...rest } = handle.props;
|
|
168
|
+
return (_jsx("footer", { ...rest, "data-slot": "footer", mix: [hstack({ align: "center", gap: "0.25rem" }), mix], children: children }));
|
|
169
|
+
};
|
|
170
|
+
};
|
|
171
|
+
/**
|
|
172
|
+
* Renders {@link Message.GroupProps.children} as a run of consecutive
|
|
173
|
+
* {@link Message} rows sharing the same sender, stacked with a hairline gap
|
|
174
|
+
* that reads as one continuous turn.
|
|
175
|
+
*
|
|
176
|
+
* @param handle Runtime handle carrying the host `<div>`'s props.
|
|
177
|
+
* @returns The render function producing the group's markup.
|
|
178
|
+
* @example
|
|
179
|
+
* <Message.Group>
|
|
180
|
+
* <Message>
|
|
181
|
+
* <Message.Header>{sender.name}</Message.Header>
|
|
182
|
+
* <Message.Content><Bubble>{firstReply.text}</Bubble></Message.Content>
|
|
183
|
+
* </Message>
|
|
184
|
+
* <Message>
|
|
185
|
+
* <Message.Avatar>
|
|
186
|
+
* <Avatar>
|
|
187
|
+
* <Avatar.Image src={sender.avatarUrl} alt={sender.name} />
|
|
188
|
+
* <Avatar.Fallback>{sender.initials}</Avatar.Fallback>
|
|
189
|
+
* </Avatar>
|
|
190
|
+
* </Message.Avatar>
|
|
191
|
+
* <Message.Content><Bubble>{secondReply.text}</Bubble></Message.Content>
|
|
192
|
+
* </Message>
|
|
193
|
+
* </Message.Group>
|
|
194
|
+
*/
|
|
195
|
+
Message.Group = function MessageGroup(handle) {
|
|
196
|
+
return () => {
|
|
197
|
+
let { children, mix, ...rest } = handle.props;
|
|
198
|
+
return (_jsx("div", { ...rest, "data-slot": "group", mix: [vstack({ gap: "var(--ui-message-group-gap, 0.125rem)" }), mix], children: children }));
|
|
199
|
+
};
|
|
200
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A styled native `<meter>` gauge paired with an optional value label,
|
|
3
|
+
* stacked in a single column so a caption can sit alongside the bar it
|
|
4
|
+
* measures. The gauge's track and fill read entirely from the control's own
|
|
5
|
+
* `value`/`min`/`max` attributes, tinted by a semantic color role chosen
|
|
6
|
+
* independently of the platform's own optimum/suboptimum quality coloring.
|
|
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 Meter} and its compound parts.
|
|
14
|
+
*/
|
|
15
|
+
export declare namespace Meter {
|
|
16
|
+
/**
|
|
17
|
+
* Semantic color role, each mapped to its matching `--ui-*-bg-solid`
|
|
18
|
+
* variable for the gauge's filled portion.
|
|
19
|
+
*/
|
|
20
|
+
type Color = "brand" | "neutral" | "success" | "warning" | "danger";
|
|
21
|
+
/**
|
|
22
|
+
* Every native `<div>` attribute, unchanged, plus the `mix` passthrough.
|
|
23
|
+
* The root only supplies the column layout stacking {@link Indicator} and
|
|
24
|
+
* {@link ValueLabel}; it carries no semantics of its own.
|
|
25
|
+
*/
|
|
26
|
+
interface Props extends TagProps<"div"> {
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Every native `<meter>` attribute, unchanged, plus `color` and the `mix`
|
|
30
|
+
* passthrough. `max` defaults to {@link DEFAULT_MAX}, so a bare `value`
|
|
31
|
+
* reads directly as a percentage.
|
|
32
|
+
*/
|
|
33
|
+
interface IndicatorProps extends TagProps<"meter"> {
|
|
34
|
+
/** Semantic color role for the gauge's fill. Defaults to {@link DEFAULT_COLOR}. */
|
|
35
|
+
color?: Color;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Every native `<span>` attribute, unchanged, plus the `mix` passthrough.
|
|
39
|
+
*/
|
|
40
|
+
interface ValueLabelProps extends TagProps<"span"> {
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Renders the root column: a `<div>` stacking {@link Meter.Indicator} and an
|
|
45
|
+
* optional {@link Meter.ValueLabel} with a small gap. The native `<meter>`
|
|
46
|
+
* inside already exposes the platform's meter semantics.
|
|
47
|
+
*
|
|
48
|
+
* @param handle Runtime handle carrying the host `<div>`'s props.
|
|
49
|
+
* @returns The render function producing the root column's markup.
|
|
50
|
+
* @example
|
|
51
|
+
* <Meter>
|
|
52
|
+
* <Meter.Indicator value={45} max={100} aria-label={t("storage.used")} />
|
|
53
|
+
* <Meter.ValueLabel>{t("storage.percent", { value: 45 })}</Meter.ValueLabel>
|
|
54
|
+
* </Meter>
|
|
55
|
+
*/
|
|
56
|
+
export declare function Meter(handle: Handle<Meter.Props>): () => import("remix/ui").RemixElement;
|
|
57
|
+
export declare namespace Meter {
|
|
58
|
+
var Indicator: (handle: Handle<Meter.IndicatorProps>) => () => import("remix/ui").RemixElement;
|
|
59
|
+
var ValueLabel: (handle: Handle<Meter.ValueLabelProps>) => () => import("remix/ui").RemixElement;
|
|
60
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { jsx as _jsx } from "remix/ui/jsx-runtime";
|
|
2
|
+
import { bg, border, fg } from "@sdxc/u/color";
|
|
3
|
+
import { rounded, transition } from "@sdxc/u/effects";
|
|
4
|
+
import { raw } from "@sdxc/u/general";
|
|
5
|
+
import { appearance, block, vstack } from "@sdxc/u/layout";
|
|
6
|
+
import { overflow } from "@sdxc/u/overflow";
|
|
7
|
+
import { media } from "@sdxc/u/responsive";
|
|
8
|
+
import { bs, is, m, p } from "@sdxc/u/size";
|
|
9
|
+
import { data, when } from "@sdxc/u/state";
|
|
10
|
+
import { text } from "@sdxc/u/typography";
|
|
11
|
+
import { warnIfNoAccessibleLabel } from "../utils/warn-if-no-accessible-name.js";
|
|
12
|
+
/** Semantic color role {@link Meter.Indicator} falls back to when `color` is omitted. */
|
|
13
|
+
const DEFAULT_COLOR = "neutral";
|
|
14
|
+
/**
|
|
15
|
+
* Native `max` value {@link Meter.Indicator} falls back to when `max` is
|
|
16
|
+
* omitted, matching the common percentage-based convention for a bare `value`.
|
|
17
|
+
*/
|
|
18
|
+
const DEFAULT_MAX = 100;
|
|
19
|
+
/**
|
|
20
|
+
* Selector list matching every engine's pseudo-element for a meter's fill:
|
|
21
|
+
* WebKit/Blink split it in three depending on `value` vs. `low`/`high`/
|
|
22
|
+
* `optimum`; Gecko exposes one. All four resolve their color from `data-color`.
|
|
23
|
+
*/
|
|
24
|
+
const FILL_PSEUDO_ELEMENTS = "&::-webkit-meter-optimum-value, &::-webkit-meter-suboptimum-value, &::-webkit-meter-even-less-good-value, &::-moz-meter-bar";
|
|
25
|
+
/**
|
|
26
|
+
* Renders the root column: a `<div>` stacking {@link Meter.Indicator} and an
|
|
27
|
+
* optional {@link Meter.ValueLabel} with a small gap. The native `<meter>`
|
|
28
|
+
* inside already exposes the platform's meter semantics.
|
|
29
|
+
*
|
|
30
|
+
* @param handle Runtime handle carrying the host `<div>`'s props.
|
|
31
|
+
* @returns The render function producing the root column's markup.
|
|
32
|
+
* @example
|
|
33
|
+
* <Meter>
|
|
34
|
+
* <Meter.Indicator value={45} max={100} aria-label={t("storage.used")} />
|
|
35
|
+
* <Meter.ValueLabel>{t("storage.percent", { value: 45 })}</Meter.ValueLabel>
|
|
36
|
+
* </Meter>
|
|
37
|
+
*/
|
|
38
|
+
export function Meter(handle) {
|
|
39
|
+
return () => {
|
|
40
|
+
let { mix, ...rest } = handle.props;
|
|
41
|
+
return _jsx("div", { ...rest, mix: [vstack({ gap: "0.25rem" }), mix] });
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Renders the gauge as a pill-shaped track filled in a semantic `color`,
|
|
46
|
+
* mirrored across each engine's fill pseudo-elements so `low`/`high`/`optimum`
|
|
47
|
+
* keep shaping accessible semantics independently of the rendered color; dev mode warns when no accessible name is set.
|
|
48
|
+
*
|
|
49
|
+
* @param handle Runtime handle carrying the host `<meter>`'s props.
|
|
50
|
+
* @returns The render function producing the gauge's markup.
|
|
51
|
+
* @example
|
|
52
|
+
* <Meter.Indicator value={45} max={100} aria-label={t("storage.used")} />
|
|
53
|
+
* @example
|
|
54
|
+
* <Meter.Indicator color="danger" value={92} aria-label={t("cpu.usage")} />
|
|
55
|
+
* @example
|
|
56
|
+
* <Meter.Indicator
|
|
57
|
+
* color="success"
|
|
58
|
+
* value={8}
|
|
59
|
+
* low={3}
|
|
60
|
+
* high={9}
|
|
61
|
+
* optimum={10}
|
|
62
|
+
* max={10}
|
|
63
|
+
* aria-label={t("rating.score")}
|
|
64
|
+
* />
|
|
65
|
+
*/
|
|
66
|
+
Meter.Indicator = function MeterIndicator(handle) {
|
|
67
|
+
return () => {
|
|
68
|
+
let { color, max, mix, ...rest } = handle.props;
|
|
69
|
+
let resolvedColor = color ?? DEFAULT_COLOR;
|
|
70
|
+
let resolvedMax = max ?? DEFAULT_MAX;
|
|
71
|
+
warnIfNoAccessibleLabel(handle.props, "Meter.Indicator: a meter with no `aria-label` or `aria-labelledby` needs one describing what it measures — assistive technology has no accessible name to announce otherwise.");
|
|
72
|
+
return (_jsx("meter", { "data-color": resolvedColor, max: resolvedMax, ...rest, mix: [
|
|
73
|
+
appearance(),
|
|
74
|
+
is("full"),
|
|
75
|
+
bs("var(--ui-meter-track-block-size, 0.5rem)"),
|
|
76
|
+
m("0"),
|
|
77
|
+
p("0"),
|
|
78
|
+
overflow("hidden"),
|
|
79
|
+
rounded("full"),
|
|
80
|
+
bg("neutral.border"),
|
|
81
|
+
block(),
|
|
82
|
+
border("none"),
|
|
83
|
+
when("&::-webkit-meter-bar", [bg("neutral.border"), rounded("full")]),
|
|
84
|
+
when(FILL_PSEUDO_ELEMENTS, [rounded("full"), transition("all")]),
|
|
85
|
+
data("color", "brand", when(FILL_PSEUDO_ELEMENTS, bg("brand.solid"))),
|
|
86
|
+
data("color", "neutral", when(FILL_PSEUDO_ELEMENTS, bg("neutral.solid"))),
|
|
87
|
+
data("color", "success", when(FILL_PSEUDO_ELEMENTS, bg("success.solid"))),
|
|
88
|
+
data("color", "warning", when(FILL_PSEUDO_ELEMENTS, bg("warning.solid"))),
|
|
89
|
+
data("color", "danger", when(FILL_PSEUDO_ELEMENTS, bg("danger.solid"))),
|
|
90
|
+
media("(prefers-reduced-motion: reduce)", when(FILL_PSEUDO_ELEMENTS, raw({ transitionDuration: "0s" }))),
|
|
91
|
+
mix,
|
|
92
|
+
] }));
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Renders the gauge's caption: a `<span>` sized as a small run of body copy
|
|
97
|
+
* in the neutral muted foreground color, for a percentage or status string
|
|
98
|
+
* placed alongside {@link Meter.Indicator}.
|
|
99
|
+
*
|
|
100
|
+
* @param handle Runtime handle carrying the host `<span>`'s props.
|
|
101
|
+
* @returns The render function producing the value label's markup.
|
|
102
|
+
* @example
|
|
103
|
+
* <Meter.ValueLabel>{t("storage.percent", { value: 45 })}</Meter.ValueLabel>
|
|
104
|
+
*/
|
|
105
|
+
Meter.ValueLabel = function MeterValueLabel(handle) {
|
|
106
|
+
return () => {
|
|
107
|
+
let { mix, ...rest } = handle.props;
|
|
108
|
+
return _jsx("span", { ...rest, mix: [text("sm"), fg("neutral"), mix] });
|
|
109
|
+
};
|
|
110
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A pre-animated preset of {@link Dialog}: the same native `<dialog>` panel,
|
|
3
|
+
* its `::backdrop` treatment, and every compound part, with the panel's own
|
|
4
|
+
* pop-in and pop-out motion — a fade paired with a scale, entering from
|
|
5
|
+
* slightly smaller and less opaque than rest and exiting back down to it —
|
|
6
|
+
* already wired onto the host.
|
|
7
|
+
*
|
|
8
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
9
|
+
* @copyright Sergio Xalambrí 2026
|
|
10
|
+
*/
|
|
11
|
+
import type { Handle } from "remix/ui";
|
|
12
|
+
import { Dialog } from "./dialog.js";
|
|
13
|
+
/**
|
|
14
|
+
* Prop types for {@link Modal} and its compound parts. Every part aliases
|
|
15
|
+
* {@link Dialog}'s matching part, since {@link Modal} renders straight
|
|
16
|
+
* through to {@link Dialog}'s own markup.
|
|
17
|
+
*/
|
|
18
|
+
export declare namespace Modal {
|
|
19
|
+
/** Every prop {@link Dialog.Props} accepts, unchanged. */
|
|
20
|
+
interface Props extends Dialog.Props {
|
|
21
|
+
}
|
|
22
|
+
/** Every prop {@link Dialog.HeaderProps} accepts, unchanged. */
|
|
23
|
+
interface HeaderProps extends Dialog.HeaderProps {
|
|
24
|
+
}
|
|
25
|
+
/** Every prop {@link Dialog.TitleProps} accepts, unchanged. */
|
|
26
|
+
interface TitleProps extends Dialog.TitleProps {
|
|
27
|
+
}
|
|
28
|
+
/** Every prop {@link Dialog.DescriptionProps} accepts, unchanged. */
|
|
29
|
+
interface DescriptionProps extends Dialog.DescriptionProps {
|
|
30
|
+
}
|
|
31
|
+
/** Every prop {@link Dialog.FooterProps} accepts, unchanged. */
|
|
32
|
+
interface FooterProps extends Dialog.FooterProps {
|
|
33
|
+
}
|
|
34
|
+
/** Every prop {@link Dialog.CloseProps} accepts, unchanged. */
|
|
35
|
+
interface CloseProps extends Dialog.CloseProps {
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Renders {@link Dialog} with its panel's pop-in/pop-out motion pre-wired
|
|
40
|
+
* through `mix`, collapsing to an opacity-only fade under reduced motion.
|
|
41
|
+
* A `mix` passed to {@link Modal} layers alongside the built-in motion.
|
|
42
|
+
*
|
|
43
|
+
* @param handle Runtime handle carrying the host `<dialog>`'s props.
|
|
44
|
+
* @returns The render function producing the animated panel's markup.
|
|
45
|
+
* @example
|
|
46
|
+
* <Button commandfor="welcome" command="show-modal">{t("welcome.cta")}</Button>
|
|
47
|
+
* <Modal id="welcome" aria-labelledby="welcome-title">
|
|
48
|
+
* <Modal.Header>
|
|
49
|
+
* <Modal.Title id="welcome-title">{t("welcome.title")}</Modal.Title>
|
|
50
|
+
* </Modal.Header>
|
|
51
|
+
* </Modal>
|
|
52
|
+
* @example
|
|
53
|
+
* <Modal id="confirm-delete" aria-labelledby="confirm-delete-title">
|
|
54
|
+
* <Modal.Close commandfor="confirm-delete" aria-label={t("actions.close")} />
|
|
55
|
+
* <Modal.Header>
|
|
56
|
+
* <Modal.Title id="confirm-delete-title">{t("project.deleteTitle")}</Modal.Title>
|
|
57
|
+
* <Modal.Description>{t("project.deleteDescription")}</Modal.Description>
|
|
58
|
+
* </Modal.Header>
|
|
59
|
+
* <Modal.Footer>
|
|
60
|
+
* <Button commandfor="confirm-delete" command="close" color="danger">{t("actions.delete")}</Button>
|
|
61
|
+
* </Modal.Footer>
|
|
62
|
+
* </Modal>
|
|
63
|
+
*/
|
|
64
|
+
export declare function Modal(handle: Handle<Modal.Props>): () => import("remix/ui").RemixElement;
|
|
65
|
+
export declare namespace Modal {
|
|
66
|
+
var Header: (handle: Handle<Dialog.HeaderProps>) => () => import("remix/ui").RemixElement;
|
|
67
|
+
var Title: (handle: Handle<Dialog.TitleProps>) => () => import("remix/ui").RemixElement;
|
|
68
|
+
var Description: (handle: Handle<Dialog.DescriptionProps>) => () => import("remix/ui").RemixElement;
|
|
69
|
+
var Footer: (handle: Handle<Dialog.FooterProps>) => () => import("remix/ui").RemixElement;
|
|
70
|
+
var Close: (handle: Handle<Dialog.CloseProps>) => () => import("remix/ui").RemixElement;
|
|
71
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { jsx as _jsx } from "remix/ui/jsx-runtime";
|
|
2
|
+
import { opacity, transition, transitionBehavior, transitionProperty } from "@sdxc/u/effects";
|
|
3
|
+
import { media, startingStyle } from "@sdxc/u/responsive";
|
|
4
|
+
import { when } from "@sdxc/u/state";
|
|
5
|
+
import { scaleProperty } from "@sdxc/u/transform";
|
|
6
|
+
import { durations, easings } from "../animations/tokens.js";
|
|
7
|
+
import { Dialog } from "./dialog.js";
|
|
8
|
+
/**
|
|
9
|
+
* Exit-state `scale` factor {@link Modal}'s panel animates from on entry and
|
|
10
|
+
* back down to on exit.
|
|
11
|
+
*/
|
|
12
|
+
const PANEL_EXIT_SCALE = "0.95";
|
|
13
|
+
/**
|
|
14
|
+
* Entered-state `scale` factor — the platform's own reset value, undoing
|
|
15
|
+
* {@link PANEL_EXIT_SCALE} once the panel is open.
|
|
16
|
+
*/
|
|
17
|
+
const PANEL_ENTERED_SCALE = "none";
|
|
18
|
+
/**
|
|
19
|
+
* Renders {@link Dialog} with its panel's pop-in/pop-out motion pre-wired
|
|
20
|
+
* through `mix`, collapsing to an opacity-only fade under reduced motion.
|
|
21
|
+
* A `mix` passed to {@link Modal} layers alongside the built-in motion.
|
|
22
|
+
*
|
|
23
|
+
* @param handle Runtime handle carrying the host `<dialog>`'s props.
|
|
24
|
+
* @returns The render function producing the animated panel's markup.
|
|
25
|
+
* @example
|
|
26
|
+
* <Button commandfor="welcome" command="show-modal">{t("welcome.cta")}</Button>
|
|
27
|
+
* <Modal id="welcome" aria-labelledby="welcome-title">
|
|
28
|
+
* <Modal.Header>
|
|
29
|
+
* <Modal.Title id="welcome-title">{t("welcome.title")}</Modal.Title>
|
|
30
|
+
* </Modal.Header>
|
|
31
|
+
* </Modal>
|
|
32
|
+
* @example
|
|
33
|
+
* <Modal id="confirm-delete" aria-labelledby="confirm-delete-title">
|
|
34
|
+
* <Modal.Close commandfor="confirm-delete" aria-label={t("actions.close")} />
|
|
35
|
+
* <Modal.Header>
|
|
36
|
+
* <Modal.Title id="confirm-delete-title">{t("project.deleteTitle")}</Modal.Title>
|
|
37
|
+
* <Modal.Description>{t("project.deleteDescription")}</Modal.Description>
|
|
38
|
+
* </Modal.Header>
|
|
39
|
+
* <Modal.Footer>
|
|
40
|
+
* <Button commandfor="confirm-delete" command="close" color="danger">{t("actions.delete")}</Button>
|
|
41
|
+
* </Modal.Footer>
|
|
42
|
+
* </Modal>
|
|
43
|
+
*/
|
|
44
|
+
export function Modal(handle) {
|
|
45
|
+
return () => {
|
|
46
|
+
let { mix, ...rest } = handle.props;
|
|
47
|
+
return (_jsx(Dialog, { ...rest, mix: [
|
|
48
|
+
scaleProperty(PANEL_EXIT_SCALE),
|
|
49
|
+
transitionBehavior("allow-discrete"),
|
|
50
|
+
opacity(0),
|
|
51
|
+
transition("opacity, scale, display, overlay", {
|
|
52
|
+
duration: durations.normal,
|
|
53
|
+
easing: easings.standard,
|
|
54
|
+
}),
|
|
55
|
+
when("&[open]", [scaleProperty(PANEL_ENTERED_SCALE), opacity(100)]),
|
|
56
|
+
startingStyle(when("&[open]", [scaleProperty(PANEL_EXIT_SCALE), opacity(0)])),
|
|
57
|
+
media("(prefers-reduced-motion: reduce)", [
|
|
58
|
+
scaleProperty(PANEL_ENTERED_SCALE),
|
|
59
|
+
transitionProperty("opacity, display, overlay"),
|
|
60
|
+
]),
|
|
61
|
+
mix,
|
|
62
|
+
] }));
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Renders {@link Modal.HeaderProps.children} as the panel's header slot:
|
|
67
|
+
* identical to {@link Dialog.Header}, since {@link Modal} shares its panel
|
|
68
|
+
* markup with {@link Dialog}.
|
|
69
|
+
*
|
|
70
|
+
* @param handle Runtime handle carrying the host `<div>`'s props.
|
|
71
|
+
* @returns The render function producing the header slot's markup.
|
|
72
|
+
* @example
|
|
73
|
+
* <Modal.Header>
|
|
74
|
+
* <Modal.Title>{t("welcome.title")}</Modal.Title>
|
|
75
|
+
* </Modal.Header>
|
|
76
|
+
*/
|
|
77
|
+
Modal.Header = Dialog.Header;
|
|
78
|
+
/**
|
|
79
|
+
* Renders {@link Modal.TitleProps.children} as the panel's heading:
|
|
80
|
+
* identical to {@link Dialog.Title}.
|
|
81
|
+
*
|
|
82
|
+
* @param handle Runtime handle carrying the host `<h2>`'s props.
|
|
83
|
+
* @returns The render function producing the heading's markup.
|
|
84
|
+
* @example
|
|
85
|
+
* <Modal.Title>{t("welcome.title")}</Modal.Title>
|
|
86
|
+
*/
|
|
87
|
+
Modal.Title = Dialog.Title;
|
|
88
|
+
/**
|
|
89
|
+
* Renders {@link Modal.DescriptionProps.children} as the panel's supporting
|
|
90
|
+
* copy: identical to {@link Dialog.Description}.
|
|
91
|
+
*
|
|
92
|
+
* @param handle Runtime handle carrying the host `<p>`'s props.
|
|
93
|
+
* @returns The render function producing the description's markup.
|
|
94
|
+
* @example
|
|
95
|
+
* <Modal.Description>{t("welcome.description")}</Modal.Description>
|
|
96
|
+
*/
|
|
97
|
+
Modal.Description = Dialog.Description;
|
|
98
|
+
/**
|
|
99
|
+
* Renders {@link Modal.FooterProps.children} as the panel's action row:
|
|
100
|
+
* identical to {@link Dialog.Footer}.
|
|
101
|
+
*
|
|
102
|
+
* @param handle Runtime handle carrying the host `<div>`'s props.
|
|
103
|
+
* @returns The render function producing the action row's markup.
|
|
104
|
+
* @example
|
|
105
|
+
* <Modal.Footer>
|
|
106
|
+
* <Button commandfor="welcome" command="close" variant="outline">{t("actions.cancel")}</Button>
|
|
107
|
+
* <Button commandfor="welcome" command="close">{t("actions.continue")}</Button>
|
|
108
|
+
* </Modal.Footer>
|
|
109
|
+
*/
|
|
110
|
+
Modal.Footer = Dialog.Footer;
|
|
111
|
+
/**
|
|
112
|
+
* Renders a dismiss control for the ancestor {@link Modal} named by
|
|
113
|
+
* `commandfor`: identical to {@link Dialog.Close}.
|
|
114
|
+
*
|
|
115
|
+
* @param handle Runtime handle carrying the host button's props.
|
|
116
|
+
* @returns The render function producing the dismiss control's markup.
|
|
117
|
+
* @example
|
|
118
|
+
* <Modal.Close commandfor="welcome" aria-label={t("actions.close")} />
|
|
119
|
+
*/
|
|
120
|
+
Modal.Close = Dialog.Close;
|