@crisp-ui-kit/crisp 0.2.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 +20 -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/base.css +25 -0
- package/dist/board.css +9 -1
- package/dist/bulkbar.css +11 -3
- package/dist/button.css +16 -2
- 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 +11 -3
- package/dist/datatable.css +106 -0
- package/dist/datatable.d.ts +7 -0
- 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 +11 -3
- 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 +33 -0
- package/dist/esm/components/accordion/accordion.recipe.js +23 -0
- package/dist/esm/components/accordion/index.js +2 -0
- package/dist/esm/components/avatar/avatar.js +8 -0
- package/dist/esm/components/avatar/avatar.recipe.js +39 -0
- package/dist/esm/components/avatar/index.js +2 -0
- package/dist/esm/components/avatargroup/avatargroup.js +16 -0
- package/dist/esm/components/avatargroup/avatargroup.recipe.js +15 -0
- package/dist/esm/components/avatargroup/index.js +2 -0
- package/dist/esm/components/badge/badge.js +8 -0
- package/dist/esm/components/badge/badge.recipe.js +65 -0
- package/dist/esm/components/badge/index.js +2 -0
- package/dist/esm/components/barchart/barchart.js +42 -0
- package/dist/esm/components/barchart/barchart.recipe.js +31 -0
- package/dist/esm/components/barchart/index.js +2 -0
- package/dist/esm/components/breadcrumb/breadcrumb.js +17 -0
- package/dist/esm/components/breadcrumb/breadcrumb.recipe.js +18 -0
- package/dist/esm/components/breadcrumb/index.js +2 -0
- package/dist/esm/components/bulkbar/bulkbar.js +16 -0
- package/dist/esm/components/bulkbar/bulkbar.recipe.js +28 -0
- package/dist/esm/components/bulkbar/index.js +2 -0
- package/dist/esm/components/button/button.js +26 -0
- package/dist/esm/components/button/button.recipe.js +55 -0
- package/dist/esm/components/button/index.js +2 -0
- package/dist/esm/components/callout/callout.js +22 -0
- package/dist/esm/components/callout/callout.recipe.js +26 -0
- package/dist/esm/components/callout/index.js +2 -0
- package/dist/esm/components/card/card.js +15 -0
- package/dist/esm/components/card/card.recipe.js +28 -0
- package/dist/esm/components/card/index.js +2 -0
- package/dist/esm/components/checkbox/checkbox.js +20 -0
- package/dist/esm/components/checkbox/checkbox.recipe.js +31 -0
- package/dist/esm/components/checkbox/index.js +2 -0
- 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.js +42 -0
- package/dist/esm/components/contextmenu/contextmenu.recipe.js +21 -0
- package/dist/esm/components/contextmenu/index.js +2 -0
- package/dist/esm/components/datatable/datatable.js +472 -0
- package/dist/esm/components/datatable/datatable.recipe.js +110 -0
- package/dist/esm/components/datatable/index.js +2 -0
- package/dist/esm/components/datepicker/datepicker.js +108 -0
- package/dist/esm/components/datepicker/datepicker.recipe.js +177 -0
- package/dist/esm/components/datepicker/index.js +2 -0
- 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 +48 -0
- package/dist/esm/components/dialog/dialog.recipe.js +32 -0
- package/dist/esm/components/dialog/index.js +2 -0
- package/dist/esm/components/divider/divider.js +7 -0
- package/dist/esm/components/divider/divider.recipe.js +14 -0
- package/dist/esm/components/divider/index.js +2 -0
- package/dist/esm/components/donutchart/donutchart.js +38 -0
- package/dist/esm/components/donutchart/donutchart.recipe.js +27 -0
- package/dist/esm/components/donutchart/index.js +2 -0
- package/dist/esm/components/drawer/drawer.js +42 -0
- package/dist/esm/components/drawer/drawer.recipe.js +27 -0
- package/dist/esm/components/drawer/index.js +2 -0
- package/dist/esm/components/emptystate/emptystate.js +7 -0
- package/dist/esm/components/emptystate/emptystate.recipe.js +31 -0
- package/dist/esm/components/emptystate/index.js +2 -0
- package/dist/esm/components/formfield/formfield.js +14 -0
- package/dist/esm/components/formfield/formfield.recipe.js +19 -0
- package/dist/esm/components/formfield/index.js +2 -0
- package/dist/esm/components/input/index.js +2 -0
- package/dist/esm/components/input/input.js +11 -0
- package/dist/esm/components/input/input.recipe.js +56 -0
- package/dist/esm/components/kbd/index.js +2 -0
- package/dist/esm/components/kbd/kbd.js +8 -0
- package/dist/esm/components/kbd/kbd.recipe.js +20 -0
- package/dist/esm/components/linechart/index.js +2 -0
- package/dist/esm/components/linechart/linechart.js +54 -0
- package/dist/esm/components/linechart/linechart.recipe.js +32 -0
- package/dist/esm/components/menu/index.js +3 -0
- package/dist/esm/components/menu/menu-keyboard.js +80 -0
- package/dist/esm/components/menu/menu.js +104 -0
- package/dist/esm/components/menu/menu.recipe.js +51 -0
- package/dist/esm/components/multiselect/index.js +2 -0
- package/dist/esm/components/multiselect/multiselect.js +125 -0
- package/dist/esm/components/multiselect/multiselect.recipe.js +68 -0
- package/dist/esm/components/popover/index.js +2 -0
- package/dist/esm/components/popover/popover.js +70 -0
- package/dist/esm/components/popover/popover.recipe.js +18 -0
- package/dist/esm/components/progress/index.js +2 -0
- package/dist/esm/components/progress/progress.js +23 -0
- package/dist/esm/components/progress/progress.recipe.js +17 -0
- package/dist/esm/components/radiogroup/index.js +2 -0
- package/dist/esm/components/radiogroup/radiogroup.js +46 -0
- package/dist/esm/components/radiogroup/radiogroup.recipe.js +37 -0
- 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/index.js +2 -0
- package/dist/esm/components/segmented/segmented.js +59 -0
- package/dist/esm/components/segmented/segmented.recipe.js +20 -0
- package/dist/esm/components/select/index.js +2 -0
- package/dist/esm/components/select/select.js +144 -0
- package/dist/esm/components/select/select.recipe.js +76 -0
- package/dist/esm/components/skeleton/index.js +2 -0
- package/dist/esm/components/skeleton/skeleton.js +10 -0
- package/dist/esm/components/skeleton/skeleton.recipe.js +14 -0
- package/dist/esm/components/spinner/index.js +2 -0
- package/dist/esm/components/spinner/spinner.js +12 -0
- package/dist/esm/components/spinner/spinner.recipe.js +13 -0
- package/dist/esm/components/stagebar/index.js +2 -0
- package/dist/esm/components/stagebar/stagebar.js +23 -0
- package/dist/esm/components/stagebar/stagebar.recipe.js +14 -0
- package/dist/esm/components/statcard/index.js +2 -0
- package/dist/esm/components/statcard/statcard.js +12 -0
- package/dist/esm/components/statcard/statcard.recipe.js +34 -0
- package/dist/esm/components/switch/index.js +2 -0
- package/dist/esm/components/switch/switch.js +22 -0
- package/dist/esm/components/switch/switch.recipe.js +26 -0
- package/dist/esm/components/table/index.js +2 -0
- package/dist/esm/components/table/table.js +30 -0
- package/dist/esm/components/table/table.recipe.js +40 -0
- package/dist/esm/components/tabletoolbar/index.js +2 -0
- package/dist/esm/components/tabletoolbar/tabletoolbar.chrome.js +79 -0
- package/dist/esm/components/tabletoolbar/tabletoolbar.js +199 -0
- package/dist/esm/components/tabletoolbar/tabletoolbar.recipe.js +23 -0
- package/dist/esm/components/tabs/index.js +2 -0
- package/dist/esm/components/tabs/tabs.js +70 -0
- package/dist/esm/components/tabs/tabs.recipe.js +33 -0
- package/dist/esm/components/textarea/index.js +2 -0
- package/dist/esm/components/textarea/textarea.js +20 -0
- package/dist/esm/components/textarea/textarea.recipe.js +43 -0
- package/dist/esm/components/toast/index.js +2 -0
- package/dist/esm/components/toast/toast.js +58 -0
- package/dist/esm/components/toast/toast.recipe.js +28 -0
- package/dist/esm/components/tooltip/index.js +2 -0
- package/dist/esm/components/tooltip/tooltip.js +59 -0
- package/dist/esm/components/tooltip/tooltip.recipe.js +13 -0
- 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/core/cx.js +1 -0
- package/dist/esm/core/define.js +3 -0
- package/dist/esm/core/index.js +4 -0
- package/dist/esm/core/primitive.js +13 -0
- package/dist/esm/core/resolve.js +41 -0
- package/dist/esm/core/types.js +1 -0
- package/dist/esm/index.js +76 -0
- package/dist/esm/product/appshell/appshell.js +68 -0
- package/dist/esm/product/appshell/appshell.recipe.js +27 -0
- package/dist/esm/product/appshell/index.js +2 -0
- 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 +42 -0
- package/dist/esm/product/board/board.recipe.js +28 -0
- package/dist/esm/product/board/index.js +2 -0
- package/dist/esm/product/command/command.js +201 -0
- package/dist/esm/product/command/command.recipe.js +44 -0
- package/dist/esm/product/command/index.js +2 -0
- package/dist/esm/product/entitycard/entitycard.js +11 -0
- package/dist/esm/product/entitycard/entitycard.recipe.js +29 -0
- package/dist/esm/product/entitycard/index.js +2 -0
- package/dist/esm/product/flowcanvas/flowcanvas.js +85 -0
- package/dist/esm/product/flowcanvas/flowcanvas.recipe.js +25 -0
- package/dist/esm/product/flowcanvas/index.js +2 -0
- package/dist/esm/product/inbox/inbox.js +13 -0
- package/dist/esm/product/inbox/inbox.recipe.js +43 -0
- package/dist/esm/product/inbox/index.js +2 -0
- package/dist/esm/product/listpage/index.js +2 -0
- package/dist/esm/product/listpage/listpage.js +21 -0
- package/dist/esm/product/listpage/listpage.recipe.js +43 -0
- package/dist/esm/product/navitem/index.js +1 -0
- package/dist/esm/product/navitem/navitem.js +8 -0
- package/dist/esm/product/navitem/navitem.recipe.js +33 -0
- package/dist/esm/product/onboarding/index.js +2 -0
- package/dist/esm/product/onboarding/onboarding.js +14 -0
- package/dist/esm/product/onboarding/onboarding.recipe.js +41 -0
- package/dist/esm/product/recordpage/index.js +2 -0
- package/dist/esm/product/recordpage/recordpage.js +372 -0
- package/dist/esm/product/recordpage/recordpage.recipe.js +159 -0
- package/dist/esm/product/recordpanel/index.js +2 -0
- package/dist/esm/product/recordpanel/recordpanel.js +47 -0
- package/dist/esm/product/recordpanel/recordpanel.recipe.js +48 -0
- package/dist/esm/product/recordstable/company-logos.js +26 -0
- package/dist/esm/product/recordstable/index.js +2 -0
- package/dist/esm/product/recordstable/recordstable.js +1054 -0
- package/dist/esm/product/recordstable/recordstable.recipe.js +149 -0
- package/dist/esm/product/recordstable/recordstable.tag.js +18 -0
- package/dist/esm/product/richtext/index.js +2 -0
- package/dist/esm/product/richtext/richtext.js +111 -0
- package/dist/esm/product/richtext/richtext.recipe.js +40 -0
- package/dist/esm/product/settingssection/index.js +2 -0
- package/dist/esm/product/settingssection/settingssection.js +11 -0
- package/dist/esm/product/settingssection/settingssection.recipe.js +20 -0
- package/dist/esm/product/settingsshell/index.js +2 -0
- package/dist/esm/product/settingsshell/settingsshell.js +23 -0
- package/dist/esm/product/settingsshell/settingsshell.recipe.js +43 -0
- package/dist/esm/product/sidebar/index.js +2 -0
- package/dist/esm/product/sidebar/sidebar.js +112 -0
- package/dist/esm/product/sidebar/sidebar.recipe.js +43 -0
- package/dist/esm/product/tasklist/index.js +2 -0
- package/dist/esm/product/tasklist/tasklist.js +16 -0
- package/dist/esm/product/tasklist/tasklist.recipe.js +35 -0
- package/dist/esm/product/trialbanner/index.js +2 -0
- package/dist/esm/product/trialbanner/trialbanner.js +10 -0
- package/dist/esm/product/trialbanner/trialbanner.recipe.js +29 -0
- package/dist/esm/product/viewtoggle/index.js +2 -0
- package/dist/esm/product/viewtoggle/viewtoggle.js +19 -0
- package/dist/esm/product/viewtoggle/viewtoggle.recipe.js +24 -0
- package/dist/esm/tokens/contract.js +18 -0
- package/dist/esm/tokens/elevation.js +44 -0
- package/dist/esm/tokens/index.js +5 -0
- package/dist/esm/tokens/palette.js +60 -0
- package/dist/esm/tokens/scale.js +67 -0
- package/dist/esm/tokens/semantic.js +54 -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 +13 -5
- package/dist/multiselect.css +17 -9
- 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 +9 -1
- package/dist/progress.css +8 -0
- package/dist/radiogroup.css +9 -1
- package/dist/recordpage.css +26 -16
- package/dist/recordpanel.css +25 -15
- package/dist/recordstable.css +41 -27
- 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 +22 -8
- package/dist/select.d.ts +2 -1
- 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/statcard.css +6 -0
- package/dist/statcard.d.ts +2 -2
- package/dist/styles.css +2134 -999
- package/dist/switch.css +8 -0
- package/dist/table.css +34 -0
- package/dist/table.d.ts +8 -0
- package/dist/tabletoolbar.css +78 -0
- package/dist/tabletoolbar.d.ts +7 -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 +53 -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 +153 -0
- package/dist/types/components/datatable/datatable.recipe.d.ts +3 -0
- package/dist/types/components/datatable/index.d.ts +2 -0
- 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 +4 -2
- package/dist/types/components/select/select.recipe.d.ts +12 -0
- 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 +7 -2
- package/dist/types/components/statcard/statcard.recipe.d.ts +12 -2
- package/dist/types/components/table/index.d.ts +2 -0
- package/dist/types/components/table/table.d.ts +53 -0
- package/dist/types/components/table/table.recipe.d.ts +21 -0
- package/dist/types/components/tabletoolbar/index.d.ts +2 -0
- package/dist/types/components/tabletoolbar/tabletoolbar.chrome.d.ts +2 -0
- package/dist/types/components/tabletoolbar/tabletoolbar.d.ts +89 -0
- package/dist/types/components/tabletoolbar/tabletoolbar.recipe.d.ts +3 -0
- 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 +8 -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/company-logos.d.ts +1 -0
- package/dist/types/product/recordstable/recordstable.d.ts +131 -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/index.d.ts +1 -1
- package/dist/types/product/sidebar/sidebar.d.ts +93 -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 +26 -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 +88 -0
- package/dist/types/tokens/scale.d.ts +7 -0
- package/dist/types/tokens/semantic.d.ts +31 -0
- package/dist/viewtoggle.css +11 -3
- package/dist/wheelpicker.css +68 -0
- package/dist/wheelpicker.d.ts +7 -0
- package/package.json +351 -9
- package/dist/index.js +0 -9690
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { defineRecipe, resolveRecipe } from "../../core/index.js";
|
|
2
|
+
import { contract as c, elevation as e } from "../../tokens/index.js";
|
|
3
|
+
// A side sheet — a focus-trapped panel that slides in from the right or left,
|
|
4
|
+
// over a scrim. Shares the Dialog header/body/footer language.
|
|
5
|
+
const config = defineRecipe({
|
|
6
|
+
name: "drawer",
|
|
7
|
+
base: `display: contents; font-family: ${c.font.sans};
|
|
8
|
+
& .drawer-backdrop { position: fixed; inset: 0; z-index: 60; background: color-mix(in srgb, ${c.fgPrimary} 18%, transparent); opacity: 1; transition: opacity 0.2s ease; @starting-style { opacity: 0; } }
|
|
9
|
+
& .drawer-positioner { position: fixed; inset: 0; z-index: 61; display: flex; box-sizing: border-box; padding: ${c.space["2"]}; }
|
|
10
|
+
& .drawer-positioner[data-side="right"] { justify-content: flex-end; }
|
|
11
|
+
& .drawer-positioner[data-side="left"] { justify-content: flex-start; }
|
|
12
|
+
& .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: ${c.bgSurface}; border-radius: ${c.radius.xl}; box-shadow: ${e.floating}; transform: none; transition: transform 0.24s cubic-bezier(.32,.72,0,1); }
|
|
13
|
+
& .drawer-positioner[data-side="right"] .drawer-content { @starting-style { transform: translateX(calc(100% + ${c.space["2"]})); } }
|
|
14
|
+
& .drawer-positioner[data-side="left"] .drawer-content { @starting-style { transform: translateX(calc(-100% - ${c.space["2"]})); } }
|
|
15
|
+
& .drawer-header { display: flex; align-items: center; gap: ${c.space["2"]}; flex-shrink: 0; height: 52px; padding: 0 ${c.space["2"]} 0 ${c.space["4"]}; border-bottom: 1px solid ${c.borderSubtle}; }
|
|
16
|
+
& .drawer-header svg { flex-shrink: 0; color: ${c.fgMuted}; }
|
|
17
|
+
& .drawer-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: ${c.text.lg}; font-weight: ${c.weight.semibold}; color: ${c.fgPrimary}; }
|
|
18
|
+
& .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: ${c.radius.md}; background: none; color: ${c.fgMuted}; font-family: inherit; cursor: pointer; }
|
|
19
|
+
& .drawer-close:hover { background: color-mix(in srgb, ${c.fgPrimary} 6%, transparent); color: ${c.fgPrimary}; }
|
|
20
|
+
& .drawer-body { flex: 1; min-height: 0; overflow-y: auto; padding: ${c.space["4"]}; }
|
|
21
|
+
& .drawer-footer { display: flex; align-items: center; justify-content: flex-end; gap: ${c.space["3"]}; flex-shrink: 0; min-height: 56px; padding: 0 ${c.space["4"]}; border-top: 1px solid ${c.borderSubtle}; }`,
|
|
22
|
+
variants: {},
|
|
23
|
+
defaultVariants: {},
|
|
24
|
+
compoundVariants: [],
|
|
25
|
+
});
|
|
26
|
+
export const drawerRecipe = resolveRecipe(config);
|
|
27
|
+
export default config;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { emptystateRecipe } from "./emptystate.recipe.js";
|
|
3
|
+
/** A centred empty-state panel — icon, title, description, optional action. */
|
|
4
|
+
export function EmptyState({ icon, title, description, action, variant, className, ...rest }) {
|
|
5
|
+
return (_jsxs("div", { className: emptystateRecipe({ variant, className }), ...rest, children: [icon && _jsx("span", { className: "emptystate-icon", children: icon }), _jsx("div", { className: "emptystate-title", children: title }), description != null && (_jsx("div", { className: "emptystate-desc", children: description })), action && _jsx("div", { className: "emptystate-action", children: action })] }));
|
|
6
|
+
}
|
|
7
|
+
EmptyState.displayName = "EmptyState";
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { defineRecipe, resolveRecipe } from "../../core/index.js";
|
|
2
|
+
import { contract as c } from "../../tokens/index.js";
|
|
3
|
+
// An empty-state panel — icon + title + description + optional action.
|
|
4
|
+
const config = defineRecipe({
|
|
5
|
+
name: "emptystate",
|
|
6
|
+
base: `display: flex; flex-direction: column; align-items: center; justify-content: center; gap: ${c.space["1.5"]}; box-sizing: border-box; padding: ${c.space["8"]} ${c.space["4"]}; text-align: center; font-family: ${c.font.sans};
|
|
7
|
+
& .emptystate-icon { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; margin-bottom: ${c.space["1"]}; border-radius: ${c.radius.xl}; background: color-mix(in srgb, ${c.fgPrimary} 5%, transparent); color: ${c.fgMuted}; }
|
|
8
|
+
& .emptystate-title { font-size: ${c.text.lg}; font-weight: ${c.weight.semibold}; color: ${c.fgPrimary}; }
|
|
9
|
+
& .emptystate-desc { max-width: 320px; font-size: ${c.text.md}; color: ${c.fgMuted}; }
|
|
10
|
+
& .emptystate-action { margin-top: ${c.space["2"]}; }`,
|
|
11
|
+
variants: {
|
|
12
|
+
variant: {
|
|
13
|
+
// compact icon tile (default)
|
|
14
|
+
default: ``,
|
|
15
|
+
// a large icon on a dotted-grid backdrop — Attio's Developers/Reports empty state
|
|
16
|
+
illustrated: `& .emptystate-icon { width: 132px; height: 96px; margin-bottom: ${c.space["2"]}; border-radius: 0; color: color-mix(in srgb, ${c.fgPrimary} 22%, transparent); background: radial-gradient(circle, color-mix(in srgb, ${c.fgPrimary} 12%, transparent) 1.2px, transparent 1.2px) 0 0 / 16px 16px; }`,
|
|
17
|
+
// Attio's full-view empty state (measured from a filtered-to-zero records table):
|
|
18
|
+
// a 45px ringed circle icon, a 20/24 semibold heading, a 14/20 medium muted body,
|
|
19
|
+
// then a primary action. Gaps are 16 / 8 / 16 (icon→title→desc→action).
|
|
20
|
+
page: `gap: ${c.space["2"]};
|
|
21
|
+
& .emptystate-icon { width: 45px; height: 45px; margin-bottom: ${c.space["2"]}; border-radius: ${c.radius.full}; border: 1px solid ${c.borderSubtle}; background: none; color: ${c.fgMuted}; }
|
|
22
|
+
& .emptystate-title { font-size: 20px; line-height: 24px; }
|
|
23
|
+
& .emptystate-desc { max-width: 266px; font-size: ${c.text.lg}; font-weight: ${c.weight.medium}; line-height: 20px; }
|
|
24
|
+
& .emptystate-action { margin-top: ${c.space["2"]}; }`,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
defaultVariants: { variant: "default" },
|
|
28
|
+
compoundVariants: [],
|
|
29
|
+
});
|
|
30
|
+
export const emptystateRecipe = resolveRecipe(config);
|
|
31
|
+
export default config;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { formfieldRecipe } from "./formfield.recipe.js";
|
|
4
|
+
/**
|
|
5
|
+
* A labelled form field — measured from Attio's Settings forms. A muted label
|
|
6
|
+
* above any control, with an optional description or error line below. When
|
|
7
|
+
* `error` is set, it replaces the description and gets `aria-describedby` wiring.
|
|
8
|
+
*/
|
|
9
|
+
export function FormField({ label, htmlFor, required, optional, description, error, children, className, ...rest }) {
|
|
10
|
+
const descId = React.useId();
|
|
11
|
+
const hasMsg = error != null || description != null;
|
|
12
|
+
return (_jsxs("div", { className: formfieldRecipe({ className }), ...rest, children: [_jsxs("label", { className: "formfield-label", htmlFor: htmlFor, children: [label, required && (_jsx("span", { className: "formfield-required", "aria-hidden": "true", children: "*" })), optional && !required && (_jsx("span", { className: "formfield-optional", children: optional === true ? "(optional)" : optional }))] }), children, error != null ? (_jsx("span", { className: "formfield-error", id: hasMsg ? descId : undefined, children: error })) : description != null ? (_jsx("span", { className: "formfield-desc", id: hasMsg ? descId : undefined, children: description })) : null] }));
|
|
13
|
+
}
|
|
14
|
+
FormField.displayName = "FormField";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { defineRecipe, resolveRecipe } from "../../core/index.js";
|
|
2
|
+
import { contract as c } from "../../tokens/index.js";
|
|
3
|
+
// A labelled form field — measured from Attio's Settings forms: a 12px/500 muted
|
|
4
|
+
// label above the control, with an optional description or danger error line
|
|
5
|
+
// below. Wraps any control (Input, Select, Textarea…).
|
|
6
|
+
const config = defineRecipe({
|
|
7
|
+
name: "formfield",
|
|
8
|
+
base: `display: flex; flex-direction: column; gap: ${c.space["1.5"]}; box-sizing: border-box; font-family: ${c.font.sans};
|
|
9
|
+
& .formfield-label { display: inline-flex; align-items: center; gap: ${c.space["1"]}; font-size: ${c.text.sm}; font-weight: ${c.weight.medium}; color: ${c.fgMuted}; }
|
|
10
|
+
& .formfield-required { color: ${c.bgDanger}; }
|
|
11
|
+
& .formfield-optional { color: color-mix(in srgb, ${c.fgPrimary} 40%, transparent); font-weight: ${c.weight.regular}; }
|
|
12
|
+
& .formfield-desc { font-size: ${c.text.sm}; line-height: 16px; color: ${c.fgMuted}; }
|
|
13
|
+
& .formfield-error { font-size: ${c.text.sm}; line-height: 16px; color: ${c.bgDanger}; }`,
|
|
14
|
+
variants: {},
|
|
15
|
+
defaultVariants: {},
|
|
16
|
+
compoundVariants: [],
|
|
17
|
+
});
|
|
18
|
+
export const formfieldRecipe = resolveRecipe(config);
|
|
19
|
+
export default config;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { inputRecipe } from "./input.recipe.js";
|
|
4
|
+
export const Input = React.forwardRef(({ size, invalid, className, style, ...props }, ref) => {
|
|
5
|
+
// The wrapper exists only to host the ::after focus ring — an <input> is a
|
|
6
|
+
// replaced element and cannot have one. Everything the consumer passes
|
|
7
|
+
// still lands on the <input> itself, so `id`, `name`, `onChange`, form
|
|
8
|
+
// association and every native attribute behave exactly as before.
|
|
9
|
+
return (_jsx("span", { className: inputRecipe({ size, invalid, className }), style: style, children: _jsx("input", { ref: ref, className: "input-value", "aria-invalid": invalid === true || undefined, ...props }) }));
|
|
10
|
+
});
|
|
11
|
+
Input.displayName = "Input";
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { defineRecipe, resolveRecipe } from "../../core/index.js";
|
|
2
|
+
import { contract as c, elevation as e } from "../../tokens/index.js";
|
|
3
|
+
// Geometry is Attio's, measured: 32/36px tall, r8/r10, 10/12px side padding.
|
|
4
|
+
// The FOCUS TREATMENT is seed-design's, measured from @seed-design/css: a 2px
|
|
5
|
+
// ring on an ::after overlay that is present-but-transparent at rest, so
|
|
6
|
+
// focusing cannot shift layout the way a width change would, and animates
|
|
7
|
+
// `border-color` over 100ms. The ring colour is a high-contrast neutral rather
|
|
8
|
+
// than the brand hue — it reads as "this field has focus", not as a state.
|
|
9
|
+
//
|
|
10
|
+
// The ring needs the ::after, and ::after needs a non-replaced element, so
|
|
11
|
+
// Input renders a wrapper around the <input>. The wrapper is presentational:
|
|
12
|
+
// every consumer prop still goes to the <input>, which is what `id`, `name`,
|
|
13
|
+
// `onChange` and form semantics require.
|
|
14
|
+
const config = defineRecipe({
|
|
15
|
+
name: "input",
|
|
16
|
+
base: `
|
|
17
|
+
position: relative; box-sizing: border-box; display: inline-flex; align-items: center;
|
|
18
|
+
width: 100%; background: ${c.bgSurface}; box-shadow: ${e.field};
|
|
19
|
+
font-family: ${c.font.sans}; font-size: ${c.text.lg}; line-height: 20px;
|
|
20
|
+
|
|
21
|
+
&::after {
|
|
22
|
+
content: ""; position: absolute; inset: 0; border-radius: inherit;
|
|
23
|
+
border: 2px solid transparent; transition: border-color .1s ease;
|
|
24
|
+
pointer-events: none;
|
|
25
|
+
}
|
|
26
|
+
&:focus-within::after { border-color: ${c.strokeFieldFocus}; }
|
|
27
|
+
|
|
28
|
+
& .input-value {
|
|
29
|
+
box-sizing: border-box; flex: 1 1 auto; min-width: 0; width: 100%;
|
|
30
|
+
align-self: stretch; margin: 0; border: none; background: none; outline: none;
|
|
31
|
+
font: inherit; color: ${c.fgPrimary};
|
|
32
|
+
}
|
|
33
|
+
& .input-value::placeholder { color: ${c.fgMuted}; }
|
|
34
|
+
& .input-value:disabled { opacity: 0.5; cursor: not-allowed; }
|
|
35
|
+
&:has(.input-value:disabled) { opacity: 1; }
|
|
36
|
+
`,
|
|
37
|
+
variants: {
|
|
38
|
+
size: {
|
|
39
|
+
medium: `height: 32px; border-radius: ${c.radius.md}; & .input-value { padding-inline: ${c.space["2.5"]}; }`,
|
|
40
|
+
large: `height: 36px; border-radius: 10px; & .input-value { padding-inline: ${c.space["3"]}; }`,
|
|
41
|
+
},
|
|
42
|
+
invalid: {
|
|
43
|
+
// critical outranks focus: a field that is wrong stays visibly wrong
|
|
44
|
+
// while you are correcting it, which is seed's behaviour too
|
|
45
|
+
true: `&::after { border-color: ${c.bgDanger}; } &:focus-within::after { border-color: ${c.bgDanger}; }`,
|
|
46
|
+
false: ``,
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
defaultVariants: { size: "medium", invalid: false },
|
|
50
|
+
compoundVariants: [],
|
|
51
|
+
});
|
|
52
|
+
export const inputRecipe = Object.assign(resolveRecipe(config), {
|
|
53
|
+
config,
|
|
54
|
+
meta: { medium: { height: "32px", borderRadius: "8px", fontSize: "14px" } },
|
|
55
|
+
});
|
|
56
|
+
export default config;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { Primitive } from "../../core/index.js";
|
|
4
|
+
import { kbdRecipe } from "./kbd.recipe.js";
|
|
5
|
+
export const Kbd = React.forwardRef(({ className, asChild, ...props }, ref) => {
|
|
6
|
+
return (_jsx(Primitive.span, { ref: ref, asChild: asChild, className: kbdRecipe({ className }), ...props }));
|
|
7
|
+
});
|
|
8
|
+
Kbd.displayName = "Kbd";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { defineRecipe, resolveRecipe } from "../../core/index.js";
|
|
2
|
+
import { contract as c } from "../../tokens/index.js";
|
|
3
|
+
const config = defineRecipe({
|
|
4
|
+
name: "kbd",
|
|
5
|
+
base: `box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; gap: ${c.space["0.5"]}; min-width: 20px; height: 20px; padding-inline: ${c.space["1"]}; border-radius: ${c.radius.sm}; font-family: ${c.font.sans}; font-size: ${c.text.xs}; font-weight: ${c.weight.regular}; color: color-mix(in srgb, ${c.fgPrimary} 50%, transparent); background: transparent; box-shadow: inset 0 0 0 1px color-mix(in srgb, ${c.fgPrimary} 6%, transparent);`,
|
|
6
|
+
variants: {},
|
|
7
|
+
defaultVariants: {},
|
|
8
|
+
compoundVariants: [],
|
|
9
|
+
});
|
|
10
|
+
export const kbdRecipe = Object.assign(resolveRecipe(config), {
|
|
11
|
+
config,
|
|
12
|
+
meta: {
|
|
13
|
+
chip: {
|
|
14
|
+
height: "20px",
|
|
15
|
+
borderRadius: "6px",
|
|
16
|
+
fontSize: "11px",
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
export default config;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { contract as c } from "../../tokens/index.js";
|
|
3
|
+
import { linechartRecipe } from "./linechart.recipe.js";
|
|
4
|
+
function niceNum(raw) {
|
|
5
|
+
if (raw <= 0)
|
|
6
|
+
return 1;
|
|
7
|
+
const mag = 10 ** Math.floor(Math.log10(raw));
|
|
8
|
+
const norm = raw / mag;
|
|
9
|
+
const step = norm <= 1 ? 1 : norm <= 2 ? 2 : norm <= 5 ? 5 : 10;
|
|
10
|
+
return step * mag;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* A responsive line chart — measured from Attio's Reports historical charts.
|
|
14
|
+
* A stretched SVG line/area (non-scaling stroke keeps it crisp) over dashed
|
|
15
|
+
* gridlines; dots are HTML so they stay round. `role="img"` with a summary.
|
|
16
|
+
*/
|
|
17
|
+
export function LineChart({ data, height = 240, max, ticks = 5, color, area = true, dots = true, format = (n) => n.toLocaleString(), yAxisWidth, xAxisTitle, "aria-label": ariaLabel, className, ...rest }) {
|
|
18
|
+
const rawMax = Math.max(1, ...data.map((d) => d.value));
|
|
19
|
+
const step = max ? max / (ticks - 1) : niceNum(rawMax / (ticks - 1));
|
|
20
|
+
const top = step * (ticks - 1);
|
|
21
|
+
const tickValues = Array.from({ length: ticks }, (_, i) => step * i);
|
|
22
|
+
// The value-axis gutter must fit whatever `format` actually returns — a
|
|
23
|
+
// hardcoded width fits "4.0k" but not "4,000,000₮". `ch` is the width of
|
|
24
|
+
// "0" in the current font, so sizing off the longest formatted tick tracks
|
|
25
|
+
// the real label width without measuring the DOM (works during SSR, no
|
|
26
|
+
// ResizeObserver). `yAxisWidth` lets a caller pin the gutter instead.
|
|
27
|
+
const longestTickChars = Math.max(0, ...tickValues.map((t) => format(t).length));
|
|
28
|
+
const yAxisWidthValue = yAxisWidth != null
|
|
29
|
+
? `${yAxisWidth}px`
|
|
30
|
+
: `max(34px, ${longestTickChars}ch + ${c.space["4"]})`;
|
|
31
|
+
// points in a 0..100 viewBox (y inverted: 0 at top)
|
|
32
|
+
const n = data.length;
|
|
33
|
+
const pts = data.map((d, i) => {
|
|
34
|
+
const x = n === 1 ? 50 : (i / (n - 1)) * 100;
|
|
35
|
+
const frac = Math.max(0, Math.min(1, d.value / top));
|
|
36
|
+
return { x, y: 100 - frac * 100, frac };
|
|
37
|
+
});
|
|
38
|
+
const line = pts.map((p) => `${p.x},${p.y}`).join(" ");
|
|
39
|
+
const areaPath = pts.length > 1
|
|
40
|
+
? `M ${pts[0].x},100 ${pts.map((p) => `L ${p.x},${p.y}`).join(" ")} L ${pts[pts.length - 1].x},100 Z`
|
|
41
|
+
: "";
|
|
42
|
+
const summary = ariaLabel ??
|
|
43
|
+
`Line chart: ${data.map((d) => `${d.label} ${format(d.value)}`).join(", ")}`;
|
|
44
|
+
return (_jsxs("div", { className: linechartRecipe({ className }), ...rest, style: {
|
|
45
|
+
height,
|
|
46
|
+
"--linechart-yaxis-width": yAxisWidthValue,
|
|
47
|
+
}, role: "img", "aria-label": summary, children: [_jsxs("div", { className: "linechart-body", children: [_jsx("div", { className: "linechart-yaxis", children: tickValues.map((t) => (_jsx("span", { className: "linechart-ytick", style: { bottom: `${(t / top) * 100}%` }, children: format(t) }, t))) }), _jsxs("div", { className: "linechart-plot", children: [tickValues.map((t) => (_jsx("div", { className: "linechart-grid", style: { bottom: `${(t / top) * 100}%` } }, t))), pts.length > 1 && (_jsxs("svg", { className: "linechart-svg", viewBox: "0 0 100 100", preserveAspectRatio: "none", "aria-hidden": "true", children: [area && _jsx("path", { className: "linechart-area", d: areaPath }), _jsx("polyline", { className: "linechart-line", points: line, style: { stroke: color } })] })), dots &&
|
|
48
|
+
pts.map((p, i) => (_jsx("span", { className: "linechart-dot-html", style: {
|
|
49
|
+
left: `${p.x}%`,
|
|
50
|
+
bottom: `${p.frac * 100}%`,
|
|
51
|
+
borderColor: color,
|
|
52
|
+
}, title: `${data[i].label}: ${format(data[i].value)}` }, i)))] })] }), _jsx("div", { className: "linechart-xaxis", children: data.map((d) => (_jsx("span", { className: "linechart-xlabel", children: d.label }, d.label))) }), xAxisTitle != null && (_jsx("div", { className: "linechart-axis-title", children: xAxisTitle }))] }));
|
|
53
|
+
}
|
|
54
|
+
LineChart.displayName = "LineChart";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { defineRecipe, resolveRecipe } from "../../core/index.js";
|
|
2
|
+
import { contract as c } from "../../tokens/index.js";
|
|
3
|
+
// A responsive line chart — measured from Attio's Reports historical charts: a
|
|
4
|
+
// brand line with a soft area fill over dashed horizontal gridlines, a value
|
|
5
|
+
// axis on the left, and category labels below. The plot is an SVG stretched to
|
|
6
|
+
// its box (non-scaling stroke keeps the line crisp); axes are HTML.
|
|
7
|
+
const config = defineRecipe({
|
|
8
|
+
name: "linechart",
|
|
9
|
+
// --linechart-yaxis-width is the one source of truth for the value-axis
|
|
10
|
+
// gutter: the component sets it (auto-sized to the longest tick label, or
|
|
11
|
+
// pinned via `yAxisWidth`) on the root element, and it inherits down to the
|
|
12
|
+
// x-axis padding and axis title so they never drift out of alignment. 34px
|
|
13
|
+
// is only the pre-JS fallback (e.g. if `linechartRecipe` is used bare).
|
|
14
|
+
base: `display: flex; flex-direction: column; box-sizing: border-box; font-family: ${c.font.sans}; --linechart-yaxis-width: 34px;
|
|
15
|
+
& .linechart-body { display: flex; flex: 1; min-height: 0; }
|
|
16
|
+
& .linechart-yaxis { position: relative; flex-shrink: 0; width: var(--linechart-yaxis-width); }
|
|
17
|
+
& .linechart-ytick { position: absolute; inset-inline-end: ${c.space["2"]}; transform: translateY(50%); font-size: ${c.text.xs}; color: ${c.fgMuted}; white-space: nowrap; }
|
|
18
|
+
& .linechart-plot { position: relative; flex: 1; min-width: 0; border-bottom: 1px solid ${c.borderDefault}; }
|
|
19
|
+
& .linechart-grid { position: absolute; left: 0; right: 0; border-top: 1px dashed ${c.borderSubtle}; pointer-events: none; }
|
|
20
|
+
& .linechart-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
|
|
21
|
+
& .linechart-area { fill: color-mix(in srgb, ${c.bgBrandSolid} 12%, transparent); stroke: none; }
|
|
22
|
+
& .linechart-line { fill: none; stroke: ${c.bgBrandSolid}; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
|
|
23
|
+
& .linechart-dot-html { position: absolute; width: 8px; height: 8px; box-sizing: border-box; border-radius: ${c.radius.full}; background: ${c.bgSurface}; border: 2px solid ${c.bgBrandSolid}; transform: translate(-50%, 50%); pointer-events: auto; }
|
|
24
|
+
& .linechart-xaxis { display: flex; margin-top: ${c.space["1.5"]}; padding-inline-start: var(--linechart-yaxis-width); }
|
|
25
|
+
& .linechart-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}; }
|
|
26
|
+
& .linechart-axis-title { margin-top: ${c.space["1"]}; padding-inline-start: var(--linechart-yaxis-width); text-align: center; font-size: ${c.text.sm}; color: ${c.fgMuted}; }`,
|
|
27
|
+
variants: {},
|
|
28
|
+
defaultVariants: {},
|
|
29
|
+
compoundVariants: [],
|
|
30
|
+
});
|
|
31
|
+
export const linechartRecipe = resolveRecipe(config);
|
|
32
|
+
export default config;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* The elements a `role="menu"` may own, minus the disabled ones. Kept here so
|
|
4
|
+
* every menu surface in crisp agrees on what counts as an item.
|
|
5
|
+
*/
|
|
6
|
+
export const MENU_ITEM_SELECTOR = [
|
|
7
|
+
'[role="menuitem"]',
|
|
8
|
+
'[role="menuitemcheckbox"]',
|
|
9
|
+
'[role="menuitemradio"]',
|
|
10
|
+
]
|
|
11
|
+
// a disabled item is not focusable, so leaving it in the list would strand
|
|
12
|
+
// the roving focus on it — both spellings have to go
|
|
13
|
+
.map((role) => `${role}:not([data-disabled]):not(:disabled)`)
|
|
14
|
+
.join(",");
|
|
15
|
+
/**
|
|
16
|
+
* The WAI-ARIA menu keyboard model: focus the first item on open, ↑/↓ to move
|
|
17
|
+
* (wrapping), Home/End to jump, printable characters for typeahead, Esc to
|
|
18
|
+
* close, Tab to dismiss. Returns the `onKeyDown` to put on the menu element.
|
|
19
|
+
*
|
|
20
|
+
* Extracted from `Menu` so the table surfaces, which build their own popovers
|
|
21
|
+
* against measured positions, get the identical model instead of a second
|
|
22
|
+
* partial one.
|
|
23
|
+
*/
|
|
24
|
+
export function useMenuKeyboard({ open, close, dismiss = close, contentRef, }) {
|
|
25
|
+
const typeahead = React.useRef("");
|
|
26
|
+
const typeaheadTimer = React.useRef(undefined);
|
|
27
|
+
const items = React.useCallback(() => Array.from(contentRef.current?.querySelectorAll(MENU_ITEM_SELECTOR) ??
|
|
28
|
+
[]), [contentRef]);
|
|
29
|
+
// focus the first item when the menu opens
|
|
30
|
+
React.useEffect(() => {
|
|
31
|
+
if (!open)
|
|
32
|
+
return;
|
|
33
|
+
const id = requestAnimationFrame(() => contentRef.current
|
|
34
|
+
?.querySelector(MENU_ITEM_SELECTOR)
|
|
35
|
+
?.focus());
|
|
36
|
+
return () => cancelAnimationFrame(id);
|
|
37
|
+
}, [open, contentRef]);
|
|
38
|
+
React.useEffect(() => () => clearTimeout(typeaheadTimer.current), []);
|
|
39
|
+
const onKeyDown = (e) => {
|
|
40
|
+
const list = items();
|
|
41
|
+
const idx = list.indexOf(document.activeElement);
|
|
42
|
+
if (e.key === "ArrowDown") {
|
|
43
|
+
e.preventDefault();
|
|
44
|
+
list[(idx + 1) % list.length]?.focus();
|
|
45
|
+
}
|
|
46
|
+
else if (e.key === "ArrowUp") {
|
|
47
|
+
e.preventDefault();
|
|
48
|
+
list[(idx - 1 + list.length) % list.length]?.focus();
|
|
49
|
+
}
|
|
50
|
+
else if (e.key === "Home") {
|
|
51
|
+
e.preventDefault();
|
|
52
|
+
list[0]?.focus();
|
|
53
|
+
}
|
|
54
|
+
else if (e.key === "End") {
|
|
55
|
+
e.preventDefault();
|
|
56
|
+
list[list.length - 1]?.focus();
|
|
57
|
+
}
|
|
58
|
+
else if (e.key === "Escape") {
|
|
59
|
+
e.preventDefault();
|
|
60
|
+
close();
|
|
61
|
+
}
|
|
62
|
+
else if (e.key === "Tab") {
|
|
63
|
+
dismiss();
|
|
64
|
+
}
|
|
65
|
+
else if (e.key.length === 1 && /\S/.test(e.key)) {
|
|
66
|
+
// typeahead: jump to the next item starting with the typed run
|
|
67
|
+
typeahead.current += e.key.toLowerCase();
|
|
68
|
+
clearTimeout(typeaheadTimer.current);
|
|
69
|
+
typeaheadTimer.current = setTimeout(() => {
|
|
70
|
+
typeahead.current = "";
|
|
71
|
+
}, 500);
|
|
72
|
+
const match = list.find((el) => (el.textContent ?? "")
|
|
73
|
+
.trim()
|
|
74
|
+
.toLowerCase()
|
|
75
|
+
.startsWith(typeahead.current));
|
|
76
|
+
match?.focus();
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
return { onKeyDown, items };
|
|
80
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Check } from "lucide-react";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { menuRecipe } from "./menu.recipe.js";
|
|
5
|
+
import { useMenuKeyboard } from "./menu-keyboard.js";
|
|
6
|
+
const MenuContext = React.createContext(null);
|
|
7
|
+
/**
|
|
8
|
+
* A dropdown menu — the ⋯ / sort / filter menu surface, on Attio's measured
|
|
9
|
+
* popover. Give it a `trigger` element and Menu items as children. Opens on
|
|
10
|
+
* click / ↓ / Enter; roving-focus keyboard model (↑/↓ move, Home/End jump,
|
|
11
|
+
* typeahead, Enter/Space select, Esc closes and returns focus to the trigger);
|
|
12
|
+
* closes on outside click. Flips up / right-aligns when space is tight.
|
|
13
|
+
*/
|
|
14
|
+
export function Menu({ trigger, children, align = "start", open: openProp, defaultOpen, onOpenChange, className, "aria-label": ariaLabel, }) {
|
|
15
|
+
const [internalOpen, setInternalOpen] = React.useState(defaultOpen ?? false);
|
|
16
|
+
const open = openProp ?? internalOpen;
|
|
17
|
+
const setOpen = React.useCallback((next) => {
|
|
18
|
+
if (openProp === undefined)
|
|
19
|
+
setInternalOpen(next);
|
|
20
|
+
onOpenChange?.(next);
|
|
21
|
+
}, [openProp, onOpenChange]);
|
|
22
|
+
const [up, setUp] = React.useState(false);
|
|
23
|
+
const [pos, setPos] = React.useState({});
|
|
24
|
+
const rootRef = React.useRef(null);
|
|
25
|
+
const triggerRef = React.useRef(null);
|
|
26
|
+
const contentRef = React.useRef(null);
|
|
27
|
+
// Position the (fixed) menu against the trigger so it escapes any overflow
|
|
28
|
+
// clip; flip up / right-align when there isn't room. Runs on every open,
|
|
29
|
+
// not just a click, so a controlled consumer gets the same placement.
|
|
30
|
+
const place = () => {
|
|
31
|
+
const rect = triggerRef.current?.getBoundingClientRect();
|
|
32
|
+
if (!rect)
|
|
33
|
+
return;
|
|
34
|
+
const gap = 4;
|
|
35
|
+
const flipUp = window.innerHeight - rect.bottom < 280;
|
|
36
|
+
const style = flipUp
|
|
37
|
+
? { bottom: window.innerHeight - rect.top + gap }
|
|
38
|
+
: { top: rect.bottom + gap };
|
|
39
|
+
if (align === "end")
|
|
40
|
+
style.right = window.innerWidth - rect.right;
|
|
41
|
+
else
|
|
42
|
+
style.left = rect.left;
|
|
43
|
+
setUp(flipUp);
|
|
44
|
+
setPos(style);
|
|
45
|
+
};
|
|
46
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: reposition each time it opens
|
|
47
|
+
React.useLayoutEffect(() => {
|
|
48
|
+
if (open)
|
|
49
|
+
place();
|
|
50
|
+
}, [open]);
|
|
51
|
+
const close = React.useCallback(() => {
|
|
52
|
+
setOpen(false);
|
|
53
|
+
triggerRef.current?.focus?.();
|
|
54
|
+
}, [setOpen]);
|
|
55
|
+
// close on outside pointer-down
|
|
56
|
+
React.useEffect(() => {
|
|
57
|
+
if (!open)
|
|
58
|
+
return;
|
|
59
|
+
const onDown = (e) => {
|
|
60
|
+
if (!rootRef.current?.contains(e.target))
|
|
61
|
+
setOpen(false);
|
|
62
|
+
};
|
|
63
|
+
document.addEventListener("pointerdown", onDown);
|
|
64
|
+
return () => document.removeEventListener("pointerdown", onDown);
|
|
65
|
+
}, [open, setOpen]);
|
|
66
|
+
const { onKeyDown: onContentKeyDown } = useMenuKeyboard({
|
|
67
|
+
open,
|
|
68
|
+
close,
|
|
69
|
+
dismiss: () => setOpen(false),
|
|
70
|
+
contentRef,
|
|
71
|
+
});
|
|
72
|
+
const triggerEl = React.cloneElement(trigger, {
|
|
73
|
+
ref: triggerRef,
|
|
74
|
+
"aria-haspopup": "menu",
|
|
75
|
+
"aria-expanded": open,
|
|
76
|
+
onClick: (e) => {
|
|
77
|
+
trigger.props.onClick?.(e);
|
|
78
|
+
setOpen(!open);
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
return (_jsxs("div", { ref: rootRef, className: menuRecipe({ className }), children: [triggerEl, open && (_jsx(MenuContext.Provider, { value: { close }, children: _jsx("div", { ref: contentRef, className: "menu-content", role: "menu", "aria-label": ariaLabel, "data-align": align, "data-up": up ? "" : undefined, style: pos, onKeyDown: onContentKeyDown, children: children }) }))] }));
|
|
82
|
+
}
|
|
83
|
+
Menu.displayName = "Menu";
|
|
84
|
+
export function MenuItem({ children, icon, shortcut, danger, disabled, onSelect, closeOnSelect = true, }) {
|
|
85
|
+
const ctx = React.useContext(MenuContext);
|
|
86
|
+
return (_jsxs("button", { type: "button", role: "menuitem", tabIndex: -1, disabled: disabled, "data-disabled": disabled ? "" : undefined, className: `menu-item${danger ? " menu-item--danger" : ""}`, onClick: () => {
|
|
87
|
+
onSelect?.();
|
|
88
|
+
if (closeOnSelect)
|
|
89
|
+
ctx?.close();
|
|
90
|
+
}, children: [icon, _jsx("span", { className: "menu-item-label", children: children }), shortcut && _jsx("span", { className: "menu-item-shortcut", children: shortcut })] }));
|
|
91
|
+
}
|
|
92
|
+
MenuItem.displayName = "MenuItem";
|
|
93
|
+
export function MenuCheckboxItem({ children, checked, onCheckedChange, disabled, }) {
|
|
94
|
+
return (_jsxs("button", { type: "button", role: "menuitemcheckbox", "aria-checked": checked, tabIndex: -1, disabled: disabled, "data-disabled": disabled ? "" : undefined, className: "menu-item", onClick: () => onCheckedChange?.(!checked), children: [checked ? (_jsx(Check, { className: "menu-item-check", size: 15, strokeWidth: 2 })) : (_jsx("span", { className: "menu-item-check--placeholder" })), _jsx("span", { className: "menu-item-label", children: children })] }));
|
|
95
|
+
}
|
|
96
|
+
MenuCheckboxItem.displayName = "MenuCheckboxItem";
|
|
97
|
+
export function MenuSeparator() {
|
|
98
|
+
return _jsx("hr", { className: "menu-sep" });
|
|
99
|
+
}
|
|
100
|
+
MenuSeparator.displayName = "MenuSeparator";
|
|
101
|
+
export function MenuLabel({ children }) {
|
|
102
|
+
return _jsx("div", { className: "menu-label", children: children });
|
|
103
|
+
}
|
|
104
|
+
MenuLabel.displayName = "MenuLabel";
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { defineRecipe, resolveRecipe } from "../../core/index.js";
|
|
2
|
+
import { contract as c, elevation as e } from "../../tokens/index.js";
|
|
3
|
+
// A dropdown menu — same popover surface Attio uses for its ⋯ / sort / filter
|
|
4
|
+
// menus (measured from the app's listboxes): radius 12, 4px padding, a layered
|
|
5
|
+
// soft shadow, over 32px items (radius 8, icon + label + optional shortcut /
|
|
6
|
+
// check). The content is rendered inside this relative root so it keeps these
|
|
7
|
+
// nested styles while escaping the trigger's own box.
|
|
8
|
+
const config = defineRecipe({
|
|
9
|
+
name: "menu",
|
|
10
|
+
base: `
|
|
11
|
+
position: relative; display: inline-flex; font-family: ${c.font.sans};
|
|
12
|
+
-webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
|
|
13
|
+
|
|
14
|
+
& .menu-content {
|
|
15
|
+
position: fixed; z-index: 60; box-sizing: border-box; display: flex; flex-direction: column; gap: ${c.space.px};
|
|
16
|
+
min-width: 200px; max-height: 360px; overflow-y: auto; padding: ${c.space["1"]};
|
|
17
|
+
border-radius: ${c.radius.xl}; background: ${c.bgPopover};
|
|
18
|
+
box-shadow: ${e.floating};
|
|
19
|
+
transform-origin: top left; opacity: 1; transform: none; transition: opacity .08s ease, transform .08s ease;
|
|
20
|
+
}
|
|
21
|
+
& .menu-content[data-align="end"] { transform-origin: top right; }
|
|
22
|
+
& .menu-content[data-up] { transform-origin: bottom left; }
|
|
23
|
+
& .menu-content[data-up][data-align="end"] { transform-origin: bottom right; }
|
|
24
|
+
& .menu-content { @starting-style { opacity: 0; transform: scale(0.97) translateY(-1px); } }
|
|
25
|
+
|
|
26
|
+
& .menu-item {
|
|
27
|
+
box-sizing: border-box; display: flex; align-items: center; gap: ${c.space["1.5"]}; width: 100%; height: ${c.size.menuRow}; flex-shrink: 0;
|
|
28
|
+
margin: 0; padding: 0 ${c.space["2"]}; border: none; background: none; border-radius: ${c.radius.md};
|
|
29
|
+
font-family: inherit; font-size: ${c.text.lg}; color: ${c.fgPrimary}; text-align: start; cursor: pointer; white-space: nowrap;
|
|
30
|
+
}
|
|
31
|
+
& .menu-item svg { flex-shrink: 0; color: ${c.fgMuted}; }
|
|
32
|
+
& .menu-item:focus { outline: none; }
|
|
33
|
+
& .menu-item:hover:not([data-disabled]), & .menu-item:focus-visible:not([data-disabled]), & .menu-item[data-highlighted]:not([data-disabled]) { background: ${c.bgRaised}; }
|
|
34
|
+
& .menu-item[data-disabled] { opacity: 0.5; cursor: not-allowed; }
|
|
35
|
+
& .menu-item--danger { color: ${c.bgDanger}; }
|
|
36
|
+
& .menu-item--danger svg { color: ${c.bgDanger}; }
|
|
37
|
+
& .menu-item--danger:hover, & .menu-item--danger:focus-visible, & .menu-item--danger[data-highlighted] { background: color-mix(in srgb, ${c.bgDanger} 10%, transparent); }
|
|
38
|
+
& .menu-item-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
|
|
39
|
+
& .menu-item-shortcut { flex-shrink: 0; margin-inline-start: ${c.space["3"]}; font-size: ${c.text.sm}; color: ${c.fgMuted}; letter-spacing: 0.02em; }
|
|
40
|
+
& .menu-item-check { flex-shrink: 0; color: ${c.bgBrandSolid}; }
|
|
41
|
+
& .menu-item-check--placeholder { width: 15px; }
|
|
42
|
+
|
|
43
|
+
& .menu-sep { height: 1px; flex-shrink: 0; border: none; margin: ${c.space["1"]} calc(-1 * ${c.space["1"]}); background: ${c.borderSubtle}; }
|
|
44
|
+
& .menu-label { padding: ${c.space["1.5"]} ${c.space["2"]} ${c.space["0.5"]}; font-size: ${c.text.sm}; font-weight: ${c.weight.medium}; color: ${c.fgMuted}; }
|
|
45
|
+
`,
|
|
46
|
+
variants: {},
|
|
47
|
+
defaultVariants: {},
|
|
48
|
+
compoundVariants: [],
|
|
49
|
+
});
|
|
50
|
+
export const menuRecipe = Object.assign(resolveRecipe(config), { config });
|
|
51
|
+
export default config;
|