@crisp-ui-kit/crisp 0.5.0 → 0.7.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 +14 -0
- package/dist/accordion.css +9 -1
- package/dist/appshell.css +12 -4
- package/dist/authshell.css +57 -0
- package/dist/authshell.d.ts +7 -0
- package/dist/avatargroup.css +2 -2
- package/dist/badge.css +4 -4
- package/dist/barchart.css +13 -5
- package/dist/board.css +9 -1
- package/dist/bulkbar.css +11 -3
- package/dist/button.css +15 -1
- package/dist/button.d.ts +2 -1
- package/dist/card.css +8 -0
- package/dist/checkbox.css +17 -1
- package/dist/cjs/components/accordion/accordion.js +69 -0
- package/dist/cjs/components/accordion/accordion.recipe.js +26 -0
- package/dist/cjs/components/accordion/index.js +7 -0
- package/dist/cjs/components/avatar/avatar.js +44 -0
- package/dist/cjs/components/avatar/avatar.recipe.js +42 -0
- package/dist/cjs/components/avatar/index.js +7 -0
- package/dist/cjs/components/avatargroup/avatargroup.js +52 -0
- package/dist/cjs/components/avatargroup/avatargroup.recipe.js +18 -0
- package/dist/cjs/components/avatargroup/index.js +7 -0
- package/dist/cjs/components/badge/badge.js +44 -0
- package/dist/cjs/components/badge/badge.recipe.js +68 -0
- package/dist/cjs/components/badge/index.js +7 -0
- package/dist/cjs/components/barchart/barchart.js +45 -0
- package/dist/cjs/components/barchart/barchart.recipe.js +34 -0
- package/dist/cjs/components/barchart/index.js +7 -0
- package/dist/cjs/components/breadcrumb/breadcrumb.js +53 -0
- package/dist/cjs/components/breadcrumb/breadcrumb.recipe.js +21 -0
- package/dist/cjs/components/breadcrumb/index.js +7 -0
- package/dist/cjs/components/bulkbar/bulkbar.js +53 -0
- package/dist/cjs/components/bulkbar/bulkbar.recipe.js +31 -0
- package/dist/cjs/components/bulkbar/index.js +8 -0
- package/dist/cjs/components/button/button.js +62 -0
- package/dist/cjs/components/button/button.recipe.js +58 -0
- package/dist/cjs/components/button/index.js +7 -0
- package/dist/cjs/components/callout/callout.js +25 -0
- package/dist/cjs/components/callout/callout.recipe.js +29 -0
- package/dist/cjs/components/callout/index.js +7 -0
- package/dist/cjs/components/card/card.js +54 -0
- package/dist/cjs/components/card/card.recipe.js +31 -0
- package/dist/cjs/components/card/index.js +10 -0
- package/dist/cjs/components/checkbox/checkbox.js +56 -0
- package/dist/cjs/components/checkbox/checkbox.recipe.js +34 -0
- package/dist/cjs/components/checkbox/index.js +7 -0
- package/dist/cjs/components/columncalc/columncalc.js +139 -0
- package/dist/cjs/components/columncalc/columncalc.recipe.js +33 -0
- package/dist/cjs/components/columncalc/index.js +10 -0
- package/dist/cjs/components/contextmenu/contextmenu.js +78 -0
- package/dist/cjs/components/contextmenu/contextmenu.recipe.js +24 -0
- package/dist/cjs/components/contextmenu/index.js +7 -0
- package/dist/cjs/components/datatable/datatable.js +508 -0
- package/dist/cjs/components/datatable/datatable.recipe.js +113 -0
- package/dist/cjs/components/datatable/index.js +7 -0
- package/dist/cjs/components/datepicker/datepicker.js +153 -0
- package/dist/cjs/components/datepicker/datepicker.recipe.js +180 -0
- package/dist/cjs/components/datepicker/index.js +19 -0
- package/dist/cjs/components/datepickerfield/datepickerfield.js +85 -0
- package/dist/cjs/components/datepickerfield/datepickerfield.recipe.js +44 -0
- package/dist/cjs/components/datepickerfield/index.js +7 -0
- package/dist/cjs/components/dialog/dialog.js +86 -0
- package/dist/cjs/components/dialog/dialog.recipe.js +35 -0
- package/dist/cjs/components/dialog/index.js +9 -0
- package/dist/cjs/components/divider/divider.js +10 -0
- package/dist/cjs/components/divider/divider.recipe.js +17 -0
- package/dist/cjs/components/divider/index.js +7 -0
- package/dist/cjs/components/donutchart/donutchart.js +41 -0
- package/dist/cjs/components/donutchart/donutchart.recipe.js +30 -0
- package/dist/cjs/components/donutchart/index.js +7 -0
- package/dist/cjs/components/drawer/drawer.js +80 -0
- package/dist/cjs/components/drawer/drawer.recipe.js +30 -0
- package/dist/cjs/components/drawer/index.js +9 -0
- package/dist/cjs/components/emptystate/emptystate.js +10 -0
- package/dist/cjs/components/emptystate/emptystate.recipe.js +34 -0
- package/dist/cjs/components/emptystate/index.js +7 -0
- package/dist/cjs/components/formfield/formfield.js +50 -0
- package/dist/cjs/components/formfield/formfield.recipe.js +22 -0
- package/dist/cjs/components/formfield/index.js +7 -0
- package/dist/cjs/components/input/index.js +7 -0
- package/dist/cjs/components/input/input.js +47 -0
- package/dist/cjs/components/input/input.recipe.js +59 -0
- package/dist/cjs/components/kbd/index.js +7 -0
- package/dist/cjs/components/kbd/kbd.js +44 -0
- package/dist/cjs/components/kbd/kbd.recipe.js +23 -0
- package/dist/cjs/components/linechart/index.js +7 -0
- package/dist/cjs/components/linechart/linechart.js +57 -0
- package/dist/cjs/components/linechart/linechart.recipe.js +35 -0
- package/dist/cjs/components/menu/index.js +14 -0
- package/dist/cjs/components/menu/menu-keyboard.js +117 -0
- package/dist/cjs/components/menu/menu.js +144 -0
- package/dist/cjs/components/menu/menu.recipe.js +54 -0
- package/dist/cjs/components/multiselect/index.js +7 -0
- package/dist/cjs/components/multiselect/multiselect.js +161 -0
- package/dist/cjs/components/multiselect/multiselect.recipe.js +71 -0
- package/dist/cjs/components/popover/index.js +7 -0
- package/dist/cjs/components/popover/popover.js +106 -0
- package/dist/cjs/components/popover/popover.recipe.js +21 -0
- package/dist/cjs/components/progress/index.js +7 -0
- package/dist/cjs/components/progress/progress.js +26 -0
- package/dist/cjs/components/progress/progress.recipe.js +20 -0
- package/dist/cjs/components/radiogroup/index.js +8 -0
- package/dist/cjs/components/radiogroup/radiogroup.js +83 -0
- package/dist/cjs/components/radiogroup/radiogroup.recipe.js +40 -0
- package/dist/cjs/components/resizablepanel/index.js +12 -0
- package/dist/cjs/components/resizablepanel/resizablepanel.js +176 -0
- package/dist/cjs/components/resizablepanel/resizablepanel.recipe.js +69 -0
- package/dist/cjs/components/segmented/index.js +7 -0
- package/dist/cjs/components/segmented/segmented.js +95 -0
- package/dist/cjs/components/segmented/segmented.recipe.js +23 -0
- package/dist/cjs/components/select/index.js +7 -0
- package/dist/cjs/components/select/select.js +180 -0
- package/dist/cjs/components/select/select.recipe.js +79 -0
- package/dist/cjs/components/skeleton/index.js +7 -0
- package/dist/cjs/components/skeleton/skeleton.js +13 -0
- package/dist/cjs/components/skeleton/skeleton.recipe.js +17 -0
- package/dist/cjs/components/spinner/index.js +7 -0
- package/dist/cjs/components/spinner/spinner.js +15 -0
- package/dist/cjs/components/spinner/spinner.recipe.js +16 -0
- package/dist/cjs/components/stagebar/index.js +7 -0
- package/dist/cjs/components/stagebar/stagebar.js +26 -0
- package/dist/cjs/components/stagebar/stagebar.recipe.js +17 -0
- package/dist/cjs/components/statcard/index.js +7 -0
- package/dist/cjs/components/statcard/statcard.js +15 -0
- package/dist/cjs/components/statcard/statcard.recipe.js +37 -0
- package/dist/cjs/components/switch/index.js +7 -0
- package/dist/cjs/components/switch/switch.js +58 -0
- package/dist/cjs/components/switch/switch.recipe.js +29 -0
- package/dist/cjs/components/table/index.js +14 -0
- package/dist/cjs/components/table/table.js +66 -0
- package/dist/cjs/components/table/table.recipe.js +43 -0
- package/dist/cjs/components/tabletoolbar/index.js +20 -0
- package/dist/cjs/components/tabletoolbar/tabletoolbar.chrome.js +84 -0
- package/dist/cjs/components/tabletoolbar/tabletoolbar.js +237 -0
- package/dist/cjs/components/tabletoolbar/tabletoolbar.recipe.js +26 -0
- package/dist/cjs/components/tabs/index.js +7 -0
- package/dist/cjs/components/tabs/tabs.js +106 -0
- package/dist/cjs/components/tabs/tabs.recipe.js +36 -0
- package/dist/cjs/components/textarea/index.js +7 -0
- package/dist/cjs/components/textarea/textarea.js +56 -0
- package/dist/cjs/components/textarea/textarea.recipe.js +46 -0
- package/dist/cjs/components/toast/index.js +8 -0
- package/dist/cjs/components/toast/toast.js +95 -0
- package/dist/cjs/components/toast/toast.recipe.js +31 -0
- package/dist/cjs/components/tooltip/index.js +7 -0
- package/dist/cjs/components/tooltip/tooltip.js +95 -0
- package/dist/cjs/components/tooltip/tooltip.recipe.js +16 -0
- package/dist/cjs/components/wheelpicker/index.js +7 -0
- package/dist/cjs/components/wheelpicker/wheelpicker.js +134 -0
- package/dist/cjs/components/wheelpicker/wheelpicker.recipe.js +95 -0
- package/dist/cjs/core/cx.js +8 -0
- package/dist/cjs/core/define.js +6 -0
- package/dist/cjs/core/index.js +11 -0
- package/dist/cjs/core/primitive.js +49 -0
- package/dist/cjs/core/resolve.js +44 -0
- package/dist/cjs/core/types.js +2 -0
- package/dist/cjs/index.js +92 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/product/appshell/appshell.js +104 -0
- package/dist/cjs/product/appshell/appshell.recipe.js +30 -0
- package/dist/cjs/product/appshell/index.js +7 -0
- package/dist/cjs/product/authshell/authshell.js +21 -0
- package/dist/cjs/product/authshell/authshell.recipe.js +67 -0
- package/dist/cjs/product/authshell/index.js +7 -0
- package/dist/cjs/product/board/board.js +78 -0
- package/dist/cjs/product/board/board.recipe.js +31 -0
- package/dist/cjs/product/board/index.js +7 -0
- package/dist/cjs/product/command/command.js +238 -0
- package/dist/cjs/product/command/command.recipe.js +47 -0
- package/dist/cjs/product/command/index.js +8 -0
- package/dist/cjs/product/entitycard/entitycard.js +14 -0
- package/dist/cjs/product/entitycard/entitycard.recipe.js +32 -0
- package/dist/cjs/product/entitycard/index.js +7 -0
- package/dist/cjs/product/flowcanvas/flowcanvas.js +121 -0
- package/dist/cjs/product/flowcanvas/flowcanvas.recipe.js +28 -0
- package/dist/cjs/product/flowcanvas/index.js +7 -0
- package/dist/cjs/product/inbox/inbox.js +16 -0
- package/dist/cjs/product/inbox/inbox.recipe.js +46 -0
- package/dist/cjs/product/inbox/index.js +7 -0
- package/dist/cjs/product/listpage/index.js +8 -0
- package/dist/cjs/product/listpage/listpage.js +25 -0
- package/dist/cjs/product/listpage/listpage.recipe.js +46 -0
- package/dist/cjs/product/navitem/index.js +5 -0
- package/dist/cjs/product/navitem/navitem.js +44 -0
- package/dist/cjs/product/navitem/navitem.recipe.js +36 -0
- package/dist/cjs/product/onboarding/index.js +7 -0
- package/dist/cjs/product/onboarding/onboarding.js +17 -0
- package/dist/cjs/product/onboarding/onboarding.recipe.js +44 -0
- package/dist/cjs/product/recordpage/index.js +7 -0
- package/dist/cjs/product/recordpage/recordpage.js +409 -0
- package/dist/cjs/product/recordpage/recordpage.recipe.js +162 -0
- package/dist/cjs/product/recordpanel/index.js +7 -0
- package/dist/cjs/product/recordpanel/recordpanel.js +83 -0
- package/dist/cjs/product/recordpanel/recordpanel.recipe.js +51 -0
- package/dist/cjs/product/recordstable/company-logos.js +29 -0
- package/dist/cjs/product/recordstable/index.js +10 -0
- package/dist/cjs/product/recordstable/recordstable.js +1092 -0
- package/dist/cjs/product/recordstable/recordstable.recipe.js +152 -0
- package/dist/cjs/product/recordstable/recordstable.tag.js +21 -0
- package/dist/cjs/product/richtext/index.js +7 -0
- package/dist/cjs/product/richtext/richtext.js +147 -0
- package/dist/cjs/product/richtext/richtext.recipe.js +43 -0
- package/dist/cjs/product/settingssection/index.js +7 -0
- package/dist/cjs/product/settingssection/settingssection.js +14 -0
- package/dist/cjs/product/settingssection/settingssection.recipe.js +23 -0
- package/dist/cjs/product/settingsshell/index.js +7 -0
- package/dist/cjs/product/settingsshell/settingsshell.js +59 -0
- package/dist/cjs/product/settingsshell/settingsshell.recipe.js +46 -0
- package/dist/cjs/product/sidebar/index.js +13 -0
- package/dist/cjs/product/sidebar/sidebar.js +148 -0
- package/dist/cjs/product/sidebar/sidebar.recipe.js +46 -0
- package/dist/cjs/product/tasklist/index.js +7 -0
- package/dist/cjs/product/tasklist/tasklist.js +19 -0
- package/dist/cjs/product/tasklist/tasklist.recipe.js +38 -0
- package/dist/cjs/product/trialbanner/index.js +7 -0
- package/dist/cjs/product/trialbanner/trialbanner.js +13 -0
- package/dist/cjs/product/trialbanner/trialbanner.recipe.js +32 -0
- package/dist/cjs/product/viewtoggle/index.js +7 -0
- package/dist/cjs/product/viewtoggle/viewtoggle.js +55 -0
- package/dist/cjs/product/viewtoggle/viewtoggle.recipe.js +27 -0
- package/dist/cjs/tokens/contract.js +21 -0
- package/dist/cjs/tokens/elevation.js +47 -0
- package/dist/cjs/tokens/index.js +18 -0
- package/dist/cjs/tokens/palette.js +63 -0
- package/dist/cjs/tokens/scale.js +70 -0
- package/dist/cjs/tokens/semantic.js +57 -0
- package/dist/columncalc.css +26 -0
- package/dist/columncalc.d.ts +7 -0
- package/dist/command.css +34 -1
- package/dist/contextmenu.css +10 -2
- package/dist/datatable.css +60 -14
- package/dist/datepicker.css +165 -19
- package/dist/datepicker.d.ts +2 -2
- package/dist/datepickerfield.css +27 -0
- package/dist/datepickerfield.d.ts +7 -0
- package/dist/dialog.css +10 -2
- package/dist/donutchart.css +8 -0
- package/dist/drawer.css +13 -5
- package/dist/entitycard.css +10 -2
- package/dist/esm/components/accordion/accordion.js +17 -16
- package/dist/esm/components/accordion/accordion.recipe.js +1 -1
- package/dist/esm/components/avatargroup/avatargroup.js +2 -2
- package/dist/esm/components/avatargroup/avatargroup.recipe.js +2 -2
- package/dist/esm/components/badge/badge.recipe.js +4 -4
- package/dist/esm/components/barchart/barchart.js +15 -2
- package/dist/esm/components/barchart/barchart.recipe.js +10 -5
- package/dist/esm/components/breadcrumb/breadcrumb.js +2 -2
- package/dist/esm/components/bulkbar/bulkbar.js +2 -2
- package/dist/esm/components/bulkbar/bulkbar.recipe.js +4 -4
- package/dist/esm/components/button/button.js +13 -2
- package/dist/esm/components/button/button.recipe.js +20 -4
- package/dist/esm/components/callout/callout.js +2 -2
- package/dist/esm/components/checkbox/checkbox.recipe.js +9 -1
- package/dist/esm/components/columncalc/columncalc.js +100 -0
- package/dist/esm/components/columncalc/columncalc.recipe.js +30 -0
- package/dist/esm/components/columncalc/index.js +1 -0
- package/dist/esm/components/contextmenu/contextmenu.recipe.js +4 -4
- package/dist/esm/components/datatable/datatable.js +276 -49
- package/dist/esm/components/datatable/datatable.recipe.js +54 -16
- package/dist/esm/components/datepicker/datepicker.js +104 -53
- package/dist/esm/components/datepicker/datepicker.recipe.js +170 -25
- package/dist/esm/components/datepicker/index.js +1 -1
- package/dist/esm/components/datepickerfield/datepickerfield.js +49 -0
- package/dist/esm/components/datepickerfield/datepickerfield.recipe.js +41 -0
- package/dist/esm/components/datepickerfield/index.js +2 -0
- package/dist/esm/components/dialog/dialog.js +2 -2
- package/dist/esm/components/dialog/dialog.recipe.js +4 -4
- package/dist/esm/components/divider/divider.js +2 -2
- package/dist/esm/components/donutchart/donutchart.js +2 -2
- package/dist/esm/components/drawer/drawer.js +2 -2
- package/dist/esm/components/drawer/drawer.recipe.js +6 -6
- package/dist/esm/components/emptystate/emptystate.js +2 -2
- package/dist/esm/components/formfield/formfield.js +2 -2
- package/dist/esm/components/input/input.js +6 -3
- package/dist/esm/components/input/input.recipe.js +38 -5
- package/dist/esm/components/linechart/linechart.js +15 -2
- package/dist/esm/components/linechart/linechart.recipe.js +10 -5
- package/dist/esm/components/menu/index.js +1 -0
- package/dist/esm/components/menu/menu-keyboard.js +80 -0
- package/dist/esm/components/menu/menu.js +27 -60
- package/dist/esm/components/menu/menu.recipe.js +5 -5
- package/dist/esm/components/multiselect/multiselect.js +10 -3
- package/dist/esm/components/multiselect/multiselect.recipe.js +8 -8
- package/dist/esm/components/popover/popover.js +2 -2
- package/dist/esm/components/popover/popover.recipe.js +2 -2
- package/dist/esm/components/progress/progress.js +3 -3
- package/dist/esm/components/radiogroup/radiogroup.js +2 -2
- package/dist/esm/components/radiogroup/radiogroup.recipe.js +1 -1
- package/dist/esm/components/resizablepanel/index.js +2 -0
- package/dist/esm/components/resizablepanel/resizablepanel.js +135 -0
- package/dist/esm/components/resizablepanel/resizablepanel.recipe.js +66 -0
- package/dist/esm/components/segmented/segmented.js +2 -2
- package/dist/esm/components/select/select.js +2 -2
- package/dist/esm/components/select/select.recipe.js +6 -6
- package/dist/esm/components/skeleton/skeleton.js +5 -2
- package/dist/esm/components/spinner/spinner.js +3 -2
- package/dist/esm/components/stagebar/stagebar.js +2 -2
- package/dist/esm/components/statcard/statcard.js +2 -2
- package/dist/esm/components/table/table.recipe.js +6 -6
- package/dist/esm/components/tabletoolbar/tabletoolbar.chrome.js +3 -3
- package/dist/esm/components/tabletoolbar/tabletoolbar.js +21 -13
- package/dist/esm/components/tabs/tabs.js +2 -2
- package/dist/esm/components/tabs/tabs.recipe.js +4 -4
- package/dist/esm/components/textarea/textarea.js +5 -5
- package/dist/esm/components/textarea/textarea.recipe.js +16 -4
- package/dist/esm/components/toast/toast.js +4 -4
- package/dist/esm/components/toast/toast.recipe.js +2 -2
- package/dist/esm/components/tooltip/tooltip.js +21 -7
- package/dist/esm/components/wheelpicker/index.js +2 -0
- package/dist/esm/components/wheelpicker/wheelpicker.js +98 -0
- package/dist/esm/components/wheelpicker/wheelpicker.recipe.js +92 -0
- package/dist/esm/index.js +5 -0
- package/dist/esm/product/appshell/appshell.js +33 -9
- package/dist/esm/product/appshell/appshell.recipe.js +4 -4
- package/dist/esm/product/authshell/authshell.js +18 -0
- package/dist/esm/product/authshell/authshell.recipe.js +64 -0
- package/dist/esm/product/authshell/index.js +2 -0
- package/dist/esm/product/board/board.js +2 -2
- package/dist/esm/product/board/board.recipe.js +1 -1
- package/dist/esm/product/command/command.js +19 -6
- package/dist/esm/product/command/command.recipe.js +27 -2
- package/dist/esm/product/entitycard/entitycard.js +2 -2
- package/dist/esm/product/entitycard/entitycard.recipe.js +2 -2
- package/dist/esm/product/flowcanvas/flowcanvas.js +4 -4
- package/dist/esm/product/inbox/inbox.recipe.js +1 -1
- package/dist/esm/product/listpage/listpage.recipe.js +3 -3
- package/dist/esm/product/navitem/navitem.recipe.js +13 -1
- package/dist/esm/product/onboarding/onboarding.js +2 -2
- package/dist/esm/product/onboarding/onboarding.recipe.js +2 -2
- package/dist/esm/product/recordpage/recordpage.js +133 -47
- package/dist/esm/product/recordpage/recordpage.recipe.js +19 -17
- package/dist/esm/product/recordpanel/recordpanel.js +4 -4
- package/dist/esm/product/recordpanel/recordpanel.recipe.js +12 -16
- package/dist/esm/product/recordstable/recordstable.js +157 -66
- package/dist/esm/product/recordstable/recordstable.recipe.js +23 -23
- package/dist/esm/product/recordstable/recordstable.tag.js +18 -0
- package/dist/esm/product/richtext/richtext.js +3 -3
- package/dist/esm/product/richtext/richtext.recipe.js +3 -3
- package/dist/esm/product/settingssection/settingssection.js +2 -2
- package/dist/esm/product/settingsshell/settingsshell.js +2 -2
- package/dist/esm/product/settingsshell/settingsshell.recipe.js +7 -2
- package/dist/esm/product/sidebar/sidebar.js +2 -2
- package/dist/esm/product/sidebar/sidebar.recipe.js +27 -2
- package/dist/esm/product/tasklist/tasklist.js +4 -4
- package/dist/esm/product/trialbanner/trialbanner.js +2 -2
- package/dist/esm/product/trialbanner/trialbanner.recipe.js +2 -2
- package/dist/esm/product/viewtoggle/viewtoggle.js +10 -2
- package/dist/esm/product/viewtoggle/viewtoggle.recipe.js +1 -1
- package/dist/esm/tokens/elevation.js +44 -0
- package/dist/esm/tokens/index.js +1 -0
- package/dist/esm/tokens/palette.js +30 -0
- package/dist/esm/tokens/scale.js +7 -0
- package/dist/esm/tokens/semantic.js +24 -0
- package/dist/inbox.css +9 -1
- package/dist/input.css +32 -4
- package/dist/linechart.css +5 -5
- package/dist/listpage.css +11 -3
- package/dist/menu.css +11 -3
- package/dist/multiselect.css +14 -6
- package/dist/native/tokens.d.ts +16 -0
- package/dist/native/tokens.js +221 -0
- package/dist/navitem.css +21 -1
- package/dist/onboarding.css +10 -2
- package/dist/popover.css +8 -0
- package/dist/progress.css +8 -0
- package/dist/radiogroup.css +9 -1
- package/dist/recordpage.css +22 -12
- package/dist/recordpanel.css +25 -15
- package/dist/recordstable.css +37 -23
- package/dist/resizablepanel.css +53 -0
- package/dist/resizablepanel.d.ts +7 -0
- package/dist/richtext.css +11 -3
- package/dist/segmented.css +8 -0
- package/dist/select.css +12 -4
- package/dist/settingsshell.css +15 -2
- package/dist/sidebar.css +34 -1
- package/dist/skeleton.css +8 -0
- package/dist/spinner.css +8 -0
- package/dist/stagebar.css +8 -0
- package/dist/styles.css +2051 -1111
- package/dist/switch.css +8 -0
- package/dist/table.css +14 -6
- package/dist/tabletoolbar.css +8 -0
- package/dist/tabs.css +12 -4
- package/dist/tasklist.css +8 -0
- package/dist/textarea.css +23 -3
- package/dist/toast.css +10 -2
- package/dist/tokens.css +29 -0
- package/dist/tokens.json +217 -0
- package/dist/tooltip.css +8 -0
- package/dist/trialbanner.css +8 -0
- package/dist/types/components/accordion/accordion.d.ts +10 -8
- package/dist/types/components/avatargroup/avatargroup.d.ts +2 -2
- package/dist/types/components/barchart/barchart.d.ts +4 -2
- package/dist/types/components/breadcrumb/breadcrumb.d.ts +2 -2
- package/dist/types/components/bulkbar/bulkbar.d.ts +4 -2
- package/dist/types/components/button/button.d.ts +8 -0
- package/dist/types/components/button/button.recipe.d.ts +12 -0
- package/dist/types/components/callout/callout.d.ts +2 -2
- package/dist/types/components/columncalc/columncalc.d.ts +49 -0
- package/dist/types/components/columncalc/columncalc.recipe.d.ts +3 -0
- package/dist/types/components/columncalc/index.d.ts +1 -0
- package/dist/types/components/datatable/datatable.d.ts +58 -3
- package/dist/types/components/datepicker/datepicker.d.ts +41 -18
- package/dist/types/components/datepicker/datepicker.recipe.d.ts +25 -2
- package/dist/types/components/datepicker/index.d.ts +1 -1
- package/dist/types/components/datepickerfield/datepickerfield.d.ts +35 -0
- package/dist/types/components/datepickerfield/datepickerfield.recipe.d.ts +5 -0
- package/dist/types/components/datepickerfield/index.d.ts +2 -0
- package/dist/types/components/dialog/dialog.d.ts +3 -1
- package/dist/types/components/divider/divider.d.ts +2 -2
- package/dist/types/components/donutchart/donutchart.d.ts +2 -2
- package/dist/types/components/drawer/drawer.d.ts +3 -1
- package/dist/types/components/emptystate/emptystate.d.ts +2 -2
- package/dist/types/components/formfield/formfield.d.ts +7 -4
- package/dist/types/components/input/input.d.ts +8 -2
- package/dist/types/components/linechart/linechart.d.ts +4 -2
- package/dist/types/components/menu/index.d.ts +1 -0
- package/dist/types/components/menu/menu-keyboard.d.ts +33 -0
- package/dist/types/components/menu/menu.d.ts +7 -1
- package/dist/types/components/multiselect/multiselect.d.ts +8 -4
- package/dist/types/components/popover/popover.d.ts +4 -1
- package/dist/types/components/progress/progress.d.ts +2 -2
- package/dist/types/components/radiogroup/radiogroup.d.ts +2 -2
- package/dist/types/components/resizablepanel/index.d.ts +2 -0
- package/dist/types/components/resizablepanel/resizablepanel.d.ts +75 -0
- package/dist/types/components/resizablepanel/resizablepanel.recipe.d.ts +3 -0
- package/dist/types/components/segmented/segmented.d.ts +2 -2
- package/dist/types/components/select/select.d.ts +2 -2
- package/dist/types/components/skeleton/skeleton.d.ts +2 -2
- package/dist/types/components/spinner/spinner.d.ts +2 -2
- package/dist/types/components/stagebar/stagebar.d.ts +2 -2
- package/dist/types/components/statcard/statcard.d.ts +2 -2
- package/dist/types/components/tabletoolbar/tabletoolbar.d.ts +28 -2
- package/dist/types/components/tabs/tabs.d.ts +2 -2
- package/dist/types/components/toast/toast.d.ts +7 -1
- package/dist/types/components/tooltip/tooltip.d.ts +8 -1
- package/dist/types/components/wheelpicker/index.d.ts +2 -0
- package/dist/types/components/wheelpicker/wheelpicker.d.ts +37 -0
- package/dist/types/components/wheelpicker/wheelpicker.recipe.d.ts +26 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/product/appshell/appshell.d.ts +16 -2
- package/dist/types/product/authshell/authshell.d.ts +28 -0
- package/dist/types/product/authshell/authshell.recipe.d.ts +3 -0
- package/dist/types/product/authshell/index.d.ts +2 -0
- package/dist/types/product/board/board.d.ts +2 -2
- package/dist/types/product/command/command.d.ts +25 -1
- package/dist/types/product/entitycard/entitycard.d.ts +2 -2
- package/dist/types/product/flowcanvas/flowcanvas.d.ts +9 -1
- package/dist/types/product/onboarding/onboarding.d.ts +7 -1
- package/dist/types/product/recordpage/recordpage.d.ts +65 -1
- package/dist/types/product/recordpanel/recordpanel.d.ts +8 -2
- package/dist/types/product/recordstable/recordstable.d.ts +90 -1
- package/dist/types/product/recordstable/recordstable.tag.d.ts +10 -0
- package/dist/types/product/richtext/richtext.d.ts +5 -1
- package/dist/types/product/settingssection/settingssection.d.ts +2 -2
- package/dist/types/product/settingsshell/settingsshell.d.ts +6 -2
- package/dist/types/product/sidebar/sidebar.d.ts +8 -0
- package/dist/types/product/tasklist/tasklist.d.ts +5 -1
- package/dist/types/product/trialbanner/trialbanner.d.ts +2 -2
- package/dist/types/product/viewtoggle/viewtoggle.d.ts +11 -5
- package/dist/types/tokens/contract.d.ts +14 -3
- package/dist/types/tokens/elevation.d.ts +44 -0
- package/dist/types/tokens/index.d.ts +1 -0
- package/dist/types/tokens/palette.d.ts +40 -0
- package/dist/types/tokens/scale.d.ts +7 -0
- package/dist/types/tokens/semantic.d.ts +19 -0
- package/dist/viewtoggle.css +9 -1
- package/dist/wheelpicker.css +68 -0
- package/dist/wheelpicker.d.ts +7 -0
- package/package.json +160 -68
package/dist/donutchart.css
CHANGED
|
@@ -14,3 +14,11 @@
|
|
|
14
14
|
& .donutchart-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--fg-muted); }
|
|
15
15
|
& .donutchart-val { flex-shrink: 0; font-weight: var(--weight-medium); color: var(--fg-primary); }
|
|
16
16
|
}
|
|
17
|
+
|
|
18
|
+
@media (prefers-reduced-motion: reduce) {
|
|
19
|
+
.donutchart, .donutchart * {
|
|
20
|
+
animation-duration: 0.01ms !important;
|
|
21
|
+
animation-iteration-count: 1 !important;
|
|
22
|
+
transition-duration: 0.01ms !important;
|
|
23
|
+
}
|
|
24
|
+
}
|
package/dist/drawer.css
CHANGED
|
@@ -1,17 +1,25 @@
|
|
|
1
1
|
.drawer {
|
|
2
2
|
display: contents; font-family: var(--font-sans);
|
|
3
3
|
& .drawer-backdrop { position: fixed; inset: 0; z-index: 60; background: color-mix(in srgb, var(--fg-primary) 18%, transparent); opacity: 1; transition: opacity 0.2s ease; @starting-style { opacity: 0; } }
|
|
4
|
-
& .drawer-positioner { position: fixed; inset: 0; z-index: 61; display: flex; }
|
|
4
|
+
& .drawer-positioner { position: fixed; inset: 0; z-index: 61; display: flex; box-sizing: border-box; padding: var(--space-2); }
|
|
5
5
|
& .drawer-positioner[data-side="right"] { justify-content: flex-end; }
|
|
6
6
|
& .drawer-positioner[data-side="left"] { justify-content: flex-start; }
|
|
7
|
-
& .drawer-content { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; position: relative; display: flex; flex-direction: column; box-sizing: border-box; width: 420px; max-width:
|
|
8
|
-
& .drawer-positioner[data-side="right"] .drawer-content {
|
|
9
|
-
& .drawer-positioner[data-side="left"] .drawer-content {
|
|
7
|
+
& .drawer-content { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; position: relative; display: flex; flex-direction: column; box-sizing: border-box; overflow: hidden; width: 420px; max-width: 100%; height: 100%; background: var(--bg-surface); border-radius: var(--radius-xl); box-shadow: inset 0 0 0 1px var(--ring-popover), 0 0 0 1px var(--shadow-popover1), 0 4px 8px -4px var(--shadow-popover2), 0 4px 12px -2px var(--shadow-popover3); transform: none; transition: transform 0.24s cubic-bezier(.32,.72,0,1); }
|
|
8
|
+
& .drawer-positioner[data-side="right"] .drawer-content { @starting-style { transform: translateX(calc(100% + var(--space-2))); } }
|
|
9
|
+
& .drawer-positioner[data-side="left"] .drawer-content { @starting-style { transform: translateX(calc(-100% - var(--space-2))); } }
|
|
10
10
|
& .drawer-header { display: flex; align-items: center; gap: var(--space-2); flex-shrink: 0; height: 52px; padding: 0 var(--space-2) 0 var(--space-4); border-bottom: 1px solid var(--border-subtle); }
|
|
11
11
|
& .drawer-header svg { flex-shrink: 0; color: var(--fg-muted); }
|
|
12
12
|
& .drawer-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--text-lg); font-weight: var(--weight-semibold); color: var(--fg-primary); }
|
|
13
|
-
& .drawer-close { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 28px; height: 28px; margin: 0; padding: 0; border: none; border-radius: var(--radius-md); background: none; color: var(--fg-muted); cursor: pointer; }
|
|
13
|
+
& .drawer-close { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 28px; height: 28px; margin: 0; padding: 0; border: none; border-radius: var(--radius-md); background: none; color: var(--fg-muted); font-family: inherit; cursor: pointer; }
|
|
14
14
|
& .drawer-close:hover { background: color-mix(in srgb, var(--fg-primary) 6%, transparent); color: var(--fg-primary); }
|
|
15
15
|
& .drawer-body { flex: 1; min-height: 0; overflow-y: auto; padding: var(--space-4); }
|
|
16
16
|
& .drawer-footer { display: flex; align-items: center; justify-content: flex-end; gap: var(--space-3); flex-shrink: 0; min-height: 56px; padding: 0 var(--space-4); border-top: 1px solid var(--border-subtle); }
|
|
17
17
|
}
|
|
18
|
+
|
|
19
|
+
@media (prefers-reduced-motion: reduce) {
|
|
20
|
+
.drawer, .drawer * {
|
|
21
|
+
animation-duration: 0.01ms !important;
|
|
22
|
+
animation-iteration-count: 1 !important;
|
|
23
|
+
transition-duration: 0.01ms !important;
|
|
24
|
+
}
|
|
25
|
+
}
|
package/dist/entitycard.css
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
.entitycard {
|
|
2
|
-
display: flex; flex-direction: column; box-sizing: border-box; width: 100%; min-width: 0; text-align:
|
|
2
|
+
display: flex; flex-direction: column; box-sizing: border-box; width: 100%; min-width: 0; text-align: start;
|
|
3
3
|
padding: var(--space-3) var(--space-4); margin: 0; border: none; border-radius: var(--radius-xl);
|
|
4
4
|
background: var(--bg-surface); box-shadow: inset 0 0 0 1px var(--border-subtle); color: var(--fg-primary);
|
|
5
5
|
font-family: var(--font-sans); cursor: pointer; transition: box-shadow .12s ease, background-color .12s ease;
|
|
@@ -14,5 +14,13 @@
|
|
|
14
14
|
& .entitycard-spacer { flex: 1; min-height: var(--space-3); }
|
|
15
15
|
& .entitycard-foot { display: flex; align-items: center; gap: var(--space-1-5); padding-top: var(--space-2-5); margin-top: var(--space-1); border-top: 1px solid var(--border-subtle); font-size: var(--text-sm); color: var(--fg-muted); }
|
|
16
16
|
& .entitycard-foot-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--fg-primary); }
|
|
17
|
-
& .entitycard-date { margin-
|
|
17
|
+
& .entitycard-date { margin-inline-start: auto; flex-shrink: 0; white-space: nowrap; }
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
@media (prefers-reduced-motion: reduce) {
|
|
21
|
+
.entitycard, .entitycard * {
|
|
22
|
+
animation-duration: 0.01ms !important;
|
|
23
|
+
animation-iteration-count: 1 !important;
|
|
24
|
+
transition-duration: 0.01ms !important;
|
|
25
|
+
}
|
|
18
26
|
}
|
|
@@ -7,23 +7,24 @@ import { accordionRecipe } from "./accordion.recipe.js";
|
|
|
7
7
|
* multiple open; panels animate their height (grid-rows 0fr->1fr). Headers are
|
|
8
8
|
* buttons with `aria-expanded` / `aria-controls`.
|
|
9
9
|
*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
10
|
+
const toSet = (v) => new Set(v == null ? [] : Array.isArray(v) ? v : [v]);
|
|
11
|
+
export function Accordion({ items, multiple, value, defaultValue, onValueChange, className, ...rest }) {
|
|
12
|
+
const [internal, setInternal] = React.useState(() => toSet(defaultValue));
|
|
13
|
+
// `value` present means the caller owns the open set; our own state is then
|
|
14
|
+
// never read, so a click can only change what is shown by going through
|
|
15
|
+
// onValueChange and coming back as a new `value`.
|
|
16
|
+
const open = value !== undefined ? toSet(value) : internal;
|
|
17
|
+
const toggle = (itemValue) => {
|
|
18
|
+
const next = new Set(multiple ? open : []);
|
|
19
|
+
if (open.has(itemValue))
|
|
20
|
+
next.delete(itemValue);
|
|
21
|
+
else
|
|
22
|
+
next.add(itemValue);
|
|
23
|
+
onValueChange?.(multiple ? [...next] : ([...next][0] ?? ""));
|
|
24
|
+
if (value === undefined)
|
|
25
|
+
setInternal(next);
|
|
25
26
|
};
|
|
26
|
-
return (_jsx("div", { className: accordionRecipe({ className }), children: items.map((item) => {
|
|
27
|
+
return (_jsx("div", { className: accordionRecipe({ className }), ...rest, children: items.map((item) => {
|
|
27
28
|
const isOpen = open.has(item.value);
|
|
28
29
|
const panelId = `accordion-panel-${item.value}`;
|
|
29
30
|
return (_jsxs("div", { className: "accordion-item", children: [_jsxs("button", { type: "button", className: "accordion-trigger", "aria-expanded": isOpen, "aria-controls": panelId, onClick: () => toggle(item.value), children: [_jsx("span", { className: "accordion-title", children: item.title }), _jsx(ChevronDown, { className: "accordion-chevron", size: 16, strokeWidth: 1.75, "aria-hidden": "true" })] }), _jsx("div", { id: panelId, className: "accordion-panel", role: "region", "data-open": isOpen ? "" : undefined, hidden: !isOpen, children: _jsx("div", { className: "accordion-panel-inner", children: _jsx("div", { className: "accordion-content", children: item.content }) }) })] }, item.value));
|
|
@@ -6,7 +6,7 @@ const config = defineRecipe({
|
|
|
6
6
|
name: "accordion",
|
|
7
7
|
base: `display: flex; flex-direction: column; font-family: ${c.font.sans};
|
|
8
8
|
& .accordion-item { border-bottom: 1px solid ${c.borderSubtle}; }
|
|
9
|
-
& .accordion-trigger { display: flex; align-items: center; gap: ${c.space["2"]}; width: 100%; height: 44px; padding: 0 ${c.space["1"]}; margin: 0; border: none; background: none; color: ${c.fgPrimary}; font-family: inherit; font-size: ${c.text.lg}; font-weight: ${c.weight.medium}; text-align:
|
|
9
|
+
& .accordion-trigger { display: flex; align-items: center; gap: ${c.space["2"]}; width: 100%; height: 44px; padding: 0 ${c.space["1"]}; margin: 0; border: none; background: none; color: ${c.fgPrimary}; font-family: inherit; font-size: ${c.text.lg}; font-weight: ${c.weight.medium}; text-align: start; cursor: pointer; }
|
|
10
10
|
& .accordion-trigger:hover { color: ${c.fgPrimary}; }
|
|
11
11
|
& .accordion-title { flex: 1; min-width: 0; }
|
|
12
12
|
& .accordion-chevron { flex-shrink: 0; color: ${c.fgMuted}; transition: transform .2s ease; }
|
|
@@ -7,10 +7,10 @@ import { avatargroupRecipe } from "./avatargroup.recipe.js";
|
|
|
7
7
|
* from Attio's team / member rows. Pass `<Avatar>` children; each is ringed in
|
|
8
8
|
* the surface colour so it reads against its neighbour.
|
|
9
9
|
*/
|
|
10
|
-
export function AvatarGroup({ children, max, size = "md", className, "aria-label": ariaLabel, }) {
|
|
10
|
+
export function AvatarGroup({ children, max, size = "md", className, "aria-label": ariaLabel, ...rest }) {
|
|
11
11
|
const items = React.Children.toArray(children);
|
|
12
12
|
const shown = max != null ? items.slice(0, max) : items;
|
|
13
13
|
const overflow = items.length - shown.length;
|
|
14
|
-
return (_jsxs("div", { className: avatargroupRecipe({ className }), role: "group", "aria-label": ariaLabel, children: [shown, overflow > 0 && (_jsxs(Avatar, { size: size, shape: "circle", tone: "neutral", children: ["+", overflow] }))] }));
|
|
14
|
+
return (_jsxs("div", { className: avatargroupRecipe({ className }), ...rest, role: "group", "aria-label": ariaLabel, children: [shown, overflow > 0 && (_jsxs(Avatar, { size: size, shape: "circle", tone: "neutral", children: ["+", overflow] }))] }));
|
|
15
15
|
}
|
|
16
16
|
AvatarGroup.displayName = "AvatarGroup";
|
|
@@ -5,8 +5,8 @@ import { contract as c } from "../../tokens/index.js";
|
|
|
5
5
|
const config = defineRecipe({
|
|
6
6
|
name: "avatargroup",
|
|
7
7
|
base: `display: inline-flex; align-items: center;
|
|
8
|
-
& > * { margin-
|
|
9
|
-
& > *:first-child { margin-
|
|
8
|
+
& > * { margin-inline-start: -${c.space["2"]}; box-shadow: 0 0 0 2px ${c.bgSurface}; position: relative; }
|
|
9
|
+
& > *:first-child { margin-inline-start: 0; }`,
|
|
10
10
|
variants: {},
|
|
11
11
|
defaultVariants: {},
|
|
12
12
|
compoundVariants: [],
|
|
@@ -15,7 +15,7 @@ const config = defineRecipe({
|
|
|
15
15
|
size: {
|
|
16
16
|
small: `height: 16px; padding-inline: ${c.space["1.5"]}; font-size: ${c.text.xs}; border-radius: ${c.radius.sm};`,
|
|
17
17
|
medium: `height: 20px; padding-inline: ${c.space["2"]}; font-size: ${c.text.sm}; border-radius: ${c.radius.sm};`,
|
|
18
|
-
large: `height:
|
|
18
|
+
large: `height: ${c.size.chip}; padding-inline: 9px; font-size: ${c.text.lg}; border-radius: ${c.radius.chip};`,
|
|
19
19
|
},
|
|
20
20
|
variant: {
|
|
21
21
|
soft: ``,
|
|
@@ -32,17 +32,17 @@ const config = defineRecipe({
|
|
|
32
32
|
{
|
|
33
33
|
variant: "solid",
|
|
34
34
|
tone: "success",
|
|
35
|
-
css: `background: ${c.bgSuccess}; color: ${c.
|
|
35
|
+
css: `background: ${c.bgSuccess}; color: ${c.fgOnTone}; box-shadow: none;`,
|
|
36
36
|
},
|
|
37
37
|
{
|
|
38
38
|
variant: "solid",
|
|
39
39
|
tone: "warning",
|
|
40
|
-
css: `background: ${c.bgWarning}; color: ${c.
|
|
40
|
+
css: `background: ${c.bgWarning}; color: ${c.fgOnTone}; box-shadow: none;`,
|
|
41
41
|
},
|
|
42
42
|
{
|
|
43
43
|
variant: "solid",
|
|
44
44
|
tone: "danger",
|
|
45
|
-
css: `background: ${c.bgDanger}; color: ${c.
|
|
45
|
+
css: `background: ${c.bgDanger}; color: ${c.fgOnTone}; box-shadow: none;`,
|
|
46
46
|
},
|
|
47
47
|
{
|
|
48
48
|
variant: "solid",
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { contract as c } from "../../tokens/index.js";
|
|
2
3
|
import { barchartRecipe } from "./barchart.recipe.js";
|
|
3
4
|
// round up to a friendly 1/2/5 × 10^n value (for tick steps)
|
|
4
5
|
function niceNum(raw) {
|
|
@@ -13,15 +14,27 @@ function niceNum(raw) {
|
|
|
13
14
|
* A responsive bar chart — measured from Attio's Reports dashboard. Pure CSS, so
|
|
14
15
|
* it scales with its container. Renders `role="img"` with an accessible summary.
|
|
15
16
|
*/
|
|
16
|
-
export function BarChart({ data, height = 240, max, ticks = 5, color, format = (n) => n.toLocaleString(), xAxisTitle, "aria-label": ariaLabel, className, }) {
|
|
17
|
+
export function BarChart({ data, height = 240, max, ticks = 5, color, format = (n) => n.toLocaleString(), yAxisWidth, xAxisTitle, "aria-label": ariaLabel, className, ...rest }) {
|
|
17
18
|
const rawMax = Math.max(1, ...data.map((d) => d.value));
|
|
18
19
|
// pick a nice step so the top tick is round and >= the data max
|
|
19
20
|
const step = max ? max / (ticks - 1) : niceNum(rawMax / (ticks - 1));
|
|
20
21
|
const top = step * (ticks - 1);
|
|
21
22
|
const tickValues = Array.from({ length: ticks }, (_, i) => step * i);
|
|
23
|
+
// The value-axis gutter must fit whatever `format` actually returns — a
|
|
24
|
+
// hardcoded width fits "4.0k" but not "4,000,000₮". `ch` is the width of
|
|
25
|
+
// "0" in the current font, so sizing off the longest formatted tick tracks
|
|
26
|
+
// the real label width without measuring the DOM (works during SSR, no
|
|
27
|
+
// ResizeObserver). `yAxisWidth` lets a caller pin the gutter instead.
|
|
28
|
+
const longestTickChars = Math.max(0, ...tickValues.map((t) => format(t).length));
|
|
29
|
+
const yAxisWidthValue = yAxisWidth != null
|
|
30
|
+
? `${yAxisWidth}px`
|
|
31
|
+
: `max(34px, ${longestTickChars}ch + ${c.space["4"]})`;
|
|
22
32
|
const summary = ariaLabel ??
|
|
23
33
|
`Bar chart: ${data.map((d) => `${d.label} ${format(d.value)}`).join(", ")}`;
|
|
24
|
-
return (_jsxs("div", { className: barchartRecipe({ className }),
|
|
34
|
+
return (_jsxs("div", { className: barchartRecipe({ className }), ...rest, style: {
|
|
35
|
+
height,
|
|
36
|
+
"--barchart-yaxis-width": yAxisWidthValue,
|
|
37
|
+
}, role: "img", "aria-label": summary, children: [_jsxs("div", { className: "barchart-body", children: [_jsx("div", { className: "barchart-yaxis", children: tickValues.map((t) => (_jsx("span", { className: "barchart-ytick", style: { bottom: `${(t / top) * 100}%` }, children: format(t) }, t))) }), _jsxs("div", { className: "barchart-plot", children: [tickValues.map((t) => (_jsx("div", { className: "barchart-grid", style: { bottom: `${(t / top) * 100}%` } }, t))), data.map((d) => (_jsx("div", { className: "barchart-col", children: _jsx("div", { className: "barchart-bar", "data-empty": d.value <= 0 ? "" : undefined, style: {
|
|
25
38
|
height: `${Math.max(0, (d.value / top) * 100)}%`,
|
|
26
39
|
background: color,
|
|
27
40
|
}, title: `${d.label}: ${format(d.value)}` }) }, d.label)))] })] }), _jsx("div", { className: "barchart-xaxis", "data-inset": "", children: data.map((d) => (_jsx("span", { className: "barchart-xlabel", children: d.label }, d.label))) }), xAxisTitle != null && (_jsx("div", { className: "barchart-axis-title", children: xAxisTitle }))] }));
|
|
@@ -5,19 +5,24 @@ import { contract as c } from "../../tokens/index.js";
|
|
|
5
5
|
// and category labels below. Pure CSS (no SVG), so it scales with its container.
|
|
6
6
|
const config = defineRecipe({
|
|
7
7
|
name: "barchart",
|
|
8
|
-
|
|
8
|
+
// --barchart-yaxis-width is the one source of truth for the value-axis
|
|
9
|
+
// gutter: the component sets it (auto-sized to the longest tick label, or
|
|
10
|
+
// pinned via `yAxisWidth`) on the root element, and it inherits down to the
|
|
11
|
+
// x-axis padding and axis title so they never drift out of alignment. 34px
|
|
12
|
+
// is only the pre-JS fallback (e.g. if `barchartRecipe` is used bare).
|
|
13
|
+
base: `display: flex; flex-direction: column; box-sizing: border-box; font-family: ${c.font.sans}; --barchart-yaxis-width: 34px;
|
|
9
14
|
& .barchart-body { display: flex; flex: 1; min-height: 0; }
|
|
10
|
-
& .barchart-yaxis { position: relative; flex-shrink: 0; width:
|
|
11
|
-
& .barchart-ytick { position: absolute;
|
|
15
|
+
& .barchart-yaxis { position: relative; flex-shrink: 0; width: var(--barchart-yaxis-width); }
|
|
16
|
+
& .barchart-ytick { position: absolute; inset-inline-end: ${c.space["2"]}; transform: translateY(50%); font-size: ${c.text.xs}; color: ${c.fgMuted}; white-space: nowrap; }
|
|
12
17
|
& .barchart-plot { position: relative; flex: 1; min-width: 0; display: flex; align-items: flex-end; gap: ${c.space["3"]}; border-bottom: 1px solid ${c.borderDefault}; }
|
|
13
18
|
& .barchart-grid { position: absolute; left: 0; right: 0; border-top: 1px dashed ${c.borderSubtle}; pointer-events: none; }
|
|
14
19
|
& .barchart-col { position: relative; flex: 1; min-width: 0; height: 100%; display: flex; align-items: flex-end; justify-content: center; }
|
|
15
20
|
& .barchart-bar { width: 100%; max-width: 96px; border-radius: ${c.radius.sm} ${c.radius.sm} 0 0; background: ${c.bgBrandSolid}; transition: height 0.3s ease; }
|
|
16
21
|
& .barchart-bar[data-empty] { min-height: 2px; opacity: 0.35; }
|
|
17
22
|
& .barchart-xaxis { display: flex; gap: ${c.space["3"]}; margin-top: ${c.space["1.5"]}; }
|
|
18
|
-
& .barchart-xaxis[data-inset] { padding-
|
|
23
|
+
& .barchart-xaxis[data-inset] { padding-inline-start: var(--barchart-yaxis-width); }
|
|
19
24
|
& .barchart-xlabel { flex: 1; min-width: 0; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: ${c.text.sm}; color: ${c.fgMuted}; }
|
|
20
|
-
& .barchart-axis-title { margin-top: ${c.space["1"]}; padding-
|
|
25
|
+
& .barchart-axis-title { margin-top: ${c.space["1"]}; padding-inline-start: var(--barchart-yaxis-width); text-align: center; font-size: ${c.text.sm}; color: ${c.fgMuted}; }`,
|
|
21
26
|
variants: {},
|
|
22
27
|
defaultVariants: {},
|
|
23
28
|
compoundVariants: [],
|
|
@@ -6,9 +6,9 @@ import { breadcrumbRecipe } from "./breadcrumb.recipe.js";
|
|
|
6
6
|
* A breadcrumb trail — measured from Attio's record-page nav. The last item is
|
|
7
7
|
* marked `aria-current="page"`; earlier items render as links or buttons.
|
|
8
8
|
*/
|
|
9
|
-
export function Breadcrumb({ items, separator, "aria-label": ariaLabel = "Breadcrumb", className, }) {
|
|
9
|
+
export function Breadcrumb({ items, separator, "aria-label": ariaLabel = "Breadcrumb", className, ...rest }) {
|
|
10
10
|
const sep = separator ?? (_jsx(ChevronRight, { size: 14, strokeWidth: 1.75, "aria-hidden": "true" }));
|
|
11
|
-
return (_jsx("nav", { "aria-label": ariaLabel, className: breadcrumbRecipe({ className }), children: items.map((item, i) => {
|
|
11
|
+
return (_jsx("nav", { "aria-label": ariaLabel, className: breadcrumbRecipe({ className }), ...rest, children: items.map((item, i) => {
|
|
12
12
|
const last = i === items.length - 1;
|
|
13
13
|
const content = (_jsxs(_Fragment, { children: [item.icon, item.label] }));
|
|
14
14
|
return (_jsxs(React.Fragment, { children: [last ? (_jsx("span", { className: "breadcrumb-item", "aria-current": "page", children: content })) : item.href ? (_jsx("a", { className: "breadcrumb-item", href: item.href, children: content })) : (_jsx("button", { type: "button", className: "breadcrumb-item", onClick: item.onClick, children: content })), !last && _jsx("span", { className: "breadcrumb-sep", children: sep })] }, i));
|
|
@@ -7,8 +7,8 @@ import { bulkbarRecipe } from "./bulkbar.recipe.js";
|
|
|
7
7
|
* positioned ancestor when a selection is active; render it conditionally
|
|
8
8
|
* (e.g. `count > 0 && <BulkBar …/>`). Measured from Attio's records table.
|
|
9
9
|
*/
|
|
10
|
-
export function BulkBar({ count, onClear, countLabel = "selected", children, className, }) {
|
|
11
|
-
return (_jsx("div", { className: bulkbarRecipe({ className }), children: _jsxs("div", { className: "bulkbar-bar", role: "status", children: [count != null && (_jsxs("button", { type: "button", className: "bulkbar-count", onClick: onClear, title:
|
|
10
|
+
export function BulkBar({ count, onClear, countLabel = "selected", children, className, clearLabel = "Clear selection", ...rest }) {
|
|
11
|
+
return (_jsx("div", { className: bulkbarRecipe({ className }), ...rest, children: _jsxs("div", { className: "bulkbar-bar", role: "status", children: [count != null && (_jsxs("button", { type: "button", className: "bulkbar-count", onClick: onClear, title: clearLabel, children: [count, " ", countLabel, _jsx(X, { size: 13, strokeWidth: 2, "aria-hidden": "true" })] })), children] }) }));
|
|
12
12
|
}
|
|
13
13
|
BulkBar.displayName = "BulkBar";
|
|
14
14
|
/** A styled action button for use inside a `<BulkBar>` (or as a `<Menu>` trigger). */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineRecipe, resolveRecipe } from "../../core/index.js";
|
|
2
|
-
import { contract as c } from "../../tokens/index.js";
|
|
2
|
+
import { contract as c, elevation as e } from "../../tokens/index.js";
|
|
3
3
|
// A floating bulk-action bar — the pill that rises from the bottom of a
|
|
4
4
|
// selection surface (a table, a gallery) when one or more rows are selected.
|
|
5
5
|
// Measured from Attio's records-table bulk bar. The root is an absolutely-
|
|
@@ -10,12 +10,12 @@ import { contract as c } from "../../tokens/index.js";
|
|
|
10
10
|
const config = defineRecipe({
|
|
11
11
|
name: "bulkbar",
|
|
12
12
|
base: `position: absolute; left: 0; right: 0; bottom: ${c.space["4"]}; display: flex; justify-content: center; pointer-events: none; z-index: 10;
|
|
13
|
-
& .bulkbar-bar { pointer-events: auto; display: flex; align-items: center; gap: ${c.space["0.5"]}; height:
|
|
13
|
+
& .bulkbar-bar { pointer-events: auto; display: flex; align-items: center; gap: ${c.space["0.5"]}; height: 48px; padding: 0 ${c.space["1"]} 0 ${c.space["1.5"]}; border-radius: 14px; background: ${c.bgSurface}; box-shadow: ${e.floating}; color: ${c.fgPrimary}; transition: opacity .16s ease, transform .16s ease; }
|
|
14
14
|
& .bulkbar-bar { @starting-style { opacity: 0; transform: translateY(10px); } }
|
|
15
|
-
& .bulkbar-count { display: inline-flex; align-items: center; gap: ${c.space["1"]}; height:
|
|
15
|
+
& .bulkbar-count { display: inline-flex; align-items: center; gap: ${c.space["1"]}; height: ${c.size.menuRow}; margin: 0; padding: 0 ${c.space["2"]}; border: none; border-radius: ${c.radius.md}; background: color-mix(in srgb, ${c.fgPrimary} 4%, transparent); font-family: inherit; font-size: ${c.text.md}; font-weight: ${c.weight.medium}; color: ${c.fgMuted}; white-space: nowrap; cursor: pointer; transition: background-color .12s; }
|
|
16
16
|
& .bulkbar-count:hover { background: color-mix(in srgb, ${c.fgPrimary} 8%, transparent); color: ${c.fgPrimary}; }
|
|
17
17
|
& .bulkbar-count svg { flex-shrink: 0; }
|
|
18
|
-
& .bulkbar-btn { display: inline-flex; align-items: center; gap: ${c.space["1"]}; height:
|
|
18
|
+
& .bulkbar-btn { display: inline-flex; align-items: center; gap: ${c.space["1"]}; height: ${c.size.menuRow}; padding: 0 ${c.space["2"]}; border: none; border-radius: ${c.radius.md}; background: transparent; color: ${c.fgPrimary}; font-family: inherit; font-size: ${c.text.md}; font-weight: ${c.weight.medium}; white-space: nowrap; cursor: pointer; transition: background-color .12s; }
|
|
19
19
|
& .bulkbar-btn:hover { background: ${c.bgRaised}; }
|
|
20
20
|
& .bulkbar-btn--danger { color: ${c.bgDanger}; }
|
|
21
21
|
& .bulkbar-btn--danger:hover { background: color-mix(in srgb, ${c.bgDanger} 10%, transparent); }
|
|
@@ -6,10 +6,21 @@ import { buttonRecipe } from "./button.recipe.js";
|
|
|
6
6
|
function Spinner() {
|
|
7
7
|
return (_jsxs("svg", { width: "1em", height: "1em", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", style: { flexShrink: 0 }, children: [_jsx("circle", { cx: "8", cy: "8", r: "6.5", stroke: "currentColor", strokeOpacity: "0.25", strokeWidth: "2" }), _jsx("path", { d: "M8 1.5a6.5 6.5 0 0 1 6.5 6.5", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", children: _jsx("animateTransform", { attributeName: "transform", type: "rotate", from: "0 8 8", to: "360 8 8", dur: "0.7s", repeatCount: "indefinite" }) })] }));
|
|
8
8
|
}
|
|
9
|
-
export const Button = React.forwardRef(({ intent, size, shape, className, asChild, loading, disabled, children, ...props }, ref) => {
|
|
9
|
+
export const Button = React.forwardRef(({ intent, size, shape, touchTarget, className, asChild, loading, disabled, children, type, ...props }, ref) => {
|
|
10
10
|
const isDisabled = disabled || loading;
|
|
11
11
|
// Slot (asChild) requires a single child — never inject the spinner in that mode.
|
|
12
12
|
const content = loading && !asChild ? (_jsxs(_Fragment, { children: [_jsx(Spinner, {}), children] })) : (children);
|
|
13
|
-
return (_jsx(Primitive.button, { ref: ref, asChild: asChild, className: buttonRecipe({
|
|
13
|
+
return (_jsx(Primitive.button, { ref: ref, asChild: asChild, className: buttonRecipe({
|
|
14
|
+
intent,
|
|
15
|
+
size,
|
|
16
|
+
shape,
|
|
17
|
+
touchTarget,
|
|
18
|
+
className,
|
|
19
|
+
}),
|
|
20
|
+
// A bare <button> inside a <form> defaults to type="submit". Nothing in
|
|
21
|
+
// a design system should submit a form by accident, so default to
|
|
22
|
+
// "button" and make submitting explicit. `asChild` renders someone
|
|
23
|
+
// else's element, which must not be given a button-only attribute.
|
|
24
|
+
type: asChild ? type : (type ?? "button"), disabled: isDisabled, "aria-busy": loading || undefined, "data-loading": loading ? "" : undefined, ...props, children: content }));
|
|
14
25
|
});
|
|
15
26
|
Button.displayName = "Button";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { defineRecipe, resolveRecipe } from "../../core/index.js";
|
|
2
|
-
import { contract as c } from "../../tokens/index.js";
|
|
2
|
+
import { contract as c, elevation as e } from "../../tokens/index.js";
|
|
3
3
|
const config = defineRecipe({
|
|
4
4
|
name: "button",
|
|
5
5
|
base: `display: inline-flex; align-items: center; justify-content: center; gap: ${c.space["1.5"]}; font-family: ${c.font.sans}; font-weight: ${c.weight.medium}; letter-spacing: -0.14px; line-height: 20px; white-space: nowrap; border: none; cursor: pointer; transition: background-color .2s, box-shadow .2s, color .2s; &:disabled { opacity: 0.5; cursor: not-allowed; }`,
|
|
6
6
|
variants: {
|
|
7
7
|
intent: {
|
|
8
8
|
primary: `background: ${c.bgBrandSolid}; color: ${c.fgOnBrand}; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.07), 0 2px 4px -2px rgba(38,109,240,0.12), 0 3px 6px -2px rgba(38,109,240,0.08); &:hover { background: ${c.bgBrandSolidPressed}; } &:active { background: ${c.bgBrandSolidPressed}; }`,
|
|
9
|
-
neutral: `background: ${c.bgSurface}; color: ${c.fgPrimary}; box-shadow:
|
|
10
|
-
danger: `background: ${c.
|
|
9
|
+
neutral: `background: ${c.bgSurface}; color: ${c.fgPrimary}; box-shadow: ${e.field}; &:hover { background: ${c.bgRaised}; }`,
|
|
10
|
+
danger: `background: ${c.bgDangerSolid}; color: ${c.fgOnBrand}; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.07), 0 2px 4px -2px rgba(186,37,37,0.20), 0 3px 6px -2px rgba(186,37,37,0.12); &:hover { filter: brightness(0.96); } &:active { filter: brightness(0.92); }`,
|
|
11
11
|
ghost: `background: transparent; color: ${c.fgMuted}; box-shadow: none; &:hover { background: ${c.bgRaised}; color: ${c.fgPrimary}; }`,
|
|
12
12
|
},
|
|
13
13
|
size: {
|
|
@@ -19,8 +19,24 @@ const config = defineRecipe({
|
|
|
19
19
|
text: ``,
|
|
20
20
|
icon: `padding-inline: 0; aspect-ratio: 1 / 1;`,
|
|
21
21
|
},
|
|
22
|
+
// Opt-in hit-area expansion (crisp/#62): none of sm/md/lg reaches the
|
|
23
|
+
// 44x44 touch-target minimum (Apple HIG / Material), and enlarging the
|
|
24
|
+
// visual sizes isn't an option — crisp is deliberately dense. A
|
|
25
|
+
// `::after` overlay grows the *clickable* region from the button's
|
|
26
|
+
// centre without reflow, so the rendered size/position never changes.
|
|
27
|
+
// Opt-in rather than always-on: an always-on overlay would swallow
|
|
28
|
+
// clicks meant for a neighbour in a toolbar packed tighter than 44px.
|
|
29
|
+
touchTarget: {
|
|
30
|
+
true: `position: relative; &::after { content: ""; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 100%; height: 100%; min-width: 44px; min-height: 44px; }`,
|
|
31
|
+
false: ``,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
defaultVariants: {
|
|
35
|
+
intent: "primary",
|
|
36
|
+
size: "md",
|
|
37
|
+
shape: "text",
|
|
38
|
+
touchTarget: false,
|
|
22
39
|
},
|
|
23
|
-
defaultVariants: { intent: "primary", size: "md", shape: "text" },
|
|
24
40
|
compoundVariants: [],
|
|
25
41
|
});
|
|
26
42
|
export const buttonRecipe = Object.assign(resolveRecipe(config), {
|
|
@@ -12,11 +12,11 @@ const DEFAULT_ICONS = {
|
|
|
12
12
|
* An inline callout / banner — measured from Attio's info notices. `tone` tints
|
|
13
13
|
* the background and icon; pass a `title` and/or body `children`.
|
|
14
14
|
*/
|
|
15
|
-
export function Callout({ tone = "neutral", icon, title, children, action, className, }) {
|
|
15
|
+
export function Callout({ tone = "neutral", icon, title, children, action, className, ...rest }) {
|
|
16
16
|
const Fallback = DEFAULT_ICONS[tone];
|
|
17
17
|
const iconNode = icon === undefined
|
|
18
18
|
? Fallback && _jsx(Fallback, { size: 16, strokeWidth: 1.75, "aria-hidden": "true" })
|
|
19
19
|
: icon;
|
|
20
|
-
return (_jsxs("div", { className: calloutRecipe({ className }), "data-tone": tone, role: "note", children: [iconNode && _jsx("span", { className: "callout-icon", children: iconNode }), _jsxs("div", { className: "callout-body", children: [title != null && _jsx("div", { className: "callout-title", children: title }), children != null && _jsx("div", { className: "callout-desc", children: children })] }), action && _jsx("div", { className: "callout-action", children: action })] }));
|
|
20
|
+
return (_jsxs("div", { className: calloutRecipe({ className }), ...rest, "data-tone": tone, role: "note", children: [iconNode && _jsx("span", { className: "callout-icon", children: iconNode }), _jsxs("div", { className: "callout-body", children: [title != null && _jsx("div", { className: "callout-title", children: title }), children != null && _jsx("div", { className: "callout-desc", children: children })] }), action && _jsx("div", { className: "callout-action", children: action })] }));
|
|
21
21
|
}
|
|
22
22
|
Callout.displayName = "Callout";
|
|
@@ -6,7 +6,15 @@ import { contract as c } from "../../tokens/index.js";
|
|
|
6
6
|
const CHECK = "url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.5 6.5 5 9l4.5-5'/%3E%3C/svg%3E\")";
|
|
7
7
|
const config = defineRecipe({
|
|
8
8
|
name: "checkbox",
|
|
9
|
-
base: `appearance: none; -webkit-appearance: none; box-sizing: border-box; flex-shrink: 0; margin: 0; width: 16px; height: 16px; border: none; border-radius: ${c.radius.sm}
|
|
9
|
+
base: `appearance: none; -webkit-appearance: none; box-sizing: border-box; flex-shrink: 0; margin: 0; width: 16px; height: 16px; border: none; border-radius: ${c.radius.sm}
|
|
10
|
+
; background: ${c.bgSurface}
|
|
11
|
+
; box-shadow: inset 0 0 0 1px color-mix(in srgb, ${c.fgPrimary}
|
|
12
|
+
9%, transparent); cursor: pointer; transition: background-color .12s, box-shadow .12s; &:hover { box-shadow: inset 0 0 0 1px color-mix(in srgb, ${c.fgPrimary} 30%, transparent); }
|
|
13
|
+
&:checked, &:indeterminate { background: ${c.bgBrandSolid} center / 10px no-repeat; box-shadow: none; }
|
|
14
|
+
&:checked { background-image: ${CHECK}; }
|
|
15
|
+
&:indeterminate { background-image: linear-gradient(${c.fgOnBrand}, ${c.fgOnBrand}); background-size: 8px 2px; }
|
|
16
|
+
&:focus-visible { outline: 2px solid ${c.bgBrandSolid}; outline-offset: 1px; }
|
|
17
|
+
`,
|
|
10
18
|
variants: {},
|
|
11
19
|
defaultVariants: {},
|
|
12
20
|
compoundVariants: [],
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ChevronDown, Plus } from "lucide-react";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { Menu, MenuItem } from "../menu/index.js";
|
|
5
|
+
import { columncalcRecipe } from "./columncalc.recipe.js";
|
|
6
|
+
/** The four Attio offers on every column, in its order. */
|
|
7
|
+
export const UNIVERSAL_CALCS = [
|
|
8
|
+
"countEmpty",
|
|
9
|
+
"countFilled",
|
|
10
|
+
"percentEmpty",
|
|
11
|
+
"percentFilled",
|
|
12
|
+
];
|
|
13
|
+
/** The four Attio adds for numeric columns, in its order. */
|
|
14
|
+
export const NUMERIC_CALCS = ["sum", "average", "min", "max"];
|
|
15
|
+
export const CALC_LABEL = {
|
|
16
|
+
none: "None",
|
|
17
|
+
countEmpty: "Count empty",
|
|
18
|
+
countFilled: "Count filled",
|
|
19
|
+
percentEmpty: "Percent empty",
|
|
20
|
+
percentFilled: "Percent filled",
|
|
21
|
+
sum: "Sum",
|
|
22
|
+
average: "Average",
|
|
23
|
+
min: "Min",
|
|
24
|
+
max: "Max",
|
|
25
|
+
};
|
|
26
|
+
/** A value counts as empty when it is null/undefined, "" or an empty array. */
|
|
27
|
+
export function isEmptyValue(v) {
|
|
28
|
+
if (v == null)
|
|
29
|
+
return true;
|
|
30
|
+
if (typeof v === "string")
|
|
31
|
+
return v.trim() === "";
|
|
32
|
+
if (Array.isArray(v))
|
|
33
|
+
return v.length === 0;
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Pure so the arithmetic is testable without rendering. Returns `null` for
|
|
38
|
+
* "none" and for numeric ops with no numbers to work on — a caller renders
|
|
39
|
+
* nothing rather than a misleading 0.
|
|
40
|
+
*/
|
|
41
|
+
export function computeCalc(values, op) {
|
|
42
|
+
if (op === "none")
|
|
43
|
+
return null;
|
|
44
|
+
const total = values.length;
|
|
45
|
+
const empty = values.filter(isEmptyValue).length;
|
|
46
|
+
const filled = total - empty;
|
|
47
|
+
switch (op) {
|
|
48
|
+
case "countEmpty":
|
|
49
|
+
return empty;
|
|
50
|
+
case "countFilled":
|
|
51
|
+
return filled;
|
|
52
|
+
case "percentEmpty":
|
|
53
|
+
return total === 0 ? 0 : (empty / total) * 100;
|
|
54
|
+
case "percentFilled":
|
|
55
|
+
return total === 0 ? 0 : (filled / total) * 100;
|
|
56
|
+
default:
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
const nums = values
|
|
60
|
+
.filter((v) => !isEmptyValue(v))
|
|
61
|
+
.map((v) => (typeof v === "number" ? v : Number(v)))
|
|
62
|
+
.filter((n) => Number.isFinite(n));
|
|
63
|
+
if (nums.length === 0)
|
|
64
|
+
return null;
|
|
65
|
+
switch (op) {
|
|
66
|
+
case "sum":
|
|
67
|
+
return nums.reduce((a, b) => a + b, 0);
|
|
68
|
+
case "average":
|
|
69
|
+
return nums.reduce((a, b) => a + b, 0) / nums.length;
|
|
70
|
+
case "min":
|
|
71
|
+
return Math.min(...nums);
|
|
72
|
+
case "max":
|
|
73
|
+
return Math.max(...nums);
|
|
74
|
+
default:
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
const defaultFormat = (n, op) => op === "percentEmpty" || op === "percentFilled"
|
|
79
|
+
? `${Math.round(n)}%`
|
|
80
|
+
: n.toLocaleString(undefined, { maximumFractionDigits: 2 });
|
|
81
|
+
export function ColumnCalc({ rows, value, numeric = false, defaultOp = "none", op: opProp, onOpChange, format = defaultFormat, align, opLabels, className, ...rest }) {
|
|
82
|
+
// a partial override, so a consumer can translate one op without
|
|
83
|
+
// restating all nine
|
|
84
|
+
const labelFor = (o) => opLabels?.[o] ?? CALC_LABEL[o];
|
|
85
|
+
const [internal, setInternal] = React.useState(defaultOp);
|
|
86
|
+
const op = opProp ?? internal;
|
|
87
|
+
const setOp = (next) => {
|
|
88
|
+
if (opProp === undefined)
|
|
89
|
+
setInternal(next);
|
|
90
|
+
onOpChange?.(next);
|
|
91
|
+
};
|
|
92
|
+
const values = React.useMemo(() => rows.map(value), [rows, value]);
|
|
93
|
+
const result = React.useMemo(() => computeCalc(values, op), [values, op]);
|
|
94
|
+
const ops = [
|
|
95
|
+
...UNIVERSAL_CALCS,
|
|
96
|
+
...(numeric ? NUMERIC_CALCS : []),
|
|
97
|
+
"none",
|
|
98
|
+
];
|
|
99
|
+
return (_jsx("span", { className: columncalcRecipe({ className }), ...rest, children: _jsxs(Menu, { trigger: _jsx("button", { type: "button", className: "columncalc-trigger", "data-align": align === "right" ? "right" : undefined, children: op === "none" || result === null ? (_jsxs(_Fragment, { children: [_jsx(Plus, { size: 12, strokeWidth: 2 }), _jsx("span", { className: "columncalc-placeholder", children: "Add calculation" })] })) : (_jsxs(_Fragment, { children: [_jsx("span", { className: "columncalc-value", children: format(result, op) }), _jsx("span", { className: "columncalc-op", children: labelFor(op) }), _jsx(ChevronDown, { size: 12, strokeWidth: 2 })] })) }), children: [_jsx("div", { className: "columncalc-section", children: "Aggregations" }), ops.map((o) => (_jsx(MenuItem, { onSelect: () => setOp(o), children: labelFor(o) }, o)))] }) }));
|
|
100
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { defineRecipe, resolveRecipe } from "../../core/index.js";
|
|
2
|
+
import { contract as c } from "../../tokens/index.js";
|
|
3
|
+
// Attio's column footer calculation. The summary row is 36px and sticky at the
|
|
4
|
+
// grid's bottom edge; each cell holds a quiet trigger that reads "Add
|
|
5
|
+
// calculation" until an aggregation is chosen, then shows the value with its
|
|
6
|
+
// operation name beside it.
|
|
7
|
+
const config = defineRecipe({
|
|
8
|
+
name: "columncalc",
|
|
9
|
+
base: `display: flex; align-items: stretch; width: 100%; height: 100%; font-family: ${c.font.sans};
|
|
10
|
+
/* Menu wraps its trigger in a flex div that sizes to content, which would
|
|
11
|
+
shrink the button back to its text. Make the wrapper fill too, so the
|
|
12
|
+
whole cell stays clickable. */
|
|
13
|
+
& .menu { width: 100%; height: 100%; }
|
|
14
|
+
/* Attio's hit target is the WHOLE summary cell -- measured 246x37 with
|
|
15
|
+
padding 0 12px, not a content-sized chip. Clicking anywhere in the cell
|
|
16
|
+
opens the aggregation menu. */
|
|
17
|
+
& .columncalc-trigger { display: flex; align-items: center; gap: ${c.space["1"]}; width: 100%; height: 100%; min-height: ${c.size.tableRow}; margin: 0; padding: 0 ${c.space["3"]}; border: none; border-radius: ${c.radius.md}; background: transparent; color: ${c.fgMuted}; font-family: inherit; font-size: ${c.text.md}; font-weight: ${c.weight.medium}; white-space: nowrap; cursor: pointer; transition: background-color .12s, color .12s; }
|
|
18
|
+
& .columncalc-trigger:hover { background: color-mix(in srgb, ${c.fgPrimary} 4%, transparent); color: ${c.fgPrimary}; }
|
|
19
|
+
& .columncalc-trigger svg { flex-shrink: 0; opacity: 0.7; }
|
|
20
|
+
& .columncalc-trigger[data-align="right"] { justify-content: flex-end; }
|
|
21
|
+
& .columncalc-placeholder { overflow: hidden; text-overflow: ellipsis; }
|
|
22
|
+
& .columncalc-value { color: ${c.fgPrimary}; font-variant-numeric: tabular-nums; }
|
|
23
|
+
& .columncalc-op { color: ${c.fgMuted}; }
|
|
24
|
+
& .columncalc-section { padding: ${c.space["1.5"]} ${c.space["2"]} ${c.space["1"]}; font-size: ${c.text.sm}; font-weight: ${c.weight.medium}; color: ${c.fgMuted}; }`,
|
|
25
|
+
variants: {},
|
|
26
|
+
defaultVariants: {},
|
|
27
|
+
compoundVariants: [],
|
|
28
|
+
});
|
|
29
|
+
export const columncalcRecipe = resolveRecipe(config);
|
|
30
|
+
export default config;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CALC_LABEL, ColumnCalc, computeCalc, isEmptyValue, NUMERIC_CALCS, UNIVERSAL_CALCS, } from "./columncalc.js";
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { defineRecipe, resolveRecipe } from "../../core/index.js";
|
|
2
|
-
import { contract as c } from "../../tokens/index.js";
|
|
2
|
+
import { contract as c, elevation as e } from "../../tokens/index.js";
|
|
3
3
|
// A right-click menu on the measured popover surface, positioned at the cursor.
|
|
4
4
|
const config = defineRecipe({
|
|
5
5
|
name: "contextmenu",
|
|
6
6
|
base: `display: contents; font-family: ${c.font.sans};
|
|
7
|
-
& .contextmenu-content { position: fixed; z-index: 60; min-width: 200px; box-sizing: border-box; padding: ${c.space["1"]}; border-radius: ${c.radius.xl}; background: ${c.bgPopover}; box-shadow:
|
|
8
|
-
& .contextmenu-item { display: flex; align-items: center; gap: ${c.space["2"]}; width: 100%; height:
|
|
7
|
+
& .contextmenu-content { position: fixed; z-index: 60; min-width: 200px; box-sizing: border-box; padding: ${c.space["1"]}; border-radius: ${c.radius.xl}; background: ${c.bgPopover}; box-shadow: ${e.floating}; opacity: 1; transform: none; transition: opacity .08s ease, transform .08s ease; transform-origin: top left; @starting-style { opacity: 0; transform: scale(0.97) translateY(-1px); } }
|
|
8
|
+
& .contextmenu-item { display: flex; align-items: center; gap: ${c.space["2"]}; width: 100%; height: ${c.size.menuRow}; box-sizing: border-box; padding: 0 ${c.space["2"]}; margin: 0; border: none; border-radius: ${c.radius.md}; background: none; color: ${c.fgPrimary}; font-family: inherit; font-size: ${c.text.lg}; text-align: start; white-space: nowrap; cursor: pointer; }
|
|
9
9
|
& .contextmenu-item svg { flex-shrink: 0; color: ${c.fgMuted}; }
|
|
10
10
|
& .contextmenu-item:hover { background: color-mix(in srgb, ${c.fgPrimary} 6%, transparent); }
|
|
11
11
|
& .contextmenu-item--danger { color: ${c.bgDanger}; }
|
|
12
12
|
& .contextmenu-item--danger svg { color: ${c.bgDanger}; }
|
|
13
13
|
& .contextmenu-item--danger:hover { background: color-mix(in srgb, ${c.bgDanger} 10%, transparent); }
|
|
14
|
-
& .contextmenu-shortcut { margin-
|
|
14
|
+
& .contextmenu-shortcut { margin-inline-start: auto; padding-inline-start: ${c.space["3"]}; color: ${c.fgMuted}; font-size: ${c.text.sm}; }
|
|
15
15
|
& .contextmenu-sep { height: 1px; margin: ${c.space["1"]} 0; border: none; background: ${c.borderSubtle}; }`,
|
|
16
16
|
variants: {},
|
|
17
17
|
defaultVariants: {},
|