@teamofsilicons/silicon-ui 0.0.0-stage → 0.2.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/LICENSE +22 -0
- package/README.md +81 -2
- package/check.mjs +236 -0
- package/components/accordion/accordion.d.ts +13 -0
- package/components/accordion/accordion.js +35 -0
- package/components/accordion/accordion.module.css +15 -0
- package/components/action-button/action-button.d.ts +11 -0
- package/components/action-button/action-button.js +57 -0
- package/components/action-button/action-button.module.css +15 -0
- package/components/activity-heatmap/activity-heatmap.d.ts +37 -0
- package/components/activity-heatmap/activity-heatmap.js +303 -0
- package/components/activity-heatmap/activity-heatmap.module.css +83 -0
- package/components/alert/alert.d.ts +13 -0
- package/components/alert/alert.js +79 -0
- package/components/alert/alert.module.css +15 -0
- package/components/animated-counter/animated-counter.d.ts +13 -0
- package/components/animated-counter/animated-counter.js +73 -0
- package/components/animated-counter/animated-counter.module.css +12 -0
- package/components/announcement-bar/announcement-bar.d.ts +53 -0
- package/components/announcement-bar/announcement-bar.js +187 -0
- package/components/announcement-bar/announcement-bar.module.css +60 -0
- package/components/avatar/avatar.d.ts +8 -0
- package/components/avatar/avatar.js +18 -0
- package/components/avatar/avatar.module.css +60 -0
- package/components/avatar-group/avatar-group.d.ts +13 -0
- package/components/avatar-group/avatar-group.js +24 -0
- package/components/avatar-group/avatar-group.module.css +27 -0
- package/components/badge/badge.d.ts +10 -0
- package/components/badge/badge.js +66 -0
- package/components/badge/badge.module.css +52 -0
- package/components/bar-chart/bar-chart.d.ts +32 -0
- package/components/bar-chart/bar-chart.js +327 -0
- package/components/bar-chart/bar-chart.module.css +49 -0
- package/components/billing-toggle/billing-toggle.d.ts +35 -0
- package/components/billing-toggle/billing-toggle.js +83 -0
- package/components/billing-toggle/billing-toggle.module.css +139 -0
- package/components/bottom-sheet/bottom-sheet.d.ts +27 -0
- package/components/bottom-sheet/bottom-sheet.js +386 -0
- package/components/bottom-sheet/bottom-sheet.module.css +69 -0
- package/components/breadcrumb/breadcrumb.d.ts +13 -0
- package/components/breadcrumb/breadcrumb.js +19 -0
- package/components/breadcrumb/breadcrumb.module.css +12 -0
- package/components/brush-chart/brush-chart.d.ts +45 -0
- package/components/brush-chart/brush-chart.js +426 -0
- package/components/brush-chart/brush-chart.module.css +69 -0
- package/components/button/button.d.ts +10 -0
- package/components/button/button.js +97 -0
- package/components/button/button.module.css +39 -0
- package/components/button-group/button-group.d.ts +59 -0
- package/components/button-group/button-group.js +280 -0
- package/components/button-group/button-group.module.css +87 -0
- package/components/button-link/button-link.d.ts +24 -0
- package/components/button-link/button-link.js +11 -0
- package/components/button-link/button-link.module.css +7 -0
- package/components/calendar/calendar.d.ts +22 -0
- package/components/calendar/calendar.js +253 -0
- package/components/calendar/calendar.module.css +51 -0
- package/components/card/card.d.ts +19 -0
- package/components/card/card.js +108 -0
- package/components/card/card.module.css +51 -0
- package/components/card-stack/card-stack.d.ts +34 -0
- package/components/card-stack/card-stack.js +291 -0
- package/components/card-stack/card-stack.module.css +63 -0
- package/components/carousel/carousel.d.ts +28 -0
- package/components/carousel/carousel.js +332 -0
- package/components/carousel/carousel.module.css +42 -0
- package/components/chat-thread/chat-thread.d.ts +135 -0
- package/components/chat-thread/chat-thread.js +406 -0
- package/components/chat-thread/chat-thread.module.css +242 -0
- package/components/checkbox/checkbox.d.ts +7 -0
- package/components/checkbox/checkbox.js +23 -0
- package/components/checkbox/checkbox.module.css +15 -0
- package/components/chip-group/chip-group.d.ts +24 -0
- package/components/chip-group/chip-group.js +196 -0
- package/components/chip-group/chip-group.module.css +38 -0
- package/components/code-block/code-block.d.ts +11 -0
- package/components/code-block/code-block.js +133 -0
- package/components/code-block/code-block.module.css +43 -0
- package/components/color-picker/color-picker.d.ts +40 -0
- package/components/color-picker/color-picker.js +449 -0
- package/components/color-picker/color-picker.module.css +111 -0
- package/components/combobox/combobox.d.ts +19 -0
- package/components/combobox/combobox.js +167 -0
- package/components/combobox/combobox.module.css +28 -0
- package/components/command-palette/command-palette.d.ts +20 -0
- package/components/command-palette/command-palette.js +151 -0
- package/components/command-palette/command-palette.module.css +94 -0
- package/components/comment-thread/comment-thread.d.ts +120 -0
- package/components/comment-thread/comment-thread.js +343 -0
- package/components/comment-thread/comment-thread.module.css +195 -0
- package/components/confirm-morph/confirm-morph.d.ts +65 -0
- package/components/confirm-morph/confirm-morph.js +355 -0
- package/components/confirm-morph/confirm-morph.module.css +146 -0
- package/components/context-menu/context-menu.d.ts +18 -0
- package/components/context-menu/context-menu.js +148 -0
- package/components/context-menu/context-menu.module.css +17 -0
- package/components/copy-button/copy-button.d.ts +10 -0
- package/components/copy-button/copy-button.js +69 -0
- package/components/copy-button/copy-button.module.css +21 -0
- package/components/countdown/countdown.d.ts +31 -0
- package/components/countdown/countdown.js +177 -0
- package/components/countdown/countdown.module.css +49 -0
- package/components/date-picker/date-picker.d.ts +17 -0
- package/components/date-picker/date-picker.js +100 -0
- package/components/date-picker/date-picker.module.css +34 -0
- package/components/date-range-picker/date-range-picker.d.ts +44 -0
- package/components/date-range-picker/date-range-picker.js +534 -0
- package/components/date-range-picker/date-range-picker.module.css +214 -0
- package/components/dialog/dialog.d.ts +11 -0
- package/components/dialog/dialog.js +52 -0
- package/components/dialog/dialog.module.css +36 -0
- package/components/donut-chart/donut-chart.d.ts +46 -0
- package/components/donut-chart/donut-chart.js +382 -0
- package/components/donut-chart/donut-chart.module.css +48 -0
- package/components/drawer/drawer.d.ts +20 -0
- package/components/drawer/drawer.js +111 -0
- package/components/drawer/drawer.module.css +97 -0
- package/components/dropdown-menu/dropdown-menu.d.ts +16 -0
- package/components/dropdown-menu/dropdown-menu.js +39 -0
- package/components/dropdown-menu/dropdown-menu.module.css +38 -0
- package/components/elastic-slider/elastic-slider.d.ts +39 -0
- package/components/elastic-slider/elastic-slider.js +261 -0
- package/components/elastic-slider/elastic-slider.module.css +40 -0
- package/components/empty-state/empty-state.d.ts +12 -0
- package/components/empty-state/empty-state.js +69 -0
- package/components/empty-state/empty-state.module.css +13 -0
- package/components/expandable-card/expandable-card.d.ts +13 -0
- package/components/expandable-card/expandable-card.js +89 -0
- package/components/expandable-card/expandable-card.module.css +22 -0
- package/components/expanding-button-group/expanding-button-group.d.ts +41 -0
- package/components/expanding-button-group/expanding-button-group.js +258 -0
- package/components/expanding-button-group/expanding-button-group.module.css +44 -0
- package/components/expanding-search/expanding-search.d.ts +38 -0
- package/components/expanding-search/expanding-search.js +242 -0
- package/components/expanding-search/expanding-search.module.css +52 -0
- package/components/file-dropzone/file-dropzone.d.ts +44 -0
- package/components/file-dropzone/file-dropzone.js +379 -0
- package/components/file-dropzone/file-dropzone.module.css +115 -0
- package/components/file-upload/file-upload.d.ts +22 -0
- package/components/file-upload/file-upload.js +192 -0
- package/components/file-upload/file-upload.module.css +49 -0
- package/components/filter-toolbar/filter-toolbar.d.ts +48 -0
- package/components/filter-toolbar/filter-toolbar.js +446 -0
- package/components/filter-toolbar/filter-toolbar.module.css +70 -0
- package/components/floating-button-group/floating-button-group.d.ts +51 -0
- package/components/floating-button-group/floating-button-group.js +215 -0
- package/components/floating-button-group/floating-button-group.module.css +74 -0
- package/components/gauge/gauge.d.ts +18 -0
- package/components/gauge/gauge.js +101 -0
- package/components/gauge/gauge.module.css +22 -0
- package/components/hold-to-confirm/hold-to-confirm.d.ts +25 -0
- package/components/hold-to-confirm/hold-to-confirm.js +165 -0
- package/components/hold-to-confirm/hold-to-confirm.module.css +20 -0
- package/components/hover-card/hover-card.d.ts +38 -0
- package/components/hover-card/hover-card.js +145 -0
- package/components/hover-card/hover-card.module.css +20 -0
- package/components/image-compare/image-compare.d.ts +27 -0
- package/components/image-compare/image-compare.js +267 -0
- package/components/image-compare/image-compare.module.css +25 -0
- package/components/in-view-title/in-view-title.d.ts +17 -0
- package/components/in-view-title/in-view-title.js +70 -0
- package/components/in-view-title/in-view-title.module.css +13 -0
- package/components/inline-edit/inline-edit.d.ts +27 -0
- package/components/inline-edit/inline-edit.js +315 -0
- package/components/inline-edit/inline-edit.module.css +73 -0
- package/components/input/input.d.ts +7 -0
- package/components/input/input.js +60 -0
- package/components/input/input.module.css +22 -0
- package/components/json-viewer/json-viewer.d.ts +48 -0
- package/components/json-viewer/json-viewer.js +463 -0
- package/components/json-viewer/json-viewer.module.css +92 -0
- package/components/line-chart/line-chart.d.ts +58 -0
- package/components/line-chart/line-chart.js +383 -0
- package/components/line-chart/line-chart.module.css +60 -0
- package/components/mention-input/mention-input.d.ts +72 -0
- package/components/mention-input/mention-input.js +417 -0
- package/components/mention-input/mention-input.module.css +134 -0
- package/components/metric-card/metric-card.d.ts +8 -0
- package/components/metric-card/metric-card.js +44 -0
- package/components/metric-card/metric-card.module.css +18 -0
- package/components/money-input/money-input.d.ts +48 -0
- package/components/money-input/money-input.js +503 -0
- package/components/money-input/money-input.module.css +77 -0
- package/components/morph-select/morph-select.d.ts +50 -0
- package/components/morph-select/morph-select.js +395 -0
- package/components/morph-select/morph-select.module.css +88 -0
- package/components/multi-select/multi-select.d.ts +18 -0
- package/components/multi-select/multi-select.js +105 -0
- package/components/multi-select/multi-select.module.css +37 -0
- package/components/notification-center/notification-center.d.ts +24 -0
- package/components/notification-center/notification-center.js +146 -0
- package/components/notification-center/notification-center.module.css +79 -0
- package/components/number-field/number-field.d.ts +41 -0
- package/components/number-field/number-field.js +455 -0
- package/components/number-field/number-field.module.css +71 -0
- package/components/otp-input/otp-input.d.ts +13 -0
- package/components/otp-input/otp-input.js +129 -0
- package/components/otp-input/otp-input.module.css +28 -0
- package/components/pagination/pagination.d.ts +7 -0
- package/components/pagination/pagination.js +60 -0
- package/components/pagination/pagination.module.css +16 -0
- package/components/password-field/password-field.d.ts +14 -0
- package/components/password-field/password-field.js +51 -0
- package/components/password-field/password-field.module.css +27 -0
- package/components/password-strength/password-strength.d.ts +107 -0
- package/components/password-strength/password-strength.js +161 -0
- package/components/password-strength/password-strength.module.css +57 -0
- package/components/phone-input/phone-input.d.ts +73 -0
- package/components/phone-input/phone-input.js +612 -0
- package/components/phone-input/phone-input.module.css +98 -0
- package/components/popover/popover.d.ts +6 -0
- package/components/popover/popover.js +19 -0
- package/components/popover/popover.module.css +32 -0
- package/components/progress/progress.d.ts +8 -0
- package/components/progress/progress.js +42 -0
- package/components/progress/progress.module.css +1 -0
- package/components/radio-cards/radio-cards.d.ts +35 -0
- package/components/radio-cards/radio-cards.js +110 -0
- package/components/radio-cards/radio-cards.module.css +84 -0
- package/components/radio-group/radio-group.d.ts +13 -0
- package/components/radio-group/radio-group.js +55 -0
- package/components/radio-group/radio-group.module.css +30 -0
- package/components/resizable-panels/resizable-panels.d.ts +37 -0
- package/components/resizable-panels/resizable-panels.js +338 -0
- package/components/resizable-panels/resizable-panels.module.css +40 -0
- package/components/rich-text-editor/rich-text-editor.d.ts +55 -0
- package/components/rich-text-editor/rich-text-editor.js +1733 -0
- package/components/rich-text-editor/rich-text-editor.module.css +201 -0
- package/components/ridgeline/ridgeline.d.ts +37 -0
- package/components/ridgeline/ridgeline.js +346 -0
- package/components/ridgeline/ridgeline.module.css +58 -0
- package/components/scroll-area/scroll-area.d.ts +40 -0
- package/components/scroll-area/scroll-area.js +153 -0
- package/components/scroll-area/scroll-area.module.css +79 -0
- package/components/search-field/search-field.d.ts +7 -0
- package/components/search-field/search-field.js +20 -0
- package/components/search-field/search-field.module.css +17 -0
- package/components/segmented-control/segmented-control.d.ts +16 -0
- package/components/segmented-control/segmented-control.js +56 -0
- package/components/segmented-control/segmented-control.module.css +15 -0
- package/components/select/select.d.ts +15 -0
- package/components/select/select.js +36 -0
- package/components/select/select.module.css +35 -0
- package/components/shortcut-recorder/shortcut-recorder.d.ts +108 -0
- package/components/shortcut-recorder/shortcut-recorder.js +380 -0
- package/components/shortcut-recorder/shortcut-recorder.module.css +85 -0
- package/components/signature-pad/signature-pad.d.ts +72 -0
- package/components/signature-pad/signature-pad.js +450 -0
- package/components/signature-pad/signature-pad.module.css +84 -0
- package/components/skeleton/skeleton.d.ts +13 -0
- package/components/skeleton/skeleton.js +53 -0
- package/components/skeleton/skeleton.module.css +11 -0
- package/components/slider/slider.d.ts +45 -0
- package/components/slider/slider.js +347 -0
- package/components/slider/slider.module.css +45 -0
- package/components/slope-chart/slope-chart.d.ts +38 -0
- package/components/slope-chart/slope-chart.js +183 -0
- package/components/slope-chart/slope-chart.module.css +51 -0
- package/components/slot-text/slot-text.d.ts +26 -0
- package/components/slot-text/slot-text.js +119 -0
- package/components/slot-text/slot-text.module.css +19 -0
- package/components/sortable-data-table/sortable-data-table.d.ts +38 -0
- package/components/sortable-data-table/sortable-data-table.js +240 -0
- package/components/sortable-data-table/sortable-data-table.module.css +116 -0
- package/components/sparkline/sparkline.d.ts +19 -0
- package/components/sparkline/sparkline.js +239 -0
- package/components/sparkline/sparkline.module.css +26 -0
- package/components/split-button/split-button.d.ts +19 -0
- package/components/split-button/split-button.js +33 -0
- package/components/split-button/split-button.module.css +51 -0
- package/components/stepper/stepper.d.ts +36 -0
- package/components/stepper/stepper.js +108 -0
- package/components/stepper/stepper.module.css +74 -0
- package/components/streamgraph/streamgraph.d.ts +51 -0
- package/components/streamgraph/streamgraph.js +376 -0
- package/components/streamgraph/streamgraph.module.css +55 -0
- package/components/swipe-actions/swipe-actions.d.ts +35 -0
- package/components/swipe-actions/swipe-actions.js +330 -0
- package/components/swipe-actions/swipe-actions.module.css +64 -0
- package/components/switch/switch.d.ts +7 -0
- package/components/switch/switch.js +45 -0
- package/components/switch/switch.module.css +12 -0
- package/components/tabs/tabs.d.ts +8 -0
- package/components/tabs/tabs.js +138 -0
- package/components/tabs/tabs.module.css +27 -0
- package/components/tag-input/tag-input.d.ts +15 -0
- package/components/tag-input/tag-input.js +150 -0
- package/components/tag-input/tag-input.module.css +34 -0
- package/components/text-morph/text-morph.d.ts +13 -0
- package/components/text-morph/text-morph.js +69 -0
- package/components/text-morph/text-morph.module.css +8 -0
- package/components/text-reveal/text-reveal.d.ts +14 -0
- package/components/text-reveal/text-reveal.js +20 -0
- package/components/text-reveal/text-reveal.module.css +13 -0
- package/components/text-shimmer/text-shimmer.d.ts +18 -0
- package/components/text-shimmer/text-shimmer.js +90 -0
- package/components/text-shimmer/text-shimmer.module.css +9 -0
- package/components/textarea/textarea.d.ts +7 -0
- package/components/textarea/textarea.js +56 -0
- package/components/textarea/textarea.module.css +22 -0
- package/components/theme-switch/theme-switch.d.ts +11 -0
- package/components/theme-switch/theme-switch.js +37 -0
- package/components/theme-switch/theme-switch.module.css +31 -0
- package/components/time-picker/time-picker.d.ts +13 -0
- package/components/time-picker/time-picker.js +95 -0
- package/components/time-picker/time-picker.module.css +23 -0
- package/components/timeline/timeline.d.ts +47 -0
- package/components/timeline/timeline.js +171 -0
- package/components/timeline/timeline.module.css +51 -0
- package/components/toast/toast.d.ts +8 -0
- package/components/toast/toast.js +118 -0
- package/components/toast/toast.module.css +100 -0
- package/components/toast-stack/toast-stack.d.ts +57 -0
- package/components/toast-stack/toast-stack.js +399 -0
- package/components/toast-stack/toast-stack.module.css +61 -0
- package/components/tooltip/tooltip.d.ts +8 -0
- package/components/tooltip/tooltip.js +62 -0
- package/components/tooltip/tooltip.module.css +18 -0
- package/components/tree-view/tree-view.d.ts +17 -0
- package/components/tree-view/tree-view.js +147 -0
- package/components/tree-view/tree-view.module.css +22 -0
- package/components/treemap/treemap.d.ts +35 -0
- package/components/treemap/treemap.js +375 -0
- package/components/treemap/treemap.module.css +59 -0
- package/components/usage-meter/usage-meter.d.ts +24 -0
- package/components/usage-meter/usage-meter.js +296 -0
- package/components/usage-meter/usage-meter.module.css +61 -0
- package/components/user-menu/user-menu.d.ts +62 -0
- package/components/user-menu/user-menu.js +316 -0
- package/components/user-menu/user-menu.module.css +97 -0
- package/components/waffle-chart/waffle-chart.d.ts +39 -0
- package/components/waffle-chart/waffle-chart.js +244 -0
- package/components/waffle-chart/waffle-chart.module.css +52 -0
- package/components.json +1330 -0
- package/eslint.js +53 -0
- package/lib/escape.d.ts +19 -0
- package/lib/escape.js +50 -0
- package/lib/media.d.ts +353 -0
- package/lib/media.js +65 -0
- package/lib/menu-highlight.d.ts +28 -0
- package/lib/menu-highlight.js +43 -0
- package/lib/motion-tokens.d.ts +60 -0
- package/lib/motion-tokens.js +25 -0
- package/lib/return-focus.d.ts +9 -0
- package/lib/return-focus.js +53 -0
- package/lib/silicon-provider.d.ts +60 -0
- package/lib/silicon-provider.js +47 -0
- package/lib/use-copy-feedback.d.ts +8 -0
- package/lib/use-copy-feedback.js +36 -0
- package/lib/use-today.d.ts +2 -0
- package/lib/use-today.js +29 -0
- package/package.json +76 -4
- package/styles.css +218 -0
- package/styles.css.d.ts +1 -0
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
/* The root holds the trigger's place in the page. The surface floats above it and grows into the panel, so opening never pushes content. */
|
|
2
|
+
.root {
|
|
3
|
+
position: relative;
|
|
4
|
+
display: inline-block;
|
|
5
|
+
height: var(--control-height-md);
|
|
6
|
+
vertical-align: top;
|
|
7
|
+
color: var(--foreground);
|
|
8
|
+
font-family: var(--font-body);
|
|
9
|
+
font-size: var(--text-sm);
|
|
10
|
+
letter-spacing: var(--tracking-body);
|
|
11
|
+
line-height: var(--leading-body);
|
|
12
|
+
}
|
|
13
|
+
.root { z-index: 0; transition: z-index 0s linear .5s; }
|
|
14
|
+
.root[data-open] { z-index: 30; transition-delay: 0s; }
|
|
15
|
+
.root:not([data-open]) .surface { z-index: 0; }
|
|
16
|
+
.root *, .root *::before, .root *::after { box-sizing: border-box; }
|
|
17
|
+
|
|
18
|
+
/* One material from trigger to panel. Size, corners, and offset come from springs; the border is an overlay so it never changes a measurement. */
|
|
19
|
+
.surface {
|
|
20
|
+
position: absolute;
|
|
21
|
+
z-index: 2;
|
|
22
|
+
top: 0;
|
|
23
|
+
left: 0;
|
|
24
|
+
overflow: clip;
|
|
25
|
+
background: var(--surface-raised);
|
|
26
|
+
box-shadow: var(--shadow-resting);
|
|
27
|
+
transition: box-shadow var(--duration-considered) var(--ease-standard), background-color var(--duration-fast) var(--ease-standard);
|
|
28
|
+
}
|
|
29
|
+
.surface::after { content: ""; position: absolute; inset: 0; border: 1px solid var(--border); border-radius: inherit; corner-shape: inherit; pointer-events: none; transition: border-color var(--duration-fast) var(--ease-standard); }
|
|
30
|
+
.root[data-open] .surface { box-shadow: var(--shadow-floating); }
|
|
31
|
+
|
|
32
|
+
/* Trigger */
|
|
33
|
+
/* The trigger sits in flow above the surface while closed; when open, the surface and its panel rise over it. */
|
|
34
|
+
.trigger {
|
|
35
|
+
position: relative;
|
|
36
|
+
z-index: 1;
|
|
37
|
+
display: inline-flex;
|
|
38
|
+
width: max-content;
|
|
39
|
+
height: var(--control-height-md);
|
|
40
|
+
align-items: center;
|
|
41
|
+
gap: 10px;
|
|
42
|
+
padding: 0 12px 0 14px;
|
|
43
|
+
border: 0;
|
|
44
|
+
background: transparent;
|
|
45
|
+
color: var(--foreground);
|
|
46
|
+
cursor: pointer;
|
|
47
|
+
font: inherit;
|
|
48
|
+
font-weight: 500;
|
|
49
|
+
white-space: nowrap;
|
|
50
|
+
-webkit-tap-highlight-color: transparent;
|
|
51
|
+
}
|
|
52
|
+
.trigger:disabled { cursor: default; }
|
|
53
|
+
.trigger[inert] { pointer-events: none; }
|
|
54
|
+
.triggerIcon, .chevron { display: grid; flex: none; place-items: center; color: var(--text-secondary); }
|
|
55
|
+
.chevron { color: var(--text-muted); }
|
|
56
|
+
.value { display: inline-flex; font-variant-numeric: tabular-nums; }
|
|
57
|
+
.value[data-empty] { color: var(--text-secondary); font-weight: 400; }
|
|
58
|
+
|
|
59
|
+
/* Words roll in their own slots; a leaving word pops out of flow so the next one never waits for space. */
|
|
60
|
+
.rolling { display: inline-flex; gap: .28em; white-space: nowrap; }
|
|
61
|
+
.word { position: relative; display: inline-block; }
|
|
62
|
+
.wordInner { display: inline-block; }
|
|
63
|
+
|
|
64
|
+
/* Panel */
|
|
65
|
+
.panel { position: absolute; top: 0; left: 0; width: max-content; padding: 10px; --cell: 36px; }
|
|
66
|
+
.body { display: flex; gap: 10px; }
|
|
67
|
+
|
|
68
|
+
.rail { position: relative; display: flex; width: 9.25rem; flex: none; flex-direction: column; gap: 2px; padding-right: 10px; border-right: 1px solid var(--border-subtle); }
|
|
69
|
+
.railHighlight { position: absolute; top: 0; left: 0; border-radius: var(--radius-control); corner-shape: var(--corner-shape); background: color-mix(in oklab, var(--foreground) 6.5%, transparent); pointer-events: none; }
|
|
70
|
+
.preset {
|
|
71
|
+
position: relative;
|
|
72
|
+
display: flex;
|
|
73
|
+
height: 32px;
|
|
74
|
+
flex: none;
|
|
75
|
+
align-items: center;
|
|
76
|
+
padding: 0 12px;
|
|
77
|
+
border: 0;
|
|
78
|
+
border-radius: var(--radius-control); corner-shape: var(--corner-shape);
|
|
79
|
+
background: transparent;
|
|
80
|
+
color: var(--text-secondary);
|
|
81
|
+
cursor: pointer;
|
|
82
|
+
font: inherit;
|
|
83
|
+
text-align: left;
|
|
84
|
+
white-space: nowrap;
|
|
85
|
+
-webkit-tap-highlight-color: transparent;
|
|
86
|
+
transition: color var(--duration-fast) var(--ease-standard), background-color var(--duration-fast) var(--ease-standard);
|
|
87
|
+
}
|
|
88
|
+
.preset[aria-pressed="true"] { color: var(--foreground); font-weight: 500; }
|
|
89
|
+
|
|
90
|
+
.calendars { position: relative; padding: 0 2px; }
|
|
91
|
+
.navButton {
|
|
92
|
+
position: absolute;
|
|
93
|
+
z-index: 2;
|
|
94
|
+
top: 0;
|
|
95
|
+
display: grid;
|
|
96
|
+
width: 32px;
|
|
97
|
+
height: 32px;
|
|
98
|
+
place-items: center;
|
|
99
|
+
padding: 0;
|
|
100
|
+
border: 0;
|
|
101
|
+
border-radius: var(--radius-full); corner-shape: round;
|
|
102
|
+
background: transparent;
|
|
103
|
+
color: var(--text-secondary);
|
|
104
|
+
cursor: pointer;
|
|
105
|
+
-webkit-tap-highlight-color: transparent;
|
|
106
|
+
transition: background-color var(--duration-fast) var(--ease-standard), color var(--duration-fast) var(--ease-standard), transform var(--duration-instant) var(--ease-standard);
|
|
107
|
+
}
|
|
108
|
+
.navButton[data-side="prev"] { left: 2px; }
|
|
109
|
+
.navButton[data-side="next"] { right: 2px; }
|
|
110
|
+
.navButton:active:not(:disabled) { transform: scale(.92); }
|
|
111
|
+
.navButton:disabled { opacity: .35; cursor: default; }
|
|
112
|
+
|
|
113
|
+
/* Months slide horizontally inside a clipped window that keeps a little room for the blur. */
|
|
114
|
+
.viewport { position: relative; overflow: clip; overflow-clip-margin: 2px; }
|
|
115
|
+
.months { display: flex; gap: 24px; }
|
|
116
|
+
.month { width: calc(var(--cell) * 7); }
|
|
117
|
+
.monthTitle { height: 32px; margin: 0; color: var(--foreground); font-weight: 500; line-height: 32px; text-align: center; white-space: nowrap; }
|
|
118
|
+
.grid { display: grid; }
|
|
119
|
+
.weekdays { display: grid; height: 28px; align-items: center; color: var(--text-muted); font-size: var(--text-xs); grid-template-columns: repeat(7, var(--cell)); text-align: center; }
|
|
120
|
+
.weeks { position: relative; }
|
|
121
|
+
.week { display: grid; height: var(--cell); grid-template-columns: repeat(7, var(--cell)); }
|
|
122
|
+
.cell, .blank { position: relative; display: block; }
|
|
123
|
+
|
|
124
|
+
/* The highlight lives under the days: one bar per week plus a solid end at each side of the range. */
|
|
125
|
+
.layer { position: absolute; inset: 0; pointer-events: none; }
|
|
126
|
+
.bar { position: absolute; height: calc(var(--cell) - 6px); border-radius: var(--radius-full); corner-shape: round; background: var(--accent-subtle); }
|
|
127
|
+
.thumb { position: absolute; top: 0; left: 0; width: var(--cell); height: var(--cell); }
|
|
128
|
+
.thumb::before { content: ""; position: absolute; inset: 3px; border-radius: 50%; corner-shape: round; background: var(--accent); }
|
|
129
|
+
|
|
130
|
+
.day {
|
|
131
|
+
position: relative;
|
|
132
|
+
z-index: 1;
|
|
133
|
+
display: grid;
|
|
134
|
+
width: 100%;
|
|
135
|
+
height: 100%;
|
|
136
|
+
place-items: center;
|
|
137
|
+
padding: 0;
|
|
138
|
+
border: 0;
|
|
139
|
+
border-radius: 50%; corner-shape: round;
|
|
140
|
+
background: transparent;
|
|
141
|
+
color: var(--foreground);
|
|
142
|
+
cursor: pointer;
|
|
143
|
+
font: inherit;
|
|
144
|
+
font-variant-numeric: tabular-nums;
|
|
145
|
+
-webkit-tap-highlight-color: transparent;
|
|
146
|
+
transition: color var(--duration-fast) var(--ease-standard);
|
|
147
|
+
}
|
|
148
|
+
.day > span { position: relative; display: grid; width: calc(100% - 6px); height: calc(100% - 6px); place-items: center; border-radius: 50%; corner-shape: round; transition: background-color var(--duration-fast) var(--ease-standard), transform var(--duration-instant) var(--ease-standard); }
|
|
149
|
+
.day:active:not(:disabled) > span { transform: scale(.9); }
|
|
150
|
+
.day[data-edge] { color: var(--accent-foreground); font-weight: 500; transition-delay: 40ms; }
|
|
151
|
+
.day[data-today]::after { content: ""; position: absolute; bottom: 5px; left: 50%; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; corner-shape: round; background: var(--accent); }
|
|
152
|
+
.day[data-today][data-edge]::after { background: var(--accent-foreground); }
|
|
153
|
+
.day:disabled { color: var(--text-muted); cursor: default; opacity: .5; }
|
|
154
|
+
.day:focus-visible:not([data-edge]) > span { background: color-mix(in oklab, var(--foreground) 7%, transparent); }
|
|
155
|
+
|
|
156
|
+
/* Footer: the formatted range and the two decisions. */
|
|
157
|
+
.footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; padding: 10px 2px 0 12px; border-top: 1px solid var(--border-subtle); }
|
|
158
|
+
.summary { display: grid; min-width: 0; gap: 1px; }
|
|
159
|
+
.summaryValue { display: inline-flex; width: max-content; font-weight: 500; font-variant-numeric: tabular-nums; }
|
|
160
|
+
.summaryCount { display: inline-flex; min-height: 1.4em; color: var(--text-muted); font-size: var(--text-xs); font-variant-numeric: tabular-nums; }
|
|
161
|
+
.actions { display: flex; flex: none; align-items: center; gap: 6px; }
|
|
162
|
+
.ghost, .primary {
|
|
163
|
+
display: inline-flex;
|
|
164
|
+
height: var(--control-height-sm);
|
|
165
|
+
align-items: center;
|
|
166
|
+
justify-content: center;
|
|
167
|
+
padding: 0 14px;
|
|
168
|
+
border: 0;
|
|
169
|
+
border-radius: var(--radius-control); corner-shape: var(--corner-shape);
|
|
170
|
+
cursor: pointer;
|
|
171
|
+
font: inherit;
|
|
172
|
+
font-weight: 500;
|
|
173
|
+
white-space: nowrap;
|
|
174
|
+
-webkit-tap-highlight-color: transparent;
|
|
175
|
+
transition: background-color var(--duration-fast) var(--ease-standard), color var(--duration-fast) var(--ease-standard), transform var(--duration-instant) var(--ease-standard), opacity var(--duration-fast) var(--ease-standard);
|
|
176
|
+
}
|
|
177
|
+
.ghost { background: transparent; color: var(--text-secondary); }
|
|
178
|
+
.primary { min-width: 4.75rem; background: var(--accent); color: var(--accent-foreground); }
|
|
179
|
+
.ghost:active, .primary:active:not(:disabled) { transform: scale(.97); }
|
|
180
|
+
.primary:disabled { opacity: .45; cursor: default; }
|
|
181
|
+
.ghost:focus-visible { background: var(--surface-muted); color: var(--foreground); }
|
|
182
|
+
.preset:focus-visible, .navButton:focus-visible { background: color-mix(in oklab, var(--foreground) 5%, transparent); color: var(--foreground); }
|
|
183
|
+
|
|
184
|
+
.srOnly { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
|
|
185
|
+
|
|
186
|
+
/* Compact: one month under a scrolling row of presets. */
|
|
187
|
+
.panel[data-compact] { padding: 8px; }
|
|
188
|
+
.panel[data-compact] .body { flex-direction: column; gap: 8px; }
|
|
189
|
+
.panel[data-compact] .rail { width: auto; flex-direction: row; gap: 2px; margin: 0 -8px; padding: 0 8px 8px; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--border-subtle); overscroll-behavior-x: contain; scrollbar-width: none; }
|
|
190
|
+
.panel[data-compact] .rail::-webkit-scrollbar { display: none; }
|
|
191
|
+
.panel[data-compact] .preset { padding: 0 11px; }
|
|
192
|
+
.panel[data-compact] .calendars { align-self: center; }
|
|
193
|
+
.panel[data-compact] .footer { flex-wrap: wrap; margin-top: 6px; padding-left: 11px; }
|
|
194
|
+
.panel[data-compact] .actions { margin-left: auto; }
|
|
195
|
+
.panel[data-compact] .summary { flex: 1 1 8rem; }
|
|
196
|
+
|
|
197
|
+
@media (hover: hover) and (pointer: fine) {
|
|
198
|
+
.root:not([data-open]):has(> .trigger:hover:not(:disabled)) .surface { background: color-mix(in oklab, var(--foreground) 3%, var(--surface-raised)); }
|
|
199
|
+
.root:not([data-open]):has(> .trigger:hover:not(:disabled)) .surface::after { border-color: var(--border-strong); }
|
|
200
|
+
.preset:hover { color: var(--foreground); }
|
|
201
|
+
.preset:not([aria-pressed="true"]):hover { background: color-mix(in oklab, var(--foreground) 4%, transparent); }
|
|
202
|
+
.navButton:hover:not(:disabled) { background: color-mix(in oklab, var(--foreground) 6.5%, transparent); color: var(--foreground); }
|
|
203
|
+
.day:hover:not(:disabled):not([data-edge]) > span { background: color-mix(in oklab, var(--foreground) 7%, transparent); }
|
|
204
|
+
.ghost:hover { background: var(--surface-muted); color: var(--foreground); }
|
|
205
|
+
.primary:hover:not(:disabled) { background: var(--accent-strong); }
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
@media (prefers-reduced-motion: reduce) {
|
|
209
|
+
.surface, .preset, .navButton, .day, .day > span, .ghost, .primary { transition-duration: 0ms; }
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
@media (prefers-contrast: more) {
|
|
213
|
+
.surface::after { border-color: var(--border-strong); }
|
|
214
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
2
|
+
import type { ComponentPropsWithoutRef, ReactNode } from "react";
|
|
3
|
+
export declare function Dialog({ open: openProp, defaultOpen, onOpenChange, ...props }: ComponentPropsWithoutRef<typeof DialogPrimitive.Root>): import("react").JSX.Element;
|
|
4
|
+
export declare const DialogTrigger: import("react").ForwardRefExoticComponent<DialogPrimitive.DialogTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
5
|
+
export declare const DialogClose: import("react").ForwardRefExoticComponent<DialogPrimitive.DialogCloseProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
6
|
+
export interface DialogContentProps extends ComponentPropsWithoutRef<typeof DialogPrimitive.Content> {
|
|
7
|
+
title: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
export declare function DialogContent({ title, description, children, className, onPointerDownOutside, onEscapeKeyDown, onOpenAutoFocus, onCloseAutoFocus, ...props }: DialogContentProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
4
|
+
import { createContext, useCallback, useContext, useLayoutEffect, useRef, useState } from "react";
|
|
5
|
+
import { AnimatePresence, motion, useReducedMotion } from "motion/react";
|
|
6
|
+
import { X } from "lucide-react";
|
|
7
|
+
import { ESCAPE_LAYER_ATTRIBUTE, layerEscape } from "../../lib/escape.js";
|
|
8
|
+
import { motionTokens } from "../../lib/motion-tokens.js";
|
|
9
|
+
import { useReturnFocus } from "../../lib/return-focus.js";
|
|
10
|
+
import styles from "./dialog.module.css";
|
|
11
|
+
/** Mirrors the open state so the content can stay mounted while it animates out, and retarget mid-flight if it is reopened or closed early. */
|
|
12
|
+
const OpenContext = createContext(null);
|
|
13
|
+
export function Dialog({ open: openProp, defaultOpen = false, onOpenChange, ...props }) {
|
|
14
|
+
const [uncontrolled, setUncontrolled] = useState(defaultOpen);
|
|
15
|
+
const open = openProp ?? uncontrolled;
|
|
16
|
+
const setOpen = useCallback((next) => { if (openProp === undefined)
|
|
17
|
+
setUncontrolled(next); onOpenChange?.(next); }, [openProp, onOpenChange]);
|
|
18
|
+
return _jsx(OpenContext.Provider, { value: open, children: _jsx(DialogPrimitive.Root, { ...props, open: open, onOpenChange: setOpen }) });
|
|
19
|
+
}
|
|
20
|
+
export const DialogTrigger = DialogPrimitive.Trigger;
|
|
21
|
+
export const DialogClose = DialogPrimitive.Close;
|
|
22
|
+
const fade = { duration: motionTokens.duration.instant };
|
|
23
|
+
const leave = { duration: motionTokens.duration.fast, ease: [...motionTokens.ease.standard] };
|
|
24
|
+
/** When the title or description changes while open, the new copy rises in and the old copy leaves upward. */
|
|
25
|
+
function SwapText({ text }) {
|
|
26
|
+
const reduced = useReducedMotion();
|
|
27
|
+
return _jsx(AnimatePresence, { mode: "popLayout", initial: false, children: _jsx(motion.span, { className: styles.swap, initial: reduced ? false : { opacity: 0, y: "0.3em", filter: `blur(${motionTokens.blur.soft}px)` }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, exit: reduced ? { opacity: 0, transition: { duration: 0 } } : { opacity: 0, y: "-0.3em", filter: `blur(${motionTokens.blur.subtle}px)`, transition: { duration: motionTokens.duration.fast, ease: [...motionTokens.ease.standard] } }, transition: { duration: motionTokens.duration.standard, ease: [...motionTokens.ease.enter] }, children: text }, text) });
|
|
28
|
+
}
|
|
29
|
+
export function DialogContent({ title, description, children, className, onPointerDownOutside, onEscapeKeyDown, onOpenAutoFocus, onCloseAutoFocus, ...props }) {
|
|
30
|
+
const open = useContext(OpenContext);
|
|
31
|
+
// Closing puts focus back on what opened the dialog, Trigger or not (lib/return-focus.ts).
|
|
32
|
+
const returnFocus = useReturnFocus(open, onOpenAutoFocus, onCloseAutoFocus);
|
|
33
|
+
// Escape inside belongs to an open list, calendar or question first (lib/escape.ts); the next one closes the dialog.
|
|
34
|
+
const escape = { [ESCAPE_LAYER_ATTRIBUTE]: "", onEscapeKeyDown: layerEscape(onEscapeKeyDown), ...returnFocus };
|
|
35
|
+
const reduced = useReducedMotion();
|
|
36
|
+
// When the open state last changed. Radix waits for the click before treating a press as outside, and a press on the trigger
|
|
37
|
+
// while the dialog leaves reopens it first, so that press must not close it again.
|
|
38
|
+
const change = useRef({ open, at: 0 });
|
|
39
|
+
useLayoutEffect(() => { change.current = { open, at: performance.now() }; }, [open]);
|
|
40
|
+
const pressOutside = event => {
|
|
41
|
+
onPointerDownOutside?.(event);
|
|
42
|
+
if (open !== null && (!change.current.open || event.detail.originalEvent.timeStamp < change.current.at))
|
|
43
|
+
event.preventDefault();
|
|
44
|
+
};
|
|
45
|
+
const classes = [styles.content, className].filter(Boolean).join(" ");
|
|
46
|
+
const inner = _jsxs(_Fragment, { children: [_jsxs("div", { className: styles.header, children: [_jsxs("div", { children: [_jsx(DialogPrimitive.Title, { className: styles.title, children: _jsx(SwapText, { text: title }) }), description ? _jsx(DialogPrimitive.Description, { className: styles.description, children: _jsx(SwapText, { text: description }) }) : null] }), _jsx(DialogPrimitive.Close, { className: styles.close, "aria-label": "Close dialog", children: _jsx(X, { size: 16, strokeWidth: 1.75, "aria-hidden": "true" }) })] }), _jsx("div", { className: styles.body, children: children })] });
|
|
47
|
+
// Under a bare Radix root the open state is unknown here, so CSS keyframes keyed off data-state animate the layers instead.
|
|
48
|
+
if (open === null)
|
|
49
|
+
return _jsxs(DialogPrimitive.Portal, { children: [_jsx(DialogPrimitive.Overlay, { className: `${styles.overlay} ${styles.keyframes}` }), _jsx(DialogPrimitive.Content, { ...props, ...escape, onPointerDownOutside: pressOutside, className: `${classes} ${styles.keyframes}`, children: inner })] });
|
|
50
|
+
// The overlay fades while the dialog rises 8px and scales up on a spring. Closing is shorter and quieter, and starts from wherever the entrance is.
|
|
51
|
+
return _jsx(AnimatePresence, { children: open && _jsxs(DialogPrimitive.Portal, { forceMount: true, children: [_jsx(DialogPrimitive.Overlay, { asChild: true, forceMount: true, children: _jsx(motion.div, { className: styles.overlay, initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0, transition: reduced ? fade : leave }, transition: reduced ? fade : { duration: motionTokens.duration.standard, ease: [...motionTokens.ease.enter] } }) }), _jsx(DialogPrimitive.Content, { ...props, ...escape, onPointerDownOutside: pressOutside, asChild: true, forceMount: true, children: _jsx(motion.div, { className: classes, initial: reduced ? { opacity: 0 } : { opacity: 0, y: 8, scale: .96 }, animate: { opacity: 1, y: 0, scale: 1 }, exit: reduced ? { opacity: 0, transition: fade } : { opacity: 0, y: 4, scale: .98, transition: leave }, transition: reduced ? fade : { default: motionTokens.spring.smooth, opacity: { duration: motionTokens.duration.fast, ease: [...motionTokens.ease.enter] } }, children: inner }) })] }, "dialog") });
|
|
52
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
.overlay { position: fixed; inset: 0; z-index: 50; background: oklch(10% 0 0 / .46); backdrop-filter: blur(7px); }
|
|
2
|
+
/* Centered with auto margins (like a native modal dialog) so transform stays free for the entrance spring. */
|
|
3
|
+
.content { position: fixed; z-index: 51; inset: 0; width: min(calc(100vw - var(--space-block)), 440px); height: fit-content; max-height: calc(100vh - var(--space-block)); max-height: calc(100dvh - var(--space-block)); margin: auto; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-overlay); background: var(--surface-raised); color: var(--foreground); box-shadow: var(--shadow-floating); }
|
|
4
|
+
/* Motion animates both layers. Keyframes only run when DialogContent sits under a bare Radix root. */
|
|
5
|
+
.keyframes.overlay[data-state="open"] { animation: overlay-in var(--duration-standard) var(--ease-enter) both; }
|
|
6
|
+
.keyframes.overlay[data-state="closed"] { animation: overlay-out var(--duration-fast) var(--ease-standard) both; }
|
|
7
|
+
.keyframes.content[data-state="open"] { animation: content-fade-in var(--duration-fast) var(--ease-enter) both, content-rise-in var(--duration-spring) var(--ease-spring) both; }
|
|
8
|
+
.keyframes.content[data-state="closed"] { animation: content-out var(--duration-fast) var(--ease-standard) both; }
|
|
9
|
+
.content:focus { outline: none; }
|
|
10
|
+
/* While the layers leave, clicks pass through, so the trigger can reopen the dialog mid-exit. Radix sets pointer-events inline on the overlay. */
|
|
11
|
+
.overlay[data-state="closed"], .content[data-state="closed"] { pointer-events: none !important; }
|
|
12
|
+
.header { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-comfort); padding: var(--space-section); border-bottom: 1px solid var(--border); }
|
|
13
|
+
.title { margin: 0; font-family: var(--font-body); font-size: var(--text-lg); font-weight: 500; letter-spacing: var(--tracking-body); line-height: var(--leading-body); }
|
|
14
|
+
.description { margin: var(--space-related) 0 0; color: var(--text-secondary); font-size: var(--text-sm); line-height: var(--leading-body); }
|
|
15
|
+
.title, .description { position: relative; overflow-wrap: anywhere; }
|
|
16
|
+
.swap { display: block; }
|
|
17
|
+
/* Line height sits on the text itself, so a page-level heading reset cannot shrink the title and pull the close button off its line. */
|
|
18
|
+
.title .swap { line-height: var(--leading-body); }
|
|
19
|
+
/* A compact icon button: quick press, spring release. The negative margin centres it on the title's first line. */
|
|
20
|
+
.close { flex: 0 0 auto; margin-block: calc((var(--text-lg) * var(--leading-body) - var(--space-block)) / 2); display: grid; place-items: center; width: var(--space-block); height: var(--space-block); border: 1px solid var(--border); border-radius: var(--radius-control); background: color-mix(in oklab, var(--surface-muted) 50%, transparent); color: var(--text-secondary); cursor: pointer; transition: background-color var(--duration-fast) var(--ease-standard), color var(--duration-fast) var(--ease-standard), transform var(--duration-spring) var(--ease-spring); }
|
|
21
|
+
@media (hover: hover) and (pointer: fine) { .close:hover { background: var(--surface-muted); color: var(--foreground); } }
|
|
22
|
+
.close:active { transform: scale(.96); transition: background-color var(--duration-fast) var(--ease-standard), color var(--duration-fast) var(--ease-standard), transform var(--duration-instant) var(--ease-standard); }
|
|
23
|
+
.body { padding: var(--space-section); font-size: var(--text-sm); line-height: var(--leading-body); }
|
|
24
|
+
@keyframes overlay-in { from { opacity: 0; } }
|
|
25
|
+
@keyframes overlay-out { to { opacity: 0; } }
|
|
26
|
+
@keyframes content-fade-in { from { opacity: 0; } }
|
|
27
|
+
@keyframes content-rise-in { from { transform: translateY(8px) scale(.96); } }
|
|
28
|
+
@keyframes content-out { to { opacity: 0; transform: translateY(4px) scale(.98); } }
|
|
29
|
+
@keyframes content-fade-out { to { opacity: 0; } }
|
|
30
|
+
@media (prefers-reduced-motion: reduce) {
|
|
31
|
+
.keyframes.overlay[data-state="open"], .keyframes.content[data-state="open"] { animation: overlay-in var(--duration-instant) var(--ease-standard) both; }
|
|
32
|
+
.keyframes.overlay[data-state="closed"] { animation: overlay-out var(--duration-instant) var(--ease-standard) both; }
|
|
33
|
+
.keyframes.content[data-state="closed"] { animation: content-fade-out var(--duration-instant) var(--ease-standard) both; }
|
|
34
|
+
.close, .close:active { transition: none; }
|
|
35
|
+
.close:active { transform: none; }
|
|
36
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { type Ref } from "react";
|
|
2
|
+
export interface DonutChartDatum {
|
|
3
|
+
/** Stable identity. A segment whose key survives a data change keeps its place and color, so switching datasets morphs the arcs. */
|
|
4
|
+
key: string;
|
|
5
|
+
label: string;
|
|
6
|
+
value: number;
|
|
7
|
+
/** Any CSS color. Segments default to the shared --series-* palette in data order, then neutral steps. */
|
|
8
|
+
color?: string;
|
|
9
|
+
}
|
|
10
|
+
/** Use a donut chart for a few parts of one whole, when the share of each part matters more than precise comparison. */
|
|
11
|
+
export interface DonutChartProps {
|
|
12
|
+
data: DonutChartDatum[];
|
|
13
|
+
/** What the whole is, such as "Visits by source". Names the chart for assistive technology. */
|
|
14
|
+
label: string;
|
|
15
|
+
/** Unit after values, such as "visits". */
|
|
16
|
+
unit?: string;
|
|
17
|
+
formatValue?: (value: number) => string;
|
|
18
|
+
/** Center label at rest, above the total. */
|
|
19
|
+
totalLabel?: string;
|
|
20
|
+
/** Diameter in pixels. The chart scales down to fit narrower containers. */
|
|
21
|
+
size?: number;
|
|
22
|
+
/** Ring thickness in pixels. */
|
|
23
|
+
thickness?: number;
|
|
24
|
+
/** Segments below this share of the total join "Other". */
|
|
25
|
+
groupBelow?: number;
|
|
26
|
+
/** The most segments drawn, counting "Other". The smallest parts beyond it are grouped. */
|
|
27
|
+
maxSegments?: number;
|
|
28
|
+
otherLabel?: string;
|
|
29
|
+
/** Controlled selected segment key. Hover and focus preview other segments without changing it. */
|
|
30
|
+
activeKey?: string | null;
|
|
31
|
+
defaultActiveKey?: string | null;
|
|
32
|
+
onActiveChange?: (key: string | null) => void;
|
|
33
|
+
/** Controlled hidden segment keys. A hidden segment closes and the rest of the ring redistributes. */
|
|
34
|
+
hiddenKeys?: string[];
|
|
35
|
+
defaultHiddenKeys?: string[];
|
|
36
|
+
onHiddenKeysChange?: (keys: string[]) => void;
|
|
37
|
+
/** What clicking a legend row does: show or hide its segment, or pin it as the selected segment. */
|
|
38
|
+
legendAction?: "toggle" | "select";
|
|
39
|
+
/** The synced legend beside or below the ring. */
|
|
40
|
+
legend?: boolean;
|
|
41
|
+
emptyLabel?: string;
|
|
42
|
+
ref?: Ref<HTMLElement>;
|
|
43
|
+
className?: string;
|
|
44
|
+
}
|
|
45
|
+
export declare function DonutChart({ data, label, unit, formatValue, totalLabel, size, thickness, groupBelow, maxSegments, otherLabel, activeKey, defaultActiveKey, onActiveChange, hiddenKeys, defaultHiddenKeys, onHiddenKeysChange, legendAction, legend, emptyLabel, ref, className }: DonutChartProps): import("react").JSX.Element;
|
|
46
|
+
export default DonutChart;
|