@krizaka/ui 3.54.0 → 3.59.0
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 +1 -0
- package/dist/{RotatingWord-D9s7FXFD.d.ts → RotatingWord-COSabR2c.d.ts} +2 -1
- package/dist/account-menu.d.ts +8 -3
- package/dist/account-menu.js +8 -1
- package/dist/account-menu.js.map +1 -1
- package/dist/account-settings.d.ts +153 -61
- package/dist/account-settings.js +243 -160
- package/dist/account-settings.js.map +1 -1
- package/dist/achievement.d.ts +2 -1
- package/dist/action-bar.d.ts +3 -2
- package/dist/activity-feed.d.ts +2 -1
- package/dist/agenda.d.ts +2 -1
- package/dist/alert.d.ts +2 -1
- package/dist/anatomy-plate.d.ts +6 -2
- package/dist/anatomy-plate.js +4 -0
- package/dist/anatomy-plate.js.map +1 -1
- package/dist/app-header/search.d.ts +64 -0
- package/dist/app-header/search.js +70 -0
- package/dist/app-header/search.js.map +1 -0
- package/dist/app-header.d.ts +89 -4
- package/dist/app-header.js +63 -5
- package/dist/app-header.js.map +1 -1
- package/dist/app-shell.d.ts +26 -25
- package/dist/app-shell.js +31 -40
- package/dist/app-shell.js.map +1 -1
- package/dist/argument-card.d.ts +3 -2
- package/dist/argument-card.js +3 -3
- package/dist/audio-player.d.ts +2 -1
- package/dist/auth-layout.d.ts +11 -10
- package/dist/avatar/defaults.d.ts +2 -1
- package/dist/avatar.d.ts +2 -1
- package/dist/badge.d.ts +2 -1
- package/dist/bird-plate.d.ts +7 -3
- package/dist/bird-plate.js +2 -2
- package/dist/bird-plate.js.map +1 -1
- package/dist/blocks.css +235 -27
- package/dist/button.d.ts +2 -1
- package/dist/captcha.d.ts +2 -1
- package/dist/captcha.js +1 -0
- package/dist/captcha.js.map +1 -1
- package/dist/card-grid.d.ts +2 -1
- package/dist/card.d.ts +2 -1
- package/dist/catalogue-page.d.ts +82 -2
- package/dist/catalogue-page.js +156 -13
- package/dist/catalogue-page.js.map +1 -1
- package/dist/changelog-page.d.ts +2 -1
- package/dist/chapter.d.ts +2 -1
- package/dist/chat.d.ts +14 -13
- package/dist/chat.js +2 -2
- package/dist/chat.js.map +1 -1
- package/dist/checkbox.d.ts +2 -1
- package/dist/checkbox.js +1 -1
- package/dist/checkbox.js.map +1 -1
- package/dist/chip-link.d.ts +2 -1
- package/dist/chip-row.d.ts +8 -7
- package/dist/chip.d.ts +55 -1
- package/dist/chip.js +14 -98
- package/dist/chip.js.map +1 -1
- package/dist/choice-grid.d.ts +3 -2
- package/dist/choice-grid.js +28 -88
- package/dist/choice-grid.js.map +1 -1
- package/dist/chunk-27AWSJTK.js +46 -0
- package/dist/chunk-27AWSJTK.js.map +1 -0
- package/dist/{chunk-YGIN2YIY.js → chunk-3X3OF4TI.js} +2 -2
- package/dist/chunk-3X3OF4TI.js.map +1 -0
- package/dist/{chunk-KBQD6HE3.js → chunk-4GQH27IT.js} +3 -3
- package/dist/{chunk-KBQD6HE3.js.map → chunk-4GQH27IT.js.map} +1 -1
- package/dist/{chunk-YHKTYFOQ.js → chunk-5LANVCK7.js} +383 -107
- package/dist/chunk-5LANVCK7.js.map +1 -0
- package/dist/{chunk-KDXRYUD3.js → chunk-5QEXOGO2.js} +3 -1
- package/dist/{chunk-KDXRYUD3.js.map → chunk-5QEXOGO2.js.map} +1 -1
- package/dist/chunk-5VEVYDVC.js +11 -0
- package/dist/chunk-5VEVYDVC.js.map +1 -0
- package/dist/chunk-7J2L4HOD.js +340 -0
- package/dist/chunk-7J2L4HOD.js.map +1 -0
- package/dist/chunk-BDIU5LZB.js +18 -0
- package/dist/chunk-BDIU5LZB.js.map +1 -0
- package/dist/chunk-BQ4EOR2O.js +177 -0
- package/dist/chunk-BQ4EOR2O.js.map +1 -0
- package/dist/chunk-CSRKYZ53.js +39 -0
- package/dist/chunk-CSRKYZ53.js.map +1 -0
- package/dist/chunk-F6JTHPHE.js +399 -0
- package/dist/chunk-F6JTHPHE.js.map +1 -0
- package/dist/chunk-HEKDKM5Y.js +128 -0
- package/dist/chunk-HEKDKM5Y.js.map +1 -0
- package/dist/chunk-KGLRZMCY.js +16 -0
- package/dist/chunk-KGLRZMCY.js.map +1 -0
- package/dist/chunk-KID32IRJ.js +18 -0
- package/dist/chunk-KID32IRJ.js.map +1 -0
- package/dist/chunk-OGWB76BR.js +90 -0
- package/dist/chunk-OGWB76BR.js.map +1 -0
- package/dist/{chunk-4LYKBSOG.js → chunk-USPOIQV5.js} +2 -2
- package/dist/chunk-USPOIQV5.js.map +1 -0
- package/dist/chunk-UYGUSYIC.js +173 -0
- package/dist/chunk-UYGUSYIC.js.map +1 -0
- package/dist/{chunk-7NRSPHAF.js → chunk-VB7MWE2N.js} +2 -2
- package/dist/{chunk-7NRSPHAF.js.map → chunk-VB7MWE2N.js.map} +1 -1
- package/dist/chunk-WOZP3JLW.js +51 -0
- package/dist/chunk-WOZP3JLW.js.map +1 -0
- package/dist/chunk-XVXFMVG3.js +27 -0
- package/dist/chunk-XVXFMVG3.js.map +1 -0
- package/dist/chunk-YCZ7N6Q6.js +385 -0
- package/dist/chunk-YCZ7N6Q6.js.map +1 -0
- package/dist/code-block.d.ts +2 -1
- package/dist/code-block.js +81 -98
- package/dist/code-block.js.map +1 -1
- package/dist/combobox.d.ts +20 -19
- package/dist/combobox.js +3 -2
- package/dist/command.d.ts +21 -20
- package/dist/comparison-table.d.ts +2 -1
- package/dist/component-page.d.ts +6 -2
- package/dist/component-page.js +5 -0
- package/dist/component-page.js.map +1 -1
- package/dist/confirm-button.d.ts +2 -1
- package/dist/contact-page.d.ts +2 -1
- package/dist/continue-prompt.d.ts +6 -2
- package/dist/continue-prompt.js +4 -0
- package/dist/continue-prompt.js.map +1 -1
- package/dist/countdown.d.ts +2 -1
- package/dist/cover-hero.d.ts +20 -19
- package/dist/cover-hero.js +25 -42
- package/dist/cover-hero.js.map +1 -1
- package/dist/cta-panel.d.ts +2 -1
- package/dist/dashboard-layout.d.ts +50 -2
- package/dist/dashboard-layout.js +66 -11
- package/dist/dashboard-layout.js.map +1 -1
- package/dist/data-table.d.ts +103 -4
- package/dist/data-table.js +23 -7
- package/dist/date-picker.d.ts +29 -28
- package/dist/date-picker.js +2 -2
- package/dist/date-picker.js.map +1 -1
- package/dist/decision-list.d.ts +2 -1
- package/dist/description-list.d.ts +2 -1
- package/dist/detail-layout.d.ts +147 -3
- package/dist/detail-layout.js +143 -17
- package/dist/detail-layout.js.map +1 -1
- package/dist/{dialog-D42QwYb_.d.ts → dialog-DpUwec2g.d.ts} +2 -1
- package/dist/dialog.d.ts +3 -2
- package/dist/docs-article-page.d.ts +2 -1
- package/dist/docs-hub-page.d.ts +2 -1
- package/dist/docs-layout.d.ts +2 -1
- package/dist/docs-nav.d.ts +3 -10
- package/dist/document-viewer.d.ts +5 -4
- package/dist/doodle.d.ts +32 -0
- package/dist/doodle.js +70 -0
- package/dist/doodle.js.map +1 -0
- package/dist/drop-overlay.d.ts +14 -5
- package/dist/drop-overlay.js +16 -6
- package/dist/drop-overlay.js.map +1 -1
- package/dist/dropdown-menu.d.ts +2 -1
- package/dist/dropdown-menu.js +13 -74
- package/dist/dropdown-menu.js.map +1 -1
- package/dist/elephant.d.ts +4 -1
- package/dist/elephant.js +4 -0
- package/dist/elephant.js.map +1 -1
- package/dist/empty-state.d.ts +2 -1
- package/dist/engine-flow.d.ts +2 -1
- package/dist/error-page.d.ts +2 -1
- package/dist/field.js +1 -1
- package/dist/field.js.map +1 -1
- package/dist/file-upload.d.ts +14 -13
- package/dist/filter-bar.d.ts +84 -11
- package/dist/filter-bar.js +6 -2
- package/dist/flock.d.ts +3 -2
- package/dist/footnote.d.ts +2 -1
- package/dist/force-update-screen.d.ts +13 -8
- package/dist/force-update-screen.js +4 -0
- package/dist/force-update-screen.js.map +1 -1
- package/dist/form/server.d.ts +2 -1
- package/dist/form.d.ts +2 -1
- package/dist/gallery-page.d.ts +6 -2
- package/dist/gallery-page.js +4 -0
- package/dist/gallery-page.js.map +1 -1
- package/dist/genui.d.ts +2 -1
- package/dist/genui.js +5 -5
- package/dist/{geometry-DX-W-Yyf.d.ts → geometry-DZ4Q3hDQ.d.ts} +2 -1
- package/dist/glossary-term.d.ts +2 -1
- package/dist/glossary.d.ts +2 -1
- package/dist/glow-card.d.ts +2 -1
- package/dist/goal-gauge.d.ts +2 -1
- package/dist/grade-stamp.d.ts +23 -0
- package/dist/grade-stamp.js +42 -0
- package/dist/grade-stamp.js.map +1 -0
- package/dist/how-it-works-page.d.ts +2 -1
- package/dist/image-cropper.d.ts +15 -6
- package/dist/image-cropper.js +4 -0
- package/dist/image-cropper.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +4 -4
- package/dist/iso.d.ts +2 -1
- package/dist/kanban.d.ts +5 -1
- package/dist/kanban.js +4 -0
- package/dist/kanban.js.map +1 -1
- package/dist/kbd.d.ts +2 -1
- package/dist/kind-config-editor.d.ts +152 -0
- package/dist/kind-config-editor.js +574 -0
- package/dist/kind-config-editor.js.map +1 -0
- package/dist/kpi-explained.d.ts +2 -1
- package/dist/landing-page.d.ts +2 -1
- package/dist/landscape.d.ts +6 -2
- package/dist/landscape.js +4 -0
- package/dist/landscape.js.map +1 -1
- package/dist/language-switch/server.d.ts +2 -1
- package/dist/language-switch.d.ts +11 -10
- package/dist/legal-page.d.ts +2 -1
- package/dist/link-card.d.ts +2 -1
- package/dist/list.d.ts +2 -1
- package/dist/list.js +1 -1
- package/dist/loader.d.ts +2 -1
- package/dist/longform-page.d.ts +2 -1
- package/dist/maintenance-screen.d.ts +10 -5
- package/dist/maintenance-screen.js +4 -0
- package/dist/maintenance-screen.js.map +1 -1
- package/dist/map.d.ts +8 -7
- package/dist/map.js +30 -0
- package/dist/map.js.map +1 -1
- package/dist/markdown.d.ts +7 -2
- package/dist/markdown.js +12 -5
- package/dist/markdown.js.map +1 -1
- package/dist/marketing-layout.d.ts +5 -4
- package/dist/marquee.d.ts +2 -1
- package/dist/mascot-quote.d.ts +2 -1
- package/dist/mascot-state.d.ts +3 -2
- package/dist/mascots.d.ts +4 -3
- package/dist/match-dialog.d.ts +6 -2
- package/dist/match-dialog.js +4 -0
- package/dist/match-dialog.js.map +1 -1
- package/dist/media-capture.d.ts +11 -5
- package/dist/media-capture.js +4 -0
- package/dist/media-capture.js.map +1 -1
- package/dist/media-gallery.d.ts +2 -1
- package/dist/media-grid.d.ts +3 -10
- package/dist/meta-row.d.ts +2 -1
- package/dist/meter.d.ts +2 -1
- package/dist/meter.js +5 -121
- package/dist/meter.js.map +1 -1
- package/dist/motion.d.ts +3 -2
- package/dist/native/form.d.ts +2 -1
- package/dist/native/list.d.ts +2 -1
- package/dist/native/map.d.ts +2 -1
- package/dist/native/map.js +30 -0
- package/dist/native/map.js.map +1 -1
- package/dist/native/markdown.d.ts +11 -3
- package/dist/native/markdown.js +46 -7
- package/dist/native/markdown.js.map +1 -1
- package/dist/native/media-capture.d.ts +3 -1
- package/dist/native/media-capture.js +5 -0
- package/dist/native/media-capture.js.map +1 -1
- package/dist/native/media-picker.d.ts +2 -1
- package/dist/native/vertical-video.d.ts +10 -3
- package/dist/native/vertical-video.js +6 -0
- package/dist/native/vertical-video.js.map +1 -1
- package/dist/native/video-player.d.ts +2 -1
- package/dist/native.d.ts +323 -4
- package/dist/native.js +1974 -1348
- package/dist/native.js.map +1 -1
- package/dist/nav-bar/me.d.ts +33 -0
- package/dist/nav-bar/me.js +23 -0
- package/dist/nav-bar/me.js.map +1 -0
- package/dist/nav-bar.d.ts +61 -2
- package/dist/nav-bar.js +92 -48
- package/dist/nav-bar.js.map +1 -1
- package/dist/next-actions.d.ts +2 -1
- package/dist/notification-preferences.d.ts +152 -0
- package/dist/notification-preferences.js +78 -0
- package/dist/notification-preferences.js.map +1 -0
- package/dist/number-ticker.d.ts +2 -1
- package/dist/opening-hours.d.ts +2 -1
- package/dist/page-header.d.ts +2 -1
- package/dist/page-header.js +1 -1
- package/dist/page-header.js.map +1 -1
- package/dist/page-hero.d.ts +2 -1
- package/dist/page-index.d.ts +2 -1
- package/dist/page.d.ts +2 -1
- package/dist/pagination.d.ts +2 -1
- package/dist/photo-grid.d.ts +2 -1
- package/dist/pointer-light.d.ts +2 -1
- package/dist/pointer-light.js +5 -0
- package/dist/pointer-light.js.map +1 -1
- package/dist/popover.d.ts +2 -1
- package/dist/pricing-page.d.ts +2 -1
- package/dist/product-page.d.ts +6 -2
- package/dist/product-page.js +4 -0
- package/dist/product-page.js.map +1 -1
- package/dist/profile-card.d.ts +120 -1
- package/dist/profile-card.js +68 -21
- package/dist/profile-card.js.map +1 -1
- package/dist/progress.d.ts +2 -1
- package/dist/promise-card.d.ts +6 -2
- package/dist/promise-card.js +4 -0
- package/dist/promise-card.js.map +1 -1
- package/dist/quota-meter.d.ts +114 -0
- package/dist/quota-meter.js +58 -0
- package/dist/quota-meter.js.map +1 -0
- package/dist/radio-group.d.ts +2 -1
- package/dist/radio-group.js +7 -9
- package/dist/radio-group.js.map +1 -1
- package/dist/rail-nav.d.ts +35 -18
- package/dist/rail-nav.js +45 -56
- package/dist/rail-nav.js.map +1 -1
- package/dist/recipes.d.ts +2 -1
- package/dist/retro-tv.d.ts +31 -0
- package/dist/retro-tv.js +124 -0
- package/dist/retro-tv.js.map +1 -0
- package/dist/router.d.ts +13 -1
- package/dist/router.js +85 -8
- package/dist/router.js.map +1 -1
- package/dist/scroll-stage.d.ts +7 -2
- package/dist/scroll-stage.js +5 -0
- package/dist/scroll-stage.js.map +1 -1
- package/dist/search-field.d.ts +2 -1
- package/dist/search-field.js +1 -1
- package/dist/section-backdrop.d.ts +2 -1
- package/dist/separator.d.ts +2 -1
- package/dist/service-card.d.ts +9 -8
- package/dist/settings-layout.d.ts +2 -1
- package/dist/settings-layout.js +10 -324
- package/dist/settings-layout.js.map +1 -1
- package/dist/showcase.d.ts +11 -3
- package/dist/showcase.js +5 -0
- package/dist/showcase.js.map +1 -1
- package/dist/signature.d.ts +20 -0
- package/dist/signature.js +39 -0
- package/dist/signature.js.map +1 -0
- package/dist/site-cahier.d.ts +187 -0
- package/dist/site-cahier.js +844 -0
- package/dist/site-cahier.js.map +1 -0
- package/dist/site-footer.d.ts +2 -1
- package/dist/site-footer.js +1 -1
- package/dist/sites.d.ts +2 -1
- package/dist/sites.js +1 -1
- package/dist/sites.js.map +1 -1
- package/dist/skeleton.d.ts +2 -1
- package/dist/skip-link.d.ts +2 -1
- package/dist/slider.d.ts +2 -1
- package/dist/slot-picker.d.ts +86 -13
- package/dist/slot-picker.js +98 -16
- package/dist/slot-picker.js.map +1 -1
- package/dist/slot.d.ts +1 -1
- package/dist/specimen-tag.d.ts +2 -1
- package/dist/speed-lines.d.ts +19 -0
- package/dist/speed-lines.js +45 -0
- package/dist/speed-lines.js.map +1 -0
- package/dist/spinner.d.ts +2 -1
- package/dist/split-view.d.ts +2 -1
- package/dist/stage-banner.d.ts +2 -1
- package/dist/stat.d.ts +2 -1
- package/dist/stat.js +1 -1
- package/dist/stat.js.map +1 -1
- package/dist/status-chip.d.ts +44 -0
- package/dist/status-chip.js +137 -0
- package/dist/status-chip.js.map +1 -0
- package/dist/status-page.d.ts +6 -2
- package/dist/status-page.js +5 -0
- package/dist/status-page.js.map +1 -1
- package/dist/step-progress.d.ts +2 -1
- package/dist/step-showcase.d.ts +2 -1
- package/dist/stepper.d.ts +2 -1
- package/dist/sticky-action.d.ts +28 -5
- package/dist/sticky-action.js +10 -4
- package/dist/sticky-action.js.map +1 -1
- package/dist/stuck.d.ts +28 -0
- package/dist/stuck.js +26 -0
- package/dist/stuck.js.map +1 -0
- package/dist/swipe-deck.d.ts +11 -3
- package/dist/swipe-deck.js +5 -0
- package/dist/swipe-deck.js.map +1 -1
- package/dist/switch.d.ts +2 -1
- package/dist/switch.js +4 -32
- package/dist/switch.js.map +1 -1
- package/dist/tabs.d.ts +48 -8
- package/dist/tabs.js +62 -12
- package/dist/tabs.js.map +1 -1
- package/dist/tag-input.d.ts +2 -1
- package/dist/tag-input.js +3 -2
- package/dist/tag-input.js.map +1 -1
- package/dist/tag-selector.d.ts +30 -4
- package/dist/tag-selector.js +90 -8
- package/dist/tag-selector.js.map +1 -1
- package/dist/taped-photo.d.ts +2 -1
- package/dist/taped-photo.js +3 -20
- package/dist/taped-photo.js.map +1 -1
- package/dist/terminal-replay.d.ts +6 -2
- package/dist/terminal-replay.js +5 -1
- package/dist/terminal-replay.js.map +1 -1
- package/dist/text-style/server.d.ts +2 -1
- package/dist/text-style.d.ts +2 -1
- package/dist/theme.d.ts +21 -1
- package/dist/theme.js +37 -1
- package/dist/theme.js.map +1 -1
- package/dist/toast.d.ts +2 -1
- package/dist/toc.d.ts +2 -1
- package/dist/tooltip.d.ts +2 -1
- package/dist/tree-view.d.ts +2 -1
- package/dist/tree-view.js +4 -0
- package/dist/tree-view.js.map +1 -1
- package/dist/update-prompt.d.ts +16 -11
- package/dist/update-prompt.js +4 -0
- package/dist/update-prompt.js.map +1 -1
- package/dist/upload-queue.d.ts +2 -1
- package/dist/verified-badge.d.ts +2 -1
- package/dist/versus-card.d.ts +40 -0
- package/dist/versus-card.js +40 -0
- package/dist/versus-card.js.map +1 -0
- package/dist/vertical-video.d.ts +2 -1
- package/dist/video-player.d.ts +20 -19
- package/dist/video-player.js +7 -376
- package/dist/video-player.js.map +1 -1
- package/dist/video-trimmer.d.ts +8 -2
- package/dist/video-trimmer.js +4 -0
- package/dist/video-trimmer.js.map +1 -1
- package/dist/virtual.d.ts +8 -7
- package/dist/waveform.d.ts +2 -1
- package/package.json +249 -52
- package/registry/account-menu.json +9 -8
- package/registry/account-settings.json +258 -6
- package/registry/achievement.json +3 -4
- package/registry/action-bar.json +3 -3
- package/registry/action-sheet.json +1 -0
- package/registry/activity-feed.json +2 -1
- package/registry/agenda.json +1 -1
- package/registry/alert.json +1 -1
- package/registry/anatomy-plate.json +13 -5
- package/registry/app-header.json +470 -23
- package/registry/app-shell.json +2 -2
- package/registry/argument-card.json +1 -1
- package/registry/audio-player.json +1 -1
- package/registry/auth-layout.json +1 -1
- package/registry/avatar.json +3 -2
- package/registry/badge.json +2 -1
- package/registry/bird-plate.json +16 -2
- package/registry/button.json +7 -6
- package/registry/captcha.json +1 -1
- package/registry/card-grid.json +1 -1
- package/registry/card.json +7 -6
- package/registry/catalogue-page.json +117 -8
- package/registry/changelog-page.json +3 -5
- package/registry/chapter.json +1 -1
- package/registry/chat.json +3 -2
- package/registry/checkbox.json +4 -3
- package/registry/chip-link.json +2 -2
- package/registry/chip-row.json +2 -2
- package/registry/chip.json +388 -12
- package/registry/choice-grid.json +3 -4
- package/registry/code-block.json +1 -1
- package/registry/combobox.json +3 -2
- package/registry/command.json +2 -2
- package/registry/comparison-table.json +1 -1
- package/registry/component-page.json +14 -5
- package/registry/confirm-button.json +4 -4
- package/registry/contact-page.json +1 -1
- package/registry/continue-prompt.json +13 -5
- package/registry/countdown.json +4 -3
- package/registry/cover-hero.json +3 -4
- package/registry/cta-panel.json +1 -1
- package/registry/dashboard-layout.json +91 -5
- package/registry/data-table.json +215 -8
- package/registry/date-picker.json +5 -4
- package/registry/decision-list.json +1 -1
- package/registry/description-list.json +2 -1
- package/registry/detail-layout.json +226 -8
- package/registry/dialog.json +7 -6
- package/registry/docs-article-page.json +3 -4
- package/registry/docs-hub-page.json +1 -1
- package/registry/docs-layout.json +1 -1
- package/registry/docs-nav.json +1 -1
- package/registry/document-viewer.json +3 -5
- package/registry/doodle.json +302 -0
- package/registry/drop-overlay.json +30 -16
- package/registry/dropdown-menu.json +2 -2
- package/registry/elephant.json +15 -7
- package/registry/empty-state.json +2 -1
- package/registry/engine-flow.json +1 -1
- package/registry/error-page.json +3 -5
- package/registry/examples/account-settings/appearance.d.ts +4 -0
- package/registry/examples/account-settings/appearance.js +40 -0
- package/registry/examples/account-settings/appearance.tsx +30 -0
- package/registry/examples/app-header/family.d.ts +4 -0
- package/registry/examples/app-header/family.js +41 -0
- package/registry/examples/app-header/family.tsx +37 -0
- package/registry/examples/app-header/native/family.d.ts +4 -0
- package/registry/examples/app-header/native/family.dark.png +0 -0
- package/registry/examples/app-header/native/family.js +25 -0
- package/registry/examples/app-header/native/family.light.png +0 -0
- package/registry/examples/app-header/native/family.tsx +33 -0
- package/registry/examples/catalogue-page/clients.d.ts +4 -0
- package/registry/examples/catalogue-page/clients.js +49 -0
- package/registry/examples/catalogue-page/clients.tsx +61 -0
- package/registry/examples/chip/marker-picker.d.ts +4 -0
- package/registry/examples/chip/marker-picker.js +17 -0
- package/registry/examples/chip/marker-picker.tsx +17 -0
- package/registry/examples/chip/native/marker-picker.d.ts +4 -0
- package/registry/examples/chip/native/marker-picker.dark.png +0 -0
- package/registry/examples/chip/native/marker-picker.js +18 -0
- package/registry/examples/chip/native/marker-picker.light.png +0 -0
- package/registry/examples/chip/native/marker-picker.tsx +16 -0
- package/registry/examples/chip/native/tags.d.ts +4 -0
- package/registry/examples/chip/native/tags.dark.png +0 -0
- package/registry/examples/chip/native/tags.js +22 -0
- package/registry/examples/chip/native/tags.light.png +0 -0
- package/registry/examples/chip/native/tags.tsx +20 -0
- package/registry/examples/chip/tags.d.ts +4 -0
- package/registry/examples/chip/tags.js +26 -0
- package/registry/examples/chip/tags.tsx +23 -0
- package/registry/examples/dashboard-layout/today.d.ts +4 -0
- package/registry/examples/dashboard-layout/today.js +54 -0
- package/registry/examples/dashboard-layout/today.tsx +63 -0
- package/registry/examples/data-table/applicant-files.d.ts +4 -0
- package/registry/examples/data-table/applicant-files.js +24 -0
- package/registry/examples/data-table/applicant-files.tsx +23 -0
- package/registry/examples/data-table/bulk.d.ts +4 -0
- package/registry/examples/data-table/bulk.js +45 -0
- package/registry/examples/data-table/bulk.tsx +34 -0
- package/registry/examples/data-table/checks.d.ts +4 -0
- package/registry/examples/data-table/checks.js +25 -0
- package/registry/examples/data-table/checks.tsx +24 -0
- package/registry/examples/detail-layout/client.d.ts +4 -0
- package/registry/examples/detail-layout/client.js +40 -0
- package/registry/examples/detail-layout/client.tsx +39 -0
- package/registry/examples/detail-layout/new-invoice.d.ts +4 -0
- package/registry/examples/detail-layout/new-invoice.js +44 -0
- package/registry/examples/detail-layout/new-invoice.tsx +34 -0
- package/registry/examples/detail-layout/profile.d.ts +4 -0
- package/registry/examples/detail-layout/profile.js +26 -0
- package/registry/examples/detail-layout/profile.tsx +21 -0
- package/registry/examples/doodle/bird-sketch.d.ts +4 -0
- package/registry/examples/doodle/bird-sketch.js +11 -0
- package/registry/examples/doodle/bird-sketch.tsx +12 -0
- package/registry/examples/doodle/kinds.d.ts +4 -0
- package/registry/examples/doodle/kinds.js +17 -0
- package/registry/examples/doodle/kinds.tsx +14 -0
- package/registry/examples/doodle/margin-marks.d.ts +4 -0
- package/registry/examples/doodle/margin-marks.js +27 -0
- package/registry/examples/doodle/margin-marks.tsx +19 -0
- package/registry/examples/doodle/margin.d.ts +4 -0
- package/registry/examples/doodle/margin.js +17 -0
- package/registry/examples/doodle/margin.tsx +17 -0
- package/registry/examples/filter-bar/views.d.ts +4 -0
- package/registry/examples/filter-bar/views.js +39 -0
- package/registry/examples/filter-bar/views.tsx +30 -0
- package/registry/examples/grade-stamp/coverage.d.ts +4 -0
- package/registry/examples/grade-stamp/coverage.js +12 -0
- package/registry/examples/grade-stamp/coverage.tsx +8 -0
- package/registry/examples/grade-stamp/lighthouse.d.ts +4 -0
- package/registry/examples/grade-stamp/lighthouse.js +12 -0
- package/registry/examples/grade-stamp/lighthouse.tsx +14 -0
- package/registry/examples/kind-config-editor/derived.d.ts +4 -0
- package/registry/examples/kind-config-editor/derived.js +26 -0
- package/registry/examples/kind-config-editor/derived.tsx +16 -0
- package/registry/examples/kind-config-editor/native/status-set.d.ts +4 -0
- package/registry/examples/kind-config-editor/native/status-set.dark.png +0 -0
- package/registry/examples/kind-config-editor/native/status-set.js +22 -0
- package/registry/examples/kind-config-editor/native/status-set.light.png +0 -0
- package/registry/examples/kind-config-editor/native/status-set.tsx +19 -0
- package/registry/examples/kind-config-editor/native/tag-set.d.ts +4 -0
- package/registry/examples/kind-config-editor/native/tag-set.dark.png +0 -0
- package/registry/examples/kind-config-editor/native/tag-set.js +20 -0
- package/registry/examples/kind-config-editor/native/tag-set.light.png +0 -0
- package/registry/examples/kind-config-editor/native/tag-set.tsx +18 -0
- package/registry/examples/kind-config-editor/status-set.d.ts +4 -0
- package/registry/examples/kind-config-editor/status-set.js +29 -0
- package/registry/examples/kind-config-editor/status-set.tsx +25 -0
- package/registry/examples/kind-config-editor/tag-set.d.ts +4 -0
- package/registry/examples/kind-config-editor/tag-set.js +20 -0
- package/registry/examples/kind-config-editor/tag-set.tsx +18 -0
- package/registry/examples/markdown/native/basic.dark.png +0 -0
- package/registry/examples/markdown/native/basic.light.png +0 -0
- package/registry/examples/markdown/native/wide-table.d.ts +4 -0
- package/registry/examples/markdown/native/wide-table.dark.png +0 -0
- package/registry/examples/markdown/native/wide-table.js +23 -0
- package/registry/examples/markdown/native/wide-table.light.png +0 -0
- package/registry/examples/markdown/native/wide-table.tsx +22 -0
- package/registry/examples/markdown/wide-table.d.ts +4 -0
- package/registry/examples/markdown/wide-table.js +28 -0
- package/registry/examples/markdown/wide-table.tsx +23 -0
- package/registry/examples/nav-bar/family-product.js +2 -4
- package/registry/examples/nav-bar/family-product.tsx +3 -5
- package/registry/examples/notification-preferences/default.d.ts +4 -0
- package/registry/examples/notification-preferences/default.js +29 -0
- package/registry/examples/notification-preferences/default.tsx +28 -0
- package/registry/examples/profile-card/banner.d.ts +4 -0
- package/registry/examples/profile-card/banner.js +28 -0
- package/registry/examples/profile-card/banner.tsx +24 -0
- package/registry/examples/profile-card/native/banner.d.ts +4 -0
- package/registry/examples/profile-card/native/banner.dark.png +0 -0
- package/registry/examples/profile-card/native/banner.js +22 -0
- package/registry/examples/profile-card/native/banner.light.png +0 -0
- package/registry/examples/profile-card/native/banner.tsx +18 -0
- package/registry/examples/quota-meter/default.d.ts +4 -0
- package/registry/examples/quota-meter/default.js +26 -0
- package/registry/examples/quota-meter/default.tsx +20 -0
- package/registry/examples/quota-meter/full.d.ts +4 -0
- package/registry/examples/quota-meter/full.js +25 -0
- package/registry/examples/quota-meter/full.tsx +18 -0
- package/registry/examples/rail-nav/shortcuts.d.ts +4 -0
- package/registry/examples/rail-nav/shortcuts.js +49 -0
- package/registry/examples/rail-nav/shortcuts.tsx +40 -0
- package/registry/examples/retro-tv/cabinet.d.ts +4 -0
- package/registry/examples/retro-tv/cabinet.js +12 -0
- package/registry/examples/retro-tv/cabinet.tsx +7 -0
- package/registry/examples/retro-tv/portable.d.ts +4 -0
- package/registry/examples/retro-tv/portable.js +12 -0
- package/registry/examples/retro-tv/portable.tsx +7 -0
- package/registry/examples/signature/both.d.ts +4 -0
- package/registry/examples/signature/both.js +11 -0
- package/registry/examples/signature/both.tsx +6 -0
- package/registry/examples/signature/variants.d.ts +4 -0
- package/registry/examples/signature/variants.js +14 -0
- package/registry/examples/signature/variants.tsx +11 -0
- package/registry/examples/site-cahier/java-releases.d.ts +4 -0
- package/registry/examples/site-cahier/java-releases.js +33 -0
- package/registry/examples/site-cahier/java-releases.tsx +32 -0
- package/registry/examples/site-cahier/motion-lab.d.ts +4 -0
- package/registry/examples/site-cahier/motion-lab.js +32 -0
- package/registry/examples/site-cahier/motion-lab.tsx +29 -0
- package/registry/examples/site-cahier/ts-changelog.d.ts +4 -0
- package/registry/examples/site-cahier/ts-changelog.js +24 -0
- package/registry/examples/site-cahier/ts-changelog.tsx +20 -0
- package/registry/examples/site-cahier/ts-doc.d.ts +4 -0
- package/registry/examples/site-cahier/ts-doc.js +38 -0
- package/registry/examples/site-cahier/ts-doc.tsx +27 -0
- package/registry/examples/site-cahier/ui-home.d.ts +4 -0
- package/registry/examples/site-cahier/ui-home.js +46 -0
- package/registry/examples/site-cahier/ui-home.tsx +40 -0
- package/registry/examples/slot-picker/weeks.d.ts +4 -0
- package/registry/examples/slot-picker/weeks.js +45 -0
- package/registry/examples/slot-picker/weeks.tsx +28 -0
- package/registry/examples/speed-lines/hero.d.ts +4 -0
- package/registry/examples/speed-lines/hero.js +11 -0
- package/registry/examples/speed-lines/hero.tsx +12 -0
- package/registry/examples/speed-lines/streaks.d.ts +4 -0
- package/registry/examples/speed-lines/streaks.js +11 -0
- package/registry/examples/speed-lines/streaks.tsx +12 -0
- package/registry/examples/status-chip/default.d.ts +4 -0
- package/registry/examples/status-chip/default.js +35 -0
- package/registry/examples/status-chip/default.tsx +32 -0
- package/registry/examples/status-chip/native/default.d.ts +4 -0
- package/registry/examples/status-chip/native/default.dark.png +0 -0
- package/registry/examples/status-chip/native/default.js +26 -0
- package/registry/examples/status-chip/native/default.light.png +0 -0
- package/registry/examples/status-chip/native/default.tsx +20 -0
- package/registry/examples/stuck/card.d.ts +4 -0
- package/registry/examples/stuck/card.js +13 -0
- package/registry/examples/stuck/card.tsx +14 -0
- package/registry/examples/stuck/holds.d.ts +4 -0
- package/registry/examples/stuck/holds.js +12 -0
- package/registry/examples/stuck/holds.tsx +16 -0
- package/registry/examples/stuck/tag.d.ts +4 -0
- package/registry/examples/stuck/tag.js +12 -0
- package/registry/examples/stuck/tag.tsx +13 -0
- package/registry/examples/tabs/binder.d.ts +4 -0
- package/registry/examples/tabs/binder.js +22 -0
- package/registry/examples/tabs/binder.tsx +20 -0
- package/registry/examples/tabs/native/binder.d.ts +4 -0
- package/registry/examples/tabs/native/binder.dark.png +0 -0
- package/registry/examples/tabs/native/binder.js +26 -0
- package/registry/examples/tabs/native/binder.light.png +0 -0
- package/registry/examples/tabs/native/binder.tsx +22 -0
- package/registry/examples/tag-selector/creatable.d.ts +4 -0
- package/registry/examples/tag-selector/creatable.js +41 -0
- package/registry/examples/tag-selector/creatable.tsx +29 -0
- package/registry/examples/tag-selector/native/tags.d.ts +4 -0
- package/registry/examples/tag-selector/native/tags.dark.png +0 -0
- package/registry/examples/tag-selector/native/tags.js +19 -0
- package/registry/examples/tag-selector/native/tags.light.png +0 -0
- package/registry/examples/tag-selector/native/tags.tsx +19 -0
- package/registry/examples/versus-card/alternatives.d.ts +4 -0
- package/registry/examples/versus-card/alternatives.js +20 -0
- package/registry/examples/versus-card/alternatives.tsx +14 -0
- package/registry/examples/versus-card/releases.d.ts +4 -0
- package/registry/examples/versus-card/releases.js +35 -0
- package/registry/examples/versus-card/releases.tsx +29 -0
- package/registry/fab.json +1 -0
- package/registry/field.json +3 -2
- package/registry/file-upload.json +6 -11
- package/registry/filter-bar.json +209 -9
- package/registry/flock.json +3 -4
- package/registry/footnote.json +2 -3
- package/registry/force-update-screen.json +14 -5
- package/registry/form.json +5 -4
- package/registry/gallery-page.json +14 -5
- package/registry/genui.json +2 -2
- package/registry/glossary-term.json +1 -1
- package/registry/glossary.json +1 -1
- package/registry/glow-card.json +2 -2
- package/registry/goal-gauge.json +2 -1
- package/registry/grade-stamp.json +227 -0
- package/registry/header.json +1 -0
- package/registry/how-it-works-page.json +3 -5
- package/registry/image-cropper.json +13 -5
- package/registry/image-viewer.json +3 -4
- package/registry/index.json +612 -105
- package/registry/iso.json +1 -1
- package/registry/kanban.json +13 -5
- package/registry/kbd.json +1 -1
- package/registry/kind-config-editor.json +565 -0
- package/registry/kpi-explained.json +2 -2
- package/registry/landing-page.json +3 -5
- package/registry/landscape.json +13 -5
- package/registry/language-switch.json +1 -1
- package/registry/legal-page.json +1 -1
- package/registry/link-card.json +1 -1
- package/registry/list.json +2 -1
- package/registry/loader.json +2 -1
- package/registry/longform-page.json +1 -1
- package/registry/maintenance-screen.json +14 -5
- package/registry/map.json +3 -2
- package/registry/markdown.json +86 -9
- package/registry/marketing-layout.json +1 -1
- package/registry/marquee.json +1 -1
- package/registry/mascot-quote.json +1 -1
- package/registry/mascot-state.json +12 -11
- package/registry/mascots.json +2 -1
- package/registry/match-dialog.json +14 -5
- package/registry/media-capture.json +14 -5
- package/registry/media-gallery.json +3 -5
- package/registry/media-grid.json +1 -1
- package/registry/media-picker.json +2 -3
- package/registry/meta-row.json +2 -1
- package/registry/meter.json +4 -3
- package/registry/nav-bar.json +100 -9
- package/registry/next-actions.json +1 -1
- package/registry/notification-preferences.json +250 -0
- package/registry/number-ticker.json +2 -1
- package/registry/onboarding.json +1 -0
- package/registry/opening-hours.json +1 -1
- package/registry/otp-input.json +1 -0
- package/registry/page-header.json +2 -2
- package/registry/page-hero.json +1 -1
- package/registry/page-index.json +1 -1
- package/registry/page.json +3 -3
- package/registry/pagination.json +2 -1
- package/registry/permission-prompt.json +2 -2
- package/registry/photo-grid.json +4 -4
- package/registry/pointer-light.json +6 -2
- package/registry/popover.json +2 -2
- package/registry/pricing-page.json +4 -6
- package/registry/product-page.json +14 -5
- package/registry/profile-card.json +232 -8
- package/registry/progress.json +4 -3
- package/registry/promise-card.json +13 -5
- package/registry/pull-to-refresh.json +1 -0
- package/registry/quota-meter.json +308 -0
- package/registry/radio-group.json +4 -3
- package/registry/rail-nav.json +48 -10
- package/registry/recipes.json +1 -1
- package/registry/retro-tv.json +478 -0
- package/registry/router.json +3 -3
- package/registry/screen.json +1 -0
- package/registry/scroll-stage.json +14 -5
- package/registry/search-field.json +3 -2
- package/registry/section-backdrop.json +1 -1
- package/registry/segmented.json +1 -0
- package/registry/separator.json +2 -2
- package/registry/service-card.json +1 -1
- package/registry/settings-layout.json +2 -1
- package/registry/showcase.json +14 -5
- package/registry/signature.json +185 -0
- package/registry/site-cahier.json +548 -0
- package/registry/site-footer.json +3 -3
- package/registry/sites.json +2 -2
- package/registry/skeleton.json +2 -1
- package/registry/skip-link.json +1 -1
- package/registry/slider.json +5 -4
- package/registry/slot-picker.json +156 -10
- package/registry/slot.json +2 -2
- package/registry/specimen-tag.json +1 -1
- package/registry/speed-lines.json +174 -0
- package/registry/spinner.json +4 -3
- package/registry/splash-handoff.json +1 -0
- package/registry/split-view.json +1 -1
- package/registry/stage-banner.json +2 -3
- package/registry/stat.json +2 -2
- package/registry/status-chip.json +350 -0
- package/registry/status-page.json +13 -5
- package/registry/step-progress.json +2 -1
- package/registry/step-showcase.json +3 -5
- package/registry/stepper.json +2 -1
- package/registry/sticky-action.json +38 -8
- package/registry/stuck.json +219 -0
- package/registry/swipe-deck.json +14 -5
- package/registry/swipeable-row.json +1 -0
- package/registry/switch.json +3 -2
- package/registry/tab-bar.json +1 -0
- package/registry/tabs.json +154 -22
- package/registry/tag-input.json +1 -1
- package/registry/tag-selector.json +190 -12
- package/registry/taped-photo.json +1 -1
- package/registry/terminal-replay.json +14 -5
- package/registry/text-style.json +5 -5
- package/registry/theme.json +4 -3
- package/registry/toast.json +2 -1
- package/registry/toc.json +1 -1
- package/registry/tooltip.json +2 -2
- package/registry/tree-view.json +6 -2
- package/registry/txt.json +1 -0
- package/registry/update-prompt.json +14 -5
- package/registry/upload-queue.json +1 -1
- package/registry/verified-badge.json +6 -6
- package/registry/versus-card.json +194 -0
- package/registry/vertical-video.json +8 -3
- package/registry/video-player.json +5 -6
- package/registry/video-trimmer.json +13 -5
- package/registry/virtual.json +2 -2
- package/registry/waveform.json +4 -3
- package/dist/chunk-4LYKBSOG.js.map +0 -1
- package/dist/chunk-HHFWK2HH.js +0 -163
- package/dist/chunk-HHFWK2HH.js.map +0 -1
- package/dist/chunk-R3LTSMS5.js +0 -75
- package/dist/chunk-R3LTSMS5.js.map +0 -1
- package/dist/chunk-YGIN2YIY.js.map +0 -1
- package/dist/chunk-YHKTYFOQ.js.map +0 -1
- package/dist/chunk-ZQW7LF4Y.js +0 -179
- package/dist/chunk-ZQW7LF4Y.js.map +0 -1
package/dist/taped-photo.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -67,7 +67,11 @@ type TerminalReplayProps = Omit<React.ComponentProps<"figure">, "children" | "ti
|
|
|
67
67
|
*/
|
|
68
68
|
autoPlay?: boolean;
|
|
69
69
|
};
|
|
70
|
-
/**
|
|
70
|
+
/**
|
|
71
|
+
* A terminal session played back: commands typed at the prompt, their output line by line — or the whole session at rest.
|
|
72
|
+
* @deprecated Since 3.55 (ADR-006, krizaka-ui#674): no product uses it. Removed in 4.0.
|
|
73
|
+
*/
|
|
71
74
|
declare function TerminalReplay({ steps, label, title, prompt, playLabel, pauseLabel, replayLabel, copyLabel, copiedLabel, typingSpeed, lineDelay, stepDelay, speed, rows, autoPlay, className, style, ...props }: TerminalReplayProps): React.JSX.Element;
|
|
72
75
|
|
|
73
|
-
export {
|
|
76
|
+
export { TerminalReplay };
|
|
77
|
+
export type { TerminalLine, TerminalReplayProps, TerminalStep, TerminalTone };
|
package/dist/terminal-replay.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import {
|
|
3
|
+
warnDeprecated
|
|
4
|
+
} from "./chunk-BDIU5LZB.js";
|
|
2
5
|
import {
|
|
3
6
|
CheckGlyph,
|
|
4
7
|
PauseGlyph,
|
|
5
8
|
PlayGlyph,
|
|
6
9
|
RetryGlyph
|
|
7
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-5QEXOGO2.js";
|
|
8
11
|
import {
|
|
9
12
|
cn
|
|
10
13
|
} from "./chunk-NSLXEDIS.js";
|
|
@@ -52,6 +55,7 @@ function TerminalReplay({
|
|
|
52
55
|
style,
|
|
53
56
|
...props
|
|
54
57
|
}) {
|
|
58
|
+
warnDeprecated("terminal-replay");
|
|
55
59
|
const root = React.useRef(null);
|
|
56
60
|
const screenRef = React.useRef(null);
|
|
57
61
|
const [phase, setPhase] = React.useState("final");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/terminal-replay/terminal-replay.tsx"],"sourcesContent":["// Client (a timer, an observer). A terminal session played back: each command is typed at the prompt, its output\n// arrives line by line, the screen follows the last line like a real terminal. What a reader sees without the motion\n// is the session itself: the server renders it whole (no JavaScript, reduced motion and assistive technology all get\n// the full transcript), the screen has a fixed height (no layout shift while it plays), the replay starts when it\n// scrolls into view, waits while it is off screen, and pauses or replays on demand (WCAG 2.2.2). A bounded chain of\n// timeouts, never a permanent animation frame.\nimport * as React from \"react\";\n\nimport { cn } from \"../cn\";\nimport { CheckGlyph, PauseGlyph, PlayGlyph, RetryGlyph } from \"../glyphs\";\n\n/** The colour of an output line — the tokens' text roles, all AA on the screen: secondary, accent, success, warning, danger. */\nexport type TerminalTone = \"muted\" | \"accent\" | \"success\" | \"warning\" | \"danger\";\n\nexport interface TerminalLine {\n /** The line as the program printed it (no colour codes). */\n text: string;\n /** Its colour, when the program coloured it. */\n tone?: TerminalTone;\n}\n\nexport interface TerminalStep {\n /** What is typed at the prompt (`npx orazaka install`). */\n command: string;\n /** What it printed, line by line. */\n output?: readonly (string | TerminalLine)[];\n}\n\nexport type TerminalReplayProps = Omit<React.ComponentProps<\"figure\">, \"children\" | \"title\"> & {\n /** The session, in order. */\n steps: readonly TerminalStep[];\n /** The accessible name of the screen (“Terminal session: install, start, dev”) — passed translated. */\n label: string;\n /** The window's title, shown in its bar (`~/projects — zsh`). */\n title?: React.ReactNode;\n /**\n * What the prompt shows before each command.\n * @default \"$\"\n */\n prompt?: string;\n /** The play button's words (the replay is waiting or paused). */\n playLabel: string;\n /** The pause button's words (the replay is running). */\n pauseLabel: string;\n /** The replay button's words (the session is shown whole). */\n replayLabel: string;\n /** The copy button's words: it copies the commands, one per line. Without it, no copy button. */\n copyLabel?: string;\n /** What the copy button says once the commands are copied (announced politely). */\n copiedLabel?: string;\n /**\n * Milliseconds per typed character.\n * @default 34\n */\n typingSpeed?: number;\n /**\n * Milliseconds between two output lines.\n * @default 70\n */\n lineDelay?: number;\n /**\n * Milliseconds between a command's last line and the next command.\n * @default 900\n */\n stepDelay?: number;\n /**\n * A multiplier on every delay (the motion vocabulary's `speed`): 2 plays twice as fast, 0.5 half as fast.\n * @default 1\n */\n speed?: number;\n /**\n * The screen's height, in lines; longer sessions scroll.\n * @default 18\n */\n rows?: number;\n /**\n * Plays the first time it scrolls into view. `false`: the session rests whole until the reader presses play.\n * @default true\n */\n autoPlay?: boolean;\n};\n\ntype Phase = \"final\" | \"idle\" | \"playing\" | \"paused\" | \"done\";\ninterface Position {\n step: number;\n chars: number;\n lines: number;\n}\n\nconst TONE: Record<TerminalTone, string> = {\n muted: \"text-fg-secondary\",\n accent: \"text-fg-accent\",\n success: \"text-fg-success\",\n warning: \"text-fg-warning\",\n danger: \"text-fg-danger\",\n};\n\nconst line = (entry: string | TerminalLine): TerminalLine => (typeof entry === \"string\" ? { text: entry } : entry);\n\n/** The next position of the replay and how long to wait for it; null at the end of the session. */\nfunction advance(steps: readonly TerminalStep[], pos: Position, timing: { typing: number; line: number; step: number }): [Position, number] | null {\n const current = steps[pos.step];\n if (!current) return null;\n const output = current.output ?? [];\n if (pos.chars < current.command.length) {\n // A space is a beat longer: the rhythm of someone typing, not of a printer.\n const pause = current.command[pos.chars] === \" \" ? timing.typing * 2 : timing.typing;\n return [{ ...pos, chars: pos.chars + 1 }, pause];\n }\n if (pos.lines < output.length) return [{ ...pos, lines: pos.lines + 1 }, pos.lines === 0 ? timing.line * 4 : timing.line];\n if (pos.step < steps.length - 1) return [{ step: pos.step + 1, chars: 0, lines: 0 }, timing.step];\n return null;\n}\n\n/** A terminal session played back: commands typed at the prompt, their output line by line — or the whole session at rest. */\nexport function TerminalReplay({\n steps,\n label,\n title,\n prompt = \"$\",\n playLabel,\n pauseLabel,\n replayLabel,\n copyLabel,\n copiedLabel,\n typingSpeed = 34,\n lineDelay = 70,\n stepDelay = 900,\n speed = 1,\n rows = 18,\n autoPlay = true,\n className,\n style,\n ...props\n}: TerminalReplayProps) {\n const root = React.useRef<HTMLElement>(null);\n const screenRef = React.useRef<HTMLDivElement>(null);\n // The server renders the session whole; the client takes it over unless the reader asked for less motion.\n const [phase, setPhase] = React.useState<Phase>(\"final\");\n const [pos, setPos] = React.useState<Position>({ step: 0, chars: 0, lines: 0 });\n const [visible, setVisible] = React.useState(false);\n const [copied, setCopied] = React.useState(false);\n\n React.useEffect(() => {\n const el = root.current;\n if (!el || !autoPlay || window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches) return;\n setPhase(\"idle\");\n // Starts the first time it is seen; off screen, it waits where it is.\n const io = new IntersectionObserver(\n ([entry]) => {\n const seen = Boolean(entry?.isIntersecting);\n setVisible(seen);\n if (seen) setPhase((current) => (current === \"idle\" ? \"playing\" : current));\n },\n { threshold: 0.35 },\n );\n io.observe(el);\n return () => io.disconnect();\n }, [autoPlay]);\n\n const rate = Math.max(0.1, speed);\n const timing = React.useMemo(() => ({ typing: typingSpeed / rate, line: lineDelay / rate, step: stepDelay / rate }), [typingSpeed, lineDelay, stepDelay, rate]);\n const ended = phase === \"playing\" && !advance(steps, pos, timing);\n // The end of the session is where the replay stands, not an event: derived, never set from an effect.\n const state: Phase = ended ? \"done\" : phase;\n\n React.useEffect(() => {\n if (phase !== \"playing\" || !visible) return;\n const next = advance(steps, pos, timing);\n if (!next) return;\n const timer = setTimeout(() => setPos(next[0]), next[1]);\n return () => clearTimeout(timer);\n }, [phase, visible, pos, steps, timing]);\n\n // The screen follows the last line while it plays, like a terminal.\n React.useEffect(() => {\n const el = screenRef.current;\n if (el && state === \"playing\") el.scrollTop = el.scrollHeight;\n }, [pos, state]);\n\n React.useEffect(() => {\n if (!copied) return;\n const timer = setTimeout(() => setCopied(false), 1800);\n return () => clearTimeout(timer);\n }, [copied]);\n\n const whole = state === \"final\" || state === \"done\";\n const shown = whole ? steps.length - 1 : pos.step;\n const toggle = () => {\n if (state === \"playing\") setPhase(\"paused\");\n else if (state === \"paused\" || state === \"idle\") setPhase(\"playing\");\n else {\n // Played on demand — also under reduced motion: the reader asked for it. Off screen it would wait: it is on screen.\n setVisible(true);\n setPos({ step: 0, chars: 0, lines: 0 });\n setPhase(\"playing\");\n }\n };\n const control =\n state === \"playing\"\n ? { text: pauseLabel, Glyph: PauseGlyph }\n : state === \"done\"\n ? { text: replayLabel, Glyph: RetryGlyph }\n : { text: playLabel, Glyph: PlayGlyph };\n const commands = steps.map((s) => s.command).join(\"\\n\");\n const transcript = steps.map((s) => [`${prompt} ${s.command}`, ...(s.output ?? []).map((o) => line(o).text)].join(\"\\n\")).join(\"\\n\\n\");\n\n return (\n <figure\n ref={root}\n data-state={state}\n data-autoplay={autoPlay ? \"\" : undefined}\n className={cn(\"kz-replay overflow-hidden rounded-xl border border-border-default bg-surface-1 shadow-md\", className)}\n style={{ \"--kz-replay-rows\": rows, ...style } as React.CSSProperties}\n {...props}\n >\n <figcaption className=\"flex items-center gap-3 border-b border-border-subtle bg-surface-2 px-3 py-2 text-xs text-fg-secondary\">\n <span aria-hidden className=\"flex shrink-0 gap-1.5\">\n <span className=\"h-2.5 w-2.5 rounded-full bg-border-strong\" />\n <span className=\"h-2.5 w-2.5 rounded-full bg-border-strong\" />\n <span className=\"h-2.5 w-2.5 rounded-full bg-border-strong\" />\n </span>\n <span className=\"min-w-0 flex-1 truncate font-mono\">{title}</span>\n <button\n type=\"button\"\n onClick={toggle}\n className=\"inline-flex shrink-0 items-center gap-1.5 rounded-md px-2 py-1 font-medium text-fg-secondary transition-colors hover:bg-surface-3 hover:text-fg focus-visible:outline-2 focus-visible:outline-ring\"\n >\n <control.Glyph className=\"h-3.5 w-3.5\" />\n {control.text}\n </button>\n {copyLabel && (\n <button\n type=\"button\"\n onClick={() => navigator.clipboard?.writeText(commands).then(() => setCopied(true))}\n data-copied={copied ? \"\" : undefined}\n className=\"inline-flex shrink-0 items-center gap-1.5 rounded-md px-2 py-1 font-medium text-fg-secondary transition-colors hover:bg-surface-3 hover:text-fg focus-visible:outline-2 focus-visible:outline-ring\"\n >\n {copied ? <CheckGlyph className=\"h-3.5 w-3.5\" /> : <CopyGlyph />}\n <span aria-live=\"polite\">{copied ? (copiedLabel ?? copyLabel) : copyLabel}</span>\n </button>\n )}\n </figcaption>\n <div\n ref={screenRef}\n role=\"region\"\n aria-label={label}\n tabIndex={0}\n className=\"kz-replay-screen relative overflow-auto bg-surface-0 px-4 py-3 font-mono text-[0.8125rem] leading-relaxed text-fg focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring\"\n >\n <div aria-hidden className=\"kz-replay-live\">\n {steps.slice(0, state === \"idle\" ? 0 : shown + 1).map((step, i) => {\n const current = !whole && i === shown;\n const typed = current ? step.command.slice(0, pos.chars) : step.command;\n const output = (step.output ?? []).slice(0, current ? pos.lines : undefined);\n const typing = current && pos.chars < step.command.length;\n return (\n <div key={i} className={i > 0 ? \"mt-3\" : undefined}>\n <div className=\"whitespace-pre\">\n <span className=\"text-fg-accent select-none\">{prompt} </span>\n <span className=\"font-medium\">{typed}</span>\n {typing && <span className=\"kz-replay-caret\" />}\n </div>\n {output.map((entry, j) => {\n const { text, tone } = line(entry);\n return (\n <div key={j} className={cn(\"min-h-[1lh] whitespace-pre\", tone ? TONE[tone] : \"text-fg\")}>\n {text}\n </div>\n );\n })}\n </div>\n );\n })}\n {(state === \"idle\" || whole) && (\n <div className={cn(\"whitespace-pre\", state !== \"idle\" && \"mt-3\")}>\n <span className=\"text-fg-accent select-none\">{prompt} </span>\n <span className=\"kz-replay-caret\" />\n </div>\n )}\n </div>\n <pre className=\"sr-only\">{transcript}</pre>\n </div>\n </figure>\n );\n}\n\n/** Two sheets, one over the other: copy. Drawn here, like the other glyphs of the primitives (decorative). */\nfunction CopyGlyph() {\n return (\n <svg viewBox=\"0 0 24 24\" className=\"h-3.5 w-3.5\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden focusable=\"false\">\n <rect x=\"9\" y=\"9\" width=\"11\" height=\"11\" rx=\"2\" />\n <path d=\"M5 15V6a2 2 0 0 1 2-2h8\" />\n </svg>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAMA,YAAY,WAAW;AAmNf,SACE,KADF;AAhIR,IAAM,OAAqC;AAAA,EACzC,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,SAAS;AAAA,EACT,QAAQ;AACV;AAEA,IAAM,OAAO,CAAC,UAAgD,OAAO,UAAU,WAAW,EAAE,MAAM,MAAM,IAAI;AAG5G,SAAS,QAAQ,OAAgC,KAAe,QAAmF;AACjJ,QAAM,UAAU,MAAM,IAAI,IAAI;A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ACtD,oBAAC,UAAK,WAAU,eAAe,iBAAM;AAAA,sBACpC,UAAU,oBAAC,UAAK,WAAU,mBAAkB;AAAA,uBAC/C;AAAA,oBACC,OAAO,IAAI,CAAC,OAAO,MAAM;AACxB,4BAAM,EAAE,MAAM,KAAK,IAAI,KAAK,KAAK;AACjC,6BACE,oBAAC,SAAY,WAAW,GAAG,8BAA8B,OAAO,KAAK,IAAI,IAAI,SAAS,GACnF,kBADO,CAEV;AAAA,oBAEJ,CAAC;AAAA,uBAbO,CAcV;AAAA,gBAEJ,CAAC;AAAA,iBACC,UAAU,UAAU,UACpB,qBAAC,SAAI,WAAW,GAAG,kBAAkB,UAAU,UAAU,MAAM,GAC7D;AAAA,uCAAC,UAAK,WAAU,8BAA8B;AAAA;AAAA,oBAAO;AAAA,qBAAC;AAAA,kBACtD,oBAAC,UAAK,WAAU,mBAAkB;AAAA,mBACpC;AAAA,iBAEJ;AAAA,cACA,oBAAC,SAAI,WAAU,WAAW,sBAAW;AAAA;AAAA;AAAA,QACvC;AAAA;AAAA;AAAA,EACF;AAEJ;AAGA,SAAS,YAAY;AACnB,SACE,qBAAC,SAAI,SAAQ,aAAY,WAAU,eAAc,MAAK,QAAO,QAAO,gBAAe,aAAY,KAAI,eAAc,SAAQ,gBAAe,SAAQ,eAAW,MAAC,WAAU,SACpK;AAAA,wBAAC,UAAK,GAAE,KAAI,GAAE,KAAI,OAAM,MAAK,QAAO,MAAK,IAAG,KAAI;AAAA,IAChD,oBAAC,UAAK,GAAE,2BAA0B;AAAA,KACpC;AAEJ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/terminal-replay/terminal-replay.tsx"],"sourcesContent":["// Client (a timer, an observer). A terminal session played back: each command is typed at the prompt, its output\n// arrives line by line, the screen follows the last line like a real terminal. What a reader sees without the motion\n// is the session itself: the server renders it whole (no JavaScript, reduced motion and assistive technology all get\n// the full transcript), the screen has a fixed height (no layout shift while it plays), the replay starts when it\n// scrolls into view, waits while it is off screen, and pauses or replays on demand (WCAG 2.2.2). A bounded chain of\n// timeouts, never a permanent animation frame.\nimport * as React from \"react\";\n\nimport { cn } from \"../cn\";\nimport { warnDeprecated } from \"../deprecated\";\nimport { CheckGlyph, PauseGlyph, PlayGlyph, RetryGlyph } from \"../glyphs\";\n\n/** The colour of an output line — the tokens' text roles, all AA on the screen: secondary, accent, success, warning, danger. */\nexport type TerminalTone = \"muted\" | \"accent\" | \"success\" | \"warning\" | \"danger\";\n\nexport interface TerminalLine {\n /** The line as the program printed it (no colour codes). */\n text: string;\n /** Its colour, when the program coloured it. */\n tone?: TerminalTone;\n}\n\nexport interface TerminalStep {\n /** What is typed at the prompt (`npx orazaka install`). */\n command: string;\n /** What it printed, line by line. */\n output?: readonly (string | TerminalLine)[];\n}\n\nexport type TerminalReplayProps = Omit<React.ComponentProps<\"figure\">, \"children\" | \"title\"> & {\n /** The session, in order. */\n steps: readonly TerminalStep[];\n /** The accessible name of the screen (“Terminal session: install, start, dev”) — passed translated. */\n label: string;\n /** The window's title, shown in its bar (`~/projects — zsh`). */\n title?: React.ReactNode;\n /**\n * What the prompt shows before each command.\n * @default \"$\"\n */\n prompt?: string;\n /** The play button's words (the replay is waiting or paused). */\n playLabel: string;\n /** The pause button's words (the replay is running). */\n pauseLabel: string;\n /** The replay button's words (the session is shown whole). */\n replayLabel: string;\n /** The copy button's words: it copies the commands, one per line. Without it, no copy button. */\n copyLabel?: string;\n /** What the copy button says once the commands are copied (announced politely). */\n copiedLabel?: string;\n /**\n * Milliseconds per typed character.\n * @default 34\n */\n typingSpeed?: number;\n /**\n * Milliseconds between two output lines.\n * @default 70\n */\n lineDelay?: number;\n /**\n * Milliseconds between a command's last line and the next command.\n * @default 900\n */\n stepDelay?: number;\n /**\n * A multiplier on every delay (the motion vocabulary's `speed`): 2 plays twice as fast, 0.5 half as fast.\n * @default 1\n */\n speed?: number;\n /**\n * The screen's height, in lines; longer sessions scroll.\n * @default 18\n */\n rows?: number;\n /**\n * Plays the first time it scrolls into view. `false`: the session rests whole until the reader presses play.\n * @default true\n */\n autoPlay?: boolean;\n};\n\ntype Phase = \"final\" | \"idle\" | \"playing\" | \"paused\" | \"done\";\ninterface Position {\n step: number;\n chars: number;\n lines: number;\n}\n\nconst TONE: Record<TerminalTone, string> = {\n muted: \"text-fg-secondary\",\n accent: \"text-fg-accent\",\n success: \"text-fg-success\",\n warning: \"text-fg-warning\",\n danger: \"text-fg-danger\",\n};\n\nconst line = (entry: string | TerminalLine): TerminalLine => (typeof entry === \"string\" ? { text: entry } : entry);\n\n/** The next position of the replay and how long to wait for it; null at the end of the session. */\nfunction advance(steps: readonly TerminalStep[], pos: Position, timing: { typing: number; line: number; step: number }): [Position, number] | null {\n const current = steps[pos.step];\n if (!current) return null;\n const output = current.output ?? [];\n if (pos.chars < current.command.length) {\n // A space is a beat longer: the rhythm of someone typing, not of a printer.\n const pause = current.command[pos.chars] === \" \" ? timing.typing * 2 : timing.typing;\n return [{ ...pos, chars: pos.chars + 1 }, pause];\n }\n if (pos.lines < output.length) return [{ ...pos, lines: pos.lines + 1 }, pos.lines === 0 ? timing.line * 4 : timing.line];\n if (pos.step < steps.length - 1) return [{ step: pos.step + 1, chars: 0, lines: 0 }, timing.step];\n return null;\n}\n\n/**\n * A terminal session played back: commands typed at the prompt, their output line by line — or the whole session at rest.\n * @deprecated Since 3.55 (ADR-006, krizaka-ui#674): no product uses it. Removed in 4.0.\n */\nexport function TerminalReplay({\n steps,\n label,\n title,\n prompt = \"$\",\n playLabel,\n pauseLabel,\n replayLabel,\n copyLabel,\n copiedLabel,\n typingSpeed = 34,\n lineDelay = 70,\n stepDelay = 900,\n speed = 1,\n rows = 18,\n autoPlay = true,\n className,\n style,\n ...props\n}: TerminalReplayProps) {\n warnDeprecated(\"terminal-replay\");\n const root = React.useRef<HTMLElement>(null);\n const screenRef = React.useRef<HTMLDivElement>(null);\n // The server renders the session whole; the client takes it over unless the reader asked for less motion.\n const [phase, setPhase] = React.useState<Phase>(\"final\");\n const [pos, setPos] = React.useState<Position>({ step: 0, chars: 0, lines: 0 });\n const [visible, setVisible] = React.useState(false);\n const [copied, setCopied] = React.useState(false);\n\n React.useEffect(() => {\n const el = root.current;\n if (!el || !autoPlay || window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches) return;\n setPhase(\"idle\");\n // Starts the first time it is seen; off screen, it waits where it is.\n const io = new IntersectionObserver(\n ([entry]) => {\n const seen = Boolean(entry?.isIntersecting);\n setVisible(seen);\n if (seen) setPhase((current) => (current === \"idle\" ? \"playing\" : current));\n },\n { threshold: 0.35 },\n );\n io.observe(el);\n return () => io.disconnect();\n }, [autoPlay]);\n\n const rate = Math.max(0.1, speed);\n const timing = React.useMemo(() => ({ typing: typingSpeed / rate, line: lineDelay / rate, step: stepDelay / rate }), [typingSpeed, lineDelay, stepDelay, rate]);\n const ended = phase === \"playing\" && !advance(steps, pos, timing);\n // The end of the session is where the replay stands, not an event: derived, never set from an effect.\n const state: Phase = ended ? \"done\" : phase;\n\n React.useEffect(() => {\n if (phase !== \"playing\" || !visible) return;\n const next = advance(steps, pos, timing);\n if (!next) return;\n const timer = setTimeout(() => setPos(next[0]), next[1]);\n return () => clearTimeout(timer);\n }, [phase, visible, pos, steps, timing]);\n\n // The screen follows the last line while it plays, like a terminal.\n React.useEffect(() => {\n const el = screenRef.current;\n if (el && state === \"playing\") el.scrollTop = el.scrollHeight;\n }, [pos, state]);\n\n React.useEffect(() => {\n if (!copied) return;\n const timer = setTimeout(() => setCopied(false), 1800);\n return () => clearTimeout(timer);\n }, [copied]);\n\n const whole = state === \"final\" || state === \"done\";\n const shown = whole ? steps.length - 1 : pos.step;\n const toggle = () => {\n if (state === \"playing\") setPhase(\"paused\");\n else if (state === \"paused\" || state === \"idle\") setPhase(\"playing\");\n else {\n // Played on demand — also under reduced motion: the reader asked for it. Off screen it would wait: it is on screen.\n setVisible(true);\n setPos({ step: 0, chars: 0, lines: 0 });\n setPhase(\"playing\");\n }\n };\n const control =\n state === \"playing\"\n ? { text: pauseLabel, Glyph: PauseGlyph }\n : state === \"done\"\n ? { text: replayLabel, Glyph: RetryGlyph }\n : { text: playLabel, Glyph: PlayGlyph };\n const commands = steps.map((s) => s.command).join(\"\\n\");\n const transcript = steps.map((s) => [`${prompt} ${s.command}`, ...(s.output ?? []).map((o) => line(o).text)].join(\"\\n\")).join(\"\\n\\n\");\n\n return (\n <figure\n ref={root}\n data-state={state}\n data-autoplay={autoPlay ? \"\" : undefined}\n className={cn(\"kz-replay overflow-hidden rounded-xl border border-border-default bg-surface-1 shadow-md\", className)}\n style={{ \"--kz-replay-rows\": rows, ...style } as React.CSSProperties}\n {...props}\n >\n <figcaption className=\"flex items-center gap-3 border-b border-border-subtle bg-surface-2 px-3 py-2 text-xs text-fg-secondary\">\n <span aria-hidden className=\"flex shrink-0 gap-1.5\">\n <span className=\"h-2.5 w-2.5 rounded-full bg-border-strong\" />\n <span className=\"h-2.5 w-2.5 rounded-full bg-border-strong\" />\n <span className=\"h-2.5 w-2.5 rounded-full bg-border-strong\" />\n </span>\n <span className=\"min-w-0 flex-1 truncate font-mono\">{title}</span>\n <button\n type=\"button\"\n onClick={toggle}\n className=\"inline-flex shrink-0 items-center gap-1.5 rounded-md px-2 py-1 font-medium text-fg-secondary transition-colors hover:bg-surface-3 hover:text-fg focus-visible:outline-2 focus-visible:outline-ring\"\n >\n <control.Glyph className=\"h-3.5 w-3.5\" />\n {control.text}\n </button>\n {copyLabel && (\n <button\n type=\"button\"\n onClick={() => navigator.clipboard?.writeText(commands).then(() => setCopied(true))}\n data-copied={copied ? \"\" : undefined}\n className=\"inline-flex shrink-0 items-center gap-1.5 rounded-md px-2 py-1 font-medium text-fg-secondary transition-colors hover:bg-surface-3 hover:text-fg focus-visible:outline-2 focus-visible:outline-ring\"\n >\n {copied ? <CheckGlyph className=\"h-3.5 w-3.5\" /> : <CopyGlyph />}\n <span aria-live=\"polite\">{copied ? (copiedLabel ?? copyLabel) : copyLabel}</span>\n </button>\n )}\n </figcaption>\n <div\n ref={screenRef}\n role=\"region\"\n aria-label={label}\n tabIndex={0}\n className=\"kz-replay-screen relative overflow-auto bg-surface-0 px-4 py-3 font-mono text-[0.8125rem] leading-relaxed text-fg focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring\"\n >\n <div aria-hidden className=\"kz-replay-live\">\n {steps.slice(0, state === \"idle\" ? 0 : shown + 1).map((step, i) => {\n const current = !whole && i === shown;\n const typed = current ? step.command.slice(0, pos.chars) : step.command;\n const output = (step.output ?? []).slice(0, current ? pos.lines : undefined);\n const typing = current && pos.chars < step.command.length;\n return (\n <div key={i} className={i > 0 ? \"mt-3\" : undefined}>\n <div className=\"whitespace-pre\">\n <span className=\"text-fg-accent select-none\">{prompt} </span>\n <span className=\"font-medium\">{typed}</span>\n {typing && <span className=\"kz-replay-caret\" />}\n </div>\n {output.map((entry, j) => {\n const { text, tone } = line(entry);\n return (\n <div key={j} className={cn(\"min-h-[1lh] whitespace-pre\", tone ? TONE[tone] : \"text-fg\")}>\n {text}\n </div>\n );\n })}\n </div>\n );\n })}\n {(state === \"idle\" || whole) && (\n <div className={cn(\"whitespace-pre\", state !== \"idle\" && \"mt-3\")}>\n <span className=\"text-fg-accent select-none\">{prompt} </span>\n <span className=\"kz-replay-caret\" />\n </div>\n )}\n </div>\n <pre className=\"sr-only\">{transcript}</pre>\n </div>\n </figure>\n );\n}\n\n/** Two sheets, one over the other: copy. Drawn here, like the other glyphs of the primitives (decorative). */\nfunction CopyGlyph() {\n return (\n <svg viewBox=\"0 0 24 24\" className=\"h-3.5 w-3.5\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden focusable=\"false\">\n <rect x=\"9\" y=\"9\" width=\"11\" height=\"11\" rx=\"2\" />\n <path d=\"M5 15V6a2 2 0 0 1 2-2h8\" />\n </svg>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAMA,YAAY,WAAW;AAwNf,SACE,KADF;AApIR,IAAM,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;","names":[]}
|
|
@@ -60,4 +60,5 @@ declare function textStyleProps(style: unknown): {
|
|
|
60
60
|
style: CSSProperties;
|
|
61
61
|
};
|
|
62
62
|
|
|
63
|
-
export {
|
|
63
|
+
export { StyledText, aligns, cases, defaultTextStyle, fontIds, fontWeights, leadings, parseTextStyle, sizeSteps, textStyleProps, textWeights, toneIds, trackings };
|
|
64
|
+
export type { Align, Case, FontId, Leading, SizeStep, StyledTextProps, TextStyle, TextWeight, ToneId, Tracking };
|
package/dist/text-style.d.ts
CHANGED
|
@@ -146,4 +146,5 @@ type TextStylePickerProps = {
|
|
|
146
146
|
/** The control of a text style: font, size, weight, spacing, alignment, case, italic and tone, with a live preview. */
|
|
147
147
|
declare function TextStylePicker({ value, onChange, previewText, presets, fields, compact, labels: given, surface, role, minBodySize, className, }: TextStylePickerProps): React.JSX.Element;
|
|
148
148
|
|
|
149
|
-
export {
|
|
149
|
+
export { StyledText, TextStylePicker, aligns, bodyTextRatio, cases, contrastRatio, defaultTextStyle, fontIds, fontWeights, isLargeText, largeTextRatio, leadings, parseColor, parseTextStyle, requiredContrast, sizeSteps, textStyleFields, textStyleLabels, textStyleLabelsFr, textStyleProps, textWeights, toneIds, trackings };
|
|
150
|
+
export type { Align, Case, FontId, Leading, SizeStep, StyledTextProps, TextStyle, TextStyleField, TextStyleLabels, TextStylePickerProps, TextStylePreset, TextWeight, ToneId, Tracking };
|
package/dist/theme.d.ts
CHANGED
|
@@ -52,5 +52,25 @@ type ThemeToggleProps = Omit<React.ComponentProps<"button">, "onClick" | "childr
|
|
|
52
52
|
* <ThemeProvider> above it. State: `data-mode`.
|
|
53
53
|
*/
|
|
54
54
|
declare function ThemeToggle({ label, variant, shape, className, ...props }: ThemeToggleProps): React.JSX.Element;
|
|
55
|
+
/** The choices of the Appearance block (ADR-006 §4): the theme (`system · light · dark`, then a surface set), the accent, the density. */
|
|
56
|
+
type AppearanceState = {
|
|
57
|
+
/** `system`, `light`, `dark`, or the surface set (`blueprint`, `carbone`) — which is dark. */
|
|
58
|
+
themeId: string;
|
|
59
|
+
setThemeId: (id: string) => void;
|
|
60
|
+
/** A brand's accent (`data-accent` on `<html>`), or null: the product's own. */
|
|
61
|
+
accent: string | null;
|
|
62
|
+
setAccent: (accent: string | null) => void;
|
|
63
|
+
/** `standard` or `compact` (`data-density` on `<html>`, the token layer: rows and gaps one step down). */
|
|
64
|
+
density: string;
|
|
65
|
+
setDensity: (density: string) => void;
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* The state of the Appearance block, applied at once and kept in the browser (`kz-theme`, `kz-theme-name`, `kz-accent`,
|
|
69
|
+
* `kz-density`; `ThemeScript` restores them before paint). A product with an account also saves what `onChange` of the block
|
|
70
|
+
* reports, so the choice follows the person. Needs a `ThemeProvider`.
|
|
71
|
+
* @param surfaceSets the themes that are a dark surface set (default `blueprint`, `carbone`)
|
|
72
|
+
*/
|
|
73
|
+
declare function useAppearance(surfaceSets?: readonly string[]): AppearanceState;
|
|
55
74
|
|
|
56
|
-
export {
|
|
75
|
+
export { ThemeProvider, ThemeScript, ThemeToggle, useAppearance, useTheme };
|
|
76
|
+
export type { AppearanceState, Mode, ThemeContextValue, ThemeProviderProps, ThemeScriptProps, ThemeToggleProps };
|
package/dist/theme.js
CHANGED
|
@@ -11,6 +11,8 @@ import * as React from "react";
|
|
|
11
11
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
12
12
|
var MODE_KEY = "kz-theme";
|
|
13
13
|
var NAME_KEY = "kz-theme-name";
|
|
14
|
+
var ACCENT_KEY = "kz-accent";
|
|
15
|
+
var DENSITY_KEY = "kz-density";
|
|
14
16
|
var MODES = ["dark", "light", "system"];
|
|
15
17
|
var DARK_QUERY = "(prefers-color-scheme: dark)";
|
|
16
18
|
var isMode = (value) => MODES.includes(value);
|
|
@@ -52,7 +54,7 @@ function applyName(previous, next) {
|
|
|
52
54
|
}
|
|
53
55
|
function ThemeScript({ nonce, defaultMode = "system" }) {
|
|
54
56
|
const fallback = isMode(defaultMode) ? defaultMode : "system";
|
|
55
|
-
const js = `(function(){try{var m=localStorage.getItem("${MODE_KEY}");if(m!=="dark"&&m!=="light"&&m!=="system")m="${fallback}";var n=localStorage.getItem("${NAME_KEY}");var d=matchMedia("${DARK_QUERY}").matches;var c=document.documentElement.classList;c.toggle("light",m==="light"||(m==="system"&&!d));if(n)c.add("theme-"+n)}catch(e){}})()`;
|
|
57
|
+
const js = `(function(){try{var m=localStorage.getItem("${MODE_KEY}");if(m!=="dark"&&m!=="light"&&m!=="system")m="${fallback}";var n=localStorage.getItem("${NAME_KEY}");var d=matchMedia("${DARK_QUERY}").matches;var c=document.documentElement.classList;c.toggle("light",m==="light"||(m==="system"&&!d));if(n)c.add("theme-"+n);var a=localStorage.getItem("${ACCENT_KEY}");if(a)document.documentElement.setAttribute("data-accent",a);var y=localStorage.getItem("${DENSITY_KEY}");if(y)document.documentElement.setAttribute("data-density",y)}catch(e){}})()`;
|
|
56
58
|
return /* @__PURE__ */ jsx("script", { nonce, dangerouslySetInnerHTML: { __html: js } });
|
|
57
59
|
}
|
|
58
60
|
var ThemeContext = React.createContext(null);
|
|
@@ -118,10 +120,44 @@ function ThemeToggle({ label, variant = "ghost", shape, className, ...props }) {
|
|
|
118
120
|
}
|
|
119
121
|
);
|
|
120
122
|
}
|
|
123
|
+
function applyAttribute(name, value) {
|
|
124
|
+
if (value === null) document.documentElement.removeAttribute(name);
|
|
125
|
+
else document.documentElement.setAttribute(name, value);
|
|
126
|
+
}
|
|
127
|
+
function useAppearance(surfaceSets = ["blueprint", "carbone"]) {
|
|
128
|
+
const { mode, setMode, theme, setTheme } = useTheme();
|
|
129
|
+
const accent = React.useSyncExternalStore(subscribe, () => read(ACCENT_KEY), () => null);
|
|
130
|
+
const density = React.useSyncExternalStore(subscribe, () => read(DENSITY_KEY), () => null) ?? "standard";
|
|
131
|
+
const themeId = theme && surfaceSets.includes(theme) && mode === "dark" ? theme : mode;
|
|
132
|
+
const setThemeId = React.useCallback(
|
|
133
|
+
(id) => {
|
|
134
|
+
if (surfaceSets.includes(id)) {
|
|
135
|
+
setMode("dark");
|
|
136
|
+
setTheme(id);
|
|
137
|
+
} else {
|
|
138
|
+
setTheme(null);
|
|
139
|
+
setMode(id);
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
[setMode, setTheme, surfaceSets]
|
|
143
|
+
);
|
|
144
|
+
const setAccent = React.useCallback((next) => {
|
|
145
|
+
applyAttribute("data-accent", next);
|
|
146
|
+
write(ACCENT_KEY, next);
|
|
147
|
+
notify();
|
|
148
|
+
}, []);
|
|
149
|
+
const setDensity = React.useCallback((next) => {
|
|
150
|
+
applyAttribute("data-density", next === "standard" ? null : next);
|
|
151
|
+
write(DENSITY_KEY, next === "standard" ? null : next);
|
|
152
|
+
notify();
|
|
153
|
+
}, []);
|
|
154
|
+
return { themeId, setThemeId, accent, setAccent, density, setDensity };
|
|
155
|
+
}
|
|
121
156
|
export {
|
|
122
157
|
ThemeProvider,
|
|
123
158
|
ThemeScript,
|
|
124
159
|
ThemeToggle,
|
|
160
|
+
useAppearance,
|
|
125
161
|
useTheme
|
|
126
162
|
};
|
|
127
163
|
//# sourceMappingURL=theme.js.map
|
package/dist/theme.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/theme/theme.tsx"],"sourcesContent":["// Client. ONE mechanism for the whole organisation: dark by default, `html.light` for light, `html.theme-<name>` for a\n// named theme, persisted in localStorage (`kz-theme` for the mode, `kz-theme-name` for the named theme).\nimport * as React from \"react\";\n\nimport { type ButtonVariants, buttonVariants } from \"../button/button\";\n\nexport type Mode = \"dark\" | \"light\" | \"system\";\n\nconst MODE_KEY = \"kz-theme\";\nconst NAME_KEY = \"kz-theme-name\";\nconst MODES: readonly Mode[] = [\"dark\", \"light\", \"system\"];\nconst DARK_QUERY = \"(prefers-color-scheme: dark)\";\n\nconst isMode = (value: unknown): value is Mode => MODES.includes(value as Mode);\n\n// Storage blocked (private mode, sandbox): the choice lives in memory for the page.\nconst memory = new Map<string, string>();\n\nfunction read(key: string): string | null {\n try {\n return localStorage.getItem(key);\n } catch {\n return memory.get(key) ?? null;\n }\n}\n\nfunction write(key: string, value: string | null) {\n if (value === null) memory.delete(key);\n else memory.set(key, value);\n try {\n if (value === null) localStorage.removeItem(key);\n else localStorage.setItem(key, value);\n } catch {\n // storage blocked: memory holds it\n }\n}\n\n// The persisted choice is an external store: every provider and tab reads the same value, the server reads none.\nconst listeners = new Set<() => void>();\nconst notify = () => listeners.forEach((listener) => listener());\nfunction subscribe(listener: () => void) {\n listeners.add(listener);\n window.addEventListener(\"storage\", listener);\n return () => {\n listeners.delete(listener);\n window.removeEventListener(\"storage\", listener);\n };\n}\n\nfunction applyMode(mode: Mode) {\n const dark = window.matchMedia(DARK_QUERY).matches;\n document.documentElement.classList.toggle(\"light\", mode === \"light\" || (mode === \"system\" && !dark));\n}\n\nfunction applyName(previous: string | null, next: string | null) {\n const classes = document.documentElement.classList;\n if (previous) classes.remove(`theme-${previous}`);\n if (next) classes.add(`theme-${next}`);\n}\n\nexport type ThemeScriptProps = {\n /** The nonce of a strict Content-Security-Policy (`script-src 'nonce-…'`). */\n nonce?: string;\n /**\n * The mode before the visitor chooses one — pass the same value as `ThemeProvider`'s `defaultMode`. A persisted\n * choice (`kz-theme`) always wins.\n * @default \"system\"\n */\n defaultMode?: Mode;\n};\n\n/**\n * In <head>, before anything renders: applies the persisted mode (else `defaultMode`) and named theme, so the page\n * never flashes. `nonce` for a strict Content-Security-Policy.\n */\nexport function ThemeScript({ nonce, defaultMode = \"system\" }: ThemeScriptProps) {\n const fallback = isMode(defaultMode) ? defaultMode : \"system\";\n const js =\n `(function(){try{var m=localStorage.getItem(\"${MODE_KEY}\");if(m!==\"dark\"&&m!==\"light\"&&m!==\"system\")m=\"${fallback}\";` +\n `var n=localStorage.getItem(\"${NAME_KEY}\");var d=matchMedia(\"${DARK_QUERY}\").matches;var c=document.documentElement.classList;` +\n `c.toggle(\"light\",m===\"light\"||(m===\"system\"&&!d));if(n)c.add(\"theme-\"+n)}catch(e){}})()`;\n return <script nonce={nonce} dangerouslySetInnerHTML={{ __html: js }} />;\n}\n\nexport type ThemeContextValue = {\n /** The chosen mode: dark, light or follow the system. */\n mode: Mode;\n setMode: (mode: Mode) => void;\n /** The named theme (`html.theme-<name>`), or null. */\n theme: string | null;\n setTheme: (theme: string | null) => void;\n};\n\nconst ThemeContext = React.createContext<ThemeContextValue | null>(null);\n\nexport type ThemeProviderProps = {\n children: React.ReactNode;\n /**\n * The mode before the visitor chooses one (nothing persisted as `kz-theme`) — pass the same value to `ThemeScript`.\n * @default \"system\"\n */\n defaultMode?: Mode;\n};\n\nexport function ThemeProvider({ children, defaultMode = \"system\" }: ThemeProviderProps) {\n // Before hydration the server knows nothing persisted (ThemeScript has already applied it to <html>).\n const stored = React.useSyncExternalStore(subscribe, () => read(MODE_KEY), () => null);\n const mode: Mode = isMode(stored) ? stored : defaultMode;\n const theme = React.useSyncExternalStore(subscribe, () => read(NAME_KEY), () => null);\n\n // The same resolution as ThemeScript (a no-op after it), for an app that renders the provider without the script.\n React.useEffect(() => {\n const persisted = read(MODE_KEY);\n applyMode(isMode(persisted) ? persisted : defaultMode);\n }, [defaultMode]);\n\n // \"system\" follows the operating system while the page is open.\n React.useEffect(() => {\n if (mode !== \"system\") return;\n const query = window.matchMedia(DARK_QUERY);\n const onChange = () => applyMode(\"system\");\n query.addEventListener?.(\"change\", onChange);\n return () => query.removeEventListener?.(\"change\", onChange);\n }, [mode]);\n\n const setMode = React.useCallback((next: Mode) => {\n write(MODE_KEY, next);\n applyMode(next);\n notify();\n }, []);\n\n const setTheme = React.useCallback((next: string | null) => {\n applyName(read(NAME_KEY), next);\n write(NAME_KEY, next);\n notify();\n }, []);\n\n const value = React.useMemo(() => ({ mode, setMode, theme, setTheme }), [mode, setMode, theme, setTheme]);\n return <ThemeContext.Provider value={value}>{children}</ThemeContext.Provider>;\n}\n\nexport function useTheme(): ThemeContextValue {\n const context = React.useContext(ThemeContext);\n if (!context) throw new Error(\"useTheme: wrap the app in <ThemeProvider>\");\n return context;\n}\n\nconst ICONS: Record<Mode, React.ReactNode> = {\n dark: <path d=\"M20 14.5A8 8 0 0 1 9.5 4a8 8 0 1 0 10.5 10.5Z\" />,\n light: (\n <>\n <circle cx=\"12\" cy=\"12\" r=\"4\" />\n <path d=\"M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4\" />\n </>\n ),\n system: (\n <>\n <rect x=\"3\" y=\"4\" width=\"18\" height=\"12\" rx=\"2\" />\n <path d=\"M8 20h8M12 16v4\" />\n </>\n ),\n};\n\nexport type ThemeToggleProps = Omit<React.ComponentProps<\"button\">, \"onClick\" | \"children\"> &\n Pick<ButtonVariants, \"variant\" | \"shape\"> & {\n /** Any `Button` variant. */\n variant?: ButtonVariants[\"variant\"];\n /**\n * rounded · pill.\n * @default \"rounded\"\n */\n shape?: ButtonVariants[\"shape\"];\n /** The accessible name — a string, or one per current mode (e.g. `(mode) => t(\"theme.\" + mode)`). */\n label: string | ((mode: Mode) => string);\n };\n\n/**\n * An icon button (styled as `IconButton`, without its Slot) that cycles dark → light → system. Needs a\n * <ThemeProvider> above it. State: `data-mode`.\n */\nexport function ThemeToggle({ label, variant = \"ghost\", shape, className, ...props }: ThemeToggleProps) {\n const { mode, setMode } = useTheme();\n const next = MODES[(MODES.indexOf(mode) + 1) % MODES.length] as Mode;\n const name = typeof label === \"function\" ? label(mode) : label;\n return (\n <button\n type=\"button\"\n aria-label={name}\n title={name}\n data-mode={mode}\n onClick={() => setMode(next)}\n className={buttonVariants({ variant, shape, size: \"icon\", className })}\n {...props}\n >\n <svg viewBox=\"0 0 24 24\" className=\"h-5 w-5\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden>\n {ICONS[mode]}\n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
1
|
+
{"version":3,"sources":["../src/theme/theme.tsx"],"sourcesContent":["// Client. ONE mechanism for the whole organisation: dark by default, `html.light` for light, `html.theme-<name>` for a\n// named theme, persisted in localStorage (`kz-theme` for the mode, `kz-theme-name` for the named theme).\nimport * as React from \"react\";\n\nimport { type ButtonVariants, buttonVariants } from \"../button/button\";\n\nexport type Mode = \"dark\" | \"light\" | \"system\";\n\nconst MODE_KEY = \"kz-theme\";\nconst NAME_KEY = \"kz-theme-name\";\nconst ACCENT_KEY = \"kz-accent\";\nconst DENSITY_KEY = \"kz-density\";\nconst MODES: readonly Mode[] = [\"dark\", \"light\", \"system\"];\nconst DARK_QUERY = \"(prefers-color-scheme: dark)\";\n\nconst isMode = (value: unknown): value is Mode => MODES.includes(value as Mode);\n\n// Storage blocked (private mode, sandbox): the choice lives in memory for the page.\nconst memory = new Map<string, string>();\n\nfunction read(key: string): string | null {\n try {\n return localStorage.getItem(key);\n } catch {\n return memory.get(key) ?? null;\n }\n}\n\nfunction write(key: string, value: string | null) {\n if (value === null) memory.delete(key);\n else memory.set(key, value);\n try {\n if (value === null) localStorage.removeItem(key);\n else localStorage.setItem(key, value);\n } catch {\n // storage blocked: memory holds it\n }\n}\n\n// The persisted choice is an external store: every provider and tab reads the same value, the server reads none.\nconst listeners = new Set<() => void>();\nconst notify = () => listeners.forEach((listener) => listener());\nfunction subscribe(listener: () => void) {\n listeners.add(listener);\n window.addEventListener(\"storage\", listener);\n return () => {\n listeners.delete(listener);\n window.removeEventListener(\"storage\", listener);\n };\n}\n\nfunction applyMode(mode: Mode) {\n const dark = window.matchMedia(DARK_QUERY).matches;\n document.documentElement.classList.toggle(\"light\", mode === \"light\" || (mode === \"system\" && !dark));\n}\n\nfunction applyName(previous: string | null, next: string | null) {\n const classes = document.documentElement.classList;\n if (previous) classes.remove(`theme-${previous}`);\n if (next) classes.add(`theme-${next}`);\n}\n\nexport type ThemeScriptProps = {\n /** The nonce of a strict Content-Security-Policy (`script-src 'nonce-…'`). */\n nonce?: string;\n /**\n * The mode before the visitor chooses one — pass the same value as `ThemeProvider`'s `defaultMode`. A persisted\n * choice (`kz-theme`) always wins.\n * @default \"system\"\n */\n defaultMode?: Mode;\n};\n\n/**\n * In <head>, before anything renders: applies the persisted mode (else `defaultMode`) and named theme, so the page\n * never flashes. `nonce` for a strict Content-Security-Policy.\n */\nexport function ThemeScript({ nonce, defaultMode = \"system\" }: ThemeScriptProps) {\n const fallback = isMode(defaultMode) ? defaultMode : \"system\";\n const js =\n `(function(){try{var m=localStorage.getItem(\"${MODE_KEY}\");if(m!==\"dark\"&&m!==\"light\"&&m!==\"system\")m=\"${fallback}\";` +\n `var n=localStorage.getItem(\"${NAME_KEY}\");var d=matchMedia(\"${DARK_QUERY}\").matches;var c=document.documentElement.classList;` +\n `c.toggle(\"light\",m===\"light\"||(m===\"system\"&&!d));if(n)c.add(\"theme-\"+n);var a=localStorage.getItem(\"${ACCENT_KEY}\");if(a)document.documentElement.setAttribute(\"data-accent\",a);var y=localStorage.getItem(\"${DENSITY_KEY}\");if(y)document.documentElement.setAttribute(\"data-density\",y)}catch(e){}})()`;\n return <script nonce={nonce} dangerouslySetInnerHTML={{ __html: js }} />;\n}\n\nexport type ThemeContextValue = {\n /** The chosen mode: dark, light or follow the system. */\n mode: Mode;\n setMode: (mode: Mode) => void;\n /** The named theme (`html.theme-<name>`), or null. */\n theme: string | null;\n setTheme: (theme: string | null) => void;\n};\n\nconst ThemeContext = React.createContext<ThemeContextValue | null>(null);\n\nexport type ThemeProviderProps = {\n children: React.ReactNode;\n /**\n * The mode before the visitor chooses one (nothing persisted as `kz-theme`) — pass the same value to `ThemeScript`.\n * @default \"system\"\n */\n defaultMode?: Mode;\n};\n\nexport function ThemeProvider({ children, defaultMode = \"system\" }: ThemeProviderProps) {\n // Before hydration the server knows nothing persisted (ThemeScript has already applied it to <html>).\n const stored = React.useSyncExternalStore(subscribe, () => read(MODE_KEY), () => null);\n const mode: Mode = isMode(stored) ? stored : defaultMode;\n const theme = React.useSyncExternalStore(subscribe, () => read(NAME_KEY), () => null);\n\n // The same resolution as ThemeScript (a no-op after it), for an app that renders the provider without the script.\n React.useEffect(() => {\n const persisted = read(MODE_KEY);\n applyMode(isMode(persisted) ? persisted : defaultMode);\n }, [defaultMode]);\n\n // \"system\" follows the operating system while the page is open.\n React.useEffect(() => {\n if (mode !== \"system\") return;\n const query = window.matchMedia(DARK_QUERY);\n const onChange = () => applyMode(\"system\");\n query.addEventListener?.(\"change\", onChange);\n return () => query.removeEventListener?.(\"change\", onChange);\n }, [mode]);\n\n const setMode = React.useCallback((next: Mode) => {\n write(MODE_KEY, next);\n applyMode(next);\n notify();\n }, []);\n\n const setTheme = React.useCallback((next: string | null) => {\n applyName(read(NAME_KEY), next);\n write(NAME_KEY, next);\n notify();\n }, []);\n\n const value = React.useMemo(() => ({ mode, setMode, theme, setTheme }), [mode, setMode, theme, setTheme]);\n return <ThemeContext.Provider value={value}>{children}</ThemeContext.Provider>;\n}\n\nexport function useTheme(): ThemeContextValue {\n const context = React.useContext(ThemeContext);\n if (!context) throw new Error(\"useTheme: wrap the app in <ThemeProvider>\");\n return context;\n}\n\nconst ICONS: Record<Mode, React.ReactNode> = {\n dark: <path d=\"M20 14.5A8 8 0 0 1 9.5 4a8 8 0 1 0 10.5 10.5Z\" />,\n light: (\n <>\n <circle cx=\"12\" cy=\"12\" r=\"4\" />\n <path d=\"M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4\" />\n </>\n ),\n system: (\n <>\n <rect x=\"3\" y=\"4\" width=\"18\" height=\"12\" rx=\"2\" />\n <path d=\"M8 20h8M12 16v4\" />\n </>\n ),\n};\n\nexport type ThemeToggleProps = Omit<React.ComponentProps<\"button\">, \"onClick\" | \"children\"> &\n Pick<ButtonVariants, \"variant\" | \"shape\"> & {\n /** Any `Button` variant. */\n variant?: ButtonVariants[\"variant\"];\n /**\n * rounded · pill.\n * @default \"rounded\"\n */\n shape?: ButtonVariants[\"shape\"];\n /** The accessible name — a string, or one per current mode (e.g. `(mode) => t(\"theme.\" + mode)`). */\n label: string | ((mode: Mode) => string);\n };\n\n/**\n * An icon button (styled as `IconButton`, without its Slot) that cycles dark → light → system. Needs a\n * <ThemeProvider> above it. State: `data-mode`.\n */\nexport function ThemeToggle({ label, variant = \"ghost\", shape, className, ...props }: ThemeToggleProps) {\n const { mode, setMode } = useTheme();\n const next = MODES[(MODES.indexOf(mode) + 1) % MODES.length] as Mode;\n const name = typeof label === \"function\" ? label(mode) : label;\n return (\n <button\n type=\"button\"\n aria-label={name}\n title={name}\n data-mode={mode}\n onClick={() => setMode(next)}\n className={buttonVariants({ variant, shape, size: \"icon\", className })}\n {...props}\n >\n <svg viewBox=\"0 0 24 24\" className=\"h-5 w-5\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden>\n {ICONS[mode]}\n </svg>\n </button>\n );\n}\n\n/** The choices of the Appearance block (ADR-006 §4): the theme (`system · light · dark`, then a surface set), the accent, the density. */\nexport type AppearanceState = {\n /** `system`, `light`, `dark`, or the surface set (`blueprint`, `carbone`) — which is dark. */\n themeId: string;\n setThemeId: (id: string) => void;\n /** A brand's accent (`data-accent` on `<html>`), or null: the product's own. */\n accent: string | null;\n setAccent: (accent: string | null) => void;\n /** `standard` or `compact` (`data-density` on `<html>`, the token layer: rows and gaps one step down). */\n density: string;\n setDensity: (density: string) => void;\n};\n\nfunction applyAttribute(name: string, value: string | null) {\n if (value === null) document.documentElement.removeAttribute(name);\n else document.documentElement.setAttribute(name, value);\n}\n\n/**\n * The state of the Appearance block, applied at once and kept in the browser (`kz-theme`, `kz-theme-name`, `kz-accent`,\n * `kz-density`; `ThemeScript` restores them before paint). A product with an account also saves what `onChange` of the block\n * reports, so the choice follows the person. Needs a `ThemeProvider`.\n * @param surfaceSets the themes that are a dark surface set (default `blueprint`, `carbone`)\n */\nexport function useAppearance(surfaceSets: readonly string[] = [\"blueprint\", \"carbone\"]): AppearanceState {\n const { mode, setMode, theme, setTheme } = useTheme();\n const accent = React.useSyncExternalStore(subscribe, () => read(ACCENT_KEY), () => null);\n const density = React.useSyncExternalStore(subscribe, () => read(DENSITY_KEY), () => null) ?? \"standard\";\n const themeId = theme && surfaceSets.includes(theme) && mode === \"dark\" ? theme : mode;\n const setThemeId = React.useCallback(\n (id: string) => {\n if (surfaceSets.includes(id)) {\n setMode(\"dark\");\n setTheme(id);\n } else {\n setTheme(null);\n setMode(id as Mode);\n }\n },\n [setMode, setTheme, surfaceSets],\n );\n const setAccent = React.useCallback((next: string | null) => {\n applyAttribute(\"data-accent\", next);\n write(ACCENT_KEY, next);\n notify();\n }, []);\n const setDensity = React.useCallback((next: string) => {\n applyAttribute(\"data-density\", next === \"standard\" ? null : next);\n write(DENSITY_KEY, next === \"standard\" ? null : next);\n notify();\n }, []);\n return { themeId, setThemeId, accent, setAccent, density, setDensity };\n}\n"],"mappings":";;;;;;;;;AAEA,YAAY,WAAW;AAiFd,SAqEL,UArEK,KAqEL,YArEK;AA3ET,IAAM,WAAW;AACjB,IAAM,WAAW;AACjB,IAAM,aAAa;AACnB,IAAM,cAAc;AACpB,IAAM,QAAyB,CAAC,QAAQ,SAAS,QAAQ;AACzD,IAAM,aAAa;AAEnB,IAAM,SAAS,CAAC,UAAkC,MAAM,SAAS,KAAa;AAG9E,IAAM,SAAS,oBAAI,IAAoB;AAEvC,SAAS,KAAK,KAA4B;AACxC,MAAI;AACF,WAAO,aAAa,QAAQ,GAAG;AAAA,EACjC,QAAQ;AACN,WAAO,OAAO,IAAI,GAAG,KAAK;AAAA,EAC5B;AACF;AAEA,SAAS,MAAM,KAAa,OAAsB;AAChD,MAAI,UAAU,KAAM,QAAO,OAAO,GAAG;AAAA,MAChC,QAAO,IAAI,KAAK,KAAK;AAC1B,MAAI;AACF,QAAI,UAAU,KAAM,cAAa,WAAW,GAAG;AAA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AAE;AAAA,MACb,OAAO;AACL,iBAAS,IAAI;AACb,gBAAQ,EAAU;AAAA,MACpB;AAAA,IACF;AAAA,IACA,CAAC,SAAS,UAAU,WAAW;AAAA,EACjC;AACA,QAAM,YAAkB,kBAAY,CAAC,SAAwB;AAC3D,mBAAe,eAAe,IAAI;AAClC,UAAM,YAAY,IAAI;AACtB,WAAO;AAAA,EACT,GAAG,CAAC,CAAC;AACL,QAAM,aAAmB,kBAAY,CAAC,SAAiB;AACrD,mBAAe,gBAAgB,SAAS,aAAa,OAAO,IAAI;AAChE,UAAM,aAAa,SAAS,aAAa,OAAO,IAAI;AACpD,WAAO;AAAA,EACT,GAAG,CAAC,CAAC;AACL,SAAO,EAAE,SAAS,YAAY,QAAQ,WAAW,SAAS,WAAW;AACvE;","names":[]}
|
package/dist/toast.d.ts
CHANGED
|
@@ -64,4 +64,5 @@ interface GroupedToastOptions extends Omit<ExternalToast, "id"> {
|
|
|
64
64
|
*/
|
|
65
65
|
declare function groupedToast(key: string, message: React.ReactNode, { countLabel, onAutoClose, onDismiss, ...options }?: GroupedToastOptions): string | number;
|
|
66
66
|
|
|
67
|
-
export {
|
|
67
|
+
export { Toaster, groupedToast, progressToast, toastClassNames, undoToast };
|
|
68
|
+
export type { GroupedToastOptions, ProgressToastOptions, ToasterProps, UndoToastOptions };
|
package/dist/toc.d.ts
CHANGED
|
@@ -20,4 +20,5 @@ type TocLayoutProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
|
20
20
|
/** A reading page: the table of contents in a sticky column on the left, the sections beside it (one column on a phone). */
|
|
21
21
|
declare function TocLayout({ toc, children, className, ...props }: TocLayoutProps): React.JSX.Element;
|
|
22
22
|
|
|
23
|
-
export { Toc, TocLayout
|
|
23
|
+
export { Toc, TocLayout };
|
|
24
|
+
export type { TocLayoutProps, TocProps };
|
package/dist/tooltip.d.ts
CHANGED
|
@@ -21,4 +21,5 @@ type TooltipProps = Omit<React.ComponentProps<typeof Tooltip$1.Content>, "conten
|
|
|
21
21
|
};
|
|
22
22
|
declare function Tooltip({ content, children, open, defaultOpen, onOpenChange, delayDuration, container, sideOffset, collisionPadding, className, ...props }: TooltipProps): React.JSX.Element;
|
|
23
23
|
|
|
24
|
-
export { Tooltip,
|
|
24
|
+
export { Tooltip, TooltipProvider };
|
|
25
|
+
export type { TooltipProps };
|
package/dist/tree-view.d.ts
CHANGED
|
@@ -110,4 +110,5 @@ type TreeViewProps = {
|
|
|
110
110
|
*/
|
|
111
111
|
declare function TreeView({ nodes, "aria-label": label, expanded: expandedProp, defaultExpanded, onExpandedChange, selected: selectedProp, defaultSelected, onSelect, onLoadChildren, loadingLabel, className, }: TreeViewProps): React.JSX.Element;
|
|
112
112
|
|
|
113
|
-
export {
|
|
113
|
+
export { TreeView, treeView };
|
|
114
|
+
export type { TreeNode, TreeViewProps };
|
package/dist/tree-view.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import {
|
|
3
|
+
warnDeprecated
|
|
4
|
+
} from "./chunk-BDIU5LZB.js";
|
|
2
5
|
import {
|
|
3
6
|
useControllable
|
|
4
7
|
} from "./chunk-FZBWEDQI.js";
|
|
@@ -42,6 +45,7 @@ function TreeView({
|
|
|
42
45
|
loadingLabel = "Loading",
|
|
43
46
|
className
|
|
44
47
|
}) {
|
|
48
|
+
warnDeprecated("tree-view", "3.6.0");
|
|
45
49
|
const s = treeView();
|
|
46
50
|
const uid = React.useId();
|
|
47
51
|
const [expanded, setExpanded] = useControllable(expandedProp, defaultExpanded, onExpandedChange);
|
package/dist/tree-view.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/tree-view/tree-view.tsx"],"sourcesContent":["// Client (expansion, selection, the roving focus). A hierarchy the keyboard walks — the ARIA tree pattern: one tab\n// stop, the arrows move and open, Home/End, typing a letter jumps; children loaded on demand when a branch opens.\nimport * as React from \"react\";\nimport { tv } from \"tailwind-variants\";\n\nimport { ChevronGlyph } from \"../glyphs\";\nimport { useControllable } from \"../media\";\n\nexport const treeView = tv({\n slots: {\n root: \"m-0 list-none p-0 text-sm\",\n group: \"m-0 list-none p-0\",\n row:\n \"flex min-h-8 cursor-pointer select-none items-center gap-1.5 rounded-md pr-2 text-fg outline-hidden \" +\n \"hover:bg-surface-2 data-[selected]:bg-accent-soft data-[selected]:font-semibold data-[disabled]:cursor-default data-[disabled]:opacity-50\",\n toggle: \"flex h-5 w-5 shrink-0 items-center justify-center text-fg-secondary [&>svg]:h-3.5 [&>svg]:w-3.5 [&>svg]:transition-transform motion-reduce:[&>svg]:transition-none\",\n icon: \"flex shrink-0 items-center text-fg-secondary [&>svg]:h-4 [&>svg]:w-4\",\n label: \"min-w-0 flex-1 truncate\",\n meta: \"shrink-0 text-xs tabular-nums text-fg-secondary\",\n },\n});\n\nexport type TreeNode = {\n /** A stable id. */\n id: string;\n /** Its name — passed translated. */\n label: string;\n /** A decorative icon before the name. */\n icon?: React.ReactNode;\n /** A detail after the name (a count, a size). */\n meta?: React.ReactNode;\n /** Its children; `undefined` for a leaf. With `hasChildren`, they load when it opens (`onLoadChildren`). */\n children?: readonly TreeNode[];\n /** A branch whose children are not loaded yet. */\n hasChildren?: boolean;\n /** Cannot be selected. */\n disabled?: boolean;\n};\n\nexport type TreeViewProps = {\n /** The roots. */\n nodes: readonly TreeNode[];\n /** The tree's accessible name (“Documentation”). */\n \"aria-label\": string;\n /** The ids of the open branches (controlled). */\n expanded?: readonly string[];\n /** The ids open at first, uncontrolled. */\n defaultExpanded?: readonly string[];\n /** Called with the open branches. */\n onExpandedChange?: (expanded: string[]) => void;\n /** The selected node (controlled). */\n selected?: string | null;\n /** The selected node at first, uncontrolled. */\n defaultSelected?: string | null;\n /** Called when a node is chosen (click, Enter or Space): navigate, open the file. */\n onSelect?: (node: TreeNode) => void;\n /** Called when a branch with `hasChildren` and no `children` opens: fetch them, then pass them in `nodes`. */\n onLoadChildren?: (node: TreeNode) => void;\n /** The words of a branch that is loading (“Loading”). */\n loadingLabel?: string;\n /** Classes merged on the tree. */\n className?: string;\n};\n\ntype Flat = { node: TreeNode; level: number; parent: string | null; posinset: number; setsize: number };\n\nconst isBranch = (node: TreeNode) => Boolean(node.children?.length || node.hasChildren);\n\nfunction flatten(nodes: readonly TreeNode[], open: Set<string>, level = 1, parent: string | null = null, out: Flat[] = []): Flat[] {\n nodes.forEach((node, i) => {\n out.push({ node, level, parent, posinset: i + 1, setsize: nodes.length });\n if (open.has(node.id) && node.children) flatten(node.children, open, level + 1, node.id, out);\n });\n return out;\n}\n\n/**\n * A hierarchy to browse — documentation sections, a studio's datasets, folders: one tab stop, the arrows walk it (→\n * opens, ← closes or goes up), Home/End, a letter jumps to the next name; branches can load their children on demand.\n *\n * @deprecated Since 3.6.0, removed in 4.0.0: no product uses it. Drill down with `List` instead.\n */\nexport function TreeView({\n nodes,\n \"aria-label\": label,\n expanded: expandedProp,\n defaultExpanded = [],\n onExpandedChange,\n selected: selectedProp,\n defaultSelected = null,\n onSelect,\n onLoadChildren,\n loadingLabel = \"Loading\",\n className,\n}: TreeViewProps) {\n const s = treeView();\n const uid = React.useId();\n const [expanded, setExpanded] = useControllable<readonly string[]>(expandedProp, defaultExpanded, onExpandedChange as (next: readonly string[]) => void);\n const [selected, setSelected] = useControllable<string | null>(selectedProp, defaultSelected);\n const open = new Set(expanded);\n const rows = flatten(nodes, open);\n const [active, setActive] = React.useState<string | null>(null);\n const focusId = active && rows.some((r) => r.node.id === active) ? active : (selected ?? rows[0]?.node.id ?? null);\n const refs = React.useRef(new Map<string, HTMLDivElement>());\n const move = (id: string | undefined) => {\n if (!id) return;\n setActive(id);\n refs.current.get(id)?.focus();\n };\n const toggle = (node: TreeNode, to = !open.has(node.id)) => {\n if (!isBranch(node)) return;\n if (to && node.hasChildren && !node.children) onLoadChildren?.(node);\n setExpanded(to ? [...expanded, node.id] : expanded.filter((id) => id !== node.id));\n };\n const choose = (node: TreeNode) => {\n if (node.disabled) return;\n setSelected(node.id);\n onSelect?.(node);\n };\n const onKeyDown = (event: React.KeyboardEvent, i: number) => {\n const row = rows[i]!;\n const { node } = row;\n const keys: Record<string, () => void> = {\n ArrowDown: () => move(rows[i + 1]?.node.id),\n ArrowUp: () => move(rows[i - 1]?.node.id),\n Home: () => move(rows[0]?.node.id),\n End: () => move(rows[rows.length - 1]?.node.id),\n ArrowRight: () => (isBranch(node) && !open.has(node.id) ? toggle(node, true) : isBranch(node) ? move(rows[i + 1]?.node.id) : undefined),\n ArrowLeft: () => (open.has(node.id) ? toggle(node, false) : move(row.parent ?? undefined)),\n Enter: () => choose(node),\n \" \": () => choose(node),\n };\n const run = keys[event.key];\n if (run) {\n event.preventDefault();\n run();\n return;\n }\n if (event.key.length === 1 && /\\S/.test(event.key)) {\n const letter = event.key.toLowerCase();\n const next = [...rows.slice(i + 1), ...rows.slice(0, i)].find((r) => r.node.label.toLowerCase().startsWith(letter));\n move(next?.node.id);\n }\n };\n\n const render = (list: readonly TreeNode[], level: number): React.ReactNode =>\n list.map((node) => {\n const i = rows.findIndex((r) => r.node.id === node.id);\n const row = rows[i]!;\n const branch = isBranch(node);\n const isOpen = open.has(node.id);\n const loading = isOpen && node.hasChildren && !node.children;\n return (\n // The row is the treeitem (its name is its own words, never its children's); the group of children hangs\n // from it with aria-owns, in the `li` that holds both.\n <li key={node.id} role=\"none\">\n <div\n ref={(el) => {\n if (el) refs.current.set(node.id, el);\n else refs.current.delete(node.id);\n }}\n role=\"treeitem\"\n aria-level={level}\n aria-posinset={row.posinset}\n aria-setsize={row.setsize}\n aria-expanded={branch ? isOpen : undefined}\n aria-selected={selected === node.id}\n aria-disabled={node.disabled || undefined}\n aria-busy={loading || undefined}\n aria-owns={branch && isOpen ? `${uid}-${node.id}-group` : undefined}\n tabIndex={node.id === focusId ? 0 : -1}\n onKeyDown={(e) => {\n if (e.target === e.currentTarget) onKeyDown(e, i);\n }}\n onFocus={(e) => {\n if (e.target === e.currentTarget) setActive(node.id);\n }}\n className={s.row({ className: \"outline-hidden focus-visible:ring-2 focus-visible:ring-ring\" })}\n data-selected={selected === node.id || undefined}\n data-disabled={node.disabled || undefined}\n style={{ paddingLeft: `${(level - 1) * 1.25 + 0.25}rem` }}\n onClick={() => {\n if (branch) toggle(node);\n choose(node);\n move(node.id);\n }}\n >\n <span className={s.toggle()} aria-hidden>\n {branch ? <ChevronGlyph direction={isOpen ? \"down\" : \"right\"} /> : null}\n </span>\n {node.icon ? <span className={s.icon()} aria-hidden>{node.icon}</span> : null}\n <span className={s.label()}>{node.label}</span>\n {node.meta ? <span className={s.meta()}>{node.meta}</span> : null}\n </div>\n {branch && isOpen ? (\n <ul role=\"group\" id={`${uid}-${node.id}-group`} className={s.group()}>\n {loading ? (\n <li role=\"none\" className=\"py-1 text-xs text-fg-secondary\" style={{ paddingLeft: `${level * 1.25 + 1.75}rem` }}>\n {loadingLabel}\n </li>\n ) : (\n render(node.children ?? [], level + 1)\n )}\n </ul>\n ) : null}\n </li>\n );\n });\n\n return (\n <ul role=\"tree\" aria-label={label} className={s.root({ className })}>\n {render(nodes, 1)}\n </ul>\n );\n}\n"],"mappings":";;;;;;;;;AAEA,YAAY,WAAW;AACvB,SAAS,UAAU;AAyJT,SAgCc,KAhCd;AApJH,IAAM,WAAW,GAAG;AAAA,EACzB,OAAO;AAAA,IACL,MAAM;AAAA,IACN,OAAO;AAAA,IACP,KACE;AAAA,IAEF,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,OAAO;AAAA,IACP,MAAM;AAAA,EACR;AACF,CAAC;AA8CD,IAAM,WAAW,CAAC,SAAmB,QAAQ,KAAK,UAAU,UAAU,KAAK,WAAW;AAEtF,SAAS,QAAQ,OAA4B,MAAmB,QAAQ,GAAG,SAAwB,MAAM,MAAc,CAAC,GAAW;AACjI,QAAM,QAAQ,CAAC,MAAM,MAAM;AACzB,QAAI,KAAK,EAAE,MAAM,OAAO,QAAQ,UAAU,IAAI,GAAG,SAAS,MAAM,OAAO,CAAC;AACxE,QAAI,KAAK,IAAI,KAA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S,MAAM;AACb,kBAAI,OAAQ,QAAO,IAAI;AACvB,qBAAO,IAAI;AACX,mBAAK,KAAK,EAAE;AAAA,YACd;AAAA,YAEA;AAAA,kCAAC,UAAK,WAAW,EAAE,OAAO,GAAG,eAAW,MACrC,mBAAS,oBAAC,gBAAa,WAAW,SAAS,SAAS,SAAS,IAAK,MACrE;AAAA,cACC,KAAK,OAAO,oBAAC,UAAK,WAAW,EAAE,KAAK,GAAG,eAAW,MAAE,eAAK,MAAK,IAAU;AAAA,cACzE,oBAAC,UAAK,WAAW,EAAE,MAAM,GAAI,eAAK,OAAM;AAAA,cACvC,KAAK,OAAO,oBAAC,UAAK,WAAW,EAAE,KAAK,GAAI,eAAK,MAAK,IAAU;AAAA;AAAA;AAAA,QAC/D;AAAA,QACC,UAAU,SACT,oBAAC,QAAG,MAAK,SAAQ,IAAI,GAAG,GAAG,IAAI,KAAK,EAAE,UAAU,WAAW,EAAE,MAAM,GAChE,oBACC,oBAAC,QAAG,MAAK,QAAO,WAAU,kCAAiC,OAAO,EAAE,aAAa,GAAG,QAAQ,OAAO,IAAI,MAAM,GAC1G,wBACH,IAEA,OAAO,KAAK,YAAY,CAAC,GAAG,QAAQ,CAAC,GAEzC,IACE;AAAA,WAjDG,KAAK,EAkDd;AAAA;AAAA,EAEJ,CAAC;AAEH,SACE,oBAAC,QAAG,MAAK,QAAO,cAAY,OAAO,WAAW,EAAE,KAAK,EAAE,UAAU,CAAC,GAC/D,iBAAO,OAAO,CAAC,GAClB;AAEJ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/tree-view/tree-view.tsx"],"sourcesContent":["// Client (expansion, selection, the roving focus). A hierarchy the keyboard walks — the ARIA tree pattern: one tab\n// stop, the arrows move and open, Home/End, typing a letter jumps; children loaded on demand when a branch opens.\nimport * as React from \"react\";\nimport { tv } from \"tailwind-variants\";\n\nimport { warnDeprecated } from \"../deprecated\";\nimport { ChevronGlyph } from \"../glyphs\";\nimport { useControllable } from \"../media\";\n\nexport const treeView = tv({\n slots: {\n root: \"m-0 list-none p-0 text-sm\",\n group: \"m-0 list-none p-0\",\n row:\n \"flex min-h-8 cursor-pointer select-none items-center gap-1.5 rounded-md pr-2 text-fg outline-hidden \" +\n \"hover:bg-surface-2 data-[selected]:bg-accent-soft data-[selected]:font-semibold data-[disabled]:cursor-default data-[disabled]:opacity-50\",\n toggle: \"flex h-5 w-5 shrink-0 items-center justify-center text-fg-secondary [&>svg]:h-3.5 [&>svg]:w-3.5 [&>svg]:transition-transform motion-reduce:[&>svg]:transition-none\",\n icon: \"flex shrink-0 items-center text-fg-secondary [&>svg]:h-4 [&>svg]:w-4\",\n label: \"min-w-0 flex-1 truncate\",\n meta: \"shrink-0 text-xs tabular-nums text-fg-secondary\",\n },\n});\n\nexport type TreeNode = {\n /** A stable id. */\n id: string;\n /** Its name — passed translated. */\n label: string;\n /** A decorative icon before the name. */\n icon?: React.ReactNode;\n /** A detail after the name (a count, a size). */\n meta?: React.ReactNode;\n /** Its children; `undefined` for a leaf. With `hasChildren`, they load when it opens (`onLoadChildren`). */\n children?: readonly TreeNode[];\n /** A branch whose children are not loaded yet. */\n hasChildren?: boolean;\n /** Cannot be selected. */\n disabled?: boolean;\n};\n\nexport type TreeViewProps = {\n /** The roots. */\n nodes: readonly TreeNode[];\n /** The tree's accessible name (“Documentation”). */\n \"aria-label\": string;\n /** The ids of the open branches (controlled). */\n expanded?: readonly string[];\n /** The ids open at first, uncontrolled. */\n defaultExpanded?: readonly string[];\n /** Called with the open branches. */\n onExpandedChange?: (expanded: string[]) => void;\n /** The selected node (controlled). */\n selected?: string | null;\n /** The selected node at first, uncontrolled. */\n defaultSelected?: string | null;\n /** Called when a node is chosen (click, Enter or Space): navigate, open the file. */\n onSelect?: (node: TreeNode) => void;\n /** Called when a branch with `hasChildren` and no `children` opens: fetch them, then pass them in `nodes`. */\n onLoadChildren?: (node: TreeNode) => void;\n /** The words of a branch that is loading (“Loading”). */\n loadingLabel?: string;\n /** Classes merged on the tree. */\n className?: string;\n};\n\ntype Flat = { node: TreeNode; level: number; parent: string | null; posinset: number; setsize: number };\n\nconst isBranch = (node: TreeNode) => Boolean(node.children?.length || node.hasChildren);\n\nfunction flatten(nodes: readonly TreeNode[], open: Set<string>, level = 1, parent: string | null = null, out: Flat[] = []): Flat[] {\n nodes.forEach((node, i) => {\n out.push({ node, level, parent, posinset: i + 1, setsize: nodes.length });\n if (open.has(node.id) && node.children) flatten(node.children, open, level + 1, node.id, out);\n });\n return out;\n}\n\n/**\n * A hierarchy to browse — documentation sections, a studio's datasets, folders: one tab stop, the arrows walk it (→\n * opens, ← closes or goes up), Home/End, a letter jumps to the next name; branches can load their children on demand.\n *\n * @deprecated Since 3.6.0, removed in 4.0.0: no product uses it. Drill down with `List` instead.\n */\nexport function TreeView({\n nodes,\n \"aria-label\": label,\n expanded: expandedProp,\n defaultExpanded = [],\n onExpandedChange,\n selected: selectedProp,\n defaultSelected = null,\n onSelect,\n onLoadChildren,\n loadingLabel = \"Loading\",\n className,\n}: TreeViewProps) {\n warnDeprecated(\"tree-view\", \"3.6.0\");\n const s = treeView();\n const uid = React.useId();\n const [expanded, setExpanded] = useControllable<readonly string[]>(expandedProp, defaultExpanded, onExpandedChange as (next: readonly string[]) => void);\n const [selected, setSelected] = useControllable<string | null>(selectedProp, defaultSelected);\n const open = new Set(expanded);\n const rows = flatten(nodes, open);\n const [active, setActive] = React.useState<string | null>(null);\n const focusId = active && rows.some((r) => r.node.id === active) ? active : (selected ?? rows[0]?.node.id ?? null);\n const refs = React.useRef(new Map<string, HTMLDivElement>());\n const move = (id: string | undefined) => {\n if (!id) return;\n setActive(id);\n refs.current.get(id)?.focus();\n };\n const toggle = (node: TreeNode, to = !open.has(node.id)) => {\n if (!isBranch(node)) return;\n if (to && node.hasChildren && !node.children) onLoadChildren?.(node);\n setExpanded(to ? [...expanded, node.id] : expanded.filter((id) => id !== node.id));\n };\n const choose = (node: TreeNode) => {\n if (node.disabled) return;\n setSelected(node.id);\n onSelect?.(node);\n };\n const onKeyDown = (event: React.KeyboardEvent, i: number) => {\n const row = rows[i]!;\n const { node } = row;\n const keys: Record<string, () => void> = {\n ArrowDown: () => move(rows[i + 1]?.node.id),\n ArrowUp: () => move(rows[i - 1]?.node.id),\n Home: () => move(rows[0]?.node.id),\n End: () => move(rows[rows.length - 1]?.node.id),\n ArrowRight: () => (isBranch(node) && !open.has(node.id) ? toggle(node, true) : isBranch(node) ? move(rows[i + 1]?.node.id) : undefined),\n ArrowLeft: () => (open.has(node.id) ? toggle(node, false) : move(row.parent ?? undefined)),\n Enter: () => choose(node),\n \" \": () => choose(node),\n };\n const run = keys[event.key];\n if (run) {\n event.preventDefault();\n run();\n return;\n }\n if (event.key.length === 1 && /\\S/.test(event.key)) {\n const letter = event.key.toLowerCase();\n const next = [...rows.slice(i + 1), ...rows.slice(0, i)].find((r) => r.node.label.toLowerCase().startsWith(letter));\n move(next?.node.id);\n }\n };\n\n const render = (list: readonly TreeNode[], level: number): React.ReactNode =>\n list.map((node) => {\n const i = rows.findIndex((r) => r.node.id === node.id);\n const row = rows[i]!;\n const branch = isBranch(node);\n const isOpen = open.has(node.id);\n const loading = isOpen && node.hasChildren && !node.children;\n return (\n // The row is the treeitem (its name is its own words, never its children's); the group of children hangs\n // from it with aria-owns, in the `li` that holds both.\n <li key={node.id} role=\"none\">\n <div\n ref={(el) => {\n if (el) refs.current.set(node.id, el);\n else refs.current.delete(node.id);\n }}\n role=\"treeitem\"\n aria-level={level}\n aria-posinset={row.posinset}\n aria-setsize={row.setsize}\n aria-expanded={branch ? isOpen : undefined}\n aria-selected={selected === node.id}\n aria-disabled={node.disabled || undefined}\n aria-busy={loading || undefined}\n aria-owns={branch && isOpen ? `${uid}-${node.id}-group` : undefined}\n tabIndex={node.id === focusId ? 0 : -1}\n onKeyDown={(e) => {\n if (e.target === e.currentTarget) onKeyDown(e, i);\n }}\n onFocus={(e) => {\n if (e.target === e.currentTarget) setActive(node.id);\n }}\n className={s.row({ className: \"outline-hidden focus-visible:ring-2 focus-visible:ring-ring\" })}\n data-selected={selected === node.id || undefined}\n data-disabled={node.disabled || undefined}\n style={{ paddingLeft: `${(level - 1) * 1.25 + 0.25}rem` }}\n onClick={() => {\n if (branch) toggle(node);\n choose(node);\n move(node.id);\n }}\n >\n <span className={s.toggle()} aria-hidden>\n {branch ? <ChevronGlyph direction={isOpen ? \"down\" : \"right\"} /> : null}\n </span>\n {node.icon ? <span className={s.icon()} aria-hidden>{node.icon}</span> : null}\n <span className={s.label()}>{node.label}</span>\n {node.meta ? <span className={s.meta()}>{node.meta}</span> : null}\n </div>\n {branch && isOpen ? (\n <ul role=\"group\" id={`${uid}-${node.id}-group`} className={s.group()}>\n {loading ? (\n <li role=\"none\" className=\"py-1 text-xs text-fg-secondary\" style={{ paddingLeft: `${level * 1.25 + 1.75}rem` }}>\n {loadingLabel}\n </li>\n ) : (\n render(node.children ?? [], level + 1)\n )}\n </ul>\n ) : null}\n </li>\n );\n });\n\n return (\n <ul role=\"tree\" aria-label={label} className={s.root({ className })}>\n {render(nodes, 1)}\n </ul>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAEA,YAAY,WAAW;AACvB,SAAS,UAAU;AA2JT,SAgCc,KAhCd;AArJH,IAAM,WAAW,GAAG;AAAA,EACzB,OAAO;AAAA,IACL,MAAM;AAAA,IACN,OAAO;AAAA,IACP,KACE;AAAA,IAEF,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,OAAO;AAAA,IACP,MAAM;AAAA,EACR;AACF,CAAC;AA8CD,IAAM,WAAW,CAAC,SAAmB,QAAQ,KAAK,UAAU,UAAU,KAAK,WAAW;AAEtF,SAAS,QAAQ,OAA4B,MAAmB,QAAQ,GAAG,SAAwB,MAAM,MAAc,CAAC,GAAW;AACjI,QAAM,QAAQ,CAAC,MAAM,MAAM;AACzB,QAAI,KAAK,EAAE,MAAM,OAAO,QAAQ,UAAU,IAAI,GAAG,SAAS,MAAM,OAAO,CAAC;AACxE,QAAI,KAAK,IAAI,KA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AAI,MAAM;AAAA,YACxD,SAAS,MAAM;AACb,kBAAI,OAAQ,QAAO,IAAI;AACvB,qBAAO,IAAI;AACX,mBAAK,KAAK,EAAE;AAAA,YACd;AAAA,YAEA;AAAA,kCAAC,UAAK,WAAW,EAAE,OAAO,GAAG,eAAW,MACrC,mBAAS,oBAAC,gBAAa,WAAW,SAAS,SAAS,SAAS,IAAK,MACrE;AAAA,cACC,KAAK,OAAO,oBAAC,UAAK,WAAW,EAAE,KAAK,GAAG,eAAW,MAAE,eAAK,MAAK,IAAU;AAAA,cACzE,oBAAC,UAAK,WAAW,EAAE,MAAM,GAAI,eAAK,OAAM;AAAA,cACvC,KAAK,OAAO,oBAAC,UAAK,WAAW,EAAE,KAAK,GAAI,eAAK,MAAK,IAAU;AAAA;AAAA;AAAA,QAC/D;AAAA,QACC,UAAU,SACT,oBAAC,QAAG,MAAK,SAAQ,IAAI,GAAG,GAAG,IAAI,KAAK,EAAE,UAAU,WAAW,EAAE,MAAM,GAChE,oBACC,oBAAC,QAAG,MAAK,QAAO,WAAU,kCAAiC,OAAO,EAAE,aAAa,GAAG,QAAQ,OAAO,IAAI,MAAM,GAC1G,wBACH,IAEA,OAAO,KAAK,YAAY,CAAC,GAAG,QAAQ,CAAC,GAEzC,IACE;AAAA,WAjDG,KAAK,EAkDd;AAAA;AAAA,EAEJ,CAAC;AAEH,SACE,oBAAC,QAAG,MAAK,QAAO,cAAY,OAAO,WAAW,EAAE,KAAK,EAAE,UAAU,CAAC,GAC/D,iBAAO,OAAO,CAAC,GAClB;AAEJ;","names":[]}
|
package/dist/update-prompt.d.ts
CHANGED
|
@@ -1,27 +1,28 @@
|
|
|
1
1
|
import * as tailwind_variants from 'tailwind-variants';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
|
|
4
|
+
/** @deprecated Since 3.55 (ADR-006, krizaka-ui#674): no product uses it. Removed in 4.0. */
|
|
4
5
|
declare const updatePrompt: tailwind_variants.TVReturnType<{
|
|
5
6
|
[key: string]: {
|
|
6
7
|
[key: string]: tailwind_variants.ClassValue | {
|
|
8
|
+
root?: tailwind_variants.ClassValue;
|
|
7
9
|
mark?: tailwind_variants.ClassValue;
|
|
8
|
-
title?: tailwind_variants.ClassValue;
|
|
9
|
-
version?: tailwind_variants.ClassValue;
|
|
10
10
|
content?: tailwind_variants.ClassValue;
|
|
11
|
-
|
|
11
|
+
title?: tailwind_variants.ClassValue;
|
|
12
12
|
message?: tailwind_variants.ClassValue;
|
|
13
|
+
version?: tailwind_variants.ClassValue;
|
|
13
14
|
actions?: tailwind_variants.ClassValue;
|
|
14
15
|
};
|
|
15
16
|
};
|
|
16
17
|
} | {
|
|
17
18
|
[x: string]: {
|
|
18
19
|
[x: string]: tailwind_variants.ClassValue | {
|
|
20
|
+
root?: tailwind_variants.ClassValue;
|
|
19
21
|
mark?: tailwind_variants.ClassValue;
|
|
20
|
-
title?: tailwind_variants.ClassValue;
|
|
21
|
-
version?: tailwind_variants.ClassValue;
|
|
22
22
|
content?: tailwind_variants.ClassValue;
|
|
23
|
-
|
|
23
|
+
title?: tailwind_variants.ClassValue;
|
|
24
24
|
message?: tailwind_variants.ClassValue;
|
|
25
|
+
version?: tailwind_variants.ClassValue;
|
|
25
26
|
actions?: tailwind_variants.ClassValue;
|
|
26
27
|
};
|
|
27
28
|
};
|
|
@@ -36,12 +37,12 @@ declare const updatePrompt: tailwind_variants.TVReturnType<{
|
|
|
36
37
|
}, undefined, {
|
|
37
38
|
[key: string]: {
|
|
38
39
|
[key: string]: tailwind_variants.ClassValue | {
|
|
40
|
+
root?: tailwind_variants.ClassValue;
|
|
39
41
|
mark?: tailwind_variants.ClassValue;
|
|
40
|
-
title?: tailwind_variants.ClassValue;
|
|
41
|
-
version?: tailwind_variants.ClassValue;
|
|
42
42
|
content?: tailwind_variants.ClassValue;
|
|
43
|
-
|
|
43
|
+
title?: tailwind_variants.ClassValue;
|
|
44
44
|
message?: tailwind_variants.ClassValue;
|
|
45
|
+
version?: tailwind_variants.ClassValue;
|
|
45
46
|
actions?: tailwind_variants.ClassValue;
|
|
46
47
|
};
|
|
47
48
|
};
|
|
@@ -80,7 +81,11 @@ type UpdatePromptProps = Omit<React.ComponentProps<"section">, "title"> & {
|
|
|
80
81
|
/** Called by the way out: the hook remembers it for this version. */
|
|
81
82
|
onLater: () => void;
|
|
82
83
|
};
|
|
83
|
-
/**
|
|
84
|
+
/**
|
|
85
|
+
* The soft update: an invitation that can be dismissed, announced politely.
|
|
86
|
+
* @deprecated Since 3.55 (ADR-006, krizaka-ui#674): no product uses it. Removed in 4.0.
|
|
87
|
+
*/
|
|
84
88
|
declare function UpdatePrompt({ title, message, versionLabel, mark, updateLabel, onUpdate, laterLabel, onLater, className, ...props }: UpdatePromptProps): React.JSX.Element;
|
|
85
89
|
|
|
86
|
-
export { UpdatePrompt,
|
|
90
|
+
export { UpdatePrompt, updatePrompt };
|
|
91
|
+
export type { UpdatePromptProps };
|
package/dist/update-prompt.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
warnDeprecated
|
|
3
|
+
} from "./chunk-KGLRZMCY.js";
|
|
1
4
|
import "./chunk-TDG7ED2W.js";
|
|
2
5
|
import {
|
|
3
6
|
Button
|
|
@@ -21,6 +24,7 @@ var updatePrompt = tv({
|
|
|
21
24
|
}
|
|
22
25
|
});
|
|
23
26
|
function UpdatePrompt({ title, message, versionLabel, mark, updateLabel, onUpdate, laterLabel, onLater, className, ...props }) {
|
|
27
|
+
warnDeprecated("update-prompt");
|
|
24
28
|
const s = updatePrompt();
|
|
25
29
|
return /* @__PURE__ */ jsxs("section", { role: "region", "aria-label": typeof title === "string" ? title : void 0, "data-kind": "update-soft", className: s.root({ className }), ...props, children: [
|
|
26
30
|
mark && /* @__PURE__ */ jsx("div", { "aria-hidden": true, className: s.mark(), children: mark }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/update-prompt/update-prompt.tsx"],"sourcesContent":["// Server-safe. The soft invitation to update: a dismissible banner, in the flow of the page, never a blocker.\n// Every word is a prop (the app passes them translated); the version and the store URL come from `useAppConfig`.\nimport { Button } from \"@krizaka/ui/button\";\nimport type * as React from \"react\";\nimport { tv } from \"tailwind-variants\";\n\nexport const updatePrompt = tv({\n slots: {\n root: \"flex w-full flex-wrap items-center gap-3 rounded-xl border border-border-default bg-surface-1 p-4 text-sm text-fg\",\n mark: \"flex h-10 w-10 shrink-0 items-center justify-center [&>svg]:h-10 [&>svg]:w-10\",\n content: \"flex min-w-0 flex-1 flex-col gap-0.5\",\n title: \"font-semibold text-fg\",\n message: \"text-fg-secondary\",\n version: \"font-mono text-xs text-fg-tertiary\",\n actions: \"flex shrink-0 items-center gap-2\",\n },\n});\n\nexport type UpdatePromptProps = Omit<React.ComponentProps<\"section\">, \"title\"> & {\n /** The headline (“A new version is available”). */\n title: React.ReactNode;\n /** Why update, in a sentence — the backend's localized `message`. */\n message?: React.ReactNode;\n /** The versions, in words and mono (“1.2.0 → 1.4.0”). */\n versionLabel?: React.ReactNode;\n /** The product's mark (decorative), e.g. `<OrazakaLogo />`. */\n mark?: React.ReactNode;\n /** The button that updates (“Update”). */\n updateLabel: string;\n /** Opens the store page, or reloads the app on the new version. */\n onUpdate: () => void;\n /** The way out (“Later”). */\n laterLabel: string;\n /** Called by the way out: the hook remembers it for this version. */\n onLater: () => void;\n};\n\n
|
|
1
|
+
{"version":3,"sources":["../src/update-prompt/update-prompt.tsx"],"sourcesContent":["// Server-safe. The soft invitation to update: a dismissible banner, in the flow of the page, never a blocker.\n// Every word is a prop (the app passes them translated); the version and the store URL come from `useAppConfig`.\nimport { Button } from \"@krizaka/ui/button\";\nimport type * as React from \"react\";\nimport { tv } from \"tailwind-variants\";\n\nimport { warnDeprecated } from \"../deprecated\";\n\n/** @deprecated Since 3.55 (ADR-006, krizaka-ui#674): no product uses it. Removed in 4.0. */\nexport const updatePrompt = tv({\n slots: {\n root: \"flex w-full flex-wrap items-center gap-3 rounded-xl border border-border-default bg-surface-1 p-4 text-sm text-fg\",\n mark: \"flex h-10 w-10 shrink-0 items-center justify-center [&>svg]:h-10 [&>svg]:w-10\",\n content: \"flex min-w-0 flex-1 flex-col gap-0.5\",\n title: \"font-semibold text-fg\",\n message: \"text-fg-secondary\",\n version: \"font-mono text-xs text-fg-tertiary\",\n actions: \"flex shrink-0 items-center gap-2\",\n },\n});\n\nexport type UpdatePromptProps = Omit<React.ComponentProps<\"section\">, \"title\"> & {\n /** The headline (“A new version is available”). */\n title: React.ReactNode;\n /** Why update, in a sentence — the backend's localized `message`. */\n message?: React.ReactNode;\n /** The versions, in words and mono (“1.2.0 → 1.4.0”). */\n versionLabel?: React.ReactNode;\n /** The product's mark (decorative), e.g. `<OrazakaLogo />`. */\n mark?: React.ReactNode;\n /** The button that updates (“Update”). */\n updateLabel: string;\n /** Opens the store page, or reloads the app on the new version. */\n onUpdate: () => void;\n /** The way out (“Later”). */\n laterLabel: string;\n /** Called by the way out: the hook remembers it for this version. */\n onLater: () => void;\n};\n\n/**\n * The soft update: an invitation that can be dismissed, announced politely.\n * @deprecated Since 3.55 (ADR-006, krizaka-ui#674): no product uses it. Removed in 4.0.\n */\nexport function UpdatePrompt({ title, message, versionLabel, mark, updateLabel, onUpdate, laterLabel, onLater, className, ...props }: UpdatePromptProps) {\n warnDeprecated(\"update-prompt\");\n const s = updatePrompt();\n return (\n <section role=\"region\" aria-label={typeof title === \"string\" ? title : undefined} data-kind=\"update-soft\" className={s.root({ className })} {...props}>\n {mark && (\n <div aria-hidden className={s.mark()}>\n {mark}\n </div>\n )}\n <div className={s.content()}>\n <p className={s.title()}>{title}</p>\n {message && <p className={s.message()}>{message}</p>}\n {versionLabel && <p className={s.version()}>{versionLabel}</p>}\n </div>\n <div className={s.actions()}>\n <Button variant=\"ghost\" size=\"sm\" onClick={onLater}>\n {laterLabel}\n </Button>\n <Button variant=\"primary\" size=\"sm\" onClick={onUpdate}>\n {updateLabel}\n </Button>\n </div>\n </section>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAIA,SAAS,UAAU;AA8CX,cAIF,YAJE;AAzCD,IAAM,eAAe,GAAG;AAAA,EAC7B,OAAO;AAAA,IACL,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,OAAO;AAAA,IACP,SAAS;AAAA,IACT,SAAS;AAAA,IACT,SAAS;AAAA,EACX;AACF,CAAC;AAyBM,SAAS,aAAa,EAAE,OAAO,SAAS,cAAc,MAAM,aAAa,UAAU,YAAY,SAAS,WAAW,GAAG,MAAM,GAAsB;AACvJ,iBAAe,eAAe;AAC9B,QAAM,IAAI,aAAa;AACvB,SACE,qBAAC,aAAQ,MAAK,UAAS,cAAY,OAAO,UAAU,WAAW,QAAQ,QAAW,aAAU,eAAc,WAAW,EAAE,KAAK,EAAE,UAAU,CAAC,GAAI,GAAG,OAC7I;AAAA,YACC,oBAAC,SAAI,eAAW,MAAC,WAAW,EAAE,KAAK,GAChC,gBACH;AAAA,IAEF,qBAAC,SAAI,WAAW,EAAE,QAAQ,GACxB;AAAA,0BAAC,OAAE,WAAW,EAAE,MAAM,GAAI,iBAAM;AAAA,MAC/B,WAAW,oBAAC,OAAE,WAAW,EAAE,QAAQ,GAAI,mBAAQ;AAAA,MAC/C,gBAAgB,oBAAC,OAAE,WAAW,EAAE,QAAQ,GAAI,wBAAa;AAAA,OAC5D;AAAA,IACA,qBAAC,SAAI,WAAW,EAAE,QAAQ,GACxB;AAAA,0BAAC,UAAO,SAAQ,SAAQ,MAAK,MAAK,SAAS,SACxC,sBACH;AAAA,MACA,oBAAC,UAAO,SAAQ,WAAU,MAAK,MAAK,SAAS,UAC1C,uBACH;AAAA,OACF;AAAA,KACF;AAEJ;","names":[]}
|
package/dist/upload-queue.d.ts
CHANGED
|
@@ -64,4 +64,5 @@ type TaskTrayProps = Omit<React.ComponentProps<"section">, "title"> & {
|
|
|
64
64
|
/** A non-blocking tray for a queue: the user keeps browsing. Bottom edge on a phone, bottom-right from `sm`. */
|
|
65
65
|
declare function TaskTray({ title, summary, toggleLabel, openLabel, defaultOpen, className, children, ...props }: TaskTrayProps): React.JSX.Element;
|
|
66
66
|
|
|
67
|
-
export { QueueStatus,
|
|
67
|
+
export { QueueStatus, TaskTray, UploadQueue, isWorking, progressOf, tally };
|
|
68
|
+
export type { QueueTally, TaskTrayProps, UploadQueueItem, UploadQueueProps };
|
package/dist/verified-badge.d.ts
CHANGED
|
@@ -13,4 +13,5 @@ type VerifiedBadgeProps = Omit<React.ComponentProps<"span">, "children"> & {
|
|
|
13
13
|
/** A seal that says the person or the account was verified (a selfie check, an ID), named in words. */
|
|
14
14
|
declare function VerifiedBadge({ label, showLabel, size, onMedia, className, ...props }: VerifiedBadgeProps): React.JSX.Element;
|
|
15
15
|
|
|
16
|
-
export { VerifiedBadge
|
|
16
|
+
export { VerifiedBadge };
|
|
17
|
+
export type { VerifiedBadgeProps };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { MascotBird } from './mascot-quote.js';
|
|
3
|
+
|
|
4
|
+
interface FighterStat {
|
|
5
|
+
/** What is measured (`Bundle size`, `Coverage`). */
|
|
6
|
+
label: string;
|
|
7
|
+
/** The measured value, from 0 to `max`. Real data: a stat that is not a finite number is left out. */
|
|
8
|
+
value: number;
|
|
9
|
+
/** The top of the bar. @default 100 */
|
|
10
|
+
max?: number;
|
|
11
|
+
/** The value as the reader reads it (`4.1 kB`, `92 %`); `value` when omitted. */
|
|
12
|
+
display?: React.ReactNode;
|
|
13
|
+
}
|
|
14
|
+
interface Fighter {
|
|
15
|
+
/** The subject's name (`@krizaka/ui 2.7`, `Radix Dialog`). */
|
|
16
|
+
name: React.ReactNode;
|
|
17
|
+
/** The bird that fights for it. */
|
|
18
|
+
bird: MascotBird;
|
|
19
|
+
/** One line under the name. */
|
|
20
|
+
caption?: React.ReactNode;
|
|
21
|
+
/** Its stat bars, from real data. */
|
|
22
|
+
stats: readonly FighterStat[];
|
|
23
|
+
}
|
|
24
|
+
type VersusCardProps = Omit<React.HTMLAttributes<HTMLElement>, "title"> & {
|
|
25
|
+
/** The accessible name of the match: `Krizaka UI 2.7 versus 2.6`. */
|
|
26
|
+
label: string;
|
|
27
|
+
/** The subject on the left. */
|
|
28
|
+
left: Fighter;
|
|
29
|
+
/** The subject on the right (its bird faces left). */
|
|
30
|
+
right: Fighter;
|
|
31
|
+
/** The mark between them. @default "VS" */
|
|
32
|
+
vs?: React.ReactNode;
|
|
33
|
+
/** Where the figures come from, under the card. */
|
|
34
|
+
source?: React.ReactNode;
|
|
35
|
+
};
|
|
36
|
+
/** An arcade versus card: two subjects face to face, a bird each, stat bars from real data, a « VS » between them. */
|
|
37
|
+
declare function VersusCard({ label, left, right, vs, source, className, ...props }: VersusCardProps): React.JSX.Element;
|
|
38
|
+
|
|
39
|
+
export { VersusCard };
|
|
40
|
+
export type { Fighter, FighterStat, VersusCardProps };
|