@sdxc/ui 2026.10.30 → 2026.11.3
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/README.md +187 -113
- package/dist/app/app-shell-toggle.d.ts +31 -0
- package/dist/app/app-shell-toggle.js +43 -0
- package/dist/app/app-shell.d.ts +131 -0
- package/dist/app/app-shell.js +542 -0
- package/dist/app/auto-refresh.d.ts +104 -0
- package/dist/app/auto-refresh.js +126 -0
- package/dist/{behaviors → app/behaviors}/drag-session.js +1 -1
- package/dist/app/behaviors/refresh-schedule.d.ts +53 -0
- package/dist/app/behaviors/refresh-schedule.js +95 -0
- package/dist/app/behaviors/shortcuts.d.ts +175 -0
- package/dist/app/behaviors/shortcuts.js +401 -0
- package/dist/{behaviors → app/behaviors}/toaster.d.ts +31 -2
- package/dist/{behaviors → app/behaviors}/toaster.js +63 -6
- package/dist/{components → app}/chart.d.ts +63 -9
- package/dist/{components → app}/chart.js +222 -40
- package/dist/app/command-palette.d.ts +132 -0
- package/dist/app/command-palette.js +181 -0
- package/dist/{components → app}/context-menu.d.ts +2 -2
- package/dist/{components → app}/context-menu.js +8 -7
- package/dist/app/danger-zone.d.ts +66 -0
- package/dist/app/danger-zone.js +66 -0
- package/dist/app/detail-sheet.d.ts +119 -0
- package/dist/app/detail-sheet.js +173 -0
- package/dist/{components → app}/drop-indicator.js +3 -3
- package/dist/{components → app}/drop-zone.d.ts +2 -1
- package/dist/{components → app}/drop-zone.js +7 -4
- package/dist/app/editor-layout.d.ts +69 -0
- package/dist/app/editor-layout.js +143 -0
- package/dist/app/empty.d.ts +128 -0
- package/dist/app/empty.js +248 -0
- package/dist/{components → app}/file-trigger.js +2 -2
- package/dist/app/filter-bar.d.ts +169 -0
- package/dist/app/filter-bar.js +346 -0
- package/dist/{components → app}/grid-list.d.ts +1 -1
- package/dist/{components → app}/grid-list.js +16 -18
- package/dist/app/index.d.ts +92 -0
- package/dist/app/index.js +92 -0
- package/dist/app/keyboard-help.d.ts +66 -0
- package/dist/app/keyboard-help.js +56 -0
- package/dist/{components → app}/menubar.js +5 -7
- package/dist/app/mixins/app-shell-controls.d.ts +46 -0
- package/dist/app/mixins/app-shell-controls.js +131 -0
- package/dist/app/mixins/auto-refresh.d.ts +29 -0
- package/dist/app/mixins/auto-refresh.js +66 -0
- package/dist/app/mixins/command-palette.d.ts +56 -0
- package/dist/app/mixins/command-palette.js +297 -0
- package/dist/app/mixins/copy-permalink.d.ts +26 -0
- package/dist/app/mixins/copy-permalink.js +54 -0
- package/dist/app/mixins/detail-sheet-keys.d.ts +28 -0
- package/dist/app/mixins/detail-sheet-keys.js +88 -0
- package/dist/{mixins → app/mixins}/drag-reorder.js +1 -1
- package/dist/{mixins → app/mixins}/drop-zone.js +1 -1
- package/dist/app/mixins/escape-link.d.ts +17 -0
- package/dist/app/mixins/escape-link.js +35 -0
- package/dist/{mixins → app/mixins}/grid-list-keys.js +2 -2
- package/dist/app/mixins/keyboard-help.d.ts +38 -0
- package/dist/app/mixins/keyboard-help.js +51 -0
- package/dist/{mixins → app/mixins}/menubar-keys.js +2 -2
- package/dist/app/mixins/optimistic-toggle-sync.d.ts +80 -0
- package/dist/app/mixins/optimistic-toggle-sync.js +153 -0
- package/dist/app/mixins/range-picker-keys.d.ts +18 -0
- package/dist/app/mixins/range-picker-keys.js +94 -0
- package/dist/{mixins → app/mixins}/resize-handle.js +3 -3
- package/dist/app/mixins/row-navigation.d.ts +85 -0
- package/dist/app/mixins/row-navigation.js +208 -0
- package/dist/app/mixins/save-bar-sync.d.ts +27 -0
- package/dist/app/mixins/save-bar-sync.js +106 -0
- package/dist/app/mixins/save-shortcut.d.ts +47 -0
- package/dist/app/mixins/save-shortcut.js +101 -0
- package/dist/app/mixins/save-status-sync.d.ts +77 -0
- package/dist/app/mixins/save-status-sync.js +159 -0
- package/dist/app/mixins/selection-bar-sync.d.ts +32 -0
- package/dist/app/mixins/selection-bar-sync.js +151 -0
- package/dist/app/mixins/split-view.d.ts +66 -0
- package/dist/app/mixins/split-view.js +319 -0
- package/dist/app/mixins/status-strip-keys.d.ts +17 -0
- package/dist/app/mixins/status-strip-keys.js +79 -0
- package/dist/app/mixins/submit-on-change.d.ts +16 -0
- package/dist/app/mixins/submit-on-change.js +28 -0
- package/dist/app/mixins/table-selection.d.ts +39 -0
- package/dist/app/mixins/table-selection.js +272 -0
- package/dist/app/mixins/toast-queue.d.ts +36 -0
- package/dist/app/mixins/toast-queue.js +77 -0
- package/dist/app/mixins/toast-stack.d.ts +20 -0
- package/dist/app/mixins/toast-stack.js +55 -0
- package/dist/{mixins/treeKeys.js → app/mixins/tree-keys.js} +2 -2
- package/dist/app/optimistic-toggle.d.ts +48 -0
- package/dist/app/optimistic-toggle.js +38 -0
- package/dist/app/page-header.d.ts +71 -0
- package/dist/app/page-header.js +249 -0
- package/dist/app/range-picker.d.ts +102 -0
- package/dist/app/range-picker.js +118 -0
- package/dist/{components → app}/resizable.js +7 -10
- package/dist/app/save-bar.d.ts +54 -0
- package/dist/app/save-bar.js +64 -0
- package/dist/app/save-status.d.ts +50 -0
- package/dist/app/save-status.js +54 -0
- package/dist/app/selection-bar.d.ts +101 -0
- package/dist/app/selection-bar.js +157 -0
- package/dist/app/settings-layout.d.ts +70 -0
- package/dist/app/settings-layout.js +112 -0
- package/dist/app/settings-section.d.ts +140 -0
- package/dist/app/settings-section.js +182 -0
- package/dist/{components → app}/shortcut-list.js +4 -3
- package/dist/app/skeleton.d.ts +79 -0
- package/dist/app/skeleton.js +185 -0
- package/dist/app/sparkline.d.ts +61 -0
- package/dist/app/sparkline.js +145 -0
- package/dist/app/split-view.d.ts +154 -0
- package/dist/app/split-view.js +272 -0
- package/dist/app/stat-card.d.ts +109 -0
- package/dist/app/stat-card.js +379 -0
- package/dist/app/status-strip.d.ts +70 -0
- package/dist/app/status-strip.js +155 -0
- package/dist/app/styles/action-row.d.ts +41 -0
- package/dist/app/styles/action-row.js +59 -0
- package/dist/{styles → app/styles}/chart-palette.d.ts +1 -1
- package/dist/{styles → app/styles}/graphic-host.d.ts +1 -1
- package/dist/{styles → app/styles}/legend-toggle.d.ts +1 -1
- package/dist/app/styles/stat-delta.d.ts +29 -0
- package/dist/app/styles/stat-delta.js +36 -0
- package/dist/app/styles/toast-stack.d.ts +21 -0
- package/dist/app/styles/toast-stack.js +54 -0
- package/dist/app/table.d.ts +327 -0
- package/dist/app/table.js +839 -0
- package/dist/{components → app}/toast.d.ts +105 -5
- package/dist/{components → app}/toast.js +101 -35
- package/dist/app/toasts.d.ts +49 -0
- package/dist/app/toasts.js +103 -0
- package/dist/{components → app}/toolbar.js +3 -3
- package/dist/{components → app}/tree.d.ts +1 -1
- package/dist/{components → app}/tree.js +10 -14
- package/dist/app/utils/app-shell-cookie.d.ts +21 -0
- package/dist/app/utils/app-shell-cookie.js +33 -0
- package/dist/{utils → app/utils}/chart-marker-indices.d.ts +9 -5
- package/dist/{utils → app/utils}/chart-marker-indices.js +9 -8
- package/dist/{utils → app/utils}/chart-path.d.ts +15 -11
- package/dist/{utils → app/utils}/chart-path.js +48 -20
- package/dist/{utils → app/utils}/chart-scale.js +1 -1
- package/dist/app/utils/edited-time.d.ts +19 -0
- package/dist/app/utils/edited-time.js +35 -0
- package/dist/app/utils/key-target.d.ts +23 -0
- package/dist/app/utils/key-target.js +48 -0
- package/dist/app/utils/search-params.d.ts +69 -0
- package/dist/app/utils/search-params.js +132 -0
- package/dist/app/utils/shortcut-groups.d.ts +21 -0
- package/dist/app/utils/shortcut-groups.js +53 -0
- package/dist/app/utils/split-view-layout.d.ts +48 -0
- package/dist/app/utils/split-view-layout.js +71 -0
- package/dist/app/view-options.d.ts +99 -0
- package/dist/app/view-options.js +182 -0
- package/dist/behaviors/index.d.ts +0 -5
- package/dist/behaviors/index.js +0 -5
- package/dist/{components → chat}/attachment.d.ts +1 -1
- package/dist/{components → chat}/attachment.js +17 -23
- package/dist/{behaviors → chat/behaviors}/scroll-follow-model.js +1 -1
- package/dist/{components → chat}/bubble.js +14 -14
- package/dist/chat/index.d.ts +16 -0
- package/dist/chat/index.js +16 -0
- package/dist/{components → chat}/marker.js +6 -8
- package/dist/{components → chat}/message-scroller.d.ts +1 -1
- package/dist/{components → chat}/message-scroller.js +12 -18
- package/dist/{components → chat}/message.js +10 -12
- package/dist/{mixins → chat/mixins}/message-follow.js +2 -2
- package/dist/{components → color}/color-area.js +7 -10
- package/dist/{components → color}/color-field.js +7 -6
- package/dist/{components → color}/color-picker.d.ts +1 -1
- package/dist/{components → color}/color-picker.js +9 -12
- package/dist/{components → color}/color-slider.js +10 -13
- package/dist/{components → color}/color-swatch-picker.js +4 -5
- package/dist/{components → color}/color-swatch.js +3 -4
- package/dist/{components → color}/color-wheel.js +5 -6
- package/dist/color/index.d.ts +21 -0
- package/dist/color/index.js +21 -0
- package/dist/{mixins → color/mixins}/color-area-drag.d.ts +1 -1
- package/dist/{mixins → color/mixins}/color-area-drag.js +2 -2
- package/dist/{mixins → color/mixins}/color-preview.js +1 -1
- package/dist/{mixins → color/mixins}/color-wheel-drag.js +1 -1
- package/dist/{styles → color/styles}/rtl-aware-gradient-direction.d.ts +1 -1
- package/dist/components/accordion.d.ts +3 -3
- package/dist/components/accordion.js +19 -15
- package/dist/components/alert-dialog.js +5 -4
- package/dist/components/alert.js +10 -20
- package/dist/components/aspect-ratio.js +3 -4
- package/dist/components/avatar.d.ts +6 -6
- package/dist/components/avatar.js +56 -8
- package/dist/components/badge.js +11 -9
- package/dist/components/banner.d.ts +61 -0
- package/dist/components/banner.js +101 -0
- package/dist/components/breadcrumbs.js +7 -9
- package/dist/components/button.d.ts +8 -6
- package/dist/components/button.js +22 -14
- package/dist/components/calendar.js +13 -24
- package/dist/components/card.js +9 -11
- package/dist/components/carousel.d.ts +1 -1
- package/dist/components/carousel.js +12 -20
- package/dist/components/checkbox-group.js +3 -3
- package/dist/components/checkbox.js +2 -2
- package/dist/components/combobox.js +6 -6
- package/dist/components/command.js +10 -14
- package/dist/components/confirm.d.ts +54 -5
- package/dist/components/confirm.js +44 -5
- package/dist/components/cta-group.d.ts +30 -14
- package/dist/components/cta-group.js +29 -10
- package/dist/components/date-field.js +2 -1
- package/dist/components/date-picker.js +4 -5
- package/dist/components/date-range-picker.js +3 -2
- package/dist/components/description.js +2 -1
- package/dist/components/dialog-dismiss.d.ts +18 -0
- package/dist/components/dialog-dismiss.js +15 -0
- package/dist/components/dialog.js +11 -15
- package/dist/components/disclosure.js +10 -14
- package/dist/components/drawer.js +3 -4
- package/dist/components/field-error.js +3 -3
- package/dist/components/form.js +2 -1
- package/dist/components/group.d.ts +14 -0
- package/dist/components/group.js +68 -13
- package/dist/components/header.js +3 -3
- package/dist/components/heading-scope.js +2 -1
- package/dist/components/heading.d.ts +4 -4
- package/dist/components/heading.js +7 -7
- package/dist/components/highlight.js +17 -12
- package/dist/components/hover-card.js +6 -8
- package/dist/components/image-placeholder.js +13 -19
- package/dist/components/index.d.ts +11 -38
- package/dist/components/index.js +11 -38
- package/dist/components/input.js +12 -7
- package/dist/components/item.js +10 -19
- package/dist/components/keyboard.js +3 -3
- package/dist/components/label.js +2 -1
- package/dist/components/link-button.d.ts +7 -5
- package/dist/components/link-button.js +24 -13
- package/dist/components/link.js +3 -4
- package/dist/components/listbox.js +6 -11
- package/dist/components/menu.js +5 -6
- package/dist/components/meter.js +5 -6
- package/dist/components/modal.js +9 -11
- package/dist/components/nav-link.d.ts +1 -1
- package/dist/components/nav-link.js +3 -4
- package/dist/components/navigation-menu.js +17 -23
- package/dist/components/number-field.js +8 -10
- package/dist/components/otp-field.js +2 -1
- package/dist/components/overlay-arrow.js +3 -4
- package/dist/components/pagination.js +8 -10
- package/dist/components/popover.js +3 -4
- package/dist/components/progress-bar.js +5 -5
- package/dist/components/property-list.d.ts +76 -0
- package/dist/components/property-list.js +175 -0
- package/dist/components/radio-group.js +5 -7
- package/dist/components/range-calendar.js +3 -3
- package/dist/components/relative-time.d.ts +72 -0
- package/dist/components/relative-time.js +45 -0
- package/dist/components/scroll-area.js +4 -5
- package/dist/components/search-field.js +8 -11
- package/dist/components/section.js +2 -1
- package/dist/components/select.js +10 -22
- package/dist/components/selection-indicator.js +3 -3
- package/dist/components/sentinel-row.js +3 -3
- package/dist/components/separator.js +3 -3
- package/dist/components/shared-element.js +2 -1
- package/dist/components/sheet.js +6 -7
- package/dist/components/sidebar.js +48 -76
- package/dist/components/slider.js +8 -10
- package/dist/components/spinner.js +3 -3
- package/dist/components/status-dot.d.ts +62 -0
- package/dist/components/status-dot.js +99 -0
- package/dist/components/switch.js +3 -3
- package/dist/components/tabs.js +9 -12
- package/dist/components/tag-group.js +7 -9
- package/dist/components/text-field.d.ts +17 -2
- package/dist/components/text-field.js +14 -4
- package/dist/components/text.js +2 -1
- package/dist/components/textarea.js +3 -4
- package/dist/components/time-field.js +2 -1
- package/dist/components/timeline.d.ts +67 -0
- package/dist/components/timeline.js +159 -0
- package/dist/components/toggle-button.js +5 -7
- package/dist/components/tooltip.js +3 -3
- package/dist/components/typeset.d.ts +2 -1
- package/dist/components/typeset.js +131 -123
- package/dist/components/youtube-embed.js +2 -1
- package/dist/docs/anchor-heading.d.ts +41 -0
- package/dist/docs/anchor-heading.js +62 -0
- package/dist/docs/callout.d.ts +46 -0
- package/dist/docs/callout.js +61 -0
- package/dist/docs/code-block.d.ts +74 -0
- package/dist/docs/code-block.js +322 -0
- package/dist/docs/code-tabs-sync.d.ts +26 -0
- package/dist/docs/code-tabs-sync.js +12 -0
- package/dist/docs/code-tabs.d.ts +53 -0
- package/dist/docs/code-tabs.js +102 -0
- package/dist/docs/copy-button.d.ts +31 -0
- package/dist/docs/copy-button.js +49 -0
- package/dist/docs/docs-feedback.d.ts +67 -0
- package/dist/docs/docs-feedback.js +74 -0
- package/dist/docs/docs-footer.d.ts +40 -0
- package/dist/docs/docs-footer.js +45 -0
- package/dist/docs/docs-hub.d.ts +93 -0
- package/dist/docs/docs-hub.js +142 -0
- package/dist/docs/docs-layout.d.ts +90 -0
- package/dist/docs/docs-layout.js +166 -0
- package/dist/docs/docs-nav-tools.d.ts +25 -0
- package/dist/docs/docs-nav-tools.js +14 -0
- package/dist/docs/docs-nav.d.ts +57 -0
- package/dist/docs/docs-nav.js +76 -0
- package/dist/docs/docs-not-found.d.ts +68 -0
- package/dist/docs/docs-not-found.js +100 -0
- package/dist/docs/docs-page-header.d.ts +55 -0
- package/dist/docs/docs-page-header.js +54 -0
- package/dist/docs/docs-pager.d.ts +50 -0
- package/dist/docs/docs-pager.js +75 -0
- package/dist/docs/file-tree.d.ts +57 -0
- package/dist/docs/file-tree.js +142 -0
- package/dist/docs/index.d.ts +38 -0
- package/dist/docs/index.js +38 -0
- package/dist/docs/install-command.d.ts +54 -0
- package/dist/docs/install-command.js +33 -0
- package/dist/docs/mixins/code-tabs-sync.d.ts +47 -0
- package/dist/docs/mixins/code-tabs-sync.js +137 -0
- package/dist/docs/mixins/copy-feedback.d.ts +25 -0
- package/dist/docs/mixins/copy-feedback.js +49 -0
- package/dist/docs/mixins/copy-from-url.d.ts +27 -0
- package/dist/docs/mixins/copy-from-url.js +95 -0
- package/dist/docs/mixins/docs-nav-tools.d.ts +27 -0
- package/dist/docs/mixins/docs-nav-tools.js +124 -0
- package/dist/docs/mixins/toc-spy.d.ts +30 -0
- package/dist/docs/mixins/toc-spy.js +165 -0
- package/dist/docs/next-steps.d.ts +45 -0
- package/dist/docs/next-steps.js +80 -0
- package/dist/docs/page-actions.d.ts +77 -0
- package/dist/docs/page-actions.js +78 -0
- package/dist/docs/plan-notice.d.ts +28 -0
- package/dist/docs/plan-notice.js +33 -0
- package/dist/docs/props-table.d.ts +64 -0
- package/dist/docs/props-table.js +147 -0
- package/dist/docs/steps.d.ts +51 -0
- package/dist/docs/steps.js +112 -0
- package/dist/docs/table-of-contents.d.ts +49 -0
- package/dist/docs/table-of-contents.js +139 -0
- package/dist/docs/ui-label.d.ts +51 -0
- package/dist/docs/ui-label.js +64 -0
- package/dist/docs/utils/docs-tree.d.ts +81 -0
- package/dist/docs/utils/docs-tree.js +57 -0
- package/dist/docs/utils/reveal-in-scroller.d.ts +19 -0
- package/dist/docs/utils/reveal-in-scroller.js +43 -0
- package/dist/landing/accent-text.d.ts +47 -0
- package/dist/landing/accent-text.js +107 -0
- package/dist/landing/animations/entrance.d.ts +40 -0
- package/dist/landing/animations/entrance.js +52 -0
- package/dist/landing/announcement-chip.d.ts +45 -0
- package/dist/landing/announcement-chip.js +36 -0
- package/dist/landing/author-band.d.ts +78 -0
- package/dist/landing/author-band.js +190 -0
- package/dist/landing/bento.d.ts +99 -0
- package/dist/landing/bento.js +138 -0
- package/dist/landing/changelog-strip.d.ts +74 -0
- package/dist/landing/changelog-strip.js +201 -0
- package/dist/{patterns → landing}/check-row.js +5 -7
- package/dist/{patterns → landing}/closing-cta.d.ts +4 -4
- package/dist/{patterns → landing}/closing-cta.js +8 -8
- package/dist/landing/code-stage.d.ts +93 -0
- package/dist/landing/code-stage.js +434 -0
- package/dist/landing/crosshair.d.ts +44 -0
- package/dist/landing/crosshair.js +48 -0
- package/dist/landing/curriculum.d.ts +79 -0
- package/dist/landing/curriculum.js +194 -0
- package/dist/landing/drawn-chart.d.ts +74 -0
- package/dist/landing/drawn-chart.js +377 -0
- package/dist/landing/event-ticker.d.ts +71 -0
- package/dist/landing/event-ticker.js +331 -0
- package/dist/landing/fan-out-diagram.d.ts +70 -0
- package/dist/landing/fan-out-diagram.js +481 -0
- package/dist/{patterns → landing}/faq-band.d.ts +5 -5
- package/dist/{patterns → landing}/faq-band.js +13 -14
- package/dist/landing/feature-band.d.ts +108 -0
- package/dist/landing/feature-band.js +67 -0
- package/dist/landing/feature.d.ts +148 -0
- package/dist/landing/feature.js +219 -0
- package/dist/landing/flow-diagram.d.ts +62 -0
- package/dist/landing/flow-diagram.js +240 -0
- package/dist/{patterns → landing}/icon-well.d.ts +17 -7
- package/dist/landing/icon-well.js +31 -0
- package/dist/landing/index.d.ts +52 -0
- package/dist/landing/index.js +52 -0
- package/dist/{patterns → landing}/install-tabs.js +4 -5
- package/dist/landing/landing-header.d.ts +103 -0
- package/dist/landing/landing-header.js +110 -0
- package/dist/landing/landing-hero.d.ts +119 -0
- package/dist/landing/landing-hero.js +172 -0
- package/dist/{components/marketing-section.d.ts → landing/landing-section.d.ts} +38 -15
- package/dist/landing/landing-section.js +183 -0
- package/dist/landing/logo-cloud.d.ts +56 -0
- package/dist/landing/logo-cloud.js +160 -0
- package/dist/landing/logo-sentence.d.ts +38 -0
- package/dist/landing/logo-sentence.js +51 -0
- package/dist/landing/marquee.d.ts +44 -0
- package/dist/landing/marquee.js +97 -0
- package/dist/landing/motion-loop.d.ts +43 -0
- package/dist/landing/motion-loop.js +42 -0
- package/dist/landing/pricing-band.d.ts +94 -0
- package/dist/landing/pricing-band.js +151 -0
- package/dist/landing/product-frame.d.ts +108 -0
- package/dist/landing/product-frame.js +202 -0
- package/dist/{patterns → landing}/proof-strip.d.ts +4 -4
- package/dist/{patterns → landing}/proof-strip.js +3 -3
- package/dist/landing/rails.d.ts +45 -0
- package/dist/landing/rails.js +69 -0
- package/dist/landing/rotating-text.d.ts +44 -0
- package/dist/landing/rotating-text.js +67 -0
- package/dist/landing/segmented-stage.d.ts +75 -0
- package/dist/landing/segmented-stage.js +141 -0
- package/dist/landing/sequence-diagram.d.ts +65 -0
- package/dist/landing/sequence-diagram.js +348 -0
- package/dist/landing/site-footer.d.ts +100 -0
- package/dist/landing/site-footer.js +274 -0
- package/dist/landing/site-header.d.ts +126 -0
- package/dist/landing/site-header.js +595 -0
- package/dist/{components → landing}/split.d.ts +12 -5
- package/dist/{components → landing}/split.js +26 -18
- package/dist/landing/sponsor-wall.d.ts +81 -0
- package/dist/landing/sponsor-wall.js +241 -0
- package/dist/{components → landing}/stat-strip.d.ts +31 -7
- package/dist/landing/stat-strip.js +105 -0
- package/dist/landing/step-list.d.ts +73 -0
- package/dist/landing/step-list.js +182 -0
- package/dist/landing/styles/card-grid.d.ts +115 -0
- package/dist/landing/styles/card-grid.js +295 -0
- package/dist/{patterns → landing}/tabbed-stage.d.ts +26 -8
- package/dist/landing/tabbed-stage.js +233 -0
- package/dist/landing/testimonial-band.d.ts +110 -0
- package/dist/landing/testimonial-band.js +164 -0
- package/dist/landing/typed-terminal.d.ts +62 -0
- package/dist/landing/typed-terminal.js +233 -0
- package/dist/landing/utils/pause-toggle.d.ts +37 -0
- package/dist/landing/utils/pause-toggle.js +71 -0
- package/dist/mixins/confirm-phrase.d.ts +19 -0
- package/dist/mixins/confirm-phrase.js +56 -0
- package/dist/mixins/copy-to-clipboard.d.ts +6 -0
- package/dist/mixins/copy-to-clipboard.js +17 -1
- package/dist/mixins/dialog-dismiss.d.ts +21 -0
- package/dist/mixins/dialog-dismiss.js +62 -0
- package/dist/mixins/index.d.ts +4 -15
- package/dist/mixins/index.js +4 -15
- package/dist/mixins/viewer-time.d.ts +20 -0
- package/dist/mixins/viewer-time.js +40 -0
- package/dist/styles/index.d.ts +3 -5
- package/dist/styles/index.js +3 -5
- package/dist/styles/landing.d.ts +200 -0
- package/dist/styles/landing.js +516 -0
- package/dist/styles/segmented-control.d.ts +49 -0
- package/dist/styles/segmented-control.js +71 -0
- package/dist/styles/surface-control.d.ts +18 -0
- package/dist/styles/surface-control.js +31 -0
- package/dist/test/table.d.ts +65 -0
- package/dist/test/table.js +108 -0
- package/dist/utils/eyebrow.d.ts +39 -0
- package/dist/utils/eyebrow.js +21 -0
- package/dist/utils/index.d.ts +2 -5
- package/dist/utils/index.js +2 -5
- package/dist/utils/relative-time.d.ts +44 -0
- package/dist/utils/relative-time.js +69 -0
- package/package.json +16 -6
- package/src/theme.css +87 -22
- package/dist/components/empty.d.ts +0 -91
- package/dist/components/empty.js +0 -151
- package/dist/components/feature.d.ts +0 -102
- package/dist/components/feature.js +0 -150
- package/dist/components/logo-cloud.d.ts +0 -42
- package/dist/components/logo-cloud.js +0 -41
- package/dist/components/marketing-header.d.ts +0 -71
- package/dist/components/marketing-header.js +0 -81
- package/dist/components/marketing-section.js +0 -117
- package/dist/components/skeleton.d.ts +0 -36
- package/dist/components/skeleton.js +0 -38
- package/dist/components/stat-strip.js +0 -65
- package/dist/components/table.d.ts +0 -152
- package/dist/components/table.js +0 -238
- package/dist/patterns/accent-text.d.ts +0 -30
- package/dist/patterns/accent-text.js +0 -17
- package/dist/patterns/announcement-chip.d.ts +0 -41
- package/dist/patterns/announcement-chip.js +0 -49
- package/dist/patterns/bento.d.ts +0 -68
- package/dist/patterns/bento.js +0 -94
- package/dist/patterns/code-stage.d.ts +0 -63
- package/dist/patterns/code-stage.js +0 -82
- package/dist/patterns/feature-band.d.ts +0 -85
- package/dist/patterns/feature-band.js +0 -50
- package/dist/patterns/icon-well.js +0 -38
- package/dist/patterns/index.d.ts +0 -23
- package/dist/patterns/index.js +0 -23
- package/dist/patterns/landing-hero.d.ts +0 -93
- package/dist/patterns/landing-hero.js +0 -126
- package/dist/patterns/product-frame.d.ts +0 -60
- package/dist/patterns/product-frame.js +0 -70
- package/dist/patterns/step-list.d.ts +0 -47
- package/dist/patterns/step-list.js +0 -85
- package/dist/patterns/tabbed-stage.js +0 -77
- package/dist/styles/marketing.d.ts +0 -120
- package/dist/styles/marketing.js +0 -225
- package/dist/utils/semantic-color-panel.d.ts +0 -35
- package/dist/utils/semantic-color-panel.js +0 -28
- /package/dist/{behaviors → app/behaviors}/drag-session.d.ts +0 -0
- /package/dist/{behaviors → app/behaviors}/resize-session.d.ts +0 -0
- /package/dist/{behaviors → app/behaviors}/resize-session.js +0 -0
- /package/dist/{behaviors → app/behaviors}/selection-model.d.ts +0 -0
- /package/dist/{behaviors → app/behaviors}/selection-model.js +0 -0
- /package/dist/{components → app}/drop-indicator.d.ts +0 -0
- /package/dist/{components → app}/file-trigger.d.ts +0 -0
- /package/dist/{components → app}/menubar.d.ts +0 -0
- /package/dist/{mixins → app/mixins}/chart-tooltip.d.ts +0 -0
- /package/dist/{mixins → app/mixins}/chart-tooltip.js +0 -0
- /package/dist/{mixins → app/mixins}/context-menu.d.ts +0 -0
- /package/dist/{mixins → app/mixins}/context-menu.js +0 -0
- /package/dist/{mixins → app/mixins}/drag-reorder.d.ts +0 -0
- /package/dist/{mixins → app/mixins}/drop-zone.d.ts +0 -0
- /package/dist/{mixins → app/mixins}/grid-list-keys.d.ts +0 -0
- /package/dist/{mixins → app/mixins}/menubar-keys.d.ts +0 -0
- /package/dist/{mixins → app/mixins}/resize-handle.d.ts +0 -0
- /package/dist/{mixins/treeKeys.d.ts → app/mixins/tree-keys.d.ts} +0 -0
- /package/dist/{components → app}/resizable.d.ts +0 -0
- /package/dist/{components → app}/shortcut-list.d.ts +0 -0
- /package/dist/{styles → app/styles}/chart-palette.js +0 -0
- /package/dist/{styles → app/styles}/graphic-host.js +0 -0
- /package/dist/{styles → app/styles}/legend-toggle.js +0 -0
- /package/dist/{components → app}/toolbar.d.ts +0 -0
- /package/dist/{utils → app/utils}/chart-scale.d.ts +0 -0
- /package/dist/{behaviors → chat/behaviors}/scroll-follow-model.d.ts +0 -0
- /package/dist/{components → chat}/bubble.d.ts +0 -0
- /package/dist/{components → chat}/marker.d.ts +0 -0
- /package/dist/{components → chat}/message.d.ts +0 -0
- /package/dist/{mixins → chat/mixins}/attachment-trigger.d.ts +0 -0
- /package/dist/{mixins → chat/mixins}/attachment-trigger.js +0 -0
- /package/dist/{mixins → chat/mixins}/message-follow.d.ts +0 -0
- /package/dist/{components → color}/color-area.d.ts +0 -0
- /package/dist/{components → color}/color-field.d.ts +0 -0
- /package/dist/{components → color}/color-slider.d.ts +0 -0
- /package/dist/{components → color}/color-swatch-picker.d.ts +0 -0
- /package/dist/{components → color}/color-swatch.d.ts +0 -0
- /package/dist/{components → color}/color-wheel.d.ts +0 -0
- /package/dist/{mixins → color/mixins}/color-channel-sync.d.ts +0 -0
- /package/dist/{mixins → color/mixins}/color-channel-sync.js +0 -0
- /package/dist/{mixins → color/mixins}/color-preview.d.ts +0 -0
- /package/dist/{mixins → color/mixins}/color-wheel-drag.d.ts +0 -0
- /package/dist/{styles → color/styles}/rtl-aware-gradient-direction.js +0 -0
- /package/dist/{utils → color/utils}/hue-spectrum.d.ts +0 -0
- /package/dist/{utils → color/utils}/hue-spectrum.js +0 -0
- /package/dist/{patterns → landing}/check-row.d.ts +0 -0
- /package/dist/{patterns → landing}/install-tabs.d.ts +0 -0
|
@@ -0,0 +1,839 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "remix/component/jsx-runtime";
|
|
2
|
+
import { ArrowDownIcon, ArrowUpDownIcon, ArrowUpIcon, EllipsisIcon } from "@sdxc/icons";
|
|
3
|
+
import { bg, center, container, cursor, fg, flex, font, fontSize, gap, hidden, hover, is, items, justify, keyframes, nowrap, opacity, outline, overflow, p, pb, pi, raw, relative, shrink, tabularNums, textAlign, textDecoration, truncate, userSelect, virtualize, weight, when, } from "@sdxc/u";
|
|
4
|
+
import { visuallyHidden } from "@sdxc/u/a11y";
|
|
5
|
+
import { mergeMix } from "@sdxc/u/general";
|
|
6
|
+
import { attrs, clientEntry } from "remix/component";
|
|
7
|
+
import { Button } from "../components/button.js";
|
|
8
|
+
import { Checkbox } from "../components/checkbox.js";
|
|
9
|
+
import { LinkButton } from "../components/link-button.js";
|
|
10
|
+
import { Menu } from "../components/menu.js";
|
|
11
|
+
import { RelativeTime } from "../components/relative-time.js";
|
|
12
|
+
import { StatusDot } from "../components/status-dot.js";
|
|
13
|
+
import { floatingSurface, SURFACE_PADDING } from "../styles/floating-surface.js";
|
|
14
|
+
import { interactiveTransition } from "../styles/interactive-transition.js";
|
|
15
|
+
import { warnIfNoAccessibleLabel } from "../utils/warn-if-no-accessible-name.js";
|
|
16
|
+
import { ROW_NAVIGATION_ATTRIBUTE, rowNavigation } from "./mixins/row-navigation.js";
|
|
17
|
+
import { tableSelection } from "./mixins/table-selection.js";
|
|
18
|
+
/**
|
|
19
|
+
* Named container {@link Table.Container} declares on its own host, so a
|
|
20
|
+
* consumer's own descendant styles can query the wrapper's width instead of
|
|
21
|
+
* the page's.
|
|
22
|
+
*/
|
|
23
|
+
const CONTAINER_NAME = "ui-table";
|
|
24
|
+
/** Text alignment {@link Table.Column} falls back to when `align` is omitted. */
|
|
25
|
+
const DEFAULT_ALIGN = "start";
|
|
26
|
+
/**
|
|
27
|
+
* Text alignment a `numeric` {@link Table.Column} falls back to when `align` is
|
|
28
|
+
* omitted, lining its header up with the end-aligned figures beneath it.
|
|
29
|
+
*/
|
|
30
|
+
const DEFAULT_NUMERIC_ALIGN = "end";
|
|
31
|
+
/**
|
|
32
|
+
* Flex alignment a sortable header's link takes for each column alignment, so the
|
|
33
|
+
* link fills the whole cell and still places its label where `align` puts it.
|
|
34
|
+
*/
|
|
35
|
+
const JUSTIFY_BY_ALIGN = { start: "start", center: "center", end: "end" };
|
|
36
|
+
/** Row block size for each density; compact leaves the variable to an app-wide setting. */
|
|
37
|
+
const ROW_BLOCK_SIZE = "var(--ui-table-row-block-size, 2.5rem)";
|
|
38
|
+
/** Surface behind sticky headers and pinned cells, which must be opaque to cover what scrolls under them. */
|
|
39
|
+
const TABLE_BG = "var(--ui-table-bg, var(--ui-bg, Canvas))";
|
|
40
|
+
/** The row's tint as an image, layered over {@link TABLE_BG} by a surface that covers the row. */
|
|
41
|
+
const ROW_TINT_IMAGE = "linear-gradient(var(--ui-table-row-tint, transparent), var(--ui-table-row-tint, transparent))";
|
|
42
|
+
/** Edge shadow a pinned first column casts once the table scrolls sideways. */
|
|
43
|
+
const PIN_SHADOW_KEYFRAMES = "ui-table-pin-shadow";
|
|
44
|
+
/** Characters an id cell keeps visible after the ellipsis, where ids differ most. */
|
|
45
|
+
const DEFAULT_ID_TAIL = 4;
|
|
46
|
+
/** Upper bound a data bar's value is measured against when `max` is omitted: a proportion. */
|
|
47
|
+
const DEFAULT_BAR_MAX = 1;
|
|
48
|
+
/** What a typed cell shows for a value that is unknown or missing. */
|
|
49
|
+
const EMPTY_VALUE = "—";
|
|
50
|
+
/**
|
|
51
|
+
* Width of the `ui-table` container at or below which {@link Table.Actions} shows one menu
|
|
52
|
+
* button in place of its inline actions, so a phone's narrow columns keep their own space.
|
|
53
|
+
*/
|
|
54
|
+
const ACTIONS_OVERFLOW_QUERY = "@container ui-table (max-width: 40rem)";
|
|
55
|
+
/**
|
|
56
|
+
* Pointers precise enough to hover a row, where {@link Table.Actions} hide until wanted and
|
|
57
|
+
* reveal over the row's end; a coarse pointer gets them in place even when it reports hover.
|
|
58
|
+
*/
|
|
59
|
+
const FINE_HOVER_QUERY = "@media (hover: hover) and (pointer: fine)";
|
|
60
|
+
/** Size of the ⋯ button, a fingertip's target under a coarse pointer. */
|
|
61
|
+
const MENU_BUTTON_SIZE = {
|
|
62
|
+
minInlineSize: "var(--ui-target-size, 1.5rem)",
|
|
63
|
+
minBlockSize: "var(--ui-target-size, 1.5rem)",
|
|
64
|
+
"@media (pointer: coarse)": {
|
|
65
|
+
minInlineSize: "var(--ui-target-size, 2.75rem)",
|
|
66
|
+
minBlockSize: "var(--ui-target-size, 2.75rem)",
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* How far the overlay of hover-revealed {@link Table.Actions} fades in ahead of its own box, and
|
|
71
|
+
* how long that fade is: text of the last visible cell running under the overlay fades out
|
|
72
|
+
* across it, reaching full cover only where the first action's label starts.
|
|
73
|
+
*/
|
|
74
|
+
const ACTIONS_FADE_LEAD = "1rem";
|
|
75
|
+
/** Length of the overlay's leading fade, from fully clear to the row's opaque surface. */
|
|
76
|
+
const ACTIONS_FADE_LENGTH = "2rem";
|
|
77
|
+
/**
|
|
78
|
+
* Hover and press fills for ghost controls in the actions overlay, mixed from each color's own
|
|
79
|
+
* foreground so they read as a step on the row's tint in light and dark. They paint as a
|
|
80
|
+
* background image, which no control style sets, so they show over whatever fill the control
|
|
81
|
+
* keeps; controls inside a dialog or popover a row action opens keep their own.
|
|
82
|
+
*/
|
|
83
|
+
const ACTIONS_HOVER_FILLS = Object.fromEntries(["brand", "neutral", "success", "warning", "danger"].flatMap((color) => {
|
|
84
|
+
let fg = color === "neutral" ? "var(--ui-neutral-fg-emphasis)" : `var(--ui-${color}-fg)`;
|
|
85
|
+
let control = `& :is(a, button)[data-variant="ghost"][data-color="${color}"]:not(:is(dialog, [popover]:not([data-slot="row-actions-inline"])) *)`;
|
|
86
|
+
let fill = (share) => {
|
|
87
|
+
let tone = `color-mix(in srgb, ${fg} ${share}%, transparent)`;
|
|
88
|
+
return { backgroundImage: `linear-gradient(${tone}, ${tone})` };
|
|
89
|
+
};
|
|
90
|
+
return [
|
|
91
|
+
[`${control}:hover`, fill(10)],
|
|
92
|
+
[`${control}:active`, fill(16)],
|
|
93
|
+
];
|
|
94
|
+
}));
|
|
95
|
+
/** Interactive elements that sit above a whole-row link, so they keep their own clicks. */
|
|
96
|
+
const ROW_CONTROLS = ':is(a, button, label, select, textarea, summary, [role="button"])';
|
|
97
|
+
/**
|
|
98
|
+
* Renders the `<table>` host: full width, border-collapsed, small text. `density` sets the row
|
|
99
|
+
* height, `pinFirstColumn` keeps the first column in view with a scroll-driven edge shadow,
|
|
100
|
+
* and `aria-busy="true"` dims the body while it refetches. Dev mode warns without a name.
|
|
101
|
+
*
|
|
102
|
+
* @param handle Runtime handle carrying the host `<table>`'s props.
|
|
103
|
+
* @returns The render function producing the table's markup.
|
|
104
|
+
* @example
|
|
105
|
+
* <Table aria-label={t("monitors.title")} density="comfortable" pinFirstColumn>
|
|
106
|
+
* <Table.Header>…</Table.Header>
|
|
107
|
+
* <Table.Body>…</Table.Body>
|
|
108
|
+
* </Table>
|
|
109
|
+
* @example <Table aria-label={t("monitors.title")} aria-busy={refreshing ? "true" : undefined}>…</Table>
|
|
110
|
+
*/
|
|
111
|
+
export function Table(handle) {
|
|
112
|
+
handle.context.set({ actionsLabelId: `${handle.id}-actions` });
|
|
113
|
+
return () => {
|
|
114
|
+
let { density, pinFirstColumn, mix, ...rest } = handle.props;
|
|
115
|
+
warnIfNoAccessibleLabel(handle.props, 'Table: needs an "aria-label" or "aria-labelledby" describing its contents for assistive technology.');
|
|
116
|
+
return (_jsx("table", { ...rest, "data-slot": "table", "data-density": density, "data-pin-first": pinFirstColumn ? "" : undefined, mix: mergeMix([
|
|
117
|
+
is("100%"),
|
|
118
|
+
fontSize("sm"),
|
|
119
|
+
keyframes(PIN_SHADOW_KEYFRAMES, { from: { opacity: 0 }, to: { opacity: 1 } }),
|
|
120
|
+
raw({
|
|
121
|
+
borderCollapse: "collapse",
|
|
122
|
+
'&[data-density="compact"]': { "--ui-table-row-block-size": "2.5rem" },
|
|
123
|
+
'&[data-density="comfortable"]': { "--ui-table-row-block-size": "3.5rem" },
|
|
124
|
+
/**
|
|
125
|
+
* Compact rows keep one line per cell, so every row stays the same height and a
|
|
126
|
+
* long value widens its column, scrolling the table inside its container.
|
|
127
|
+
*/
|
|
128
|
+
'&:not([data-density="comfortable"]) > * > tr > *': { whiteSpace: "nowrap" },
|
|
129
|
+
"& > tbody": { transition: "opacity 200ms ease-out" },
|
|
130
|
+
'&[aria-busy="true"] > tbody': { opacity: 0.5 },
|
|
131
|
+
"@media (prefers-reduced-motion: reduce)": { "& > tbody": { transition: "none" } },
|
|
132
|
+
"&[data-pin-first] > tbody > tr > :first-child": {
|
|
133
|
+
position: "sticky",
|
|
134
|
+
insetInlineStart: 0,
|
|
135
|
+
zIndex: 1,
|
|
136
|
+
backgroundColor: TABLE_BG,
|
|
137
|
+
backgroundImage: ROW_TINT_IMAGE,
|
|
138
|
+
},
|
|
139
|
+
"&[data-pin-first] > * > tr > :first-child::after": {
|
|
140
|
+
content: '""',
|
|
141
|
+
position: "absolute",
|
|
142
|
+
insetBlock: 0,
|
|
143
|
+
insetInlineStart: "100%",
|
|
144
|
+
inlineSize: "0.75rem",
|
|
145
|
+
pointerEvents: "none",
|
|
146
|
+
opacity: 0,
|
|
147
|
+
backgroundImage: "linear-gradient(to var(--ui-table-pin-shadow-direction, right), color-mix(in oklab, var(--ui-fg, CanvasText) 14%, transparent), transparent)",
|
|
148
|
+
},
|
|
149
|
+
"&[data-pin-first]:dir(rtl)": { "--ui-table-pin-shadow-direction": "left" },
|
|
150
|
+
"@supports (animation-timeline: scroll())": {
|
|
151
|
+
"&[data-pin-first] > * > tr > :first-child::after": {
|
|
152
|
+
animationName: PIN_SHADOW_KEYFRAMES,
|
|
153
|
+
animationDuration: "auto",
|
|
154
|
+
animationTimingFunction: "linear",
|
|
155
|
+
animationFillMode: "both",
|
|
156
|
+
animationTimeline: "scroll(nearest inline)",
|
|
157
|
+
animationRange: "0 1rem",
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
}),
|
|
161
|
+
], mix) }));
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Renders the scrolling wrapper around {@link Table}: the table scrolls sideways inside it
|
|
166
|
+
* instead of widening the page, and the header sticks to its own top edge, whatever sticky offset
|
|
167
|
+
* the page around it sets. Give it a `max-block-size` to scroll rows inside it; the `ui-table`
|
|
168
|
+
* container is declared here.
|
|
169
|
+
*
|
|
170
|
+
* @param handle Runtime handle carrying the host `<div>`'s props.
|
|
171
|
+
* @returns The render function producing the wrapper's markup.
|
|
172
|
+
* @example
|
|
173
|
+
* <Table.Container>
|
|
174
|
+
* <Table aria-label={t("subjects.title")}>...</Table>
|
|
175
|
+
* </Table.Container>
|
|
176
|
+
*/
|
|
177
|
+
Table.Container = function TableContainer(handle) {
|
|
178
|
+
return () => {
|
|
179
|
+
let { mix, ...rest } = handle.props;
|
|
180
|
+
return (_jsx("div", { ...rest, "data-slot": "container", mix: mergeMix([
|
|
181
|
+
relative(),
|
|
182
|
+
is("100%"),
|
|
183
|
+
overflow("auto"),
|
|
184
|
+
container(CONTAINER_NAME),
|
|
185
|
+
raw({ "--ui-app-sticky-top": "0px" }),
|
|
186
|
+
when(`& [${ROW_NAVIGATION_ATTRIBUTE}]:focus-visible`, outline({ color: "brand.ring", width: 2, offset: -2 })),
|
|
187
|
+
], mix) }));
|
|
188
|
+
};
|
|
189
|
+
};
|
|
190
|
+
/**
|
|
191
|
+
* Renders the `<thead>` host, whose header cells stick at `--ui-app-sticky-top` (below an app's
|
|
192
|
+
* own sticky bar) over an opaque surface, ruled from the body by an inset line that stays with
|
|
193
|
+
* them as they stick.
|
|
194
|
+
*
|
|
195
|
+
* @param handle Runtime handle carrying the host `<thead>`'s props.
|
|
196
|
+
* @returns The render function producing the header section's markup.
|
|
197
|
+
* @example
|
|
198
|
+
* <Table.Header>
|
|
199
|
+
* <Table.Row>
|
|
200
|
+
* <Table.Column>{t("subjects.name")}</Table.Column>
|
|
201
|
+
* </Table.Row>
|
|
202
|
+
* </Table.Header>
|
|
203
|
+
*/
|
|
204
|
+
Table.Header = function TableHeader(handle) {
|
|
205
|
+
return () => {
|
|
206
|
+
let { mix, ...rest } = handle.props;
|
|
207
|
+
return (_jsx("thead", { ...rest, "data-slot": "header", mix: mergeMix(raw({
|
|
208
|
+
"& > tr > th": {
|
|
209
|
+
position: "sticky",
|
|
210
|
+
insetBlockStart: "var(--ui-app-sticky-top, 0px)",
|
|
211
|
+
zIndex: 2,
|
|
212
|
+
backgroundColor: TABLE_BG,
|
|
213
|
+
boxShadow: "inset 0 -1px 0 var(--ui-neutral-border)",
|
|
214
|
+
},
|
|
215
|
+
"[data-pin-first] > & > tr > th:first-child": { insetInlineStart: 0, zIndex: 3 },
|
|
216
|
+
}), mix) }));
|
|
217
|
+
};
|
|
218
|
+
};
|
|
219
|
+
/**
|
|
220
|
+
* Renders the table's `<tbody>` host: a block-start border rules the space
|
|
221
|
+
* between direct row children, and `content-visibility: auto` lets a long
|
|
222
|
+
* body's off-screen rows skip layout and paint until they scroll into view.
|
|
223
|
+
*
|
|
224
|
+
* @param handle Runtime handle carrying the host `<tbody>`'s props.
|
|
225
|
+
* @returns The render function producing the body section's markup.
|
|
226
|
+
* @example
|
|
227
|
+
* <Table.Body>
|
|
228
|
+
* {subjects.map((subject) => (
|
|
229
|
+
* <Table.Row key={subject.id}>
|
|
230
|
+
* <Table.Cell>{subject.name}</Table.Cell>
|
|
231
|
+
* </Table.Row>
|
|
232
|
+
* ))}
|
|
233
|
+
* </Table.Body>
|
|
234
|
+
*/
|
|
235
|
+
Table.Body = function TableBody(handle) {
|
|
236
|
+
return () => {
|
|
237
|
+
let { mix, ...rest } = handle.props;
|
|
238
|
+
return (_jsx("tbody", { ...rest, "data-slot": "body", mix: mergeMix([
|
|
239
|
+
virtualize("auto var(--ui-table-body-intrinsic-size, 32rem)"),
|
|
240
|
+
raw({
|
|
241
|
+
"& > :not([hidden]) ~ :not([hidden])": {
|
|
242
|
+
borderBlockStart: "1px solid var(--ui-neutral-border)",
|
|
243
|
+
},
|
|
244
|
+
}),
|
|
245
|
+
], mix) }));
|
|
246
|
+
};
|
|
247
|
+
};
|
|
248
|
+
/**
|
|
249
|
+
* Renders a column header inside a native `<th scope="col">`, aligned by `data-align`.
|
|
250
|
+
* Setting `href` makes the header a cell-filling sort link with `aria-sort` and a direction
|
|
251
|
+
* indicator held square, so a header narrow enough to squeeze the link keeps both arrows legible.
|
|
252
|
+
*
|
|
253
|
+
* @param handle Runtime handle carrying the host `<th>`'s props.
|
|
254
|
+
* @returns The render function producing the column header's markup.
|
|
255
|
+
* @example
|
|
256
|
+
* <Table.Column>{t("subjects.email")}</Table.Column>
|
|
257
|
+
* @example
|
|
258
|
+
* <Table.Column numeric>{t("invoices.amount")}</Table.Column>
|
|
259
|
+
* @example
|
|
260
|
+
* <Table.Column href={sortUrl("name", nextDirection)} sortDirection={activeSort === "name" ? currentDirection : undefined}>
|
|
261
|
+
* {t("subjects.name")}
|
|
262
|
+
* </Table.Column>
|
|
263
|
+
*/
|
|
264
|
+
Table.Column = function TableColumn(handle) {
|
|
265
|
+
return () => {
|
|
266
|
+
let { align, numeric, href, sortDirection, parts, children, mix, ...rest } = handle.props;
|
|
267
|
+
let resolvedAlign = align ?? (numeric ? DEFAULT_NUMERIC_ALIGN : DEFAULT_ALIGN);
|
|
268
|
+
return (_jsx("th", { ...rest, "data-align": resolvedAlign, "data-numeric": numeric ? "" : undefined, "aria-sort": href ? (sortDirection ?? "none") : undefined, "data-slot": "column", mix: mergeMix([
|
|
269
|
+
attrs({ scope: "col" }),
|
|
270
|
+
href ? undefined : [pi("1rem"), pb("0.25rem")],
|
|
271
|
+
textAlign("start"),
|
|
272
|
+
weight(500),
|
|
273
|
+
fg("neutral"),
|
|
274
|
+
raw({ whiteSpace: "nowrap" }),
|
|
275
|
+
when('&[data-align="center"]', textAlign("center")),
|
|
276
|
+
when('&[data-align="end"]', textAlign("end")),
|
|
277
|
+
when("&[aria-sort]:hover", bg({
|
|
278
|
+
image: "linear-gradient(var(--ui-neutral-bg-tint), var(--ui-neutral-bg-tint))",
|
|
279
|
+
})),
|
|
280
|
+
when("&[aria-sort]", [cursor("pointer"), userSelect()]),
|
|
281
|
+
], mix), children: href ? (_jsxs("a", { href: href, mix: [
|
|
282
|
+
when("&:focus-visible", outline({ color: "brand.ring", offset: -2 })),
|
|
283
|
+
flex(),
|
|
284
|
+
justify(JUSTIFY_BY_ALIGN[resolvedAlign]),
|
|
285
|
+
pi("1rem"),
|
|
286
|
+
pb("0.25rem"),
|
|
287
|
+
items("center"),
|
|
288
|
+
gap("0.25rem"),
|
|
289
|
+
fg("inherit"),
|
|
290
|
+
textDecoration("none"),
|
|
291
|
+
hover(textDecoration("underline")),
|
|
292
|
+
parts?.link,
|
|
293
|
+
], children: [children, sortDirection === "ascending" && _jsx(ArrowUpIcon, { size: 14, mix: [shrink()] }), sortDirection === "descending" && _jsx(ArrowDownIcon, { size: 14, mix: [shrink()] }), !sortDirection && _jsx(ArrowUpDownIcon, { size: 14, mix: [shrink(), opacity(40)] })] })) : (children) }));
|
|
294
|
+
};
|
|
295
|
+
};
|
|
296
|
+
/**
|
|
297
|
+
* Renders a native `<tr>` host at the density's block size. It tints on hover and when
|
|
298
|
+
* selected, through a checked selection checkbox or `aria-selected="true"`; a row holding a
|
|
299
|
+
* {@link Table.RowLink} positions itself so the link covers it, with its other controls above.
|
|
300
|
+
*
|
|
301
|
+
* @param handle Runtime handle carrying the host `<tr>`'s props.
|
|
302
|
+
* @returns The render function producing the row's markup.
|
|
303
|
+
* @example
|
|
304
|
+
* <Table.Row>
|
|
305
|
+
* <Table.Cell>{subject.name}</Table.Cell>
|
|
306
|
+
* </Table.Row>
|
|
307
|
+
* @example
|
|
308
|
+
* <Table.Row aria-selected="true">
|
|
309
|
+
* <Table.Cell>{subject.name}</Table.Cell>
|
|
310
|
+
* </Table.Row>
|
|
311
|
+
*/
|
|
312
|
+
Table.Row = function TableRow(handle) {
|
|
313
|
+
return () => {
|
|
314
|
+
let { mix, ...rest } = handle.props;
|
|
315
|
+
return (_jsx("tr", { ...rest, "data-slot": "row", mix: mergeMix([
|
|
316
|
+
interactiveTransition(),
|
|
317
|
+
raw({
|
|
318
|
+
blockSize: ROW_BLOCK_SIZE,
|
|
319
|
+
backgroundColor: "var(--ui-table-row-tint, transparent)",
|
|
320
|
+
":is(thead) > &": { blockSize: "var(--ui-table-header-block-size, 2.5rem)" },
|
|
321
|
+
":is(tbody) > &:hover": { "--ui-table-row-tint": "var(--ui-neutral-bg-tint)" },
|
|
322
|
+
'&[aria-selected="true"], &:has([data-selection-item]:checked)': {
|
|
323
|
+
"--ui-table-row-tint": "var(--ui-brand-bg-tint)",
|
|
324
|
+
},
|
|
325
|
+
'&:has([data-slot="row-link"])': { position: "relative" },
|
|
326
|
+
"@media (hover: hover)": {
|
|
327
|
+
'&:has(> [data-slot="row-actions"])': { position: "relative" },
|
|
328
|
+
},
|
|
329
|
+
[`&:has([data-slot="row-link"]) ${ROW_CONTROLS}:not([data-slot="row-link"])`]: {
|
|
330
|
+
position: "relative",
|
|
331
|
+
zIndex: 1,
|
|
332
|
+
},
|
|
333
|
+
}),
|
|
334
|
+
], mix) }));
|
|
335
|
+
};
|
|
336
|
+
};
|
|
337
|
+
/**
|
|
338
|
+
* Renders a native `<td>` host, padded on every side and colored as the
|
|
339
|
+
* table's emphasized foreground text; a `numeric` cell end-aligns tabular figures.
|
|
340
|
+
*
|
|
341
|
+
* @param handle Runtime handle carrying the host `<td>`'s props.
|
|
342
|
+
* @returns The render function producing the cell's markup.
|
|
343
|
+
* @example
|
|
344
|
+
* <Table.Cell>{subject.name}</Table.Cell>
|
|
345
|
+
* @example
|
|
346
|
+
* <Table.Cell numeric>{formatCurrency(invoice.amount)}</Table.Cell>
|
|
347
|
+
*/
|
|
348
|
+
Table.Cell = function TableCell(handle) {
|
|
349
|
+
return () => {
|
|
350
|
+
let { numeric, mix, ...rest } = handle.props;
|
|
351
|
+
return (_jsx("td", { ...rest, "data-numeric": numeric ? "" : undefined, "data-slot": "cell", mix: mergeMix([
|
|
352
|
+
pi("1rem"),
|
|
353
|
+
pb("0.25rem"),
|
|
354
|
+
fg("neutral.emphasis"),
|
|
355
|
+
when("&[data-numeric]", [tabularNums(), textAlign("end")]),
|
|
356
|
+
], mix) }));
|
|
357
|
+
};
|
|
358
|
+
};
|
|
359
|
+
/**
|
|
360
|
+
* Client island the select-all header carries: a hidden marker whose mixin keeps the table's
|
|
361
|
+
* selection checkboxes in step. Loads from `@sdxc/ui/app/table#TableSelection` once the app's
|
|
362
|
+
* browser entry maps it; until then every row checkbox still works on its own.
|
|
363
|
+
*/
|
|
364
|
+
export const TableSelection = clientEntry("@sdxc/ui/app/table#TableSelection", function TableSelection() {
|
|
365
|
+
return () => _jsx("span", { mix: [hidden(), tableSelection()] });
|
|
366
|
+
});
|
|
367
|
+
/** Selector for the box {@link TableKeys} walks: the table's container, or the table itself. */
|
|
368
|
+
const TABLE_KEYS_SCOPE = '[data-slot="container"], table';
|
|
369
|
+
/**
|
|
370
|
+
* Client island behind {@link Table.Keys}: a hidden marker whose `rowNavigation()` walks the
|
|
371
|
+
* rows of the container it sits in. Loads from `@sdxc/ui/app/table#TableKeys` once the app's
|
|
372
|
+
* browser entry maps it; until then every row link and checkbox stays reachable by Tab.
|
|
373
|
+
*/
|
|
374
|
+
export const TableKeys = clientEntry("@sdxc/ui/app/table#TableKeys", function TableKeys(handle) {
|
|
375
|
+
return () => (_jsx("span", { mix: [hidden(), rowNavigation({ ...handle.props, within: TABLE_KEYS_SCOPE })] }));
|
|
376
|
+
});
|
|
377
|
+
/**
|
|
378
|
+
* Turns on keyboard row navigation for a server-rendered table: `j`/`k` and the arrows move
|
|
379
|
+
* through the rows with an inset ring, Enter or `o` opens the row's link, `x` toggles its
|
|
380
|
+
* checkbox and `/` focuses the search field. Place it inside `Table.Container`, beside the table.
|
|
381
|
+
*
|
|
382
|
+
* @param handle Runtime handle carrying the keys' options.
|
|
383
|
+
* @returns The render function producing the island.
|
|
384
|
+
* @example <Table.Container><Table.Keys search="q" labels={{ group: t("keys.list"), next: t("keys.next") }} /><Table>…</Table></Table.Container>
|
|
385
|
+
*/
|
|
386
|
+
Table.Keys = function TableKeysPart(handle) {
|
|
387
|
+
return () => _jsx(TableKeys, { ...handle.props });
|
|
388
|
+
};
|
|
389
|
+
/**
|
|
390
|
+
* Renders the selection column's header: a select-all checkbox marked `data-selection-all`,
|
|
391
|
+
* and the {@link TableSelection} island that makes it check every row, show indeterminate
|
|
392
|
+
* while some are, and lets shift-click check a range.
|
|
393
|
+
*
|
|
394
|
+
* @param handle Runtime handle carrying the host `<th>`'s props.
|
|
395
|
+
* @returns The render function producing the header cell.
|
|
396
|
+
* @example <Table.SelectAll label={t("monitors.selectAll")} />
|
|
397
|
+
*/
|
|
398
|
+
Table.SelectAll = function TableSelectAll(handle) {
|
|
399
|
+
return () => {
|
|
400
|
+
let { label, checked, mix, ...rest } = handle.props;
|
|
401
|
+
return (_jsxs("th", { ...rest, "data-slot": "selection-column", mix: mergeMix([attrs({ scope: "col" }), is("1%"), pi("1rem"), pb("0.25rem")], mix), children: [_jsx(Checkbox, { "aria-label": label, checked: checked, "data-selection-all": "" }), _jsx(TableSelection, {})] }));
|
|
402
|
+
};
|
|
403
|
+
};
|
|
404
|
+
/**
|
|
405
|
+
* Renders one row's selection checkbox, marked `data-selection-item` with the row's key as its
|
|
406
|
+
* value, so it submits with a form and any selection bar can count it.
|
|
407
|
+
*
|
|
408
|
+
* @param handle Runtime handle carrying the host `<td>`'s props.
|
|
409
|
+
* @returns The render function producing the cell.
|
|
410
|
+
* @example <Table.Select name="monitor" value={monitor.id} label={t("monitors.select", { name: monitor.name })} form="bulk" />
|
|
411
|
+
*/
|
|
412
|
+
Table.Select = function TableSelect(handle) {
|
|
413
|
+
return () => {
|
|
414
|
+
let { value, label, name, form, checked, disabled, mix, ...rest } = handle.props;
|
|
415
|
+
return (_jsx("td", { ...rest, "data-slot": "selection-cell", mix: mergeMix([is("1%"), pi("1rem"), pb("0.25rem")], mix), children: _jsx(Checkbox, { "aria-label": label, name: name, value: value, form: form, checked: checked, disabled: disabled, "data-selection-item": "" }) }));
|
|
416
|
+
};
|
|
417
|
+
};
|
|
418
|
+
/**
|
|
419
|
+
* Renders the header over the row actions with its name visually hidden, since the buttons
|
|
420
|
+
* beneath name themselves.
|
|
421
|
+
*
|
|
422
|
+
* @param handle Runtime handle carrying the host `<th>`'s props.
|
|
423
|
+
* @returns The render function producing the header cell.
|
|
424
|
+
* @example <Table.ActionsColumn label={t("monitors.actions")} />
|
|
425
|
+
*/
|
|
426
|
+
Table.ActionsColumn = function TableActionsColumn(handle) {
|
|
427
|
+
return () => {
|
|
428
|
+
let { label, mix, ...rest } = handle.props;
|
|
429
|
+
let table = handle.context.get(Table);
|
|
430
|
+
return (_jsx("th", { ...rest, "data-slot": "actions-column", mix: mergeMix([attrs({ scope: "col" }), is("1%")], mix), children: _jsx("span", { id: table?.actionsLabelId, mix: [visuallyHidden()], children: label }) }));
|
|
431
|
+
};
|
|
432
|
+
};
|
|
433
|
+
/**
|
|
434
|
+
* Marks the actions it wraps as the overflow menu's copy, so each {@link Table.Action} inside
|
|
435
|
+
* renders as a menu row.
|
|
436
|
+
*
|
|
437
|
+
* @param handle Runtime handle carrying the menu's actions.
|
|
438
|
+
* @returns The render function passing the actions through.
|
|
439
|
+
*/
|
|
440
|
+
function TableActionsMenu(handle) {
|
|
441
|
+
handle.context.set({ menu: true });
|
|
442
|
+
return () => handle.props.children;
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
445
|
+
* Renders a row's actions on one line. Under a fine hovering pointer they reserve no width: hidden
|
|
446
|
+
* until the row is hovered, focused within, selected or has a menu open, they fade in over the
|
|
447
|
+
* row's end on its tint. Under a coarse pointer they show in a cell as wide as they are. In a
|
|
448
|
+
* `ui-table` container 40rem wide or narrower, one ⋯ button in their place opens them in a menu.
|
|
449
|
+
*
|
|
450
|
+
* @param handle Runtime handle carrying the host `<td>`'s props.
|
|
451
|
+
* @returns The render function producing the cell.
|
|
452
|
+
* @example
|
|
453
|
+
* <Table.Actions overflowLabel={t("posts.moreActions")}>
|
|
454
|
+
* <Table.Action href={editUrl}>{t("posts.edit")}</Table.Action>
|
|
455
|
+
* <Table.Action danger commandfor="confirm-delete" command="show-modal">{t("posts.delete")}</Table.Action>
|
|
456
|
+
* </Table.Actions>
|
|
457
|
+
* @example
|
|
458
|
+
* <Table.Actions>
|
|
459
|
+
* <Button size="sm" variant="ghost">{t("monitors.pause")}</Button>
|
|
460
|
+
* </Table.Actions>
|
|
461
|
+
*/
|
|
462
|
+
Table.Actions = function TableActions(handle) {
|
|
463
|
+
return () => {
|
|
464
|
+
let { overflowLabel, children, mix, ...rest } = handle.props;
|
|
465
|
+
let menuId = `${handle.id}-menu`;
|
|
466
|
+
let panelId = `${handle.id}-actions`;
|
|
467
|
+
/**
|
|
468
|
+
* Without an `overflowLabel`, the inline actions are themselves the popover the ⋯ button
|
|
469
|
+
* opens, named by the actions column; a row with neither name keeps its actions in place.
|
|
470
|
+
*/
|
|
471
|
+
let labelledBy = overflowLabel ? undefined : handle.context.get(Table)?.actionsLabelId;
|
|
472
|
+
let panel = Boolean(labelledBy);
|
|
473
|
+
let folds = Boolean(overflowLabel) || panel;
|
|
474
|
+
return (_jsxs("td", { ...rest, "data-slot": "row-actions", mix: mergeMix([
|
|
475
|
+
is("1%"),
|
|
476
|
+
pi("0.5rem"),
|
|
477
|
+
pb("0.25rem"),
|
|
478
|
+
raw({
|
|
479
|
+
whiteSpace: "nowrap",
|
|
480
|
+
transition: "opacity 150ms ease-out",
|
|
481
|
+
[FINE_HOVER_QUERY]: {
|
|
482
|
+
paddingInline: 0,
|
|
483
|
+
opacity: 0,
|
|
484
|
+
':is(tr:hover, tr:focus-within, tr[aria-selected="true"], tr:has(:popover-open)) > &': { opacity: 1 },
|
|
485
|
+
},
|
|
486
|
+
[ACTIONS_OVERFLOW_QUERY]: { paddingInline: "0.5rem", opacity: 1 },
|
|
487
|
+
"@media (prefers-reduced-motion: reduce)": { transition: "none" },
|
|
488
|
+
}),
|
|
489
|
+
], mix), children: [_jsx("div", { id: panel ? panelId : undefined, popover: panel ? "auto" : undefined, "data-slot": "row-actions-inline", mix: [
|
|
490
|
+
raw({
|
|
491
|
+
position: "static",
|
|
492
|
+
inset: "auto",
|
|
493
|
+
display: "flex",
|
|
494
|
+
alignItems: "center",
|
|
495
|
+
justifyContent: "end",
|
|
496
|
+
gap: "0.25rem",
|
|
497
|
+
padding: 0,
|
|
498
|
+
"&:not(:popover-open)": {
|
|
499
|
+
margin: 0,
|
|
500
|
+
border: 0,
|
|
501
|
+
overflow: "visible",
|
|
502
|
+
color: "inherit",
|
|
503
|
+
backgroundColor: "transparent",
|
|
504
|
+
inlineSize: "auto",
|
|
505
|
+
blockSize: "auto",
|
|
506
|
+
},
|
|
507
|
+
[FINE_HOVER_QUERY]: {
|
|
508
|
+
position: "absolute",
|
|
509
|
+
insetBlock: 0,
|
|
510
|
+
insetInlineEnd: 0,
|
|
511
|
+
zIndex: 1,
|
|
512
|
+
paddingInline: "0.5rem",
|
|
513
|
+
"&::before": {
|
|
514
|
+
content: '""',
|
|
515
|
+
position: "absolute",
|
|
516
|
+
insetBlock: 0,
|
|
517
|
+
insetInlineStart: `calc(-1 * ${ACTIONS_FADE_LEAD})`,
|
|
518
|
+
insetInlineEnd: 0,
|
|
519
|
+
zIndex: -1,
|
|
520
|
+
pointerEvents: "none",
|
|
521
|
+
backgroundColor: TABLE_BG,
|
|
522
|
+
backgroundImage: ROW_TINT_IMAGE,
|
|
523
|
+
maskImage: `linear-gradient(to right, transparent, black ${ACTIONS_FADE_LENGTH})`,
|
|
524
|
+
},
|
|
525
|
+
"&:dir(rtl)::before": {
|
|
526
|
+
maskImage: `linear-gradient(to left, transparent, black ${ACTIONS_FADE_LENGTH})`,
|
|
527
|
+
},
|
|
528
|
+
...ACTIONS_HOVER_FILLS,
|
|
529
|
+
},
|
|
530
|
+
[ACTIONS_OVERFLOW_QUERY]: {
|
|
531
|
+
position: "static",
|
|
532
|
+
paddingInline: 0,
|
|
533
|
+
"&::before": { content: "none" },
|
|
534
|
+
...(folds ? { "&:not(:popover-open)": { display: "none" } } : {}),
|
|
535
|
+
},
|
|
536
|
+
/**
|
|
537
|
+
* Opened from the ⋯ button, the actions stack as a menu's rows under it, each
|
|
538
|
+
* keeping its own control and tone.
|
|
539
|
+
*/
|
|
540
|
+
"&:popover-open": {
|
|
541
|
+
position: "fixed",
|
|
542
|
+
inset: "auto",
|
|
543
|
+
margin: 0,
|
|
544
|
+
marginBlockStart: "var(--ui-popover-offset, 0.5rem)",
|
|
545
|
+
positionArea: "bottom span-left",
|
|
546
|
+
positionTryFallbacks: "flip-block, flip-inline, flip-block flip-inline",
|
|
547
|
+
flexDirection: "column",
|
|
548
|
+
alignItems: "stretch",
|
|
549
|
+
gap: "0.125rem",
|
|
550
|
+
padding: SURFACE_PADDING,
|
|
551
|
+
minInlineSize: "10rem",
|
|
552
|
+
"&::before": { content: "none" },
|
|
553
|
+
"& > :is(a, button)": { justifyContent: "start" },
|
|
554
|
+
},
|
|
555
|
+
}),
|
|
556
|
+
when("&:popover-open", floatingSurface()),
|
|
557
|
+
], children: children }), folds ? (_jsx("div", { "data-slot": "row-actions-overflow", mix: [
|
|
558
|
+
justify("end"),
|
|
559
|
+
raw({
|
|
560
|
+
display: "none",
|
|
561
|
+
[ACTIONS_OVERFLOW_QUERY]: {
|
|
562
|
+
display: "flex",
|
|
563
|
+
':is(td):not(:has(> [data-slot="row-actions-inline"] > *)) > &': {
|
|
564
|
+
display: "none",
|
|
565
|
+
},
|
|
566
|
+
},
|
|
567
|
+
}),
|
|
568
|
+
], children: _jsx(Button, { size: "sm", variant: "ghost", color: "neutral", commandfor: overflowLabel ? menuId : panelId, command: "toggle-popover", "aria-label": overflowLabel, "aria-labelledby": labelledBy, mix: [raw(MENU_BUTTON_SIZE)], children: _jsx(EllipsisIcon, { size: 16 }) }) })) : null, overflowLabel ? (_jsx(TableActionsMenu, { children: _jsx(Menu, { id: menuId, placement: "bottom-end", "aria-label": overflowLabel, children: children }) })) : null] }));
|
|
569
|
+
};
|
|
570
|
+
};
|
|
571
|
+
/**
|
|
572
|
+
* Renders one row action as a small neutral ghost button, or a danger one with `danger`; inside
|
|
573
|
+
* the overflow menu of {@link Table.Actions} it renders as a menu row instead, so an app writes
|
|
574
|
+
* each action once and both forms carry it.
|
|
575
|
+
*
|
|
576
|
+
* @param handle Runtime handle carrying the host `<a>`/`<button>`'s props.
|
|
577
|
+
* @returns The render function producing the action.
|
|
578
|
+
* @example <Table.Action href={href("posts.edit", { id })}>{t("posts.edit")}</Table.Action>
|
|
579
|
+
* @example <Table.Action danger commandfor="confirm-delete" command="show-modal">{t("posts.delete")}</Table.Action>
|
|
580
|
+
*/
|
|
581
|
+
Table.Action = function TableAction(handle) {
|
|
582
|
+
return () => {
|
|
583
|
+
let inMenu = handle.context.get(TableActionsMenu);
|
|
584
|
+
if (inMenu)
|
|
585
|
+
return _jsx(Menu.Item, { ...handle.props });
|
|
586
|
+
let { href, target, rel, danger, mix, ...rest } = handle.props;
|
|
587
|
+
let color = danger ? "danger" : "neutral";
|
|
588
|
+
if (href) {
|
|
589
|
+
/**
|
|
590
|
+
* `rest`'s fields (aria-*, data-*, id, event props, …) are all valid on an `<a>` too;
|
|
591
|
+
* `type` and `role` are left to the link.
|
|
592
|
+
*/
|
|
593
|
+
let { type: _type, ...anchorRest } = rest;
|
|
594
|
+
return (_jsx(LinkButton, { ...anchorRest, href: href, target: target, rel: rel, size: "sm", variant: "ghost", color: color, mix: mix }));
|
|
595
|
+
}
|
|
596
|
+
return (_jsx(Button, { type: "button", ...rest, size: "sm", variant: "ghost", color: color, mix: mix }));
|
|
597
|
+
};
|
|
598
|
+
};
|
|
599
|
+
/**
|
|
600
|
+
* Renders the link to a row's record, usually the name in the first cell; its hit area covers
|
|
601
|
+
* the whole row, and its focus ring outlines the row. In a pinned first column the target
|
|
602
|
+
* stays within that cell, since the pinned cell anchors the link's overlay.
|
|
603
|
+
*
|
|
604
|
+
* @param handle Runtime handle carrying the host `<a>`'s props.
|
|
605
|
+
* @returns The render function producing the link.
|
|
606
|
+
* @example <Table.Cell><Table.RowLink href={href("monitors.show", { id })}>{monitor.name}</Table.RowLink></Table.Cell>
|
|
607
|
+
*/
|
|
608
|
+
Table.RowLink = function TableRowLink(handle) {
|
|
609
|
+
return () => {
|
|
610
|
+
let { mix, ...rest } = handle.props;
|
|
611
|
+
return (_jsx("a", { ...rest, "data-slot": "row-link", mix: mergeMix([
|
|
612
|
+
fg("inherit"),
|
|
613
|
+
weight(500),
|
|
614
|
+
textDecoration("none"),
|
|
615
|
+
hover(textDecoration("underline")),
|
|
616
|
+
raw({
|
|
617
|
+
outline: "none",
|
|
618
|
+
"&::after": { content: '""', position: "absolute", inset: 0 },
|
|
619
|
+
"&:focus-visible::after": {
|
|
620
|
+
outline: "2px solid var(--ui-brand-ring)",
|
|
621
|
+
outlineOffset: "-2px",
|
|
622
|
+
},
|
|
623
|
+
}),
|
|
624
|
+
], mix) }));
|
|
625
|
+
};
|
|
626
|
+
};
|
|
627
|
+
/**
|
|
628
|
+
* Draws `—` muted, the one mark for an unknown value, so a blank never reads as zero.
|
|
629
|
+
*
|
|
630
|
+
* @returns The render function producing the dash.
|
|
631
|
+
*/
|
|
632
|
+
function EmptyValue() {
|
|
633
|
+
return () => (_jsx("span", { "data-slot": "empty-value", mix: [fg("neutral.muted")], children: EMPTY_VALUE }));
|
|
634
|
+
}
|
|
635
|
+
/**
|
|
636
|
+
* Renders a number through `Intl.NumberFormat`, end-aligned in tabular figures.
|
|
637
|
+
*
|
|
638
|
+
* @param handle Runtime handle carrying the host `<td>`'s props.
|
|
639
|
+
* @returns The render function producing the cell.
|
|
640
|
+
* @example <Table.NumberCell value={monitor.p95} locale={locale} format={{ style: "unit", unit: "millisecond" }} />
|
|
641
|
+
* @example <Table.NumberCell value={monitor.uptime} locale={locale} format={{ style: "percent", maximumFractionDigits: 2 }} />
|
|
642
|
+
*/
|
|
643
|
+
Table.NumberCell = function TableNumberCell(handle) {
|
|
644
|
+
return () => {
|
|
645
|
+
let { value, locale, format, ...rest } = handle.props;
|
|
646
|
+
return (_jsx(Table.Cell, { ...rest, numeric: true, "data-type": "number", children: value === null || value === undefined ? (_jsx(EmptyValue, {})) : (new Intl.NumberFormat(locale, format).format(value)) }));
|
|
647
|
+
};
|
|
648
|
+
};
|
|
649
|
+
/**
|
|
650
|
+
* Renders an amount in its currency's symbol with the ISO code muted after it ("€123.00 EUR"),
|
|
651
|
+
* end-aligned in tabular figures so amounts in mixed currencies still line up.
|
|
652
|
+
*
|
|
653
|
+
* @param handle Runtime handle carrying the host `<td>`'s props.
|
|
654
|
+
* @returns The render function producing the cell.
|
|
655
|
+
* @example <Table.CurrencyCell value={payment.amount / 100} currency={payment.currency} locale={locale} />
|
|
656
|
+
*/
|
|
657
|
+
Table.CurrencyCell = function TableCurrencyCell(handle) {
|
|
658
|
+
return () => {
|
|
659
|
+
let { value, currency, locale, ...rest } = handle.props;
|
|
660
|
+
return (_jsx(Table.Cell, { ...rest, numeric: true, "data-type": "currency", children: value === null || value === undefined ? (_jsx(EmptyValue, {})) : (_jsxs("span", { mix: [raw({ whiteSpace: "nowrap" })], children: [new Intl.NumberFormat(locale, {
|
|
661
|
+
style: "currency",
|
|
662
|
+
currency,
|
|
663
|
+
currencyDisplay: "narrowSymbol",
|
|
664
|
+
}).format(value), _jsx("span", { "data-slot": "currency-code", mix: [fg("neutral.muted"), raw({ marginInlineStart: "0.375em" })], children: currency.toUpperCase() })] })) }));
|
|
665
|
+
};
|
|
666
|
+
};
|
|
667
|
+
/**
|
|
668
|
+
* Renders an id in mono, ellipsised in the middle so its last characters stay visible. The
|
|
669
|
+
* whole id stays in the text, so it reads aloud, copies and searches whole, and in the title.
|
|
670
|
+
*
|
|
671
|
+
* @param handle Runtime handle carrying the host `<td>`'s props.
|
|
672
|
+
* @returns The render function producing the cell.
|
|
673
|
+
* @example <Table.IdCell value={payment.id} />
|
|
674
|
+
*/
|
|
675
|
+
Table.IdCell = function TableIdCell(handle) {
|
|
676
|
+
return () => {
|
|
677
|
+
let { value, tail, ...rest } = handle.props;
|
|
678
|
+
let keep = Math.max(0, tail ?? DEFAULT_ID_TAIL);
|
|
679
|
+
let kept = value && value.length > keep ? keep : 0;
|
|
680
|
+
return (_jsx(Table.Cell, { ...rest, "data-type": "id", children: value === null || value === undefined || value === "" ? (_jsx(EmptyValue, {})) : (_jsxs("span", { "data-slot": "id", title: value, mix: [
|
|
681
|
+
flex(),
|
|
682
|
+
font("mono"),
|
|
683
|
+
fontSize("xs"),
|
|
684
|
+
fg("neutral"),
|
|
685
|
+
/**
|
|
686
|
+
* The cap yields to the tail plus one character for the head's ellipsis,
|
|
687
|
+
* so a long tail stays whole and the head truncates first.
|
|
688
|
+
*/
|
|
689
|
+
raw({
|
|
690
|
+
maxInlineSize: `max(var(--ui-table-id-max-inline-size, 14ch), ${kept + 1}ch)`,
|
|
691
|
+
}),
|
|
692
|
+
], children: [_jsx("span", { mix: [truncate(), raw({ minInlineSize: kept > 0 ? "1ch" : 0 })], children: value.length > keep ? value.slice(0, value.length - keep) : value }), value.length > keep && keep > 0 ? (_jsx("span", { mix: [shrink(0), raw({ whiteSpace: "pre" })], children: value.slice(-keep) })) : null] })) }));
|
|
693
|
+
};
|
|
694
|
+
};
|
|
695
|
+
/**
|
|
696
|
+
* Renders a moment through `RelativeTime`: "2m ago" within a week, a date after it, the exact
|
|
697
|
+
* local and UTC time in its title. The cell holds one line in every density.
|
|
698
|
+
*
|
|
699
|
+
* @param handle Runtime handle carrying the host `<td>`'s props.
|
|
700
|
+
* @returns The render function producing the cell.
|
|
701
|
+
* @example <Table.DateCell date={monitor.checkedAt} now={requestTime} locale={locale} local />
|
|
702
|
+
*/
|
|
703
|
+
Table.DateCell = function TableDateCell(handle) {
|
|
704
|
+
return () => {
|
|
705
|
+
let { date, now, locale, timeZone, local, mix, ...rest } = handle.props;
|
|
706
|
+
return (_jsx(Table.Cell, { ...rest, "data-type": "date", mix: [nowrap(), mix], children: date === null || date === undefined ? (_jsx(EmptyValue, {})) : (_jsx(RelativeTime, { date: date, now: now, locale: locale, timeZone: timeZone, local: local, mix: [fg("neutral"), raw({ whiteSpace: "nowrap" })] })) }));
|
|
707
|
+
};
|
|
708
|
+
};
|
|
709
|
+
/**
|
|
710
|
+
* Renders a state as a `StatusDot` and its label, with any `detail` muted after a middle dot,
|
|
711
|
+
* the whole label on one line.
|
|
712
|
+
*
|
|
713
|
+
* @param handle Runtime handle carrying the host `<td>`'s props.
|
|
714
|
+
* @returns The render function producing the cell.
|
|
715
|
+
* @example <Table.StatusCell color="success">{t("monitor.up")}</Table.StatusCell>
|
|
716
|
+
* @example <Table.StatusCell color="warning" detail={<RelativeTime date={post.publishAt} />}>{t("posts.scheduled")}</Table.StatusCell>
|
|
717
|
+
*/
|
|
718
|
+
Table.StatusCell = function TableStatusCell(handle) {
|
|
719
|
+
return () => {
|
|
720
|
+
let { color, pulse, children, detail, ...rest } = handle.props;
|
|
721
|
+
let detailed = detail !== null && detail !== undefined && detail !== false;
|
|
722
|
+
let empty = children === null || children === undefined || children === false;
|
|
723
|
+
return (_jsx(Table.Cell, { ...rest, "data-type": "status", children: empty ? (_jsx(EmptyValue, {})) : (_jsxs(StatusDot, { color: color, pulse: pulse, children: [children, detailed ? (_jsxs("span", { "data-slot": "status-detail", mix: [fg("neutral.muted"), tabularNums()], children: [" · ", detail] })) : null] })) }));
|
|
724
|
+
};
|
|
725
|
+
};
|
|
726
|
+
/**
|
|
727
|
+
* Renders a figure over a bar sized to `value / max`, so the column reads as a bar chart
|
|
728
|
+
* while every figure stays exact. The bar is decorative; the figure carries the value.
|
|
729
|
+
*
|
|
730
|
+
* @param handle Runtime handle carrying the host `<td>`'s props.
|
|
731
|
+
* @returns The render function producing the cell.
|
|
732
|
+
* @example <Table.BarCell value={route.requests} max={busiest} locale={locale} />
|
|
733
|
+
*/
|
|
734
|
+
Table.BarCell = function TableBarCell(handle) {
|
|
735
|
+
return () => {
|
|
736
|
+
let { value, max, locale, format, color, ...rest } = handle.props;
|
|
737
|
+
let share = value === null || value === undefined
|
|
738
|
+
? 0
|
|
739
|
+
: Math.min(1, Math.max(0, value / (max ?? DEFAULT_BAR_MAX)));
|
|
740
|
+
return (_jsx(Table.Cell, { ...rest, numeric: true, "data-type": "bar", children: value === null || value === undefined ? (_jsx(EmptyValue, {})) : (_jsxs("span", { "data-slot": "bar", "data-color": color ?? "neutral", mix: [
|
|
741
|
+
relative(),
|
|
742
|
+
flex(),
|
|
743
|
+
justify("end"),
|
|
744
|
+
raw({
|
|
745
|
+
isolation: "isolate",
|
|
746
|
+
paddingInline: "0.375rem",
|
|
747
|
+
minInlineSize: "var(--ui-table-bar-min-inline-size, 6rem)",
|
|
748
|
+
}),
|
|
749
|
+
], children: [_jsx("span", { "aria-hidden": "true", "data-slot": "bar-fill", mix: [
|
|
750
|
+
raw({
|
|
751
|
+
position: "absolute",
|
|
752
|
+
insetBlock: "-0.125rem",
|
|
753
|
+
insetInlineStart: 0,
|
|
754
|
+
inlineSize: `${(share * 100).toFixed(2)}%`,
|
|
755
|
+
zIndex: -1,
|
|
756
|
+
borderRadius: "var(--ui-radius-sm, 0.25rem)",
|
|
757
|
+
backgroundColor: "var(--ui-neutral-bg-tint)",
|
|
758
|
+
'[data-color="brand"] > &': { backgroundColor: "var(--ui-brand-bg-tint)" },
|
|
759
|
+
'[data-color="success"] > &': { backgroundColor: "var(--ui-success-bg-tint)" },
|
|
760
|
+
'[data-color="warning"] > &': { backgroundColor: "var(--ui-warning-bg-tint)" },
|
|
761
|
+
'[data-color="danger"] > &': { backgroundColor: "var(--ui-danger-bg-tint)" },
|
|
762
|
+
}),
|
|
763
|
+
] }), new Intl.NumberFormat(locale, format).format(value)] })) }));
|
|
764
|
+
};
|
|
765
|
+
};
|
|
766
|
+
/**
|
|
767
|
+
* Renders what a table with no rows shows: any content, laid out beneath the table's header
|
|
768
|
+
* and outside the `<table>`, so the column names stay as context for what is missing.
|
|
769
|
+
*
|
|
770
|
+
* @param handle Runtime handle carrying the host `<div>`'s props.
|
|
771
|
+
* @returns The render function producing the slot.
|
|
772
|
+
* @example
|
|
773
|
+
* <Table.Container>
|
|
774
|
+
* <Table aria-label={t("monitors.title")}><Table.Header>…</Table.Header></Table>
|
|
775
|
+
* <Table.Empty><Empty>…</Empty></Table.Empty>
|
|
776
|
+
* </Table.Container>
|
|
777
|
+
*/
|
|
778
|
+
Table.Empty = function TableEmpty(handle) {
|
|
779
|
+
return () => {
|
|
780
|
+
let { mix, ...rest } = handle.props;
|
|
781
|
+
return (_jsx("div", { ...rest, "data-slot": "table-empty", mix: mergeMix([raw({ paddingBlock: "2.5rem", paddingInline: "1rem" })], mix) }));
|
|
782
|
+
};
|
|
783
|
+
};
|
|
784
|
+
/**
|
|
785
|
+
* Renders a failure in place of {@link Table.Body}: the message and a Retry slot centred
|
|
786
|
+
* across every column, announced as an alert, so the header and the page around it stay put.
|
|
787
|
+
*
|
|
788
|
+
* @param handle Runtime handle carrying the host `<tbody>`'s props.
|
|
789
|
+
* @returns The render function producing the body.
|
|
790
|
+
* @example
|
|
791
|
+
* <Table.Error colSpan={6} action={<LinkButton href={currentUrl}>{t("retry")}</LinkButton>}>
|
|
792
|
+
* {t("monitors.loadFailed")}
|
|
793
|
+
* </Table.Error>
|
|
794
|
+
*/
|
|
795
|
+
Table.Error = function TableError(handle) {
|
|
796
|
+
return () => {
|
|
797
|
+
let { colSpan, children, action, mix, ...rest } = handle.props;
|
|
798
|
+
return (_jsx("tbody", { ...rest, "data-slot": "error", mix: [mix], children: _jsx("tr", { children: _jsx("td", { colSpan: colSpan, mix: [p("0")], children: _jsxs("div", { role: "alert", mix: [
|
|
799
|
+
flex(),
|
|
800
|
+
items("center"),
|
|
801
|
+
justify("center"),
|
|
802
|
+
gap("0.75rem"),
|
|
803
|
+
fg("neutral"),
|
|
804
|
+
raw({
|
|
805
|
+
flexWrap: "wrap",
|
|
806
|
+
paddingBlock: "2rem",
|
|
807
|
+
paddingInline: "1rem",
|
|
808
|
+
textAlign: "center",
|
|
809
|
+
}),
|
|
810
|
+
], children: [_jsx("span", { children: children }), action] }) }) }) }));
|
|
811
|
+
};
|
|
812
|
+
};
|
|
813
|
+
/**
|
|
814
|
+
* Renders a trailing row carrying a single link that spans every column,
|
|
815
|
+
* standing in for an auto-loading "next page" trigger since fetching more
|
|
816
|
+
* rows without a full navigation requires script a consumer attaches.
|
|
817
|
+
*
|
|
818
|
+
* @param handle Runtime handle carrying the host `<tr>`'s props.
|
|
819
|
+
* @returns The render function producing the row's markup.
|
|
820
|
+
* @example
|
|
821
|
+
* <Table.LoadMore href={nextPageUrl} colSpan={4}>
|
|
822
|
+
* {t("subjects.loadMore")}
|
|
823
|
+
* </Table.LoadMore>
|
|
824
|
+
*/
|
|
825
|
+
Table.LoadMore = function TableLoadMore(handle) {
|
|
826
|
+
return () => {
|
|
827
|
+
let { href, colSpan, parts, children, mix, ...rest } = handle.props;
|
|
828
|
+
return (_jsx("tr", { ...rest, "data-slot": "load-more", mix: [mix], children: _jsx("td", { colSpan: colSpan, mix: [p("0"), parts?.cell], children: _jsx("a", { href: href, mix: [
|
|
829
|
+
when("&:focus-visible", outline({ color: "brand.ring", offset: 2 })),
|
|
830
|
+
center(),
|
|
831
|
+
pb("1rem"),
|
|
832
|
+
fg("neutral.muted"),
|
|
833
|
+
hover(fg("neutral")),
|
|
834
|
+
fontSize("sm"),
|
|
835
|
+
textDecoration("none"),
|
|
836
|
+
parts?.link,
|
|
837
|
+
], children: children }) }) }));
|
|
838
|
+
};
|
|
839
|
+
};
|