@crisp-ui-kit/crisp 0.57.1 → 0.57.2
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/dist/authshell.css +9 -4
- package/dist/authshell.layered.css +9 -4
- package/dist/badge.css +3 -3
- package/dist/badge.layered.css +3 -3
- package/dist/board.css +28 -8
- package/dist/board.layered.css +28 -8
- package/dist/bottomsheet.css +26 -0
- package/dist/bottomsheet.d.ts +7 -0
- package/dist/bottomsheet.layered.css +28 -0
- package/dist/button.css +7 -6
- package/dist/button.layered.css +7 -6
- package/dist/checkbox.css +7 -3
- package/dist/checkbox.layered.css +7 -3
- package/dist/chip.css +15 -0
- package/dist/chip.d.ts +3 -1
- package/dist/chip.layered.css +15 -0
- package/dist/chipgroup.css +5 -0
- package/dist/chipgroup.d.ts +7 -0
- package/dist/chipgroup.layered.css +7 -0
- package/dist/cjs/components/badge/badge.recipe.js +22 -8
- package/dist/cjs/components/bottomsheet/bottomsheet.js +90 -0
- package/dist/cjs/components/bottomsheet/bottomsheet.recipe.js +77 -0
- package/dist/cjs/components/bottomsheet/index.js +9 -0
- package/dist/cjs/components/button/button.recipe.js +39 -15
- package/dist/cjs/components/checkbox/checkbox.recipe.js +61 -9
- package/dist/cjs/components/chip/chip.js +14 -2
- package/dist/cjs/components/chip/chip.recipe.js +69 -1
- package/dist/cjs/components/chipgroup/chipgroup.js +51 -0
- package/dist/cjs/components/chipgroup/chipgroup.recipe.js +36 -0
- package/dist/cjs/components/chipgroup/index.js +7 -0
- package/dist/cjs/components/datatable/datatable.js +5 -1
- package/dist/cjs/components/datatable/datatable.recipe.js +11 -2
- package/dist/cjs/components/dialog/dialog.recipe.js +21 -10
- package/dist/cjs/components/emptystate/emptystate.recipe.js +7 -2
- package/dist/cjs/components/fileupload/fileupload.js +21 -4
- package/dist/cjs/components/input/index.js +2 -1
- package/dist/cjs/components/input/input.js +31 -1
- package/dist/cjs/components/input/input.recipe.js +16 -9
- package/dist/cjs/components/menu/menu.recipe.js +21 -7
- package/dist/cjs/components/menusheet/index.js +9 -0
- package/dist/cjs/components/menusheet/menusheet.js +133 -0
- package/dist/cjs/components/menusheet/menusheet.recipe.js +103 -0
- package/dist/cjs/components/multiselect/multiselect.js +1 -1
- package/dist/cjs/components/multiselect/multiselect.recipe.js +33 -9
- package/dist/cjs/components/select/select.js +1 -1
- package/dist/cjs/components/select/select.recipe.js +38 -12
- package/dist/cjs/components/snackbar/index.js +8 -0
- package/dist/cjs/components/snackbar/snackbar.js +121 -0
- package/dist/cjs/components/snackbar/snackbar.recipe.js +71 -0
- package/dist/cjs/components/tabletoolbar/tabletoolbar.chrome.js +7 -2
- package/dist/cjs/components/tabletoolbar/tabletoolbar.js +37 -12
- package/dist/cjs/components/tabs/tabs.js +10 -4
- package/dist/cjs/components/tabs/tabs.recipe.js +23 -6
- package/dist/cjs/components/textarea/textarea.recipe.js +11 -8
- package/dist/cjs/index.js +7 -0
- package/dist/cjs/product/authshell/authshell.recipe.js +5 -1
- package/dist/cjs/product/command/command.recipe.js +4 -1
- package/dist/cjs/product/comments/comments.js +7 -2
- package/dist/cjs/product/comments/comments.recipe.js +25 -7
- package/dist/cjs/product/memberssettings/index.js +6 -0
- package/dist/cjs/product/memberssettings/memberssettings.js +99 -0
- package/dist/cjs/product/memberssettings/memberssettings.recipe.js +83 -0
- package/dist/cjs/product/notificationssettings/index.js +5 -0
- package/dist/cjs/product/notificationssettings/notificationssettings.js +19 -0
- package/dist/cjs/product/notificationssettings/notificationssettings.recipe.js +44 -0
- package/dist/cjs/product/recordpage/recordpage.js +57 -6
- package/dist/cjs/product/recordpage/recordpage.recipe.js +43 -6
- package/dist/cjs/product/workspacegeneralsettings/index.js +5 -0
- package/dist/cjs/product/workspacegeneralsettings/workspacegeneralsettings.js +21 -0
- package/dist/cjs/product/workspacegeneralsettings/workspacegeneralsettings.recipe.js +51 -0
- package/dist/cjs/tokens/contract.js +1 -0
- package/dist/cjs/tokens/elevation.js +8 -5
- package/dist/cjs/tokens/palette.js +28 -8
- package/dist/cjs/tokens/scale.js +44 -2
- package/dist/cjs/tokens/semantic.js +2 -0
- package/dist/columncalc.css +15 -7
- package/dist/columncalc.layered.css +15 -7
- package/dist/command.css +23 -19
- package/dist/command.layered.css +23 -19
- package/dist/comments.css +28 -19
- package/dist/comments.d.ts +2 -2
- package/dist/comments.layered.css +28 -19
- package/dist/datatable.css +161 -67
- package/dist/datatable.layered.css +161 -67
- package/dist/datepicker.css +13 -41
- package/dist/datepicker.layered.css +13 -41
- package/dist/datepickerfield.css +4 -1
- package/dist/datepickerfield.layered.css +4 -1
- package/dist/dialog.css +12 -7
- package/dist/dialog.layered.css +12 -7
- package/dist/emptystate.css +5 -3
- package/dist/emptystate.layered.css +5 -3
- package/dist/esm/components/badge/badge.recipe.js +22 -8
- package/dist/esm/components/bottomsheet/bottomsheet.js +52 -0
- package/dist/esm/components/bottomsheet/bottomsheet.recipe.js +74 -0
- package/dist/esm/components/bottomsheet/index.js +2 -0
- package/dist/esm/components/button/button.recipe.js +40 -16
- package/dist/esm/components/checkbox/checkbox.recipe.js +61 -9
- package/dist/esm/components/chip/chip.js +14 -2
- package/dist/esm/components/chip/chip.recipe.js +69 -1
- package/dist/esm/components/chipgroup/chipgroup.js +15 -0
- package/dist/esm/components/chipgroup/chipgroup.recipe.js +33 -0
- package/dist/esm/components/chipgroup/index.js +2 -0
- package/dist/esm/components/datatable/datatable.js +5 -1
- package/dist/esm/components/datatable/datatable.recipe.js +11 -2
- package/dist/esm/components/dialog/dialog.recipe.js +22 -11
- package/dist/esm/components/emptystate/emptystate.recipe.js +7 -2
- package/dist/esm/components/fileupload/fileupload.js +20 -5
- package/dist/esm/components/input/index.js +1 -1
- package/dist/esm/components/input/input.js +30 -0
- package/dist/esm/components/input/input.recipe.js +17 -10
- package/dist/esm/components/menu/menu.recipe.js +21 -7
- package/dist/esm/components/menusheet/index.js +2 -0
- package/dist/esm/components/menusheet/menusheet.js +95 -0
- package/dist/esm/components/menusheet/menusheet.recipe.js +100 -0
- package/dist/esm/components/multiselect/multiselect.js +1 -1
- package/dist/esm/components/multiselect/multiselect.recipe.js +33 -9
- package/dist/esm/components/select/select.js +1 -1
- package/dist/esm/components/select/select.recipe.js +38 -12
- package/dist/esm/components/snackbar/index.js +2 -0
- package/dist/esm/components/snackbar/snackbar.js +84 -0
- package/dist/esm/components/snackbar/snackbar.recipe.js +68 -0
- package/dist/esm/components/tabletoolbar/tabletoolbar.chrome.js +7 -2
- package/dist/esm/components/tabletoolbar/tabletoolbar.js +37 -12
- package/dist/esm/components/tabs/tabs.js +10 -4
- package/dist/esm/components/tabs/tabs.recipe.js +23 -6
- package/dist/esm/components/textarea/textarea.recipe.js +12 -9
- package/dist/esm/index.js +7 -0
- package/dist/esm/product/authshell/authshell.recipe.js +5 -1
- package/dist/esm/product/command/command.recipe.js +4 -1
- package/dist/esm/product/comments/comments.js +7 -2
- package/dist/esm/product/comments/comments.recipe.js +25 -7
- package/dist/esm/product/memberssettings/index.js +1 -0
- package/dist/esm/product/memberssettings/memberssettings.js +62 -0
- package/dist/esm/product/memberssettings/memberssettings.recipe.js +80 -0
- package/dist/esm/product/notificationssettings/index.js +1 -0
- package/dist/esm/product/notificationssettings/notificationssettings.js +16 -0
- package/dist/esm/product/notificationssettings/notificationssettings.recipe.js +41 -0
- package/dist/esm/product/recordpage/recordpage.js +58 -7
- package/dist/esm/product/recordpage/recordpage.recipe.js +43 -6
- package/dist/esm/product/workspacegeneralsettings/index.js +1 -0
- package/dist/esm/product/workspacegeneralsettings/workspacegeneralsettings.js +18 -0
- package/dist/esm/product/workspacegeneralsettings/workspacegeneralsettings.recipe.js +48 -0
- package/dist/esm/tokens/contract.js +2 -1
- package/dist/esm/tokens/elevation.js +8 -5
- package/dist/esm/tokens/palette.js +28 -8
- package/dist/esm/tokens/scale.js +43 -1
- package/dist/esm/tokens/semantic.js +2 -0
- package/dist/fileupload.css +3 -1
- package/dist/fileupload.layered.css +3 -1
- package/dist/input.css +6 -4
- package/dist/input.layered.css +6 -4
- package/dist/listpage.css +3 -1
- package/dist/listpage.layered.css +3 -1
- package/dist/memberssettings.css +67 -0
- package/dist/memberssettings.d.ts +7 -0
- package/dist/memberssettings.layered.css +69 -0
- package/dist/menu.css +2 -2
- package/dist/menu.layered.css +2 -2
- package/dist/menusheet.css +36 -0
- package/dist/menusheet.d.ts +7 -0
- package/dist/menusheet.layered.css +38 -0
- package/dist/multiselect.css +13 -6
- package/dist/multiselect.layered.css +13 -6
- package/dist/native/tokens.d.ts +2 -1
- package/dist/native/tokens.js +20 -3
- package/dist/notificationssettings.css +22 -0
- package/dist/notificationssettings.d.ts +7 -0
- package/dist/notificationssettings.layered.css +24 -0
- package/dist/objectsettings.css +4 -4
- package/dist/objectsettings.layered.css +4 -4
- package/dist/recordpage.css +67 -23
- package/dist/recordpage.layered.css +67 -23
- package/dist/recordpanel.css +35 -16
- package/dist/recordpanel.layered.css +35 -16
- package/dist/resizablepanel.css +8 -5
- package/dist/resizablepanel.layered.css +8 -5
- package/dist/richtext.css +24 -8
- package/dist/richtext.layered.css +24 -8
- package/dist/savedviews.css +9 -2
- package/dist/savedviews.layered.css +9 -2
- package/dist/select.css +25 -5
- package/dist/select.layered.css +25 -5
- package/dist/settingsshell.css +2 -3
- package/dist/settingsshell.layered.css +2 -3
- package/dist/slider.css +6 -27
- package/dist/slider.layered.css +6 -27
- package/dist/snackbar.css +24 -0
- package/dist/snackbar.d.ts +7 -0
- package/dist/snackbar.layered.css +26 -0
- package/dist/statcard.css +3 -1
- package/dist/statcard.layered.css +3 -1
- package/dist/styles.css +859 -345
- package/dist/styles.layered.css +859 -345
- package/dist/table.css +28 -10
- package/dist/table.layered.css +28 -10
- package/dist/tabletoolbar.css +35 -24
- package/dist/tabletoolbar.layered.css +35 -24
- package/dist/tabs.css +18 -4
- package/dist/tabs.layered.css +18 -4
- package/dist/textarea.css +2 -6
- package/dist/textarea.layered.css +2 -6
- package/dist/themepicker.css +2 -1
- package/dist/themepicker.layered.css +2 -1
- package/dist/tokens.css +13 -2
- package/dist/tokens.json +20 -3
- package/dist/types/components/bottomsheet/bottomsheet.d.ts +35 -0
- package/dist/types/components/bottomsheet/bottomsheet.recipe.d.ts +3 -0
- package/dist/types/components/bottomsheet/index.d.ts +2 -0
- package/dist/types/components/button/button.recipe.d.ts +11 -6
- package/dist/types/components/checkbox/checkbox.recipe.d.ts +28 -5
- package/dist/types/components/chip/chip.d.ts +22 -0
- package/dist/types/components/chip/chip.recipe.d.ts +48 -0
- package/dist/types/components/chipgroup/chipgroup.d.ts +14 -0
- package/dist/types/components/chipgroup/chipgroup.recipe.d.ts +5 -0
- package/dist/types/components/chipgroup/index.d.ts +2 -0
- package/dist/types/components/datatable/datatable.d.ts +19 -0
- package/dist/types/components/fileupload/fileupload.d.ts +26 -0
- package/dist/types/components/input/index.d.ts +1 -1
- package/dist/types/components/input/input.d.ts +72 -0
- package/dist/types/components/menusheet/index.d.ts +2 -0
- package/dist/types/components/menusheet/menusheet.d.ts +42 -0
- package/dist/types/components/menusheet/menusheet.recipe.d.ts +3 -0
- package/dist/types/components/snackbar/index.d.ts +2 -0
- package/dist/types/components/snackbar/snackbar.d.ts +36 -0
- package/dist/types/components/snackbar/snackbar.recipe.d.ts +5 -0
- package/dist/types/components/tabletoolbar/tabletoolbar.d.ts +28 -1
- package/dist/types/components/tabs/tabs.d.ts +11 -1
- package/dist/types/index.d.ts +7 -0
- package/dist/types/product/comments/comments.d.ts +9 -3
- package/dist/types/product/comments/comments.recipe.d.ts +12 -2
- package/dist/types/product/memberssettings/index.d.ts +1 -0
- package/dist/types/product/memberssettings/memberssettings.d.ts +85 -0
- package/dist/types/product/memberssettings/memberssettings.recipe.d.ts +3 -0
- package/dist/types/product/notificationssettings/index.d.ts +1 -0
- package/dist/types/product/notificationssettings/notificationssettings.d.ts +37 -0
- package/dist/types/product/notificationssettings/notificationssettings.recipe.d.ts +3 -0
- package/dist/types/product/recordpage/recordpage.d.ts +53 -2
- package/dist/types/product/workspacegeneralsettings/index.d.ts +1 -0
- package/dist/types/product/workspacegeneralsettings/workspacegeneralsettings.d.ts +48 -0
- package/dist/types/product/workspacegeneralsettings/workspacegeneralsettings.recipe.d.ts +3 -0
- package/dist/types/tokens/contract.d.ts +4 -1
- package/dist/types/tokens/elevation.d.ts +8 -5
- package/dist/types/tokens/palette.d.ts +9 -1
- package/dist/types/tokens/scale.d.ts +11 -1
- package/dist/types/tokens/semantic.d.ts +2 -0
- package/dist/wheelpicker.css +4 -2
- package/dist/wheelpicker.layered.css +4 -2
- package/dist/workspacegeneralsettings.css +30 -0
- package/dist/workspacegeneralsettings.d.ts +7 -0
- package/dist/workspacegeneralsettings.layered.css +32 -0
- package/package.json +36 -1
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { defineRecipe, resolveRecipe } from "../../core/index.js";
|
|
2
|
+
import { contract as c } from "../../tokens/index.js";
|
|
3
|
+
// A mobile menu sheet -- daangn/seed-design components menu-sheet.yaml and
|
|
4
|
+
// menu-sheet-item.yaml (dev at e1c486b904297f7b6a8f17b8523f732c37015d60), not
|
|
5
|
+
// Attio (no such component there; crisp#911). Same @zag-js/dialog machine as
|
|
6
|
+
// BottomSheet, and the identical role=menu keyboard model Menu already uses
|
|
7
|
+
// (useMenuKeyboard, shared rather than reimplemented). Differs from
|
|
8
|
+
// BottomSheet in every slot value: r5 radius (not r6), content-level padding
|
|
9
|
+
// (not per-slot), no header alignment / close-button matrix at all -- menu
|
|
10
|
+
// sheet has neither in its own schema. Every numeric value cites its yaml
|
|
11
|
+
// line. NOTE: no apostrophes in this file -- one broke the recipe compiler
|
|
12
|
+
// silently on BottomSheet, see AUTHORING.md Lesson 64.
|
|
13
|
+
const config = defineRecipe({
|
|
14
|
+
name: "menusheet",
|
|
15
|
+
base: `display: contents; font-family: ${c.font.sans};
|
|
16
|
+
& .crisp-menusheet-backdrop {
|
|
17
|
+
position: fixed; inset: 0; z-index: 60;
|
|
18
|
+
background: ${c.bgOverlayStrong}; /* menu-sheet.yaml:95 backdrop.color = $color.bg.overlay */
|
|
19
|
+
opacity: 1; transition: opacity 100ms cubic-bezier(0,0,.15,1); /* menu-sheet.yaml:96-98 enterDuration/enterTimingFunction = $duration.d2/$timing-function.enter */
|
|
20
|
+
@starting-style { opacity: 0; }
|
|
21
|
+
}
|
|
22
|
+
& .crisp-menusheet-positioner {
|
|
23
|
+
position: fixed; inset: 0; z-index: 61;
|
|
24
|
+
display: flex; align-items: flex-end; justify-content: center;
|
|
25
|
+
}
|
|
26
|
+
& .crisp-menusheet-content {
|
|
27
|
+
-webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
|
|
28
|
+
position: relative; box-sizing: border-box; display: flex; flex-direction: column;
|
|
29
|
+
overflow: hidden; width: 100%; max-width: 480px; /* menu-sheet.yaml:104 content.maxWidth */
|
|
30
|
+
max-height: 85vh;
|
|
31
|
+
background: ${c.bgSurface}; /* menu-sheet.yaml:103 content.color = $color.bg.layer-floating */
|
|
32
|
+
padding: ${c.space["6"]} ${c.space["4"]} ${c.space["4"]}; /* menu-sheet.yaml:105-107 content.paddingX/paddingTop/paddingBottom = global-gutter/x6/x4 (16px/24px/16px) */
|
|
33
|
+
border-radius: ${c.radius["3xl"]} ${c.radius["3xl"]} 0 0; /* menu-sheet.yaml:108 content.topCornerRadius = $radius.r5 (20px) */
|
|
34
|
+
transform: translateY(0);
|
|
35
|
+
transition: transform 300ms cubic-bezier(.03,.4,.1,1); /* menu-sheet.yaml:109-110 content.enterDuration/enterTimingFunction (enter-expressive) */
|
|
36
|
+
@starting-style { transform: translateY(100%); }
|
|
37
|
+
}
|
|
38
|
+
& .crisp-menusheet-header {
|
|
39
|
+
display: flex; flex-direction: column;
|
|
40
|
+
gap: ${c.space["1"]}; /* menu-sheet.yaml:115 header.gap = $dimension.x1 (4px) */
|
|
41
|
+
padding-bottom: ${c.space["4"]}; /* menu-sheet.yaml:116 header.paddingBottom = $dimension.x4 (16px) */
|
|
42
|
+
flex-shrink: 0;
|
|
43
|
+
}
|
|
44
|
+
& .crisp-menusheet-title {
|
|
45
|
+
color: ${c.fgPrimary}; /* menu-sheet.yaml:121 title.color = $color.fg.neutral */
|
|
46
|
+
font-size: 18px; line-height: 24px; font-weight: ${c.weight.bold}; /* menu-sheet.yaml:118-120 title.fontSize/lineHeight/fontWeight = $font-size.t6/$line-height.t6/bold */
|
|
47
|
+
}
|
|
48
|
+
& .crisp-menusheet-description {
|
|
49
|
+
color: ${c.fgMuted}; /* menu-sheet.yaml:126 description.color = $color.fg.neutral-muted */
|
|
50
|
+
font-size: ${c.text.lg}; line-height: 19px; font-weight: ${c.weight.regular}; /* menu-sheet.yaml:123-125 description.fontSize/lineHeight/fontWeight = $font-size.t4/$line-height.t4/regular */
|
|
51
|
+
}
|
|
52
|
+
& .crisp-menusheet-list {
|
|
53
|
+
display: flex; flex-direction: column;
|
|
54
|
+
gap: ${c.space["2.5"]}; /* menu-sheet.yaml:129 list.gap = $dimension.x2_5 (10px) */
|
|
55
|
+
overflow-y: auto; min-height: 0;
|
|
56
|
+
}
|
|
57
|
+
& .crisp-menusheet-group {
|
|
58
|
+
display: flex; flex-direction: column;
|
|
59
|
+
border-radius: ${c.radius["2xl"]}; overflow: hidden; /* menu-sheet.yaml:131 group.cornerRadius = $radius.r4 (16px) */
|
|
60
|
+
}
|
|
61
|
+
& .crisp-menusheet-group > * + * { border-top: 1px solid ${c.strokeGroupDivider}; } /* menu-sheet.yaml:132-134 divider.strokeBottomWidth/strokeColor = 1px/$color.stroke.neutral-muted */
|
|
62
|
+
& .crisp-menusheet-footer {
|
|
63
|
+
flex-shrink: 0;
|
|
64
|
+
padding-top: ${c.space["2.5"]}; /* menu-sheet.yaml:136 footer.paddingTop = $dimension.x2_5 (10px) */
|
|
65
|
+
}
|
|
66
|
+
& .crisp-menusheet-item {
|
|
67
|
+
position: relative; box-sizing: border-box; display: flex; align-items: center;
|
|
68
|
+
width: 100%; min-height: 52px; /* menu-sheet-item.yaml:72 root.minHeight */
|
|
69
|
+
padding: ${c.space["3.5"]} ${c.space["4"]}; gap: ${c.space["3.5"]}; /* menu-sheet-item.yaml:73-75 root.paddingX/paddingY/gap = x4/x3_5/x3_5 (16px/14px/14px) */
|
|
70
|
+
border: none; margin: 0; cursor: pointer; text-align: start;
|
|
71
|
+
background: ${c.bgNeutralWeak}; /* menu-sheet-item.yaml:71 root.color = $color.bg.neutral-weak */
|
|
72
|
+
font-family: inherit;
|
|
73
|
+
}
|
|
74
|
+
& .crisp-menusheet-item:hover,
|
|
75
|
+
& .crisp-menusheet-item:active { background: color-mix(in srgb, ${c.fgPrimary} 6%, ${c.bgNeutralWeak}); } /* menu-sheet-item.yaml:90-91 pressed.root.color = $color.bg.neutral-weak-pressed, approximated as a tint over the base fill */
|
|
76
|
+
& .crisp-menusheet-item:active .crisp-menusheet-item-content { transform: scale(0.98); } /* menu-sheet-item.yaml:92 pressed.root.scaleScope = content */
|
|
77
|
+
& .crisp-menusheet-item-icon { flex-shrink: 0; display: inline-flex; width: 22px; height: 22px; } /* menu-sheet-item.yaml:77 prefixIcon.size */
|
|
78
|
+
& .crisp-menusheet-item-content {
|
|
79
|
+
flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column;
|
|
80
|
+
gap: ${c.space["0.5"]}; /* menu-sheet-item.yaml:79 content.gap = $dimension.x0_5 (2px) */
|
|
81
|
+
transition: transform 150ms cubic-bezier(0,0,.15,1);
|
|
82
|
+
}
|
|
83
|
+
& .crisp-menusheet-item-label {
|
|
84
|
+
font-size: ${c.text.xl}; line-height: 22px; font-weight: ${c.weight.regular}; /* menu-sheet-item.yaml:81-83 label.fontSize/lineHeight/fontWeight = $font-size.t5/$line-height.t5/regular */
|
|
85
|
+
}
|
|
86
|
+
& .crisp-menusheet-item-description {
|
|
87
|
+
color: ${c.fgNeutralSubtle}; /* menu-sheet-item.yaml:88 description.color = $color.fg.neutral-subtle */
|
|
88
|
+
font-size: ${c.text.md}; line-height: 18px; font-weight: ${c.weight.medium}; /* menu-sheet-item.yaml:85-87 description.fontSize/lineHeight/fontWeight = $font-size.t3/$line-height.t3/medium */
|
|
89
|
+
}
|
|
90
|
+
& .crisp-menusheet-item[data-tone="neutral"] .crisp-menusheet-item-icon,
|
|
91
|
+
& .crisp-menusheet-item[data-tone="neutral"] .crisp-menusheet-item-label { color: ${c.fgPrimary}; } /* menu-sheet-item.yaml:93-98 tone=neutral */
|
|
92
|
+
& .crisp-menusheet-item[data-tone="critical"] .crisp-menusheet-item-icon,
|
|
93
|
+
& .crisp-menusheet-item[data-tone="critical"] .crisp-menusheet-item-label { color: ${c.fgDanger}; } /* menu-sheet-item.yaml:99-104 tone=critical */
|
|
94
|
+
`,
|
|
95
|
+
variants: {},
|
|
96
|
+
defaultVariants: {},
|
|
97
|
+
compoundVariants: [],
|
|
98
|
+
});
|
|
99
|
+
export const menusheetRecipe = resolveRecipe(config);
|
|
100
|
+
export default config;
|
|
@@ -186,7 +186,7 @@ id, placeholder: placeholderProp, searchable = true, searchPlaceholder: searchPl
|
|
|
186
186
|
}, children: [_jsx("span", { className: "crisp-multiselect-chips", children: selectedOptions.length === 0 ? (_jsx("span", { className: "crisp-multiselect-placeholder", children: placeholder })) : (selectedOptions.map((o) => _jsx(Chip, { opt: o }, o.value))) }), _jsx(ChevronDown, { className: "crisp-multiselect-chevron", size: 16, strokeWidth: 1.75 })] }), open && (_jsx(FloatingPortal, { sourceRef: rootRef, children: _jsxs("div", { ref: listboxRef, id: listboxId, className: "crisp-multiselect-listbox", role: "listbox", "aria-multiselectable": "true", "aria-label": ariaLabel, "data-up": up ? "" : undefined, style: pos, children: [searchable && (_jsxs("div", { className: "crisp-multiselect-search", children: [_jsx(Search, { size: 16, strokeWidth: 1.75 }), _jsx("input", { ref: searchRef, type: "text", placeholder: searchPlaceholder, "aria-label": searchPlaceholder, "aria-controls": listboxId, "aria-activedescendant": activeId, value: query, onChange: (e) => {
|
|
187
187
|
setQuery(e.target.value);
|
|
188
188
|
setHighlight(0);
|
|
189
|
-
}, onKeyDown: onNavKeys })] })), filtered.length === 0 ? (_jsx("div", { className: "crisp-multiselect-empty", children: emptyLabel })) : (filtered.map((opt, i) => {
|
|
189
|
+
}, onKeyDown: onNavKeys })] })), searchable && _jsx("div", { className: "crisp-multiselect-divider" }), filtered.length === 0 ? (_jsx("div", { className: "crisp-multiselect-empty", children: emptyLabel })) : (filtered.map((opt, i) => {
|
|
190
190
|
const sel = selectedSet.has(opt.value);
|
|
191
191
|
// #343: a header renders once per run of same-`group`
|
|
192
192
|
// options, so consecutive rows sharing a group render one
|
|
@@ -13,10 +13,14 @@ import { contract as c, elevation as e } from "../../tokens/index.js";
|
|
|
13
13
|
// styling (shared with RecordsTable/DataTable elsewhere), the checkbox-style
|
|
14
14
|
// selected indicator, and the toggle-without-closing interaction.
|
|
15
15
|
//
|
|
16
|
-
// The search row
|
|
17
|
-
//
|
|
18
|
-
//
|
|
19
|
-
//
|
|
16
|
+
// The search row now follows seed too (owner decision, 2026-09-26: Select
|
|
17
|
+
// AND MultiSelect both follow seed-design, superseding #481's old Attio
|
|
18
|
+
// lock on this row's geometry -- crisp/#904's MultiSelect follow-up). It
|
|
19
|
+
// reads the exact same composed @seed-design/rootage `text-input.yaml`
|
|
20
|
+
// (variant=outline,size=medium) values #913 resolved for Select's own
|
|
21
|
+
// search row -- see that recipe's matching comment for the full citation.
|
|
22
|
+
// `build/spec-check.mjs`'s guard was rewritten to assert these seed values
|
|
23
|
+
// instead of the old 36px Attio measurement.
|
|
20
24
|
//
|
|
21
25
|
// The listbox portals to `document.body` (#339), so its rules live in
|
|
22
26
|
// `globalCss`, not nested under `&` -- see Select's own recipe for the full
|
|
@@ -61,13 +65,19 @@ const config = defineRecipe({
|
|
|
61
65
|
}
|
|
62
66
|
.crisp-multiselect-listbox[data-up] { transform-origin: bottom left; }
|
|
63
67
|
.crisp-multiselect-listbox { @starting-style { opacity: 0; transform: scale(0.95); } }
|
|
64
|
-
/*
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
+
/* Seed geometry (build/spec-check.mjs guards these four properties
|
|
69
|
+
directly), superseding #481's old Attio lock -- see this file's
|
|
70
|
+
header comment and Select's matching .crisp-select-search comment
|
|
71
|
+
for the full citation. An ordinary flex child of the listbox, so its
|
|
72
|
+
own 8px gap provides the inset/seam on every side, same as Select. */
|
|
73
|
+
.crisp-multiselect-search { display: flex; align-items: center; gap: ${c.space["2"]}; height: ${c.size.selectTriggerMd}; flex-shrink: 0; padding: 0 ${c.space["3.5"]}; border: 1px solid ${c.strokeSelectTrigger}; border-radius: ${c.radius.md}; color: ${c.fgNeutralMuted}; }
|
|
68
74
|
.crisp-multiselect-search svg { flex-shrink: 0; }
|
|
69
|
-
.crisp-multiselect-search input { flex: 1; min-width: 0; border: none; outline: none; background: none; font-family: inherit; font-size: ${c.text.lg}; color: ${c.fgSelectNeutral}; }
|
|
75
|
+
.crisp-multiselect-search input { flex: 1; min-width: 0; border: none; outline: none; background: none; font-family: inherit; font-size: ${c.text.lg}; line-height: 19px; color: ${c.fgSelectNeutral}; }
|
|
70
76
|
.crisp-multiselect-search input::placeholder { color: ${c.fgSelectPlaceholder}; }
|
|
77
|
+
/* Same header/body seam as Select's own .crisp-select-divider -- see
|
|
78
|
+
that recipe's comment for the seed source (select.yaml's divider
|
|
79
|
+
slot, stroke.neutral-muted). */
|
|
80
|
+
.crisp-multiselect-divider { flex-shrink: 0; height: 1px; margin-inline: ${c.space["4"]}; background: ${c.strokeSelectDivider}; }
|
|
71
81
|
/* Same groupLabel treatment as Select's (13px/regular/neutral-subtle). */
|
|
72
82
|
.crisp-multiselect-label { padding: ${c.space["2"]} ${c.space["4"]} 0; font-size: ${c.text.md}; line-height: 18px; font-weight: ${c.weight.regular}; color: ${c.fgNeutralSubtle}; }
|
|
73
83
|
.crisp-multiselect-option {
|
|
@@ -103,6 +113,20 @@ const config = defineRecipe({
|
|
|
103
113
|
// default: `c.size.menuRow` (32px) and the original, pre-#882
|
|
104
114
|
// Attio-measured asymmetric padding for a chip-wrapping trigger.
|
|
105
115
|
// `medium`/`large` (seed's own 40/52px) stay, opt-in.
|
|
116
|
+
//
|
|
117
|
+
// crisp/#904 (MultiSelect follow-up, briefly moved then reverted, same
|
|
118
|
+
// ruling as Select's own): `small`'s `gap` moved from `space["1"]`
|
|
119
|
+
// (4px) to `space["2"]` (8px), matching `medium`/`large`'s seed gap --
|
|
120
|
+
// team-lead's review ruling on Select's matching change reversed it:
|
|
121
|
+
// padding AND gap are SPACING, and the owner's direction is "sizes/
|
|
122
|
+
// spacing from Attio, look from seed", not seed's literal gap number.
|
|
123
|
+
// Back to `space["1"]` (4px), the original pre-#882 Attio-measured
|
|
124
|
+
// value. `padding` was never touched either way: the pre-#882,
|
|
125
|
+
// Attio-measured asymmetric padding a chip-wrapping trigger needs
|
|
126
|
+
// (chips sit close to the start edge, the chevron gets more room at
|
|
127
|
+
// the end) -- seed has no multi-value combobox of its own to source a
|
|
128
|
+
// replacement number from (see this file's header comment) even if
|
|
129
|
+
// the ruling had gone the other way.
|
|
106
130
|
size: {
|
|
107
131
|
small: `
|
|
108
132
|
& .crisp-multiselect-trigger { min-height: ${c.size.menuRow}; border-radius: ${c.radius.md}; gap: ${c.space["1"]}; padding: ${c.space["0.5"]} ${c.space["1.5"]} ${c.space["0.5"]} ${c.space["2"]}; }
|
|
@@ -185,7 +185,7 @@ export function Select({ options, value, defaultValue, onValueChange, name, requ
|
|
|
185
185
|
setQuery(e.target.value);
|
|
186
186
|
setHighlight(0);
|
|
187
187
|
onSearchChange?.(e.target.value);
|
|
188
|
-
}, onKeyDown: onNavKeys })] })), filtered.length === 0 ? (_jsx("div", { className: "crisp-select-empty", children: emptyLabel })) : (filtered.map((opt, i) => {
|
|
188
|
+
}, onKeyDown: onNavKeys })] })), searchable && _jsx("div", { className: "crisp-select-divider" }), filtered.length === 0 ? (_jsx("div", { className: "crisp-select-empty", children: emptyLabel })) : (filtered.map((opt, i) => {
|
|
189
189
|
const isSel = opt.value === selected;
|
|
190
190
|
// #343: a header renders once per run of same-`group`
|
|
191
191
|
// options, so consecutive rows sharing a group render one
|
|
@@ -26,11 +26,11 @@ import { contract as c, elevation as e } from "../../tokens/index.js";
|
|
|
26
26
|
// pattern with no precedent anywhere else in the repo, for one component.
|
|
27
27
|
// The enter animation (scale 0.95→1, opacity 0→1, seed's own curve) IS
|
|
28
28
|
// reproduced below.
|
|
29
|
-
// - A
|
|
30
|
-
// crisp or GRC groups options with an explicit separator
|
|
31
|
-
// AUTHORING's rule against building what nothing consumes
|
|
32
|
-
// too.
|
|
33
|
-
//
|
|
29
|
+
// - A general-purpose `divider` slot between arbitrary option groups:
|
|
30
|
+
// nothing in crisp or GRC groups options with an explicit separator
|
|
31
|
+
// today, and AUTHORING's rule against building what nothing consumes
|
|
32
|
+
// applies to CSS too. (`select.yaml`'s resolved value IS used below, just
|
|
33
|
+
// for one specific seam — see `.crisp-select-divider`'s own comment.)
|
|
34
34
|
const config = defineRecipe({
|
|
35
35
|
name: "select",
|
|
36
36
|
base: `
|
|
@@ -99,6 +99,20 @@ const config = defineRecipe({
|
|
|
99
99
|
.crisp-select-search svg { flex-shrink: 0; }
|
|
100
100
|
.crisp-select-search input { flex: 1; min-width: 0; border: none; outline: none; background: none; font-family: inherit; font-size: ${c.text.lg}; line-height: 19px; color: ${c.fgSelectNeutral}; }
|
|
101
101
|
.crisp-select-search input::placeholder { color: ${c.fgSelectPlaceholder}; }
|
|
102
|
+
/* select.yaml's own divider slot (marginX x4, height 1px, colour
|
|
103
|
+
stroke.neutral-muted -- described upstream as "the line marking a
|
|
104
|
+
boundary between semantic units: between sections, between content
|
|
105
|
+
and an action area, between a header and a body" -- exactly the
|
|
106
|
+
search-field/option-list boundary crisp#904's review flagged as
|
|
107
|
+
reading too tight). Not the general-purpose separator #867 declined
|
|
108
|
+
to build (nothing groups options with one) -- scoped to this one
|
|
109
|
+
specific header/body seam, which now exists because searchable
|
|
110
|
+
does. Sits as an ordinary flex child, so the listbox's own 8px gap
|
|
111
|
+
still applies on both sides of it -- total visual seam is
|
|
112
|
+
gap+1px+gap (17px), deliberately more than the 8px between two
|
|
113
|
+
plain option rows, so it reads as a section break, not a wider list
|
|
114
|
+
gap. */
|
|
115
|
+
.crisp-select-divider { flex-shrink: 0; height: 1px; margin-inline: ${c.space["4"]}; background: ${c.strokeSelectDivider}; }
|
|
102
116
|
.crisp-select-empty { padding: ${c.space["3"]} ${c.space["4"]}; text-align: center; font-size: ${c.text.md}; color: ${c.fgNeutralSubtle}; }
|
|
103
117
|
/* select.yaml's groupLabel -- font-size/line-height/weight are the same
|
|
104
118
|
across sizes, only paddingY differs (medium 8px, large 10px). */
|
|
@@ -133,13 +147,25 @@ const config = defineRecipe({
|
|
|
133
147
|
},
|
|
134
148
|
// Owner's follow-up after #867/#879 (crisp/#889): the LOOK stays seed's
|
|
135
149
|
// (border, listbox, radius, shadow, items, states, all unchanged below),
|
|
136
|
-
// but the
|
|
137
|
-
// in the same form visibly mismatched (measured live in GRC's
|
|
138
|
-
// employee" dialog). `small` is the new default: Attio's
|
|
139
|
-
// 32px `c.size.menuRow
|
|
140
|
-
//
|
|
141
|
-
//
|
|
142
|
-
//
|
|
150
|
+
// but the HEIGHT is Attio's again -- a 40px trigger next to a 32px
|
|
151
|
+
// `Input` in the same form visibly mismatched (measured live in GRC's
|
|
152
|
+
// own "New employee" dialog). `small` is the new default: Attio's
|
|
153
|
+
// original 32px `c.size.menuRow`. `medium`/`large` (seed's own 40/52px)
|
|
154
|
+
// stay, opt-in. Item rows are IDENTICAL across all three -- only the
|
|
155
|
+
// trigger differs; only it was ever the mismatch.
|
|
156
|
+
//
|
|
157
|
+
// crisp/#904 (follow-up, then reverted): `small`'s gap/padding-inline
|
|
158
|
+
// briefly moved to seed's literal `select-trigger.yaml` `size=medium`
|
|
159
|
+
// values (8px/14px), on the theory that even the 32px trigger should
|
|
160
|
+
// read seed's numbers verbatim. Team-lead ruling on that PR's review:
|
|
161
|
+
// padding and gap are SPACING, and the owner's actual direction is
|
|
162
|
+
// "sizes/spacing from Attio, look from seed" -- Select and Input sit
|
|
163
|
+
// side by side in every form, so spacing follows Input's measured
|
|
164
|
+
// values here, same as `medium`/`large` below follow seed's. Reverted
|
|
165
|
+
// to `space["1.5"]`/`space["2.5"]` (6px/10px, `Input`'s own gap/padding
|
|
166
|
+
// at this row height) -- everything else `small` already got from seed
|
|
167
|
+
// (fill/stroke/border/radius/chevron/colours/states, see this file's
|
|
168
|
+
// other comments) is unaffected and stays seed's.
|
|
143
169
|
size: {
|
|
144
170
|
small: `
|
|
145
171
|
& .crisp-select-trigger { height: ${c.size.menuRow}; border-radius: ${c.radius.md}; gap: ${c.space["1.5"]}; padding-inline: ${c.space["2.5"]}; }
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { CircleAlert, CircleCheck } from "lucide-react";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { useCrispMessage, useFocusAfterRemoval } from "../../core/index.js";
|
|
5
|
+
import { snackbarRecipe } from "./snackbar.recipe.js";
|
|
6
|
+
const SnackbarContext = React.createContext(null);
|
|
7
|
+
const ICONS = {
|
|
8
|
+
positive: CircleCheck,
|
|
9
|
+
critical: CircleAlert,
|
|
10
|
+
};
|
|
11
|
+
function SnackbarPill({ item, onClose, }) {
|
|
12
|
+
const Icon = ICONS[item.variant ?? "default"];
|
|
13
|
+
return (_jsxs("div", { className: "crisp-snackbar", "data-variant": item.variant ?? "default", children: [_jsxs("div", { className: "crisp-snackbar-content", children: [Icon != null && (_jsx("span", { className: "crisp-snackbar-icon", children: _jsx(Icon, { size: 24, strokeWidth: 1.75, "aria-hidden": "true" }) })), _jsx("span", { className: "crisp-snackbar-message", children: item.message })] }), item.action && (_jsx("button", { type: "button", className: "crisp-snackbar-action", onClick: () => {
|
|
14
|
+
item.action?.onClick();
|
|
15
|
+
onClose();
|
|
16
|
+
}, children: item.action.label }))] }));
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Wrap your app in a `SnackbarProvider`, then call `useSnackbar().show({...})`
|
|
20
|
+
* from anywhere to queue a bottom-anchored snackbar. Only one shows at a time
|
|
21
|
+
* (seed-design's mobile pattern, crisp#911) -- a second call queues behind the
|
|
22
|
+
* first and shows once it dismisses. Auto-dismisses after `duration` (default
|
|
23
|
+
* 4s; 0 keeps it until `dismiss()` or its action fires -- there is no close
|
|
24
|
+
* button, matching seed's own anatomy, which has none).
|
|
25
|
+
*/
|
|
26
|
+
export function SnackbarProvider({ children, duration = 4000, regionLabel: regionLabelProp, }) {
|
|
27
|
+
const regionLabel = useCrispMessage(regionLabelProp, "Notifications");
|
|
28
|
+
const [queue, setQueue] = React.useState([]);
|
|
29
|
+
const idRef = React.useRef(0);
|
|
30
|
+
const timer = React.useRef(null);
|
|
31
|
+
const regionRef = React.useRef(null);
|
|
32
|
+
const cameFrom = React.useRef(null);
|
|
33
|
+
const focusAfterDismiss = useFocusAfterRemoval(regionRef, ".crisp-snackbar-action", cameFrom);
|
|
34
|
+
React.useEffect(() => {
|
|
35
|
+
const onFocusIn = (e) => {
|
|
36
|
+
const target = e.target;
|
|
37
|
+
if (!target || regionRef.current?.contains(target))
|
|
38
|
+
return;
|
|
39
|
+
cameFrom.current = target;
|
|
40
|
+
};
|
|
41
|
+
document.addEventListener("focusin", onFocusIn);
|
|
42
|
+
return () => document.removeEventListener("focusin", onFocusIn);
|
|
43
|
+
}, []);
|
|
44
|
+
const dismiss = React.useCallback((id) => {
|
|
45
|
+
setQueue((list) => list.filter((s) => s.id !== id));
|
|
46
|
+
if (timer.current) {
|
|
47
|
+
clearTimeout(timer.current);
|
|
48
|
+
timer.current = null;
|
|
49
|
+
}
|
|
50
|
+
}, []);
|
|
51
|
+
const show = React.useCallback((o) => {
|
|
52
|
+
idRef.current += 1;
|
|
53
|
+
const id = idRef.current;
|
|
54
|
+
setQueue((list) => [...list, { ...o, id }]);
|
|
55
|
+
return id;
|
|
56
|
+
}, []);
|
|
57
|
+
// Only the FRONT of the queue is ever mounted, so its own auto-dismiss
|
|
58
|
+
// timer starts when it becomes visible, not when `show` was called.
|
|
59
|
+
const current = queue[0];
|
|
60
|
+
React.useEffect(() => {
|
|
61
|
+
if (!current)
|
|
62
|
+
return;
|
|
63
|
+
const d = current.duration ?? duration;
|
|
64
|
+
if (d <= 0)
|
|
65
|
+
return;
|
|
66
|
+
timer.current = setTimeout(() => dismiss(current.id), d);
|
|
67
|
+
return () => {
|
|
68
|
+
if (timer.current)
|
|
69
|
+
clearTimeout(timer.current);
|
|
70
|
+
};
|
|
71
|
+
}, [current, duration, dismiss]);
|
|
72
|
+
const api = React.useMemo(() => ({ show, dismiss }), [show, dismiss]);
|
|
73
|
+
return (_jsxs(SnackbarContext.Provider, { value: api, children: [children, _jsx("div", { className: snackbarRecipe(), children: _jsx("div", { ref: regionRef, className: "crisp-snackbar-region", role: "region", "aria-label": regionLabel, "aria-live": "polite", "aria-atomic": "false", children: current && (_jsx(SnackbarPill, { item: current, onClose: () => {
|
|
74
|
+
focusAfterDismiss(0);
|
|
75
|
+
dismiss(current.id);
|
|
76
|
+
} }, current.id)) }) })] }));
|
|
77
|
+
}
|
|
78
|
+
SnackbarProvider.displayName = "SnackbarProvider";
|
|
79
|
+
export function useSnackbar() {
|
|
80
|
+
const ctx = React.useContext(SnackbarContext);
|
|
81
|
+
if (!ctx)
|
|
82
|
+
throw new Error("useSnackbar must be used within a SnackbarProvider");
|
|
83
|
+
return ctx;
|
|
84
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { defineRecipe, resolveRecipe } from "../../core/index.js";
|
|
2
|
+
import { contract as c } from "../../tokens/index.js";
|
|
3
|
+
// A mobile-pattern snackbar — daangn/seed-design's
|
|
4
|
+
// packages/rootage/components/snackbar.yaml (dev@e1c486b904297f7b6a8f17b8523f732c37015d60),
|
|
5
|
+
// not Attio (no such component lives there; crisp#911). A single dark
|
|
6
|
+
// `bgNeutralInverted` pill, bottom-anchored, holding an optional tone-coloured
|
|
7
|
+
// prefix icon, a message, and an optional bold action. Every numeric value
|
|
8
|
+
// below cites its yaml line; sizes/radii already equal existing crisp tokens
|
|
9
|
+
// (crisp's space/radius scale was itself derived 2px-granular, same as
|
|
10
|
+
// seed's `dimension`/`radius` scales, so no new tokens were needed).
|
|
11
|
+
//
|
|
12
|
+
// Deviation from the spec's literal `actionButton.color: $color.fg.brand`
|
|
13
|
+
// (snackbar.yaml:128, seed's carrot-600 `#ff6600`): crisp's OWN brand token
|
|
14
|
+
// is TechPartners' verified blue (`bgBrandSolid`, `#0298d9`), not seed's
|
|
15
|
+
// orange (the identity migration takes seed's STRUCTURE, crisp's own colour
|
|
16
|
+
// -- `~/grc-parity/seed-identity-spec.md`). Computed contrast of
|
|
17
|
+
// `bgBrandSolid` on `bgNeutralInverted` (light theme: `#0298d9` on `#2a3038`)
|
|
18
|
+
// is 4.11:1 -- below AA's 4.5:1 for 14px text (bold 14px does not clear the
|
|
19
|
+
// large-text 3:1 threshold, which needs 18.66px). crisp has no brand step
|
|
20
|
+
// bright enough on this dark surface yet, so the action reads in
|
|
21
|
+
// `fgOnNeutralInverted` (the same token the message already uses) at bold
|
|
22
|
+
// weight instead -- distinguished by weight, not colour, until a dedicated
|
|
23
|
+
// token is measured.
|
|
24
|
+
const config = defineRecipe({
|
|
25
|
+
name: "snackbar",
|
|
26
|
+
base: `
|
|
27
|
+
& .crisp-snackbar-region {
|
|
28
|
+
position: fixed; z-index: 80; inset-inline: 0; bottom: 0;
|
|
29
|
+
display: flex; justify-content: center;
|
|
30
|
+
padding: ${c.space["2"]}; /* snackbar.yaml:95-96 region.paddingX/paddingY = $dimension.x2 (8px) */
|
|
31
|
+
pointer-events: none;
|
|
32
|
+
}
|
|
33
|
+
& .crisp-snackbar {
|
|
34
|
+
pointer-events: auto; box-sizing: border-box;
|
|
35
|
+
display: flex; align-items: center; gap: ${c.space["2.5"]}; /* snackbar.yaml:116 content.gap = $dimension.x2_5 (10px), reused as the icon+message-to-action gap */
|
|
36
|
+
min-height: 44px; max-width: 464px; /* snackbar.yaml:102-103 */
|
|
37
|
+
width: max-content;
|
|
38
|
+
padding: ${c.space["2.5"]}; /* snackbar.yaml:104-105 root.paddingX/paddingY = $dimension.x2_5 (10px) */
|
|
39
|
+
border-radius: ${c.radius.md}; /* snackbar.yaml:101 root.cornerRadius = $radius.r2 (8px) */
|
|
40
|
+
background: ${c.bgNeutralInverted}; /* snackbar.yaml:100 root.color = $color.bg.neutral-inverted */
|
|
41
|
+
font-family: ${c.font.sans};
|
|
42
|
+
opacity: 1; transform: scale(1);
|
|
43
|
+
transition: opacity 150ms cubic-bezier(0,0,.15,1), transform 150ms cubic-bezier(0,0,.15,1); /* snackbar.yaml:108-109 enterDuration/enterTimingFunction = $duration.d3 (150ms) / $timing-function.enter */
|
|
44
|
+
@starting-style { opacity: 0; transform: scale(0.8); } /* snackbar.yaml:106-107 enterOpacity/enterScale */
|
|
45
|
+
}
|
|
46
|
+
& .crisp-snackbar-content { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: ${c.space["0.5"]}; } /* snackbar.yaml:124 prefixIcon.paddingRight = $dimension.x0_5 (2px), used as the icon-to-message gap */
|
|
47
|
+
& .crisp-snackbar-icon { flex-shrink: 0; display: inline-flex; }
|
|
48
|
+
& .crisp-snackbar[data-variant="positive"] .crisp-snackbar-icon { color: ${c.bgSuccess}; } /* snackbar.yaml:138-139 variant=positive prefixIcon.color = $color.fg.positive */
|
|
49
|
+
& .crisp-snackbar[data-variant="critical"] .crisp-snackbar-icon { color: ${c.bgDanger}; } /* snackbar.yaml:142-143 variant=critical prefixIcon.color = $color.fg.critical */
|
|
50
|
+
& .crisp-snackbar-message { flex: 1 1 auto; min-width: 0; color: ${c.fgOnNeutralInverted}; font-size: ${c.text.lg}; line-height: 19px; font-weight: ${c.weight.regular}; } /* snackbar.yaml:117-121: message.color = $color.fg.neutral-inverted, fontSize/lineHeight = $font-size.t4/$line-height.t4 (14px/19px), fontWeight = regular */
|
|
51
|
+
& .crisp-snackbar-action {
|
|
52
|
+
flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
|
|
53
|
+
min-height: 44px; padding: 0 ${c.space["2"]}; margin: -12px calc(-1 * ${c.space["2"]}); /* snackbar.yaml:126-127 targetPaddingX/targetMinHeight = $dimension.x2 (8px, doubled here as horizontal padding)/44px -- a larger invisible tap target than the pill's own 44px content row, via negative margin so it doesn't grow the pill visually */
|
|
54
|
+
border: none; border-radius: ${c.radius.md}; background: none;
|
|
55
|
+
color: ${c.fgOnNeutralInverted}; font-family: inherit; font-size: ${c.text.lg}; line-height: 19px; font-weight: ${c.weight.bold}; /* fontSize/lineHeight = t4/line-height.t4; fontWeight = bold (snackbar.yaml:129-131); colour deviation documented above */
|
|
56
|
+
cursor: pointer;
|
|
57
|
+
transition: transform 150ms cubic-bezier(0,0,.15,1);
|
|
58
|
+
}
|
|
59
|
+
& .crisp-snackbar-action:active { transform: scale(0.98); } /* snackbar.yaml:133-134 pressed.actionButton.scaleScope = self */
|
|
60
|
+
`,
|
|
61
|
+
variants: {},
|
|
62
|
+
defaultVariants: {},
|
|
63
|
+
compoundVariants: [],
|
|
64
|
+
});
|
|
65
|
+
export const snackbarRecipe = Object.assign(resolveRecipe(config), {
|
|
66
|
+
config,
|
|
67
|
+
});
|
|
68
|
+
export default config;
|
|
@@ -175,5 +175,10 @@ export const toolbarChromeBody = (p) => ` & .${CLASS_PREFIX}${p}-menu-head {
|
|
|
175
175
|
& .${CLASS_PREFIX}${p}-fchip-x:hover { background: color-mix(in srgb, ${c.fgPrimary} 10%, transparent); color: ${c.fgPrimary}; }
|
|
176
176
|
& .${CLASS_PREFIX}${p}-spacer { flex: 1; }
|
|
177
177
|
& .${CLASS_PREFIX}${p}-count { font-size: ${c.text.md}; color: ${c.fgMuted}; }
|
|
178
|
-
|
|
179
|
-
|
|
178
|
+
/* your-moon/crisp#953: bgBrandContrast, not bgBrandSolid --
|
|
179
|
+
the accent (#0298d9) only clears 3.23:1 with white; the darker sibling
|
|
180
|
+
clears 4.5:1+, same fix already applied to Button/Badge/Avatar (#897).
|
|
181
|
+
Hover is a brightness filter on the new fill, not bgBrandSolidPressed
|
|
182
|
+
(that token stays tuned for the lighter accent's own consumers). */
|
|
183
|
+
& .${CLASS_PREFIX}${p}-new { display: inline-flex; align-items: center; gap: ${c.space["1"]}; height: ${c.size.row}; padding: 0 ${c.space["2.5"]}; border: none; border-radius: ${c.radius.md}; background: ${c.bgBrandContrast}; color: ${c.fgOnBrand}; font-family: inherit; font-size: ${c.text.md}; font-weight: ${c.weight.medium}; cursor: pointer; transition: filter .12s; }
|
|
184
|
+
& .${CLASS_PREFIX}${p}-new:hover { filter: brightness(0.96); }`;
|
|
@@ -2,7 +2,7 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
|
|
|
2
2
|
import { ArrowDownWideNarrow, ArrowUpDown, ArrowUpNarrowWide, Check, ChevronDown, ChevronLeft, ChevronRight, CircleHelp, Download, GripVertical, ListFilter, MoreVertical, Plus, SlidersHorizontal, Trash2, Upload, X, } from "lucide-react";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { createPortal } from "react-dom";
|
|
5
|
-
import { FloatingPortal, isInsideLaterFloatingLayer, placeFloating, registerFloatingLayer, useCrispMessage, useCrispMessages, useFocusAfterRemoval, } from "../../core/index.js";
|
|
5
|
+
import { FloatingPortal, isInsideLaterFloatingLayer, placeFloating, registerFloatingLayer, useCrispComponentDefaults, useCrispMessage, useCrispMessages, useFocusAfterRemoval, } from "../../core/index.js";
|
|
6
6
|
import { DatePicker, } from "../datepicker/index.js";
|
|
7
7
|
import { MenuCheckboxItem, useMenuKeyboard } from "../menu/index.js";
|
|
8
8
|
import { Select } from "../select/index.js";
|
|
@@ -44,7 +44,7 @@ function ViewBarSlot({ target, children, }) {
|
|
|
44
44
|
// file, not per call site, and three independently attributed tags for
|
|
45
45
|
// the same name over-counts against that (it expects one per name).
|
|
46
46
|
const RtlChevronRight = ({ size, className, }) => (_jsx(ChevronRight, { "data-rtl-flip": "", size: size, strokeWidth: 1.75, className: className }));
|
|
47
|
-
const
|
|
47
|
+
export const toolbarOperatorLabels = {
|
|
48
48
|
contains: "contains",
|
|
49
49
|
doesnotcontain: "does not contain",
|
|
50
50
|
startswith: "starts with",
|
|
@@ -65,6 +65,33 @@ const OP_LABELS = {
|
|
|
65
65
|
before: "before",
|
|
66
66
|
after: "after",
|
|
67
67
|
};
|
|
68
|
+
/**
|
|
69
|
+
* crisp/#962: resolves each operator word through four layers, explicit
|
|
70
|
+
* prop winning, same "prop beats provider beats built-in" order as every
|
|
71
|
+
* other label in this file — `operatorLabels` prop, then a
|
|
72
|
+
* `CrispMessagesProvider`'s `componentDefaults.tableToolbar` (the new,
|
|
73
|
+
* discoverable, typed override), then the OLD whole-`CrispMessages`-
|
|
74
|
+
* dictionary-keyed-by-English-string lookup this file already had (kept
|
|
75
|
+
* so a consumer who already added entries there keeps working, unchanged),
|
|
76
|
+
* then the hardcoded English word. Not `useCrispMessage` in a loop over 13
|
|
77
|
+
* keys — that breaks the rules of hooks the same reason `useCrispMessages`
|
|
78
|
+
* itself exists (see that hook's own doc comment).
|
|
79
|
+
*/
|
|
80
|
+
function useToolbarOperatorLabels(operatorLabels, crispMessages) {
|
|
81
|
+
const providerLabels = useCrispComponentDefaults("tableToolbar");
|
|
82
|
+
return React.useMemo(() => {
|
|
83
|
+
const resolved = {};
|
|
84
|
+
for (const op of Object.keys(toolbarOperatorLabels)) {
|
|
85
|
+
const builtIn = toolbarOperatorLabels[op];
|
|
86
|
+
resolved[op] =
|
|
87
|
+
operatorLabels?.[op] ??
|
|
88
|
+
providerLabels?.[op] ??
|
|
89
|
+
crispMessages[builtIn] ??
|
|
90
|
+
builtIn;
|
|
91
|
+
}
|
|
92
|
+
return resolved;
|
|
93
|
+
}, [operatorLabels, providerLabels, crispMessages]);
|
|
94
|
+
}
|
|
68
95
|
// #619: order and label set match Attio's own text-filter operator picker
|
|
69
96
|
// verbatim (measured live, per RecordsTable's own #578 port of the same
|
|
70
97
|
// set: contains · does not contain · starts with · ends with · is · is not ·
|
|
@@ -329,7 +356,7 @@ export function applySorts(rows, sorts, get = (row, key) => row[key]) {
|
|
|
329
356
|
* this (Sort: Due date/Assignee/Creation date; Filter: Assignee/Record/
|
|
330
357
|
* Created by), which one shared list can't reproduce.
|
|
331
358
|
*/
|
|
332
|
-
export function TableToolbar({ columns, sortColumns: sortColumnsProp, filterColumns: filterColumnsProp, sorts: sortsProp, defaultSorts, onSortsChange, filters: filtersProp, defaultFilters, onFiltersChange, count, children, helpHref, className, sortLabel: sortLabelProp, filterLabel: filterLabelProp, reorderSortLabel: reorderSortLabelProp, noSortsLabel: noSortsLabelProp, addSortLabel: addSortLabelProp, learnSortingLabel: learnSortingLabelProp, selectConditionLabel: selectConditionLabelProp, sortFieldLabel: sortFieldLabelProp, sortDirectionLabel: sortDirectionLabelProp, removeSortLabel: removeSortLabelProp, filterFieldLabel: filterFieldLabelProp, filterFieldPlaceholder: filterFieldPlaceholderProp, filterValuePlaceholder: filterValuePlaceholderProp, filterOptionsLabel: filterOptionsLabelProp, deleteFilterLabel: deleteFilterLabelProp, ascendingLabel: ascendingLabelProp, descendingLabel: descendingLabelProp, sortTriggerLabel, filterTriggerLabel, inline, showSort = true, showViewSettings = true, viewSettingsRef, importExportRef, viewColumns: viewColumnsProp, shownKeys: shownKeysProp, defaultShownKeys, onShownKeysChange, viewSettingsLabel: viewSettingsLabelProp, reorderAttributeLabel: reorderAttributeLabelProp, hideAttributeLabel, addAttributeToViewLabel: addAttributeToViewLabelProp, searchAttributesPlaceholder: searchAttributesPlaceholderProp, importExportLabel: importExportLabelProp, onImportCsv, onExportCsv, onExportExcel, importExportHelpHref, importCsvLabel: importCsvLabelProp, exportCsvLabel: exportCsvLabelProp, exportExcelLabel: exportExcelLabelProp, learnImportExportLabel: learnImportExportLabelProp, backLabel: backLabelProp, nestedFieldPlaceholder, ...rest }) {
|
|
359
|
+
export function TableToolbar({ columns, sortColumns: sortColumnsProp, filterColumns: filterColumnsProp, sorts: sortsProp, defaultSorts, onSortsChange, filters: filtersProp, defaultFilters, onFiltersChange, count, children, helpHref, className, sortLabel: sortLabelProp, filterLabel: filterLabelProp, reorderSortLabel: reorderSortLabelProp, noSortsLabel: noSortsLabelProp, addSortLabel: addSortLabelProp, learnSortingLabel: learnSortingLabelProp, selectConditionLabel: selectConditionLabelProp, sortFieldLabel: sortFieldLabelProp, sortDirectionLabel: sortDirectionLabelProp, removeSortLabel: removeSortLabelProp, filterFieldLabel: filterFieldLabelProp, filterFieldPlaceholder: filterFieldPlaceholderProp, filterValuePlaceholder: filterValuePlaceholderProp, filterOptionsLabel: filterOptionsLabelProp, deleteFilterLabel: deleteFilterLabelProp, operatorLabels, ascendingLabel: ascendingLabelProp, descendingLabel: descendingLabelProp, sortTriggerLabel, filterTriggerLabel, inline, showSort = true, showViewSettings = true, viewSettingsRef, importExportRef, viewColumns: viewColumnsProp, shownKeys: shownKeysProp, defaultShownKeys, onShownKeysChange, viewSettingsLabel: viewSettingsLabelProp, reorderAttributeLabel: reorderAttributeLabelProp, hideAttributeLabel, addAttributeToViewLabel: addAttributeToViewLabelProp, searchAttributesPlaceholder: searchAttributesPlaceholderProp, importExportLabel: importExportLabelProp, onImportCsv, onExportCsv, onExportExcel, importExportHelpHref, importCsvLabel: importCsvLabelProp, exportCsvLabel: exportCsvLabelProp, exportExcelLabel: exportExcelLabelProp, learnImportExportLabel: learnImportExportLabelProp, backLabel: backLabelProp, nestedFieldPlaceholder, ...rest }) {
|
|
333
360
|
// crisp/#471: an explicit prop always wins; missing, it reads the nearest
|
|
334
361
|
// CrispMessagesProvider's translation of the English default below, or
|
|
335
362
|
// that default itself with no provider — unchanged from before this
|
|
@@ -362,12 +389,12 @@ export function TableToolbar({ columns, sortColumns: sortColumnsProp, filterColu
|
|
|
362
389
|
const exportExcelLabel = useCrispMessage(exportExcelLabelProp, "Export view as Excel");
|
|
363
390
|
const learnImportExportLabel = useCrispMessage(learnImportExportLabelProp, "Learn about imports and exports");
|
|
364
391
|
const backLabel = useCrispMessage(backLabelProp, "Back");
|
|
365
|
-
// OP_LABELS' own words ("contains", "is", "is any of", …) have no prop of
|
|
366
|
-
// their own — a whole lookup table, not one string — so they translate
|
|
367
|
-
// straight from the provider's dictionary at the two spots they render
|
|
368
|
-
// (#628, #673 below), same fallback order as every resolved constant
|
|
369
|
-
// above.
|
|
370
392
|
const crispMessages = useCrispMessages();
|
|
393
|
+
// crisp/#962: `operatorLabels` prop + `componentDefaults.tableToolbar`,
|
|
394
|
+
// layered over the old whole-dictionary lookup — see
|
|
395
|
+
// `useToolbarOperatorLabels`'s own doc comment for the full resolution
|
|
396
|
+
// order.
|
|
397
|
+
const opLabels = useToolbarOperatorLabels(operatorLabels, crispMessages);
|
|
371
398
|
// Each side falls back to the shared `columns` independently — a caller
|
|
372
399
|
// that only overrides one (Filter's own Record/Created by, say) still
|
|
373
400
|
// gets `columns` on the other, unchanged from before either prop existed.
|
|
@@ -803,9 +830,7 @@ export function TableToolbar({ columns, sortColumns: sortColumnsProp, filterColu
|
|
|
803
830
|
return (_jsxs("span", { className: "crisp-tabletoolbar-toolgroup", children: [_jsxs("span", { className: "crisp-tabletoolbar-fcond", "data-complete": complete ? "" : undefined, children: [_jsxs("button", { type: "button", className: "crisp-tabletoolbar-fcond-seg crisp-tabletoolbar-fcond-seg--field", "data-menu-trigger": true, "aria-haspopup": "dialog", "aria-expanded": fieldOpen, onClick: () => {
|
|
804
831
|
setFieldPickerPath([]);
|
|
805
832
|
setOpenMenu(fieldOpen ? null : `ffield:${cond.id}`);
|
|
806
|
-
}, children: [col?.icon ? _jsx(col.icon, { size: 14, strokeWidth: 1.75 }) : null, colPath.length > 1 ? (_jsx("span", { className: "crisp-tabletoolbar-fcond-path", children: colPath.map((c, i) => (_jsxs(React.Fragment, { children: [i > 0 && (_jsx(RtlChevronRight, { size: 14, className: "crisp-tabletoolbar-fcond-path-sep" })), _jsx("span", { className: "crisp-tabletoolbar-fcond-path-seg", children: c.label })] }, c.key))) })) : (col?.label)] }), _jsx("button", { type: "button", className: "crisp-tabletoolbar-fcond-seg crisp-tabletoolbar-fcond-seg--op", "data-menu-trigger": true, "aria-haspopup": "menu", "aria-expanded": opOpen, onClick: () => setOpenMenu(opOpen ? null : `fop:${cond.id}`), children: cond.op
|
|
807
|
-
? (crispMessages[OP_LABELS[cond.op]] ?? OP_LABELS[cond.op])
|
|
808
|
-
: selectConditionLabel }), showValueSeg && (_jsx("button", { type: "button", className: "crisp-tabletoolbar-fcond-seg crisp-tabletoolbar-fcond-seg--val", "data-menu-trigger": true, "aria-haspopup": "dialog", "aria-expanded": valOpen, onClick: () => setOpenMenu(valOpen ? null : `fval:${cond.id}`), children: cond.op === "isanyof"
|
|
833
|
+
}, children: [col?.icon ? _jsx(col.icon, { size: 14, strokeWidth: 1.75 }) : null, colPath.length > 1 ? (_jsx("span", { className: "crisp-tabletoolbar-fcond-path", children: colPath.map((c, i) => (_jsxs(React.Fragment, { children: [i > 0 && (_jsx(RtlChevronRight, { size: 14, className: "crisp-tabletoolbar-fcond-path-sep" })), _jsx("span", { className: "crisp-tabletoolbar-fcond-path-seg", children: c.label })] }, c.key))) })) : (col?.label)] }), _jsx("button", { type: "button", className: "crisp-tabletoolbar-fcond-seg crisp-tabletoolbar-fcond-seg--op", "data-menu-trigger": true, "aria-haspopup": "menu", "aria-expanded": opOpen, onClick: () => setOpenMenu(opOpen ? null : `fop:${cond.id}`), children: cond.op ? opLabels[cond.op] : selectConditionLabel }), showValueSeg && (_jsx("button", { type: "button", className: "crisp-tabletoolbar-fcond-seg crisp-tabletoolbar-fcond-seg--val", "data-menu-trigger": true, "aria-haspopup": "dialog", "aria-expanded": valOpen, onClick: () => setOpenMenu(valOpen ? null : `fval:${cond.id}`), children: cond.op === "isanyof"
|
|
809
834
|
? cond.values?.length
|
|
810
835
|
? isAnyOfSummary(cond.values)
|
|
811
836
|
: filterValuePlaceholder
|
|
@@ -813,7 +838,7 @@ export function TableToolbar({ columns, sortColumns: sortColumnsProp, filterColu
|
|
|
813
838
|
? col?.type === "date"
|
|
814
839
|
? formatFilterDate(cond.value)
|
|
815
840
|
: cond.value
|
|
816
|
-
: filterValuePlaceholder })), _jsx("button", { type: "button", className: "crisp-tabletoolbar-fcond-seg crisp-tabletoolbar-fcond-seg--kebab", "data-menu-trigger": true, "aria-haspopup": "menu", "aria-expanded": kebabOpen, "aria-label": `${col?.label} ${filterOptionsLabel}`, onClick: () => setOpenMenu(kebabOpen ? null : `fkebab:${cond.id}`), children: _jsx(MoreVertical, { size: 13, strokeWidth: 2 }) })] }), kebabOpen && (_jsx("div", { ref: kebabMenuRef, className: "crisp-tabletoolbar-menu crisp-tabletoolbar-menu--right crisp-tabletoolbar-menu--hdr", role: "menu", "aria-label": `${col?.label} ${filterOptionsLabel}`, onKeyDown: onKebabKeyDown, children: _jsxs("button", { type: "button", role: "menuitem", className: "crisp-tabletoolbar-menu-item crisp-tabletoolbar-menu-item--danger", onClick: () => removeFilter(cond.id), children: [_jsx(Trash2, { size: 16, strokeWidth: 1.75 }), deleteFilterLabel] }) })), fieldOpen && (_jsx("div", { className: "crisp-tabletoolbar-menu", role: "dialog", "aria-label": filterFieldLabel, children: nestedFieldPicker(filterColumns, (key) => changeFilterField(cond.id, key), filterFieldPlaceholder, filterFieldLabel) })), opOpen && (_jsx("div", { ref: opMenuRef, className: "crisp-tabletoolbar-menu crisp-tabletoolbar-menu--op", role: "menu", "aria-label": `${col?.label} ${crispMessages.condition ?? "condition"}`, onKeyDown: onOpKeyDown, children: opsFor(col).map((op) => (_jsxs("button", { type: "button", role: "menuitem", className: "crisp-tabletoolbar-menu-item", "data-on": cond.op === op ? "" : undefined, onClick: () => pickOp(cond.id, op), children: [
|
|
841
|
+
: filterValuePlaceholder })), _jsx("button", { type: "button", className: "crisp-tabletoolbar-fcond-seg crisp-tabletoolbar-fcond-seg--kebab", "data-menu-trigger": true, "aria-haspopup": "menu", "aria-expanded": kebabOpen, "aria-label": `${col?.label} ${filterOptionsLabel}`, onClick: () => setOpenMenu(kebabOpen ? null : `fkebab:${cond.id}`), children: _jsx(MoreVertical, { size: 13, strokeWidth: 2 }) })] }), kebabOpen && (_jsx("div", { ref: kebabMenuRef, className: "crisp-tabletoolbar-menu crisp-tabletoolbar-menu--right crisp-tabletoolbar-menu--hdr", role: "menu", "aria-label": `${col?.label} ${filterOptionsLabel}`, onKeyDown: onKebabKeyDown, children: _jsxs("button", { type: "button", role: "menuitem", className: "crisp-tabletoolbar-menu-item crisp-tabletoolbar-menu-item--danger", onClick: () => removeFilter(cond.id), children: [_jsx(Trash2, { size: 16, strokeWidth: 1.75 }), deleteFilterLabel] }) })), fieldOpen && (_jsx("div", { className: "crisp-tabletoolbar-menu", role: "dialog", "aria-label": filterFieldLabel, children: nestedFieldPicker(filterColumns, (key) => changeFilterField(cond.id, key), filterFieldPlaceholder, filterFieldLabel) })), opOpen && (_jsx("div", { ref: opMenuRef, className: "crisp-tabletoolbar-menu crisp-tabletoolbar-menu--op", role: "menu", "aria-label": `${col?.label} ${crispMessages.condition ?? "condition"}`, onKeyDown: onOpKeyDown, children: opsFor(col).map((op) => (_jsxs("button", { type: "button", role: "menuitem", className: "crisp-tabletoolbar-menu-item", "data-on": cond.op === op ? "" : undefined, onClick: () => pickOp(cond.id, op), children: [opLabels[op], cond.op === op ? (_jsx(Check, { className: "crisp-tabletoolbar-menu-check", size: 15, strokeWidth: 1.75 })) : null] }, op))) })), valOpen && showValueSeg && (_jsx("div", { className: "crisp-tabletoolbar-menu crisp-tabletoolbar-menu--val", role: "dialog", "aria-label": `${col?.label} filter value`, children: cond.op === "isanyof" && col?.values ? (_jsxs(_Fragment, { children: [_jsx("input", { className: "crisp-tabletoolbar-menu-input", placeholder: filterValuePlaceholder, "aria-label": `${col?.label} filter values`,
|
|
817
842
|
// biome-ignore lint/a11y/noAutofocus: focus the search field
|
|
818
843
|
autoFocus: true, value: anyOfQuery, onChange: (e) => setAnyOfQuery(e.target.value) }), col.values
|
|
819
844
|
.filter((v) => v
|
|
@@ -10,7 +10,7 @@ import { useTablistKeyboard } from "./tabs-keyboard.js";
|
|
|
10
10
|
* Home/End jump); activation follows focus. Controlled via
|
|
11
11
|
* `value`/`onValueChange`, or uncontrolled from `defaultValue`.
|
|
12
12
|
*/
|
|
13
|
-
export function Tabs({ tabs, value, defaultValue, onValueChange, leading, children, moreLabel = (n) => `+${n} more`, moreMenuLabel = "More tabs", className, fill, "aria-label": ariaLabel, ...rest }) {
|
|
13
|
+
export function Tabs({ tabs, value, defaultValue, onValueChange, leading, children, moreLabel = (n) => `+${n} more`, moreMenuLabel = "More tabs", overflow = "collapse", className, fill, "aria-label": ariaLabel, ...rest }) {
|
|
14
14
|
// Scoped to this instance: `tab-${value}` and `panel-${value}` are global,
|
|
15
15
|
// so two tab bars sharing a value mint the same id twice and every
|
|
16
16
|
// aria-labelledby resolves to the first one (#227).
|
|
@@ -57,6 +57,12 @@ export function Tabs({ tabs, value, defaultValue, onValueChange, leading, childr
|
|
|
57
57
|
const [hiddenFrom, setHiddenFrom] = React.useState(null);
|
|
58
58
|
const moreRef = React.useRef(null);
|
|
59
59
|
React.useLayoutEffect(() => {
|
|
60
|
+
// crisp#908: "scroll" never collapses anything -- the row scrolls
|
|
61
|
+
// instead, so there is nothing to measure or hide.
|
|
62
|
+
if (overflow !== "collapse") {
|
|
63
|
+
setHiddenFrom(null);
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
60
66
|
const list = listRef.current;
|
|
61
67
|
if (!list || tabs.length === 0)
|
|
62
68
|
return;
|
|
@@ -97,7 +103,7 @@ export function Tabs({ tabs, value, defaultValue, onValueChange, leading, childr
|
|
|
97
103
|
const ro = new ResizeObserver(recompute);
|
|
98
104
|
ro.observe(list);
|
|
99
105
|
return () => ro.disconnect();
|
|
100
|
-
}, [tabs, active]);
|
|
106
|
+
}, [tabs, active, overflow]);
|
|
101
107
|
const hiddenTabs = hiddenFrom == null ? [] : tabs.slice(hiddenFrom);
|
|
102
108
|
const { onKeyDown, tabIndexFor } = useTablistKeyboard({
|
|
103
109
|
tabs,
|
|
@@ -105,11 +111,11 @@ export function Tabs({ tabs, value, defaultValue, onValueChange, leading, childr
|
|
|
105
111
|
select,
|
|
106
112
|
listRef,
|
|
107
113
|
});
|
|
108
|
-
return (_jsxs("div", { className: tabsRecipe({ fill, className }), ...rest, children: [_jsxs("div", { ref: listRef, className: "crisp-tabs-list", role: "tablist", "aria-label": ariaLabel, onKeyDown: onKeyDown, children: [leading && _jsx("span", { className: "crisp-tabs-leading", children: leading }), tabs.map((t, i) => {
|
|
114
|
+
return (_jsxs("div", { className: tabsRecipe({ fill, className }), ...rest, children: [_jsxs("div", { ref: listRef, className: "crisp-tabs-list", "data-overflow": overflow, role: "tablist", "aria-label": ariaLabel, onKeyDown: onKeyDown, children: [leading && _jsx("span", { className: "crisp-tabs-leading", children: leading }), tabs.map((t, i) => {
|
|
109
115
|
const selected = t.value === active;
|
|
110
116
|
const overflowHidden = hiddenFrom != null && i >= hiddenFrom;
|
|
111
117
|
return (_jsxs("button", { type: "button", role: "tab", id: tabId(t.value), "aria-selected": selected, "aria-controls": children && selected ? panelId(t.value) : undefined, tabIndex: overflowHidden ? -1 : tabIndexFor(t.value), "data-value": t.value, "data-selected": selected ? "" : undefined, "data-tabs-overflow-hidden": overflowHidden ? "" : undefined, disabled: t.disabled, className: "crisp-tabs-tab", onClick: () => select(t.value), children: [t.icon, _jsx("span", { className: "tabs-tab-label", children: t.label }), t.badge != null && (_jsx("span", { className: "crisp-tabs-tab-badge", children: t.badge }))] }, t.value));
|
|
112
|
-
}), _jsx("span", { ref: moreRef, className: "crisp-tabs-more", "data-tabs-overflow-hidden": hiddenTabs.length === 0 ? "" : undefined, children: _jsx(Menu, { "aria-label": moreMenuLabel, trigger: _jsxs("button", { type: "button", className: "crisp-tabs-tab", children: [_jsx("span", { className: "tabs-tab-label", children: moreLabel(hiddenTabs.length) }), _jsx(ChevronDown, { size: 16, strokeWidth: 1.75, "aria-hidden": "true" })] }), children: hiddenTabs.map((t) => (_jsxs(MenuItem, { icon: t.icon, onSelect: () => select(t.value), children: [t.label, t.badge != null && (_jsx("span", { className: "crisp-tabs-tab-badge", children: t.badge }))] }, t.value))) }) }), indicator && (_jsx("span", { className: "crisp-tabs-indicator", style: {
|
|
118
|
+
}), overflow === "collapse" && (_jsx("span", { ref: moreRef, className: "crisp-tabs-more", "data-tabs-overflow-hidden": hiddenTabs.length === 0 ? "" : undefined, children: _jsx(Menu, { "aria-label": moreMenuLabel, trigger: _jsxs("button", { type: "button", className: "crisp-tabs-tab", children: [_jsx("span", { className: "tabs-tab-label", children: moreLabel(hiddenTabs.length) }), _jsx(ChevronDown, { size: 16, strokeWidth: 1.75, "aria-hidden": "true" })] }), children: hiddenTabs.map((t) => (_jsxs(MenuItem, { icon: t.icon, onSelect: () => select(t.value), children: [t.label, t.badge != null && (_jsx("span", { className: "crisp-tabs-tab-badge", children: t.badge }))] }, t.value))) }) })), indicator && (_jsx("span", { className: "crisp-tabs-indicator", style: {
|
|
113
119
|
width: indicator.width,
|
|
114
120
|
transform: `translateX(${indicator.left}px)`,
|
|
115
121
|
} }))] }), children && (_jsx("div", { className: "crisp-tabs-panel", role: "tabpanel", id: panelId(active), "aria-labelledby": tabId(active),
|