@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,239 @@
|
|
|
1
|
+
import { jsx as _jsx } from "remix/ui/jsx-runtime";
|
|
2
|
+
import { ChevronRightIcon } from "@sdxc/icons";
|
|
3
|
+
import { bg, fg, outline } from "@sdxc/u/color";
|
|
4
|
+
import { opacity, rounded, transition, transitionDuration } from "@sdxc/u/effects";
|
|
5
|
+
import { cursor, listStyle, raw } from "@sdxc/u/general";
|
|
6
|
+
import { center, hidden, hstack, interpolateSize, shrink, vstack } from "@sdxc/u/layout";
|
|
7
|
+
import { clip } from "@sdxc/u/overflow";
|
|
8
|
+
import { media } from "@sdxc/u/responsive";
|
|
9
|
+
import { bs, is, pb, pie, pi } from "@sdxc/u/size";
|
|
10
|
+
import { detailsContent, when } from "@sdxc/u/state";
|
|
11
|
+
import { rotate } from "@sdxc/u/transform";
|
|
12
|
+
import { text } from "@sdxc/u/typography";
|
|
13
|
+
import { attrs } from "remix/ui";
|
|
14
|
+
import { interactiveTransition } from "../styles/interactive-transition.js";
|
|
15
|
+
import { panelChrome } from "../styles/panel-chrome.js";
|
|
16
|
+
import { warnIfNoAccessibleLabel } from "../utils/warn-if-no-accessible-name.js";
|
|
17
|
+
import { SentinelRow } from "./sentinel-row.js";
|
|
18
|
+
/** `role="tree"` applied to {@link Tree} through {@link attrs} unless a consumer supplies its own `role`. */
|
|
19
|
+
const DEFAULT_ROLE = "tree";
|
|
20
|
+
/**
|
|
21
|
+
* `role="group"` applied to {@link Tree.Item} through {@link attrs} unless a
|
|
22
|
+
* consumer supplies its own `role` — the only role a native `<details>`
|
|
23
|
+
* accepts, and a fitting one since each item's own `<details>` groups its nodes.
|
|
24
|
+
*/
|
|
25
|
+
const DEFAULT_ITEM_ROLE = "group";
|
|
26
|
+
/** `role="treeitem"` applied to {@link Tree.ItemContent} through {@link attrs} unless a consumer supplies its own `role`. */
|
|
27
|
+
const DEFAULT_CONTENT_ROLE = "treeitem";
|
|
28
|
+
/**
|
|
29
|
+
* Nesting depth {@link Tree.Item} falls back to when nothing wraps it in
|
|
30
|
+
* another {@link Tree.Item} at all, so a root-level node's row renders with
|
|
31
|
+
* no extra indentation and an `aria-level` of `1`.
|
|
32
|
+
*/
|
|
33
|
+
const DEFAULT_DEPTH = 0;
|
|
34
|
+
/**
|
|
35
|
+
* Marker {@link Tree.ExpandButton} always carries as its `data-slot`
|
|
36
|
+
* attribute, applied through {@link attrs} unless a consumer supplies its
|
|
37
|
+
* own value, letting {@link Tree.Item}'s styling target just this chevron.
|
|
38
|
+
*/
|
|
39
|
+
const DEFAULT_EXPAND_BUTTON_SLOT = "expand-button";
|
|
40
|
+
/**
|
|
41
|
+
* Reads the nesting depth published by the nearest ancestor {@link Tree.Item},
|
|
42
|
+
* resolving to `undefined` when the lookup finds no ancestor item at all.
|
|
43
|
+
*
|
|
44
|
+
* @param handle Runtime handle of the component performing the lookup.
|
|
45
|
+
* @returns The nearest ancestor item's depth, or `undefined` where nothing wraps the caller.
|
|
46
|
+
* @example
|
|
47
|
+
* let ambient = readAmbientDepth(handle); // 1, nested one level inside a Tree.Item holding depth 1
|
|
48
|
+
*/
|
|
49
|
+
function readAmbientDepth(handle) {
|
|
50
|
+
try {
|
|
51
|
+
let ambient = handle.context.get(TreeItem);
|
|
52
|
+
return ambient?.depth;
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Renders the tree's root host: a bordered `<div>` carrying `role="tree"`,
|
|
60
|
+
* stacking {@link Tree.Item} nodes in block flow, with `data-empty`
|
|
61
|
+
* centering a fallback message; an unlabeled tree logs a dev `console.warn`.
|
|
62
|
+
*
|
|
63
|
+
* @param handle Runtime handle carrying the host `<div>`'s props.
|
|
64
|
+
* @returns The render function producing the tree's markup.
|
|
65
|
+
* @example
|
|
66
|
+
* <Tree aria-label={t("files.title")}>
|
|
67
|
+
* <Tree.Item id="src">
|
|
68
|
+
* <Tree.ItemContent>
|
|
69
|
+
* <Tree.ExpandButton aria-label={t("files.expand")} />
|
|
70
|
+
* {t("files.folder", { name: "src" })}
|
|
71
|
+
* </Tree.ItemContent>
|
|
72
|
+
* <Tree.Item id="src-index">
|
|
73
|
+
* <Tree.ItemContent>{t("files.file", { name: "index.ts" })}</Tree.ItemContent>
|
|
74
|
+
* </Tree.Item>
|
|
75
|
+
* </Tree.Item>
|
|
76
|
+
* </Tree>
|
|
77
|
+
* @example
|
|
78
|
+
* <Tree aria-label={t("files.title")} data-empty>
|
|
79
|
+
* {t("files.empty")}
|
|
80
|
+
* </Tree>
|
|
81
|
+
*/
|
|
82
|
+
export function Tree(handle) {
|
|
83
|
+
return () => {
|
|
84
|
+
let { children, mix, ...rest } = handle.props;
|
|
85
|
+
warnIfNoAccessibleLabel(handle.props, 'Tree: needs an "aria-label" or "aria-labelledby" describing its contents for assistive technology.');
|
|
86
|
+
return (_jsx("div", { ...rest, mix: [
|
|
87
|
+
attrs({ role: DEFAULT_ROLE }),
|
|
88
|
+
panelChrome(),
|
|
89
|
+
when("&:focus-visible", outline({ color: "brand.ring", offset: 2 })),
|
|
90
|
+
vstack(),
|
|
91
|
+
pb(1),
|
|
92
|
+
pi(1),
|
|
93
|
+
outline("none"),
|
|
94
|
+
when("&[data-empty]", [center(), pb(8), fg("neutral.muted")]),
|
|
95
|
+
mix,
|
|
96
|
+
], children: children }));
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Renders a node as a native `<details>`, so a subtree's reveal and `[open]`
|
|
101
|
+
* state come from the platform. Nest {@link Tree.ItemContent} first as the
|
|
102
|
+
* row, then nested {@link Tree.Item} children; reveal animates via `::details-content`.
|
|
103
|
+
*
|
|
104
|
+
* @param handle Runtime handle carrying the host `<details>`'s props and providing {@link Tree.ItemContext} to nodes nested inside it.
|
|
105
|
+
* @returns The render function producing the node's markup.
|
|
106
|
+
* @example
|
|
107
|
+
* <Tree.Item id="src">
|
|
108
|
+
* <Tree.ItemContent>
|
|
109
|
+
* <Tree.ExpandButton aria-label={t("files.expand")} />
|
|
110
|
+
* {t("files.folder", { name: "src" })}
|
|
111
|
+
* </Tree.ItemContent>
|
|
112
|
+
* <Tree.Item id="src-index">
|
|
113
|
+
* <Tree.ItemContent>{t("files.file", { name: "index.ts" })}</Tree.ItemContent>
|
|
114
|
+
* </Tree.Item>
|
|
115
|
+
* </Tree.Item>
|
|
116
|
+
* @example
|
|
117
|
+
* <Tree.Item id="src" open>
|
|
118
|
+
* <Tree.ItemContent>
|
|
119
|
+
* <Tree.ExpandButton aria-label={t("files.collapse")} />
|
|
120
|
+
* {t("files.folder", { name: "src" })}
|
|
121
|
+
* </Tree.ItemContent>
|
|
122
|
+
* </Tree.Item>
|
|
123
|
+
*/
|
|
124
|
+
function TreeItem(handle) {
|
|
125
|
+
return () => {
|
|
126
|
+
let { id, children, mix, ...rest } = handle.props;
|
|
127
|
+
let ambient = readAmbientDepth(handle);
|
|
128
|
+
let depth = ambient === undefined ? DEFAULT_DEPTH : ambient + 1;
|
|
129
|
+
handle.context.set({ depth });
|
|
130
|
+
return (_jsx("details", { ...rest, id: id, "data-rmx-key": id, mix: [
|
|
131
|
+
attrs({ role: DEFAULT_ITEM_ROLE }),
|
|
132
|
+
interpolateSize(),
|
|
133
|
+
detailsContent([clip(), bs(0)]),
|
|
134
|
+
detailsContent([
|
|
135
|
+
raw({
|
|
136
|
+
transitionProperty: "block-size, content-visibility",
|
|
137
|
+
transitionBehavior: "allow-discrete",
|
|
138
|
+
}),
|
|
139
|
+
transitionDuration("200ms"),
|
|
140
|
+
]),
|
|
141
|
+
when("&[open]::details-content", bs("auto")),
|
|
142
|
+
when(`&[open] > summary [data-slot="${DEFAULT_EXPAND_BUTTON_SLOT}"]`, rotate(90)),
|
|
143
|
+
media("(prefers-reduced-motion: reduce)", detailsContent(transitionDuration("0s"))),
|
|
144
|
+
mix,
|
|
145
|
+
], children: children }));
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
Tree.Item = TreeItem;
|
|
149
|
+
/**
|
|
150
|
+
* Renders {@link Tree.ItemContentProps.children} inside a native
|
|
151
|
+
* `<summary>` — the enclosing {@link Tree.Item}'s always-visible row —
|
|
152
|
+
* indented from its ambient depth, with `aria-selected`/`aria-disabled` styling.
|
|
153
|
+
*
|
|
154
|
+
* @param handle Runtime handle carrying the host `<summary>`'s props.
|
|
155
|
+
* @returns The render function producing the row's markup.
|
|
156
|
+
* @example
|
|
157
|
+
* <Tree.ItemContent>
|
|
158
|
+
* <Tree.ExpandButton aria-label={t("files.expand")} />
|
|
159
|
+
* {t("files.folder", { name: "src" })}
|
|
160
|
+
* </Tree.ItemContent>
|
|
161
|
+
* @example
|
|
162
|
+
* <Tree.ItemContent aria-selected="true">
|
|
163
|
+
* {t("files.file", { name: "index.ts" })}
|
|
164
|
+
* </Tree.ItemContent>
|
|
165
|
+
*/
|
|
166
|
+
Tree.ItemContent = function TreeItemContent(handle) {
|
|
167
|
+
return () => {
|
|
168
|
+
let { children, mix, ...rest } = handle.props;
|
|
169
|
+
let depth = readAmbientDepth(handle) ?? DEFAULT_DEPTH;
|
|
170
|
+
return (_jsx("summary", { ...rest, mix: [
|
|
171
|
+
interactiveTransition(),
|
|
172
|
+
attrs({ role: DEFAULT_CONTENT_ROLE, "aria-level": depth + 1 }),
|
|
173
|
+
hstack({ gap: 2, align: "center" }),
|
|
174
|
+
rounded("md"),
|
|
175
|
+
pb(1.5),
|
|
176
|
+
pie(3),
|
|
177
|
+
fg("neutral.emphasis"),
|
|
178
|
+
cursor("default"),
|
|
179
|
+
listStyle(),
|
|
180
|
+
raw({
|
|
181
|
+
paddingInlineStart: `calc(0.5rem + ${depth} * var(--ui-tree-indent, 1.25rem))`,
|
|
182
|
+
}),
|
|
183
|
+
outline("none"),
|
|
184
|
+
text("sm"),
|
|
185
|
+
when("&::-webkit-details-marker", hidden()),
|
|
186
|
+
when("&::marker", raw({ content: '""' })),
|
|
187
|
+
media("(prefers-reduced-motion: reduce)", transitionDuration("0s")),
|
|
188
|
+
when("&:hover", bg("neutral.bg-tint-hover")),
|
|
189
|
+
when("&:active", bg("neutral.bg-tint-pressed")),
|
|
190
|
+
when("&:focus", bg("neutral.bg-tint-hover")),
|
|
191
|
+
when('&[aria-selected="true"]', bg("brand.tint")),
|
|
192
|
+
when('&[aria-disabled="true"]', opacity(50)),
|
|
193
|
+
mix,
|
|
194
|
+
], children: children }));
|
|
195
|
+
};
|
|
196
|
+
};
|
|
197
|
+
/**
|
|
198
|
+
* Renders a decorative sentinel node: a `<div>` styled as centered, muted
|
|
199
|
+
* small text sized to match {@link Tree.ItemContent}'s vertical rhythm,
|
|
200
|
+
* ready to hold whatever loading indicator a paired enhancement supplies.
|
|
201
|
+
*
|
|
202
|
+
* @param handle Runtime handle carrying the host `<div>`'s props.
|
|
203
|
+
* @returns The render function producing the sentinel node's markup.
|
|
204
|
+
* @example
|
|
205
|
+
* <Tree.LoadMoreItem>{t("files.loadingMore")}</Tree.LoadMoreItem>
|
|
206
|
+
*/
|
|
207
|
+
Tree.LoadMoreItem = SentinelRow;
|
|
208
|
+
/**
|
|
209
|
+
* Renders the chevron a node's row shows for a subtree, rotated 90 degrees
|
|
210
|
+
* while the enclosing {@link Tree.Item}'s `<details>` carries `[open]`.
|
|
211
|
+
* `type="button"` precedes the consumer's attributes so a `command`/`commandfor` invoker still runs inside a `<form>`.
|
|
212
|
+
*
|
|
213
|
+
* @param handle Runtime handle carrying the host `<button>`'s props.
|
|
214
|
+
* @returns The render function producing the chevron's markup.
|
|
215
|
+
* @example
|
|
216
|
+
* <Tree.ItemContent>
|
|
217
|
+
* <Tree.ExpandButton aria-label={t("files.expand")} />
|
|
218
|
+
* {t("files.folder", { name: "src" })}
|
|
219
|
+
* </Tree.ItemContent>
|
|
220
|
+
*/
|
|
221
|
+
Tree.ExpandButton = function TreeExpandButton(handle) {
|
|
222
|
+
return () => {
|
|
223
|
+
let { children, mix, ...rest } = handle.props;
|
|
224
|
+
return (_jsx("button", { type: "button", ...rest, mix: [
|
|
225
|
+
attrs({ "data-slot": DEFAULT_EXPAND_BUTTON_SLOT }),
|
|
226
|
+
center(),
|
|
227
|
+
is(5),
|
|
228
|
+
bs(5),
|
|
229
|
+
rounded("sm"),
|
|
230
|
+
fg("neutral.muted"),
|
|
231
|
+
transition("transform, background-color"),
|
|
232
|
+
shrink(),
|
|
233
|
+
media("(prefers-reduced-motion: reduce)", transitionDuration("0s")),
|
|
234
|
+
when("&:hover", bg("neutral.bg-tint-pressed")),
|
|
235
|
+
when("&:focus-visible", outline("brand.ring")),
|
|
236
|
+
mix,
|
|
237
|
+
], children: children ?? _jsx(ChevronRightIcon, { size: 16 }) }));
|
|
238
|
+
};
|
|
239
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A typography layer wrapping already-rendered markdown or HTML content and
|
|
3
|
+
* supplying every size, weight, spacing, and color decision through three
|
|
4
|
+
* custom properties: `--ui-typeset-size`, `--ui-typeset-leading`, and
|
|
5
|
+
* `--ui-typeset-flow`. `data-preset` swaps all three for a different rhythm
|
|
6
|
+
* context; `data-not-typeset` opts a subtree out of the whole layer.
|
|
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 Typeset}.
|
|
14
|
+
*/
|
|
15
|
+
export declare namespace Typeset {
|
|
16
|
+
/**
|
|
17
|
+
* Rhythm context: `"docs"` is the spacious default, `"chat"` tightens the
|
|
18
|
+
* scale for a conversational bubble's denser turn-taking, and `"reading"`
|
|
19
|
+
* opens both further for a long-form article.
|
|
20
|
+
*/
|
|
21
|
+
type Preset = "docs" | "chat" | "reading";
|
|
22
|
+
/**
|
|
23
|
+
* Every native `<div>` attribute plus `mix`. `preset` defaults to
|
|
24
|
+
* {@link DEFAULT_PRESET}; setting a `--ui-typeset-*` property directly
|
|
25
|
+
* overrides it, and `data-not-typeset` opts a subtree out entirely.
|
|
26
|
+
*/
|
|
27
|
+
interface Props extends TagProps<"div"> {
|
|
28
|
+
/** Rhythm context. Defaults to {@link DEFAULT_PRESET}. */
|
|
29
|
+
preset?: Preset;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Renders a `<div>` that sizes and colors already-rendered markdown or HTML
|
|
34
|
+
* content through `--ui-typeset-size`, `--ui-typeset-leading`, and
|
|
35
|
+
* `--ui-typeset-flow`, computing heading sizes via `calc()` off one shared value.
|
|
36
|
+
*
|
|
37
|
+
* @param handle Runtime handle carrying the host `<div>`'s props.
|
|
38
|
+
* @returns The render function producing the typeset layer's markup.
|
|
39
|
+
* @example
|
|
40
|
+
* <Typeset preset="reading">{renderedArticleHtml}</Typeset>
|
|
41
|
+
* @example
|
|
42
|
+
* <Typeset preset="chat">
|
|
43
|
+
* <p>{t("assistant.reply")}</p>
|
|
44
|
+
* </Typeset>
|
|
45
|
+
* @example
|
|
46
|
+
* <Typeset>
|
|
47
|
+
* <p>{t("docs.intro")}</p>
|
|
48
|
+
* <div data-not-typeset>
|
|
49
|
+
* <EmbeddedWidget />
|
|
50
|
+
* </div>
|
|
51
|
+
* </Typeset>
|
|
52
|
+
*/
|
|
53
|
+
export declare function Typeset(handle: Handle<Typeset.Props>): () => import("remix/ui").RemixElement;
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
import { jsx as _jsx } from "remix/ui/jsx-runtime";
|
|
2
|
+
import { keyframes } from "@sdxc/u/animation";
|
|
3
|
+
import { bg, border, borderEdge, fg, outline } from "@sdxc/u/color";
|
|
4
|
+
import { rounded } from "@sdxc/u/effects";
|
|
5
|
+
import { raw } from "@sdxc/u/general";
|
|
6
|
+
import { block, container } from "@sdxc/u/layout";
|
|
7
|
+
import { overflow } from "@sdxc/u/overflow";
|
|
8
|
+
import { at } from "@sdxc/u/responsive";
|
|
9
|
+
import { is, maxIs, pb, pi, pis } from "@sdxc/u/size";
|
|
10
|
+
import { when } from "@sdxc/u/state";
|
|
11
|
+
import { leading, textAlign, textDecoration, tracking, weight } from "@sdxc/u/typography";
|
|
12
|
+
import { css } from "remix/ui";
|
|
13
|
+
import { easings } from "../animations/tokens.js";
|
|
14
|
+
/**
|
|
15
|
+
* Named container {@link Typeset} declares on its own host, so its wide-table
|
|
16
|
+
* handling can grant roomier cell and code-block padding once there's enough
|
|
17
|
+
* space, instead of reading the viewport.
|
|
18
|
+
*/
|
|
19
|
+
const CONTAINER_NAME = "ui-typeset";
|
|
20
|
+
/** Rhythm context {@link Typeset} falls back to when `preset` is omitted. */
|
|
21
|
+
const DEFAULT_PRESET = "docs";
|
|
22
|
+
/** CSS length each edge of a wide table's own fade tapers over. */
|
|
23
|
+
const TABLE_FADE_SIZE = "2.5rem";
|
|
24
|
+
/**
|
|
25
|
+
* Custom property carrying the gradient direction a wide table's edge fade
|
|
26
|
+
* paints along, mirrored under `:dir(rtl)` so the same mask string works in
|
|
27
|
+
* both writing directions without a second, mirrored gradient.
|
|
28
|
+
*/
|
|
29
|
+
const TABLE_FADE_DIRECTION_PROPERTY = "--ui-typeset-table-fade-direction";
|
|
30
|
+
/**
|
|
31
|
+
* `@keyframes` name backing a wide table's scroll-linked edge fade; the
|
|
32
|
+
* `keyframes()` call using it must stay a top-level mixin rather than nested
|
|
33
|
+
* under the table selector, since the serializer only recognizes stops there.
|
|
34
|
+
*/
|
|
35
|
+
const TABLE_FADE_KEYFRAMES_NAME = "ui-typeset-table-fade";
|
|
36
|
+
/** Proportion of a wide table's own scroll range its edge fade ramps across. */
|
|
37
|
+
const TABLE_FADE_RAMP_PERCENT = 10;
|
|
38
|
+
/**
|
|
39
|
+
* Builds the four-stop mask-image gradient a wide table's edge fade paints:
|
|
40
|
+
* a leading stop, two middle stops marking where the faded band meets the
|
|
41
|
+
* fully opaque middle, and a trailing stop; only the middle stops move.
|
|
42
|
+
*/
|
|
43
|
+
function tableFadeMask(startStop, endStop) {
|
|
44
|
+
return `linear-gradient(to var(${TABLE_FADE_DIRECTION_PROPERTY}, right), transparent 0%, black ${startStop}, black ${endStop}, transparent 100%)`;
|
|
45
|
+
}
|
|
46
|
+
const TABLE_FADE_SETTLED_STOP = `calc(100% - ${TABLE_FADE_SIZE})`;
|
|
47
|
+
const TABLE_FADE_SETTLED_MASK = tableFadeMask(TABLE_FADE_SIZE, TABLE_FADE_SETTLED_STOP);
|
|
48
|
+
/**
|
|
49
|
+
* Stops the wide-table edge fade animates through: fully faded on the leading
|
|
50
|
+
* edge at rest, settled on both edges across the long middle of the scroll
|
|
51
|
+
* range, and fully faded on the trailing edge at the end.
|
|
52
|
+
*/
|
|
53
|
+
const TABLE_FADE_KEYFRAMES = {
|
|
54
|
+
"0%": { maskImage: tableFadeMask("0%", TABLE_FADE_SETTLED_STOP) },
|
|
55
|
+
[`${TABLE_FADE_RAMP_PERCENT}%, ${100 - TABLE_FADE_RAMP_PERCENT}%`]: {
|
|
56
|
+
maskImage: TABLE_FADE_SETTLED_MASK,
|
|
57
|
+
},
|
|
58
|
+
"100%": { maskImage: tableFadeMask(TABLE_FADE_SIZE, "100%") },
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Renders a `<div>` that sizes and colors already-rendered markdown or HTML
|
|
62
|
+
* content through `--ui-typeset-size`, `--ui-typeset-leading`, and
|
|
63
|
+
* `--ui-typeset-flow`, computing heading sizes via `calc()` off one shared value.
|
|
64
|
+
*
|
|
65
|
+
* @param handle Runtime handle carrying the host `<div>`'s props.
|
|
66
|
+
* @returns The render function producing the typeset layer's markup.
|
|
67
|
+
* @example
|
|
68
|
+
* <Typeset preset="reading">{renderedArticleHtml}</Typeset>
|
|
69
|
+
* @example
|
|
70
|
+
* <Typeset preset="chat">
|
|
71
|
+
* <p>{t("assistant.reply")}</p>
|
|
72
|
+
* </Typeset>
|
|
73
|
+
* @example
|
|
74
|
+
* <Typeset>
|
|
75
|
+
* <p>{t("docs.intro")}</p>
|
|
76
|
+
* <div data-not-typeset>
|
|
77
|
+
* <EmbeddedWidget />
|
|
78
|
+
* </div>
|
|
79
|
+
* </Typeset>
|
|
80
|
+
*/
|
|
81
|
+
export function Typeset(handle) {
|
|
82
|
+
return () => {
|
|
83
|
+
let { preset, mix, ...rest } = handle.props;
|
|
84
|
+
let resolvedPreset = preset ?? DEFAULT_PRESET;
|
|
85
|
+
return (_jsx("div", { ...rest, "data-preset": resolvedPreset, "data-slot": "typeset", mix: [
|
|
86
|
+
fg("neutral.emphasis"),
|
|
87
|
+
container(CONTAINER_NAME),
|
|
88
|
+
keyframes(TABLE_FADE_KEYFRAMES_NAME, TABLE_FADE_KEYFRAMES),
|
|
89
|
+
raw({
|
|
90
|
+
fontSize: "var(--ui-typeset-size, 1rem)",
|
|
91
|
+
lineHeight: "var(--ui-typeset-leading, 1.75)",
|
|
92
|
+
'&[data-preset="docs"]': {
|
|
93
|
+
"--ui-typeset-size": "1rem",
|
|
94
|
+
"--ui-typeset-leading": "1.75",
|
|
95
|
+
"--ui-typeset-flow": "1.25em",
|
|
96
|
+
},
|
|
97
|
+
'&[data-preset="chat"]': {
|
|
98
|
+
"--ui-typeset-size": "0.9375rem",
|
|
99
|
+
"--ui-typeset-leading": "1.5",
|
|
100
|
+
"--ui-typeset-flow": "0.75em",
|
|
101
|
+
},
|
|
102
|
+
'&[data-preset="reading"]': {
|
|
103
|
+
"--ui-typeset-size": "1.125rem",
|
|
104
|
+
"--ui-typeset-leading": "1.8",
|
|
105
|
+
"--ui-typeset-flow": "1.5em",
|
|
106
|
+
},
|
|
107
|
+
"& > * + *": {
|
|
108
|
+
marginBlockStart: "var(--ui-typeset-flow, 1.25em)",
|
|
109
|
+
},
|
|
110
|
+
"& :where(blockquote, li) > * + *": {
|
|
111
|
+
marginBlockStart: "var(--ui-typeset-flow, 1.25em)",
|
|
112
|
+
},
|
|
113
|
+
"& :where(h1)": {
|
|
114
|
+
fontSize: "calc(var(--ui-typeset-size, 1rem) * 2)",
|
|
115
|
+
},
|
|
116
|
+
"& :where(h2)": {
|
|
117
|
+
fontSize: "calc(var(--ui-typeset-size, 1rem) * 1.5)",
|
|
118
|
+
},
|
|
119
|
+
"& :where(h3)": {
|
|
120
|
+
fontSize: "calc(var(--ui-typeset-size, 1rem) * 1.25)",
|
|
121
|
+
},
|
|
122
|
+
"& :where(h4)": {
|
|
123
|
+
fontSize: "calc(var(--ui-typeset-size, 1rem) * 1.125)",
|
|
124
|
+
},
|
|
125
|
+
"& :where(h5)": {
|
|
126
|
+
fontSize: "var(--ui-typeset-size, 1rem)",
|
|
127
|
+
},
|
|
128
|
+
"& :where(h6)": {
|
|
129
|
+
fontSize: "calc(var(--ui-typeset-size, 1rem) * 0.875)",
|
|
130
|
+
},
|
|
131
|
+
"& :where(ul)": {
|
|
132
|
+
listStyleType: "disc",
|
|
133
|
+
},
|
|
134
|
+
"& :where(ol)": {
|
|
135
|
+
listStyleType: "decimal",
|
|
136
|
+
},
|
|
137
|
+
"& :where(ul, ol) :where(ul)": {
|
|
138
|
+
listStyleType: "circle",
|
|
139
|
+
},
|
|
140
|
+
"& :where(blockquote)": {
|
|
141
|
+
fontStyle: "italic",
|
|
142
|
+
},
|
|
143
|
+
"& :where(a)": {
|
|
144
|
+
textUnderlineOffset: "0.15em",
|
|
145
|
+
},
|
|
146
|
+
"& :where(a):hover": {
|
|
147
|
+
textDecorationThickness: "2px",
|
|
148
|
+
},
|
|
149
|
+
"& :where(em, i)": {
|
|
150
|
+
fontStyle: "italic",
|
|
151
|
+
},
|
|
152
|
+
"& :where(code)": {
|
|
153
|
+
fontSize: "0.875em",
|
|
154
|
+
},
|
|
155
|
+
"& :where(pre)": {
|
|
156
|
+
fontSize: "0.875em",
|
|
157
|
+
},
|
|
158
|
+
"& :where(pre code)": {
|
|
159
|
+
padding: "0",
|
|
160
|
+
fontSize: "1em",
|
|
161
|
+
},
|
|
162
|
+
"& :where(table)": {
|
|
163
|
+
borderCollapse: "collapse",
|
|
164
|
+
fontSize: "0.875em",
|
|
165
|
+
scrollbarWidth: "thin",
|
|
166
|
+
scrollbarGutter: "stable",
|
|
167
|
+
[TABLE_FADE_DIRECTION_PROPERTY]: "right",
|
|
168
|
+
maskImage: "none",
|
|
169
|
+
"-webkit-mask-image": "none",
|
|
170
|
+
"&:dir(rtl)": {
|
|
171
|
+
[TABLE_FADE_DIRECTION_PROPERTY]: "left",
|
|
172
|
+
},
|
|
173
|
+
"&::-webkit-scrollbar": {
|
|
174
|
+
width: "0.75rem",
|
|
175
|
+
height: "0.75rem",
|
|
176
|
+
},
|
|
177
|
+
"&::-webkit-scrollbar-track": {
|
|
178
|
+
backgroundColor: "transparent",
|
|
179
|
+
},
|
|
180
|
+
"&::-webkit-scrollbar-thumb": {
|
|
181
|
+
borderRadius: "var(--ui-radius-full, 9999px)",
|
|
182
|
+
backgroundColor: "var(--ui-neutral-border)",
|
|
183
|
+
borderWidth: "3px",
|
|
184
|
+
borderStyle: "solid",
|
|
185
|
+
borderColor: "transparent",
|
|
186
|
+
backgroundClip: "content-box",
|
|
187
|
+
},
|
|
188
|
+
"&::-webkit-scrollbar-thumb:hover": {
|
|
189
|
+
backgroundColor: "var(--ui-neutral-border-strong)",
|
|
190
|
+
},
|
|
191
|
+
"@supports (animation-timeline: scroll())": {
|
|
192
|
+
animationName: TABLE_FADE_KEYFRAMES_NAME,
|
|
193
|
+
animationDuration: "auto",
|
|
194
|
+
animationTimingFunction: easings.linear,
|
|
195
|
+
animationFillMode: "both",
|
|
196
|
+
animationTimeline: "scroll(self inline)",
|
|
197
|
+
"@media (prefers-reduced-motion: reduce)": {
|
|
198
|
+
animationName: "none",
|
|
199
|
+
maskImage: TABLE_FADE_SETTLED_MASK,
|
|
200
|
+
"-webkit-mask-image": TABLE_FADE_SETTLED_MASK,
|
|
201
|
+
},
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
"& :where([data-not-typeset], [data-not-typeset] *)": {
|
|
205
|
+
all: "revert-layer",
|
|
206
|
+
},
|
|
207
|
+
}),
|
|
208
|
+
at("30rem", CONTAINER_NAME, raw({
|
|
209
|
+
"& :where(th, td)": {
|
|
210
|
+
paddingInline: "1em",
|
|
211
|
+
},
|
|
212
|
+
"& :where(pre)": {
|
|
213
|
+
paddingInline: "1.25em",
|
|
214
|
+
},
|
|
215
|
+
})),
|
|
216
|
+
when("& :where(pre)", leading(1.6)),
|
|
217
|
+
when("& :where(h1, h2, h3, h4, h5, h6)", [
|
|
218
|
+
weight("semibold"),
|
|
219
|
+
leading(1.25),
|
|
220
|
+
tracking("tight"),
|
|
221
|
+
fg("neutral.emphasis"),
|
|
222
|
+
]),
|
|
223
|
+
when("& :where(h6)", fg("neutral")),
|
|
224
|
+
when("& :where(ul, ol)", pis("1.5em")),
|
|
225
|
+
when("& :where(li)::marker", fg("neutral.muted")),
|
|
226
|
+
when("& :where(blockquote)", [
|
|
227
|
+
pis("1em"),
|
|
228
|
+
fg("neutral"),
|
|
229
|
+
borderEdge("inline-start", { color: "neutral", width: "0.25em" }),
|
|
230
|
+
]),
|
|
231
|
+
when("& :where(hr)", borderEdge("block-start", { color: "neutral", width: "1px" })),
|
|
232
|
+
when("& :where(a)", [fg("brand"), textDecoration("underline")]),
|
|
233
|
+
when("& :where(a):focus-visible", [
|
|
234
|
+
outline({ color: "brand.ring", offset: 2 }),
|
|
235
|
+
rounded("xs"),
|
|
236
|
+
]),
|
|
237
|
+
when("& :where(strong, b)", [weight("semibold"), fg("neutral.emphasis")]),
|
|
238
|
+
when("& :where(code)", [
|
|
239
|
+
rounded("sm"),
|
|
240
|
+
bg("neutral.tint"),
|
|
241
|
+
fg("neutral.emphasis"),
|
|
242
|
+
pi("0.3em"),
|
|
243
|
+
pb("0.15em"),
|
|
244
|
+
]),
|
|
245
|
+
when("& :where(pre)", [
|
|
246
|
+
rounded("md"),
|
|
247
|
+
border({ color: "neutral.border", width: 1 }),
|
|
248
|
+
bg("neutral.tint"),
|
|
249
|
+
fg("neutral.emphasis"),
|
|
250
|
+
pi("1em"),
|
|
251
|
+
pb("0.875em"),
|
|
252
|
+
overflow("auto"),
|
|
253
|
+
]),
|
|
254
|
+
when("& :where(pre code)", [bg("transparent"), fg("inherit"), rounded("none")]),
|
|
255
|
+
when("& :where(table)", [
|
|
256
|
+
block(),
|
|
257
|
+
is("max(100%, max-content)"),
|
|
258
|
+
maxIs("full"),
|
|
259
|
+
overflow("auto"),
|
|
260
|
+
]),
|
|
261
|
+
when("& :where(th, td):not([align])", textAlign("start")),
|
|
262
|
+
when("& :where(th)", [weight("semibold"), fg("neutral.emphasis")]),
|
|
263
|
+
when("& :where(th, td)", [
|
|
264
|
+
pi("0.75em"),
|
|
265
|
+
pb("0.5em"),
|
|
266
|
+
borderEdge("block-end", { color: "neutral", width: "1px" }),
|
|
267
|
+
]),
|
|
268
|
+
mix,
|
|
269
|
+
] }));
|
|
270
|
+
};
|
|
271
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public entry point, re-exporting every component from `./components` so
|
|
3
|
+
* apps can import the whole catalog from the package root.
|
|
4
|
+
*
|
|
5
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
6
|
+
* @copyright Sergio Xalambrí 2026
|
|
7
|
+
*/
|
|
8
|
+
export * from "./components/index.js";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public entry point, re-exporting every component from `./components` so
|
|
3
|
+
* apps can import the whole catalog from the package root.
|
|
4
|
+
*
|
|
5
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
6
|
+
* @copyright Sergio Xalambrí 2026
|
|
7
|
+
*/
|
|
8
|
+
export * from "./components/index.js";
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keeps `aria-checked` on a native checked-state control in sync with its
|
|
3
|
+
* live checkedness, since the attribute is static and won't follow a
|
|
4
|
+
* control's state on its own. Opt-in, for a control inside a hydrated
|
|
5
|
+
* island: with no JavaScript, assistive technology reads checkedness off
|
|
6
|
+
* the control itself already.
|
|
7
|
+
*
|
|
8
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
9
|
+
* @copyright Sergio Xalambrí 2026
|
|
10
|
+
*/
|
|
11
|
+
import type { MixinFactory } from "remix/ui";
|
|
12
|
+
/**
|
|
13
|
+
* Rewrites {@link CHECKED_ATTRIBUTE} on `control`, and on its sibling radios,
|
|
14
|
+
* since picking one radio unchecks another with no `change` event of its own.
|
|
15
|
+
* Call this directly after a programmatic checked/indeterminate write or a form reset, neither of which fires `change`.
|
|
16
|
+
*
|
|
17
|
+
* @param control Mounted checkbox or radio whose attribute is brought back in line.
|
|
18
|
+
* @example
|
|
19
|
+
* selectAll.indeterminate = someButNotAllSelected;
|
|
20
|
+
* syncAriaChecked(selectAll);
|
|
21
|
+
*/
|
|
22
|
+
export declare function syncAriaChecked(control: HTMLInputElement): void;
|
|
23
|
+
/**
|
|
24
|
+
* Adds `aria-checked` to a checkbox, switch, or radio, syncing it from the
|
|
25
|
+
* host's own render-time state and again on every `change`. Apply the mixin
|
|
26
|
+
* to every radio in a shared group — a change refreshes only the ones that carry it.
|
|
27
|
+
*
|
|
28
|
+
* @returns A mixin descriptor for a checkbox's, switch's, or radio's `mix` prop.
|
|
29
|
+
* @see {@link syncAriaChecked} to resync after a programmatic checked/indeterminate write or a form reset, neither of which fires `change`.
|
|
30
|
+
* @example
|
|
31
|
+
* <Switch name="notifications" defaultChecked mix={[ariaChecked()]}>
|
|
32
|
+
* {t("settings.notifications.label")}
|
|
33
|
+
* </Switch>
|
|
34
|
+
* @example
|
|
35
|
+
* <Checkbox name="terms" mix={[ariaChecked()]}>{t("signup.acceptTerms")}</Checkbox>
|
|
36
|
+
* @example
|
|
37
|
+
* // A radio's own input sits behind the `parts.input` passthrough.
|
|
38
|
+
* <RadioGroup.Radio value="express" parts={{ input: [ariaChecked()] }}>
|
|
39
|
+
* {t("shipping.express")}
|
|
40
|
+
* </RadioGroup.Radio>
|
|
41
|
+
*/
|
|
42
|
+
export declare const ariaChecked: MixinFactory<HTMLInputElement>;
|