@kushagradhawan/kookie-ui 0.3.21 → 0.3.23
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/components.css +264 -329
- package/dist/cjs/components/_internal/base-button.d.ts.map +1 -1
- package/dist/cjs/components/_internal/base-button.js +1 -1
- package/dist/cjs/components/_internal/base-button.js.map +4 -4
- package/dist/cjs/components/_internal/dropdown-menu-drill-down.js +1 -1
- package/dist/cjs/components/_internal/dropdown-menu-drill-down.js.map +3 -3
- package/dist/cjs/components/_internal/shell-bottom.js +1 -1
- package/dist/cjs/components/_internal/shell-bottom.js.map +4 -4
- package/dist/cjs/components/_internal/shell-handles.d.ts.map +1 -1
- package/dist/cjs/components/_internal/shell-handles.js +1 -1
- package/dist/cjs/components/_internal/shell-handles.js.map +3 -3
- package/dist/cjs/components/_internal/shell-inspector.js +1 -1
- package/dist/cjs/components/_internal/shell-inspector.js.map +4 -4
- package/dist/cjs/components/_internal/shell-sidebar.js +1 -1
- package/dist/cjs/components/_internal/shell-sidebar.js.map +4 -4
- package/dist/cjs/components/accordion.d.ts.map +1 -1
- package/dist/cjs/components/accordion.js +1 -1
- package/dist/cjs/components/accordion.js.map +4 -4
- package/dist/cjs/components/alert-dialog.d.ts.map +1 -1
- package/dist/cjs/components/alert-dialog.js +1 -1
- package/dist/cjs/components/alert-dialog.js.map +4 -4
- package/dist/cjs/components/avatar.js +1 -1
- package/dist/cjs/components/avatar.js.map +4 -4
- package/dist/cjs/components/badge.d.ts.map +1 -1
- package/dist/cjs/components/badge.js +1 -1
- package/dist/cjs/components/badge.js.map +4 -4
- package/dist/cjs/components/blockquote.js +1 -1
- package/dist/cjs/components/blockquote.js.map +4 -4
- package/dist/cjs/components/box.js +1 -1
- package/dist/cjs/components/box.js.map +4 -4
- package/dist/cjs/components/button.js +1 -1
- package/dist/cjs/components/button.js.map +4 -4
- package/dist/cjs/components/callout.js +1 -1
- package/dist/cjs/components/callout.js.map +4 -4
- package/dist/cjs/components/card.js +1 -1
- package/dist/cjs/components/card.js.map +4 -4
- package/dist/cjs/components/chatbar.js +2 -2
- package/dist/cjs/components/chatbar.js.map +4 -4
- package/dist/cjs/components/checkbox-cards.js +1 -1
- package/dist/cjs/components/checkbox-cards.js.map +4 -4
- package/dist/cjs/components/checkbox-group.js +1 -1
- package/dist/cjs/components/checkbox-group.js.map +4 -4
- package/dist/cjs/components/checkbox.js +1 -1
- package/dist/cjs/components/checkbox.js.map +4 -4
- package/dist/cjs/components/code.js +1 -1
- package/dist/cjs/components/code.js.map +4 -4
- package/dist/cjs/components/combobox.js +1 -1
- package/dist/cjs/components/combobox.js.map +4 -4
- package/dist/cjs/components/container.js +1 -1
- package/dist/cjs/components/container.js.map +4 -4
- package/dist/cjs/components/context-menu.d.ts.map +1 -1
- package/dist/cjs/components/context-menu.js +1 -1
- package/dist/cjs/components/context-menu.js.map +4 -4
- package/dist/cjs/components/data-list.js +1 -1
- package/dist/cjs/components/data-list.js.map +4 -4
- package/dist/cjs/components/dialog.d.ts.map +1 -1
- package/dist/cjs/components/dialog.js +1 -1
- package/dist/cjs/components/dialog.js.map +4 -4
- package/dist/cjs/components/dropdown-menu.d.ts.map +1 -1
- package/dist/cjs/components/dropdown-menu.js +1 -1
- package/dist/cjs/components/dropdown-menu.js.map +4 -4
- package/dist/cjs/components/em.js +1 -1
- package/dist/cjs/components/em.js.map +4 -4
- package/dist/cjs/components/flex.js +1 -1
- package/dist/cjs/components/flex.js.map +4 -4
- package/dist/cjs/components/grid.js +1 -1
- package/dist/cjs/components/grid.js.map +4 -4
- package/dist/cjs/components/heading.js +1 -1
- package/dist/cjs/components/heading.js.map +4 -4
- package/dist/cjs/components/hover-card.js +1 -1
- package/dist/cjs/components/hover-card.js.map +4 -4
- package/dist/cjs/components/icon-button.js +2 -2
- package/dist/cjs/components/icon-button.js.map +4 -4
- package/dist/cjs/components/image.js +1 -1
- package/dist/cjs/components/image.js.map +4 -4
- package/dist/cjs/components/index.js +5 -5
- package/dist/cjs/components/index.js.map +4 -4
- package/dist/cjs/components/inset.js +1 -1
- package/dist/cjs/components/inset.js.map +4 -4
- package/dist/cjs/components/kbd.js +1 -1
- package/dist/cjs/components/kbd.js.map +4 -4
- package/dist/cjs/components/link.js +1 -1
- package/dist/cjs/components/link.js.map +4 -4
- package/dist/cjs/components/navbar.js +1 -1
- package/dist/cjs/components/navbar.js.map +4 -4
- package/dist/cjs/components/popover.js +1 -1
- package/dist/cjs/components/popover.js.map +4 -4
- package/dist/cjs/components/progress.js +1 -1
- package/dist/cjs/components/progress.js.map +4 -4
- package/dist/cjs/components/quote.js +1 -1
- package/dist/cjs/components/quote.js.map +4 -4
- package/dist/cjs/components/radio-cards.js +1 -1
- package/dist/cjs/components/radio-cards.js.map +4 -4
- package/dist/cjs/components/radio-group.js +1 -1
- package/dist/cjs/components/radio-group.js.map +4 -4
- package/dist/cjs/components/radio.js +1 -1
- package/dist/cjs/components/radio.js.map +4 -4
- package/dist/cjs/components/schemas/base-button.schema.d.ts +2 -2
- package/dist/cjs/components/schemas/button.schema.d.ts +2 -2
- package/dist/cjs/components/schemas/icon-button.schema.d.ts +4 -4
- package/dist/cjs/components/schemas/shell.schema.d.ts +2 -2
- package/dist/cjs/components/schemas/toggle-button.schema.d.ts +6 -6
- package/dist/cjs/components/schemas/toggle-icon-button.schema.d.ts +8 -8
- package/dist/cjs/components/scroll-area.js +1 -1
- package/dist/cjs/components/scroll-area.js.map +4 -4
- package/dist/cjs/components/section.js +1 -1
- package/dist/cjs/components/section.js.map +4 -4
- package/dist/cjs/components/segmented-control.js +1 -1
- package/dist/cjs/components/segmented-control.js.map +4 -4
- package/dist/cjs/components/select.js +1 -1
- package/dist/cjs/components/select.js.map +4 -4
- package/dist/cjs/components/separator.js +1 -1
- package/dist/cjs/components/separator.js.map +4 -4
- package/dist/cjs/components/sheet.d.ts.map +1 -1
- package/dist/cjs/components/sheet.js +1 -1
- package/dist/cjs/components/sheet.js.map +4 -4
- package/dist/cjs/components/shell.d.ts.map +1 -1
- package/dist/cjs/components/shell.js +1 -1
- package/dist/cjs/components/shell.js.map +4 -4
- package/dist/cjs/components/sidebar.js +1 -1
- package/dist/cjs/components/sidebar.js.map +4 -4
- package/dist/cjs/components/skeleton.js +1 -1
- package/dist/cjs/components/skeleton.js.map +4 -4
- package/dist/cjs/components/slider.js +1 -1
- package/dist/cjs/components/slider.js.map +4 -4
- package/dist/cjs/components/spinner.js +1 -1
- package/dist/cjs/components/spinner.js.map +4 -4
- package/dist/cjs/components/strong.js +1 -1
- package/dist/cjs/components/strong.js.map +4 -4
- package/dist/cjs/components/switch.js +1 -1
- package/dist/cjs/components/switch.js.map +4 -4
- package/dist/cjs/components/tab-nav.js +1 -1
- package/dist/cjs/components/tab-nav.js.map +4 -4
- package/dist/cjs/components/table.js +1 -1
- package/dist/cjs/components/table.js.map +4 -4
- package/dist/cjs/components/tabs.js +1 -1
- package/dist/cjs/components/tabs.js.map +4 -4
- package/dist/cjs/components/text-area.js +1 -1
- package/dist/cjs/components/text-area.js.map +4 -4
- package/dist/cjs/components/text-field.js +2 -2
- package/dist/cjs/components/text-field.js.map +4 -4
- package/dist/cjs/components/text.js +1 -1
- package/dist/cjs/components/text.js.map +4 -4
- package/dist/cjs/components/theme-panel.js +3 -3
- package/dist/cjs/components/theme-panel.js.map +4 -4
- package/dist/cjs/components/theme.d.ts.map +1 -1
- package/dist/cjs/components/theme.js +1 -1
- package/dist/cjs/components/theme.js.map +4 -4
- package/dist/cjs/components/toggle-button.js +2 -2
- package/dist/cjs/components/toggle-button.js.map +4 -4
- package/dist/cjs/components/toggle-icon-button.js +3 -3
- package/dist/cjs/components/toggle-icon-button.js.map +4 -4
- package/dist/cjs/components/toolbar.js +1 -1
- package/dist/cjs/components/toolbar.js.map +4 -4
- package/dist/cjs/components/tooltip.js +1 -1
- package/dist/cjs/components/tooltip.js.map +4 -4
- package/dist/cjs/components/user-card.js +1 -1
- package/dist/cjs/components/user-card.js.map +4 -4
- package/dist/cjs/helpers/compile-prop-defs.d.ts +49 -0
- package/dist/cjs/helpers/compile-prop-defs.d.ts.map +1 -0
- package/dist/cjs/helpers/compile-prop-defs.js +2 -0
- package/dist/cjs/helpers/compile-prop-defs.js.map +7 -0
- package/dist/cjs/helpers/extract-props.d.ts.map +1 -1
- package/dist/cjs/helpers/extract-props.js +1 -1
- package/dist/cjs/helpers/extract-props.js.map +4 -4
- package/dist/cjs/helpers/get-margin-styles.d.ts.map +1 -1
- package/dist/cjs/helpers/get-margin-styles.js +1 -1
- package/dist/cjs/helpers/get-margin-styles.js.map +3 -3
- package/dist/cjs/helpers/get-responsive-styles.d.ts +5 -2
- package/dist/cjs/helpers/get-responsive-styles.d.ts.map +1 -1
- package/dist/cjs/helpers/get-responsive-styles.js +1 -1
- package/dist/cjs/helpers/get-responsive-styles.js.map +3 -3
- package/dist/cjs/helpers/index.js +2 -2
- package/dist/cjs/helpers/index.js.map +4 -4
- package/dist/cjs/helpers/use-deprecation-warning.d.ts +10 -0
- package/dist/cjs/helpers/use-deprecation-warning.d.ts.map +1 -0
- package/dist/cjs/helpers/use-deprecation-warning.js +2 -0
- package/dist/cjs/helpers/use-deprecation-warning.js.map +7 -0
- package/dist/cjs/hooks/index.js +2 -2
- package/dist/cjs/hooks/index.js.map +3 -3
- package/dist/cjs/hooks/use-body-pointer-events-cleanup.d.ts.map +1 -1
- package/dist/cjs/hooks/use-body-pointer-events-cleanup.js +1 -1
- package/dist/cjs/hooks/use-body-pointer-events-cleanup.js.map +3 -3
- package/dist/cjs/hooks/use-breakpoint.d.ts +7 -3
- package/dist/cjs/hooks/use-breakpoint.d.ts.map +1 -1
- package/dist/cjs/hooks/use-breakpoint.js +1 -1
- package/dist/cjs/hooks/use-breakpoint.js.map +3 -3
- package/dist/cjs/hooks/use-prop-synced-state.d.ts +14 -0
- package/dist/cjs/hooks/use-prop-synced-state.d.ts.map +1 -0
- package/dist/cjs/hooks/use-prop-synced-state.js +2 -0
- package/dist/cjs/hooks/use-prop-synced-state.js.map +7 -0
- package/dist/cjs/index.js +5 -5
- package/dist/cjs/index.js.map +4 -4
- package/dist/esm/{chunk-RQ2ZPMHJ.js → chunk-22HGLMPQ.js} +2 -2
- package/dist/esm/{chunk-WYA4IRU6.js → chunk-25WZA7ZU.js} +2 -2
- package/dist/esm/chunk-2UPAYDKR.js +2 -0
- package/dist/esm/chunk-2UPAYDKR.js.map +7 -0
- package/dist/esm/{chunk-XHQGMOXV.js → chunk-36ZQVP7F.js} +2 -2
- package/dist/esm/{chunk-K3R4AH3E.js → chunk-3MWWP4MW.js} +2 -2
- package/dist/esm/{chunk-HQ35PM4O.js → chunk-43A5GUSI.js} +2 -2
- package/dist/esm/{chunk-Z5DQ6FSA.js → chunk-4AQTUBVP.js} +2 -2
- package/dist/esm/{chunk-25U7DENY.js → chunk-4BBOHEF4.js} +2 -2
- package/dist/esm/chunk-4CKDU6FY.js +2 -0
- package/dist/esm/chunk-4CKDU6FY.js.map +7 -0
- package/dist/esm/{chunk-ZSEFZM5H.js → chunk-4IY2PR6N.js} +2 -2
- package/dist/esm/{chunk-QLIELX4I.js → chunk-4ME6O27S.js} +2 -2
- package/dist/esm/chunk-4XJY6FIK.js +2 -0
- package/dist/esm/chunk-4XJY6FIK.js.map +7 -0
- package/dist/esm/{chunk-JQOFJNCV.js → chunk-4YFJWXL2.js} +2 -2
- package/dist/esm/{chunk-DNI4QRXQ.js → chunk-5IBGFL6O.js} +2 -2
- package/dist/esm/chunk-5TXQLK4G.js +2 -0
- package/dist/esm/chunk-5TXQLK4G.js.map +7 -0
- package/dist/esm/{chunk-IPJUHVM6.js → chunk-666GX7O5.js} +2 -2
- package/dist/esm/chunk-6FLLFCBU.js +2 -0
- package/dist/esm/chunk-6FLLFCBU.js.map +7 -0
- package/dist/esm/{chunk-DJBPM5QK.js → chunk-7FC7HF76.js} +2 -2
- package/dist/esm/{chunk-SVLY6B5F.js → chunk-7QDTSBJF.js} +2 -2
- package/dist/esm/chunk-AX5S56DS.js +2 -0
- package/dist/esm/chunk-AX5S56DS.js.map +7 -0
- package/dist/esm/{chunk-DK5MHD6I.js → chunk-B24BDVG2.js} +2 -2
- package/dist/esm/{chunk-WZCZHCVE.js → chunk-BJYUPIXO.js} +2 -2
- package/dist/esm/{chunk-BJTJUIYJ.js → chunk-CRWYCLTE.js} +2 -2
- package/dist/esm/{chunk-OHJVFZMH.js → chunk-CSKZZOI2.js} +2 -2
- package/dist/esm/chunk-D5N627TH.js +2 -0
- package/dist/esm/chunk-D5N627TH.js.map +7 -0
- package/dist/esm/{chunk-ADYTQCZX.js → chunk-D6B7IMZU.js} +2 -2
- package/dist/esm/chunk-DL2O3GKG.js +2 -0
- package/dist/esm/chunk-DL2O3GKG.js.map +7 -0
- package/dist/esm/{chunk-USGTBZ43.js → chunk-E67CIG6A.js} +2 -2
- package/dist/esm/{chunk-42HFGCHX.js → chunk-ETMLMDW4.js} +2 -2
- package/dist/esm/{chunk-7CBAHIVG.js → chunk-F2HYQ3ZR.js} +2 -2
- package/dist/esm/{chunk-YUZPSUJE.js → chunk-F7IYL2VW.js} +2 -2
- package/dist/esm/{chunk-FVCWNSRU.js → chunk-FHOCUZDR.js} +2 -2
- package/dist/esm/{chunk-7MURQ6CR.js → chunk-FLFAXVFB.js} +2 -2
- package/dist/esm/{chunk-APRBRAOT.js → chunk-FOEZLQTW.js} +2 -2
- package/dist/esm/{chunk-WNSPLWRV.js → chunk-GJSGKE7B.js} +2 -2
- package/dist/esm/{chunk-OGOOZLUD.js → chunk-GLERJXVS.js} +2 -2
- package/dist/esm/{chunk-6VGPTAHM.js → chunk-GWXVETMF.js} +2 -2
- package/dist/esm/{chunk-ES7MK2MM.js → chunk-GYBLXQ4R.js} +2 -2
- package/dist/esm/{chunk-4OBMRJHC.js → chunk-H7ST535H.js} +2 -2
- package/dist/esm/{chunk-QLZ5XAW6.js → chunk-HF5WY5YE.js} +2 -2
- package/dist/esm/chunk-ICIGZ3N7.js +2 -0
- package/dist/esm/chunk-ICIGZ3N7.js.map +7 -0
- package/dist/esm/{chunk-RDP4UQ42.js → chunk-IEWCQU2S.js} +2 -2
- package/dist/esm/{chunk-XLOHPURR.js → chunk-IHK3H2OM.js} +2 -2
- package/dist/esm/{chunk-3F6I7YOR.js → chunk-JDGJSNWT.js} +2 -2
- package/dist/esm/chunk-JQQIPEGY.js +2 -0
- package/dist/esm/chunk-JQQIPEGY.js.map +7 -0
- package/dist/esm/chunk-JR2YOGII.js +2 -0
- package/dist/esm/chunk-JR2YOGII.js.map +7 -0
- package/dist/esm/chunk-JUY7CBSL.js +2 -0
- package/dist/esm/chunk-JUY7CBSL.js.map +7 -0
- package/dist/esm/{chunk-VF5TRT3H.js → chunk-KKM6T5P7.js} +2 -2
- package/dist/esm/{chunk-ZHYOJNWV.js → chunk-LKAK5GXF.js} +2 -2
- package/dist/esm/chunk-LOGJJF4I.js +2 -0
- package/dist/esm/chunk-LOGJJF4I.js.map +7 -0
- package/dist/esm/{chunk-JCYI4NTV.js → chunk-MBCBP73P.js} +2 -2
- package/dist/esm/{chunk-UYNYUR7O.js → chunk-MBE2YSBU.js} +2 -2
- package/dist/esm/chunk-MHANZINI.js +2 -0
- package/dist/esm/chunk-MHANZINI.js.map +7 -0
- package/dist/esm/chunk-MRECKC4D.js +2 -0
- package/dist/esm/chunk-MRECKC4D.js.map +7 -0
- package/dist/esm/{chunk-H2G446JG.js → chunk-NMKPFUNP.js} +2 -2
- package/dist/esm/{chunk-4N5JU7XQ.js → chunk-O3CDWEZA.js} +2 -2
- package/dist/esm/{chunk-TEULZKBM.js → chunk-OGXZHAQL.js} +2 -2
- package/dist/esm/{chunk-2AEELIG6.js → chunk-OWAUCLRT.js} +2 -2
- package/dist/esm/{chunk-7CXVHFMQ.js → chunk-P7HYVJSU.js} +2 -2
- package/dist/esm/{chunk-4532RT2B.js → chunk-P7IAHW4V.js} +2 -2
- package/dist/esm/{chunk-M3ZYJANH.js → chunk-PQZXQ4ST.js} +2 -2
- package/dist/esm/{chunk-SGU4HUHF.js → chunk-PTLFMWCN.js} +2 -2
- package/dist/esm/chunk-S2HA3W3V.js +2 -0
- package/dist/esm/chunk-S2HA3W3V.js.map +7 -0
- package/dist/esm/{chunk-E6IWYD3U.js → chunk-S5C5YRBS.js} +2 -2
- package/dist/esm/{chunk-A24PYRVV.js → chunk-SO67YEVQ.js} +2 -2
- package/dist/esm/chunk-TLWTUKKL.js +2 -0
- package/dist/esm/chunk-TLWTUKKL.js.map +7 -0
- package/dist/esm/{chunk-HACQF6F4.js → chunk-TOOSHJOA.js} +2 -2
- package/dist/esm/{chunk-QOWA5LK5.js → chunk-U2X2CAW4.js} +2 -2
- package/dist/esm/{chunk-U7AASKZI.js → chunk-UVCH7QKO.js} +2 -2
- package/dist/esm/{chunk-GWYFT3EI.js → chunk-VLO7NXSP.js} +2 -2
- package/dist/esm/{chunk-DXI5P5O4.js → chunk-VX6ARMWP.js} +2 -2
- package/dist/esm/chunk-WAURCNAS.js +2 -0
- package/dist/esm/chunk-WAURCNAS.js.map +7 -0
- package/dist/esm/{chunk-EJWAAFCI.js → chunk-WO43WW3A.js} +2 -2
- package/dist/esm/{chunk-GLC4QJBF.js → chunk-WTYNFBFV.js} +2 -2
- package/dist/esm/{chunk-6FAICIYS.js → chunk-XMRIRFM7.js} +2 -2
- package/dist/esm/chunk-YV2KYHGR.js +2 -0
- package/dist/esm/chunk-YV2KYHGR.js.map +7 -0
- package/dist/esm/{chunk-UIEUZLZZ.js → chunk-ZY6SQWHT.js} +2 -2
- package/dist/esm/components/_internal/base-button.d.ts.map +1 -1
- package/dist/esm/components/_internal/base-button.js +1 -1
- package/dist/esm/components/_internal/dropdown-menu-drill-down.js +1 -1
- package/dist/esm/components/_internal/shell-bottom.js +1 -1
- package/dist/esm/components/_internal/shell-handles.d.ts.map +1 -1
- package/dist/esm/components/_internal/shell-handles.js +1 -1
- package/dist/esm/components/_internal/shell-inspector.js +1 -1
- package/dist/esm/components/_internal/shell-sidebar.js +1 -1
- package/dist/esm/components/accordion.d.ts.map +1 -1
- package/dist/esm/components/accordion.js +1 -1
- package/dist/esm/components/alert-dialog.d.ts.map +1 -1
- package/dist/esm/components/alert-dialog.js +1 -1
- package/dist/esm/components/avatar.js +1 -1
- package/dist/esm/components/badge.d.ts.map +1 -1
- package/dist/esm/components/badge.js +1 -1
- package/dist/esm/components/blockquote.js +1 -1
- package/dist/esm/components/box.js +1 -1
- package/dist/esm/components/button.js +1 -1
- package/dist/esm/components/callout.js +1 -1
- package/dist/esm/components/card.js +1 -1
- package/dist/esm/components/chatbar.js +1 -1
- package/dist/esm/components/checkbox-cards.js +1 -1
- package/dist/esm/components/checkbox-group.js +1 -1
- package/dist/esm/components/checkbox.js +1 -1
- package/dist/esm/components/code.js +1 -1
- package/dist/esm/components/combobox.js +1 -1
- package/dist/esm/components/container.js +1 -1
- package/dist/esm/components/context-menu.d.ts.map +1 -1
- package/dist/esm/components/context-menu.js +1 -1
- package/dist/esm/components/data-list.js +1 -1
- package/dist/esm/components/dialog.d.ts.map +1 -1
- package/dist/esm/components/dialog.js +1 -1
- package/dist/esm/components/dropdown-menu.d.ts.map +1 -1
- package/dist/esm/components/dropdown-menu.js +1 -1
- package/dist/esm/components/em.js +1 -1
- package/dist/esm/components/flex.js +1 -1
- package/dist/esm/components/grid.js +1 -1
- package/dist/esm/components/heading.js +1 -1
- package/dist/esm/components/hover-card.js +1 -1
- package/dist/esm/components/icon-button.js +1 -1
- package/dist/esm/components/image.js +1 -1
- package/dist/esm/components/index.js +1 -1
- package/dist/esm/components/inset.js +1 -1
- package/dist/esm/components/kbd.js +1 -1
- package/dist/esm/components/link.js +1 -1
- package/dist/esm/components/navbar.js +1 -1
- package/dist/esm/components/popover.js +1 -1
- package/dist/esm/components/progress.js +1 -1
- package/dist/esm/components/quote.js +1 -1
- package/dist/esm/components/radio-cards.js +1 -1
- package/dist/esm/components/radio-group.js +1 -1
- package/dist/esm/components/radio.js +1 -1
- package/dist/esm/components/schemas/base-button.schema.d.ts +2 -2
- package/dist/esm/components/schemas/button.schema.d.ts +2 -2
- package/dist/esm/components/schemas/icon-button.schema.d.ts +4 -4
- package/dist/esm/components/schemas/shell.schema.d.ts +2 -2
- package/dist/esm/components/schemas/toggle-button.schema.d.ts +6 -6
- package/dist/esm/components/schemas/toggle-icon-button.schema.d.ts +8 -8
- package/dist/esm/components/scroll-area.js +1 -1
- package/dist/esm/components/section.js +1 -1
- package/dist/esm/components/segmented-control.js +1 -1
- package/dist/esm/components/select.js +1 -1
- package/dist/esm/components/separator.js +1 -1
- package/dist/esm/components/sheet.d.ts.map +1 -1
- package/dist/esm/components/sheet.js +1 -1
- package/dist/esm/components/shell.d.ts.map +1 -1
- package/dist/esm/components/shell.js +1 -1
- package/dist/esm/components/sidebar.js +1 -1
- package/dist/esm/components/skeleton.js +1 -1
- package/dist/esm/components/slider.js +1 -1
- package/dist/esm/components/spinner.js +1 -1
- package/dist/esm/components/strong.js +1 -1
- package/dist/esm/components/switch.js +1 -1
- package/dist/esm/components/tab-nav.js +1 -1
- package/dist/esm/components/table.js +1 -1
- package/dist/esm/components/tabs.js +1 -1
- package/dist/esm/components/text-area.js +1 -1
- package/dist/esm/components/text-field.js +1 -1
- package/dist/esm/components/text.js +1 -1
- package/dist/esm/components/theme-panel.js +1 -1
- package/dist/esm/components/theme.d.ts.map +1 -1
- package/dist/esm/components/theme.js +1 -1
- package/dist/esm/components/toggle-button.js +1 -1
- package/dist/esm/components/toggle-icon-button.js +1 -1
- package/dist/esm/components/toolbar.js +1 -1
- package/dist/esm/components/tooltip.js +1 -1
- package/dist/esm/components/user-card.js +1 -1
- package/dist/esm/helpers/compile-prop-defs.d.ts +49 -0
- package/dist/esm/helpers/compile-prop-defs.d.ts.map +1 -0
- package/dist/esm/helpers/compile-prop-defs.js +2 -0
- package/dist/esm/helpers/compile-prop-defs.js.map +7 -0
- package/dist/esm/helpers/extract-props.d.ts.map +1 -1
- package/dist/esm/helpers/extract-props.js +1 -1
- package/dist/esm/helpers/get-margin-styles.d.ts.map +1 -1
- package/dist/esm/helpers/get-margin-styles.js +1 -1
- package/dist/esm/helpers/get-responsive-styles.d.ts +5 -2
- package/dist/esm/helpers/get-responsive-styles.d.ts.map +1 -1
- package/dist/esm/helpers/get-responsive-styles.js +1 -1
- package/dist/esm/helpers/index.js +1 -1
- package/dist/esm/helpers/use-deprecation-warning.d.ts +10 -0
- package/dist/esm/helpers/use-deprecation-warning.d.ts.map +1 -0
- package/dist/esm/helpers/use-deprecation-warning.js +2 -0
- package/dist/esm/helpers/use-deprecation-warning.js.map +7 -0
- package/dist/esm/hooks/index.js +1 -1
- package/dist/esm/hooks/use-body-pointer-events-cleanup.d.ts.map +1 -1
- package/dist/esm/hooks/use-body-pointer-events-cleanup.js +1 -1
- package/dist/esm/hooks/use-breakpoint.d.ts +7 -3
- package/dist/esm/hooks/use-breakpoint.d.ts.map +1 -1
- package/dist/esm/hooks/use-breakpoint.js +1 -1
- package/dist/esm/hooks/use-prop-synced-state.d.ts +14 -0
- package/dist/esm/hooks/use-prop-synced-state.d.ts.map +1 -0
- package/dist/esm/hooks/use-prop-synced-state.js +2 -0
- package/dist/esm/hooks/use-prop-synced-state.js.map +7 -0
- package/dist/esm/index.js +1 -1
- package/package.json +2 -1
- package/schemas/base-button.json +0 -1
- package/schemas/button.json +0 -1
- package/schemas/icon-button.json +0 -1
- package/schemas/index.json +0 -6
- package/schemas/toggle-button.json +0 -1
- package/schemas/toggle-icon-button.json +0 -1
- package/src/components/_internal/base-button.css +2 -2
- package/src/components/_internal/base-button.tsx +3 -58
- package/src/components/_internal/base-card.css +19 -4
- package/src/components/_internal/base-checkbox.css +2 -2
- package/src/components/_internal/base-dialog.css +7 -13
- package/src/components/_internal/base-menu.css +7 -0
- package/src/components/_internal/base-radio.css +2 -2
- package/src/components/_internal/base-sidebar.css +7 -0
- package/src/components/_internal/base-tab-list.css +2 -2
- package/src/components/_internal/shell-handles.tsx +27 -0
- package/src/components/accordion.css +6 -6
- package/src/components/accordion.tsx +2 -8
- package/src/components/alert-dialog.tsx +22 -20
- package/src/components/avatar.css +2 -2
- package/src/components/badge.css +2 -2
- package/src/components/badge.tsx +2 -8
- package/src/components/callout.css +2 -2
- package/src/components/chatbar.css +1 -1
- package/src/components/context-menu.tsx +2 -8
- package/src/components/dialog.tsx +46 -72
- package/src/components/dropdown-menu.tsx +2 -8
- package/src/components/popover.css +7 -0
- package/src/components/progress.css +21 -8
- package/src/components/segmented-control.css +2 -2
- package/src/components/select.css +9 -2
- package/src/components/sheet.tsx +31 -28
- package/src/components/shell.css +106 -69
- package/src/components/shell.tsx +168 -97
- package/src/components/slider.css +2 -2
- package/src/components/switch.css +2 -2
- package/src/components/table.css +7 -0
- package/src/components/text-area.css +2 -2
- package/src/components/text-field.css +2 -2
- package/src/components/theme.tsx +35 -34
- package/src/helpers/compile-prop-defs.ts +121 -0
- package/src/helpers/extract-props.ts +104 -83
- package/src/helpers/get-margin-styles.ts +38 -71
- package/src/helpers/get-responsive-styles.ts +37 -38
- package/src/helpers/use-deprecation-warning.ts +26 -0
- package/src/hooks/use-body-pointer-events-cleanup.ts +36 -6
- package/src/hooks/use-breakpoint.ts +94 -53
- package/src/hooks/use-prop-synced-state.ts +24 -0
- package/src/styles/tokens/blur.css +28 -0
- package/src/styles/tokens/color.css +3 -3
- package/src/styles/tokens/constants.css +11 -0
- package/styles.css +280 -332
- package/tokens/base.css +13 -3
- package/tokens.css +16 -3
- package/dist/esm/chunk-2SS3FA3N.js +0 -2
- package/dist/esm/chunk-2SS3FA3N.js.map +0 -7
- package/dist/esm/chunk-5U2Q23K3.js +0 -2
- package/dist/esm/chunk-5U2Q23K3.js.map +0 -7
- package/dist/esm/chunk-6ELPYR73.js +0 -2
- package/dist/esm/chunk-6ELPYR73.js.map +0 -7
- package/dist/esm/chunk-DZ4H2KTP.js +0 -2
- package/dist/esm/chunk-DZ4H2KTP.js.map +0 -7
- package/dist/esm/chunk-H4MMVAGQ.js +0 -2
- package/dist/esm/chunk-H4MMVAGQ.js.map +0 -7
- package/dist/esm/chunk-HURTSXRY.js +0 -2
- package/dist/esm/chunk-HURTSXRY.js.map +0 -7
- package/dist/esm/chunk-ITRVKLYU.js +0 -2
- package/dist/esm/chunk-ITRVKLYU.js.map +0 -7
- package/dist/esm/chunk-KCAFSCOV.js +0 -2
- package/dist/esm/chunk-KCAFSCOV.js.map +0 -7
- package/dist/esm/chunk-KMPBTEZH.js +0 -2
- package/dist/esm/chunk-KMPBTEZH.js.map +0 -7
- package/dist/esm/chunk-LN5SP46K.js +0 -2
- package/dist/esm/chunk-LN5SP46K.js.map +0 -7
- package/dist/esm/chunk-Q73Y5O5P.js +0 -2
- package/dist/esm/chunk-Q73Y5O5P.js.map +0 -7
- package/dist/esm/chunk-RMBS6CAO.js +0 -2
- package/dist/esm/chunk-RMBS6CAO.js.map +0 -7
- package/dist/esm/chunk-UUX42HBM.js +0 -2
- package/dist/esm/chunk-UUX42HBM.js.map +0 -7
- package/dist/esm/chunk-X7BD5FLE.js +0 -2
- package/dist/esm/chunk-X7BD5FLE.js.map +0 -7
- package/dist/esm/chunk-YEA646GM.js +0 -2
- package/dist/esm/chunk-YEA646GM.js.map +0 -7
- package/dist/esm/chunk-ZMEXIPWM.js +0 -2
- package/dist/esm/chunk-ZMEXIPWM.js.map +0 -7
- /package/dist/esm/{chunk-RQ2ZPMHJ.js.map → chunk-22HGLMPQ.js.map} +0 -0
- /package/dist/esm/{chunk-WYA4IRU6.js.map → chunk-25WZA7ZU.js.map} +0 -0
- /package/dist/esm/{chunk-XHQGMOXV.js.map → chunk-36ZQVP7F.js.map} +0 -0
- /package/dist/esm/{chunk-K3R4AH3E.js.map → chunk-3MWWP4MW.js.map} +0 -0
- /package/dist/esm/{chunk-HQ35PM4O.js.map → chunk-43A5GUSI.js.map} +0 -0
- /package/dist/esm/{chunk-Z5DQ6FSA.js.map → chunk-4AQTUBVP.js.map} +0 -0
- /package/dist/esm/{chunk-25U7DENY.js.map → chunk-4BBOHEF4.js.map} +0 -0
- /package/dist/esm/{chunk-ZSEFZM5H.js.map → chunk-4IY2PR6N.js.map} +0 -0
- /package/dist/esm/{chunk-QLIELX4I.js.map → chunk-4ME6O27S.js.map} +0 -0
- /package/dist/esm/{chunk-JQOFJNCV.js.map → chunk-4YFJWXL2.js.map} +0 -0
- /package/dist/esm/{chunk-DNI4QRXQ.js.map → chunk-5IBGFL6O.js.map} +0 -0
- /package/dist/esm/{chunk-IPJUHVM6.js.map → chunk-666GX7O5.js.map} +0 -0
- /package/dist/esm/{chunk-DJBPM5QK.js.map → chunk-7FC7HF76.js.map} +0 -0
- /package/dist/esm/{chunk-SVLY6B5F.js.map → chunk-7QDTSBJF.js.map} +0 -0
- /package/dist/esm/{chunk-DK5MHD6I.js.map → chunk-B24BDVG2.js.map} +0 -0
- /package/dist/esm/{chunk-WZCZHCVE.js.map → chunk-BJYUPIXO.js.map} +0 -0
- /package/dist/esm/{chunk-BJTJUIYJ.js.map → chunk-CRWYCLTE.js.map} +0 -0
- /package/dist/esm/{chunk-OHJVFZMH.js.map → chunk-CSKZZOI2.js.map} +0 -0
- /package/dist/esm/{chunk-ADYTQCZX.js.map → chunk-D6B7IMZU.js.map} +0 -0
- /package/dist/esm/{chunk-USGTBZ43.js.map → chunk-E67CIG6A.js.map} +0 -0
- /package/dist/esm/{chunk-42HFGCHX.js.map → chunk-ETMLMDW4.js.map} +0 -0
- /package/dist/esm/{chunk-7CBAHIVG.js.map → chunk-F2HYQ3ZR.js.map} +0 -0
- /package/dist/esm/{chunk-YUZPSUJE.js.map → chunk-F7IYL2VW.js.map} +0 -0
- /package/dist/esm/{chunk-FVCWNSRU.js.map → chunk-FHOCUZDR.js.map} +0 -0
- /package/dist/esm/{chunk-7MURQ6CR.js.map → chunk-FLFAXVFB.js.map} +0 -0
- /package/dist/esm/{chunk-APRBRAOT.js.map → chunk-FOEZLQTW.js.map} +0 -0
- /package/dist/esm/{chunk-WNSPLWRV.js.map → chunk-GJSGKE7B.js.map} +0 -0
- /package/dist/esm/{chunk-OGOOZLUD.js.map → chunk-GLERJXVS.js.map} +0 -0
- /package/dist/esm/{chunk-6VGPTAHM.js.map → chunk-GWXVETMF.js.map} +0 -0
- /package/dist/esm/{chunk-ES7MK2MM.js.map → chunk-GYBLXQ4R.js.map} +0 -0
- /package/dist/esm/{chunk-4OBMRJHC.js.map → chunk-H7ST535H.js.map} +0 -0
- /package/dist/esm/{chunk-QLZ5XAW6.js.map → chunk-HF5WY5YE.js.map} +0 -0
- /package/dist/esm/{chunk-RDP4UQ42.js.map → chunk-IEWCQU2S.js.map} +0 -0
- /package/dist/esm/{chunk-XLOHPURR.js.map → chunk-IHK3H2OM.js.map} +0 -0
- /package/dist/esm/{chunk-3F6I7YOR.js.map → chunk-JDGJSNWT.js.map} +0 -0
- /package/dist/esm/{chunk-VF5TRT3H.js.map → chunk-KKM6T5P7.js.map} +0 -0
- /package/dist/esm/{chunk-ZHYOJNWV.js.map → chunk-LKAK5GXF.js.map} +0 -0
- /package/dist/esm/{chunk-JCYI4NTV.js.map → chunk-MBCBP73P.js.map} +0 -0
- /package/dist/esm/{chunk-UYNYUR7O.js.map → chunk-MBE2YSBU.js.map} +0 -0
- /package/dist/esm/{chunk-H2G446JG.js.map → chunk-NMKPFUNP.js.map} +0 -0
- /package/dist/esm/{chunk-4N5JU7XQ.js.map → chunk-O3CDWEZA.js.map} +0 -0
- /package/dist/esm/{chunk-TEULZKBM.js.map → chunk-OGXZHAQL.js.map} +0 -0
- /package/dist/esm/{chunk-2AEELIG6.js.map → chunk-OWAUCLRT.js.map} +0 -0
- /package/dist/esm/{chunk-7CXVHFMQ.js.map → chunk-P7HYVJSU.js.map} +0 -0
- /package/dist/esm/{chunk-4532RT2B.js.map → chunk-P7IAHW4V.js.map} +0 -0
- /package/dist/esm/{chunk-M3ZYJANH.js.map → chunk-PQZXQ4ST.js.map} +0 -0
- /package/dist/esm/{chunk-SGU4HUHF.js.map → chunk-PTLFMWCN.js.map} +0 -0
- /package/dist/esm/{chunk-E6IWYD3U.js.map → chunk-S5C5YRBS.js.map} +0 -0
- /package/dist/esm/{chunk-A24PYRVV.js.map → chunk-SO67YEVQ.js.map} +0 -0
- /package/dist/esm/{chunk-HACQF6F4.js.map → chunk-TOOSHJOA.js.map} +0 -0
- /package/dist/esm/{chunk-QOWA5LK5.js.map → chunk-U2X2CAW4.js.map} +0 -0
- /package/dist/esm/{chunk-U7AASKZI.js.map → chunk-UVCH7QKO.js.map} +0 -0
- /package/dist/esm/{chunk-GWYFT3EI.js.map → chunk-VLO7NXSP.js.map} +0 -0
- /package/dist/esm/{chunk-DXI5P5O4.js.map → chunk-VX6ARMWP.js.map} +0 -0
- /package/dist/esm/{chunk-EJWAAFCI.js.map → chunk-WO43WW3A.js.map} +0 -0
- /package/dist/esm/{chunk-GLC4QJBF.js.map → chunk-WTYNFBFV.js.map} +0 -0
- /package/dist/esm/{chunk-6FAICIYS.js.map → chunk-XMRIRFM7.js.map} +0 -0
- /package/dist/esm/{chunk-UIEUZLZZ.js.map → chunk-ZY6SQWHT.js.map} +0 -0
package/src/components/shell.tsx
CHANGED
|
@@ -36,6 +36,7 @@ import { omitPaneProps, extractPaneDomProps, mapResponsiveBooleanToPaneMode } fr
|
|
|
36
36
|
import { Sidebar } from './_internal/shell-sidebar.js';
|
|
37
37
|
import { Bottom } from './_internal/shell-bottom.js';
|
|
38
38
|
import { Inspector } from './_internal/shell-inspector.js';
|
|
39
|
+
import { _BREAKPOINTS } from './shell.types.js';
|
|
39
40
|
import type { PresentationValue, ResponsivePresentation, PaneMode, SidebarMode, PaneSizePersistence, Breakpoint, PaneTarget, Responsive, PaneBaseProps, CSSPropertiesWithVars } from './shell.types.js';
|
|
40
41
|
import { normalizeToPx } from '../helpers/normalize-to-px.js';
|
|
41
42
|
import { useBreakpoint } from '../hooks/use-breakpoint.js';
|
|
@@ -222,114 +223,143 @@ interface ShellRootProps extends React.ComponentPropsWithoutRef<'div'> {
|
|
|
222
223
|
height?: 'full' | 'auto' | string | number;
|
|
223
224
|
}
|
|
224
225
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
226
|
+
/**
|
|
227
|
+
* Read the pane modes a set of Shell children asks for.
|
|
228
|
+
*
|
|
229
|
+
* Runs once at mount, for the reducer's initial state, and again whenever a
|
|
230
|
+
* pane family enters after mount. Pure - it only reads the children's props.
|
|
231
|
+
*/
|
|
232
|
+
/**
|
|
233
|
+
* Pick the entry of a responsive map that applies at `breakpoint`, falling
|
|
234
|
+
* back down the scale the way useResponsiveValue does. With no breakpoint it
|
|
235
|
+
* takes `initial`, which is what the mount path has always done.
|
|
236
|
+
*/
|
|
237
|
+
function pickResponsive<T>(map: Partial<Record<Breakpoint, T>>, breakpoint?: Breakpoint): T | undefined {
|
|
238
|
+
if (breakpoint === undefined) return (map.initial ?? Object.values(map)[0]) as T | undefined;
|
|
239
|
+
if (map[breakpoint] !== undefined) return map[breakpoint];
|
|
240
|
+
|
|
241
|
+
const bpKeys = Object.keys(_BREAKPOINTS) as Array<keyof typeof _BREAKPOINTS>;
|
|
242
|
+
const order: Breakpoint[] = ([...bpKeys].reverse() as Breakpoint[]).concat('initial' as Breakpoint);
|
|
243
|
+
for (let i = order.indexOf(breakpoint) + 1; i < order.length; i++) {
|
|
244
|
+
if (map[order[i]] !== undefined) return map[order[i]];
|
|
245
|
+
}
|
|
246
|
+
return undefined;
|
|
247
|
+
}
|
|
230
248
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
const [paneState, dispatchPane] = React.useReducer(paneReducer, children, (initialChildren) => {
|
|
234
|
-
const childArray = React.Children.toArray(initialChildren) as React.ReactElement[];
|
|
249
|
+
function readPaneStateFromChildren(initialChildren: React.ReactNode, breakpoint?: Breakpoint): PaneState & { hasPanelDefaultOpen: boolean } {
|
|
250
|
+
const childArray = React.Children.toArray(initialChildren) as React.ReactElement[];
|
|
235
251
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
// Store for use in passthrough props
|
|
241
|
-
hasPanelDefaultOpenRef.current = hasPanelDefaultOpen;
|
|
252
|
+
// Compute initial defaults from immediate children (one-time, uncontrolled defaults)
|
|
253
|
+
const hasPanelDefaultOpen = childArray.some(
|
|
254
|
+
(el) => React.isValidElement(el) && (el as any).type?.displayName === 'Shell.Panel' && Boolean((el as any).props?.defaultOpen),
|
|
255
|
+
);
|
|
242
256
|
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
+
// Rail defaults to open (true) unless explicitly set to false
|
|
258
|
+
// Supports responsive objects: { initial: false, md: true }
|
|
259
|
+
const railEl = childArray.find((el) => React.isValidElement(el) && (el as any).type?.displayName === 'Shell.Rail');
|
|
260
|
+
const railDefaultOpen = railEl ? (railEl as any).props?.defaultOpen : undefined;
|
|
261
|
+
const hasRailDefaultOpen = (() => {
|
|
262
|
+
if (!railEl) return false;
|
|
263
|
+
if (railDefaultOpen === undefined) return true; // Default to open
|
|
264
|
+
if (typeof railDefaultOpen === 'boolean') return railDefaultOpen;
|
|
265
|
+
// Responsive object - use 'initial' value, or first defined value, or default true
|
|
266
|
+
if (typeof railDefaultOpen === 'object') {
|
|
267
|
+
return railDefaultOpen.initial ?? Object.values(railDefaultOpen)[0] ?? true;
|
|
268
|
+
}
|
|
269
|
+
return true;
|
|
270
|
+
})();
|
|
257
271
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
272
|
+
const hasInspectorDefaultOpen = childArray.some(
|
|
273
|
+
(el) => React.isValidElement(el) && (el as any).type?.displayName === 'Shell.Inspector' && Boolean((el as any).props?.defaultOpen),
|
|
274
|
+
);
|
|
275
|
+
const hasInspectorOpenControlled = childArray.some(
|
|
276
|
+
(el) =>
|
|
277
|
+
React.isValidElement(el) &&
|
|
278
|
+
(el as any).type?.displayName === 'Shell.Inspector' &&
|
|
279
|
+
typeof (el as any).props?.open !== 'undefined' &&
|
|
280
|
+
Boolean((el as any).props?.open),
|
|
281
|
+
);
|
|
268
282
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
283
|
+
// Detect Panel controlled open state for initial reducer state
|
|
284
|
+
const hasPanelOpenControlled = childArray.some((el) => {
|
|
285
|
+
if (!React.isValidElement(el) || (el as any).type?.displayName !== 'Shell.Panel') return false;
|
|
286
|
+
const openProp = (el as any).props?.open;
|
|
287
|
+
if (typeof openProp === 'undefined') return false;
|
|
288
|
+
if (typeof openProp === 'boolean') return openProp;
|
|
289
|
+
// Responsive object - check 'initial' or first truthy value
|
|
290
|
+
if (typeof openProp === 'object' && openProp !== null) {
|
|
291
|
+
return openProp.initial ?? Object.values(openProp)[0] ?? false;
|
|
292
|
+
}
|
|
293
|
+
return false;
|
|
294
|
+
});
|
|
281
295
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
}
|
|
296
|
+
// Detect Sidebar initial state from props
|
|
297
|
+
const getSidebarInitialState = (): SidebarMode => {
|
|
298
|
+
const sidebarEl = childArray.find((el) => React.isValidElement(el) && (el as any).type?.displayName === 'Shell.Sidebar');
|
|
299
|
+
if (!sidebarEl) return 'expanded';
|
|
300
|
+
const sidebarProps = (sidebarEl as any).props;
|
|
301
|
+
// Check controlled state first
|
|
302
|
+
if (typeof sidebarProps?.state !== 'undefined') {
|
|
303
|
+
if (typeof sidebarProps.state === 'string') return sidebarProps.state as SidebarMode;
|
|
304
|
+
// Responsive object - use 'initial' breakpoint or first defined value
|
|
305
|
+
if (typeof sidebarProps.state === 'object') {
|
|
306
|
+
return (pickResponsive<SidebarMode>(sidebarProps.state, breakpoint) ?? 'expanded') as SidebarMode;
|
|
294
307
|
}
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
308
|
+
}
|
|
309
|
+
// Check defaultState
|
|
310
|
+
if (typeof sidebarProps?.defaultState !== 'undefined') {
|
|
311
|
+
if (typeof sidebarProps.defaultState === 'string') return sidebarProps.defaultState as SidebarMode;
|
|
312
|
+
if (typeof sidebarProps.defaultState === 'object') {
|
|
313
|
+
return (pickResponsive<SidebarMode>(sidebarProps.defaultState, breakpoint) ?? 'expanded') as SidebarMode;
|
|
301
314
|
}
|
|
302
|
-
|
|
303
|
-
|
|
315
|
+
}
|
|
316
|
+
return 'expanded';
|
|
317
|
+
};
|
|
304
318
|
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
}
|
|
319
|
+
// Detect Bottom initial state from props
|
|
320
|
+
const getBottomInitialState = (): PaneMode => {
|
|
321
|
+
const bottomEl = childArray.find((el) => React.isValidElement(el) && (el as any).type?.displayName === 'Shell.Bottom');
|
|
322
|
+
if (!bottomEl) return 'collapsed';
|
|
323
|
+
const bottomProps = (bottomEl as any).props;
|
|
324
|
+
// Check controlled open first
|
|
325
|
+
if (typeof bottomProps?.open !== 'undefined') {
|
|
326
|
+
if (typeof bottomProps.open === 'boolean') return bottomProps.open ? 'expanded' : 'collapsed';
|
|
327
|
+
// Responsive object - use 'initial' breakpoint or first defined value
|
|
328
|
+
if (typeof bottomProps.open === 'object') {
|
|
329
|
+
const val = bottomProps.open.initial ?? Object.values(bottomProps.open)[0];
|
|
330
|
+
return val ? 'expanded' : 'collapsed';
|
|
318
331
|
}
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
332
|
+
}
|
|
333
|
+
// Check defaultOpen
|
|
334
|
+
if (typeof bottomProps?.defaultOpen !== 'undefined') {
|
|
335
|
+
return bottomProps.defaultOpen ? 'expanded' : 'collapsed';
|
|
336
|
+
}
|
|
337
|
+
return 'collapsed';
|
|
338
|
+
};
|
|
325
339
|
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
340
|
+
return {
|
|
341
|
+
hasPanelDefaultOpen,
|
|
342
|
+
leftMode: hasPanelDefaultOpen || hasPanelOpenControlled || hasRailDefaultOpen ? 'expanded' : ('collapsed' as PaneMode),
|
|
343
|
+
panelMode: hasPanelDefaultOpen || hasPanelOpenControlled ? 'expanded' : ('collapsed' as PaneMode),
|
|
344
|
+
sidebarMode: getSidebarInitialState(),
|
|
345
|
+
inspectorMode: hasInspectorDefaultOpen || hasInspectorOpenControlled ? 'expanded' : ('collapsed' as PaneMode),
|
|
346
|
+
bottomMode: getBottomInitialState(),
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
const Root = React.forwardRef<HTMLDivElement, ShellRootProps>(({ className, children, height = 'full', ...props }, ref) => {
|
|
351
|
+
const { breakpoint: currentBreakpoint, ready: currentBreakpointReady } = useBreakpoint();
|
|
352
|
+
|
|
353
|
+
// Store hasPanelDefaultOpen for use in passthrough props (computed once during lazy init)
|
|
354
|
+
const hasPanelDefaultOpenRef = React.useRef<boolean>(false);
|
|
355
|
+
|
|
356
|
+
// Pane state management via reducer with lazy initialization
|
|
357
|
+
// This computation only runs once on mount, not on every render
|
|
358
|
+
const [paneState, dispatchPane] = React.useReducer(paneReducer, children, (initialChildren) => {
|
|
359
|
+
const { hasPanelDefaultOpen, ...modes } = readPaneStateFromChildren(initialChildren);
|
|
360
|
+
// Store for use in passthrough props
|
|
361
|
+
hasPanelDefaultOpenRef.current = hasPanelDefaultOpen;
|
|
362
|
+
return modes;
|
|
333
363
|
});
|
|
334
364
|
const setLeftMode = React.useCallback((mode: PaneMode) => dispatchPane({ type: 'SET_LEFT_MODE', mode }), []);
|
|
335
365
|
const setPanelMode = React.useCallback((mode: PaneMode) => dispatchPane({ type: 'SET_PANEL_MODE', mode }), []);
|
|
@@ -381,6 +411,47 @@ const Root = React.forwardRef<HTMLDivElement, ShellRootProps>(({ className, chil
|
|
|
381
411
|
return childArray.some((el) => isShellComponentType(el, Sidebar));
|
|
382
412
|
}, [children]);
|
|
383
413
|
|
|
414
|
+
// Re-read the defaults when a pane family enters after mount.
|
|
415
|
+
//
|
|
416
|
+
// The initial modes are computed once, from the children present at mount.
|
|
417
|
+
// That is right until an app swaps families at runtime - a Sidebar giving
|
|
418
|
+
// way to Rail+Panel on one route, and back on the next. The entering pane
|
|
419
|
+
// then renders against the mode left behind by the family that just went:
|
|
420
|
+
// a Rail mounting 'collapsed', at width 0, with its content faded out, put
|
|
421
|
+
// right one layout effect later. The reader sees a flicker in place where
|
|
422
|
+
// the pane should have been there already.
|
|
423
|
+
//
|
|
424
|
+
// Adjusting state during render keeps this out of the paint: React re-runs
|
|
425
|
+
// Root before the children render, so the entering pane never sees the
|
|
426
|
+
// mode of the family it replaced. The ref guard is what makes the update
|
|
427
|
+
// terminate - it fires only on the edge, never on a steady render.
|
|
428
|
+
const enteredFamilyRef = React.useRef({ left: hasLeftChildren, sidebar: hasSidebarChildren });
|
|
429
|
+
if (enteredFamilyRef.current.left !== hasLeftChildren || enteredFamilyRef.current.sidebar !== hasSidebarChildren) {
|
|
430
|
+
const leftEntered = hasLeftChildren && !enteredFamilyRef.current.left;
|
|
431
|
+
const sidebarEntered = hasSidebarChildren && !enteredFamilyRef.current.sidebar;
|
|
432
|
+
enteredFamilyRef.current = { left: hasLeftChildren, sidebar: hasSidebarChildren };
|
|
433
|
+
|
|
434
|
+
if (leftEntered || sidebarEntered) {
|
|
435
|
+
// The live breakpoint, not the mount default: a responsive
|
|
436
|
+
// defaultState like { initial: 'collapsed', md: 'expanded' } must be
|
|
437
|
+
// read for the width the reader is on. Taking `initial` would send a
|
|
438
|
+
// desktop sidebar in collapsed and let its own start-up effect open it
|
|
439
|
+
// again after the paint, which is the blink this whole block exists to
|
|
440
|
+
// remove.
|
|
441
|
+
const { hasPanelDefaultOpen, ...modes } = readPaneStateFromChildren(children, currentBreakpoint as Breakpoint);
|
|
442
|
+
if (leftEntered) {
|
|
443
|
+
hasPanelDefaultOpenRef.current = hasPanelDefaultOpen;
|
|
444
|
+
// Only when the mode actually differs, so a family that enters
|
|
445
|
+
// already in the right mode dispatches nothing.
|
|
446
|
+
if (modes.leftMode !== paneState.leftMode) dispatchPane({ type: 'SET_LEFT_MODE', mode: modes.leftMode });
|
|
447
|
+
if (modes.panelMode !== paneState.panelMode) dispatchPane({ type: 'SET_PANEL_MODE', mode: modes.panelMode });
|
|
448
|
+
}
|
|
449
|
+
if (sidebarEntered && modes.sidebarMode !== paneState.sidebarMode) {
|
|
450
|
+
dispatchPane({ type: 'SET_SIDEBAR_MODE', mode: modes.sidebarMode });
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
|
|
384
455
|
// Keep a ref to sidebar mode so togglePane doesn't depend on it,
|
|
385
456
|
// preventing ActionsContext churn on every sidebar mode change
|
|
386
457
|
const sidebarModeRef = React.useRef(paneState.sidebarMode);
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
*/
|
|
21
21
|
:where([data-panel-background='translucent'], [data-material='translucent']) & {
|
|
22
22
|
backdrop-filter: var(--backdrop-filter-components);
|
|
23
|
-
--backdrop-filter-components:
|
|
23
|
+
--backdrop-filter-components: var(--backdrop-filter-components-enabled);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
/* Prevent backdrop-filter stacking with parent elements */
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
|
|
38
38
|
&:where([data-panel-background='translucent'], [data-material='translucent']) {
|
|
39
39
|
backdrop-filter: var(--backdrop-filter-components);
|
|
40
|
-
--backdrop-filter-components:
|
|
40
|
+
--backdrop-filter-components: var(--backdrop-filter-components-enabled);
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
&:where([data-orientation='horizontal']) {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
*/
|
|
21
21
|
:where([data-panel-background='translucent'], [data-material='translucent']) & {
|
|
22
22
|
backdrop-filter: var(--backdrop-filter-components);
|
|
23
|
-
--backdrop-filter-components:
|
|
23
|
+
--backdrop-filter-components: var(--backdrop-filter-components-enabled);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
/* Prevent backdrop-filter stacking with parent elements */
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
|
|
38
38
|
&:where([data-panel-background='translucent'], [data-material='translucent']) {
|
|
39
39
|
backdrop-filter: var(--backdrop-filter-components);
|
|
40
|
-
--backdrop-filter-components:
|
|
40
|
+
--backdrop-filter-components: var(--backdrop-filter-components-enabled);
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
&::before {
|
package/src/components/table.css
CHANGED
|
@@ -121,6 +121,13 @@
|
|
|
121
121
|
/* surface */
|
|
122
122
|
|
|
123
123
|
.rt-TableRoot:where(.rt-variant-surface) {
|
|
124
|
+
/*
|
|
125
|
+
* This surface blurs its own backdrop, which makes it the backdrop root for
|
|
126
|
+
* everything inside it. A component nested here would re-blur an already
|
|
127
|
+
* blurred, already flat surface for the full cost of another blur pass, so
|
|
128
|
+
* switch the component filter off for the subtree. See tokens/blur.css.
|
|
129
|
+
*/
|
|
130
|
+
--backdrop-filter-components-enabled: none;
|
|
124
131
|
box-sizing: border-box;
|
|
125
132
|
border: 1px solid var(--gray-a5);
|
|
126
133
|
border-radius: var(--table-border-radius);
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
/* Theme-level translucent override */
|
|
48
48
|
:where([data-panel-background='translucent'], [data-material='translucent']) & {
|
|
49
49
|
backdrop-filter: var(--backdrop-filter-components);
|
|
50
|
-
--backdrop-filter-components:
|
|
50
|
+
--backdrop-filter-components: var(--backdrop-filter-components-enabled);
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
/* Prevent backdrop-filter stacking with parents */
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
|
|
62
62
|
&:where([data-panel-background='translucent'], [data-material='translucent']) {
|
|
63
63
|
backdrop-filter: var(--backdrop-filter-components);
|
|
64
|
-
--backdrop-filter-components:
|
|
64
|
+
--backdrop-filter-components: var(--backdrop-filter-components-enabled);
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
&:where(:focus-within) {
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
/* Theme-level translucent override */
|
|
13
13
|
:where([data-panel-background='translucent'], [data-material='translucent']) & {
|
|
14
14
|
backdrop-filter: var(--backdrop-filter-components);
|
|
15
|
-
--backdrop-filter-components:
|
|
15
|
+
--backdrop-filter-components: var(--backdrop-filter-components-enabled);
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
/* Prevent backdrop-filter stacking with parents */
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
|
|
27
27
|
&:where([data-panel-background='translucent'], [data-material='translucent']) {
|
|
28
28
|
backdrop-filter: var(--backdrop-filter-components);
|
|
29
|
-
--backdrop-filter-components:
|
|
29
|
+
--backdrop-filter-components: var(--backdrop-filter-components-enabled);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
@supports selector(:has(*)) {
|
package/src/components/theme.tsx
CHANGED
|
@@ -3,8 +3,11 @@
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import classNames from 'classnames';
|
|
5
5
|
import { Direction, Slot, Tooltip as TooltipPrimitive } from 'radix-ui';
|
|
6
|
+
import { useComposedRefs, useLayoutEffect } from 'radix-ui/internal';
|
|
6
7
|
|
|
7
8
|
import { getMatchingGrayColor } from '../helpers/get-matching-gray-color.js';
|
|
9
|
+
import { usePropSyncedState } from '../hooks/use-prop-synced-state.js';
|
|
10
|
+
import { useDeprecatedPanelBackgroundWarning } from '../helpers/use-deprecation-warning.js';
|
|
8
11
|
import { themePropDefs } from './theme.props.js';
|
|
9
12
|
|
|
10
13
|
import type { ThemeOwnProps } from './theme.props.js';
|
|
@@ -104,42 +107,27 @@ const ThemeRoot = React.forwardRef<ThemeImplElement, ThemeImplPublicProps>(
|
|
|
104
107
|
...rootProps
|
|
105
108
|
} = props;
|
|
106
109
|
|
|
107
|
-
|
|
108
|
-
React.useEffect(() => {
|
|
109
|
-
if (props.panelBackground !== undefined) {
|
|
110
|
-
console.warn(
|
|
111
|
-
'Warning: The `panelBackground` prop is deprecated and will be removed in a future version. Use `material` prop instead.',
|
|
112
|
-
);
|
|
113
|
-
}
|
|
114
|
-
}, [props.panelBackground]);
|
|
110
|
+
useDeprecatedPanelBackgroundWarning(props.panelBackground);
|
|
115
111
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
const [grayColor, setGrayColor] =
|
|
123
|
-
React.useEffect(() => setGrayColor(grayColorProp), [grayColorProp]);
|
|
112
|
+
// Each of these follows its prop but stays independently settable, so
|
|
113
|
+
// `ThemePanel` can change the theme at runtime. Syncing during render
|
|
114
|
+
// rather than in an effect matters here: an effect would commit the old
|
|
115
|
+
// theme first and re-render every consumer of the context a second time.
|
|
116
|
+
const [appearance, setAppearance] = usePropSyncedState(appearanceProp);
|
|
117
|
+
const [accentColor, setAccentColor] = usePropSyncedState(accentColorProp);
|
|
118
|
+
const [grayColor, setGrayColor] = usePropSyncedState(grayColorProp);
|
|
124
119
|
|
|
125
120
|
// Material takes precedence over panelBackground
|
|
126
121
|
const effectiveMaterial =
|
|
127
122
|
materialProp !== themePropDefs.material.default ? materialProp : panelBackgroundProp;
|
|
128
|
-
const [material, setMaterial] =
|
|
129
|
-
React.useEffect(() => setMaterial(effectiveMaterial), [effectiveMaterial]);
|
|
123
|
+
const [material, setMaterial] = usePropSyncedState(effectiveMaterial);
|
|
130
124
|
|
|
131
125
|
// Keep panelBackground in sync with material for backward compatibility
|
|
132
|
-
const [panelBackground, setPanelBackground] =
|
|
133
|
-
React.useEffect(() => setPanelBackground(material), [material]);
|
|
134
|
-
|
|
135
|
-
const [radius, setRadius] = React.useState(radiusProp);
|
|
136
|
-
React.useEffect(() => setRadius(radiusProp), [radiusProp]);
|
|
137
|
-
|
|
138
|
-
const [scaling, setScaling] = React.useState(scalingProp);
|
|
139
|
-
React.useEffect(() => setScaling(scalingProp), [scalingProp]);
|
|
126
|
+
const [panelBackground, setPanelBackground] = usePropSyncedState(material);
|
|
140
127
|
|
|
141
|
-
const [
|
|
142
|
-
|
|
128
|
+
const [radius, setRadius] = usePropSyncedState(radiusProp);
|
|
129
|
+
const [scaling, setScaling] = usePropSyncedState(scalingProp);
|
|
130
|
+
const [fontFamily, setFontFamily] = usePropSyncedState(fontFamilyProp);
|
|
143
131
|
|
|
144
132
|
return (
|
|
145
133
|
<ThemeImpl
|
|
@@ -223,10 +211,24 @@ const ThemeImpl = React.forwardRef<ThemeImplElement, ThemeImplProps>((props, for
|
|
|
223
211
|
const hasBackground =
|
|
224
212
|
hasBackgroundProp === undefined ? isRoot || isExplicitAppearance : hasBackgroundProp;
|
|
225
213
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
214
|
+
// `data-os` can only be resolved on the client. Writing it straight to the
|
|
215
|
+
// DOM keeps it out of the server markup — so hydration still matches — without
|
|
216
|
+
// spending a render pass, and a state update here would re-render the whole
|
|
217
|
+
// application on mount.
|
|
218
|
+
const rootRef = React.useRef<ThemeImplElement>(null);
|
|
219
|
+
const composedRef = useComposedRefs(forwardedRef, rootRef);
|
|
220
|
+
const hasExplicitOS = 'data-os' in themeProps;
|
|
221
|
+
|
|
222
|
+
useLayoutEffect(() => {
|
|
223
|
+
if (!isRoot || hasExplicitOS) return;
|
|
224
|
+
const node = rootRef.current;
|
|
225
|
+
if (!node) return;
|
|
226
|
+
|
|
227
|
+
const os = getClientOS();
|
|
228
|
+
if (!os) return;
|
|
229
|
+
node.setAttribute('data-os', os);
|
|
230
|
+
return () => node.removeAttribute('data-os');
|
|
231
|
+
}, [isRoot, hasExplicitOS]);
|
|
230
232
|
|
|
231
233
|
return (
|
|
232
234
|
<ThemeContext.Provider
|
|
@@ -284,8 +286,7 @@ const ThemeImpl = React.forwardRef<ThemeImplElement, ThemeImplProps>((props, for
|
|
|
284
286
|
data-radius={radius}
|
|
285
287
|
data-scaling={scaling}
|
|
286
288
|
data-font-family={fontFamily}
|
|
287
|
-
|
|
288
|
-
ref={forwardedRef}
|
|
289
|
+
ref={composedRef}
|
|
289
290
|
{...themeProps}
|
|
290
291
|
className={classNames(
|
|
291
292
|
'radix-themes',
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import type { PropDef } from '../props/prop-def.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A prop def pre-processed into the exact shape `extractProps` needs at render
|
|
5
|
+
* time. Everything that can be derived from the static prop def — enum
|
|
6
|
+
* membership sets, whether the def is responsive, whether it carries a default
|
|
7
|
+
* — is computed once here instead of on every render.
|
|
8
|
+
*/
|
|
9
|
+
interface CompiledPropDef {
|
|
10
|
+
key: string;
|
|
11
|
+
type: PropDef['type'];
|
|
12
|
+
default: unknown;
|
|
13
|
+
hasDefault: boolean;
|
|
14
|
+
responsive: boolean;
|
|
15
|
+
className?: string;
|
|
16
|
+
customProperties?: `--${string}`[];
|
|
17
|
+
parseValue?: (value: string) => string | undefined;
|
|
18
|
+
/** The prop def's own enum values, kept for the responsive class name helpers. */
|
|
19
|
+
values: readonly string[];
|
|
20
|
+
/** O(1) membership for `values`. */
|
|
21
|
+
valueSet: ReadonlySet<string>;
|
|
22
|
+
/**
|
|
23
|
+
* `values` plus the default, used to coerce invalid enum values back to the
|
|
24
|
+
* default. Only present for `type: 'enum'` — `'enum | string'` props accept
|
|
25
|
+
* arbitrary strings and must not be coerced.
|
|
26
|
+
*/
|
|
27
|
+
enumValueSet?: ReadonlySet<unknown>;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
interface CompiledPropDefs {
|
|
31
|
+
/** Defs that contribute a class name and/or custom properties. */
|
|
32
|
+
styling: CompiledPropDef[];
|
|
33
|
+
/**
|
|
34
|
+
* Defs that pass through to the element but still need a default applied or
|
|
35
|
+
* an invalid enum value coerced. Defs that can do neither are omitted
|
|
36
|
+
* entirely — they are already correct as passed.
|
|
37
|
+
*/
|
|
38
|
+
passthrough: CompiledPropDef[];
|
|
39
|
+
/** Keys consumed by `styling`, so they can be skipped when copying props. */
|
|
40
|
+
stylingKeys: ReadonlySet<string>;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const EMPTY_VALUES: readonly string[] = [];
|
|
44
|
+
const EMPTY_SET: ReadonlySet<string> = new Set();
|
|
45
|
+
|
|
46
|
+
function compile(propDefs: readonly Record<string, PropDef>[]): CompiledPropDefs {
|
|
47
|
+
const merged: Record<string, PropDef> = Object.assign({}, ...propDefs);
|
|
48
|
+
const styling: CompiledPropDef[] = [];
|
|
49
|
+
const passthrough: CompiledPropDef[] = [];
|
|
50
|
+
const stylingKeys = new Set<string>();
|
|
51
|
+
|
|
52
|
+
for (const key in merged) {
|
|
53
|
+
// The PropDef union is narrowed per-field below; reading the optional
|
|
54
|
+
// members off the union directly is what the runtime actually needs.
|
|
55
|
+
const def = merged[key] as PropDef & {
|
|
56
|
+
default?: unknown;
|
|
57
|
+
values?: readonly string[];
|
|
58
|
+
className?: string;
|
|
59
|
+
customProperties?: `--${string}`[];
|
|
60
|
+
parseValue?: (value: string) => string | undefined;
|
|
61
|
+
responsive?: true;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const values = def.values ?? EMPTY_VALUES;
|
|
65
|
+
const compiled: CompiledPropDef = {
|
|
66
|
+
key,
|
|
67
|
+
type: def.type,
|
|
68
|
+
default: def.default,
|
|
69
|
+
hasDefault: def.default !== undefined,
|
|
70
|
+
responsive: 'responsive' in def,
|
|
71
|
+
className: def.className,
|
|
72
|
+
customProperties: def.customProperties,
|
|
73
|
+
parseValue: def.parseValue,
|
|
74
|
+
values,
|
|
75
|
+
valueSet: values.length > 0 ? new Set(values) : EMPTY_SET,
|
|
76
|
+
enumValueSet: def.type === 'enum' ? new Set<unknown>([def.default, ...values]) : undefined,
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
if (def.className) {
|
|
80
|
+
styling.push(compiled);
|
|
81
|
+
stylingKeys.add(key);
|
|
82
|
+
} else if (compiled.hasDefault || def.type === 'enum') {
|
|
83
|
+
// Anything else is copied through untouched, so there is nothing to do.
|
|
84
|
+
passthrough.push(compiled);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return { styling, passthrough, stylingKeys };
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
interface CacheNode {
|
|
92
|
+
children: WeakMap<object, CacheNode>;
|
|
93
|
+
compiled?: CompiledPropDefs;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const cacheRoot: CacheNode = { children: new WeakMap() };
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Compiles a set of prop defs, memoized on the identity of the prop def objects
|
|
100
|
+
* themselves. Components always pass the same module-level constants, so after
|
|
101
|
+
* the first render of a given component this is a couple of WeakMap lookups
|
|
102
|
+
* instead of merging 50-odd prop defs into a fresh object.
|
|
103
|
+
*/
|
|
104
|
+
function getCompiledPropDefs(propDefs: readonly Record<string, PropDef>[]): CompiledPropDefs {
|
|
105
|
+
let node = cacheRoot;
|
|
106
|
+
|
|
107
|
+
for (let i = 0; i < propDefs.length; i++) {
|
|
108
|
+
const propDef = propDefs[i];
|
|
109
|
+
let child = node.children.get(propDef);
|
|
110
|
+
if (child === undefined) {
|
|
111
|
+
child = { children: new WeakMap() };
|
|
112
|
+
node.children.set(propDef, child);
|
|
113
|
+
}
|
|
114
|
+
node = child;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return (node.compiled ??= compile(propDefs));
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export { getCompiledPropDefs };
|
|
121
|
+
export type { CompiledPropDef, CompiledPropDefs };
|