@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,125 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Check, ChevronDown, Search } from "lucide-react";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { multiselectRecipe } from "./multiselect.recipe.js";
|
|
5
|
+
const TONES = [
|
|
6
|
+
"brand",
|
|
7
|
+
"success",
|
|
8
|
+
"warning",
|
|
9
|
+
"danger",
|
|
10
|
+
"purple",
|
|
11
|
+
"cyan",
|
|
12
|
+
"orange",
|
|
13
|
+
];
|
|
14
|
+
// deterministic pastel per value (a value keeps its colour), matching the table
|
|
15
|
+
function toneFor(t) {
|
|
16
|
+
let h = 0;
|
|
17
|
+
for (let i = 0; i < t.length; i++)
|
|
18
|
+
h = (h * 31 + t.charCodeAt(i)) >>> 0;
|
|
19
|
+
return TONES[h % TONES.length];
|
|
20
|
+
}
|
|
21
|
+
function Chip({ opt }) {
|
|
22
|
+
return (_jsx("span", { className: "recordstable-tag", "data-tone": opt.tone ?? toneFor(opt.value), children: opt.label }));
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* A multi-select / tag editor — measured from Attio's cell tag picker. The
|
|
26
|
+
* outlined trigger shows the selected values as coloured chips; it opens a
|
|
27
|
+
* popover with a search field over rows of "[chip] … [checkbox]" that toggle on
|
|
28
|
+
* click (the menu stays open). Keyboard: ↑/↓ move, Enter toggles, Esc closes.
|
|
29
|
+
*/
|
|
30
|
+
export function MultiSelect({ options, value: valueProp, defaultValue, onValueChange, placeholder = "Select…", searchable = true, searchPlaceholder = "Search…", disabled, className, "aria-label": ariaLabel, ...rest }) {
|
|
31
|
+
const [open, setOpen] = React.useState(false);
|
|
32
|
+
const [up, setUp] = React.useState(false);
|
|
33
|
+
const [pos, setPos] = React.useState({});
|
|
34
|
+
const [query, setQuery] = React.useState("");
|
|
35
|
+
const [highlight, setHighlight] = React.useState(0);
|
|
36
|
+
const rootRef = React.useRef(null);
|
|
37
|
+
const triggerRef = React.useRef(null);
|
|
38
|
+
const searchRef = React.useRef(null);
|
|
39
|
+
const [internalValue, setInternalValue] = React.useState(defaultValue ?? []);
|
|
40
|
+
const value = valueProp ?? internalValue;
|
|
41
|
+
const selectedSet = React.useMemo(() => new Set(value), [value]);
|
|
42
|
+
const selectedOptions = options.filter((o) => selectedSet.has(o.value));
|
|
43
|
+
const q = query.trim().toLowerCase();
|
|
44
|
+
const filtered = searchable && q
|
|
45
|
+
? options.filter((o) => o.label.toLowerCase().includes(q))
|
|
46
|
+
: options;
|
|
47
|
+
const openMenu = () => {
|
|
48
|
+
if (disabled)
|
|
49
|
+
return;
|
|
50
|
+
const rect = triggerRef.current?.getBoundingClientRect();
|
|
51
|
+
if (rect) {
|
|
52
|
+
const flipUp = window.innerHeight - rect.bottom < 300;
|
|
53
|
+
setUp(flipUp);
|
|
54
|
+
setPos({
|
|
55
|
+
left: rect.left,
|
|
56
|
+
minWidth: rect.width,
|
|
57
|
+
...(flipUp
|
|
58
|
+
? { bottom: window.innerHeight - rect.top + 4 }
|
|
59
|
+
: { top: rect.bottom + 4 }),
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
setQuery("");
|
|
63
|
+
setHighlight(0);
|
|
64
|
+
setOpen(true);
|
|
65
|
+
if (searchable)
|
|
66
|
+
requestAnimationFrame(() => searchRef.current?.focus({ preventScroll: true }));
|
|
67
|
+
};
|
|
68
|
+
const close = () => {
|
|
69
|
+
setOpen(false);
|
|
70
|
+
triggerRef.current?.focus({ preventScroll: true });
|
|
71
|
+
};
|
|
72
|
+
const toggle = (v) => {
|
|
73
|
+
const next = selectedSet.has(v)
|
|
74
|
+
? value.filter((x) => x !== v)
|
|
75
|
+
: [...value, v];
|
|
76
|
+
if (valueProp === undefined)
|
|
77
|
+
setInternalValue(next);
|
|
78
|
+
onValueChange?.(next);
|
|
79
|
+
};
|
|
80
|
+
const onNavKeys = (e) => {
|
|
81
|
+
if (e.key === "ArrowDown") {
|
|
82
|
+
e.preventDefault();
|
|
83
|
+
setHighlight((h) => Math.min(h + 1, filtered.length - 1));
|
|
84
|
+
}
|
|
85
|
+
else if (e.key === "ArrowUp") {
|
|
86
|
+
e.preventDefault();
|
|
87
|
+
setHighlight((h) => Math.max(h - 1, 0));
|
|
88
|
+
}
|
|
89
|
+
else if (e.key === "Enter") {
|
|
90
|
+
e.preventDefault();
|
|
91
|
+
const opt = filtered[highlight];
|
|
92
|
+
if (opt)
|
|
93
|
+
toggle(opt.value);
|
|
94
|
+
}
|
|
95
|
+
else if (e.key === "Escape") {
|
|
96
|
+
e.preventDefault();
|
|
97
|
+
close();
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
React.useEffect(() => {
|
|
101
|
+
if (!open)
|
|
102
|
+
return;
|
|
103
|
+
const onDown = (e) => {
|
|
104
|
+
if (!rootRef.current?.contains(e.target))
|
|
105
|
+
setOpen(false);
|
|
106
|
+
};
|
|
107
|
+
document.addEventListener("pointerdown", onDown);
|
|
108
|
+
return () => document.removeEventListener("pointerdown", onDown);
|
|
109
|
+
}, [open]);
|
|
110
|
+
return (_jsxs("div", { ref: rootRef, className: multiselectRecipe({ className }), ...rest, children: [_jsxs("button", { ref: triggerRef, type: "button", "aria-haspopup": "listbox", "aria-expanded": open, "aria-label": ariaLabel, disabled: disabled, "data-open": open ? "" : undefined, className: "multiselect-trigger", onClick: () => (open ? setOpen(false) : openMenu()), onKeyDown: (e) => {
|
|
111
|
+
if (open && !searchable)
|
|
112
|
+
onNavKeys(e);
|
|
113
|
+
else if (!open && (e.key === "ArrowDown" || e.key === "Enter")) {
|
|
114
|
+
e.preventDefault();
|
|
115
|
+
openMenu();
|
|
116
|
+
}
|
|
117
|
+
}, children: [_jsx("span", { className: "multiselect-chips", children: selectedOptions.length === 0 ? (_jsx("span", { className: "multiselect-placeholder", children: placeholder })) : (selectedOptions.map((o) => _jsx(Chip, { opt: o }, o.value))) }), _jsx(ChevronDown, { className: "multiselect-chevron", size: 16, strokeWidth: 1.75 })] }), open && (_jsxs("div", { className: "multiselect-listbox", role: "listbox", "aria-multiselectable": "true", "aria-label": ariaLabel, "data-up": up ? "" : undefined, style: pos, children: [searchable && (_jsxs("div", { className: "multiselect-search", children: [_jsx(Search, { size: 15, strokeWidth: 1.75 }), _jsx("input", { ref: searchRef, type: "text", placeholder: searchPlaceholder, "aria-label": searchPlaceholder, value: query, onChange: (e) => {
|
|
118
|
+
setQuery(e.target.value);
|
|
119
|
+
setHighlight(0);
|
|
120
|
+
}, onKeyDown: onNavKeys })] })), filtered.length === 0 ? (_jsx("div", { className: "multiselect-empty", children: "No results" })) : (filtered.map((opt, i) => {
|
|
121
|
+
const sel = selectedSet.has(opt.value);
|
|
122
|
+
return (_jsxs("button", { type: "button", role: "option", "aria-selected": sel, "data-highlighted": i === highlight ? "" : undefined, className: "multiselect-option", onClick: () => toggle(opt.value), onMouseEnter: () => setHighlight(i), children: [_jsx("span", { className: "multiselect-option-chip", children: _jsx(Chip, { opt: opt }) }), _jsx("span", { className: "multiselect-check", children: sel && _jsx(Check, { size: 12, strokeWidth: 3 }) })] }, opt.value));
|
|
123
|
+
}))] }))] }));
|
|
124
|
+
}
|
|
125
|
+
MultiSelect.displayName = "MultiSelect";
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { defineRecipe, resolveRecipe } from "../../core/index.js";
|
|
2
|
+
import { contract as c, elevation as e } from "../../tokens/index.js";
|
|
3
|
+
// A multi-select / tag editor — measured from Attio's cell tag picker: an
|
|
4
|
+
// outlined trigger showing the selected values as coloured chips, opening a
|
|
5
|
+
// popover with a search field over rows of "[coloured chip] … [checkbox]" that
|
|
6
|
+
// toggle on click. The popover keeps these nested styles by rendering inside
|
|
7
|
+
// this relative root.
|
|
8
|
+
const config = defineRecipe({
|
|
9
|
+
name: "multiselect",
|
|
10
|
+
base: `
|
|
11
|
+
position: relative; display: inline-flex; width: 100%; font-family: ${c.font.sans};
|
|
12
|
+
-webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
|
|
13
|
+
|
|
14
|
+
& .multiselect-trigger {
|
|
15
|
+
box-sizing: border-box; display: flex; align-items: center; gap: ${c.space["1"]}; width: 100%; min-width: 0; min-height: ${c.size.menuRow};
|
|
16
|
+
margin: 0; padding: ${c.space["0.5"]} ${c.space["1.5"]} ${c.space["0.5"]} ${c.space["2"]};
|
|
17
|
+
border: none; border-radius: ${c.radius.md}; background: transparent; box-shadow: inset 0 0 0 1px color-mix(in srgb, ${c.fgPrimary} 7%, transparent);
|
|
18
|
+
font-family: inherit; font-size: ${c.text.lg}; color: ${c.fgPrimary}; cursor: pointer; text-align: start;
|
|
19
|
+
transition: background-color .12s ease, box-shadow .12s ease;
|
|
20
|
+
}
|
|
21
|
+
& .multiselect-trigger:hover { background: ${c.bgRaised}; }
|
|
22
|
+
& .multiselect-trigger[data-open], & .multiselect-trigger:focus-visible { outline: none; box-shadow: inset 0 0 0 1px ${c.bgBrandSolid}; background: ${c.bgSurface}; }
|
|
23
|
+
& .multiselect-trigger:disabled { opacity: 0.5; cursor: not-allowed; }
|
|
24
|
+
& .multiselect-chips { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: ${c.space["1"]}; }
|
|
25
|
+
& .multiselect-placeholder { color: ${c.fgMuted}; }
|
|
26
|
+
& .multiselect-chevron { flex-shrink: 0; color: ${c.fgMuted}; transition: transform .15s ease; }
|
|
27
|
+
& .multiselect-trigger[data-open] .multiselect-chevron { transform: rotate(180deg); }
|
|
28
|
+
|
|
29
|
+
& .multiselect-listbox {
|
|
30
|
+
position: fixed; z-index: 60; box-sizing: border-box; display: flex; flex-direction: column; gap: ${c.space.px};
|
|
31
|
+
max-height: 300px; overflow-y: auto; padding: ${c.space["1"]};
|
|
32
|
+
border-radius: ${c.radius.xl}; background: ${c.bgPopover};
|
|
33
|
+
box-shadow: ${e.floating};
|
|
34
|
+
transform-origin: top left; opacity: 1; transform: none; transition: opacity .08s ease, transform .08s ease;
|
|
35
|
+
}
|
|
36
|
+
& .multiselect-listbox[data-up] { transform-origin: bottom left; }
|
|
37
|
+
& .multiselect-listbox { @starting-style { opacity: 0; transform: scale(0.97) translateY(-1px); } }
|
|
38
|
+
& .multiselect-search { display: flex; align-items: center; gap: ${c.space["2"]}; height: 34px; flex-shrink: 0; margin: calc(-1 * ${c.space["1"]}) calc(-1 * ${c.space["1"]}) ${c.space["1"]}; padding: 0 ${c.space["2.5"]}; border-bottom: 1px solid ${c.borderSubtle}; color: ${c.fgMuted}; }
|
|
39
|
+
& .multiselect-search svg { flex-shrink: 0; }
|
|
40
|
+
& .multiselect-search input { flex: 1; min-width: 0; border: none; outline: none; background: none; font-family: inherit; font-size: ${c.text.lg}; color: ${c.fgPrimary}; }
|
|
41
|
+
& .multiselect-search input::placeholder { color: ${c.fgMuted}; }
|
|
42
|
+
& .multiselect-option {
|
|
43
|
+
box-sizing: border-box; display: flex; align-items: center; gap: ${c.space["2"]}; height: ${c.size.menuRow}; flex-shrink: 0;
|
|
44
|
+
padding: 0 ${c.space["2"]}; margin: 0; border: none; background: none; border-radius: ${c.radius.md}; font-family: inherit; cursor: pointer; text-align: start;
|
|
45
|
+
}
|
|
46
|
+
& .multiselect-option[data-highlighted] { background: ${c.bgRaised}; }
|
|
47
|
+
& .multiselect-option-chip { flex: 0 1 auto; min-width: 0; overflow: hidden; }
|
|
48
|
+
& .multiselect-check { flex-shrink: 0; margin-inline-start: auto; display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; border-radius: ${c.radius.sm}; box-shadow: inset 0 0 0 1.5px ${c.borderDefault}; color: transparent; }
|
|
49
|
+
& .multiselect-option[aria-selected="true"] .multiselect-check { background: ${c.bgBrandSolid}; box-shadow: none; color: #fff; }
|
|
50
|
+
& .multiselect-empty { padding: ${c.space["3"]} ${c.space["2"]}; text-align: center; font-size: ${c.text.md}; color: ${c.fgMuted}; }
|
|
51
|
+
|
|
52
|
+
& .recordstable-tag { display: inline-flex; align-items: center; height: ${c.size.chip}; padding: 0 ${c.space["1"]}; border-radius: ${c.radius.chip}; font-size: ${c.text.lg}; line-height: 20px; font-weight: ${c.weight.medium}; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: color-mix(in srgb, ${c.fgPrimary} 6%, transparent); color: color-mix(in srgb, ${c.fgPrimary} 82%, transparent); }
|
|
53
|
+
& .recordstable-tag[data-tone="brand"] { background: color-mix(in srgb, ${c.bgBrandSolid} 14%, transparent); color: color-mix(in srgb, ${c.bgBrandSolid} 82%, ${c.fgPrimary}); }
|
|
54
|
+
& .recordstable-tag[data-tone="success"] { background: color-mix(in srgb, ${c.bgSuccess} 16%, transparent); color: color-mix(in srgb, ${c.bgSuccess} 78%, ${c.fgPrimary}); }
|
|
55
|
+
& .recordstable-tag[data-tone="warning"] { background: color-mix(in srgb, ${c.bgWarning} 18%, transparent); color: color-mix(in srgb, ${c.bgWarning} 82%, ${c.fgPrimary}); }
|
|
56
|
+
& .recordstable-tag[data-tone="danger"] { background: color-mix(in srgb, ${c.bgDanger} 15%, transparent); color: color-mix(in srgb, ${c.bgDanger} 80%, ${c.fgPrimary}); }
|
|
57
|
+
& .recordstable-tag[data-tone="purple"] { background: color-mix(in srgb, ${c.bgPurple} 16%, transparent); color: color-mix(in srgb, ${c.bgPurple} 80%, ${c.fgPrimary}); }
|
|
58
|
+
& .recordstable-tag[data-tone="cyan"] { background: color-mix(in srgb, ${c.bgCyan} 18%, transparent); color: color-mix(in srgb, ${c.bgCyan} 82%, ${c.fgPrimary}); }
|
|
59
|
+
& .recordstable-tag[data-tone="orange"] { background: color-mix(in srgb, ${c.bgOrange} 16%, transparent); color: color-mix(in srgb, ${c.bgOrange} 82%, ${c.fgPrimary}); }
|
|
60
|
+
`,
|
|
61
|
+
variants: {},
|
|
62
|
+
defaultVariants: {},
|
|
63
|
+
compoundVariants: [],
|
|
64
|
+
});
|
|
65
|
+
export const multiselectRecipe = Object.assign(resolveRecipe(config), {
|
|
66
|
+
config,
|
|
67
|
+
});
|
|
68
|
+
export default config;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { popoverRecipe } from "./popover.recipe.js";
|
|
4
|
+
/**
|
|
5
|
+
* A generic anchored popover — the Menu/Select surface holding arbitrary
|
|
6
|
+
* content. Opens below the trigger (flipping up when there's no room),
|
|
7
|
+
* closes on outside pointer-down and Escape. Controlled or self-managed.
|
|
8
|
+
*/
|
|
9
|
+
export function Popover({ trigger, children, align = "start", open: openProp, defaultOpen, onOpenChange, "aria-label": ariaLabel, className, }) {
|
|
10
|
+
const [internalOpen, setInternalOpen] = React.useState(defaultOpen ?? false);
|
|
11
|
+
const open = openProp ?? internalOpen;
|
|
12
|
+
const rootRef = React.useRef(null);
|
|
13
|
+
const triggerRef = React.useRef(null);
|
|
14
|
+
const [pos, setPos] = React.useState({});
|
|
15
|
+
const [up, setUp] = React.useState(false);
|
|
16
|
+
const setOpen = React.useCallback((next) => {
|
|
17
|
+
if (openProp === undefined)
|
|
18
|
+
setInternalOpen(next);
|
|
19
|
+
onOpenChange?.(next);
|
|
20
|
+
}, [openProp, onOpenChange]);
|
|
21
|
+
const place = () => {
|
|
22
|
+
const el = triggerRef.current;
|
|
23
|
+
if (!el)
|
|
24
|
+
return;
|
|
25
|
+
const rect = el.getBoundingClientRect();
|
|
26
|
+
const gap = 6;
|
|
27
|
+
const flipUp = window.innerHeight - rect.bottom < 280;
|
|
28
|
+
const style = flipUp
|
|
29
|
+
? { bottom: window.innerHeight - rect.top + gap }
|
|
30
|
+
: { top: rect.bottom + gap };
|
|
31
|
+
if (align === "end")
|
|
32
|
+
style.right = window.innerWidth - rect.right;
|
|
33
|
+
else
|
|
34
|
+
style.left = rect.left;
|
|
35
|
+
setUp(flipUp);
|
|
36
|
+
setPos(style);
|
|
37
|
+
};
|
|
38
|
+
// Position when opening (before paint so it never flashes at 0,0).
|
|
39
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: reposition each time it opens
|
|
40
|
+
React.useLayoutEffect(() => {
|
|
41
|
+
if (open)
|
|
42
|
+
place();
|
|
43
|
+
}, [open]);
|
|
44
|
+
React.useEffect(() => {
|
|
45
|
+
if (!open)
|
|
46
|
+
return;
|
|
47
|
+
const onDown = (e) => {
|
|
48
|
+
if (!rootRef.current?.contains(e.target))
|
|
49
|
+
setOpen(false);
|
|
50
|
+
};
|
|
51
|
+
document.addEventListener("pointerdown", onDown);
|
|
52
|
+
return () => document.removeEventListener("pointerdown", onDown);
|
|
53
|
+
}, [open, setOpen]);
|
|
54
|
+
const triggerEl = React.cloneElement(trigger, {
|
|
55
|
+
ref: triggerRef,
|
|
56
|
+
"aria-haspopup": "dialog",
|
|
57
|
+
"aria-expanded": open,
|
|
58
|
+
onClick: (e) => {
|
|
59
|
+
trigger.props.onClick?.(e);
|
|
60
|
+
setOpen(!open);
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
return (_jsxs("div", { ref: rootRef, className: popoverRecipe({ className }), children: [triggerEl, open && (_jsx("div", { className: "popover-content", role: "dialog", "aria-label": ariaLabel, "data-align": align, "data-up": up ? "" : undefined, style: pos, onKeyDown: (e) => {
|
|
64
|
+
if (e.key === "Escape") {
|
|
65
|
+
e.preventDefault();
|
|
66
|
+
setOpen(false);
|
|
67
|
+
}
|
|
68
|
+
}, children: children }))] }));
|
|
69
|
+
}
|
|
70
|
+
Popover.displayName = "Popover";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { defineRecipe, resolveRecipe } from "../../core/index.js";
|
|
2
|
+
import { contract as c, elevation as e } from "../../tokens/index.js";
|
|
3
|
+
// A generic anchored popover — the same measured surface as Menu / Select
|
|
4
|
+
// (radius 12, 4px padding, layered soft shadow, inset border), but holding
|
|
5
|
+
// arbitrary content. Rendered inside a display:contents root and lifted out of
|
|
6
|
+
// flow with position:fixed, so its styles survive while it floats.
|
|
7
|
+
const config = defineRecipe({
|
|
8
|
+
name: "popover",
|
|
9
|
+
base: `display: contents; font-family: ${c.font.sans};
|
|
10
|
+
& .popover-content { position: fixed; z-index: 60; box-sizing: border-box; min-width: 200px; max-width: min(360px, 92vw); padding: ${c.space["1"]}; border-radius: ${c.radius.xl}; background: ${c.bgPopover}; color: ${c.fgPrimary}; box-shadow: ${e.floating}; opacity: 1; transform: none; transition: opacity 0.08s ease, transform 0.08s ease; transform-origin: top left; @starting-style { opacity: 0; transform: scale(0.97) translateY(-1px); } }
|
|
11
|
+
& .popover-content[data-align="end"] { transform-origin: top right; }
|
|
12
|
+
& .popover-content[data-up] { transform-origin: bottom left; }`,
|
|
13
|
+
variants: {},
|
|
14
|
+
defaultVariants: {},
|
|
15
|
+
compoundVariants: [],
|
|
16
|
+
});
|
|
17
|
+
export const popoverRecipe = resolveRecipe(config);
|
|
18
|
+
export default config;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { progressRecipe } from "./progress.recipe.js";
|
|
3
|
+
/**
|
|
4
|
+
* A progress bar — a continuous brand fill, or a segmented row of pills when
|
|
5
|
+
* `segments` is set (the "Getting started 3/6" pattern). Reports its state via
|
|
6
|
+
* `role="progressbar"` and the ARIA value attributes.
|
|
7
|
+
*/
|
|
8
|
+
export function Progress({ value, max = 100, segments, "aria-label": ariaLabel, className, ...rest }) {
|
|
9
|
+
const pct = Math.max(0, Math.min(100, (value / max) * 100));
|
|
10
|
+
const aria = {
|
|
11
|
+
role: "progressbar",
|
|
12
|
+
"aria-valuenow": value,
|
|
13
|
+
"aria-valuemin": 0,
|
|
14
|
+
"aria-valuemax": max,
|
|
15
|
+
"aria-label": ariaLabel,
|
|
16
|
+
};
|
|
17
|
+
if (segments && segments > 0) {
|
|
18
|
+
const filled = Math.round((pct / 100) * segments);
|
|
19
|
+
return (_jsx("div", { ...aria, className: progressRecipe({ className }), ...rest, "data-segmented": "", children: Array.from({ length: segments }, (_, i) => (_jsx("span", { className: "progress-seg", "data-filled": i < filled ? "" : undefined }, i))) }));
|
|
20
|
+
}
|
|
21
|
+
return (_jsx("div", { ...aria, className: progressRecipe({ className }), ...rest, children: _jsx("span", { className: "progress-fill", style: { width: `${pct}%` } }) }));
|
|
22
|
+
}
|
|
23
|
+
Progress.displayName = "Progress";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { defineRecipe, resolveRecipe } from "../../core/index.js";
|
|
2
|
+
import { contract as c } from "../../tokens/index.js";
|
|
3
|
+
// A progress indicator — a continuous brand-filled track, or a segmented row of
|
|
4
|
+
// pills (Attio's "Getting started 3/6" bar).
|
|
5
|
+
const config = defineRecipe({
|
|
6
|
+
name: "progress",
|
|
7
|
+
base: `display: block; box-sizing: border-box; height: 6px; border-radius: ${c.radius.full}; background: color-mix(in srgb, ${c.fgPrimary} 8%, transparent); overflow: hidden;
|
|
8
|
+
& .progress-fill { display: block; height: 100%; border-radius: ${c.radius.full}; background: ${c.bgBrandSolid}; transition: width 0.25s ease; }
|
|
9
|
+
&[data-segmented] { display: flex; gap: ${c.space["1"]}; background: transparent; overflow: visible; }
|
|
10
|
+
&[data-segmented] .progress-seg { flex: 1; height: 100%; border-radius: ${c.radius.full}; background: color-mix(in srgb, ${c.fgPrimary} 8%, transparent); transition: background 0.2s; }
|
|
11
|
+
&[data-segmented] .progress-seg[data-filled] { background: ${c.bgBrandSolid}; }`,
|
|
12
|
+
variants: {},
|
|
13
|
+
defaultVariants: {},
|
|
14
|
+
compoundVariants: [],
|
|
15
|
+
});
|
|
16
|
+
export const progressRecipe = resolveRecipe(config);
|
|
17
|
+
export default config;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { radiogroupRecipe } from "./radiogroup.recipe.js";
|
|
4
|
+
const RadioContext = React.createContext(null);
|
|
5
|
+
/**
|
|
6
|
+
* A radio group — measured from Attio's settings. `default` renders rows (a ring
|
|
7
|
+
* that fills brand when selected + a label); `card` renders a row of bordered
|
|
8
|
+
* preview cards whose border turns brand when picked (the Theme picker). Arrow
|
|
9
|
+
* keys move between options (roving focus). Controlled or uncontrolled.
|
|
10
|
+
*/
|
|
11
|
+
export function RadioGroup({ value, defaultValue, onValueChange, variant = "default", name, className, "aria-label": ariaLabel, children, ...rest }) {
|
|
12
|
+
const [internal, setInternal] = React.useState(defaultValue);
|
|
13
|
+
const selected = value ?? internal;
|
|
14
|
+
const generatedName = React.useId();
|
|
15
|
+
const groupName = name ?? generatedName;
|
|
16
|
+
const select = React.useCallback((v) => {
|
|
17
|
+
if (value === undefined)
|
|
18
|
+
setInternal(v);
|
|
19
|
+
onValueChange?.(v);
|
|
20
|
+
}, [value, onValueChange]);
|
|
21
|
+
const onKeyDown = (e) => {
|
|
22
|
+
if (!["ArrowDown", "ArrowRight", "ArrowUp", "ArrowLeft"].includes(e.key))
|
|
23
|
+
return;
|
|
24
|
+
const radios = Array.from(e.currentTarget.querySelectorAll('[role="radio"]:not([disabled])'));
|
|
25
|
+
const idx = radios.indexOf(document.activeElement);
|
|
26
|
+
const fwd = e.key === "ArrowDown" || e.key === "ArrowRight";
|
|
27
|
+
const next = radios[(idx + (fwd ? 1 : -1) + radios.length) % radios.length];
|
|
28
|
+
if (next) {
|
|
29
|
+
e.preventDefault();
|
|
30
|
+
next.focus();
|
|
31
|
+
next.dataset.value && select(next.dataset.value);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
return (_jsx(RadioContext.Provider, { value: { value: selected, select, name: groupName, variant }, children: _jsx("div", { role: "radiogroup", "aria-label": ariaLabel, "data-variant": variant, className: radiogroupRecipe({ className }), ...rest, onKeyDown: onKeyDown, children: children }) }));
|
|
35
|
+
}
|
|
36
|
+
RadioGroup.displayName = "RadioGroup";
|
|
37
|
+
export function Radio({ value, label, children, disabled }) {
|
|
38
|
+
const ctx = React.useContext(RadioContext);
|
|
39
|
+
if (!ctx)
|
|
40
|
+
throw new Error("Radio must be used within a RadioGroup");
|
|
41
|
+
const checked = ctx.value === value;
|
|
42
|
+
return (_jsx("button", { type: "button", role: "radio", "aria-checked": checked, name: ctx.name, disabled: disabled, "data-value": value, "data-checked": checked ? "" : undefined,
|
|
43
|
+
// roving tabindex: the selected (or first, when none) radio is tabbable
|
|
44
|
+
tabIndex: checked ? 0 : -1, className: "radio", onClick: () => ctx.select(value), children: ctx.variant === "card" ? (_jsxs(_Fragment, { children: [_jsx("span", { className: "radio-preview", children: children }), _jsx("span", { className: "radio-cardfoot", children: _jsx("span", { className: "radio-label", children: label }) })] })) : (_jsxs(_Fragment, { children: [_jsx("span", { className: "radio-dot" }), _jsx("span", { className: "radio-label", children: label ?? children })] })) }));
|
|
45
|
+
}
|
|
46
|
+
Radio.displayName = "Radio";
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { defineRecipe, resolveRecipe } from "../../core/index.js";
|
|
2
|
+
import { contract as c } from "../../tokens/index.js";
|
|
3
|
+
// A radio group with two shapes, measured from Attio's settings: the default is
|
|
4
|
+
// a column of rows (a 16px ring that fills brand when selected + a label); the
|
|
5
|
+
// `card` variant is a row of bordered preview cards (radius 16) whose border
|
|
6
|
+
// turns brand (#266df0) when selected — the Appearance "Theme" picker.
|
|
7
|
+
const config = defineRecipe({
|
|
8
|
+
name: "radiogroup",
|
|
9
|
+
base: `
|
|
10
|
+
display: flex; flex-direction: column; gap: ${c.space["1"]}; font-family: ${c.font.sans};
|
|
11
|
+
-webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
|
|
12
|
+
|
|
13
|
+
& .radio { display: flex; align-items: center; gap: ${c.space["2"]}; margin: 0; padding: ${c.space["1"]} ${c.space["1"]}; border: none; background: none; border-radius: ${c.radius.md}; font-family: inherit; font-size: ${c.text.lg}; color: ${c.fgPrimary}; text-align: start; cursor: pointer; }
|
|
14
|
+
& .radio:disabled { opacity: 0.5; cursor: not-allowed; }
|
|
15
|
+
& .radio:focus-visible { outline: none; }
|
|
16
|
+
& .radio-dot { position: relative; flex-shrink: 0; width: 16px; height: 16px; border-radius: ${c.radius.full}; box-shadow: inset 0 0 0 1.5px ${c.borderDefault}; transition: box-shadow .12s ease; }
|
|
17
|
+
& .radio:hover .radio-dot { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, ${c.fgPrimary} 40%, transparent); }
|
|
18
|
+
& .radio[data-checked] .radio-dot { box-shadow: inset 0 0 0 1.5px ${c.bgBrandSolid}; }
|
|
19
|
+
& .radio[data-checked] .radio-dot::after { content: ""; position: absolute; inset: 0; margin: auto; width: 8px; height: 8px; border-radius: ${c.radius.full}; background: ${c.bgBrandSolid}; }
|
|
20
|
+
& .radio:focus-visible .radio-dot { outline: 2px solid ${c.bgBrandSolid}; outline-offset: 2px; }
|
|
21
|
+
& .radio-label { min-width: 0; }
|
|
22
|
+
|
|
23
|
+
&[data-variant="card"] { flex-direction: row; flex-wrap: wrap; gap: ${c.space["3"]}; }
|
|
24
|
+
&[data-variant="card"] .radio { flex: 1 1 150px; min-width: 150px; flex-direction: column; align-items: stretch; gap: 0; padding: 0; border-radius: ${c.radius["2xl"]}; box-shadow: inset 0 0 0 1px ${c.borderDefault}; overflow: hidden; transition: box-shadow .12s ease; }
|
|
25
|
+
&[data-variant="card"] .radio:hover { box-shadow: inset 0 0 0 1px color-mix(in srgb, ${c.fgPrimary} 22%, transparent); }
|
|
26
|
+
&[data-variant="card"] .radio[data-checked] { box-shadow: inset 0 0 0 1px ${c.bgBrandSolid}; }
|
|
27
|
+
&[data-variant="card"] .radio-preview { flex: 1; min-height: 0; background: ${c.bgRaised}; }
|
|
28
|
+
&[data-variant="card"] .radio-cardfoot { display: flex; align-items: center; gap: ${c.space["2"]}; padding: ${c.space["2"]} ${c.space["2.5"]}; border-top: 1px solid ${c.borderSubtle}; font-size: ${c.text.md}; font-weight: ${c.weight.medium}; }
|
|
29
|
+
`,
|
|
30
|
+
variants: {},
|
|
31
|
+
defaultVariants: {},
|
|
32
|
+
compoundVariants: [],
|
|
33
|
+
});
|
|
34
|
+
export const radiogroupRecipe = Object.assign(resolveRecipe(config), {
|
|
35
|
+
config,
|
|
36
|
+
});
|
|
37
|
+
export default config;
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { resizablepanelRecipe } from "./resizablepanel.recipe.js";
|
|
4
|
+
/**
|
|
5
|
+
* Drag delta -> next width, in px, signed by which edge of the panel the
|
|
6
|
+
* handle drags from. A left-side panel's handle sits at its *right* edge, so
|
|
7
|
+
* dragging right (positive dx) grows it; a right-side panel's handle sits at
|
|
8
|
+
* its *left* edge, so dragging right shrinks it. Pure so drag math can be
|
|
9
|
+
* unit-tested without a DOM.
|
|
10
|
+
*/
|
|
11
|
+
export function computeDragWidth(startWidth, startX, clientX, side) {
|
|
12
|
+
const dx = clientX - startX;
|
|
13
|
+
return side === "left" ? startWidth + dx : startWidth - dx;
|
|
14
|
+
}
|
|
15
|
+
/** width (px) -> percentage of the container's width. Pure, unrounded. */
|
|
16
|
+
export function widthToPercent(width, containerWidth) {
|
|
17
|
+
if (!(containerWidth > 0))
|
|
18
|
+
return 0;
|
|
19
|
+
return (width / containerWidth) * 100;
|
|
20
|
+
}
|
|
21
|
+
/** percentage of the container's width -> width (px). Pure, unrounded. */
|
|
22
|
+
export function percentToWidth(percent, containerWidth) {
|
|
23
|
+
return (percent / 100) * containerWidth;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Reads a persisted width percentage, wrapped in try/catch: `localStorage`
|
|
27
|
+
* can throw (private browsing, storage disabled), and a resizable panel
|
|
28
|
+
* failing to *render* over a persistence error would be worse than the
|
|
29
|
+
* panel simply forgetting its width. `storage` defaults to
|
|
30
|
+
* `window.localStorage` and exists as a seam for tests — dropping the
|
|
31
|
+
* try/catch here is the exact failure this must catch.
|
|
32
|
+
*/
|
|
33
|
+
export function readStoredPercent(key, storage = window.localStorage) {
|
|
34
|
+
try {
|
|
35
|
+
const raw = storage.getItem(key);
|
|
36
|
+
if (raw == null)
|
|
37
|
+
return null;
|
|
38
|
+
const n = Number(raw);
|
|
39
|
+
return Number.isFinite(n) ? n : null;
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
// private mode / storage disabled — behave as if nothing is stored
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/** Writes a persisted width percentage, wrapped in try/catch — see {@link readStoredPercent}. */
|
|
47
|
+
export function writeStoredPercent(key, percent, storage = window.localStorage) {
|
|
48
|
+
try {
|
|
49
|
+
storage.setItem(key, String(percent));
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
// private mode / quota exceeded — persistence is best-effort
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Attio's adjustable-panel primitive: a spacer that reserves layout width
|
|
57
|
+
* plus a panel that overlays it, so the panel can move between docked
|
|
58
|
+
* (in-flow) and floating (`position: fixed`, an overlay) without a reflow
|
|
59
|
+
* glitch. Drag the edge handle to resize; constraints are CSS `min-width`/
|
|
60
|
+
* `max-width`, never re-clamped in JS.
|
|
61
|
+
*/
|
|
62
|
+
export function ResizablePanel({ side = "left", size, defaultSize = 280, onSizeChange, min = 200, max, floating = false, handleVariant = "panel", storageKey, className, children, ...rest }) {
|
|
63
|
+
const controlled = size != null;
|
|
64
|
+
const [uncontrolledSize, setUncontrolledSize] = React.useState(defaultSize);
|
|
65
|
+
const width = controlled ? size : uncontrolledSize;
|
|
66
|
+
const containerRef = React.useRef(null);
|
|
67
|
+
const panelRef = React.useRef(null);
|
|
68
|
+
const dragRef = React.useRef(null);
|
|
69
|
+
const [dragging, setDragging] = React.useState(false);
|
|
70
|
+
// Restore a persisted percentage on mount (uncontrolled + storageKey only).
|
|
71
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: restore the persisted width once, on mount only
|
|
72
|
+
React.useEffect(() => {
|
|
73
|
+
if (controlled || !storageKey)
|
|
74
|
+
return;
|
|
75
|
+
const percent = readStoredPercent(storageKey);
|
|
76
|
+
if (percent == null)
|
|
77
|
+
return;
|
|
78
|
+
const containerWidth = containerRef.current?.getBoundingClientRect().width;
|
|
79
|
+
if (!containerWidth)
|
|
80
|
+
return;
|
|
81
|
+
setUncontrolledSize(percentToWidth(percent, containerWidth));
|
|
82
|
+
}, []);
|
|
83
|
+
const commitSize = React.useCallback((next) => {
|
|
84
|
+
if (!controlled)
|
|
85
|
+
setUncontrolledSize(next);
|
|
86
|
+
onSizeChange?.(next);
|
|
87
|
+
if (!controlled && storageKey) {
|
|
88
|
+
const containerWidth = containerRef.current?.getBoundingClientRect().width;
|
|
89
|
+
if (containerWidth) {
|
|
90
|
+
writeStoredPercent(storageKey, widthToPercent(next, containerWidth));
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}, [controlled, onSizeChange, storageKey]);
|
|
94
|
+
function onHandlePointerDown(e) {
|
|
95
|
+
e.preventDefault();
|
|
96
|
+
e.target.setPointerCapture?.(e.pointerId);
|
|
97
|
+
dragRef.current = { startX: e.clientX, startWidth: width, moved: false };
|
|
98
|
+
}
|
|
99
|
+
function onHandlePointerMove(e) {
|
|
100
|
+
const drag = dragRef.current;
|
|
101
|
+
if (!drag)
|
|
102
|
+
return;
|
|
103
|
+
if (!drag.moved) {
|
|
104
|
+
drag.moved = true;
|
|
105
|
+
setDragging(true);
|
|
106
|
+
}
|
|
107
|
+
const next = computeDragWidth(drag.startWidth, drag.startX, e.clientX, side);
|
|
108
|
+
if (!controlled)
|
|
109
|
+
setUncontrolledSize(next);
|
|
110
|
+
onSizeChange?.(next);
|
|
111
|
+
}
|
|
112
|
+
function onHandlePointerUp(e) {
|
|
113
|
+
const drag = dragRef.current;
|
|
114
|
+
dragRef.current = null;
|
|
115
|
+
setDragging(false);
|
|
116
|
+
e.target.releasePointerCapture?.(e.pointerId);
|
|
117
|
+
if (!drag)
|
|
118
|
+
return;
|
|
119
|
+
// Never re-clamp here: read back the panel's actual, CSS-clamped
|
|
120
|
+
// rendered width after layout, and commit *that* value.
|
|
121
|
+
const rect = panelRef.current?.getBoundingClientRect();
|
|
122
|
+
const finalWidth = rect ? Math.round(rect.width) : width;
|
|
123
|
+
commitSize(finalWidth);
|
|
124
|
+
}
|
|
125
|
+
const maxStyle = max == null ? undefined : typeof max === "number" ? `${max}px` : max;
|
|
126
|
+
const panelSizeStyle = {
|
|
127
|
+
width,
|
|
128
|
+
minWidth: min,
|
|
129
|
+
maxWidth: maxStyle,
|
|
130
|
+
};
|
|
131
|
+
return (_jsxs("div", { ref: containerRef, className: resizablepanelRecipe({ className }), ...rest, children: [_jsx("div", { className: "resizablepanel-spacer", style: floating ? { width: 0 } : { width, minWidth: min, maxWidth: maxStyle } }), _jsxs("div", { ref: panelRef, className: "resizablepanel-panel", "data-side": side, "data-floating": floating ? "true" : "false", style: panelSizeStyle, children: [_jsx("div", { className: "resizablepanel-inner", children: children }), _jsx("div", { className: handleVariant === "column"
|
|
132
|
+
? "resizablepanel-handle resizablepanel-handle--column"
|
|
133
|
+
: "resizablepanel-handle", "data-side": side, "data-dragging": dragging ? "true" : undefined, "data-handle": "", onPointerDown: onHandlePointerDown, onPointerMove: onHandlePointerMove, onPointerUp: onHandlePointerUp, children: handleVariant === "column" && (_jsx("span", { className: "resizablepanel-handle-inner", "aria-hidden": "true" })) })] })] }));
|
|
134
|
+
}
|
|
135
|
+
ResizablePanel.displayName = "ResizablePanel";
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { defineRecipe, resolveRecipe } from "../../core/index.js";
|
|
2
|
+
import { contract as c, elevation as e } from "../../tokens/index.js";
|
|
3
|
+
// Attio's adjustable-panel primitive (measured live — see
|
|
4
|
+
// docs/study/attio-panels.md §1-2). Two elements carry the layout: an
|
|
5
|
+
// invisible SPACER that reserves flow width (it alone animates `width`, a
|
|
6
|
+
// cheap reflow of a leaf node) and the PANEL, taken out of flow with
|
|
7
|
+
// `position: absolute` and drawn on top of the spacer. That split is what
|
|
8
|
+
// lets the panel move between docked (in-flow, hairline divider, no
|
|
9
|
+
// elevation) and floating (position: fixed, 8px gutter, r10, the measured
|
|
10
|
+
// tier-1 elevation) without a reflow glitch on the rest of the layout.
|
|
11
|
+
//
|
|
12
|
+
// Per Lesson 27, the floating panel rests at `transform: none` — the
|
|
13
|
+
// measured off-canvas value (`translateX(calc(-100% - space-2))`, identical
|
|
14
|
+
// to Drawer's left-side value) lives in `@starting-style` as the enter
|
|
15
|
+
// transform only, never as a permanent resting position.
|
|
16
|
+
const config = defineRecipe({
|
|
17
|
+
name: "resizablepanel",
|
|
18
|
+
base: `
|
|
19
|
+
position: relative; display: flex; height: 100%;
|
|
20
|
+
& .resizablepanel-spacer { flex: 0 0 auto; height: 100%; transition: width 0.14s; }
|
|
21
|
+
& .resizablepanel-panel { position: absolute; top: 0; bottom: 0; box-sizing: border-box; overflow: hidden; background: ${c.bgSurface}; }
|
|
22
|
+
& .resizablepanel-panel[data-side="left"] { left: 0; }
|
|
23
|
+
& .resizablepanel-panel[data-side="right"] { right: 0; }
|
|
24
|
+
|
|
25
|
+
/* docked */
|
|
26
|
+
& .resizablepanel-panel[data-floating="false"] { border-radius: 0; box-shadow: none; }
|
|
27
|
+
& .resizablepanel-panel[data-floating="false"][data-side="left"] { border-inline-end: 1px solid ${c.borderSubtle}; }
|
|
28
|
+
& .resizablepanel-panel[data-floating="false"][data-side="right"] { border-inline-start: 1px solid ${c.borderSubtle}; }
|
|
29
|
+
|
|
30
|
+
/* floating — position: fixed, 8px gutter, r10, the measured floating elevation.
|
|
31
|
+
Rest is transform: none (Lesson 27); the off-canvas value is the @starting-style enter only. */
|
|
32
|
+
& .resizablepanel-panel[data-floating="true"] { position: fixed; top: ${c.space["2"]}; bottom: ${c.space["2"]}; border-inline-end: none; border-inline-start: none; border-radius: 10px; box-shadow: ${e.floating}; transform: none; transition: transform 0.14s, padding 0.14s; }
|
|
33
|
+
& .resizablepanel-panel[data-floating="true"][data-side="left"] { padding: ${c.space["2"]} 0 ${c.space["2"]} ${c.space["2"]}; @starting-style { transform: translateX(calc(-100% - ${c.space["2"]})); } }
|
|
34
|
+
& .resizablepanel-panel[data-floating="true"][data-side="right"] { padding: ${c.space["2"]} ${c.space["2"]} ${c.space["2"]} 0; @starting-style { transform: translateX(calc(100% + ${c.space["2"]})); } }
|
|
35
|
+
|
|
36
|
+
& .resizablepanel-inner { height: 100%; opacity: 1; }
|
|
37
|
+
& .resizablepanel-panel[data-floating="true"] .resizablepanel-inner { opacity: 1; transition: opacity 0.14s; @starting-style { opacity: 0; } }
|
|
38
|
+
|
|
39
|
+
/* handle — variant "panel" (default): a 10px hit target, its ::before the
|
|
40
|
+
only visible divider (1px rest -> 2px on hover/drag, brand-solid). */
|
|
41
|
+
& .resizablepanel-handle { position: absolute; top: 0; width: 10px; height: 100%; z-index: 2; cursor: col-resize; background: transparent; touch-action: none; }
|
|
42
|
+
& .resizablepanel-handle[data-side="left"] { right: 0; }
|
|
43
|
+
& .resizablepanel-handle[data-side="right"] { left: 0; }
|
|
44
|
+
& .resizablepanel-handle::before { content: ""; position: absolute; top: 0; width: 1px; height: 100%; background: ${c.borderSubtle}; transition: background-color 0.16s, height 0.16s; }
|
|
45
|
+
& .resizablepanel-handle[data-side="left"]::before { right: 0; }
|
|
46
|
+
& .resizablepanel-handle[data-side="right"]::before { left: 0; }
|
|
47
|
+
& .resizablepanel-handle:hover::before, & .resizablepanel-handle[data-dragging="true"]::before { width: 2px; background: ${c.bgBrandSolid}; }
|
|
48
|
+
|
|
49
|
+
/* handle — variant "column": a wider 7px hit target straddling a 1px
|
|
50
|
+
divider (table column edges), with a real 3px inner bar whose opacity
|
|
51
|
+
comes in on a 100ms DELAY — distinct from the panel variant's instant
|
|
52
|
+
::before swap. */
|
|
53
|
+
/* .resizablepanel-handle.resizablepanel-handle--column (both classes) to
|
|
54
|
+
out-specificity the base [data-side] left/right rules above, which
|
|
55
|
+
otherwise tie-break by source order alone and would win. */
|
|
56
|
+
& .resizablepanel-handle.resizablepanel-handle--column { display: flex; align-items: center; justify-content: center; width: 7px; left: -3px; right: -3px; z-index: 1; cursor: col-resize; }
|
|
57
|
+
& .resizablepanel-handle--column::before { content: none; }
|
|
58
|
+
& .resizablepanel-handle-inner { width: 3px; height: 100%; border-radius: 3px; background: ${c.bgBrandSolid}; opacity: 0; transition: opacity 0.1s 0.1s; }
|
|
59
|
+
& .resizablepanel-handle--column:hover .resizablepanel-handle-inner, & .resizablepanel-handle--column[data-dragging="true"] .resizablepanel-handle-inner { opacity: 1; }
|
|
60
|
+
`,
|
|
61
|
+
variants: {},
|
|
62
|
+
defaultVariants: {},
|
|
63
|
+
compoundVariants: [],
|
|
64
|
+
});
|
|
65
|
+
export const resizablepanelRecipe = resolveRecipe(config);
|
|
66
|
+
export default config;
|