@crisp-ui-kit/crisp 0.5.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -0
- package/dist/accordion.css +9 -1
- package/dist/appshell.css +12 -4
- package/dist/authshell.css +57 -0
- package/dist/authshell.d.ts +7 -0
- package/dist/avatargroup.css +2 -2
- package/dist/badge.css +4 -4
- package/dist/barchart.css +13 -5
- package/dist/board.css +9 -1
- package/dist/bulkbar.css +11 -3
- package/dist/button.css +15 -1
- package/dist/button.d.ts +2 -1
- package/dist/card.css +8 -0
- package/dist/checkbox.css +17 -1
- package/dist/cjs/components/accordion/accordion.js +69 -0
- package/dist/cjs/components/accordion/accordion.recipe.js +26 -0
- package/dist/cjs/components/accordion/index.js +7 -0
- package/dist/cjs/components/avatar/avatar.js +44 -0
- package/dist/cjs/components/avatar/avatar.recipe.js +42 -0
- package/dist/cjs/components/avatar/index.js +7 -0
- package/dist/cjs/components/avatargroup/avatargroup.js +52 -0
- package/dist/cjs/components/avatargroup/avatargroup.recipe.js +18 -0
- package/dist/cjs/components/avatargroup/index.js +7 -0
- package/dist/cjs/components/badge/badge.js +44 -0
- package/dist/cjs/components/badge/badge.recipe.js +68 -0
- package/dist/cjs/components/badge/index.js +7 -0
- package/dist/cjs/components/barchart/barchart.js +45 -0
- package/dist/cjs/components/barchart/barchart.recipe.js +34 -0
- package/dist/cjs/components/barchart/index.js +7 -0
- package/dist/cjs/components/breadcrumb/breadcrumb.js +53 -0
- package/dist/cjs/components/breadcrumb/breadcrumb.recipe.js +21 -0
- package/dist/cjs/components/breadcrumb/index.js +7 -0
- package/dist/cjs/components/bulkbar/bulkbar.js +53 -0
- package/dist/cjs/components/bulkbar/bulkbar.recipe.js +31 -0
- package/dist/cjs/components/bulkbar/index.js +8 -0
- package/dist/cjs/components/button/button.js +62 -0
- package/dist/cjs/components/button/button.recipe.js +58 -0
- package/dist/cjs/components/button/index.js +7 -0
- package/dist/cjs/components/callout/callout.js +25 -0
- package/dist/cjs/components/callout/callout.recipe.js +29 -0
- package/dist/cjs/components/callout/index.js +7 -0
- package/dist/cjs/components/card/card.js +54 -0
- package/dist/cjs/components/card/card.recipe.js +31 -0
- package/dist/cjs/components/card/index.js +10 -0
- package/dist/cjs/components/checkbox/checkbox.js +56 -0
- package/dist/cjs/components/checkbox/checkbox.recipe.js +34 -0
- package/dist/cjs/components/checkbox/index.js +7 -0
- package/dist/cjs/components/columncalc/columncalc.js +139 -0
- package/dist/cjs/components/columncalc/columncalc.recipe.js +33 -0
- package/dist/cjs/components/columncalc/index.js +10 -0
- package/dist/cjs/components/contextmenu/contextmenu.js +78 -0
- package/dist/cjs/components/contextmenu/contextmenu.recipe.js +24 -0
- package/dist/cjs/components/contextmenu/index.js +7 -0
- package/dist/cjs/components/datatable/datatable.js +508 -0
- package/dist/cjs/components/datatable/datatable.recipe.js +113 -0
- package/dist/cjs/components/datatable/index.js +7 -0
- package/dist/cjs/components/datepicker/datepicker.js +153 -0
- package/dist/cjs/components/datepicker/datepicker.recipe.js +190 -0
- package/dist/cjs/components/datepicker/index.js +19 -0
- package/dist/cjs/components/datepickerfield/datepickerfield.js +85 -0
- package/dist/cjs/components/datepickerfield/datepickerfield.recipe.js +44 -0
- package/dist/cjs/components/datepickerfield/index.js +7 -0
- package/dist/cjs/components/dialog/dialog.js +86 -0
- package/dist/cjs/components/dialog/dialog.recipe.js +35 -0
- package/dist/cjs/components/dialog/index.js +9 -0
- package/dist/cjs/components/divider/divider.js +10 -0
- package/dist/cjs/components/divider/divider.recipe.js +17 -0
- package/dist/cjs/components/divider/index.js +7 -0
- package/dist/cjs/components/donutchart/donutchart.js +41 -0
- package/dist/cjs/components/donutchart/donutchart.recipe.js +30 -0
- package/dist/cjs/components/donutchart/index.js +7 -0
- package/dist/cjs/components/drawer/drawer.js +80 -0
- package/dist/cjs/components/drawer/drawer.recipe.js +30 -0
- package/dist/cjs/components/drawer/index.js +9 -0
- package/dist/cjs/components/emptystate/emptystate.js +10 -0
- package/dist/cjs/components/emptystate/emptystate.recipe.js +34 -0
- package/dist/cjs/components/emptystate/index.js +7 -0
- package/dist/cjs/components/formfield/formfield.js +50 -0
- package/dist/cjs/components/formfield/formfield.recipe.js +22 -0
- package/dist/cjs/components/formfield/index.js +7 -0
- package/dist/cjs/components/input/index.js +7 -0
- package/dist/cjs/components/input/input.js +47 -0
- package/dist/cjs/components/input/input.recipe.js +59 -0
- package/dist/cjs/components/kbd/index.js +7 -0
- package/dist/cjs/components/kbd/kbd.js +44 -0
- package/dist/cjs/components/kbd/kbd.recipe.js +23 -0
- package/dist/cjs/components/linechart/index.js +7 -0
- package/dist/cjs/components/linechart/linechart.js +57 -0
- package/dist/cjs/components/linechart/linechart.recipe.js +35 -0
- package/dist/cjs/components/menu/index.js +14 -0
- package/dist/cjs/components/menu/menu-keyboard.js +117 -0
- package/dist/cjs/components/menu/menu.js +144 -0
- package/dist/cjs/components/menu/menu.recipe.js +54 -0
- package/dist/cjs/components/multiselect/index.js +7 -0
- package/dist/cjs/components/multiselect/multiselect.js +161 -0
- package/dist/cjs/components/multiselect/multiselect.recipe.js +71 -0
- package/dist/cjs/components/popover/index.js +7 -0
- package/dist/cjs/components/popover/popover.js +106 -0
- package/dist/cjs/components/popover/popover.recipe.js +21 -0
- package/dist/cjs/components/progress/index.js +7 -0
- package/dist/cjs/components/progress/progress.js +26 -0
- package/dist/cjs/components/progress/progress.recipe.js +20 -0
- package/dist/cjs/components/radiogroup/index.js +8 -0
- package/dist/cjs/components/radiogroup/radiogroup.js +83 -0
- package/dist/cjs/components/radiogroup/radiogroup.recipe.js +40 -0
- package/dist/cjs/components/resizablepanel/index.js +12 -0
- package/dist/cjs/components/resizablepanel/resizablepanel.js +176 -0
- package/dist/cjs/components/resizablepanel/resizablepanel.recipe.js +69 -0
- package/dist/cjs/components/segmented/index.js +7 -0
- package/dist/cjs/components/segmented/segmented.js +95 -0
- package/dist/cjs/components/segmented/segmented.recipe.js +23 -0
- package/dist/cjs/components/select/index.js +7 -0
- package/dist/cjs/components/select/select.js +180 -0
- package/dist/cjs/components/select/select.recipe.js +79 -0
- package/dist/cjs/components/skeleton/index.js +7 -0
- package/dist/cjs/components/skeleton/skeleton.js +13 -0
- package/dist/cjs/components/skeleton/skeleton.recipe.js +17 -0
- package/dist/cjs/components/spinner/index.js +7 -0
- package/dist/cjs/components/spinner/spinner.js +15 -0
- package/dist/cjs/components/spinner/spinner.recipe.js +16 -0
- package/dist/cjs/components/stagebar/index.js +7 -0
- package/dist/cjs/components/stagebar/stagebar.js +26 -0
- package/dist/cjs/components/stagebar/stagebar.recipe.js +17 -0
- package/dist/cjs/components/statcard/index.js +7 -0
- package/dist/cjs/components/statcard/statcard.js +15 -0
- package/dist/cjs/components/statcard/statcard.recipe.js +37 -0
- package/dist/cjs/components/switch/index.js +7 -0
- package/dist/cjs/components/switch/switch.js +58 -0
- package/dist/cjs/components/switch/switch.recipe.js +29 -0
- package/dist/cjs/components/table/index.js +14 -0
- package/dist/cjs/components/table/table.js +66 -0
- package/dist/cjs/components/table/table.recipe.js +43 -0
- package/dist/cjs/components/tabletoolbar/index.js +20 -0
- package/dist/cjs/components/tabletoolbar/tabletoolbar.chrome.js +84 -0
- package/dist/cjs/components/tabletoolbar/tabletoolbar.js +237 -0
- package/dist/cjs/components/tabletoolbar/tabletoolbar.recipe.js +26 -0
- package/dist/cjs/components/tabs/index.js +7 -0
- package/dist/cjs/components/tabs/tabs.js +106 -0
- package/dist/cjs/components/tabs/tabs.recipe.js +36 -0
- package/dist/cjs/components/textarea/index.js +7 -0
- package/dist/cjs/components/textarea/textarea.js +56 -0
- package/dist/cjs/components/textarea/textarea.recipe.js +46 -0
- package/dist/cjs/components/toast/index.js +8 -0
- package/dist/cjs/components/toast/toast.js +95 -0
- package/dist/cjs/components/toast/toast.recipe.js +31 -0
- package/dist/cjs/components/tooltip/index.js +7 -0
- package/dist/cjs/components/tooltip/tooltip.js +95 -0
- package/dist/cjs/components/tooltip/tooltip.recipe.js +16 -0
- package/dist/cjs/components/wheelpicker/index.js +7 -0
- package/dist/cjs/components/wheelpicker/wheelpicker.js +134 -0
- package/dist/cjs/components/wheelpicker/wheelpicker.recipe.js +95 -0
- package/dist/cjs/core/cx.js +8 -0
- package/dist/cjs/core/define.js +6 -0
- package/dist/cjs/core/index.js +11 -0
- package/dist/cjs/core/primitive.js +49 -0
- package/dist/cjs/core/resolve.js +44 -0
- package/dist/cjs/core/types.js +2 -0
- package/dist/cjs/index.js +92 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/product/appshell/appshell.js +104 -0
- package/dist/cjs/product/appshell/appshell.recipe.js +30 -0
- package/dist/cjs/product/appshell/index.js +7 -0
- package/dist/cjs/product/authshell/authshell.js +21 -0
- package/dist/cjs/product/authshell/authshell.recipe.js +67 -0
- package/dist/cjs/product/authshell/index.js +7 -0
- package/dist/cjs/product/board/board.js +78 -0
- package/dist/cjs/product/board/board.recipe.js +31 -0
- package/dist/cjs/product/board/index.js +7 -0
- package/dist/cjs/product/command/command.js +238 -0
- package/dist/cjs/product/command/command.recipe.js +47 -0
- package/dist/cjs/product/command/index.js +8 -0
- package/dist/cjs/product/entitycard/entitycard.js +14 -0
- package/dist/cjs/product/entitycard/entitycard.recipe.js +32 -0
- package/dist/cjs/product/entitycard/index.js +7 -0
- package/dist/cjs/product/flowcanvas/flowcanvas.js +121 -0
- package/dist/cjs/product/flowcanvas/flowcanvas.recipe.js +28 -0
- package/dist/cjs/product/flowcanvas/index.js +7 -0
- package/dist/cjs/product/inbox/inbox.js +16 -0
- package/dist/cjs/product/inbox/inbox.recipe.js +46 -0
- package/dist/cjs/product/inbox/index.js +7 -0
- package/dist/cjs/product/listpage/index.js +8 -0
- package/dist/cjs/product/listpage/listpage.js +25 -0
- package/dist/cjs/product/listpage/listpage.recipe.js +46 -0
- package/dist/cjs/product/navitem/index.js +5 -0
- package/dist/cjs/product/navitem/navitem.js +44 -0
- package/dist/cjs/product/navitem/navitem.recipe.js +36 -0
- package/dist/cjs/product/onboarding/index.js +7 -0
- package/dist/cjs/product/onboarding/onboarding.js +17 -0
- package/dist/cjs/product/onboarding/onboarding.recipe.js +44 -0
- package/dist/cjs/product/recordpage/index.js +7 -0
- package/dist/cjs/product/recordpage/recordpage.js +409 -0
- package/dist/cjs/product/recordpage/recordpage.recipe.js +162 -0
- package/dist/cjs/product/recordpanel/index.js +7 -0
- package/dist/cjs/product/recordpanel/recordpanel.js +83 -0
- package/dist/cjs/product/recordpanel/recordpanel.recipe.js +51 -0
- package/dist/cjs/product/recordstable/company-logos.js +29 -0
- package/dist/cjs/product/recordstable/index.js +10 -0
- package/dist/cjs/product/recordstable/recordstable.js +1092 -0
- package/dist/cjs/product/recordstable/recordstable.recipe.js +152 -0
- package/dist/cjs/product/recordstable/recordstable.tag.js +21 -0
- package/dist/cjs/product/richtext/index.js +7 -0
- package/dist/cjs/product/richtext/richtext.js +147 -0
- package/dist/cjs/product/richtext/richtext.recipe.js +43 -0
- package/dist/cjs/product/settingssection/index.js +7 -0
- package/dist/cjs/product/settingssection/settingssection.js +14 -0
- package/dist/cjs/product/settingssection/settingssection.recipe.js +23 -0
- package/dist/cjs/product/settingsshell/index.js +7 -0
- package/dist/cjs/product/settingsshell/settingsshell.js +59 -0
- package/dist/cjs/product/settingsshell/settingsshell.recipe.js +46 -0
- package/dist/cjs/product/sidebar/index.js +13 -0
- package/dist/cjs/product/sidebar/sidebar.js +148 -0
- package/dist/cjs/product/sidebar/sidebar.recipe.js +46 -0
- package/dist/cjs/product/tasklist/index.js +7 -0
- package/dist/cjs/product/tasklist/tasklist.js +19 -0
- package/dist/cjs/product/tasklist/tasklist.recipe.js +38 -0
- package/dist/cjs/product/trialbanner/index.js +7 -0
- package/dist/cjs/product/trialbanner/trialbanner.js +13 -0
- package/dist/cjs/product/trialbanner/trialbanner.recipe.js +32 -0
- package/dist/cjs/product/viewtoggle/index.js +7 -0
- package/dist/cjs/product/viewtoggle/viewtoggle.js +55 -0
- package/dist/cjs/product/viewtoggle/viewtoggle.recipe.js +27 -0
- package/dist/cjs/tokens/contract.js +21 -0
- package/dist/cjs/tokens/elevation.js +47 -0
- package/dist/cjs/tokens/index.js +18 -0
- package/dist/cjs/tokens/palette.js +63 -0
- package/dist/cjs/tokens/scale.js +70 -0
- package/dist/cjs/tokens/semantic.js +57 -0
- package/dist/columncalc.css +26 -0
- package/dist/columncalc.d.ts +7 -0
- package/dist/command.css +34 -1
- package/dist/contextmenu.css +10 -2
- package/dist/datatable.css +60 -14
- package/dist/datepicker.css +175 -19
- package/dist/datepicker.d.ts +2 -2
- package/dist/datepickerfield.css +27 -0
- package/dist/datepickerfield.d.ts +7 -0
- package/dist/dialog.css +10 -2
- package/dist/donutchart.css +8 -0
- package/dist/drawer.css +13 -5
- package/dist/entitycard.css +10 -2
- package/dist/esm/components/accordion/accordion.js +17 -16
- package/dist/esm/components/accordion/accordion.recipe.js +1 -1
- package/dist/esm/components/avatargroup/avatargroup.js +2 -2
- package/dist/esm/components/avatargroup/avatargroup.recipe.js +2 -2
- package/dist/esm/components/badge/badge.recipe.js +4 -4
- package/dist/esm/components/barchart/barchart.js +15 -2
- package/dist/esm/components/barchart/barchart.recipe.js +10 -5
- package/dist/esm/components/breadcrumb/breadcrumb.js +2 -2
- package/dist/esm/components/bulkbar/bulkbar.js +2 -2
- package/dist/esm/components/bulkbar/bulkbar.recipe.js +4 -4
- package/dist/esm/components/button/button.js +13 -2
- package/dist/esm/components/button/button.recipe.js +20 -4
- package/dist/esm/components/callout/callout.js +2 -2
- package/dist/esm/components/checkbox/checkbox.recipe.js +9 -1
- package/dist/esm/components/columncalc/columncalc.js +100 -0
- package/dist/esm/components/columncalc/columncalc.recipe.js +30 -0
- package/dist/esm/components/columncalc/index.js +1 -0
- package/dist/esm/components/contextmenu/contextmenu.recipe.js +4 -4
- package/dist/esm/components/datatable/datatable.js +276 -49
- package/dist/esm/components/datatable/datatable.recipe.js +54 -16
- package/dist/esm/components/datepicker/datepicker.js +104 -53
- package/dist/esm/components/datepicker/datepicker.recipe.js +180 -25
- package/dist/esm/components/datepicker/index.js +1 -1
- package/dist/esm/components/datepickerfield/datepickerfield.js +49 -0
- package/dist/esm/components/datepickerfield/datepickerfield.recipe.js +41 -0
- package/dist/esm/components/datepickerfield/index.js +2 -0
- package/dist/esm/components/dialog/dialog.js +2 -2
- package/dist/esm/components/dialog/dialog.recipe.js +4 -4
- package/dist/esm/components/divider/divider.js +2 -2
- package/dist/esm/components/donutchart/donutchart.js +2 -2
- package/dist/esm/components/drawer/drawer.js +2 -2
- package/dist/esm/components/drawer/drawer.recipe.js +6 -6
- package/dist/esm/components/emptystate/emptystate.js +2 -2
- package/dist/esm/components/formfield/formfield.js +2 -2
- package/dist/esm/components/input/input.js +6 -3
- package/dist/esm/components/input/input.recipe.js +38 -5
- package/dist/esm/components/linechart/linechart.js +15 -2
- package/dist/esm/components/linechart/linechart.recipe.js +10 -5
- package/dist/esm/components/menu/index.js +1 -0
- package/dist/esm/components/menu/menu-keyboard.js +80 -0
- package/dist/esm/components/menu/menu.js +27 -60
- package/dist/esm/components/menu/menu.recipe.js +5 -5
- package/dist/esm/components/multiselect/multiselect.js +10 -3
- package/dist/esm/components/multiselect/multiselect.recipe.js +8 -8
- package/dist/esm/components/popover/popover.js +2 -2
- package/dist/esm/components/popover/popover.recipe.js +2 -2
- package/dist/esm/components/progress/progress.js +3 -3
- package/dist/esm/components/radiogroup/radiogroup.js +2 -2
- package/dist/esm/components/radiogroup/radiogroup.recipe.js +1 -1
- package/dist/esm/components/resizablepanel/index.js +2 -0
- package/dist/esm/components/resizablepanel/resizablepanel.js +135 -0
- package/dist/esm/components/resizablepanel/resizablepanel.recipe.js +66 -0
- package/dist/esm/components/segmented/segmented.js +2 -2
- package/dist/esm/components/select/select.js +2 -2
- package/dist/esm/components/select/select.recipe.js +6 -6
- package/dist/esm/components/skeleton/skeleton.js +5 -2
- package/dist/esm/components/spinner/spinner.js +3 -2
- package/dist/esm/components/stagebar/stagebar.js +2 -2
- package/dist/esm/components/statcard/statcard.js +2 -2
- package/dist/esm/components/table/table.recipe.js +6 -6
- package/dist/esm/components/tabletoolbar/tabletoolbar.chrome.js +3 -3
- package/dist/esm/components/tabletoolbar/tabletoolbar.js +21 -13
- package/dist/esm/components/tabs/tabs.js +2 -2
- package/dist/esm/components/tabs/tabs.recipe.js +4 -4
- package/dist/esm/components/textarea/textarea.js +5 -5
- package/dist/esm/components/textarea/textarea.recipe.js +16 -4
- package/dist/esm/components/toast/toast.js +4 -4
- package/dist/esm/components/toast/toast.recipe.js +2 -2
- package/dist/esm/components/tooltip/tooltip.js +21 -7
- package/dist/esm/components/wheelpicker/index.js +2 -0
- package/dist/esm/components/wheelpicker/wheelpicker.js +98 -0
- package/dist/esm/components/wheelpicker/wheelpicker.recipe.js +92 -0
- package/dist/esm/index.js +5 -0
- package/dist/esm/product/appshell/appshell.js +33 -9
- package/dist/esm/product/appshell/appshell.recipe.js +4 -4
- package/dist/esm/product/authshell/authshell.js +18 -0
- package/dist/esm/product/authshell/authshell.recipe.js +64 -0
- package/dist/esm/product/authshell/index.js +2 -0
- package/dist/esm/product/board/board.js +2 -2
- package/dist/esm/product/board/board.recipe.js +1 -1
- package/dist/esm/product/command/command.js +19 -6
- package/dist/esm/product/command/command.recipe.js +27 -2
- package/dist/esm/product/entitycard/entitycard.js +2 -2
- package/dist/esm/product/entitycard/entitycard.recipe.js +2 -2
- package/dist/esm/product/flowcanvas/flowcanvas.js +4 -4
- package/dist/esm/product/inbox/inbox.recipe.js +1 -1
- package/dist/esm/product/listpage/listpage.recipe.js +3 -3
- package/dist/esm/product/navitem/navitem.recipe.js +13 -1
- package/dist/esm/product/onboarding/onboarding.js +2 -2
- package/dist/esm/product/onboarding/onboarding.recipe.js +2 -2
- package/dist/esm/product/recordpage/recordpage.js +133 -47
- package/dist/esm/product/recordpage/recordpage.recipe.js +19 -17
- package/dist/esm/product/recordpanel/recordpanel.js +4 -4
- package/dist/esm/product/recordpanel/recordpanel.recipe.js +12 -16
- package/dist/esm/product/recordstable/recordstable.js +157 -66
- package/dist/esm/product/recordstable/recordstable.recipe.js +23 -23
- package/dist/esm/product/recordstable/recordstable.tag.js +18 -0
- package/dist/esm/product/richtext/richtext.js +3 -3
- package/dist/esm/product/richtext/richtext.recipe.js +3 -3
- package/dist/esm/product/settingssection/settingssection.js +2 -2
- package/dist/esm/product/settingsshell/settingsshell.js +2 -2
- package/dist/esm/product/settingsshell/settingsshell.recipe.js +7 -2
- package/dist/esm/product/sidebar/sidebar.js +2 -2
- package/dist/esm/product/sidebar/sidebar.recipe.js +27 -2
- package/dist/esm/product/tasklist/tasklist.js +4 -4
- package/dist/esm/product/trialbanner/trialbanner.js +2 -2
- package/dist/esm/product/trialbanner/trialbanner.recipe.js +2 -2
- package/dist/esm/product/viewtoggle/viewtoggle.js +10 -2
- package/dist/esm/product/viewtoggle/viewtoggle.recipe.js +1 -1
- package/dist/esm/tokens/elevation.js +44 -0
- package/dist/esm/tokens/index.js +1 -0
- package/dist/esm/tokens/palette.js +30 -0
- package/dist/esm/tokens/scale.js +7 -0
- package/dist/esm/tokens/semantic.js +24 -0
- package/dist/inbox.css +9 -1
- package/dist/input.css +32 -4
- package/dist/linechart.css +5 -5
- package/dist/listpage.css +11 -3
- package/dist/menu.css +11 -3
- package/dist/multiselect.css +14 -6
- package/dist/native/tokens.d.ts +16 -0
- package/dist/native/tokens.js +221 -0
- package/dist/navitem.css +21 -1
- package/dist/onboarding.css +10 -2
- package/dist/popover.css +8 -0
- package/dist/progress.css +8 -0
- package/dist/radiogroup.css +9 -1
- package/dist/recordpage.css +22 -12
- package/dist/recordpanel.css +25 -15
- package/dist/recordstable.css +37 -23
- package/dist/resizablepanel.css +53 -0
- package/dist/resizablepanel.d.ts +7 -0
- package/dist/richtext.css +11 -3
- package/dist/segmented.css +8 -0
- package/dist/select.css +12 -4
- package/dist/settingsshell.css +15 -2
- package/dist/sidebar.css +34 -1
- package/dist/skeleton.css +8 -0
- package/dist/spinner.css +8 -0
- package/dist/stagebar.css +8 -0
- package/dist/styles.css +2061 -1111
- package/dist/switch.css +8 -0
- package/dist/table.css +14 -6
- package/dist/tabletoolbar.css +8 -0
- package/dist/tabs.css +12 -4
- package/dist/tasklist.css +8 -0
- package/dist/textarea.css +23 -3
- package/dist/toast.css +10 -2
- package/dist/tokens.css +29 -0
- package/dist/tokens.json +217 -0
- package/dist/tooltip.css +8 -0
- package/dist/trialbanner.css +8 -0
- package/dist/types/components/accordion/accordion.d.ts +10 -8
- package/dist/types/components/avatargroup/avatargroup.d.ts +2 -2
- package/dist/types/components/barchart/barchart.d.ts +4 -2
- package/dist/types/components/breadcrumb/breadcrumb.d.ts +2 -2
- package/dist/types/components/bulkbar/bulkbar.d.ts +4 -2
- package/dist/types/components/button/button.d.ts +8 -0
- package/dist/types/components/button/button.recipe.d.ts +12 -0
- package/dist/types/components/callout/callout.d.ts +2 -2
- package/dist/types/components/columncalc/columncalc.d.ts +49 -0
- package/dist/types/components/columncalc/columncalc.recipe.d.ts +3 -0
- package/dist/types/components/columncalc/index.d.ts +1 -0
- package/dist/types/components/datatable/datatable.d.ts +58 -3
- package/dist/types/components/datepicker/datepicker.d.ts +41 -18
- package/dist/types/components/datepicker/datepicker.recipe.d.ts +25 -2
- package/dist/types/components/datepicker/index.d.ts +1 -1
- package/dist/types/components/datepickerfield/datepickerfield.d.ts +35 -0
- package/dist/types/components/datepickerfield/datepickerfield.recipe.d.ts +5 -0
- package/dist/types/components/datepickerfield/index.d.ts +2 -0
- package/dist/types/components/dialog/dialog.d.ts +3 -1
- package/dist/types/components/divider/divider.d.ts +2 -2
- package/dist/types/components/donutchart/donutchart.d.ts +2 -2
- package/dist/types/components/drawer/drawer.d.ts +3 -1
- package/dist/types/components/emptystate/emptystate.d.ts +2 -2
- package/dist/types/components/formfield/formfield.d.ts +7 -4
- package/dist/types/components/input/input.d.ts +8 -2
- package/dist/types/components/linechart/linechart.d.ts +4 -2
- package/dist/types/components/menu/index.d.ts +1 -0
- package/dist/types/components/menu/menu-keyboard.d.ts +33 -0
- package/dist/types/components/menu/menu.d.ts +7 -1
- package/dist/types/components/multiselect/multiselect.d.ts +8 -4
- package/dist/types/components/popover/popover.d.ts +4 -1
- package/dist/types/components/progress/progress.d.ts +2 -2
- package/dist/types/components/radiogroup/radiogroup.d.ts +2 -2
- package/dist/types/components/resizablepanel/index.d.ts +2 -0
- package/dist/types/components/resizablepanel/resizablepanel.d.ts +75 -0
- package/dist/types/components/resizablepanel/resizablepanel.recipe.d.ts +3 -0
- package/dist/types/components/segmented/segmented.d.ts +2 -2
- package/dist/types/components/select/select.d.ts +2 -2
- package/dist/types/components/skeleton/skeleton.d.ts +2 -2
- package/dist/types/components/spinner/spinner.d.ts +2 -2
- package/dist/types/components/stagebar/stagebar.d.ts +2 -2
- package/dist/types/components/statcard/statcard.d.ts +2 -2
- package/dist/types/components/tabletoolbar/tabletoolbar.d.ts +28 -2
- package/dist/types/components/tabs/tabs.d.ts +2 -2
- package/dist/types/components/toast/toast.d.ts +7 -1
- package/dist/types/components/tooltip/tooltip.d.ts +8 -1
- package/dist/types/components/wheelpicker/index.d.ts +2 -0
- package/dist/types/components/wheelpicker/wheelpicker.d.ts +37 -0
- package/dist/types/components/wheelpicker/wheelpicker.recipe.d.ts +26 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/product/appshell/appshell.d.ts +16 -2
- package/dist/types/product/authshell/authshell.d.ts +28 -0
- package/dist/types/product/authshell/authshell.recipe.d.ts +3 -0
- package/dist/types/product/authshell/index.d.ts +2 -0
- package/dist/types/product/board/board.d.ts +2 -2
- package/dist/types/product/command/command.d.ts +25 -1
- package/dist/types/product/entitycard/entitycard.d.ts +2 -2
- package/dist/types/product/flowcanvas/flowcanvas.d.ts +9 -1
- package/dist/types/product/onboarding/onboarding.d.ts +7 -1
- package/dist/types/product/recordpage/recordpage.d.ts +65 -1
- package/dist/types/product/recordpanel/recordpanel.d.ts +8 -2
- package/dist/types/product/recordstable/recordstable.d.ts +90 -1
- package/dist/types/product/recordstable/recordstable.tag.d.ts +10 -0
- package/dist/types/product/richtext/richtext.d.ts +5 -1
- package/dist/types/product/settingssection/settingssection.d.ts +2 -2
- package/dist/types/product/settingsshell/settingsshell.d.ts +6 -2
- package/dist/types/product/sidebar/sidebar.d.ts +8 -0
- package/dist/types/product/tasklist/tasklist.d.ts +5 -1
- package/dist/types/product/trialbanner/trialbanner.d.ts +2 -2
- package/dist/types/product/viewtoggle/viewtoggle.d.ts +11 -5
- package/dist/types/tokens/contract.d.ts +14 -3
- package/dist/types/tokens/elevation.d.ts +44 -0
- package/dist/types/tokens/index.d.ts +1 -0
- package/dist/types/tokens/palette.d.ts +40 -0
- package/dist/types/tokens/scale.d.ts +7 -0
- package/dist/types/tokens/semantic.d.ts +19 -0
- package/dist/viewtoggle.css +9 -1
- package/dist/wheelpicker.css +68 -0
- package/dist/wheelpicker.d.ts +7 -0
- package/package.json +160 -68
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.multiselectRecipe = void 0;
|
|
4
|
+
const core_1 = require("../../core");
|
|
5
|
+
const tokens_1 = require("../../tokens");
|
|
6
|
+
// A multi-select / tag editor — measured from Attio's cell tag picker: an
|
|
7
|
+
// outlined trigger showing the selected values as coloured chips, opening a
|
|
8
|
+
// popover with a search field over rows of "[coloured chip] … [checkbox]" that
|
|
9
|
+
// toggle on click. The popover keeps these nested styles by rendering inside
|
|
10
|
+
// this relative root.
|
|
11
|
+
const config = (0, core_1.defineRecipe)({
|
|
12
|
+
name: "multiselect",
|
|
13
|
+
base: `
|
|
14
|
+
position: relative; display: inline-flex; width: 100%; font-family: ${tokens_1.contract.font.sans};
|
|
15
|
+
-webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
|
|
16
|
+
|
|
17
|
+
& .multiselect-trigger {
|
|
18
|
+
box-sizing: border-box; display: flex; align-items: center; gap: ${tokens_1.contract.space["1"]}; width: 100%; min-width: 0; min-height: ${tokens_1.contract.size.menuRow};
|
|
19
|
+
margin: 0; padding: ${tokens_1.contract.space["0.5"]} ${tokens_1.contract.space["1.5"]} ${tokens_1.contract.space["0.5"]} ${tokens_1.contract.space["2"]};
|
|
20
|
+
border: none; border-radius: ${tokens_1.contract.radius.md}; background: transparent; box-shadow: inset 0 0 0 1px color-mix(in srgb, ${tokens_1.contract.fgPrimary} 7%, transparent);
|
|
21
|
+
font-family: inherit; font-size: ${tokens_1.contract.text.lg}; color: ${tokens_1.contract.fgPrimary}; cursor: pointer; text-align: start;
|
|
22
|
+
transition: background-color .12s ease, box-shadow .12s ease;
|
|
23
|
+
}
|
|
24
|
+
& .multiselect-trigger:hover { background: ${tokens_1.contract.bgRaised}; }
|
|
25
|
+
& .multiselect-trigger[data-open], & .multiselect-trigger:focus-visible { outline: none; box-shadow: inset 0 0 0 1px ${tokens_1.contract.bgBrandSolid}; background: ${tokens_1.contract.bgSurface}; }
|
|
26
|
+
& .multiselect-trigger:disabled { opacity: 0.5; cursor: not-allowed; }
|
|
27
|
+
& .multiselect-chips { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: ${tokens_1.contract.space["1"]}; }
|
|
28
|
+
& .multiselect-placeholder { color: ${tokens_1.contract.fgMuted}; }
|
|
29
|
+
& .multiselect-chevron { flex-shrink: 0; color: ${tokens_1.contract.fgMuted}; transition: transform .15s ease; }
|
|
30
|
+
& .multiselect-trigger[data-open] .multiselect-chevron { transform: rotate(180deg); }
|
|
31
|
+
|
|
32
|
+
& .multiselect-listbox {
|
|
33
|
+
position: fixed; z-index: 60; box-sizing: border-box; display: flex; flex-direction: column; gap: ${tokens_1.contract.space.px};
|
|
34
|
+
max-height: 300px; overflow-y: auto; padding: ${tokens_1.contract.space["1"]};
|
|
35
|
+
border-radius: ${tokens_1.contract.radius.xl}; background: ${tokens_1.contract.bgPopover};
|
|
36
|
+
box-shadow: ${tokens_1.elevation.floating};
|
|
37
|
+
transform-origin: top left; opacity: 1; transform: none; transition: opacity .08s ease, transform .08s ease;
|
|
38
|
+
}
|
|
39
|
+
& .multiselect-listbox[data-up] { transform-origin: bottom left; }
|
|
40
|
+
& .multiselect-listbox { @starting-style { opacity: 0; transform: scale(0.97) translateY(-1px); } }
|
|
41
|
+
& .multiselect-search { display: flex; align-items: center; gap: ${tokens_1.contract.space["2"]}; height: 34px; flex-shrink: 0; margin: calc(-1 * ${tokens_1.contract.space["1"]}) calc(-1 * ${tokens_1.contract.space["1"]}) ${tokens_1.contract.space["1"]}; padding: 0 ${tokens_1.contract.space["2.5"]}; border-bottom: 1px solid ${tokens_1.contract.borderSubtle}; color: ${tokens_1.contract.fgMuted}; }
|
|
42
|
+
& .multiselect-search svg { flex-shrink: 0; }
|
|
43
|
+
& .multiselect-search input { flex: 1; min-width: 0; border: none; outline: none; background: none; font-family: inherit; font-size: ${tokens_1.contract.text.lg}; color: ${tokens_1.contract.fgPrimary}; }
|
|
44
|
+
& .multiselect-search input::placeholder { color: ${tokens_1.contract.fgMuted}; }
|
|
45
|
+
& .multiselect-option {
|
|
46
|
+
box-sizing: border-box; display: flex; align-items: center; gap: ${tokens_1.contract.space["2"]}; height: ${tokens_1.contract.size.menuRow}; flex-shrink: 0;
|
|
47
|
+
padding: 0 ${tokens_1.contract.space["2"]}; margin: 0; border: none; background: none; border-radius: ${tokens_1.contract.radius.md}; font-family: inherit; cursor: pointer; text-align: start;
|
|
48
|
+
}
|
|
49
|
+
& .multiselect-option[data-highlighted] { background: ${tokens_1.contract.bgRaised}; }
|
|
50
|
+
& .multiselect-option-chip { flex: 0 1 auto; min-width: 0; overflow: hidden; }
|
|
51
|
+
& .multiselect-check { flex-shrink: 0; margin-inline-start: auto; display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; border-radius: ${tokens_1.contract.radius.sm}; box-shadow: inset 0 0 0 1.5px ${tokens_1.contract.borderDefault}; color: transparent; }
|
|
52
|
+
& .multiselect-option[aria-selected="true"] .multiselect-check { background: ${tokens_1.contract.bgBrandSolid}; box-shadow: none; color: #fff; }
|
|
53
|
+
& .multiselect-empty { padding: ${tokens_1.contract.space["3"]} ${tokens_1.contract.space["2"]}; text-align: center; font-size: ${tokens_1.contract.text.md}; color: ${tokens_1.contract.fgMuted}; }
|
|
54
|
+
|
|
55
|
+
& .recordstable-tag { display: inline-flex; align-items: center; height: ${tokens_1.contract.size.chip}; padding: 0 ${tokens_1.contract.space["1"]}; border-radius: ${tokens_1.contract.radius.chip}; font-size: ${tokens_1.contract.text.lg}; line-height: 20px; font-weight: ${tokens_1.contract.weight.medium}; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: color-mix(in srgb, ${tokens_1.contract.fgPrimary} 6%, transparent); color: color-mix(in srgb, ${tokens_1.contract.fgPrimary} 82%, transparent); }
|
|
56
|
+
& .recordstable-tag[data-tone="brand"] { background: color-mix(in srgb, ${tokens_1.contract.bgBrandSolid} 14%, transparent); color: color-mix(in srgb, ${tokens_1.contract.bgBrandSolid} 82%, ${tokens_1.contract.fgPrimary}); }
|
|
57
|
+
& .recordstable-tag[data-tone="success"] { background: color-mix(in srgb, ${tokens_1.contract.bgSuccess} 16%, transparent); color: color-mix(in srgb, ${tokens_1.contract.bgSuccess} 78%, ${tokens_1.contract.fgPrimary}); }
|
|
58
|
+
& .recordstable-tag[data-tone="warning"] { background: color-mix(in srgb, ${tokens_1.contract.bgWarning} 18%, transparent); color: color-mix(in srgb, ${tokens_1.contract.bgWarning} 82%, ${tokens_1.contract.fgPrimary}); }
|
|
59
|
+
& .recordstable-tag[data-tone="danger"] { background: color-mix(in srgb, ${tokens_1.contract.bgDanger} 15%, transparent); color: color-mix(in srgb, ${tokens_1.contract.bgDanger} 80%, ${tokens_1.contract.fgPrimary}); }
|
|
60
|
+
& .recordstable-tag[data-tone="purple"] { background: color-mix(in srgb, ${tokens_1.contract.bgPurple} 16%, transparent); color: color-mix(in srgb, ${tokens_1.contract.bgPurple} 80%, ${tokens_1.contract.fgPrimary}); }
|
|
61
|
+
& .recordstable-tag[data-tone="cyan"] { background: color-mix(in srgb, ${tokens_1.contract.bgCyan} 18%, transparent); color: color-mix(in srgb, ${tokens_1.contract.bgCyan} 82%, ${tokens_1.contract.fgPrimary}); }
|
|
62
|
+
& .recordstable-tag[data-tone="orange"] { background: color-mix(in srgb, ${tokens_1.contract.bgOrange} 16%, transparent); color: color-mix(in srgb, ${tokens_1.contract.bgOrange} 82%, ${tokens_1.contract.fgPrimary}); }
|
|
63
|
+
`,
|
|
64
|
+
variants: {},
|
|
65
|
+
defaultVariants: {},
|
|
66
|
+
compoundVariants: [],
|
|
67
|
+
});
|
|
68
|
+
exports.multiselectRecipe = Object.assign((0, core_1.resolveRecipe)(config), {
|
|
69
|
+
config,
|
|
70
|
+
});
|
|
71
|
+
exports.default = config;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.popoverRecipe = exports.Popover = void 0;
|
|
4
|
+
var popover_1 = require("./popover");
|
|
5
|
+
Object.defineProperty(exports, "Popover", { enumerable: true, get: function () { return popover_1.Popover; } });
|
|
6
|
+
var popover_recipe_1 = require("./popover.recipe");
|
|
7
|
+
Object.defineProperty(exports, "popoverRecipe", { enumerable: true, get: function () { return popover_recipe_1.popoverRecipe; } });
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.Popover = Popover;
|
|
37
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
38
|
+
const React = __importStar(require("react"));
|
|
39
|
+
const popover_recipe_1 = require("./popover.recipe");
|
|
40
|
+
/**
|
|
41
|
+
* A generic anchored popover — the Menu/Select surface holding arbitrary
|
|
42
|
+
* content. Opens below the trigger (flipping up when there's no room),
|
|
43
|
+
* closes on outside pointer-down and Escape. Controlled or self-managed.
|
|
44
|
+
*/
|
|
45
|
+
function Popover({ trigger, children, align = "start", open: openProp, defaultOpen, onOpenChange, "aria-label": ariaLabel, className, }) {
|
|
46
|
+
const [internalOpen, setInternalOpen] = React.useState(defaultOpen ?? false);
|
|
47
|
+
const open = openProp ?? internalOpen;
|
|
48
|
+
const rootRef = React.useRef(null);
|
|
49
|
+
const triggerRef = React.useRef(null);
|
|
50
|
+
const [pos, setPos] = React.useState({});
|
|
51
|
+
const [up, setUp] = React.useState(false);
|
|
52
|
+
const setOpen = React.useCallback((next) => {
|
|
53
|
+
if (openProp === undefined)
|
|
54
|
+
setInternalOpen(next);
|
|
55
|
+
onOpenChange?.(next);
|
|
56
|
+
}, [openProp, onOpenChange]);
|
|
57
|
+
const place = () => {
|
|
58
|
+
const el = triggerRef.current;
|
|
59
|
+
if (!el)
|
|
60
|
+
return;
|
|
61
|
+
const rect = el.getBoundingClientRect();
|
|
62
|
+
const gap = 6;
|
|
63
|
+
const flipUp = window.innerHeight - rect.bottom < 280;
|
|
64
|
+
const style = flipUp
|
|
65
|
+
? { bottom: window.innerHeight - rect.top + gap }
|
|
66
|
+
: { top: rect.bottom + gap };
|
|
67
|
+
if (align === "end")
|
|
68
|
+
style.right = window.innerWidth - rect.right;
|
|
69
|
+
else
|
|
70
|
+
style.left = rect.left;
|
|
71
|
+
setUp(flipUp);
|
|
72
|
+
setPos(style);
|
|
73
|
+
};
|
|
74
|
+
// Position when opening (before paint so it never flashes at 0,0).
|
|
75
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: reposition each time it opens
|
|
76
|
+
React.useLayoutEffect(() => {
|
|
77
|
+
if (open)
|
|
78
|
+
place();
|
|
79
|
+
}, [open]);
|
|
80
|
+
React.useEffect(() => {
|
|
81
|
+
if (!open)
|
|
82
|
+
return;
|
|
83
|
+
const onDown = (e) => {
|
|
84
|
+
if (!rootRef.current?.contains(e.target))
|
|
85
|
+
setOpen(false);
|
|
86
|
+
};
|
|
87
|
+
document.addEventListener("pointerdown", onDown);
|
|
88
|
+
return () => document.removeEventListener("pointerdown", onDown);
|
|
89
|
+
}, [open, setOpen]);
|
|
90
|
+
const triggerEl = React.cloneElement(trigger, {
|
|
91
|
+
ref: triggerRef,
|
|
92
|
+
"aria-haspopup": "dialog",
|
|
93
|
+
"aria-expanded": open,
|
|
94
|
+
onClick: (e) => {
|
|
95
|
+
trigger.props.onClick?.(e);
|
|
96
|
+
setOpen(!open);
|
|
97
|
+
},
|
|
98
|
+
});
|
|
99
|
+
return ((0, jsx_runtime_1.jsxs)("div", { ref: rootRef, className: (0, popover_recipe_1.popoverRecipe)({ className }), children: [triggerEl, open && ((0, jsx_runtime_1.jsx)("div", { className: "popover-content", role: "dialog", "aria-label": ariaLabel, "data-align": align, "data-up": up ? "" : undefined, style: pos, onKeyDown: (e) => {
|
|
100
|
+
if (e.key === "Escape") {
|
|
101
|
+
e.preventDefault();
|
|
102
|
+
setOpen(false);
|
|
103
|
+
}
|
|
104
|
+
}, children: children }))] }));
|
|
105
|
+
}
|
|
106
|
+
Popover.displayName = "Popover";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.popoverRecipe = void 0;
|
|
4
|
+
const core_1 = require("../../core");
|
|
5
|
+
const tokens_1 = require("../../tokens");
|
|
6
|
+
// A generic anchored popover — the same measured surface as Menu / Select
|
|
7
|
+
// (radius 12, 4px padding, layered soft shadow, inset border), but holding
|
|
8
|
+
// arbitrary content. Rendered inside a display:contents root and lifted out of
|
|
9
|
+
// flow with position:fixed, so its styles survive while it floats.
|
|
10
|
+
const config = (0, core_1.defineRecipe)({
|
|
11
|
+
name: "popover",
|
|
12
|
+
base: `display: contents; font-family: ${tokens_1.contract.font.sans};
|
|
13
|
+
& .popover-content { position: fixed; z-index: 60; box-sizing: border-box; min-width: 200px; max-width: min(360px, 92vw); padding: ${tokens_1.contract.space["1"]}; border-radius: ${tokens_1.contract.radius.xl}; background: ${tokens_1.contract.bgPopover}; color: ${tokens_1.contract.fgPrimary}; box-shadow: ${tokens_1.elevation.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); } }
|
|
14
|
+
& .popover-content[data-align="end"] { transform-origin: top right; }
|
|
15
|
+
& .popover-content[data-up] { transform-origin: bottom left; }`,
|
|
16
|
+
variants: {},
|
|
17
|
+
defaultVariants: {},
|
|
18
|
+
compoundVariants: [],
|
|
19
|
+
});
|
|
20
|
+
exports.popoverRecipe = (0, core_1.resolveRecipe)(config);
|
|
21
|
+
exports.default = config;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.progressRecipe = exports.Progress = void 0;
|
|
4
|
+
var progress_1 = require("./progress");
|
|
5
|
+
Object.defineProperty(exports, "Progress", { enumerable: true, get: function () { return progress_1.Progress; } });
|
|
6
|
+
var progress_recipe_1 = require("./progress.recipe");
|
|
7
|
+
Object.defineProperty(exports, "progressRecipe", { enumerable: true, get: function () { return progress_recipe_1.progressRecipe; } });
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Progress = Progress;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const progress_recipe_1 = require("./progress.recipe");
|
|
6
|
+
/**
|
|
7
|
+
* A progress bar — a continuous brand fill, or a segmented row of pills when
|
|
8
|
+
* `segments` is set (the "Getting started 3/6" pattern). Reports its state via
|
|
9
|
+
* `role="progressbar"` and the ARIA value attributes.
|
|
10
|
+
*/
|
|
11
|
+
function Progress({ value, max = 100, segments, "aria-label": ariaLabel, className, ...rest }) {
|
|
12
|
+
const pct = Math.max(0, Math.min(100, (value / max) * 100));
|
|
13
|
+
const aria = {
|
|
14
|
+
role: "progressbar",
|
|
15
|
+
"aria-valuenow": value,
|
|
16
|
+
"aria-valuemin": 0,
|
|
17
|
+
"aria-valuemax": max,
|
|
18
|
+
"aria-label": ariaLabel,
|
|
19
|
+
};
|
|
20
|
+
if (segments && segments > 0) {
|
|
21
|
+
const filled = Math.round((pct / 100) * segments);
|
|
22
|
+
return ((0, jsx_runtime_1.jsx)("div", { ...aria, className: (0, progress_recipe_1.progressRecipe)({ className }), ...rest, "data-segmented": "", children: Array.from({ length: segments }, (_, i) => ((0, jsx_runtime_1.jsx)("span", { className: "progress-seg", "data-filled": i < filled ? "" : undefined }, i))) }));
|
|
23
|
+
}
|
|
24
|
+
return ((0, jsx_runtime_1.jsx)("div", { ...aria, className: (0, progress_recipe_1.progressRecipe)({ className }), ...rest, children: (0, jsx_runtime_1.jsx)("span", { className: "progress-fill", style: { width: `${pct}%` } }) }));
|
|
25
|
+
}
|
|
26
|
+
Progress.displayName = "Progress";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.progressRecipe = void 0;
|
|
4
|
+
const core_1 = require("../../core");
|
|
5
|
+
const tokens_1 = require("../../tokens");
|
|
6
|
+
// A progress indicator — a continuous brand-filled track, or a segmented row of
|
|
7
|
+
// pills (Attio's "Getting started 3/6" bar).
|
|
8
|
+
const config = (0, core_1.defineRecipe)({
|
|
9
|
+
name: "progress",
|
|
10
|
+
base: `display: block; box-sizing: border-box; height: 6px; border-radius: ${tokens_1.contract.radius.full}; background: color-mix(in srgb, ${tokens_1.contract.fgPrimary} 8%, transparent); overflow: hidden;
|
|
11
|
+
& .progress-fill { display: block; height: 100%; border-radius: ${tokens_1.contract.radius.full}; background: ${tokens_1.contract.bgBrandSolid}; transition: width 0.25s ease; }
|
|
12
|
+
&[data-segmented] { display: flex; gap: ${tokens_1.contract.space["1"]}; background: transparent; overflow: visible; }
|
|
13
|
+
&[data-segmented] .progress-seg { flex: 1; height: 100%; border-radius: ${tokens_1.contract.radius.full}; background: color-mix(in srgb, ${tokens_1.contract.fgPrimary} 8%, transparent); transition: background 0.2s; }
|
|
14
|
+
&[data-segmented] .progress-seg[data-filled] { background: ${tokens_1.contract.bgBrandSolid}; }`,
|
|
15
|
+
variants: {},
|
|
16
|
+
defaultVariants: {},
|
|
17
|
+
compoundVariants: [],
|
|
18
|
+
});
|
|
19
|
+
exports.progressRecipe = (0, core_1.resolveRecipe)(config);
|
|
20
|
+
exports.default = config;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.radiogroupRecipe = exports.RadioGroup = exports.Radio = void 0;
|
|
4
|
+
var radiogroup_1 = require("./radiogroup");
|
|
5
|
+
Object.defineProperty(exports, "Radio", { enumerable: true, get: function () { return radiogroup_1.Radio; } });
|
|
6
|
+
Object.defineProperty(exports, "RadioGroup", { enumerable: true, get: function () { return radiogroup_1.RadioGroup; } });
|
|
7
|
+
var radiogroup_recipe_1 = require("./radiogroup.recipe");
|
|
8
|
+
Object.defineProperty(exports, "radiogroupRecipe", { enumerable: true, get: function () { return radiogroup_recipe_1.radiogroupRecipe; } });
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.RadioGroup = RadioGroup;
|
|
37
|
+
exports.Radio = Radio;
|
|
38
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
39
|
+
const React = __importStar(require("react"));
|
|
40
|
+
const radiogroup_recipe_1 = require("./radiogroup.recipe");
|
|
41
|
+
const RadioContext = React.createContext(null);
|
|
42
|
+
/**
|
|
43
|
+
* A radio group — measured from Attio's settings. `default` renders rows (a ring
|
|
44
|
+
* that fills brand when selected + a label); `card` renders a row of bordered
|
|
45
|
+
* preview cards whose border turns brand when picked (the Theme picker). Arrow
|
|
46
|
+
* keys move between options (roving focus). Controlled or uncontrolled.
|
|
47
|
+
*/
|
|
48
|
+
function RadioGroup({ value, defaultValue, onValueChange, variant = "default", name, className, "aria-label": ariaLabel, children, ...rest }) {
|
|
49
|
+
const [internal, setInternal] = React.useState(defaultValue);
|
|
50
|
+
const selected = value ?? internal;
|
|
51
|
+
const generatedName = React.useId();
|
|
52
|
+
const groupName = name ?? generatedName;
|
|
53
|
+
const select = React.useCallback((v) => {
|
|
54
|
+
if (value === undefined)
|
|
55
|
+
setInternal(v);
|
|
56
|
+
onValueChange?.(v);
|
|
57
|
+
}, [value, onValueChange]);
|
|
58
|
+
const onKeyDown = (e) => {
|
|
59
|
+
if (!["ArrowDown", "ArrowRight", "ArrowUp", "ArrowLeft"].includes(e.key))
|
|
60
|
+
return;
|
|
61
|
+
const radios = Array.from(e.currentTarget.querySelectorAll('[role="radio"]:not([disabled])'));
|
|
62
|
+
const idx = radios.indexOf(document.activeElement);
|
|
63
|
+
const fwd = e.key === "ArrowDown" || e.key === "ArrowRight";
|
|
64
|
+
const next = radios[(idx + (fwd ? 1 : -1) + radios.length) % radios.length];
|
|
65
|
+
if (next) {
|
|
66
|
+
e.preventDefault();
|
|
67
|
+
next.focus();
|
|
68
|
+
next.dataset.value && select(next.dataset.value);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
return ((0, jsx_runtime_1.jsx)(RadioContext.Provider, { value: { value: selected, select, name: groupName, variant }, children: (0, jsx_runtime_1.jsx)("div", { role: "radiogroup", "aria-label": ariaLabel, "data-variant": variant, className: (0, radiogroup_recipe_1.radiogroupRecipe)({ className }), ...rest, onKeyDown: onKeyDown, children: children }) }));
|
|
72
|
+
}
|
|
73
|
+
RadioGroup.displayName = "RadioGroup";
|
|
74
|
+
function Radio({ value, label, children, disabled }) {
|
|
75
|
+
const ctx = React.useContext(RadioContext);
|
|
76
|
+
if (!ctx)
|
|
77
|
+
throw new Error("Radio must be used within a RadioGroup");
|
|
78
|
+
const checked = ctx.value === value;
|
|
79
|
+
return ((0, jsx_runtime_1.jsx)("button", { type: "button", role: "radio", "aria-checked": checked, name: ctx.name, disabled: disabled, "data-value": value, "data-checked": checked ? "" : undefined,
|
|
80
|
+
// roving tabindex: the selected (or first, when none) radio is tabbable
|
|
81
|
+
tabIndex: checked ? 0 : -1, className: "radio", onClick: () => ctx.select(value), children: ctx.variant === "card" ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("span", { className: "radio-preview", children: children }), (0, jsx_runtime_1.jsx)("span", { className: "radio-cardfoot", children: (0, jsx_runtime_1.jsx)("span", { className: "radio-label", children: label }) })] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("span", { className: "radio-dot" }), (0, jsx_runtime_1.jsx)("span", { className: "radio-label", children: label ?? children })] })) }));
|
|
82
|
+
}
|
|
83
|
+
Radio.displayName = "Radio";
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.radiogroupRecipe = void 0;
|
|
4
|
+
const core_1 = require("../../core");
|
|
5
|
+
const tokens_1 = require("../../tokens");
|
|
6
|
+
// A radio group with two shapes, measured from Attio's settings: the default is
|
|
7
|
+
// a column of rows (a 16px ring that fills brand when selected + a label); the
|
|
8
|
+
// `card` variant is a row of bordered preview cards (radius 16) whose border
|
|
9
|
+
// turns brand (#266df0) when selected — the Appearance "Theme" picker.
|
|
10
|
+
const config = (0, core_1.defineRecipe)({
|
|
11
|
+
name: "radiogroup",
|
|
12
|
+
base: `
|
|
13
|
+
display: flex; flex-direction: column; gap: ${tokens_1.contract.space["1"]}; font-family: ${tokens_1.contract.font.sans};
|
|
14
|
+
-webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
|
|
15
|
+
|
|
16
|
+
& .radio { display: flex; align-items: center; gap: ${tokens_1.contract.space["2"]}; margin: 0; padding: ${tokens_1.contract.space["1"]} ${tokens_1.contract.space["1"]}; border: none; background: none; border-radius: ${tokens_1.contract.radius.md}; font-family: inherit; font-size: ${tokens_1.contract.text.lg}; color: ${tokens_1.contract.fgPrimary}; text-align: start; cursor: pointer; }
|
|
17
|
+
& .radio:disabled { opacity: 0.5; cursor: not-allowed; }
|
|
18
|
+
& .radio:focus-visible { outline: none; }
|
|
19
|
+
& .radio-dot { position: relative; flex-shrink: 0; width: 16px; height: 16px; border-radius: ${tokens_1.contract.radius.full}; box-shadow: inset 0 0 0 1.5px ${tokens_1.contract.borderDefault}; transition: box-shadow .12s ease; }
|
|
20
|
+
& .radio:hover .radio-dot { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, ${tokens_1.contract.fgPrimary} 40%, transparent); }
|
|
21
|
+
& .radio[data-checked] .radio-dot { box-shadow: inset 0 0 0 1.5px ${tokens_1.contract.bgBrandSolid}; }
|
|
22
|
+
& .radio[data-checked] .radio-dot::after { content: ""; position: absolute; inset: 0; margin: auto; width: 8px; height: 8px; border-radius: ${tokens_1.contract.radius.full}; background: ${tokens_1.contract.bgBrandSolid}; }
|
|
23
|
+
& .radio:focus-visible .radio-dot { outline: 2px solid ${tokens_1.contract.bgBrandSolid}; outline-offset: 2px; }
|
|
24
|
+
& .radio-label { min-width: 0; }
|
|
25
|
+
|
|
26
|
+
&[data-variant="card"] { flex-direction: row; flex-wrap: wrap; gap: ${tokens_1.contract.space["3"]}; }
|
|
27
|
+
&[data-variant="card"] .radio { flex: 1 1 150px; min-width: 150px; flex-direction: column; align-items: stretch; gap: 0; padding: 0; border-radius: ${tokens_1.contract.radius["2xl"]}; box-shadow: inset 0 0 0 1px ${tokens_1.contract.borderDefault}; overflow: hidden; transition: box-shadow .12s ease; }
|
|
28
|
+
&[data-variant="card"] .radio:hover { box-shadow: inset 0 0 0 1px color-mix(in srgb, ${tokens_1.contract.fgPrimary} 22%, transparent); }
|
|
29
|
+
&[data-variant="card"] .radio[data-checked] { box-shadow: inset 0 0 0 1px ${tokens_1.contract.bgBrandSolid}; }
|
|
30
|
+
&[data-variant="card"] .radio-preview { flex: 1; min-height: 0; background: ${tokens_1.contract.bgRaised}; }
|
|
31
|
+
&[data-variant="card"] .radio-cardfoot { display: flex; align-items: center; gap: ${tokens_1.contract.space["2"]}; padding: ${tokens_1.contract.space["2"]} ${tokens_1.contract.space["2.5"]}; border-top: 1px solid ${tokens_1.contract.borderSubtle}; font-size: ${tokens_1.contract.text.md}; font-weight: ${tokens_1.contract.weight.medium}; }
|
|
32
|
+
`,
|
|
33
|
+
variants: {},
|
|
34
|
+
defaultVariants: {},
|
|
35
|
+
compoundVariants: [],
|
|
36
|
+
});
|
|
37
|
+
exports.radiogroupRecipe = Object.assign((0, core_1.resolveRecipe)(config), {
|
|
38
|
+
config,
|
|
39
|
+
});
|
|
40
|
+
exports.default = config;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resizablepanelRecipe = exports.writeStoredPercent = exports.widthToPercent = exports.readStoredPercent = exports.ResizablePanel = exports.percentToWidth = exports.computeDragWidth = void 0;
|
|
4
|
+
var resizablepanel_1 = require("./resizablepanel");
|
|
5
|
+
Object.defineProperty(exports, "computeDragWidth", { enumerable: true, get: function () { return resizablepanel_1.computeDragWidth; } });
|
|
6
|
+
Object.defineProperty(exports, "percentToWidth", { enumerable: true, get: function () { return resizablepanel_1.percentToWidth; } });
|
|
7
|
+
Object.defineProperty(exports, "ResizablePanel", { enumerable: true, get: function () { return resizablepanel_1.ResizablePanel; } });
|
|
8
|
+
Object.defineProperty(exports, "readStoredPercent", { enumerable: true, get: function () { return resizablepanel_1.readStoredPercent; } });
|
|
9
|
+
Object.defineProperty(exports, "widthToPercent", { enumerable: true, get: function () { return resizablepanel_1.widthToPercent; } });
|
|
10
|
+
Object.defineProperty(exports, "writeStoredPercent", { enumerable: true, get: function () { return resizablepanel_1.writeStoredPercent; } });
|
|
11
|
+
var resizablepanel_recipe_1 = require("./resizablepanel.recipe");
|
|
12
|
+
Object.defineProperty(exports, "resizablepanelRecipe", { enumerable: true, get: function () { return resizablepanel_recipe_1.resizablepanelRecipe; } });
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.computeDragWidth = computeDragWidth;
|
|
37
|
+
exports.widthToPercent = widthToPercent;
|
|
38
|
+
exports.percentToWidth = percentToWidth;
|
|
39
|
+
exports.readStoredPercent = readStoredPercent;
|
|
40
|
+
exports.writeStoredPercent = writeStoredPercent;
|
|
41
|
+
exports.ResizablePanel = ResizablePanel;
|
|
42
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
43
|
+
const React = __importStar(require("react"));
|
|
44
|
+
const resizablepanel_recipe_1 = require("./resizablepanel.recipe");
|
|
45
|
+
/**
|
|
46
|
+
* Drag delta -> next width, in px, signed by which edge of the panel the
|
|
47
|
+
* handle drags from. A left-side panel's handle sits at its *right* edge, so
|
|
48
|
+
* dragging right (positive dx) grows it; a right-side panel's handle sits at
|
|
49
|
+
* its *left* edge, so dragging right shrinks it. Pure so drag math can be
|
|
50
|
+
* unit-tested without a DOM.
|
|
51
|
+
*/
|
|
52
|
+
function computeDragWidth(startWidth, startX, clientX, side) {
|
|
53
|
+
const dx = clientX - startX;
|
|
54
|
+
return side === "left" ? startWidth + dx : startWidth - dx;
|
|
55
|
+
}
|
|
56
|
+
/** width (px) -> percentage of the container's width. Pure, unrounded. */
|
|
57
|
+
function widthToPercent(width, containerWidth) {
|
|
58
|
+
if (!(containerWidth > 0))
|
|
59
|
+
return 0;
|
|
60
|
+
return (width / containerWidth) * 100;
|
|
61
|
+
}
|
|
62
|
+
/** percentage of the container's width -> width (px). Pure, unrounded. */
|
|
63
|
+
function percentToWidth(percent, containerWidth) {
|
|
64
|
+
return (percent / 100) * containerWidth;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Reads a persisted width percentage, wrapped in try/catch: `localStorage`
|
|
68
|
+
* can throw (private browsing, storage disabled), and a resizable panel
|
|
69
|
+
* failing to *render* over a persistence error would be worse than the
|
|
70
|
+
* panel simply forgetting its width. `storage` defaults to
|
|
71
|
+
* `window.localStorage` and exists as a seam for tests — dropping the
|
|
72
|
+
* try/catch here is the exact failure this must catch.
|
|
73
|
+
*/
|
|
74
|
+
function readStoredPercent(key, storage = window.localStorage) {
|
|
75
|
+
try {
|
|
76
|
+
const raw = storage.getItem(key);
|
|
77
|
+
if (raw == null)
|
|
78
|
+
return null;
|
|
79
|
+
const n = Number(raw);
|
|
80
|
+
return Number.isFinite(n) ? n : null;
|
|
81
|
+
}
|
|
82
|
+
catch {
|
|
83
|
+
// private mode / storage disabled — behave as if nothing is stored
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
/** Writes a persisted width percentage, wrapped in try/catch — see {@link readStoredPercent}. */
|
|
88
|
+
function writeStoredPercent(key, percent, storage = window.localStorage) {
|
|
89
|
+
try {
|
|
90
|
+
storage.setItem(key, String(percent));
|
|
91
|
+
}
|
|
92
|
+
catch {
|
|
93
|
+
// private mode / quota exceeded — persistence is best-effort
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Attio's adjustable-panel primitive: a spacer that reserves layout width
|
|
98
|
+
* plus a panel that overlays it, so the panel can move between docked
|
|
99
|
+
* (in-flow) and floating (`position: fixed`, an overlay) without a reflow
|
|
100
|
+
* glitch. Drag the edge handle to resize; constraints are CSS `min-width`/
|
|
101
|
+
* `max-width`, never re-clamped in JS.
|
|
102
|
+
*/
|
|
103
|
+
function ResizablePanel({ side = "left", size, defaultSize = 280, onSizeChange, min = 200, max, floating = false, handleVariant = "panel", storageKey, className, children, ...rest }) {
|
|
104
|
+
const controlled = size != null;
|
|
105
|
+
const [uncontrolledSize, setUncontrolledSize] = React.useState(defaultSize);
|
|
106
|
+
const width = controlled ? size : uncontrolledSize;
|
|
107
|
+
const containerRef = React.useRef(null);
|
|
108
|
+
const panelRef = React.useRef(null);
|
|
109
|
+
const dragRef = React.useRef(null);
|
|
110
|
+
const [dragging, setDragging] = React.useState(false);
|
|
111
|
+
// Restore a persisted percentage on mount (uncontrolled + storageKey only).
|
|
112
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: restore the persisted width once, on mount only
|
|
113
|
+
React.useEffect(() => {
|
|
114
|
+
if (controlled || !storageKey)
|
|
115
|
+
return;
|
|
116
|
+
const percent = readStoredPercent(storageKey);
|
|
117
|
+
if (percent == null)
|
|
118
|
+
return;
|
|
119
|
+
const containerWidth = containerRef.current?.getBoundingClientRect().width;
|
|
120
|
+
if (!containerWidth)
|
|
121
|
+
return;
|
|
122
|
+
setUncontrolledSize(percentToWidth(percent, containerWidth));
|
|
123
|
+
}, []);
|
|
124
|
+
const commitSize = React.useCallback((next) => {
|
|
125
|
+
if (!controlled)
|
|
126
|
+
setUncontrolledSize(next);
|
|
127
|
+
onSizeChange?.(next);
|
|
128
|
+
if (!controlled && storageKey) {
|
|
129
|
+
const containerWidth = containerRef.current?.getBoundingClientRect().width;
|
|
130
|
+
if (containerWidth) {
|
|
131
|
+
writeStoredPercent(storageKey, widthToPercent(next, containerWidth));
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}, [controlled, onSizeChange, storageKey]);
|
|
135
|
+
function onHandlePointerDown(e) {
|
|
136
|
+
e.preventDefault();
|
|
137
|
+
e.target.setPointerCapture?.(e.pointerId);
|
|
138
|
+
dragRef.current = { startX: e.clientX, startWidth: width, moved: false };
|
|
139
|
+
}
|
|
140
|
+
function onHandlePointerMove(e) {
|
|
141
|
+
const drag = dragRef.current;
|
|
142
|
+
if (!drag)
|
|
143
|
+
return;
|
|
144
|
+
if (!drag.moved) {
|
|
145
|
+
drag.moved = true;
|
|
146
|
+
setDragging(true);
|
|
147
|
+
}
|
|
148
|
+
const next = computeDragWidth(drag.startWidth, drag.startX, e.clientX, side);
|
|
149
|
+
if (!controlled)
|
|
150
|
+
setUncontrolledSize(next);
|
|
151
|
+
onSizeChange?.(next);
|
|
152
|
+
}
|
|
153
|
+
function onHandlePointerUp(e) {
|
|
154
|
+
const drag = dragRef.current;
|
|
155
|
+
dragRef.current = null;
|
|
156
|
+
setDragging(false);
|
|
157
|
+
e.target.releasePointerCapture?.(e.pointerId);
|
|
158
|
+
if (!drag)
|
|
159
|
+
return;
|
|
160
|
+
// Never re-clamp here: read back the panel's actual, CSS-clamped
|
|
161
|
+
// rendered width after layout, and commit *that* value.
|
|
162
|
+
const rect = panelRef.current?.getBoundingClientRect();
|
|
163
|
+
const finalWidth = rect ? Math.round(rect.width) : width;
|
|
164
|
+
commitSize(finalWidth);
|
|
165
|
+
}
|
|
166
|
+
const maxStyle = max == null ? undefined : typeof max === "number" ? `${max}px` : max;
|
|
167
|
+
const panelSizeStyle = {
|
|
168
|
+
width,
|
|
169
|
+
minWidth: min,
|
|
170
|
+
maxWidth: maxStyle,
|
|
171
|
+
};
|
|
172
|
+
return ((0, jsx_runtime_1.jsxs)("div", { ref: containerRef, className: (0, resizablepanel_recipe_1.resizablepanelRecipe)({ className }), ...rest, children: [(0, jsx_runtime_1.jsx)("div", { className: "resizablepanel-spacer", style: floating ? { width: 0 } : { width, minWidth: min, maxWidth: maxStyle } }), (0, jsx_runtime_1.jsxs)("div", { ref: panelRef, className: "resizablepanel-panel", "data-side": side, "data-floating": floating ? "true" : "false", style: panelSizeStyle, children: [(0, jsx_runtime_1.jsx)("div", { className: "resizablepanel-inner", children: children }), (0, jsx_runtime_1.jsx)("div", { className: handleVariant === "column"
|
|
173
|
+
? "resizablepanel-handle resizablepanel-handle--column"
|
|
174
|
+
: "resizablepanel-handle", "data-side": side, "data-dragging": dragging ? "true" : undefined, "data-handle": "", onPointerDown: onHandlePointerDown, onPointerMove: onHandlePointerMove, onPointerUp: onHandlePointerUp, children: handleVariant === "column" && ((0, jsx_runtime_1.jsx)("span", { className: "resizablepanel-handle-inner", "aria-hidden": "true" })) })] })] }));
|
|
175
|
+
}
|
|
176
|
+
ResizablePanel.displayName = "ResizablePanel";
|