@sdxc/ui 2026.11.27 → 2026.11.29
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 +265 -162
- package/dist/app/app-shell.d.ts +85 -50
- package/dist/app/app-shell.js +419 -222
- package/dist/app/auto-refresh.d.ts +68 -51
- package/dist/app/auto-refresh.js +193 -61
- package/dist/app/board.d.ts +40 -17
- package/dist/app/board.js +173 -88
- package/dist/app/chart.d.ts +10 -63
- package/dist/app/chart.js +22 -29
- package/dist/app/code-view.d.ts +12 -11
- package/dist/app/code-view.js +83 -19
- package/dist/app/command-palette.d.ts +61 -33
- package/dist/app/command-palette.js +178 -32
- package/dist/app/contribution-graph.d.ts +30 -14
- package/dist/app/contribution-graph.js +87 -26
- package/dist/app/danger-zone.d.ts +40 -35
- package/dist/app/danger-zone.js +177 -34
- package/dist/app/detail-sheet.d.ts +42 -51
- package/dist/app/detail-sheet.js +156 -37
- package/dist/app/diff.d.ts +6 -5
- package/dist/app/diff.js +9 -6
- package/dist/app/drop-zone.d.ts +3 -13
- package/dist/app/drop-zone.js +2 -2
- package/dist/app/editor-layout.d.ts +69 -47
- package/dist/app/editor-layout.js +256 -115
- package/dist/app/empty.d.ts +16 -12
- package/dist/app/empty.js +45 -19
- package/dist/app/file-trigger.d.ts +5 -13
- package/dist/app/file-trigger.js +3 -4
- package/dist/app/filter-bar.d.ts +182 -120
- package/dist/app/filter-bar.js +509 -161
- package/dist/app/filter-menu.d.ts +51 -33
- package/dist/app/filter-menu.js +105 -40
- package/dist/app/gantt.d.ts +67 -27
- package/dist/app/gantt.js +320 -163
- package/dist/app/grid-list.d.ts +2 -15
- package/dist/app/grid-list.js +3 -3
- package/dist/app/merge-box.d.ts +58 -52
- package/dist/app/merge-box.js +107 -46
- package/dist/app/mixins/optimistic-toggle-sync.d.ts +2 -2
- package/dist/app/mixins/optimistic-toggle-sync.js +3 -2
- package/dist/app/mixins/range-picker-keys.d.ts +1 -1
- package/dist/app/mixins/range-picker-keys.js +1 -1
- package/dist/app/mixins/save-bar-sync.d.ts +1 -1
- package/dist/app/mixins/save-bar-sync.js +3 -2
- package/dist/app/mixins/split-view.d.ts +3 -1
- package/dist/app/mixins/split-view.js +16 -8
- package/dist/app/optimistic-toggle.d.ts +65 -37
- package/dist/app/optimistic-toggle.js +38 -15
- package/dist/app/page-header.d.ts +80 -58
- package/dist/app/page-header.js +329 -154
- package/dist/app/profile-picker.d.ts +31 -24
- package/dist/app/profile-picker.js +134 -58
- package/dist/app/range-picker.d.ts +62 -59
- package/dist/app/range-picker.js +124 -37
- package/dist/app/review-thread.d.ts +69 -66
- package/dist/app/review-thread.js +203 -53
- package/dist/app/save-bar.d.ts +56 -27
- package/dist/app/save-bar.js +66 -14
- package/dist/app/selection-bar.d.ts +64 -66
- package/dist/app/selection-bar.js +157 -56
- package/dist/app/settings-layout.d.ts +65 -52
- package/dist/app/settings-layout.js +198 -71
- package/dist/app/settings-section.d.ts +86 -93
- package/dist/app/settings-section.js +297 -120
- package/dist/app/shortcut-list.d.ts +19 -8
- package/dist/app/shortcut-list.js +50 -9
- package/dist/app/sparkline.d.ts +14 -16
- package/dist/app/sparkline.js +20 -7
- package/dist/app/split-view.d.ts +66 -42
- package/dist/app/split-view.js +235 -128
- package/dist/app/stat-card.d.ts +16 -4
- package/dist/app/stat-card.js +57 -21
- package/dist/app/status-strip.d.ts +24 -25
- package/dist/app/status-strip.js +82 -25
- package/dist/app/tab-bar.d.ts +15 -7
- package/dist/app/tab-bar.js +74 -37
- package/dist/app/table.d.ts +37 -38
- package/dist/app/table.js +101 -45
- package/dist/app/view-options.d.ts +100 -76
- package/dist/app/view-options.js +263 -129
- package/dist/audio/media-tile.d.ts +33 -21
- package/dist/audio/media-tile.js +139 -79
- package/dist/audio/player-bar.d.ts +24 -43
- package/dist/audio/player-bar.js +183 -118
- package/dist/audio/queue-list.d.ts +40 -36
- package/dist/audio/queue-list.js +172 -73
- package/dist/audio/track-list.d.ts +53 -54
- package/dist/audio/track-list.js +127 -35
- package/dist/blog/archive-list.d.ts +158 -0
- package/dist/blog/archive-list.js +353 -0
- package/dist/blog/article-layout.d.ts +81 -0
- package/dist/blog/article-layout.js +211 -0
- package/dist/blog/author-card.d.ts +99 -0
- package/dist/blog/author-card.js +184 -0
- package/dist/blog/blog-masthead.d.ts +55 -0
- package/dist/blog/blog-masthead.js +143 -0
- package/dist/blog/index.d.ts +21 -0
- package/dist/blog/index.js +21 -0
- package/dist/blog/link-host.d.ts +47 -0
- package/dist/blog/link-host.js +61 -0
- package/dist/blog/newsletter-form.d.ts +66 -0
- package/dist/blog/newsletter-form.js +100 -0
- package/dist/blog/post-byline.d.ts +96 -0
- package/dist/blog/post-byline.js +180 -0
- package/dist/blog/post-entry.d.ts +153 -0
- package/dist/blog/post-entry.js +402 -0
- package/dist/blog/post-stream.d.ts +92 -0
- package/dist/blog/post-stream.js +163 -0
- package/dist/blog/series-nav.d.ts +144 -0
- package/dist/blog/series-nav.js +275 -0
- package/dist/blog/tag-cloud.d.ts +103 -0
- package/dist/blog/tag-cloud.js +138 -0
- package/dist/blog/tag-list.d.ts +91 -0
- package/dist/blog/tag-list.js +92 -0
- package/dist/blog/widget.d.ts +68 -0
- package/dist/blog/widget.js +61 -0
- package/dist/chat/activity.d.ts +47 -15
- package/dist/chat/activity.js +124 -46
- package/dist/chat/mention-menu.d.ts +6 -7
- package/dist/chat/mention-menu.js +4 -4
- package/dist/chat/message-group.d.ts +17 -4
- package/dist/chat/message-group.js +29 -6
- package/dist/color/color-field.d.ts +41 -68
- package/dist/color/color-field.js +21 -38
- package/dist/color/color-picker.d.ts +10 -61
- package/dist/color/color-picker.js +7 -15
- package/dist/color/color-swatch-picker.d.ts +0 -11
- package/dist/color/color-swatch-picker.js +2 -3
- package/dist/color/color-wheel.d.ts +3 -13
- package/dist/color/color-wheel.js +1 -2
- package/dist/commerce/cart-drawer.d.ts +41 -24
- package/dist/commerce/cart-drawer.js +129 -58
- package/dist/commerce/cart-line.d.ts +34 -19
- package/dist/commerce/cart-line.js +94 -28
- package/dist/commerce/checkout-layout.d.ts +23 -19
- package/dist/commerce/checkout-layout.js +53 -24
- package/dist/commerce/facet-filters.d.ts +57 -59
- package/dist/commerce/facet-filters.js +219 -129
- package/dist/commerce/item-options-dialog.d.ts +69 -40
- package/dist/commerce/item-options-dialog.js +231 -104
- package/dist/commerce/menu-item-card.d.ts +36 -20
- package/dist/commerce/menu-item-card.js +114 -61
- package/dist/commerce/option-group.d.ts +46 -27
- package/dist/commerce/option-group.js +123 -52
- package/dist/commerce/order-summary.d.ts +41 -26
- package/dist/commerce/order-summary.js +103 -49
- package/dist/commerce/order-tracker.d.ts +32 -16
- package/dist/commerce/order-tracker.js +91 -66
- package/dist/commerce/price.d.ts +41 -25
- package/dist/commerce/price.js +131 -68
- package/dist/commerce/product-card.d.ts +66 -36
- package/dist/commerce/product-card.js +215 -100
- package/dist/commerce/product-gallery.d.ts +72 -38
- package/dist/commerce/product-gallery.js +187 -82
- package/dist/commerce/promo-code.d.ts +73 -37
- package/dist/commerce/promo-code.js +172 -77
- package/dist/commerce/question-list.d.ts +43 -35
- package/dist/commerce/question-list.js +146 -72
- package/dist/commerce/shipping-estimate.d.ts +68 -33
- package/dist/commerce/shipping-estimate.js +149 -25
- package/dist/commerce/sort-select.d.ts +33 -22
- package/dist/commerce/sort-select.js +55 -26
- package/dist/commerce/variant-picker.d.ts +25 -23
- package/dist/commerce/variant-picker.js +103 -29
- package/dist/{docs → components}/anchor-heading.d.ts +1 -1
- package/dist/{docs → components}/anchor-heading.js +1 -1
- package/dist/components/autocomplete.d.ts +19 -21
- package/dist/components/autocomplete.js +57 -21
- package/dist/components/banner.d.ts +48 -37
- package/dist/components/banner.js +69 -27
- package/dist/components/button.d.ts +2 -18
- package/dist/components/button.js +4 -3
- package/dist/components/callout.d.ts +52 -0
- package/dist/components/callout.js +77 -0
- package/dist/components/checkbox.d.ts +3 -12
- package/dist/components/checkbox.js +1 -2
- package/dist/components/code-block.d.ts +110 -0
- package/dist/{docs → components}/code-block.js +92 -23
- package/dist/components/confirm.d.ts +63 -130
- package/dist/components/confirm.js +133 -52
- package/dist/{docs → components}/copy-button.d.ts +1 -1
- package/dist/{docs → components}/copy-button.js +3 -3
- package/dist/components/date-field.d.ts +40 -60
- package/dist/components/date-field.js +23 -36
- package/dist/components/date-picker.d.ts +11 -67
- package/dist/components/date-picker.js +4 -15
- package/dist/components/date-range-picker.d.ts +20 -91
- package/dist/components/date-range-picker.js +13 -27
- package/dist/components/dialog-dismiss.d.ts +1 -1
- package/dist/components/dialog-dismiss.js +1 -1
- package/dist/components/field-parts.d.ts +158 -0
- package/dist/components/field-parts.js +237 -0
- package/dist/components/filter-links.d.ts +107 -0
- package/dist/components/filter-links.js +120 -0
- package/dist/components/form.d.ts +3 -1
- package/dist/components/form.js +3 -1
- package/dist/components/index.d.ts +14 -7
- package/dist/components/index.js +14 -7
- package/dist/components/listbox.d.ts +0 -9
- package/dist/components/listbox.js +2 -2
- package/dist/components/media-grid.d.ts +15 -16
- package/dist/components/media-grid.js +75 -34
- package/dist/components/pager.d.ts +103 -0
- package/dist/components/pager.js +187 -0
- package/dist/components/property-list.d.ts +38 -39
- package/dist/components/property-list.js +149 -96
- package/dist/components/radio-group.d.ts +0 -11
- package/dist/components/radio-group.js +5 -6
- package/dist/components/range-calendar.d.ts +2 -14
- package/dist/components/range-calendar.js +2 -2
- package/dist/components/range-months.d.ts +12 -2
- package/dist/components/range-months.js +32 -16
- package/dist/components/rating-input.d.ts +14 -6
- package/dist/components/rating-input.js +26 -12
- package/dist/components/rating.d.ts +13 -8
- package/dist/components/rating.js +19 -5
- package/dist/components/review-card.d.ts +51 -26
- package/dist/components/review-card.js +173 -40
- package/dist/components/search-field.js +18 -8
- package/dist/components/section-bar.d.ts +23 -15
- package/dist/components/section-bar.js +59 -37
- package/dist/components/sidebar.d.ts +27 -0
- package/dist/components/sidebar.js +49 -20
- package/dist/{docs → components}/table-of-contents.d.ts +1 -1
- package/dist/{docs → components}/table-of-contents.js +3 -3
- package/dist/components/text-field.d.ts +54 -81
- package/dist/components/text-field.js +30 -44
- package/dist/components/time-field.d.ts +45 -65
- package/dist/components/time-field.js +23 -35
- package/dist/components/timeline.d.ts +80 -86
- package/dist/components/timeline.js +383 -170
- package/dist/components/typeset.d.ts +5 -0
- package/dist/components/typeset.js +17 -2
- package/dist/docs/code-tabs.d.ts +50 -24
- package/dist/docs/code-tabs.js +91 -25
- package/dist/docs/docs-feedback.d.ts +70 -27
- package/dist/docs/docs-feedback.js +156 -27
- package/dist/docs/docs-footer.d.ts +36 -22
- package/dist/docs/docs-footer.js +76 -23
- package/dist/docs/docs-hub.d.ts +103 -73
- package/dist/docs/docs-hub.js +333 -83
- package/dist/docs/docs-layout.d.ts +111 -42
- package/dist/docs/docs-layout.js +371 -97
- package/dist/docs/docs-nav-tools.d.ts +11 -7
- package/dist/docs/docs-nav-tools.js +4 -3
- package/dist/docs/docs-nav.d.ts +53 -17
- package/dist/docs/docs-nav.js +125 -14
- package/dist/docs/docs-not-found.d.ts +61 -35
- package/dist/docs/docs-not-found.js +198 -52
- package/dist/docs/docs-page-header.d.ts +47 -30
- package/dist/docs/docs-page-header.js +114 -31
- package/dist/docs/docs-pager.d.ts +43 -27
- package/dist/docs/docs-pager.js +73 -23
- package/dist/docs/file-tree.d.ts +16 -6
- package/dist/docs/file-tree.js +19 -4
- package/dist/docs/index.d.ts +0 -7
- package/dist/docs/index.js +0 -7
- package/dist/docs/install-command.d.ts +7 -6
- package/dist/docs/install-command.js +8 -10
- package/dist/docs/mixins/docs-nav-tools.js +1 -1
- package/dist/docs/next-steps.d.ts +56 -23
- package/dist/docs/next-steps.js +121 -35
- package/dist/docs/page-actions.d.ts +68 -46
- package/dist/docs/page-actions.js +129 -21
- package/dist/docs/steps.d.ts +14 -11
- package/dist/docs/steps.js +36 -18
- package/dist/docs/ui-label.d.ts +7 -6
- package/dist/docs/ui-label.js +21 -8
- package/dist/finance/ledger.d.ts +33 -29
- package/dist/finance/ledger.js +190 -43
- package/dist/finance/payment-card.d.ts +43 -31
- package/dist/finance/payment-card.js +170 -67
- package/dist/landing/author-band.d.ts +57 -54
- package/dist/landing/author-band.js +218 -64
- package/dist/landing/case-study.d.ts +57 -57
- package/dist/landing/case-study.js +148 -17
- package/dist/landing/changelog-strip.d.ts +56 -36
- package/dist/landing/changelog-strip.js +176 -68
- package/dist/landing/closing-cta.d.ts +21 -41
- package/dist/landing/closing-cta.js +13 -19
- package/dist/landing/code-stage.d.ts +55 -47
- package/dist/landing/code-stage.js +198 -67
- package/dist/landing/contributor-wall.d.ts +4 -4
- package/dist/landing/contributor-wall.js +4 -4
- package/dist/landing/curriculum.d.ts +74 -45
- package/dist/landing/curriculum.js +220 -62
- package/dist/landing/drawn-chart.d.ts +18 -10
- package/dist/landing/drawn-chart.js +57 -26
- package/dist/landing/episode-player.d.ts +69 -43
- package/dist/landing/episode-player.js +213 -48
- package/dist/landing/event-ticker.d.ts +13 -7
- package/dist/landing/event-ticker.js +67 -32
- package/dist/landing/fan-out-diagram.d.ts +19 -8
- package/dist/landing/fan-out-diagram.js +60 -19
- package/dist/landing/faq-band.d.ts +30 -48
- package/dist/landing/faq-band.js +37 -30
- package/dist/landing/feature-band.d.ts +48 -76
- package/dist/landing/feature-band.js +71 -49
- package/dist/landing/flow-diagram.d.ts +16 -8
- package/dist/landing/flow-diagram.js +50 -18
- package/dist/landing/install-tabs.d.ts +16 -14
- package/dist/landing/install-tabs.js +87 -39
- package/dist/landing/landing-header.d.ts +75 -66
- package/dist/landing/landing-header.js +284 -57
- package/dist/landing/landing-hero.d.ts +59 -87
- package/dist/landing/landing-hero.js +157 -128
- package/dist/landing/landing-section.d.ts +0 -9
- package/dist/landing/landing-section.js +1 -2
- package/dist/landing/logo-cloud.d.ts +26 -9
- package/dist/landing/logo-cloud.js +62 -18
- package/dist/landing/phone-fan.d.ts +15 -7
- package/dist/landing/phone-fan.js +60 -17
- package/dist/landing/price-list.d.ts +29 -22
- package/dist/landing/price-list.js +175 -77
- package/dist/landing/pricing-band.d.ts +46 -53
- package/dist/landing/pricing-band.js +167 -51
- package/dist/landing/product-frame.d.ts +44 -42
- package/dist/landing/product-frame.js +182 -85
- package/dist/landing/proof-strip.d.ts +7 -2
- package/dist/landing/proof-strip.js +7 -2
- package/dist/landing/rails.d.ts +1 -1
- package/dist/landing/rails.js +1 -1
- package/dist/landing/segmented-stage.d.ts +19 -8
- package/dist/landing/segmented-stage.js +60 -16
- package/dist/landing/sequence-diagram.d.ts +18 -8
- package/dist/landing/sequence-diagram.js +49 -18
- package/dist/landing/site-footer.d.ts +89 -68
- package/dist/landing/site-footer.js +344 -111
- package/dist/landing/site-header.d.ts +118 -80
- package/dist/landing/site-header.js +482 -67
- package/dist/landing/sponsor-wall.d.ts +34 -15
- package/dist/landing/sponsor-wall.js +111 -34
- package/dist/landing/stat-strip.d.ts +7 -9
- package/dist/landing/stat-strip.js +57 -22
- package/dist/landing/step-list.d.ts +18 -21
- package/dist/landing/step-list.js +132 -38
- package/dist/landing/tabbed-stage.d.ts +23 -15
- package/dist/landing/tabbed-stage.js +103 -21
- package/dist/landing/testimonial-band.d.ts +58 -61
- package/dist/landing/testimonial-band.js +209 -71
- package/dist/landing/typed-terminal.d.ts +9 -6
- package/dist/landing/typed-terminal.js +16 -5
- package/dist/landing/usage-estimate.d.ts +83 -74
- package/dist/landing/usage-estimate.js +254 -113
- package/dist/landing/utils/has-parts.d.ts +17 -0
- package/dist/landing/utils/has-parts.js +24 -0
- package/dist/map/map-canvas.d.ts +15 -16
- package/dist/map/map-canvas.js +40 -24
- package/dist/map/map.d.ts +42 -33
- package/dist/map/map.js +149 -38
- package/dist/mixins/aria-checked.d.ts +1 -4
- package/dist/mixins/aria-checked.js +1 -4
- package/dist/mixins/clear-field.d.ts +2 -4
- package/dist/mixins/clear-field.js +2 -4
- package/dist/mixins/index.d.ts +2 -0
- package/dist/mixins/index.js +2 -0
- package/dist/schedule/agenda.d.ts +69 -41
- package/dist/schedule/agenda.js +273 -134
- package/dist/schedule/day-strip.d.ts +38 -26
- package/dist/schedule/day-strip.js +119 -88
- package/dist/test/map.d.ts +1 -1
- package/dist/test/map.js +1 -6
- package/dist/test/reels.js +1 -1
- package/dist/test/stories.js +2 -2
- package/dist/travel/boarding-pass.d.ts +94 -70
- package/dist/travel/boarding-pass.js +341 -144
- package/dist/travel/car-offer.d.ts +109 -49
- package/dist/travel/car-offer.js +424 -64
- package/dist/travel/fare-options.d.ts +58 -34
- package/dist/travel/fare-options.js +210 -69
- package/dist/travel/flight-itinerary.d.ts +62 -55
- package/dist/travel/flight-itinerary.js +230 -55
- package/dist/travel/flight-option.d.ts +65 -33
- package/dist/travel/flight-option.js +250 -69
- package/dist/travel/flight-segment.d.ts +121 -70
- package/dist/travel/flight-segment.js +358 -96
- package/dist/travel/package-savings.d.ts +79 -39
- package/dist/travel/package-savings.js +309 -65
- package/dist/travel/price-breakdown.d.ts +30 -22
- package/dist/travel/price-breakdown.js +72 -17
- package/dist/travel/rating-breakdown.d.ts +25 -18
- package/dist/travel/rating-breakdown.js +60 -23
- package/dist/travel/seat-map.d.ts +29 -22
- package/dist/travel/seat-map.js +140 -78
- package/dist/travel/trip-timeline.d.ts +77 -39
- package/dist/travel/trip-timeline.js +316 -107
- package/dist/utils/eyebrow.d.ts +2 -2
- package/dist/utils/eyebrow.js +3 -3
- package/dist/utils/index.d.ts +0 -1
- package/dist/utils/index.js +0 -1
- package/dist/video/episode-list.d.ts +22 -14
- package/dist/video/episode-list.js +89 -53
- package/dist/video/reel-feed.d.ts +21 -15
- package/dist/video/reel-feed.js +59 -24
- package/dist/video/story-viewer.d.ts +6 -5
- package/dist/video/story-viewer.js +84 -53
- package/dist/video/title-hero.d.ts +8 -8
- package/dist/video/title-hero.js +48 -34
- package/dist/video/video-card.d.ts +34 -20
- package/dist/video/video-card.js +119 -76
- package/dist/video/video-player.d.ts +17 -14
- package/dist/video/video-player.js +68 -30
- package/dist/video/video-shelf.d.ts +26 -14
- package/dist/video/video-shelf.js +88 -50
- package/package.json +4 -2
- package/dist/docs/callout.d.ts +0 -46
- package/dist/docs/callout.js +0 -61
- package/dist/docs/code-block.d.ts +0 -74
- package/dist/utils/field-parts.d.ts +0 -26
- package/dist/utils/field-parts.js +0 -12
- /package/dist/{docs/mixins → mixins}/copy-feedback.d.ts +0 -0
- /package/dist/{docs/mixins → mixins}/copy-feedback.js +0 -0
- /package/dist/{docs/mixins → mixins}/toc-spy.d.ts +0 -0
- /package/dist/{docs/mixins → mixins}/toc-spy.js +0 -0
- /package/dist/{docs/utils → utils}/reveal-in-scroller.d.ts +0 -0
- /package/dist/{docs/utils → utils}/reveal-in-scroller.js +0 -0
|
@@ -1,30 +1,26 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* A receipt block as a `<dl
|
|
3
|
-
* green with a minus,
|
|
4
|
-
* end-aligned in tabular figures
|
|
2
|
+
* A receipt block as composable parts: a `<dl>` of charges, each with its working beneath,
|
|
3
|
+
* discounts in green with a minus, a bold total under a rule, and a note under the list.
|
|
4
|
+
* Amounts arrive formatted and sit end-aligned in tabular figures; a named one is an `<output>`.
|
|
5
5
|
*
|
|
6
6
|
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
7
7
|
* @copyright Sergio Xalambrí 2026
|
|
8
8
|
*/
|
|
9
|
-
import type { Handle, Props as TagProps
|
|
9
|
+
import type { Handle, Props as TagProps } from "remix/component";
|
|
10
10
|
/**
|
|
11
11
|
* Prop types for {@link PriceBreakdown} and its compound parts.
|
|
12
12
|
*/
|
|
13
13
|
export declare namespace PriceBreakdown {
|
|
14
14
|
/** `"discount"` colours the line green and signs its amount with a minus. */
|
|
15
15
|
type Tone = "default" | "discount";
|
|
16
|
-
/** Every native `<div>` attribute
|
|
16
|
+
/** Every native `<div>` attribute; holds the {@link PriceBreakdown.Lines} and a note. */
|
|
17
17
|
interface Props extends TagProps<"div"> {
|
|
18
|
-
/**
|
|
19
|
-
* Small muted text under the total, such as "You won't be charged yet"; it sits
|
|
20
|
-
* after the `<dl>`, since a description list holds only label/value groups.
|
|
21
|
-
*/
|
|
22
|
-
note?: RemixNode;
|
|
23
18
|
}
|
|
24
|
-
/**
|
|
25
|
-
interface
|
|
26
|
-
|
|
27
|
-
|
|
19
|
+
/** Every native `<dl>` attribute; holds the lines and the total. */
|
|
20
|
+
interface LinesProps extends TagProps<"dl"> {
|
|
21
|
+
}
|
|
22
|
+
/** What every amount-bearing line takes; its children are what the charge is. */
|
|
23
|
+
interface AmountProps extends TagProps<"div"> {
|
|
28
24
|
/** The amount, formatted by the caller, such as "$728.00". */
|
|
29
25
|
amount: string;
|
|
30
26
|
/**
|
|
@@ -37,30 +33,42 @@ export declare namespace PriceBreakdown {
|
|
|
37
33
|
}
|
|
38
34
|
/** Props accepted by {@link PriceBreakdown.Line}. */
|
|
39
35
|
interface LineProps extends AmountProps {
|
|
40
|
-
/** How the amount was worked out, such as "$182 × 4 nights", in small type beneath. */
|
|
41
|
-
detail?: RemixNode;
|
|
42
36
|
/** @default "default" */
|
|
43
37
|
tone?: Tone;
|
|
44
38
|
}
|
|
45
39
|
/** Props accepted by {@link PriceBreakdown.Total}. */
|
|
46
40
|
interface TotalProps extends AmountProps {
|
|
47
41
|
}
|
|
42
|
+
/** Every native `<span>` attribute; how a charge was worked out. */
|
|
43
|
+
interface DetailProps extends TagProps<"span"> {
|
|
44
|
+
}
|
|
45
|
+
/** Every native `<p>` attribute; small text under the receipt. */
|
|
46
|
+
interface NoteProps extends TagProps<"p"> {
|
|
47
|
+
}
|
|
48
48
|
}
|
|
49
49
|
/**
|
|
50
|
-
* Renders the receipt
|
|
51
|
-
*
|
|
50
|
+
* Renders the receipt as a column of the parts it is given, usually a
|
|
51
|
+
* {@link PriceBreakdown.Lines} list and a {@link PriceBreakdown.Note} under it.
|
|
52
52
|
*
|
|
53
53
|
* @param handle Runtime handle carrying the wrapper's props.
|
|
54
54
|
* @returns The render function producing the receipt's markup.
|
|
55
55
|
* @example
|
|
56
|
-
* <PriceBreakdown
|
|
57
|
-
* <PriceBreakdown.
|
|
58
|
-
*
|
|
59
|
-
*
|
|
56
|
+
* <PriceBreakdown>
|
|
57
|
+
* <PriceBreakdown.Lines>
|
|
58
|
+
* <PriceBreakdown.Line amount="$728.00" name="nights">
|
|
59
|
+
* 4 nights<PriceBreakdown.Detail>$182 × 4 nights</PriceBreakdown.Detail>
|
|
60
|
+
* </PriceBreakdown.Line>
|
|
61
|
+
* <PriceBreakdown.Line amount="$72.80" tone="discount">Weekly stay discount</PriceBreakdown.Line>
|
|
62
|
+
* <PriceBreakdown.Total amount="$745.20" name="total">Total</PriceBreakdown.Total>
|
|
63
|
+
* </PriceBreakdown.Lines>
|
|
64
|
+
* <PriceBreakdown.Note>You won't be charged yet</PriceBreakdown.Note>
|
|
60
65
|
* </PriceBreakdown>
|
|
61
66
|
*/
|
|
62
67
|
export declare function PriceBreakdown(handle: Handle<PriceBreakdown.Props>): () => import("remix/component").RemixElement;
|
|
63
68
|
export declare namespace PriceBreakdown {
|
|
69
|
+
var Lines: (handle: Handle<PriceBreakdown.LinesProps>) => () => import("remix/component").RemixElement;
|
|
64
70
|
var Line: (handle: Handle<PriceBreakdown.LineProps>) => () => import("remix/component").RemixElement;
|
|
71
|
+
var Detail: (handle: Handle<PriceBreakdown.DetailProps>) => () => import("remix/component").RemixElement;
|
|
65
72
|
var Total: (handle: Handle<PriceBreakdown.TotalProps>) => () => import("remix/component").RemixElement;
|
|
73
|
+
var Note: (handle: Handle<PriceBreakdown.NoteProps>) => () => import("remix/component").RemixElement;
|
|
66
74
|
}
|
|
@@ -6,6 +6,8 @@ import { m, minIs, p } from "@sdxc/u/size";
|
|
|
6
6
|
import { leading, tabularNums, text, weight } from "@sdxc/u/typography";
|
|
7
7
|
/** The sign a discount's amount gains when the caller formatted it without one. */
|
|
8
8
|
const MINUS = "−";
|
|
9
|
+
/** Tone a line takes when `tone` is left out. */
|
|
10
|
+
const DEFAULT_TONE = "default";
|
|
9
11
|
/**
|
|
10
12
|
* Signs a discount's amount with a minus unless it already carries one.
|
|
11
13
|
*
|
|
@@ -33,24 +35,46 @@ function AmountValue(handle) {
|
|
|
33
35
|
};
|
|
34
36
|
}
|
|
35
37
|
/**
|
|
36
|
-
* Renders the receipt
|
|
37
|
-
*
|
|
38
|
+
* Renders the receipt as a column of the parts it is given, usually a
|
|
39
|
+
* {@link PriceBreakdown.Lines} list and a {@link PriceBreakdown.Note} under it.
|
|
38
40
|
*
|
|
39
41
|
* @param handle Runtime handle carrying the wrapper's props.
|
|
40
42
|
* @returns The render function producing the receipt's markup.
|
|
41
43
|
* @example
|
|
42
|
-
* <PriceBreakdown
|
|
43
|
-
* <PriceBreakdown.
|
|
44
|
-
*
|
|
45
|
-
*
|
|
44
|
+
* <PriceBreakdown>
|
|
45
|
+
* <PriceBreakdown.Lines>
|
|
46
|
+
* <PriceBreakdown.Line amount="$728.00" name="nights">
|
|
47
|
+
* 4 nights<PriceBreakdown.Detail>$182 × 4 nights</PriceBreakdown.Detail>
|
|
48
|
+
* </PriceBreakdown.Line>
|
|
49
|
+
* <PriceBreakdown.Line amount="$72.80" tone="discount">Weekly stay discount</PriceBreakdown.Line>
|
|
50
|
+
* <PriceBreakdown.Total amount="$745.20" name="total">Total</PriceBreakdown.Total>
|
|
51
|
+
* </PriceBreakdown.Lines>
|
|
52
|
+
* <PriceBreakdown.Note>You won't be charged yet</PriceBreakdown.Note>
|
|
46
53
|
* </PriceBreakdown>
|
|
47
54
|
*/
|
|
48
55
|
export function PriceBreakdown(handle) {
|
|
49
56
|
return () => {
|
|
50
|
-
let {
|
|
51
|
-
return (
|
|
57
|
+
let { mix, ...rest } = handle.props;
|
|
58
|
+
return (_jsx("div", { "data-slot": "price-breakdown", ...rest, mix: mergeMix([minIs(0), vstack({ gap: 4 }), text("sm")], mix) }));
|
|
52
59
|
};
|
|
53
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* Renders the charges as a `<dl>`, so each line's label and amount stay paired in the
|
|
63
|
+
* accessibility tree.
|
|
64
|
+
*
|
|
65
|
+
* @param handle Runtime handle carrying the list's props.
|
|
66
|
+
* @returns The render function producing the list's markup.
|
|
67
|
+
* @example
|
|
68
|
+
* <PriceBreakdown.Lines>
|
|
69
|
+
* <PriceBreakdown.Line amount="$45.00">Cleaning fee</PriceBreakdown.Line>
|
|
70
|
+
* </PriceBreakdown.Lines>
|
|
71
|
+
*/
|
|
72
|
+
PriceBreakdown.Lines = function PriceBreakdownLines(handle) {
|
|
73
|
+
return () => {
|
|
74
|
+
let { mix, ...rest } = handle.props;
|
|
75
|
+
return (_jsx("dl", { "data-slot": "price-breakdown-lines", ...rest, mix: mergeMix([m(0), vstack({ gap: 3 }), text("sm")], mix) }));
|
|
76
|
+
};
|
|
77
|
+
};
|
|
54
78
|
/** Columns every line shares: the label takes what is left, the amount what it needs. */
|
|
55
79
|
const LINE_COLUMNS = raw({
|
|
56
80
|
display: "grid",
|
|
@@ -59,21 +83,36 @@ const LINE_COLUMNS = raw({
|
|
|
59
83
|
alignItems: "baseline",
|
|
60
84
|
});
|
|
61
85
|
/**
|
|
62
|
-
* Renders one charge: its label,
|
|
63
|
-
* at the end. A discount is green and
|
|
86
|
+
* Renders one charge: its children as the label, any {@link PriceBreakdown.Detail} under it in
|
|
87
|
+
* muted small type, and its amount at the end. A discount is green and signed with a minus.
|
|
64
88
|
*
|
|
65
89
|
* @param handle Runtime handle carrying the line's props.
|
|
66
90
|
* @returns The render function producing the line's markup.
|
|
67
91
|
* @example
|
|
68
|
-
* <PriceBreakdown.Line
|
|
92
|
+
* <PriceBreakdown.Line amount="$45.00">Cleaning fee</PriceBreakdown.Line>
|
|
69
93
|
* @example
|
|
70
|
-
* <PriceBreakdown.Line
|
|
94
|
+
* <PriceBreakdown.Line amount="$30.00" tone="discount" line="discount">Early-bird discount</PriceBreakdown.Line>
|
|
71
95
|
*/
|
|
72
96
|
PriceBreakdown.Line = function PriceBreakdownLine(handle) {
|
|
73
97
|
return () => {
|
|
74
|
-
let {
|
|
98
|
+
let { amount, name, line, tone = DEFAULT_TONE, children, mix, ...rest } = handle.props;
|
|
75
99
|
let discount = tone === "discount";
|
|
76
|
-
return (_jsxs("div", { "data-slot": "price-breakdown-line", "data-line": line, "data-tone": discount ? "discount" : undefined, ...rest, mix: mergeMix([LINE_COLUMNS, discount ? fg("success") : fg("neutral.emphasis")], mix), children: [
|
|
100
|
+
return (_jsxs("div", { "data-slot": "price-breakdown-line", "data-line": line, "data-tone": discount ? "discount" : undefined, ...rest, mix: mergeMix([LINE_COLUMNS, discount ? fg("success") : fg("neutral.emphasis")], mix), children: [_jsx("dt", { mix: [m(0), minIs(0), leading("1.4")], children: children }), _jsx("dd", { mix: [m(0), tabularNums(), raw({ textAlign: "end", whiteSpace: "nowrap" })], children: _jsx(AmountValue, { amount: discount ? asDiscount(amount) : amount, name: name }) })] }));
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* Renders how a charge was worked out, such as "$182 × 4 nights", on its own line under the
|
|
105
|
+
* label in muted small type; write it inside a {@link PriceBreakdown.Line}.
|
|
106
|
+
*
|
|
107
|
+
* @param handle Runtime handle carrying the span's props.
|
|
108
|
+
* @returns The render function producing the detail's markup.
|
|
109
|
+
* @example
|
|
110
|
+
* <PriceBreakdown.Detail>$182 × 4 nights</PriceBreakdown.Detail>
|
|
111
|
+
*/
|
|
112
|
+
PriceBreakdown.Detail = function PriceBreakdownDetail(handle) {
|
|
113
|
+
return () => {
|
|
114
|
+
let { mix, ...rest } = handle.props;
|
|
115
|
+
return (_jsx("span", { "data-slot": "price-breakdown-detail", ...rest, mix: mergeMix([raw({ display: "block" }), text("xs"), fg("neutral.muted"), tabularNums()], mix) }));
|
|
77
116
|
};
|
|
78
117
|
};
|
|
79
118
|
/**
|
|
@@ -83,11 +122,11 @@ PriceBreakdown.Line = function PriceBreakdownLine(handle) {
|
|
|
83
122
|
* @param handle Runtime handle carrying the total's props.
|
|
84
123
|
* @returns The render function producing the total's markup.
|
|
85
124
|
* @example
|
|
86
|
-
* <PriceBreakdown.Total
|
|
125
|
+
* <PriceBreakdown.Total amount="$745.20" name="total">Total (USD)</PriceBreakdown.Total>
|
|
87
126
|
*/
|
|
88
127
|
PriceBreakdown.Total = function PriceBreakdownTotal(handle) {
|
|
89
128
|
return () => {
|
|
90
|
-
let {
|
|
129
|
+
let { amount, name, line, children, mix, ...rest } = handle.props;
|
|
91
130
|
return (_jsxs("div", { "data-slot": "price-breakdown-total", "data-line": line, ...rest, mix: mergeMix([
|
|
92
131
|
LINE_COLUMNS,
|
|
93
132
|
border({ color: "neutral.border", width: 0 }),
|
|
@@ -97,6 +136,22 @@ PriceBreakdown.Total = function PriceBreakdownTotal(handle) {
|
|
|
97
136
|
text("base"),
|
|
98
137
|
weight("semibold"),
|
|
99
138
|
fg("neutral.emphasis"),
|
|
100
|
-
], mix), children: [_jsx("dt", { mix: [m(0), minIs(0)], children:
|
|
139
|
+
], mix), children: [_jsx("dt", { mix: [m(0), minIs(0)], children: children }), _jsx("dd", { mix: [m(0), tabularNums(), raw({ textAlign: "end", whiteSpace: "nowrap" })], children: _jsx(AmountValue, { amount: amount, name: name }) })] }));
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* Renders small muted text centred under the receipt, such as "You won't be charged yet";
|
|
144
|
+
* write it after the {@link PriceBreakdown.Lines}, since a description list holds only
|
|
145
|
+
* label and value groups.
|
|
146
|
+
*
|
|
147
|
+
* @param handle Runtime handle carrying the paragraph's props.
|
|
148
|
+
* @returns The render function producing the note's markup.
|
|
149
|
+
* @example
|
|
150
|
+
* <PriceBreakdown.Note>You won't be charged yet</PriceBreakdown.Note>
|
|
151
|
+
*/
|
|
152
|
+
PriceBreakdown.Note = function PriceBreakdownNote(handle) {
|
|
153
|
+
return () => {
|
|
154
|
+
let { mix, ...rest } = handle.props;
|
|
155
|
+
return (_jsx("p", { "data-slot": "price-breakdown-note", ...rest, mix: mergeMix([m(0), text("xs"), fg("neutral.muted"), raw({ textAlign: "center" })], mix) }));
|
|
101
156
|
};
|
|
102
157
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* A reviews summary: the average score set large beside a star and the
|
|
3
|
-
* groups of bars, one per star level or per category. Each bar is an ARIA
|
|
4
|
-
* label, and a category group runs two to a row once
|
|
2
|
+
* A reviews summary as composable parts: the average score set large beside a star and the
|
|
3
|
+
* review count, then groups of bars, one per star level or per category. Each bar is an ARIA
|
|
4
|
+
* meter named by its label, and a category group runs two to a row once the summary is wide.
|
|
5
5
|
*
|
|
6
6
|
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
7
7
|
* @copyright Sergio Xalambrí 2026
|
|
8
8
|
*/
|
|
9
|
-
import type { Handle, Props as TagProps
|
|
9
|
+
import type { Handle, Props as TagProps } from "remix/component";
|
|
10
10
|
/**
|
|
11
11
|
* Prop types for {@link RatingBreakdown} and its compound parts.
|
|
12
12
|
*/
|
|
@@ -21,8 +21,11 @@ export declare namespace RatingBreakdown {
|
|
|
21
21
|
interface GroupContext {
|
|
22
22
|
kind: Kind;
|
|
23
23
|
}
|
|
24
|
-
/** Every native `<section>` attribute
|
|
24
|
+
/** Every native `<section>` attribute; holds the score and the groups of bars. */
|
|
25
25
|
interface Props extends TagProps<"section"> {
|
|
26
|
+
}
|
|
27
|
+
/** Every native `<p>` attribute, plus the headline score; holds the review count. */
|
|
28
|
+
interface ScoreProps extends TagProps<"p"> {
|
|
26
29
|
/** The average rating, such as `4.86`. */
|
|
27
30
|
score: number;
|
|
28
31
|
/** @default 5 */
|
|
@@ -33,8 +36,6 @@ export declare namespace RatingBreakdown {
|
|
|
33
36
|
* @default score.toFixed(2)
|
|
34
37
|
*/
|
|
35
38
|
display?: string;
|
|
36
|
-
/** The review count as shown, such as "128 reviews". */
|
|
37
|
-
count?: RemixNode;
|
|
38
39
|
/**
|
|
39
40
|
* What follows the score for a screen reader, completing "4.86 out of 5".
|
|
40
41
|
*
|
|
@@ -42,16 +43,18 @@ export declare namespace RatingBreakdown {
|
|
|
42
43
|
*/
|
|
43
44
|
outOf?: string;
|
|
44
45
|
}
|
|
46
|
+
/** Every native `<span>` attribute; the review count, such as "128 reviews". */
|
|
47
|
+
interface CountProps extends TagProps<"span"> {
|
|
48
|
+
}
|
|
45
49
|
/** Every native `<ul>` attribute, plus how its bars lay out. */
|
|
46
50
|
interface GroupProps extends TagProps<"ul"> {
|
|
47
51
|
kind: Kind;
|
|
48
52
|
}
|
|
49
|
-
/**
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
icon?: RemixNode;
|
|
53
|
+
/**
|
|
54
|
+
* Every native `<li>` attribute, plus what the bar measures; its children, such as an icon
|
|
55
|
+
* and "Cleanliness", are the label that names the meter.
|
|
56
|
+
*/
|
|
57
|
+
interface BarProps extends TagProps<"li"> {
|
|
55
58
|
/** The measured amount: a share from 0 to `max`, or a category's score. */
|
|
56
59
|
value: number;
|
|
57
60
|
/** @default 1 for a "stars" group, 5 for a "categories" group */
|
|
@@ -61,21 +64,25 @@ export declare namespace RatingBreakdown {
|
|
|
61
64
|
}
|
|
62
65
|
}
|
|
63
66
|
/**
|
|
64
|
-
* Renders the summary
|
|
65
|
-
*
|
|
66
|
-
* "4.86 out of 5".
|
|
67
|
+
* Renders the summary as a `<section>` that stacks the parts it is given, usually a
|
|
68
|
+
* {@link RatingBreakdown.Score} over one or more {@link RatingBreakdown.Group}s.
|
|
67
69
|
*
|
|
68
70
|
* @param handle Runtime handle carrying the section's props.
|
|
69
71
|
* @returns The render function producing the summary's markup.
|
|
70
72
|
* @example
|
|
71
|
-
* <RatingBreakdown
|
|
73
|
+
* <RatingBreakdown>
|
|
74
|
+
* <RatingBreakdown.Score score={4.86}>
|
|
75
|
+
* <RatingBreakdown.Count>128 reviews</RatingBreakdown.Count>
|
|
76
|
+
* </RatingBreakdown.Score>
|
|
72
77
|
* <RatingBreakdown.Group kind="stars" aria-label="Ratings by star">
|
|
73
|
-
* <RatingBreakdown.Bar
|
|
78
|
+
* <RatingBreakdown.Bar value={0.92} display="92%">5 stars</RatingBreakdown.Bar>
|
|
74
79
|
* </RatingBreakdown.Group>
|
|
75
80
|
* </RatingBreakdown>
|
|
76
81
|
*/
|
|
77
82
|
export declare function RatingBreakdown(handle: Handle<RatingBreakdown.Props>): () => import("remix/component").RemixElement;
|
|
78
83
|
export declare namespace RatingBreakdown {
|
|
84
|
+
var Score: (handle: Handle<RatingBreakdown.ScoreProps>) => () => import("remix/component").RemixElement;
|
|
85
|
+
var Count: (handle: Handle<RatingBreakdown.CountProps>) => () => import("remix/component").RemixElement;
|
|
79
86
|
var Group: (handle: Handle<RatingBreakdown.GroupProps, RatingBreakdown.GroupContext>) => () => import("remix/component").RemixElement;
|
|
80
87
|
var Bar: (handle: Handle<RatingBreakdown.BarProps>) => () => import("remix/component").RemixElement;
|
|
81
88
|
}
|
|
@@ -15,34 +15,70 @@ const CONTAINER_NAME = "ui-rating-breakdown";
|
|
|
15
15
|
const TWO_COLUMN_WIDTH = "30rem";
|
|
16
16
|
/** Top of the scale when `max` is left out: a five-star rating. */
|
|
17
17
|
const DEFAULT_MAX = 5;
|
|
18
|
+
/** How a bar lays out when it sits outside a {@link RatingBreakdown.Group}. */
|
|
19
|
+
const DEFAULT_KIND = "stars";
|
|
18
20
|
/**
|
|
19
|
-
* Renders the summary
|
|
20
|
-
*
|
|
21
|
-
* "4.86 out of 5".
|
|
21
|
+
* Renders the summary as a `<section>` that stacks the parts it is given, usually a
|
|
22
|
+
* {@link RatingBreakdown.Score} over one or more {@link RatingBreakdown.Group}s.
|
|
22
23
|
*
|
|
23
24
|
* @param handle Runtime handle carrying the section's props.
|
|
24
25
|
* @returns The render function producing the summary's markup.
|
|
25
26
|
* @example
|
|
26
|
-
* <RatingBreakdown
|
|
27
|
+
* <RatingBreakdown>
|
|
28
|
+
* <RatingBreakdown.Score score={4.86}>
|
|
29
|
+
* <RatingBreakdown.Count>128 reviews</RatingBreakdown.Count>
|
|
30
|
+
* </RatingBreakdown.Score>
|
|
27
31
|
* <RatingBreakdown.Group kind="stars" aria-label="Ratings by star">
|
|
28
|
-
* <RatingBreakdown.Bar
|
|
32
|
+
* <RatingBreakdown.Bar value={0.92} display="92%">5 stars</RatingBreakdown.Bar>
|
|
29
33
|
* </RatingBreakdown.Group>
|
|
30
34
|
* </RatingBreakdown>
|
|
31
35
|
*/
|
|
32
36
|
export function RatingBreakdown(handle) {
|
|
33
37
|
return () => {
|
|
34
|
-
let {
|
|
35
|
-
|
|
36
|
-
return (_jsxs("section", { "data-slot": "rating-breakdown", ...rest, mix: mergeMix([container(CONTAINER_NAME, "inline-size"), vstack({ gap: 5 })], mix), children: [_jsxs("p", { "data-slot": "rating-breakdown-score", mix: [m(0), flex(), items("center"), gap(2), raw({ flexWrap: "wrap" })], children: [_jsx("span", { "aria-hidden": "true", mix: [flex(), raw({ color: "var(--ui-warning-fg)" })], children: _jsx(StarIcon, { size: 28, fill: "currentColor", "stroke-width": 0 }) }), _jsxs("span", { mix: [
|
|
37
|
-
text("3xl"),
|
|
38
|
-
weight("semibold"),
|
|
39
|
-
tracking("tight"),
|
|
40
|
-
leading(1),
|
|
41
|
-
tabularNums(),
|
|
42
|
-
fg("neutral.emphasis"),
|
|
43
|
-
], children: [display ?? score.toFixed(2), _jsx("span", { mix: [visuallyHidden()], children: ` ${outOf ?? `out of ${top}`}` })] }), count === undefined ? null : (_jsx("span", { "data-slot": "rating-breakdown-count", mix: [text("sm"), fg("neutral.muted")], children: count }))] }), children] }));
|
|
38
|
+
let { mix, ...rest } = handle.props;
|
|
39
|
+
return (_jsx("section", { "data-slot": "rating-breakdown", ...rest, mix: mergeMix([container(CONTAINER_NAME, "inline-size"), vstack({ gap: 5 })], mix) }));
|
|
44
40
|
};
|
|
45
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* Renders the headline: a star, the score set large and its children, usually a
|
|
44
|
+
* {@link RatingBreakdown.Count}. A screen reader hears the score as "4.86 out of 5".
|
|
45
|
+
*
|
|
46
|
+
* @param handle Runtime handle carrying the paragraph's props.
|
|
47
|
+
* @returns The render function producing the score's markup.
|
|
48
|
+
* @example
|
|
49
|
+
* <RatingBreakdown.Score score={4.86} outOf="out of 5">
|
|
50
|
+
* <RatingBreakdown.Count>128 reviews</RatingBreakdown.Count>
|
|
51
|
+
* </RatingBreakdown.Score>
|
|
52
|
+
*/
|
|
53
|
+
RatingBreakdown.Score = function RatingBreakdownScore(handle) {
|
|
54
|
+
return () => {
|
|
55
|
+
let { score, max, display, outOf, children, mix, ...rest } = handle.props;
|
|
56
|
+
let top = max ?? DEFAULT_MAX;
|
|
57
|
+
return (_jsxs("p", { "data-slot": "rating-breakdown-score", ...rest, mix: mergeMix([m(0), flex(), items("center"), gap(2), raw({ flexWrap: "wrap" })], mix), children: [_jsx("span", { "aria-hidden": "true", mix: [flex(), raw({ color: "var(--ui-warning-fg)" })], children: _jsx(StarIcon, { size: 28, fill: "currentColor", "stroke-width": 0 }) }), _jsxs("span", { mix: [
|
|
58
|
+
text("3xl"),
|
|
59
|
+
weight("semibold"),
|
|
60
|
+
tracking("tight"),
|
|
61
|
+
leading(1),
|
|
62
|
+
tabularNums(),
|
|
63
|
+
fg("neutral.emphasis"),
|
|
64
|
+
], children: [display ?? score.toFixed(2), _jsx("span", { mix: [visuallyHidden()], children: ` ${outOf ?? `out of ${top}`}` })] }), children] }));
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* Renders the review count in small muted type, beside the score when written inside a
|
|
69
|
+
* {@link RatingBreakdown.Score}.
|
|
70
|
+
*
|
|
71
|
+
* @param handle Runtime handle carrying the span's props.
|
|
72
|
+
* @returns The render function producing the count's markup.
|
|
73
|
+
* @example
|
|
74
|
+
* <RatingBreakdown.Count>128 reviews</RatingBreakdown.Count>
|
|
75
|
+
*/
|
|
76
|
+
RatingBreakdown.Count = function RatingBreakdownCount(handle) {
|
|
77
|
+
return () => {
|
|
78
|
+
let { mix, ...rest } = handle.props;
|
|
79
|
+
return (_jsx("span", { "data-slot": "rating-breakdown-count", ...rest, mix: mergeMix([text("sm"), fg("neutral.muted")], mix) }));
|
|
80
|
+
};
|
|
81
|
+
};
|
|
46
82
|
/**
|
|
47
83
|
* Renders a list of bars of one kind: star levels one under another, or categories in a
|
|
48
84
|
* grid that runs two to a row once the summary is 30rem wide. Name each group with
|
|
@@ -52,7 +88,7 @@ export function RatingBreakdown(handle) {
|
|
|
52
88
|
* @returns The render function producing the list's markup.
|
|
53
89
|
* @example
|
|
54
90
|
* <RatingBreakdown.Group kind="categories" aria-label="Ratings by category">
|
|
55
|
-
* <RatingBreakdown.Bar
|
|
91
|
+
* <RatingBreakdown.Bar value={4.9} display="4.9"><SparklesIcon />Cleanliness</RatingBreakdown.Bar>
|
|
56
92
|
* </RatingBreakdown.Group>
|
|
57
93
|
*/
|
|
58
94
|
RatingBreakdown.Group = function RatingBreakdownGroup(handle) {
|
|
@@ -74,21 +110,22 @@ RatingBreakdown.Group = function RatingBreakdownGroup(handle) {
|
|
|
74
110
|
};
|
|
75
111
|
};
|
|
76
112
|
/**
|
|
77
|
-
* Renders one bar as an ARIA meter named by
|
|
113
|
+
* Renders one bar as an ARIA meter named by its children and valued by `display`, filled to
|
|
78
114
|
* `value / max` of its track; the figure at its end is hidden from assistive technology,
|
|
79
115
|
* which reads it as the meter's value. Values outside `0..max` are clamped.
|
|
80
116
|
*
|
|
81
117
|
* @param handle Runtime handle carrying the item's props.
|
|
82
118
|
* @returns The render function producing the bar's markup.
|
|
83
119
|
* @example
|
|
84
|
-
* <RatingBreakdown.Bar
|
|
120
|
+
* <RatingBreakdown.Bar value={0.06} display="6%">4 stars</RatingBreakdown.Bar>
|
|
85
121
|
* @example
|
|
86
|
-
* <RatingBreakdown.Bar
|
|
122
|
+
* <RatingBreakdown.Bar value={4.7} display="4.7"><MapPinIcon />Location</RatingBreakdown.Bar>
|
|
87
123
|
*/
|
|
88
124
|
RatingBreakdown.Bar = function RatingBreakdownBar(handle) {
|
|
89
125
|
return () => {
|
|
90
|
-
let {
|
|
91
|
-
let
|
|
126
|
+
let { value, max, display, children, mix, ...rest } = handle.props;
|
|
127
|
+
let group = handle.context.get(RatingBreakdown.Group);
|
|
128
|
+
let kind = group?.kind ?? DEFAULT_KIND;
|
|
92
129
|
let top = max ?? (kind === "stars" ? 1 : DEFAULT_MAX);
|
|
93
130
|
let share = top > 0 ? Math.max(0, Math.min(1, value / top)) : 0;
|
|
94
131
|
let labelId = `${handle.id}-label`;
|
|
@@ -108,7 +145,7 @@ RatingBreakdown.Bar = function RatingBreakdownBar(handle) {
|
|
|
108
145
|
columnGap: "0.75rem",
|
|
109
146
|
rowGap: "0.375rem",
|
|
110
147
|
}),
|
|
111
|
-
], mix), children: [
|
|
148
|
+
], mix), children: [_jsx("span", { id: labelId, "data-slot": "rating-breakdown-label", mix: [
|
|
112
149
|
flex(),
|
|
113
150
|
items("center"),
|
|
114
151
|
gap(1.5),
|
|
@@ -116,7 +153,7 @@ RatingBreakdown.Bar = function RatingBreakdownBar(handle) {
|
|
|
116
153
|
fg(stars ? "neutral.muted" : "neutral.emphasis"),
|
|
117
154
|
stars ? null : raw({ gridArea: "label" }),
|
|
118
155
|
when("& > svg", raw({ inlineSize: "1rem", blockSize: "1rem", flexShrink: 0 })),
|
|
119
|
-
], children:
|
|
156
|
+
], children: children }), _jsx("div", { role: "meter", "aria-labelledby": labelId, "aria-valuemin": 0, "aria-valuemax": top, "aria-valuenow": value, "aria-valuetext": display, "data-slot": "rating-breakdown-track", mix: [
|
|
120
157
|
bs("0.375rem"),
|
|
121
158
|
rounded("full"),
|
|
122
159
|
bg("neutral.border"),
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* An aircraft cabin seat picker: a fuselage with a rounded nose,
|
|
3
|
-
* seats, row numbers down the aisle and exits
|
|
4
|
-
* under one name, so a form posts the pick
|
|
2
|
+
* An aircraft cabin seat picker: a fuselage with a rounded nose, an optional deck title and section
|
|
3
|
+
* titles, column letters over a grid of seats, row numbers down the aisle and exits on both walls.
|
|
4
|
+
* Every seat is a native radio under one name, so a form posts the pick with no script.
|
|
5
5
|
*
|
|
6
6
|
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
7
7
|
* @copyright Sergio Xalambrí 2026
|
|
8
8
|
*/
|
|
9
9
|
import type { Handle, Props as TagProps, RemixNode } from "remix/component";
|
|
10
|
-
/** Prop types for {@link SeatMap} and
|
|
10
|
+
/** Prop types for {@link SeatMap} and its compound parts. */
|
|
11
11
|
export declare namespace SeatMap {
|
|
12
12
|
/** Whether a seat can be picked; `"taken"` and `"blocked"` seats render disabled. */
|
|
13
13
|
type Status = "available" | "taken" | "blocked";
|
|
@@ -28,10 +28,9 @@ export declare namespace SeatMap {
|
|
|
28
28
|
number: number;
|
|
29
29
|
seats: Seat[];
|
|
30
30
|
}
|
|
31
|
-
/**
|
|
32
|
-
interface
|
|
33
|
-
|
|
34
|
-
title: RemixNode;
|
|
31
|
+
/** What {@link SeatMap} shares with its titles: the grid line each row's title takes. */
|
|
32
|
+
interface Context {
|
|
33
|
+
sectionLines: Record<number, number>;
|
|
35
34
|
}
|
|
36
35
|
/** Words appended to a seat's spoken name, in the page's language. */
|
|
37
36
|
interface Labels {
|
|
@@ -48,8 +47,11 @@ export declare namespace SeatMap {
|
|
|
48
47
|
/** Read after a seat of each tinted kind, e.g. `{ "extra-legroom": "extra legroom" }`. */
|
|
49
48
|
kinds?: Partial<Record<Exclude<Kind, "standard">, string>>;
|
|
50
49
|
}
|
|
51
|
-
/**
|
|
52
|
-
|
|
50
|
+
/**
|
|
51
|
+
* Every native `<fieldset>` attribute, plus the cabin to draw; its children are the
|
|
52
|
+
* {@link SeatMap.Deck} and {@link SeatMap.Section} titles drawn across the cabin.
|
|
53
|
+
*/
|
|
54
|
+
interface Props extends TagProps<"fieldset"> {
|
|
53
55
|
rows: Row[];
|
|
54
56
|
/** Seat letters in cabin order, a space for each aisle, e.g. "ABC DEF". */
|
|
55
57
|
layout: string;
|
|
@@ -60,27 +62,29 @@ export declare namespace SeatMap {
|
|
|
60
62
|
/** Names the radio group for assistive technology, e.g. "Choose a seat". */
|
|
61
63
|
label: string;
|
|
62
64
|
labels: Labels;
|
|
63
|
-
/** A visible header under the nose, such as "Main deck · Larkwing A321". */
|
|
64
|
-
deck?: RemixNode;
|
|
65
65
|
/** First and last rows the wing spans, drawn on both walls. */
|
|
66
66
|
wings?: [number, number];
|
|
67
67
|
/** Rows with an emergency exit, marked on both walls. */
|
|
68
68
|
exitRows?: number[];
|
|
69
|
-
/** Section titles, each drawn above the row it starts at. */
|
|
70
|
-
sections?: Section[];
|
|
71
69
|
/** Asks the browser to require a pick before the form submits. */
|
|
72
70
|
required?: boolean;
|
|
73
71
|
}
|
|
74
72
|
/** What one legend entry explains. */
|
|
75
73
|
type Swatch = "available" | "selected" | "taken" | "blocked" | Exclude<Kind, "standard">;
|
|
76
|
-
/**
|
|
77
|
-
interface
|
|
78
|
-
|
|
79
|
-
|
|
74
|
+
/** Every native `<p>` attribute; a header under the nose, such as "Main deck · A321". */
|
|
75
|
+
interface DeckProps extends TagProps<"p"> {
|
|
76
|
+
}
|
|
77
|
+
/** Every native `<p>` attribute, plus the row the section starts at. */
|
|
78
|
+
interface SectionProps extends TagProps<"p"> {
|
|
79
|
+
/** The number of the row the title sits above, such as `10` for "Economy". */
|
|
80
|
+
from: number;
|
|
81
|
+
}
|
|
82
|
+
/** Every native `<ul>` attribute; holds the {@link SeatMap.LegendItem}s. */
|
|
83
|
+
interface LegendProps extends TagProps<"ul"> {
|
|
80
84
|
}
|
|
81
|
-
/** Every native `<
|
|
82
|
-
interface
|
|
83
|
-
|
|
85
|
+
/** Every native `<li>` attribute, plus the swatch it draws; its children are the caption. */
|
|
86
|
+
interface LegendItemProps extends TagProps<"li"> {
|
|
87
|
+
swatch: Swatch;
|
|
84
88
|
}
|
|
85
89
|
}
|
|
86
90
|
/**
|
|
@@ -102,7 +106,10 @@ export declare namespace SeatMap {
|
|
|
102
106
|
* wings={[10, 18]}
|
|
103
107
|
* />
|
|
104
108
|
*/
|
|
105
|
-
export declare function SeatMap(handle: Handle<SeatMap.Props>): () => import("remix/component").RemixElement;
|
|
109
|
+
export declare function SeatMap(handle: Handle<SeatMap.Props, SeatMap.Context>): () => import("remix/component").RemixElement;
|
|
106
110
|
export declare namespace SeatMap {
|
|
111
|
+
var Deck: (handle: Handle<SeatMap.DeckProps>) => () => import("remix/component").RemixElement;
|
|
112
|
+
var Section: (handle: Handle<SeatMap.SectionProps>) => () => import("remix/component").RemixElement | null;
|
|
107
113
|
var Legend: (handle: Handle<SeatMap.LegendProps>) => () => import("remix/component").RemixElement;
|
|
114
|
+
var LegendItem: (handle: Handle<SeatMap.LegendItemProps>) => () => import("remix/component").RemixElement;
|
|
108
115
|
}
|