@teamofsilicons/silicon-ui 0.2.0 → 0.4.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 +4 -3
- package/check.mjs +14 -5
- package/components/activity-heatmap/activity-heatmap.module.css +4 -4
- package/components/alert/alert.module.css +1 -1
- package/components/animated-counter/animated-counter.js +1 -1
- package/components/announcement-bar/announcement-bar.module.css +6 -6
- package/components/avatar/avatar.d.ts +2 -2
- package/components/avatar/avatar.js +1 -1
- package/components/avatar/avatar.module.css +5 -2
- package/components/avatar-group/avatar-group.module.css +4 -4
- package/components/badge/badge.module.css +4 -4
- package/components/bar-chart/bar-chart.js +1 -1
- package/components/bar-chart/bar-chart.module.css +4 -4
- package/components/billing-toggle/billing-toggle.js +2 -2
- package/components/billing-toggle/billing-toggle.module.css +10 -10
- package/components/bottom-sheet/bottom-sheet.js +1 -1
- package/components/bottom-sheet/bottom-sheet.module.css +4 -5
- package/components/breadcrumb/breadcrumb.d.ts +8 -2
- package/components/breadcrumb/breadcrumb.js +21 -9
- package/components/breadcrumb/breadcrumb.module.css +7 -3
- package/components/brush-chart/brush-chart.module.css +9 -9
- package/components/button/button.d.ts +7 -2
- package/components/button/button.js +3 -1
- package/components/button/button.module.css +10 -1
- package/components/button-group/button-group.module.css +7 -7
- package/components/calendar/calendar.js +15 -5
- package/components/calendar/calendar.module.css +13 -10
- package/components/card/card.js +4 -4
- package/components/card/card.module.css +2 -2
- package/components/card-stack/card-stack.js +2 -2
- package/components/card-stack/card-stack.module.css +2 -3
- package/components/carousel/carousel.module.css +3 -3
- package/components/chat-thread/chat-thread.module.css +41 -41
- package/components/checkbox/checkbox.module.css +1 -1
- package/components/chip-group/chip-group.js +1 -1
- package/components/chip-group/chip-group.module.css +2 -2
- package/components/code-block/code-block.module.css +7 -14
- package/components/color-picker/color-picker.module.css +20 -21
- package/components/combobox/combobox.js +5 -1
- package/components/combobox/combobox.module.css +2 -2
- package/components/command-palette/command-palette.js +18 -11
- package/components/command-palette/command-palette.module.css +18 -18
- package/components/comment-thread/comment-thread.module.css +35 -35
- package/components/confirm-morph/confirm-morph.js +5 -5
- package/components/confirm-morph/confirm-morph.module.css +9 -9
- package/components/context-menu/context-menu.js +10 -28
- package/components/context-menu/context-menu.module.css +3 -3
- package/components/copy-button/copy-button.js +4 -4
- package/components/countdown/countdown.module.css +4 -4
- package/components/date-picker/date-picker.js +3 -3
- package/components/date-picker/date-picker.module.css +7 -7
- package/components/date-range-picker/date-range-picker.js +13 -10
- package/components/date-range-picker/date-range-picker.module.css +23 -22
- package/components/dialog/dialog.module.css +2 -2
- package/components/donut-chart/donut-chart.module.css +5 -5
- package/components/drawer/drawer.module.css +7 -7
- package/components/dropdown-menu/dropdown-menu.d.ts +71 -1
- package/components/dropdown-menu/dropdown-menu.js +100 -6
- package/components/dropdown-menu/dropdown-menu.module.css +15 -5
- package/components/elastic-slider/elastic-slider.js +2 -2
- package/components/elastic-slider/elastic-slider.module.css +4 -4
- package/components/expandable-card/expandable-card.js +1 -1
- package/components/expandable-card/expandable-card.module.css +1 -1
- package/components/expanding-button-group/expanding-button-group.module.css +3 -3
- package/components/expanding-search/expanding-search.js +3 -3
- package/components/expanding-search/expanding-search.module.css +9 -9
- package/components/file-dropzone/file-dropzone.js +3 -3
- package/components/file-dropzone/file-dropzone.module.css +21 -21
- package/components/file-upload/file-upload.module.css +7 -7
- package/components/filter-toolbar/filter-toolbar.js +7 -3
- package/components/filter-toolbar/filter-toolbar.module.css +9 -9
- package/components/floating-button-group/floating-button-group.module.css +7 -7
- package/components/gauge/gauge.js +1 -1
- package/components/gauge/gauge.module.css +2 -2
- package/components/hover-card/hover-card.js +2 -2
- package/components/hover-card/hover-card.module.css +2 -2
- package/components/image-compare/image-compare.module.css +4 -4
- package/components/inline-edit/inline-edit.module.css +12 -12
- package/components/json-viewer/json-viewer.module.css +12 -12
- package/components/line-chart/line-chart.js +1 -1
- package/components/line-chart/line-chart.module.css +8 -8
- package/components/mention-input/mention-input.js +4 -2
- package/components/mention-input/mention-input.module.css +8 -8
- package/components/metric-card/metric-card.module.css +1 -1
- package/components/money-input/money-input.js +6 -3
- package/components/money-input/money-input.module.css +10 -10
- package/components/morph-select/morph-select.js +7 -5
- package/components/morph-select/morph-select.module.css +13 -13
- package/components/multi-select/multi-select.js +4 -2
- package/components/multi-select/multi-select.module.css +6 -6
- package/components/nav-list/nav-list.d.ts +64 -0
- package/components/nav-list/nav-list.js +96 -0
- package/components/nav-list/nav-list.module.css +25 -0
- package/components/notification-center/notification-center.module.css +27 -27
- package/components/number-field/number-field.js +3 -3
- package/components/number-field/number-field.module.css +3 -3
- package/components/otp-input/otp-input.module.css +4 -4
- package/components/pagination/pagination.module.css +1 -1
- package/components/password-field/password-field.module.css +2 -2
- package/components/password-strength/password-strength.module.css +8 -8
- package/components/phone-input/phone-input.js +9 -7
- package/components/phone-input/phone-input.module.css +19 -19
- package/components/popover/popover.module.css +2 -2
- package/components/progress/progress.module.css +1 -1
- package/components/radio-cards/radio-cards.module.css +8 -8
- package/components/radio-group/radio-group.js +4 -1
- package/components/radio-group/radio-group.module.css +4 -3
- package/components/resizable-panels/resizable-panels.module.css +5 -5
- package/components/rich-text-editor/rich-text-editor.js +3 -3
- package/components/rich-text-editor/rich-text-editor.module.css +12 -12
- package/components/ridgeline/ridgeline.module.css +7 -7
- package/components/scroll-area/scroll-area.module.css +8 -8
- package/components/segmented-control/segmented-control.d.ts +3 -1
- package/components/segmented-control/segmented-control.js +5 -2
- package/components/segmented-control/segmented-control.module.css +9 -4
- package/components/select/select.module.css +5 -5
- package/components/shortcut-recorder/shortcut-recorder.js +5 -5
- package/components/shortcut-recorder/shortcut-recorder.module.css +16 -16
- package/components/signature-pad/signature-pad.module.css +11 -11
- package/components/slider/slider.module.css +4 -4
- package/components/slope-chart/slope-chart.module.css +7 -7
- package/components/slot-text/slot-text.js +2 -1
- package/components/sortable-data-table/sortable-data-table.module.css +4 -4
- package/components/sparkline/sparkline.js +1 -1
- package/components/split-button/split-button.module.css +6 -6
- package/components/stepper/stepper.module.css +3 -3
- package/components/streamgraph/streamgraph.module.css +7 -7
- package/components/swipe-actions/swipe-actions.js +2 -2
- package/components/swipe-actions/swipe-actions.module.css +5 -5
- package/components/switch/switch.js +2 -2
- package/components/switch/switch.module.css +1 -1
- package/components/tabs/tabs.d.ts +9 -2
- package/components/tabs/tabs.js +11 -5
- package/components/tabs/tabs.module.css +10 -3
- package/components/tag-input/tag-input.module.css +4 -4
- package/components/text-reveal/text-reveal.js +1 -1
- package/components/time-picker/time-picker.js +4 -2
- package/components/time-picker/time-picker.module.css +3 -3
- package/components/timeline/timeline.js +4 -4
- package/components/timeline/timeline.module.css +3 -3
- package/components/toast/toast.js +1 -1
- package/components/toast/toast.module.css +5 -5
- package/components/toast-stack/toast-stack.js +1 -1
- package/components/toast-stack/toast-stack.module.css +5 -5
- package/components/tooltip/tooltip.module.css +1 -1
- package/components/tree-view/tree-view.js +16 -12
- package/components/tree-view/tree-view.module.css +10 -8
- package/components/treemap/treemap.module.css +13 -13
- package/components/usage-meter/usage-meter.js +1 -1
- package/components/usage-meter/usage-meter.module.css +5 -5
- package/components/user-menu/user-menu.js +16 -14
- package/components/user-menu/user-menu.module.css +22 -22
- package/components/waffle-chart/waffle-chart.module.css +7 -7
- package/components.json +416 -1
- package/eslint.js +35 -3
- package/lib/fluid-hover.d.ts +83 -0
- package/lib/fluid-hover.js +184 -0
- package/lib/menu-highlight.d.ts +24 -11
- package/lib/menu-highlight.js +29 -28
- package/lib/motion-tokens.d.ts +76 -18
- package/lib/motion-tokens.js +45 -10
- package/package.json +1 -1
- package/styles.css +50 -7
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
display: flex;
|
|
14
14
|
min-height: 54px;
|
|
15
15
|
align-items: center;
|
|
16
|
-
gap:
|
|
17
|
-
padding:
|
|
16
|
+
gap: var(--space-group);
|
|
17
|
+
padding: var(--space-related) var(--space-inset);
|
|
18
18
|
border-bottom: 1px solid var(--border-subtle);
|
|
19
19
|
transition: background var(--duration-fast) var(--ease-standard);
|
|
20
20
|
}
|
|
@@ -42,51 +42,51 @@
|
|
|
42
42
|
font-variant-numeric: tabular-nums;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
.commandKey { min-width: 38px; height: 24px; padding: 0
|
|
45
|
+
.commandKey { min-width: 38px; height: 24px; padding: 0 var(--space-related); gap: var(--space-hair); }
|
|
46
46
|
.clearButton { display: grid; width: 24px; height: 24px; flex: none; place-items: center; border: 0; border-radius: var(--radius-detail); background: transparent; color: var(--text-muted); cursor: pointer; transition: color var(--duration-fast) var(--ease-standard), background-color var(--duration-fast) var(--ease-standard); }
|
|
47
47
|
@media (hover: hover) and (pointer: fine) { .clearButton:hover, .closeButton:hover { background: var(--surface); color: var(--foreground); } }
|
|
48
48
|
.clearButton:active, .closeButton:active { background: var(--surface); color: var(--foreground); }
|
|
49
|
-
.closeButton { display: grid; min-width: 27px; height: 24px; flex: none; place-items: center; border: 1px solid var(--border-subtle); border-radius: var(--radius-detail); background: transparent; color: var(--text-muted); padding: 0
|
|
49
|
+
.closeButton { display: grid; min-width: 27px; height: 24px; flex: none; place-items: center; border: 1px solid var(--border-subtle); border-radius: var(--radius-detail); background: transparent; color: var(--text-muted); padding: 0 var(--space-related); font: inherit; font-size: var(--text-xs); font-weight: 500; line-height: 1; cursor: pointer; transition: color var(--duration-fast) var(--ease-standard), background-color var(--duration-fast) var(--ease-standard); }
|
|
50
50
|
|
|
51
51
|
/* The frame animates to the list height; the list keeps its own scroll. */
|
|
52
52
|
.resultsFrame { overflow: hidden; }
|
|
53
|
-
.results { position: relative; max-height: 342px; overflow: auto; padding:
|
|
54
|
-
.highlight { position: absolute; top: 0; right:
|
|
53
|
+
.results { position: relative; max-height: 342px; overflow: auto; padding: var(--space-related) var(--space-related); }
|
|
54
|
+
.highlight { position: absolute; top: 0; right: var(--space-related); left: var(--space-related); border-radius: var(--radius-detail); background: var(--surface-muted); opacity: 0; pointer-events: none; }
|
|
55
55
|
/* Groups are positioned so a row that pops out of the flow is placed against the same box it was measured in, even mid-glide. */
|
|
56
56
|
.group { position: relative; }
|
|
57
|
-
.group + .group { margin-top:
|
|
58
|
-
.groupHeading { display: block; padding:
|
|
57
|
+
.group + .group { margin-top: var(--space-related); }
|
|
58
|
+
.groupHeading { display: block; padding: var(--space-related) var(--space-related) var(--space-tight); color: var(--text-muted); font-size: var(--text-xs); font-weight: 500; line-height: var(--leading-body); }
|
|
59
59
|
|
|
60
60
|
/* One line per result: the title, then its description in muted text, so the list stays short and scannable. */
|
|
61
|
-
.result { position: relative; display: flex; width: 100%; min-height: 34px; align-items: center; gap:
|
|
61
|
+
.result { position: relative; display: flex; width: 100%; min-height: 34px; align-items: center; gap: var(--space-group); border: 0; border-radius: var(--radius-detail); padding: 0 var(--space-related); background: transparent; color: var(--foreground); text-align: left; cursor: pointer; }
|
|
62
62
|
/* The active row is drawn by the shared highlight; the row itself only tints its icon and arrow. */
|
|
63
63
|
.itemIcon { transition: color var(--duration-fast) var(--ease-standard); }
|
|
64
64
|
.itemIcon { display: grid; width: 16px; height: 16px; flex: none; place-items: center; color: var(--text-muted); }
|
|
65
65
|
.itemIcon svg { width: 16px; height: 16px; }
|
|
66
|
-
.resultCopy { display: flex; min-width: 0; flex: 1; align-items: baseline; gap:
|
|
66
|
+
.resultCopy { display: flex; min-width: 0; flex: 1; align-items: baseline; gap: var(--space-related); }
|
|
67
67
|
.resultCopy strong, .resultCopy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
68
68
|
.resultCopy strong { flex: none; max-width: 100%; }
|
|
69
69
|
.resultCopy small { min-width: 0; }
|
|
70
70
|
.resultCopy strong { font-size: var(--text-sm); font-weight: 500; }
|
|
71
71
|
.resultCopy small { color: var(--text-muted); font-size: var(--text-xs); }
|
|
72
|
-
.shortcut { min-width: 18px; height: 18px; padding: 0
|
|
72
|
+
.shortcut { min-width: 18px; height: 18px; padding: 0 var(--space-tight); border-color: transparent; border-radius: var(--radius-detail); font-size: var(--text-xs); }
|
|
73
73
|
.activeResult .itemIcon { color: var(--foreground); }
|
|
74
|
-
.empty { display: grid; justify-items: center; gap:
|
|
75
|
-
.empty > span { display: grid; width: 32px; height: 32px; place-items: center; margin-bottom:
|
|
74
|
+
.empty { display: grid; justify-items: center; gap: var(--space-tight); padding: var(--space-section) var(--space-group) var(--space-block); text-align: center; }
|
|
75
|
+
.empty > span { display: grid; width: 32px; height: 32px; place-items: center; margin-bottom: var(--space-tight); color: var(--text-muted); }
|
|
76
76
|
.empty strong { font-size: var(--text-sm); font-weight: 500; }
|
|
77
77
|
.empty small { color: var(--text-muted); font-size: var(--text-xs); }
|
|
78
78
|
.visuallyHidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
|
|
79
79
|
|
|
80
80
|
@media (max-width: 480px) {
|
|
81
|
-
.searchRow { gap:
|
|
82
|
-
.results { padding:
|
|
83
|
-
.highlight { right:
|
|
84
|
-
.result { gap:
|
|
81
|
+
.searchRow { gap: var(--space-related); padding: var(--space-related) var(--space-group); }
|
|
82
|
+
.results { padding: var(--space-related); }
|
|
83
|
+
.highlight { right: var(--space-related); left: var(--space-related); }
|
|
84
|
+
.result { gap: var(--space-related); }
|
|
85
85
|
.shortcut, .commandKey { display: none; }
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
@media (max-width: 340px) {
|
|
89
|
-
.result { padding-inline:
|
|
89
|
+
.result { padding-inline: var(--space-related); }
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
@media (prefers-reduced-motion: reduce) {
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
/* Header */
|
|
20
20
|
.thread { display: grid; }
|
|
21
|
-
.header { display: flex; align-items: center; justify-content: space-between; gap:
|
|
21
|
+
.header { display: flex; align-items: center; justify-content: space-between; gap: var(--space-group); padding: var(--space-group) var(--space-group) var(--space-related) var(--space-comfort); }
|
|
22
22
|
.heading { display: grid; min-width: 0; }
|
|
23
23
|
.title { margin: 0; overflow: hidden; font-size: var(--text-sm); font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
|
|
24
24
|
.subtitle { color: var(--text-muted); font-size: var(--text-xs); font-variant-numeric: tabular-nums; }
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
height: 32px;
|
|
29
29
|
flex: none;
|
|
30
30
|
align-items: center;
|
|
31
|
-
gap:
|
|
32
|
-
padding: 0
|
|
31
|
+
gap: var(--space-related);
|
|
32
|
+
padding: 0 var(--space-group) 0 var(--space-group);
|
|
33
33
|
border: 1px solid var(--border);
|
|
34
34
|
border-radius: var(--radius-full); corner-shape: round;
|
|
35
35
|
background: var(--surface);
|
|
@@ -46,32 +46,32 @@
|
|
|
46
46
|
|
|
47
47
|
/* Comments */
|
|
48
48
|
.list, .replies { display: grid; margin: 0; padding: 0; list-style: none; }
|
|
49
|
-
.list { padding: 0
|
|
49
|
+
.list { padding: 0 var(--space-related); }
|
|
50
50
|
.item { overflow: clip; overflow-clip-margin: 4px; }
|
|
51
51
|
.repliesWrap { overflow: clip; }
|
|
52
52
|
/* Replies hang from a quiet rail under their parent's avatar. */
|
|
53
|
-
.replies { position: relative; margin-left:
|
|
54
|
-
.replies::before { content: ""; position: absolute; top:
|
|
53
|
+
.replies { position: relative; margin-left: var(--space-section); padding-left: var(--space-group); }
|
|
54
|
+
.replies::before { content: ""; position: absolute; top: var(--space-hair); bottom: var(--space-inset); left: 0; width: 1px; background: var(--border); }
|
|
55
55
|
|
|
56
|
-
.comment { display: flex; gap:
|
|
56
|
+
.comment { display: flex; gap: var(--space-group); padding: var(--space-group); border-radius: var(--radius-control); corner-shape: var(--corner-shape); }
|
|
57
57
|
.avatar { display: inline-grid; flex: none; place-items: center; overflow: hidden; border-radius: 50%; corner-shape: round; background: var(--surface-muted); color: var(--text-secondary); font-size: var(--text-xs); font-weight: 500; letter-spacing: 0; object-fit: cover; }
|
|
58
58
|
.deletedDot { width: 28px; height: 28px; flex: none; border: 1px dashed var(--border-strong); border-radius: 50%; corner-shape: round; }
|
|
59
|
-
.main { display: grid; min-width: 0; flex: 1; gap:
|
|
60
|
-
.meta { display: flex; min-width: 0; align-items: baseline; gap:
|
|
59
|
+
.main { display: grid; min-width: 0; flex: 1; gap: var(--space-hair); }
|
|
60
|
+
.meta { display: flex; min-width: 0; align-items: baseline; gap: var(--space-related); }
|
|
61
61
|
.name { overflow: hidden; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
|
|
62
62
|
.time { flex: none; color: var(--text-muted); font-size: var(--text-xs); }
|
|
63
63
|
.body { margin: 0; color: var(--text-secondary); overflow-wrap: anywhere; white-space: pre-wrap; text-wrap: pretty; }
|
|
64
64
|
.mention { color: var(--accent-strong); font-weight: 500; }
|
|
65
|
-
.deleted { margin:
|
|
65
|
+
.deleted { margin: var(--space-tight) 0 0; color: var(--text-muted); font-style: italic; }
|
|
66
66
|
|
|
67
|
-
.footer { display: flex; min-height: 30px; flex-wrap: wrap; align-items: center; gap:
|
|
68
|
-
.reactions { display: flex; flex-wrap: wrap; gap:
|
|
67
|
+
.footer { display: flex; min-height: 30px; flex-wrap: wrap; align-items: center; gap: var(--space-tight) var(--space-related); margin-top: var(--space-tight); }
|
|
68
|
+
.reactions { display: flex; flex-wrap: wrap; gap: var(--space-tight); }
|
|
69
69
|
.reaction {
|
|
70
70
|
display: inline-flex;
|
|
71
71
|
height: 26px;
|
|
72
72
|
align-items: center;
|
|
73
|
-
gap:
|
|
74
|
-
padding: 0
|
|
73
|
+
gap: var(--space-tight);
|
|
74
|
+
padding: 0 var(--space-related) 0 var(--space-related);
|
|
75
75
|
border: 1px solid var(--border);
|
|
76
76
|
border-radius: var(--radius-full); corner-shape: round;
|
|
77
77
|
background: var(--surface);
|
|
@@ -88,14 +88,14 @@
|
|
|
88
88
|
.count > span { grid-area: 1 / 1; }
|
|
89
89
|
|
|
90
90
|
/* Actions sit quietly after the reactions and come forward on hover or focus; touch screens always show them. */
|
|
91
|
-
.actions { display: flex; min-height: 28px; flex-wrap: wrap; align-items: center; gap:
|
|
91
|
+
.actions { display: flex; min-height: 28px; flex-wrap: wrap; align-items: center; gap: var(--space-hair); transition: opacity var(--duration-fast) var(--ease-standard); }
|
|
92
92
|
.action,
|
|
93
93
|
.iconAction {
|
|
94
94
|
display: inline-flex;
|
|
95
95
|
height: 28px;
|
|
96
96
|
align-items: center;
|
|
97
97
|
justify-content: center;
|
|
98
|
-
padding: 0
|
|
98
|
+
padding: 0 var(--space-related);
|
|
99
99
|
border: 0;
|
|
100
100
|
border-radius: var(--radius-full); corner-shape: round;
|
|
101
101
|
background: transparent;
|
|
@@ -109,34 +109,34 @@
|
|
|
109
109
|
}
|
|
110
110
|
.iconAction { width: 28px; padding: 0; }
|
|
111
111
|
.action[data-tone="danger"] { color: var(--danger); }
|
|
112
|
-
.prompt { margin-right:
|
|
112
|
+
.prompt { margin-right: var(--space-tight); color: var(--foreground); font-size: var(--text-xs); }
|
|
113
113
|
.emoji { display: grid; width: 28px; height: 28px; place-items: center; padding: 0; border: 0; border-radius: 50%; corner-shape: round; background: transparent; cursor: pointer; font-size: var(--text-base); line-height: 1; transition: background-color var(--duration-fast) var(--ease-standard), transform var(--duration-instant) var(--ease-standard); }
|
|
114
114
|
.emoji[aria-pressed="true"] { background: var(--accent-subtle); }
|
|
115
115
|
.emoji:active { transform: scale(.88); }
|
|
116
116
|
|
|
117
|
-
.toggle { display: inline-flex; width: fit-content; height: 28px; align-items: center; gap:
|
|
117
|
+
.toggle { display: inline-flex; width: fit-content; height: 28px; align-items: center; gap: var(--space-related); margin: var(--space-hair) 0 0 calc(var(--space-related) * -1); padding: 0 var(--space-related) 0 var(--space-related); border: 0; border-radius: var(--radius-full); corner-shape: round; background: transparent; color: var(--text-secondary); cursor: pointer; font: inherit; font-size: var(--text-xs); font-weight: 500; transition: background-color var(--duration-fast) var(--ease-standard); }
|
|
118
118
|
.toggleIcon { display: grid; place-items: center; color: var(--text-muted); }
|
|
119
|
-
.stack { display: inline-flex; flex: none; padding-left:
|
|
120
|
-
.stack > * { margin-left: -
|
|
119
|
+
.stack { display: inline-flex; flex: none; padding-left: var(--space-tight); }
|
|
120
|
+
.stack > * { margin-left: calc(var(--space-tight) * -1); box-shadow: 0 0 0 2px var(--surface); }
|
|
121
121
|
|
|
122
|
-
.empty { margin: 0; padding:
|
|
122
|
+
.empty { margin: 0; padding: var(--space-related) var(--space-comfort) var(--space-inset); color: var(--text-muted); }
|
|
123
123
|
|
|
124
124
|
/* Composer */
|
|
125
|
-
.composerArea { display: grid; margin-top:
|
|
125
|
+
.composerArea { display: grid; margin-top: var(--space-tight); padding: var(--space-group) var(--space-group) var(--space-group); border-top: 1px solid var(--border-subtle); }
|
|
126
126
|
.replying { overflow: clip; }
|
|
127
|
-
.replyingInner { display: flex; align-items: center; gap:
|
|
128
|
-
.replyingInner .iconAction { width: 22px; height: 22px; margin-left:
|
|
127
|
+
.replyingInner { display: flex; align-items: center; gap: var(--space-related); padding: 0 var(--space-hair) var(--space-related) var(--space-block); color: var(--text-secondary); font-size: var(--text-xs); }
|
|
128
|
+
.replyingInner .iconAction { width: 22px; height: 22px; margin-left: var(--space-hair); }
|
|
129
129
|
.replyingName { color: var(--foreground); font-weight: 500; }
|
|
130
130
|
|
|
131
|
-
.composer { display: grid; align-items: start; gap:
|
|
132
|
-
.composer > .avatar { margin-top:
|
|
133
|
-
.composer[data-compact] { grid-template-columns: minmax(0, 1fr); margin-top:
|
|
131
|
+
.composer { display: grid; align-items: start; gap: var(--space-related) var(--space-group); grid-template-columns: auto minmax(0, 1fr) auto; }
|
|
132
|
+
.composer > .avatar { margin-top: var(--space-tight); }
|
|
133
|
+
.composer[data-compact] { grid-template-columns: minmax(0, 1fr); margin-top: var(--space-tight); }
|
|
134
134
|
.fieldWrap { display: grid; min-width: 0; }
|
|
135
135
|
.field {
|
|
136
136
|
width: 100%;
|
|
137
137
|
min-height: 38px;
|
|
138
138
|
max-height: 160px;
|
|
139
|
-
padding:
|
|
139
|
+
padding: var(--space-related) var(--space-group);
|
|
140
140
|
border: 1px solid var(--border);
|
|
141
141
|
border-radius: var(--radius-control); corner-shape: var(--corner-shape);
|
|
142
142
|
background: var(--surface);
|
|
@@ -148,22 +148,22 @@
|
|
|
148
148
|
}
|
|
149
149
|
.field::placeholder { color: var(--text-muted); }
|
|
150
150
|
.field:focus { border-color: var(--border-strong); }
|
|
151
|
-
.composerActions { display: flex; align-items: center; gap:
|
|
151
|
+
.composerActions { display: flex; align-items: center; gap: var(--space-tight); }
|
|
152
152
|
.composer[data-compact] .composerActions { justify-content: flex-end; }
|
|
153
153
|
.send,
|
|
154
|
-
.ghost { height: 38px; padding: 0
|
|
154
|
+
.ghost { height: 38px; padding: 0 var(--space-inset); border: 0; border-radius: var(--radius-full); corner-shape: round; cursor: pointer; font: inherit; font-weight: 500; transition: background-color var(--duration-fast) var(--ease-standard), opacity var(--duration-fast) var(--ease-standard), transform var(--duration-instant) var(--ease-standard); }
|
|
155
155
|
.composer[data-compact] :is(.send, .ghost) { height: 32px; font-size: var(--text-xs); }
|
|
156
156
|
.send { background: var(--foreground); color: var(--background); }
|
|
157
157
|
.send:disabled { opacity: .35; cursor: default; }
|
|
158
158
|
.send:active:not(:disabled), .ghost:active { transform: scale(.97); }
|
|
159
159
|
.ghost { background: transparent; color: var(--text-secondary); }
|
|
160
160
|
|
|
161
|
-
.suggestions { display: grid; margin:
|
|
162
|
-
.suggestion { display: flex; align-items: center; gap:
|
|
161
|
+
.suggestions { display: grid; margin: var(--space-related) 0 0; padding: var(--space-tight); overflow: clip; border: 1px solid var(--border); border-radius: var(--radius-control); corner-shape: var(--corner-shape); background: var(--surface-raised); list-style: none; }
|
|
162
|
+
.suggestion { display: flex; align-items: center; gap: var(--space-related); min-height: 32px; padding: 0 var(--space-related); border-radius: var(--radius-detail); corner-shape: var(--corner-shape); cursor: pointer; }
|
|
163
163
|
.suggestion[aria-selected="true"] { background: var(--surface-muted); }
|
|
164
164
|
|
|
165
165
|
/* Resolved chip */
|
|
166
|
-
.resolved { display: flex; align-items: center; gap:
|
|
166
|
+
.resolved { display: flex; align-items: center; gap: var(--space-group); padding: var(--space-group) var(--space-group) var(--space-group) var(--space-inset); }
|
|
167
167
|
.resolvedIcon { display: grid; width: 24px; height: 24px; flex: none; place-items: center; border-radius: 50%; corner-shape: round; background: color-mix(in oklab, var(--success) 14%, transparent); color: var(--success); }
|
|
168
168
|
.resolvedText { display: grid; min-width: 0; flex: 1; }
|
|
169
169
|
.resolvedTitle { overflow: hidden; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
|
|
@@ -186,8 +186,8 @@
|
|
|
186
186
|
@media (max-width: 420px) {
|
|
187
187
|
.composer { grid-template-columns: minmax(0, 1fr) auto; }
|
|
188
188
|
.composer > .avatar { display: none; }
|
|
189
|
-
.replyingInner { padding-left:
|
|
190
|
-
.replies { margin-left:
|
|
189
|
+
.replyingInner { padding-left: var(--space-hair); }
|
|
190
|
+
.replies { margin-left: var(--space-group); }
|
|
191
191
|
}
|
|
192
192
|
|
|
193
193
|
@media (prefers-reduced-motion: reduce) {
|
|
@@ -34,9 +34,9 @@ const faceVariants = {
|
|
|
34
34
|
};
|
|
35
35
|
const partVariants = {
|
|
36
36
|
hidden: { opacity: 0, filter: `blur(${blur.soft}px)` },
|
|
37
|
-
shown: { opacity: 1, filter: "blur(0px)", transition: { duration: .
|
|
37
|
+
shown: { opacity: 1, filter: "blur(0px)", transition: { duration: motionTokens.duration.exit, ease: enter } },
|
|
38
38
|
};
|
|
39
|
-
const reducedFace = { hidden: { opacity: 0 }, shown: { opacity: 1, transition: { duration: .
|
|
39
|
+
const reducedFace = { hidden: { opacity: 0 }, shown: { opacity: 1, transition: { duration: motionTokens.duration.fast } }, gone: { opacity: 0, transition: { duration: motionTokens.duration.instant } } };
|
|
40
40
|
const reducedPart = { hidden: { opacity: 1 }, shown: { opacity: 1 } };
|
|
41
41
|
function Face({ id, reduced, onSize, children, labelledBy }) {
|
|
42
42
|
const ref = useRef(null);
|
|
@@ -61,7 +61,7 @@ function Part({ reduced, className, children }) {
|
|
|
61
61
|
}
|
|
62
62
|
/** A success disc that pops in with a tick drawing across it, the moment the action lands. */
|
|
63
63
|
function Check({ reduced }) {
|
|
64
|
-
return _jsxs("svg", { className: styles.check, viewBox: "0 0 18 18", fill: "none", "aria-hidden": "true", children: [_jsx(motion.circle, { className: styles.checkDisc, cx: "9", cy: "9", r: "8", style: { transformOrigin: "9px 9px" }, initial: reduced ? false : { scale: .5, opacity: 0 }, animate: { scale: 1, opacity: 1 }, transition: { scale: physical(motionTokens.spring.snappy), opacity: { duration: .
|
|
64
|
+
return _jsxs("svg", { className: styles.check, viewBox: "0 0 18 18", fill: "none", "aria-hidden": "true", children: [_jsx(motion.circle, { className: styles.checkDisc, cx: "9", cy: "9", r: "8", style: { transformOrigin: "9px 9px" }, initial: reduced ? false : { scale: .5, opacity: 0 }, animate: { scale: 1, opacity: 1 }, transition: { scale: physical(motionTokens.spring.snappy), opacity: { duration: motionTokens.duration.instant } } }), _jsx(motion.path, { className: styles.checkTick, d: "M5.6 9.3 7.8 11.4 12.4 6.7", strokeWidth: "1.9", strokeLinecap: "round", strokeLinejoin: "round", initial: reduced ? false : { pathLength: 0 }, animate: { pathLength: 1 }, transition: { duration: .3, ease: enter, delay: .14 } })] });
|
|
65
65
|
}
|
|
66
66
|
/** A ring that drains with the countdown. */
|
|
67
67
|
function Ring({ progress }) {
|
|
@@ -69,7 +69,7 @@ function Ring({ progress }) {
|
|
|
69
69
|
}
|
|
70
70
|
/** Seconds that swap in place: the old digit fades up and out, the new one rises in, on tabular figures so the width holds. */
|
|
71
71
|
function Seconds({ value, reduced }) {
|
|
72
|
-
return _jsx("span", { className: styles.seconds, children: _jsx(AnimatePresence, { initial: false, mode: "popLayout", children: _jsx(motion.span, { className: styles.digit, initial: reduced ? { opacity: 0 } : { opacity: 0, y: 6, filter: `blur(${blur.subtle}px)` }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, exit: reduced ? { opacity: 0 } : { opacity: 0, y: -6, filter: `blur(${blur.subtle}px)` }, transition: { duration: .
|
|
72
|
+
return _jsx("span", { className: styles.seconds, children: _jsx(AnimatePresence, { initial: false, mode: "popLayout", children: _jsx(motion.span, { className: styles.digit, initial: reduced ? { opacity: 0 } : { opacity: 0, y: 6, filter: `blur(${blur.subtle}px)` }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, exit: reduced ? { opacity: 0 } : { opacity: 0, y: -6, filter: `blur(${blur.subtle}px)` }, transition: { duration: motionTokens.duration.exit, ease: enter }, children: value }, value) }) });
|
|
73
73
|
}
|
|
74
74
|
export function ConfirmMorph({ label, icon, prompt, confirmLabel = "Delete", cancelLabel = "Cancel", pendingLabel = "Deleting", doneLabel = "Deleted", errorLabel = "Couldn’t finish", retryLabel = "Retry", undoLabel = "Undo", undoingLabel = "Restoring", tone = "danger", confirmMode = "press", holdDuration = 1000, countdown = 3, countdownLabel, onConfirm, onUndo, onCancel, state: stateProp, defaultState = "idle", onStateChange, confirmTimeout = 6000, resultTimeout = 5000, cancelOnOutsidePress = true, disabled = false, className, ref, }) {
|
|
75
75
|
const reduced = useReducedFlag();
|
|
@@ -252,7 +252,7 @@ export function ConfirmMorph({ label, icon, prompt, confirmLabel = "Delete", can
|
|
|
252
252
|
holding.current = null;
|
|
253
253
|
control.stop();
|
|
254
254
|
if (hold.get() < 1) {
|
|
255
|
-
animate(hold, 0, reduced ? { duration: 0 } : { type: "spring", visualDuration: .
|
|
255
|
+
animate(hold, 0, reduced ? { duration: 0 } : { type: "spring", visualDuration: motionTokens.spring.fast.visualDuration, bounce: 0 });
|
|
256
256
|
setAnnouncement(`Keep holding to ${confirmLabel.toLowerCase()}`);
|
|
257
257
|
}
|
|
258
258
|
};
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
.root[data-disabled][data-state="idle"] .surface { box-shadow: none; }
|
|
35
35
|
.root[data-disabled][data-state="idle"] .surface::after { border-color: var(--border-subtle); }
|
|
36
36
|
|
|
37
|
-
.face { display: flex; flex: none; height: 100%; align-items: center; gap:
|
|
37
|
+
.face { display: flex; flex: none; height: 100%; align-items: center; gap: var(--space-hair); padding: 0 var(--space-tight); white-space: nowrap; }
|
|
38
38
|
.face[data-face="idle"] { padding: 0; }
|
|
39
39
|
/* A leaving face steps out of the flow, exactly where it was, and fades while the pill springs to the next one. */
|
|
40
40
|
.face[inert] { position: absolute; top: 0; inset-inline-start: 0; pointer-events: none; }
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
display: inline-flex;
|
|
45
45
|
height: 100%;
|
|
46
46
|
align-items: center;
|
|
47
|
-
gap:
|
|
48
|
-
padding: 0
|
|
47
|
+
gap: var(--space-related);
|
|
48
|
+
padding: 0 var(--space-inset) 0 var(--space-inset);
|
|
49
49
|
border: 0;
|
|
50
50
|
border-radius: var(--radius-full); corner-shape: round;
|
|
51
51
|
background: transparent;
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
.trigger:disabled .icon { color: inherit; }
|
|
63
63
|
.icon > svg { width: 16px; height: 16px; }
|
|
64
64
|
|
|
65
|
-
.prompt { max-width: 16rem; overflow: hidden; padding: 0
|
|
65
|
+
.prompt { max-width: 16rem; overflow: hidden; padding: 0 var(--space-related) 0 var(--space-group); color: var(--foreground); font-weight: 500; font-variant-numeric: tabular-nums; }
|
|
66
66
|
.prompt > span { overflow: hidden; text-overflow: ellipsis; }
|
|
67
67
|
|
|
68
68
|
.secondary,
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
height: calc(var(--control-height-sm) - 8px);
|
|
74
74
|
align-items: center;
|
|
75
75
|
justify-content: center;
|
|
76
|
-
padding: 0
|
|
76
|
+
padding: 0 var(--space-group);
|
|
77
77
|
border: 0;
|
|
78
78
|
border-radius: var(--radius-full); corner-shape: round;
|
|
79
79
|
cursor: pointer;
|
|
@@ -97,12 +97,12 @@
|
|
|
97
97
|
.fill { position: absolute; inset: 0; display: inline-flex; align-items: center; justify-content: center; background: var(--danger); color: var(--background); pointer-events: none; }
|
|
98
98
|
.root[data-tone="neutral"] .fill { background: var(--accent-strong); color: var(--accent-foreground); }
|
|
99
99
|
|
|
100
|
-
.status { gap:
|
|
100
|
+
.status { gap: var(--space-related); padding: 0 var(--space-group) 0 var(--space-group); color: var(--foreground); font-weight: 500; font-variant-numeric: tabular-nums; }
|
|
101
101
|
.status > svg { flex: none; }
|
|
102
102
|
.statusText { display: inline-flex; align-items: baseline; gap: .25em; }
|
|
103
|
-
.face[data-face="pending"] .status { padding-inline:
|
|
104
|
-
.face[data-face="done"]:not(:has(.secondary)) .status { padding-right:
|
|
105
|
-
.face[data-face="counting"] .status { padding-right:
|
|
103
|
+
.face[data-face="pending"] .status { padding-inline: var(--space-group) var(--space-inset); color: var(--text-secondary); }
|
|
104
|
+
.face[data-face="done"]:not(:has(.secondary)) .status { padding-right: var(--space-inset); }
|
|
105
|
+
.face[data-face="counting"] .status { padding-right: var(--space-related); color: var(--text-secondary); }
|
|
106
106
|
.alert { color: var(--danger); }
|
|
107
107
|
.check { width: 18px; height: 18px; }
|
|
108
108
|
.checkDisc { fill: var(--success); }
|
|
@@ -5,6 +5,7 @@ import { useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
|
5
5
|
import { AnimatePresence, motion, useReducedMotion } from "motion/react";
|
|
6
6
|
import { Check, Copy, MoreHorizontal, Trash2 } from "lucide-react";
|
|
7
7
|
import { motionTokens } from "../../lib/motion-tokens.js";
|
|
8
|
+
import { MenuHighlight, useMenuHighlight } from "../../lib/menu-highlight.js";
|
|
8
9
|
import styles from "./context-menu.module.css";
|
|
9
10
|
const MENU_WIDTH = 208;
|
|
10
11
|
// Keeps the menu 8px inside the viewport. Rows are 34px with 5px padding and a 1px border; the real size is measured before paint.
|
|
@@ -22,11 +23,10 @@ export function ContextMenu({ children, items, label = "Context menu" }) {
|
|
|
22
23
|
// Each open gets its own key, so reopening at a new point fades the old menu out in place
|
|
23
24
|
// and grows a fresh one from the pointer instead of teleporting the visible menu.
|
|
24
25
|
const [point, setPoint] = useState({ x: 0, y: 0, originX: 0, originY: 0, key: 0 });
|
|
25
|
-
|
|
26
|
+
// Fluid hover: the nearest row is lit, gaps and padding included, and a click in a gap picks it.
|
|
27
|
+
const { highlight, reset, contentProps } = useMenuHighlight();
|
|
26
28
|
const menuRef = useRef(null);
|
|
27
29
|
const targetRef = useRef(null);
|
|
28
|
-
const pointer = useRef(false);
|
|
29
|
-
const clearTimer = useRef(0);
|
|
30
30
|
// A primary press on the target while the menu is open closes it; the click that follows must not reopen it.
|
|
31
31
|
const pressedWhileOpen = useRef(false);
|
|
32
32
|
// An exiting menu keeps its last props, so its handlers check this before moving focus or selecting.
|
|
@@ -41,7 +41,6 @@ export function ContextMenu({ children, items, label = "Context menu" }) {
|
|
|
41
41
|
const next = clampTo(anchor.current.x, anchor.current.y, node.offsetWidth, node.offsetHeight);
|
|
42
42
|
setPoint(current => (current.x === next.x && current.y === next.y && current.originX === next.originX && current.originY === next.originY ? current : { ...next, key: current.key }));
|
|
43
43
|
}, [open, point.key]);
|
|
44
|
-
useEffect(() => () => window.clearTimeout(clearTimer.current), []);
|
|
45
44
|
useEffect(() => {
|
|
46
45
|
if (!open)
|
|
47
46
|
return;
|
|
@@ -68,9 +67,7 @@ export function ContextMenu({ children, items, label = "Context menu" }) {
|
|
|
68
67
|
anchor.current = { x, y };
|
|
69
68
|
const estimate = clampTo(x, y, MENU_WIDTH, Math.min(300, items.length * 34 + 12));
|
|
70
69
|
setPoint(current => ({ ...estimate, key: current.key + 1 }));
|
|
71
|
-
|
|
72
|
-
pointer.current = false;
|
|
73
|
-
setHighlight(null);
|
|
70
|
+
reset();
|
|
74
71
|
setPortal(true);
|
|
75
72
|
setOpen(true);
|
|
76
73
|
}
|
|
@@ -114,30 +111,15 @@ export function ContextMenu({ children, items, label = "Context menu" }) {
|
|
|
114
111
|
targetRef.current?.focus();
|
|
115
112
|
}
|
|
116
113
|
}
|
|
117
|
-
|
|
118
|
-
window.clearTimeout(clearTimer.current);
|
|
119
|
-
const next = { index: Number(item.dataset.index), top: item.offsetTop, height: item.offsetHeight, danger: item.dataset.tone === "danger" };
|
|
120
|
-
setHighlight(current => ({ ...next, glide: glide && current !== null }));
|
|
121
|
-
}
|
|
122
|
-
// Keyboard focus places the highlight instantly; the pointer makes it glide between rows.
|
|
114
|
+
// Keyboard focus lights its row at once. A pointer-opened menu focuses its first row without lighting it, like a native menu.
|
|
123
115
|
function onMenuFocus(event) {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
// A pointer-opened menu focuses its first row without showing a highlight, like a native menu.
|
|
127
|
-
if (!pointer.current && item.matches(":focus-visible"))
|
|
128
|
-
place(item, false);
|
|
129
|
-
return;
|
|
130
|
-
}
|
|
131
|
-
// A short grace period keeps the highlight gliding across the gap between rows.
|
|
132
|
-
window.clearTimeout(clearTimer.current);
|
|
133
|
-
clearTimer.current = window.setTimeout(() => setHighlight(null), pointer.current ? 70 : 0);
|
|
116
|
+
if (event.target instanceof HTMLElement && event.target.matches(":focus-visible"))
|
|
117
|
+
contentProps.onFocus(event);
|
|
134
118
|
}
|
|
135
119
|
return _jsxs(_Fragment, { children: [_jsx("div", { ref: targetRef, className: styles.target, tabIndex: 0, onPointerDown: event => { pressedWhileOpen.current = open && event.button === 0; }, onClick: onTargetClick, onContextMenu: event => { event.preventDefault(); showMenu(event.clientX, event.clientY); }, onKeyDown: onTargetKeyDown, "aria-label": label, "aria-haspopup": "menu", "aria-expanded": open, children: children }), portal ? createPortal(_jsx(AnimatePresence, { children: open && _jsxs(motion.div, { ref: node => { if (node)
|
|
136
|
-
menuRef.current = node; }, className: styles.menu, role: "menu", "aria-label": label, tabIndex: -1, style: { left: point.x, top: point.y, transformOrigin: `${point.originX}px ${point.originY}px` }, onKeyDown: onMenuKeyDown, onFocus: onMenuFocus,
|
|
137
|
-
event.currentTarget.focus({ preventScroll: true }); }, initial: reduced ? { opacity: 0 } : { opacity: 0, scale: .96 }, animate: { opacity: 1, scale: 1 }, exit: reduced ? { opacity: 0, transition: { duration: motionTokens.duration.instant } } : { opacity: 0, scale: .98, transition: { duration: motionTokens.duration.instant, ease: [...motionTokens.ease.standard] } }, transition: reduced ? { duration: motionTokens.duration.instant } : { default: motionTokens.spring.snappy, opacity: { duration: motionTokens.duration.fast, ease: [...motionTokens.ease.enter] } }, children: [_jsx(
|
|
138
|
-
|
|
139
|
-
event.currentTarget.focus({ preventScroll: true }); if (highlight?.index !== index)
|
|
140
|
-
place(event.currentTarget, true); }, onPointerLeave: () => { if (live.current)
|
|
120
|
+
menuRef.current = node; }, className: styles.menu, role: "menu", "aria-label": label, tabIndex: -1, style: { left: point.x, top: point.y, transformOrigin: `${point.originX}px ${point.originY}px` }, onKeyDown: onMenuKeyDown, ...contentProps, onFocus: onMenuFocus, onPointerLeave: event => { if (live.current)
|
|
121
|
+
event.currentTarget.focus({ preventScroll: true }); }, initial: reduced ? { opacity: 0 } : { opacity: 0, scale: .96 }, animate: { opacity: 1, scale: 1 }, exit: reduced ? { opacity: 0, transition: { duration: motionTokens.duration.instant } } : { opacity: 0, scale: .98, transition: { duration: motionTokens.duration.instant, ease: [...motionTokens.ease.standard] } }, transition: reduced ? { duration: motionTokens.duration.instant } : { default: motionTokens.spring.snappy, opacity: { duration: motionTokens.duration.fast, ease: [...motionTokens.ease.enter] } }, children: [_jsx(MenuHighlight, { state: highlight, className: styles.highlight }), items.map((item, index) => _jsxs("button", { type: "button", role: "menuitem", tabIndex: -1, "data-index": index, "data-tone": item.destructive ? "danger" : undefined, style: { "--i": index }, disabled: item.disabled, className: [styles.item, item.destructive ? styles.destructive : ""].filter(Boolean).join(" "), onPointerMove: event => { if (live.current && document.activeElement !== event.currentTarget)
|
|
122
|
+
event.currentTarget.focus({ preventScroll: true }); }, onPointerLeave: () => { if (live.current)
|
|
141
123
|
menuRef.current?.focus({ preventScroll: true }); }, onClick: () => { if (!live.current)
|
|
142
124
|
return; live.current = false; item.onSelect?.(); setOpen(false); targetRef.current?.focus(); }, children: [_jsx("span", { className: styles.icon, "aria-hidden": "true", children: item.icon ?? (item.checked ? _jsx(Check, { size: 15 }) : _jsx(MoreHorizontal, { size: 15 })) }), _jsx("span", { children: item.label })] }, item.id))] }, point.key) }), document.body) : null] });
|
|
143
125
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
.target { display: block; outline: none; }
|
|
2
2
|
/* Motion scales the menu from the pointer (transform-origin is set inline) and fades it out faster than it arrives. */
|
|
3
|
-
.menu { position: fixed; z-index:
|
|
4
|
-
.highlight { position: absolute; top: 0; right:
|
|
3
|
+
.menu { position: fixed; z-index: var(--layer-dropdown); min-width: min(13rem, calc(100vw - 16px)); max-width: calc(100vw - 16px); max-height: min(300px, calc(100vh - 16px)); overflow-y: auto; padding: var(--space-tight); border: 1px solid var(--border); border-radius: var(--radius-container); background: var(--surface-raised); color: var(--foreground); box-shadow: var(--shadow-floating); outline: none; }
|
|
4
|
+
.highlight { position: absolute; top: 0; right: var(--space-tight); left: var(--space-tight); border-radius: calc(var(--radius-container) - var(--space-related)); background: var(--surface-muted); opacity: 0; pointer-events: none; transition: background-color var(--duration-fast) var(--ease-standard); }
|
|
5
5
|
.highlight[data-tone="danger"] { background: color-mix(in oklab, var(--danger) 8%, var(--surface)); }
|
|
6
|
-
.item { position: relative; display: flex; width: 100%; min-height: 34px; align-items: center; gap:
|
|
6
|
+
.item { position: relative; display: flex; width: 100%; min-height: 34px; align-items: center; gap: var(--space-related); padding: 0 var(--space-group); border: 0; border-radius: calc(var(--radius-container) - var(--space-related)); background: transparent; color: inherit; font: inherit; font-size: var(--text-sm); letter-spacing: var(--tracking-body); line-height: var(--leading-body); text-align: left; cursor: pointer; outline: none; transition: background-color var(--duration-instant) var(--ease-standard), color var(--duration-fast) var(--ease-standard); animation: context-item-in var(--duration-standard) var(--ease-enter) both; animation-delay: calc(min(var(--i, 0), 4) * 35ms); }
|
|
7
7
|
/* The gliding highlight is the focus indicator, as in the dropdown menu. */
|
|
8
8
|
.item:focus-visible { outline: none; }
|
|
9
9
|
/* Rows press with a tint, not a scale. */
|
|
@@ -8,9 +8,9 @@ import { useCopyFeedback } from "../../lib/use-copy-feedback.js";
|
|
|
8
8
|
import styles from "./copy-button.module.css";
|
|
9
9
|
/** Copy feedback is deliberately unhurried: a slow, almost critically damped spring and long, soft crossfades read as calm, never busy.
|
|
10
10
|
* The same motion plays in reverse when the confirmation hands back to idle, so nothing ever snaps. */
|
|
11
|
-
const settle = { type: "spring", visualDuration: .
|
|
12
|
-
const enter = { duration: .
|
|
13
|
-
const leave = { duration: .
|
|
11
|
+
const settle = { type: "spring", visualDuration: motionTokens.spring.slow.visualDuration, bounce: .06 };
|
|
12
|
+
const enter = { duration: motionTokens.duration.standard, ease: [...motionTokens.ease.enter] };
|
|
13
|
+
const leave = { duration: motionTokens.duration.exit, ease: [...motionTokens.ease.standard] };
|
|
14
14
|
const instant = { duration: motionTokens.duration.instant };
|
|
15
15
|
const soft = `blur(${motionTokens.blur.soft}px)`;
|
|
16
16
|
const rest = { opacity: 1, y: 0, scale: 1, filter: "blur(0px)" };
|
|
@@ -18,7 +18,7 @@ const fadeIn = { ...rest, opacity: 0 };
|
|
|
18
18
|
const fadeOut = { opacity: 0, transition: instant };
|
|
19
19
|
/** Icons trade places in one soft breath: the old glyph shrinks into a blur while the new one grows out of it on the slow spring. */
|
|
20
20
|
const iconIn = { opacity: 0, scale: .6, filter: soft };
|
|
21
|
-
const iconOut = { opacity: 0, scale: .6, filter: soft, transition: { duration: .
|
|
21
|
+
const iconOut = { opacity: 0, scale: .6, filter: soft, transition: { duration: motionTokens.duration.exit, ease: [...motionTokens.ease.standard] } };
|
|
22
22
|
const iconEnter = { scale: settle, opacity: { ...enter, delay: .03 }, filter: { ...enter, delay: .03 } };
|
|
23
23
|
/** Letters rise about .3em out of a soft blur; the outgoing ones lift away a little faster. */
|
|
24
24
|
const glyphIn = { opacity: 0, y: 4, filter: soft };
|
|
@@ -11,21 +11,21 @@
|
|
|
11
11
|
|
|
12
12
|
.units { display: inline-flex; align-items: flex-start; white-space: nowrap; }
|
|
13
13
|
.unit { display: inline-flex; align-items: flex-start; }
|
|
14
|
-
.group { display: inline-grid; justify-items: center; gap:
|
|
14
|
+
.group { display: inline-grid; justify-items: center; gap: var(--space-related); }
|
|
15
15
|
.number { display: inline-flex; font-variant-numeric: tabular-nums; transition: opacity var(--duration-considered) var(--ease-standard); }
|
|
16
16
|
.countdown[data-pending] .number { opacity: .3; }
|
|
17
17
|
.name { color: var(--text-muted); font-size: var(--text-xs); line-height: 1; }
|
|
18
18
|
.colon { color: var(--text-muted); opacity: .6; }
|
|
19
19
|
|
|
20
20
|
/* Large: display digits sized to the container, so four groups fit at 320px and breathe on a wide card. */
|
|
21
|
-
.countdown[data-variant="large"] .units { gap: 0; font-family: var(--font-display); font-size: clamp(
|
|
21
|
+
.countdown[data-variant="large"] .units { gap: 0; font-family: var(--font-display); font-size: clamp(var(--text-2xl), 12.5cqi, var(--text-5xl)); font-weight: 500; letter-spacing: var(--tracking-display); line-height: 1; }
|
|
22
22
|
.countdown[data-variant="large"] .colon { padding-inline: .12em; line-height: 1; transform: translateY(-.06em); }
|
|
23
23
|
/* On a narrow card the unit names outgrow the digits; an even column floor keeps the colons evenly spaced instead of following each name's width. */
|
|
24
24
|
.countdown[data-variant="large"] .group { min-width: min(calc((100cqi - 1.6em) / 4), calc(var(--text-xs) * 4.2)); }
|
|
25
25
|
.countdown[data-variant="large"] .name { font-family: var(--font-body); letter-spacing: var(--tracking-body); }
|
|
26
26
|
|
|
27
27
|
/* Compact: one line, digits then a quiet unit letter. */
|
|
28
|
-
.countdown[data-variant="compact"] .units { gap:
|
|
28
|
+
.countdown[data-variant="compact"] .units { gap: var(--space-related); font-size: var(--text-sm); font-weight: 500; line-height: 1.3; }
|
|
29
29
|
.countdown[data-variant="compact"] .group { display: inline-flex; align-items: baseline; gap: 1px; }
|
|
30
30
|
.countdown[data-variant="compact"] .name { font-size: var(--text-sm); font-weight: 400; line-height: 1.3; }
|
|
31
31
|
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
|
|
37
37
|
/* Finished: the digits give way to the label and a live mark. */
|
|
38
38
|
.done { display: inline-flex; align-items: center; gap: .4em; white-space: nowrap; }
|
|
39
|
-
.countdown[data-variant="large"] .done { font-family: var(--font-display); font-size: clamp(
|
|
39
|
+
.countdown[data-variant="large"] .done { font-family: var(--font-display); font-size: clamp(var(--text-2xl), 11cqi, var(--text-4xl)); font-weight: 500; letter-spacing: var(--tracking-display); line-height: 1.1; }
|
|
40
40
|
.countdown[data-variant="compact"] .done { color: var(--success); font-size: var(--text-sm); font-weight: 500; line-height: 1.3; }
|
|
41
41
|
.pulse { position: relative; width: .3em; height: .3em; min-width: 8px; min-height: 8px; flex: none; border-radius: 50%; corner-shape: round; background: var(--success); }
|
|
42
42
|
.pulse::after { position: absolute; inset: 0; border-radius: inherit; corner-shape: inherit; background: var(--success); content: ""; animation: pulse 2s var(--ease-standard) infinite; }
|
|
@@ -13,7 +13,7 @@ const instant = { duration: duration.instant };
|
|
|
13
13
|
const valueRoll = {
|
|
14
14
|
enter: (direction) => ({ opacity: 0, y: `${direction * 0.35}em`, filter: `blur(${blur.soft}px)` }),
|
|
15
15
|
center: { opacity: 1, y: 0, filter: "blur(0px)", transition: { duration: duration.standard, ease: ease.enter } },
|
|
16
|
-
exit: (direction) => ({ opacity: 0, y: `${direction * -0.3}em`, filter: `blur(${blur.subtle}px)`, transition: { duration:
|
|
16
|
+
exit: (direction) => ({ opacity: 0, y: `${direction * -0.3}em`, filter: `blur(${blur.subtle}px)`, transition: { duration: motionTokens.duration.fast, ease: ease.standard } }),
|
|
17
17
|
};
|
|
18
18
|
/** Reduced motion keeps a short crossfade; resting values match the roll so server and client markup agree. */
|
|
19
19
|
const valueFade = { enter: { opacity: 0 }, center: { opacity: 1, y: 0, filter: "blur(0px)", transition: instant }, exit: { opacity: 0, transition: instant } };
|
|
@@ -21,7 +21,7 @@ const valueFade = { enter: { opacity: 0 }, center: { opacity: 1, y: 0, filter: "
|
|
|
21
21
|
const statusRise = {
|
|
22
22
|
enter: { opacity: 0, y: "0.3em", filter: `blur(${blur.soft}px)` },
|
|
23
23
|
center: { opacity: 1, y: 0, filter: "blur(0px)", transition: { duration: duration.standard, ease: ease.enter } },
|
|
24
|
-
exit: { opacity: 0, y: "-0.3em", filter: `blur(${blur.subtle}px)`, transition: { duration:
|
|
24
|
+
exit: { opacity: 0, y: "-0.3em", filter: `blur(${blur.subtle}px)`, transition: { duration: motionTokens.duration.fast, ease: ease.standard } },
|
|
25
25
|
};
|
|
26
26
|
export function DatePicker({ label, value, onChange, description, placeholder = "Select a date", minDate, maxDate, disabledDates, locale = "en-US", format = { month: "short", day: "numeric", year: "numeric" }, showToday, id, className, disabled, ...buttonProps }) {
|
|
27
27
|
const generatedId = useId();
|
|
@@ -96,5 +96,5 @@ export function DatePicker({ label, value, onChange, description, placeholder =
|
|
|
96
96
|
return _jsxs("div", { className: [styles.field, className].filter(Boolean).join(" "), ref: rootRef, onBlur: onBlur, children: [_jsx("label", { className: styles.label, htmlFor: controlId, children: label }), _jsxs("div", { className: styles.anchor, children: [_jsxs("button", { ...buttonProps, ref: triggerRef, id: controlId, type: "button", disabled: disabled, "aria-haspopup": "dialog", "aria-expanded": open, "aria-describedby": hintId, className: styles.trigger, onClick: () => (open ? close() : show()), onKeyDown: onTriggerKeyDown, children: [_jsx(CalendarDays, { size: 16, strokeWidth: 1.75, "aria-hidden": "true" }), _jsx("span", { className: styles.srOnly, children: shown }), _jsx("span", { className: styles.valueText, "aria-hidden": "true", children: _jsx(AnimatePresence, { mode: "popLayout", initial: false, custom: 1, children: value ? _jsx(motion.span, { className: styles.value, custom: 1, variants: reduce ? valueFade : valueRoll, initial: "enter", animate: "center", exit: "exit", children: parts.map((part, index) => _jsx(motion.span, { className: styles.part, layout: "position", layoutDependency: time, transition: partMotion, children: part.type === "literal" ? _jsx("span", { className: styles.partValue, children: part.value }) : _jsx(AnimatePresence, { mode: "popLayout", initial: false, custom: direction, children: _jsx(motion.span, { className: styles.partValue, custom: direction, variants: reduce ? valueFade : valueRoll, initial: "enter", animate: "center", exit: "exit", children: part.value }, part.value) }) }, `${index}-${part.type}`)) }, "value") : _jsx(motion.span, { className: styles.placeholder, custom: -1, variants: reduce ? valueFade : valueRoll, initial: "enter", animate: "center", exit: "exit", children: placeholder }, "placeholder") }) }), _jsx(ChevronDown, { className: styles.chevron, size: 16, strokeWidth: 1.75, "aria-hidden": "true" })] }), _jsx(AnimatePresence, { children: open && _jsxs(motion.div, { ref: popoverRef, className: styles.popover, role: "dialog", "aria-label": `${label} calendar`, onKeyDown: (event) => { if (event.key === "Escape") {
|
|
97
97
|
event.stopPropagation();
|
|
98
98
|
close();
|
|
99
|
-
} }, initial: reduce ? { opacity: 0 } : { opacity: 0, y: -8, scale: .95 }, animate: { opacity: 1, y: 0, scale: 1, transition: reduce ? instant : { ...spring.snappy, opacity: { duration: duration.fast, ease: ease.enter } } }, exit: { opacity: 0, ...(reduce ? {} : { y: -6, scale: .97 }), transition: { duration:
|
|
99
|
+
} }, initial: reduce ? { opacity: 0 } : { opacity: 0, y: -8, scale: .95 }, animate: { opacity: 1, y: 0, scale: 1, transition: reduce ? instant : { ...spring.snappy, opacity: { duration: duration.fast, ease: ease.enter } } }, exit: { opacity: 0, ...(reduce ? {} : { y: -6, scale: .97 }), transition: { duration: motionTokens.duration.fast, ease: ease.standard } }, children: [_jsx(Calendar, { value: value, onChange: selectDate, month: month, onMonthChange: setMonth, minDate: minDate, maxDate: maxDate, disabledDates: disabledDates, locale: locale, showToday: showToday }), _jsxs("div", { className: styles.footer, children: [_jsx("button", { type: "button", onClick: () => selectDate(undefined), disabled: !value, children: "Clear" }), _jsx("span", { className: styles.status, children: _jsx(AnimatePresence, { initial: false, children: _jsx(motion.span, { variants: reduce ? valueFade : statusRise, initial: "enter", animate: "center", exit: "exit", children: value ? `Selected ${formatter.format(value)}` : "Choose a day" }, time ?? "none") }) })] })] }) })] }), description && _jsx("span", { id: hintId, className: styles.description, children: description })] });
|
|
100
100
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
.field { display: grid; gap:
|
|
1
|
+
.field { display: grid; gap: var(--space-related); min-width: 0; }
|
|
2
2
|
.label { color: var(--foreground); font-size: var(--text-sm); font-weight: 500; line-height: var(--leading-body); }
|
|
3
3
|
.anchor { position: relative; min-width: 0; }
|
|
4
4
|
/* The trigger anchors the calendar, so press feedback stays in color; it never scales. */
|
|
5
|
-
.trigger { position: relative; display: flex; width: 100%; min-height: var(--control-height-md); align-items: center; gap:
|
|
5
|
+
.trigger { position: relative; display: flex; width: 100%; min-height: var(--control-height-md); align-items: center; gap: var(--space-related); border: 1px solid var(--border); border-radius: var(--radius-control); padding: 0 var(--space-group); background: var(--surface); color: var(--foreground); font: inherit; font-size: var(--text-sm); text-align: left; cursor: pointer; transition: border-color var(--duration-fast) var(--ease-standard), background var(--duration-fast) var(--ease-standard), box-shadow var(--duration-fast) var(--ease-standard); }
|
|
6
6
|
@media (hover: hover) and (pointer: fine) { .trigger:hover:not(:disabled) { border-color: var(--border-strong); background: var(--surface-muted); } }
|
|
7
7
|
.trigger:active:not(:disabled), .trigger[aria-expanded="true"] { border-color: var(--border-strong); background: var(--surface-muted); }
|
|
8
8
|
.trigger:disabled { cursor: not-allowed; opacity: .5; }
|
|
@@ -17,16 +17,16 @@
|
|
|
17
17
|
.chevron { flex: 0 0 auto; color: var(--text-muted); transition: transform var(--duration-spring) var(--ease-spring); }
|
|
18
18
|
.trigger[aria-expanded="true"] .chevron { transform: rotate(180deg); }
|
|
19
19
|
/* Grows out of the trigger's calendar icon and returns there on close. */
|
|
20
|
-
.popover { position: absolute; z-index:
|
|
20
|
+
.popover { position: absolute; z-index: var(--layer-popover); top: calc(100% + var(--space-related)); left: 0; width: min(320px, calc(100vw - 32px)); overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-container); padding: var(--space-inset); background: var(--surface-raised); box-shadow: var(--shadow-floating); transform-origin: 22px -8px; will-change: transform, opacity; }
|
|
21
21
|
/* On phone widths the calendar matches the field instead of running past the screen edge, and a tighter inset keeps the month and its controls on one row. */
|
|
22
|
-
@media (max-width: 360px) { .popover { right: 0; width: auto; padding:
|
|
23
|
-
.footer { display: flex; align-items: center; justify-content: space-between; gap:
|
|
22
|
+
@media (max-width: 360px) { .popover { right: 0; width: auto; padding: var(--space-group); } }
|
|
23
|
+
.footer { display: flex; align-items: center; justify-content: space-between; gap: var(--space-related); margin-top: var(--space-inset); border-top: 1px solid var(--border-subtle); padding-top: var(--space-group); color: var(--text-muted); font-size: var(--text-xs); }
|
|
24
24
|
/* Old and new status lines share one cell, pinned to the trailing edge so a shorter line never shifts. */
|
|
25
25
|
.status { display: grid; min-width: 0; justify-items: end; }
|
|
26
26
|
.status > span { grid-area: 1 / 1; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
27
|
-
.footer button { border: 0; border-radius: var(--radius-control); padding:
|
|
27
|
+
.footer button { border: 0; border-radius: var(--radius-control); padding: var(--space-tight) var(--space-related); background: transparent; color: var(--text-secondary); font: inherit; 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); }
|
|
28
28
|
@media (hover: hover) and (pointer: fine) { .footer button:hover:not(:disabled) { background: var(--surface-muted); color: var(--foreground); } }
|
|
29
|
-
.footer button:active:not(:disabled) { transform: scale(.97); transition-duration: var(--duration-fast), var(--duration-fast),
|
|
29
|
+
.footer button:active:not(:disabled) { transform: scale(.97); transition-duration: var(--duration-fast), var(--duration-fast), var(--duration-fast); transition-timing-function: var(--ease-standard); }
|
|
30
30
|
.footer button:disabled { cursor: not-allowed; opacity: .4; }
|
|
31
31
|
.description { color: var(--text-muted); font-size: var(--text-xs); line-height: var(--leading-body); transition: opacity var(--duration-fast) var(--ease-standard); }
|
|
32
32
|
/* The open calendar covers the hint; fading it keeps its first letters from peeking past the popover's rounded corner. */
|