@womp/kookie-ui 0.5.0 → 0.6.2
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 +306 -508
- package/dist/cjs/components/_internal/base-menu.utils.d.ts +48 -0
- package/dist/cjs/components/_internal/base-menu.utils.d.ts.map +1 -0
- package/dist/cjs/components/_internal/base-menu.utils.js +2 -0
- package/dist/cjs/components/_internal/base-menu.utils.js.map +7 -0
- package/dist/cjs/components/_internal/dropdown-menu-drill-down.d.ts +77 -59
- package/dist/cjs/components/_internal/dropdown-menu-drill-down.d.ts.map +1 -1
- package/dist/cjs/components/_internal/dropdown-menu-drill-down.js +1 -1
- package/dist/cjs/components/_internal/dropdown-menu-drill-down.js.map +4 -4
- package/dist/cjs/components/_internal/menu-context.d.ts +7 -3
- package/dist/cjs/components/_internal/menu-context.d.ts.map +1 -1
- package/dist/cjs/components/_internal/menu-context.js +1 -1
- package/dist/cjs/components/_internal/menu-context.js.map +4 -4
- package/dist/cjs/components/_internal/shell-bottom.js +1 -1
- package/dist/cjs/components/_internal/shell-bottom.js.map +2 -2
- package/dist/cjs/components/_internal/shell-inspector.js +1 -1
- package/dist/cjs/components/_internal/shell-inspector.js.map +2 -2
- package/dist/cjs/components/_internal/shell-sidebar.js +1 -1
- package/dist/cjs/components/_internal/shell-sidebar.js.map +2 -2
- package/dist/cjs/components/accordion.js +1 -1
- package/dist/cjs/components/alert-dialog.js +1 -1
- package/dist/cjs/components/alert-dialog.js.map +2 -2
- package/dist/cjs/components/badge.js +1 -1
- package/dist/cjs/components/badge.js.map +2 -2
- package/dist/cjs/components/blockquote.js +1 -1
- package/dist/cjs/components/button.js +1 -1
- package/dist/cjs/components/button.js.map +2 -2
- package/dist/cjs/components/callout.js +1 -1
- package/dist/cjs/components/callout.js.map +2 -2
- package/dist/cjs/components/card.js +1 -1
- package/dist/cjs/components/card.js.map +2 -2
- package/dist/cjs/components/chatbar.d.ts +46 -44
- package/dist/cjs/components/chatbar.d.ts.map +1 -1
- package/dist/cjs/components/chatbar.js +2 -2
- package/dist/cjs/components/chatbar.js.map +3 -3
- package/dist/cjs/components/checkbox-cards.js +1 -1
- package/dist/cjs/components/checkbox-cards.js.map +2 -2
- package/dist/cjs/components/checkbox-group.js +1 -1
- package/dist/cjs/components/checkbox.js +1 -1
- package/dist/cjs/components/combobox.d.ts +28 -15
- package/dist/cjs/components/combobox.d.ts.map +1 -1
- package/dist/cjs/components/combobox.js +1 -1
- package/dist/cjs/components/combobox.js.map +4 -4
- package/dist/cjs/components/combobox.props.d.ts +48 -0
- package/dist/cjs/components/combobox.props.d.ts.map +1 -1
- package/dist/cjs/components/combobox.props.js +1 -1
- package/dist/cjs/components/combobox.props.js.map +4 -4
- package/dist/cjs/components/context-menu.d.ts +18 -5
- 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/context-menu.props.d.ts +1 -1
- package/dist/cjs/components/context-menu.props.d.ts.map +1 -1
- package/dist/cjs/components/context-menu.props.js +1 -1
- package/dist/cjs/components/context-menu.props.js.map +3 -3
- package/dist/cjs/components/dialog.js +1 -1
- package/dist/cjs/components/dialog.js.map +2 -2
- package/dist/cjs/components/dropdown-menu.d.ts +11 -18
- 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/heading.js +1 -1
- package/dist/cjs/components/hover-card.js +1 -1
- package/dist/cjs/components/hover-card.js.map +2 -2
- package/dist/cjs/components/icon-button.js +1 -1
- package/dist/cjs/components/icon-button.js.map +2 -2
- package/dist/cjs/components/index.js +5 -5
- package/dist/cjs/components/index.js.map +4 -4
- package/dist/cjs/components/link.js +1 -1
- package/dist/cjs/components/popover.js +1 -1
- package/dist/cjs/components/popover.js.map +2 -2
- package/dist/cjs/components/radio-cards.js +1 -1
- package/dist/cjs/components/radio-cards.js.map +2 -2
- package/dist/cjs/components/radio.js +1 -1
- package/dist/cjs/components/radio.js.map +2 -2
- package/dist/cjs/components/schemas/base-button.schema.d.ts +111 -256
- package/dist/cjs/components/schemas/base-button.schema.d.ts.map +1 -1
- package/dist/cjs/components/schemas/button.schema.d.ts +136 -557
- package/dist/cjs/components/schemas/button.schema.d.ts.map +1 -1
- package/dist/cjs/components/schemas/icon-button.schema.d.ts +123 -240
- package/dist/cjs/components/schemas/icon-button.schema.d.ts.map +1 -1
- package/dist/cjs/components/schemas/index.js +1 -1
- package/dist/cjs/components/schemas/index.js.map +2 -2
- package/dist/cjs/components/schemas/shell.schema.d.ts +592 -851
- package/dist/cjs/components/schemas/shell.schema.d.ts.map +1 -1
- package/dist/cjs/components/schemas/shell.schema.js +1 -1
- package/dist/cjs/components/schemas/shell.schema.js.map +2 -2
- package/dist/cjs/components/schemas/toggle-button.schema.d.ts +138 -1026
- package/dist/cjs/components/schemas/toggle-button.schema.d.ts.map +1 -1
- package/dist/cjs/components/schemas/toggle-icon-button.schema.d.ts +124 -465
- package/dist/cjs/components/schemas/toggle-icon-button.schema.d.ts.map +1 -1
- package/dist/cjs/components/scroll-area.js +1 -1
- package/dist/cjs/components/segmented-control.js +1 -1
- package/dist/cjs/components/select.js +1 -1
- package/dist/cjs/components/select.js.map +2 -2
- package/dist/cjs/components/sheet.js +1 -1
- package/dist/cjs/components/sheet.js.map +2 -2
- package/dist/cjs/components/shell.js +1 -1
- package/dist/cjs/components/shell.js.map +3 -3
- package/dist/cjs/components/sidebar.js +1 -1
- package/dist/cjs/components/sidebar.js.map +4 -4
- package/dist/cjs/components/slider.js +1 -1
- package/dist/cjs/components/slot.d.ts +6 -2
- package/dist/cjs/components/slot.d.ts.map +1 -1
- package/dist/cjs/components/switch.js +1 -1
- package/dist/cjs/components/tab-nav.js +1 -1
- package/dist/cjs/components/text-field.js +2 -2
- package/dist/cjs/components/text.js +1 -1
- package/dist/cjs/components/theme-panel.js +3 -3
- package/dist/cjs/components/theme-panel.js.map +2 -2
- package/dist/cjs/components/theme.js +1 -1
- package/dist/cjs/components/theme.js.map +2 -2
- package/dist/cjs/components/theme.props.d.ts +1 -1
- package/dist/cjs/components/theme.props.js +1 -1
- package/dist/cjs/components/theme.props.js.map +2 -2
- package/dist/cjs/components/toggle-button.js +1 -1
- package/dist/cjs/components/toggle-button.js.map +2 -2
- package/dist/cjs/components/toggle-icon-button.js +1 -1
- package/dist/cjs/components/toggle-icon-button.js.map +2 -2
- package/dist/cjs/components/tooltip.js +1 -1
- package/dist/cjs/components/tooltip.js.map +2 -2
- package/dist/cjs/components/user-card.js +1 -1
- package/dist/cjs/components/user-card.js.map +2 -2
- package/dist/cjs/components/virtual-menu.d.ts.map +1 -1
- package/dist/cjs/components/virtual-menu.js +1 -1
- package/dist/cjs/components/virtual-menu.js.map +4 -4
- package/dist/cjs/helpers/extract-props.js +1 -1
- package/dist/cjs/helpers/extract-props.js.map +2 -2
- package/dist/cjs/helpers/get-margin-styles.js +1 -1
- package/dist/cjs/helpers/get-margin-styles.js.map +2 -2
- package/dist/cjs/hooks/use-breakpoint.d.ts +4 -1
- 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/index.js +5 -5
- package/dist/cjs/index.js.map +4 -4
- package/dist/cjs/props/index.js +1 -1
- package/dist/cjs/props/index.js.map +3 -3
- package/dist/esm/{chunk-P7HYVJSU.js → chunk-2TIADHPD.js} +2 -2
- package/dist/esm/chunk-37OGSEQR.js +2 -0
- package/dist/esm/chunk-37OGSEQR.js.map +7 -0
- package/dist/esm/{chunk-RMKXWYOV.js → chunk-3OBXZUFJ.js} +2 -2
- package/dist/esm/{chunk-S2HA3W3V.js → chunk-3R7XMRV5.js} +2 -2
- package/dist/esm/chunk-4SMJ7D4S.js +2 -0
- package/dist/esm/chunk-4SMJ7D4S.js.map +7 -0
- package/dist/esm/{chunk-S56YSRHP.js → chunk-56TS6OKQ.js} +2 -2
- package/dist/esm/{chunk-2FYJTSOP.js → chunk-5BYHEYO6.js} +2 -2
- package/dist/esm/{chunk-B24BDVG2.js → chunk-5MNBQROW.js} +2 -2
- package/dist/esm/{chunk-W7N7V5YD.js → chunk-7ESHXHHO.js} +2 -2
- package/dist/esm/{chunk-CRWYCLTE.js → chunk-ABSKRHVM.js} +2 -2
- package/dist/esm/chunk-ADBLURLJ.js +2 -0
- package/dist/esm/chunk-ADBLURLJ.js.map +7 -0
- package/dist/esm/{chunk-3MWWP4MW.js → chunk-BBJUB52V.js} +2 -2
- package/dist/esm/{chunk-PTLFMWCN.js → chunk-CQNPBTM5.js} +2 -2
- package/dist/esm/{chunk-GJSGKE7B.js → chunk-CTA5ODAO.js} +2 -2
- package/dist/esm/{chunk-GWXVETMF.js → chunk-DCAZPMOB.js} +2 -2
- package/dist/esm/{chunk-PLWXTEVE.js → chunk-DMJJM5IS.js} +2 -2
- package/dist/esm/{chunk-A2RZGGMY.js → chunk-DQAUX5ZL.js} +2 -2
- package/dist/esm/{chunk-6XGZPIUT.js → chunk-DX5JJYMZ.js} +2 -2
- package/dist/esm/{chunk-6XGZPIUT.js.map → chunk-DX5JJYMZ.js.map} +2 -2
- package/dist/esm/{chunk-YUP6EICB.js → chunk-DXL6V2A5.js} +2 -2
- package/dist/esm/{chunk-XMRIRFM7.js → chunk-FG7XM7KJ.js} +2 -2
- package/dist/esm/{chunk-IKSN4RNB.js → chunk-FIB3XATL.js} +3 -3
- package/dist/esm/chunk-FMBECDL4.js +2 -0
- package/dist/esm/{chunk-4XJY6FIK.js.map → chunk-FMBECDL4.js.map} +3 -3
- package/dist/esm/{chunk-374ZYJUP.js → chunk-HBR42MIX.js} +2 -2
- package/dist/esm/{chunk-2UPAYDKR.js → chunk-HIKVMKYQ.js} +2 -2
- package/dist/esm/{chunk-VX6ARMWP.js → chunk-HSAG7C53.js} +2 -2
- package/dist/esm/{chunk-OSRJRBKP.js → chunk-HW324FK3.js} +2 -2
- package/dist/esm/{chunk-DNHUQLXO.js → chunk-JBO5YOUM.js} +2 -2
- package/dist/esm/{chunk-HF5WY5YE.js → chunk-JGLAE5G7.js} +2 -2
- package/dist/esm/{chunk-4YFJWXL2.js → chunk-JJKQ7CGI.js} +2 -2
- package/dist/esm/chunk-JSW6J6RS.js +2 -0
- package/dist/esm/chunk-JSW6J6RS.js.map +7 -0
- package/dist/esm/chunk-KRDP5SQ7.js +2 -0
- package/dist/esm/chunk-KRDP5SQ7.js.map +7 -0
- package/dist/esm/{chunk-CWRNW44F.js → chunk-L6PVH3RM.js} +2 -2
- package/dist/esm/{chunk-MK2R6DAU.js → chunk-LAOMR7SE.js} +2 -2
- package/dist/esm/{chunk-FHOCUZDR.js → chunk-NIQT45PJ.js} +2 -2
- package/dist/esm/chunk-NKEJTTIL.js +2 -0
- package/dist/esm/chunk-NKEJTTIL.js.map +7 -0
- package/dist/esm/chunk-NVDXXGVW.js +2 -0
- package/dist/esm/chunk-NVDXXGVW.js.map +7 -0
- package/dist/esm/chunk-OS3FCYZY.js +2 -0
- package/dist/esm/{chunk-7QDTSBJF.js → chunk-OYF6YXH7.js} +2 -2
- package/dist/esm/{chunk-WFMYNZXZ.js → chunk-P5OSU4NX.js} +2 -2
- package/dist/esm/{chunk-QEOAXJLN.js → chunk-PTS6QYQW.js} +2 -2
- package/dist/esm/{chunk-CVWCKOHO.js → chunk-RLPKKCBL.js} +2 -2
- package/dist/esm/{chunk-LKAK5GXF.js → chunk-SPIU5JYC.js} +2 -2
- package/dist/esm/chunk-SZTZ2XLI.js +2 -0
- package/dist/esm/chunk-SZTZ2XLI.js.map +7 -0
- package/dist/esm/chunk-T2FZN7G3.js +2 -0
- package/dist/esm/chunk-T2FZN7G3.js.map +7 -0
- package/dist/esm/{chunk-4AQTUBVP.js → chunk-T4UHUQFJ.js} +2 -2
- package/dist/esm/{chunk-K6QZMNCD.js → chunk-TS623UPD.js} +2 -2
- package/dist/esm/{chunk-YV2KYHGR.js → chunk-UBOOUDS4.js} +2 -2
- package/dist/esm/{chunk-D6B7IMZU.js → chunk-UFI53QUC.js} +2 -2
- package/dist/esm/{chunk-AU3D6F42.js → chunk-UIRSGVJG.js} +2 -2
- package/dist/esm/{chunk-FXUUI6Z2.js → chunk-UUUZXUIP.js} +2 -2
- package/dist/esm/{chunk-25WZA7ZU.js → chunk-VA4CTVQL.js} +2 -2
- package/dist/esm/{chunk-TOLLPRMM.js → chunk-VNPNEJI6.js} +2 -2
- package/dist/esm/{chunk-6IGTK4JE.js → chunk-YMUGKYGW.js} +2 -2
- package/dist/esm/chunk-ZWYYPFZW.js +2 -0
- package/dist/esm/chunk-ZWYYPFZW.js.map +7 -0
- package/dist/esm/{chunk-M24UXMOQ.js → chunk-ZXZOH63L.js} +2 -2
- package/dist/esm/components/_internal/base-button.js +1 -1
- package/dist/esm/components/_internal/base-button.props.js +1 -1
- package/dist/esm/components/_internal/base-checkbox.props.js +1 -1
- package/dist/esm/components/_internal/base-menu.props.js +1 -1
- package/dist/esm/components/_internal/base-menu.utils.d.ts +48 -0
- package/dist/esm/components/_internal/base-menu.utils.d.ts.map +1 -0
- package/dist/esm/components/_internal/base-menu.utils.js +2 -0
- package/dist/esm/components/_internal/base-menu.utils.js.map +7 -0
- package/dist/esm/components/_internal/base-radio.props.js +1 -1
- package/dist/esm/components/_internal/base-tab-list.props.js +1 -1
- package/dist/esm/components/_internal/dropdown-menu-drill-down.d.ts +77 -59
- package/dist/esm/components/_internal/dropdown-menu-drill-down.d.ts.map +1 -1
- package/dist/esm/components/_internal/dropdown-menu-drill-down.js +1 -1
- package/dist/esm/components/_internal/menu-context.d.ts +7 -3
- package/dist/esm/components/_internal/menu-context.d.ts.map +1 -1
- package/dist/esm/components/_internal/menu-context.js +1 -1
- package/dist/esm/components/_internal/shell-bottom.js +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-prop-helpers.js +1 -1
- package/dist/esm/components/_internal/shell-resize.js +1 -1
- package/dist/esm/components/_internal/shell-sidebar.js +1 -1
- package/dist/esm/components/accessible-icon.js +1 -1
- package/dist/esm/components/accordion.js +1 -1
- package/dist/esm/components/accordion.props.js +1 -1
- package/dist/esm/components/alert-dialog.js +1 -1
- package/dist/esm/components/alert-dialog.props.js +1 -1
- package/dist/esm/components/aspect-ratio.js +1 -1
- package/dist/esm/components/avatar.js +1 -1
- package/dist/esm/components/avatar.props.js +1 -1
- package/dist/esm/components/badge.js +1 -1
- package/dist/esm/components/badge.props.js +1 -1
- package/dist/esm/components/blockquote.js +1 -1
- package/dist/esm/components/blockquote.props.js +1 -1
- package/dist/esm/components/box.js +1 -1
- package/dist/esm/components/box.props.js +1 -1
- package/dist/esm/components/button.js +1 -1
- package/dist/esm/components/button.props.js +1 -1
- package/dist/esm/components/callout.js +1 -1
- package/dist/esm/components/callout.props.js +1 -1
- package/dist/esm/components/card.js +1 -1
- package/dist/esm/components/card.props.js +1 -1
- package/dist/esm/components/chatbar.d.ts +46 -44
- package/dist/esm/components/chatbar.d.ts.map +1 -1
- package/dist/esm/components/chatbar.js +1 -1
- package/dist/esm/components/checkbox-cards.js +1 -1
- package/dist/esm/components/checkbox-cards.props.js +1 -1
- package/dist/esm/components/checkbox-group.js +1 -1
- package/dist/esm/components/checkbox-group.primitive.js +1 -1
- package/dist/esm/components/checkbox-group.props.js +1 -1
- package/dist/esm/components/checkbox.js +1 -1
- package/dist/esm/components/checkbox.props.js +1 -1
- package/dist/esm/components/code.js +1 -1
- package/dist/esm/components/code.props.js +1 -1
- package/dist/esm/components/combobox.d.ts +28 -15
- package/dist/esm/components/combobox.d.ts.map +1 -1
- package/dist/esm/components/combobox.js +1 -1
- package/dist/esm/components/combobox.props.d.ts +48 -0
- package/dist/esm/components/combobox.props.d.ts.map +1 -1
- package/dist/esm/components/combobox.props.js +1 -1
- package/dist/esm/components/container.js +1 -1
- package/dist/esm/components/container.props.js +1 -1
- package/dist/esm/components/context-menu.d.ts +18 -5
- package/dist/esm/components/context-menu.d.ts.map +1 -1
- package/dist/esm/components/context-menu.js +1 -1
- package/dist/esm/components/context-menu.props.d.ts +1 -1
- package/dist/esm/components/context-menu.props.d.ts.map +1 -1
- package/dist/esm/components/context-menu.props.js +1 -1
- package/dist/esm/components/data-list.js +1 -1
- package/dist/esm/components/data-list.props.js +1 -1
- package/dist/esm/components/dialog.js +1 -1
- package/dist/esm/components/dialog.props.js +1 -1
- package/dist/esm/components/dropdown-menu.d.ts +11 -18
- package/dist/esm/components/dropdown-menu.d.ts.map +1 -1
- package/dist/esm/components/dropdown-menu.js +1 -1
- package/dist/esm/components/dropdown-menu.props.js +1 -1
- package/dist/esm/components/em.js +1 -1
- package/dist/esm/components/em.props.js +1 -1
- package/dist/esm/components/flex.js +1 -1
- package/dist/esm/components/flex.props.js +1 -1
- package/dist/esm/components/grid.js +1 -1
- package/dist/esm/components/grid.props.js +1 -1
- package/dist/esm/components/heading.js +1 -1
- package/dist/esm/components/heading.props.js +1 -1
- package/dist/esm/components/hover-card.js +1 -1
- package/dist/esm/components/hover-card.props.js +1 -1
- package/dist/esm/components/icon-button.js +1 -1
- package/dist/esm/components/icon-button.props.js +1 -1
- package/dist/esm/components/icons.js +1 -1
- package/dist/esm/components/image.js +1 -1
- package/dist/esm/components/image.props.js +1 -1
- package/dist/esm/components/index.js +1 -1
- package/dist/esm/components/inset.js +1 -1
- package/dist/esm/components/inset.props.js +1 -1
- package/dist/esm/components/kbd.js +1 -1
- package/dist/esm/components/kbd.props.js +1 -1
- package/dist/esm/components/link.js +1 -1
- package/dist/esm/components/link.props.js +1 -1
- package/dist/esm/components/navbar.js +1 -1
- package/dist/esm/components/navbar.props.js +1 -1
- package/dist/esm/components/popover.js +1 -1
- package/dist/esm/components/popover.props.js +1 -1
- package/dist/esm/components/portal.js +1 -1
- package/dist/esm/components/progress.js +1 -1
- package/dist/esm/components/progress.props.js +1 -1
- package/dist/esm/components/quote.js +1 -1
- package/dist/esm/components/quote.props.js +1 -1
- package/dist/esm/components/radio-cards.js +1 -1
- package/dist/esm/components/radio-cards.props.js +1 -1
- package/dist/esm/components/radio-group.js +1 -1
- package/dist/esm/components/radio-group.props.js +1 -1
- package/dist/esm/components/radio.js +1 -1
- package/dist/esm/components/radio.props.js +1 -1
- package/dist/esm/components/reset.js +1 -1
- package/dist/esm/components/schemas/base-button.schema.d.ts +111 -256
- package/dist/esm/components/schemas/base-button.schema.d.ts.map +1 -1
- package/dist/esm/components/schemas/base-button.schema.js +1 -1
- package/dist/esm/components/schemas/button.schema.d.ts +136 -557
- package/dist/esm/components/schemas/button.schema.d.ts.map +1 -1
- package/dist/esm/components/schemas/button.schema.js +1 -1
- package/dist/esm/components/schemas/icon-button.schema.d.ts +123 -240
- package/dist/esm/components/schemas/icon-button.schema.d.ts.map +1 -1
- package/dist/esm/components/schemas/icon-button.schema.js +1 -1
- package/dist/esm/components/schemas/index.js +1 -1
- package/dist/esm/components/schemas/shell.schema.d.ts +592 -851
- package/dist/esm/components/schemas/shell.schema.d.ts.map +1 -1
- package/dist/esm/components/schemas/shell.schema.js +1 -1
- package/dist/esm/components/schemas/toggle-button.schema.d.ts +138 -1026
- package/dist/esm/components/schemas/toggle-button.schema.d.ts.map +1 -1
- package/dist/esm/components/schemas/toggle-button.schema.js +1 -1
- package/dist/esm/components/schemas/toggle-icon-button.schema.d.ts +124 -465
- package/dist/esm/components/schemas/toggle-icon-button.schema.d.ts.map +1 -1
- package/dist/esm/components/schemas/toggle-icon-button.schema.js +1 -1
- package/dist/esm/components/scroll-area.js +1 -1
- package/dist/esm/components/scroll-area.props.js +1 -1
- package/dist/esm/components/section.js +1 -1
- package/dist/esm/components/section.props.js +1 -1
- package/dist/esm/components/segmented-control.js +1 -1
- package/dist/esm/components/segmented-control.props.js +1 -1
- package/dist/esm/components/select.js +1 -1
- package/dist/esm/components/select.props.js +1 -1
- package/dist/esm/components/separator.js +1 -1
- package/dist/esm/components/separator.props.js +1 -1
- package/dist/esm/components/sheet.js +1 -1
- package/dist/esm/components/shell.context.js +1 -1
- package/dist/esm/components/shell.hooks.js +1 -1
- package/dist/esm/components/shell.js +1 -1
- package/dist/esm/components/shell.types.js +1 -1
- package/dist/esm/components/sidebar.js +1 -1
- package/dist/esm/components/sidebar.props.js +1 -1
- package/dist/esm/components/skeleton.js +1 -1
- package/dist/esm/components/skeleton.props.js +1 -1
- package/dist/esm/components/slider.js +1 -1
- package/dist/esm/components/slider.props.js +1 -1
- package/dist/esm/components/slot.d.ts +6 -2
- package/dist/esm/components/slot.d.ts.map +1 -1
- package/dist/esm/components/slot.js +1 -1
- package/dist/esm/components/spinner.js +1 -1
- package/dist/esm/components/spinner.props.js +1 -1
- package/dist/esm/components/strong.js +1 -1
- package/dist/esm/components/strong.props.js +1 -1
- package/dist/esm/components/switch.js +1 -1
- package/dist/esm/components/switch.props.js +1 -1
- package/dist/esm/components/tab-nav.js +1 -1
- package/dist/esm/components/tab-nav.props.js +1 -1
- package/dist/esm/components/table.js +1 -1
- package/dist/esm/components/table.props.js +1 -1
- package/dist/esm/components/tabs.js +1 -1
- package/dist/esm/components/tabs.props.js +1 -1
- package/dist/esm/components/text-area.js +1 -1
- package/dist/esm/components/text-area.props.js +1 -1
- package/dist/esm/components/text-field.js +1 -1
- package/dist/esm/components/text-field.props.js +1 -1
- package/dist/esm/components/text.js +1 -1
- package/dist/esm/components/text.props.js +1 -1
- package/dist/esm/components/theme-panel.js +1 -1
- package/dist/esm/components/theme.js +1 -1
- package/dist/esm/components/theme.props.d.ts +1 -1
- package/dist/esm/components/theme.props.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/tooltip.props.js +1 -1
- package/dist/esm/components/user-card.js +1 -1
- package/dist/esm/components/user-card.props.js +1 -1
- package/dist/esm/components/virtual-menu.d.ts.map +1 -1
- package/dist/esm/components/virtual-menu.js +1 -1
- package/dist/esm/components/visually-hidden.js +1 -1
- package/dist/esm/helpers/compile-prop-defs.js +1 -1
- package/dist/esm/helpers/extract-margin-props.js +1 -1
- package/dist/esm/helpers/extract-props.js +1 -1
- package/dist/esm/helpers/font-config.js +1 -1
- package/dist/esm/helpers/get-margin-styles.js +1 -1
- package/dist/esm/helpers/get-matching-gray-color.js +1 -1
- package/dist/esm/helpers/get-responsive-styles.js +1 -1
- package/dist/esm/helpers/get-subtree.js +1 -1
- package/dist/esm/helpers/has-own-property.js +1 -1
- package/dist/esm/helpers/index.js +1 -1
- package/dist/esm/helpers/inert.js +1 -1
- package/dist/esm/helpers/is-responsive-object.js +1 -1
- package/dist/esm/helpers/map-prop-values.js +1 -1
- package/dist/esm/helpers/merge-styles.js +1 -1
- package/dist/esm/helpers/normalize-to-px.js +1 -1
- package/dist/esm/helpers/require-react-element.js +1 -1
- package/dist/esm/helpers/use-deprecation-warning.js +1 -1
- package/dist/esm/hooks/index.js +1 -1
- package/dist/esm/hooks/use-body-pointer-events-cleanup.js +1 -1
- package/dist/esm/hooks/use-breakpoint.d.ts +4 -1
- 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-live-announcer.js +1 -1
- package/dist/esm/hooks/use-prop-synced-state.js +1 -1
- package/dist/esm/hooks/use-toggle-state.js +1 -1
- package/dist/esm/hooks/use-tooltip-wrapper.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/props/as-child.prop.js +1 -1
- package/dist/esm/props/color.prop.js +1 -1
- package/dist/esm/props/font-family.prop.js +1 -1
- package/dist/esm/props/gap.props.js +1 -1
- package/dist/esm/props/height.props.js +1 -1
- package/dist/esm/props/high-contrast.prop.js +1 -1
- package/dist/esm/props/index.js +1 -1
- package/dist/esm/props/layout.props.js +1 -1
- package/dist/esm/props/leading-trim.prop.js +1 -1
- package/dist/esm/props/margin.props.js +1 -1
- package/dist/esm/props/padding.props.js +1 -1
- package/dist/esm/props/prop-def.js +1 -1
- package/dist/esm/props/radius.prop.js +1 -1
- package/dist/esm/props/shadow.props.js +1 -1
- package/dist/esm/props/text-align.prop.js +1 -1
- package/dist/esm/props/text-wrap.prop.js +1 -1
- package/dist/esm/props/truncate.prop.js +1 -1
- package/dist/esm/props/weight.prop.js +1 -1
- package/dist/esm/props/width.props.js +1 -1
- package/fonts.css +2 -0
- package/package.json +36 -36
- package/schemas/base-button.json +66 -60
- package/schemas/button.json +80 -74
- package/schemas/icon-button.json +78 -72
- package/schemas/index.json +390 -360
- package/schemas/toggle-button.json +84 -78
- package/schemas/toggle-icon-button.json +82 -76
- package/src/components/_internal/base-menu.css +65 -140
- package/src/components/_internal/base-menu.utils.tsx +144 -0
- package/src/components/_internal/dropdown-menu-drill-down.tsx +281 -183
- package/src/components/_internal/menu-context.tsx +24 -15
- package/src/components/chatbar.css +94 -26
- package/src/components/chatbar.tsx +739 -735
- package/src/components/combobox.css +62 -115
- package/src/components/combobox.props.tsx +14 -0
- package/src/components/combobox.tsx +440 -212
- package/src/components/context-menu.props.tsx +4 -1
- package/src/components/context-menu.tsx +108 -62
- package/src/components/dropdown-menu.css +41 -121
- package/src/components/dropdown-menu.tsx +430 -275
- package/src/components/schemas/shell.schema.ts +11 -18
- package/src/components/scroll-area.css +2 -3
- package/src/components/theme.props.tsx +1 -1
- package/src/components/virtual-menu.tsx +12 -8
- package/src/hooks/use-breakpoint.ts +19 -3
- package/src/styles/fonts.css +6 -1
- package/src/styles/tokens/font-family.css +13 -5
- package/styles.css +307 -509
- package/tokens/base.css +1 -1
- package/tokens.css +1 -1
- package/dist/esm/chunk-3XT5P2HO.js +0 -2
- package/dist/esm/chunk-4XJY6FIK.js +0 -2
- package/dist/esm/chunk-4Z33XHOK.js +0 -2
- package/dist/esm/chunk-4Z33XHOK.js.map +0 -7
- package/dist/esm/chunk-E2Z5IA2P.js +0 -2
- package/dist/esm/chunk-E2Z5IA2P.js.map +0 -7
- package/dist/esm/chunk-HVWEPVBH.js +0 -2
- package/dist/esm/chunk-HVWEPVBH.js.map +0 -7
- package/dist/esm/chunk-KKBP2CRH.js +0 -2
- package/dist/esm/chunk-KKBP2CRH.js.map +0 -7
- package/dist/esm/chunk-MOR3NSXQ.js +0 -2
- package/dist/esm/chunk-MOR3NSXQ.js.map +0 -7
- package/dist/esm/chunk-QCNUTT4R.js +0 -2
- package/dist/esm/chunk-QCNUTT4R.js.map +0 -7
- package/dist/esm/chunk-UGD7Z3L4.js +0 -2
- package/dist/esm/chunk-UGD7Z3L4.js.map +0 -7
- package/dist/esm/chunk-YEB3H7QN.js +0 -2
- package/dist/esm/chunk-YEB3H7QN.js.map +0 -7
- package/dist/esm/chunk-ZY6SQWHT.js +0 -2
- package/dist/esm/chunk-ZY6SQWHT.js.map +0 -7
- /package/dist/esm/{chunk-P7HYVJSU.js.map → chunk-2TIADHPD.js.map} +0 -0
- /package/dist/esm/{chunk-RMKXWYOV.js.map → chunk-3OBXZUFJ.js.map} +0 -0
- /package/dist/esm/{chunk-S2HA3W3V.js.map → chunk-3R7XMRV5.js.map} +0 -0
- /package/dist/esm/{chunk-S56YSRHP.js.map → chunk-56TS6OKQ.js.map} +0 -0
- /package/dist/esm/{chunk-2FYJTSOP.js.map → chunk-5BYHEYO6.js.map} +0 -0
- /package/dist/esm/{chunk-B24BDVG2.js.map → chunk-5MNBQROW.js.map} +0 -0
- /package/dist/esm/{chunk-W7N7V5YD.js.map → chunk-7ESHXHHO.js.map} +0 -0
- /package/dist/esm/{chunk-CRWYCLTE.js.map → chunk-ABSKRHVM.js.map} +0 -0
- /package/dist/esm/{chunk-3MWWP4MW.js.map → chunk-BBJUB52V.js.map} +0 -0
- /package/dist/esm/{chunk-PTLFMWCN.js.map → chunk-CQNPBTM5.js.map} +0 -0
- /package/dist/esm/{chunk-GJSGKE7B.js.map → chunk-CTA5ODAO.js.map} +0 -0
- /package/dist/esm/{chunk-GWXVETMF.js.map → chunk-DCAZPMOB.js.map} +0 -0
- /package/dist/esm/{chunk-PLWXTEVE.js.map → chunk-DMJJM5IS.js.map} +0 -0
- /package/dist/esm/{chunk-A2RZGGMY.js.map → chunk-DQAUX5ZL.js.map} +0 -0
- /package/dist/esm/{chunk-YUP6EICB.js.map → chunk-DXL6V2A5.js.map} +0 -0
- /package/dist/esm/{chunk-XMRIRFM7.js.map → chunk-FG7XM7KJ.js.map} +0 -0
- /package/dist/esm/{chunk-IKSN4RNB.js.map → chunk-FIB3XATL.js.map} +0 -0
- /package/dist/esm/{chunk-374ZYJUP.js.map → chunk-HBR42MIX.js.map} +0 -0
- /package/dist/esm/{chunk-2UPAYDKR.js.map → chunk-HIKVMKYQ.js.map} +0 -0
- /package/dist/esm/{chunk-VX6ARMWP.js.map → chunk-HSAG7C53.js.map} +0 -0
- /package/dist/esm/{chunk-OSRJRBKP.js.map → chunk-HW324FK3.js.map} +0 -0
- /package/dist/esm/{chunk-DNHUQLXO.js.map → chunk-JBO5YOUM.js.map} +0 -0
- /package/dist/esm/{chunk-HF5WY5YE.js.map → chunk-JGLAE5G7.js.map} +0 -0
- /package/dist/esm/{chunk-4YFJWXL2.js.map → chunk-JJKQ7CGI.js.map} +0 -0
- /package/dist/esm/{chunk-CWRNW44F.js.map → chunk-L6PVH3RM.js.map} +0 -0
- /package/dist/esm/{chunk-MK2R6DAU.js.map → chunk-LAOMR7SE.js.map} +0 -0
- /package/dist/esm/{chunk-FHOCUZDR.js.map → chunk-NIQT45PJ.js.map} +0 -0
- /package/dist/esm/{chunk-3XT5P2HO.js.map → chunk-OS3FCYZY.js.map} +0 -0
- /package/dist/esm/{chunk-7QDTSBJF.js.map → chunk-OYF6YXH7.js.map} +0 -0
- /package/dist/esm/{chunk-WFMYNZXZ.js.map → chunk-P5OSU4NX.js.map} +0 -0
- /package/dist/esm/{chunk-QEOAXJLN.js.map → chunk-PTS6QYQW.js.map} +0 -0
- /package/dist/esm/{chunk-CVWCKOHO.js.map → chunk-RLPKKCBL.js.map} +0 -0
- /package/dist/esm/{chunk-LKAK5GXF.js.map → chunk-SPIU5JYC.js.map} +0 -0
- /package/dist/esm/{chunk-4AQTUBVP.js.map → chunk-T4UHUQFJ.js.map} +0 -0
- /package/dist/esm/{chunk-K6QZMNCD.js.map → chunk-TS623UPD.js.map} +0 -0
- /package/dist/esm/{chunk-YV2KYHGR.js.map → chunk-UBOOUDS4.js.map} +0 -0
- /package/dist/esm/{chunk-D6B7IMZU.js.map → chunk-UFI53QUC.js.map} +0 -0
- /package/dist/esm/{chunk-AU3D6F42.js.map → chunk-UIRSGVJG.js.map} +0 -0
- /package/dist/esm/{chunk-FXUUI6Z2.js.map → chunk-UUUZXUIP.js.map} +0 -0
- /package/dist/esm/{chunk-25WZA7ZU.js.map → chunk-VA4CTVQL.js.map} +0 -0
- /package/dist/esm/{chunk-TOLLPRMM.js.map → chunk-VNPNEJI6.js.map} +0 -0
- /package/dist/esm/{chunk-6IGTK4JE.js.map → chunk-YMUGKYGW.js.map} +0 -0
- /package/dist/esm/{chunk-M24UXMOQ.js.map → chunk-ZXZOH63L.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"virtual-menu.d.ts","sourceRoot":"","sources":["../../../src/components/virtual-menu.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"virtual-menu.d.ts","sourceRoot":"","sources":["../../../src/components/virtual-menu.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAMH,mDAAmD;AACnD,UAAU,0BAA0B,CAAC,CAAC;IACpC,oBAAoB;IACpB,IAAI,EAAE,CAAC,CAAC;IACR,+BAA+B;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,iDAAiD;IACjD,aAAa,EAAE,OAAO,CAA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AAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,4BAA4B;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wBAAwB;IACxB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,oCAAoC;IACpC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAqED,iBAAS,eAAe,CAAC,CAAC,EAAE,EAC1B,KAAK,EACL,SAAS,EACT,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,QAAQ,EACd,iBAAiB,EAAE,qBAAqB,EACxC,QAAY,EACZ,QAAQ,EACR,SAAS,EACT,KAAK,EACL,YAAY,EAAE,SAAS,GACxB,EAAE,gBAAgB,CAAC,CAAC,CAAC,qBA8OrB;kBAzPQ,eAAe;;;AAiQxB,UAAU,oBAAqB,SAAQ,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC;IAC1E,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,2CAA2C;IAC3C,kBAAkB,CAAC,EAAE,IAAI,GAAG,SAAS,CAAC;IACtC,0CAA0C;IAC1C,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAqCD,QAAA,MAAM,WAAW;;CAEf,CAAC;AAEH,OAAO,EAAE,WAAW,EAAE,CAAC;AACvB,YAAY,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";"use client";var X=Object.create;var v=Object.defineProperty;var Z=Object.getOwnPropertyDescriptor;var ee=Object.getOwnPropertyNames;var te=Object.getPrototypeOf,ne=Object.prototype.hasOwnProperty;var re=(e,t)=>{for(var i in t)v(e,i,{get:t[i],enumerable:!0})},D=(e,t,i,u)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of ee(t))!ne.call(e,l)&&l!==i&&v(e,l,{get:()=>t[l],enumerable:!(u=Z(t,l))||u.enumerable});return e};var k=(e,t,i)=>(i=e!=null?X(te(e)):{},D(t||!e||!e.__esModule?v(i,"default",{value:e,enumerable:!0}):i,e)),ae=e=>D(v({},"__esModule",{value:!0}),e);var le={};re(le,{VirtualMenu:()=>ue});module.exports=ae(le);var n=k(require("react")),y=k(require("classnames")),w=require("@tanstack/react-virtual");var c=k(require("react")),ie=c.createContext({isInsideMenu:!1});function P(){return c.useContext(ie)}var L={1:24,2:32};var oe=n.memo(function({label:t,isHighlighted:i,id:u,style:l,tabIndex:S,"data-highlighted":h,"data-index":T,onMouseEnter:g,onMouseLeave:E,onClick:M,onKeyDown:R}){return n.createElement("div",{id:u,role:"menuitem",className:(0,y.default)("rt-reset","rt-BaseMenuItem","rt-VirtualMenuItem"),style:l,tabIndex:S,"data-highlighted":h,"data-index":T,onMouseEnter:g,onMouseLeave:E,onClick:M,onKeyDown:R},t)},(e,t)=>!(e.label!==t.label||e["data-highlighted"]!==t["data-highlighted"]||e.style.height!==t.style.height||e.style.transform!==t.style.transform||e.tabIndex!==t.tabIndex||e.id!==t.id));function K({items:e,itemLabel:t,renderItem:i,size:u,estimatedItemSize:l,overscan:S=5,onSelect:h,className:T,style:g,"aria-label":E}){let M=n.useId(),R=n.useRef(null),[C,d]=n.useState(-1),{isInsideMenu:j,size:A}=P(),I=l??L[u??A??"2"];if(!t&&!i)throw new Error("VirtualMenu requires either itemLabel or renderItem prop");let B=n.useMemo(()=>t?typeof t=="function"?t:r=>r[t]:null,[t]),m=n.useMemo(()=>e.length===0||C<0?-1:Math.min(C,e.length-1),[C,e.length]),q=n.useMemo(()=>typeof I=="function"?I:()=>I,[I]),p=(0,w.useVirtualizer)({count:e.length,getScrollElement:()=>R.current,estimateSize:q,overscan:S}),O=p.getVirtualItems(),b=n.useRef(e),x=n.useRef(h);b.current=e,x.current=h;let f=n.useRef(p.scrollToIndex);f.current=p.scrollToIndex;let z=n.useRef(m);z.current=m;let U=n.useCallback(r=>{let s=r.currentTarget.dataset.index;s!=null&&d(Number(s))},[]),W=n.useCallback(r=>{let s=r.currentTarget.dataset.index;if(s!=null){let a=Number(s),o=b.current;a>=0&&a<o.length&&x.current?.(o[a],a)}},[]),Y=n.useCallback(()=>{},[]),_=n.useCallback(r=>{if(r.key==="Enter"||r.key===" "){r.preventDefault();let s=r.currentTarget.dataset.index;if(s!=null){let a=Number(s),o=b.current;a>=0&&a<o.length&&x.current?.(o[a],a)}}},[]),F=n.useCallback(r=>{let s=b.current,a=z.current;switch(r.key){case"ArrowDown":{r.preventDefault();let o=a<s.length-1?a+1:0;d(o),f.current(o,{align:"auto"});break}case"ArrowUp":{r.preventDefault();let o=a>0?a-1:s.length-1;d(o),f.current(o,{align:"auto"});break}case"Home":{r.preventDefault(),d(0),f.current(0,{align:"start"});break}case"End":{r.preventDefault();let o=s.length-1;d(o),f.current(o,{align:"end"});break}case"Enter":case" ":{r.preventDefault(),a>=0&&a<s.length&&x.current?.(s[a],a);break}case"Tab":{r.preventDefault();break}case"Escape":{r.currentTarget.blur();break}}},[]),V=n.useCallback(r=>`${M}-item-${r}`,[M]),G=n.useMemo(()=>({overflow:"auto",position:"relative",...g}),[g]),H=p.getTotalSize(),J=n.useMemo(()=>({height:`${H}px`,width:"100%",position:"relative"}),[H]);return n.createElement("div",{ref:R,role:j?"group":"menu","aria-label":E,"aria-activedescendant":m>=0?V(m):void 0,tabIndex:0,onKeyDown:F,className:(0,y.default)("rt-VirtualMenuRoot",T),style:G},n.createElement("div",{className:"rt-VirtualMenuViewport",style:J},O.map(r=>{let s=e[r.index],a=r.index,o=m===a,Q={height:r.size,transform:`translateY(${r.start}px)`},N={id:V(a),isHighlighted:o,style:Q,tabIndex:o?0:-1,"data-highlighted":o?!0:void 0,"data-index":a,onMouseEnter:U,onMouseLeave:Y,onClick:W,onKeyDown:_};return i?n.createElement(i,{key:r.key,item:s,index:a,...N}):n.createElement(oe,{key:r.key,label:B(s),...N})})))}K.displayName="VirtualMenu";var $=n.forwardRef(({className:e,children:t,...i},u)=>n.createElement("div",{ref:u,role:"menuitem",className:(0,y.default)("rt-reset","rt-BaseMenuItem","rt-VirtualMenuItem",e),...i},t));$.displayName="VirtualMenu.Item";var se=n.memo($,(e,t)=>{let i=e.style,u=t.style;return!(i?.height!==u?.height||i?.transform!==u?.transform||e["data-highlighted"]!==t["data-highlighted"]||e.tabIndex!==t.tabIndex||e.id!==t.id||e.className!==t.className||e.children!==t.children)}),ue=Object.assign(K,{Item:se});
|
|
1
|
+
"use strict";"use client";var Te=Object.create;var $=Object.defineProperty;var Re=Object.getOwnPropertyDescriptor;var be=Object.getOwnPropertyNames;var xe=Object.getPrototypeOf,Me=Object.prototype.hasOwnProperty;var Fe=(e,t)=>{for(var n in t)$(e,n,{get:t[n],enumerable:!0})},te=(e,t,n,l)=>{if(t&&typeof t=="object"||typeof t=="function")for(let c of be(t))!Me.call(e,c)&&c!==n&&$(e,c,{get:()=>t[c],enumerable:!(l=Re(t,c))||l.enumerable});return e};var E=(e,t,n)=>(n=e!=null?Te(xe(e)):{},te(t||!e||!e.__esModule?$(n,"default",{value:e,enumerable:!0}):n,e)),Ie=e=>te($({},"__esModule",{value:!0}),e);var Ke={};Fe(Ke,{VirtualMenu:()=>je});module.exports=Ie(Ke);var a=E(require("react")),Y=E(require("classnames")),ge=require("@tanstack/react-virtual");var j=E(require("react"));var s=E(require("react")),de=E(require("classnames")),L=require("radix-ui"),q=require("radix-ui/internal");function ne(e){switch(e){case"tomato":case"red":case"ruby":case"crimson":case"pink":case"plum":case"purple":case"violet":return"mauve";case"iris":case"indigo":case"blue":case"sky":case"cyan":return"slate";case"teal":case"jade":case"mint":case"green":return"sage";case"grass":case"lime":return"olive";case"yellow":case"amber":case"orange":case"brown":case"gold":case"bronze":return"sand";case"gray":return"gray"}}var J=E(require("react"));function R(e){let[t,n]=J.useState(e),[l,c]=J.useState(e);return Object.is(e,l)||(c(e),n(e)),[t,n]}var oe=E(require("react")),ke="Warning: The `panelBackground` prop is deprecated and will be removed in a future version. Use `material` prop instead.",ae=new Set;function De(e){ae.has(e)||(ae.add(e),console.warn(e))}function re(e){oe.useEffect(()=>{},[e])}var ie={asChild:{type:"boolean"}};var se=["gray","gold","bronze","brown","yellow","amber","orange","tomato","red","ruby","crimson","pink","plum","purple","violet","iris","indigo","blue","cyan","teal","jade","green","grass","lime","mint","sky"],le=["auto","gray","mauve","slate","sage","olive","sand"];var ce=["none","small","medium","large","full"];var Se=["inherit","light","dark"],Ee=["solid","translucent"],Be=["solid","translucent"],He=["90%","95%","100%","105%","110%"],ue=["sans","mono","serif"],r={...ie,hasBackground:{type:"boolean",default:!0},appearance:{type:"enum",values:Se,default:"inherit"},accentColor:{type:"enum",values:se,default:"blue"},grayColor:{type:"enum",values:le,default:"slate"},material:{type:"enum",values:Be,default:"translucent"},panelBackground:{type:"enum",values:Ee,default:"translucent"},radius:{type:"enum",values:ce,default:"full"},scaling:{type:"enum",values:He,default:"100%"},fontFamily:{type:"enum",values:ue,default:"sans"},headingFontFamily:{type:"enum",values:ue}};var d=()=>{},we={appearance:r.appearance.default,accentColor:r.accentColor.default,grayColor:r.grayColor.default,resolvedGrayColor:r.grayColor.default,material:r.material.default,panelBackground:r.panelBackground.default,radius:r.radius.default,scaling:r.scaling.default,fontFamily:r.fontFamily.default,headingFontFamily:void 0,onAppearanceChange:d,onAccentColorChange:d,onGrayColorChange:d,onMaterialChange:d,onPanelBackgroundChange:d,onRadiusChange:d,onScalingChange:d,onFontFamilyChange:d,onHeadingFontFamilyChange:d},U=s.createContext(void 0);function me(){return s.useContext(U)??we}var Ve=s.forwardRef((e,t)=>s.useContext(U)===void 0?s.createElement(L.Tooltip.Provider,{delayDuration:200},s.createElement(L.Direction.Provider,{dir:"ltr"},s.createElement(pe,{...e,ref:t}))):s.createElement(Q,{...e,ref:t}));Ve.displayName="Theme";var pe=s.forwardRef((e,t)=>{let{appearance:n=r.appearance.default,accentColor:l=r.accentColor.default,grayColor:c=r.grayColor.default,material:b=r.material.default,panelBackground:p=r.panelBackground.default,radius:C=r.radius.default,scaling:f=r.scaling.default,fontFamily:x=r.fontFamily.default,headingFontFamily:P,hasBackground:v=r.hasBackground.default,...M}=e;re(e.panelBackground);let[g,D]=R(n),[B,H]=R(l),[S,F]=R(c),w=b!==r.material.default?b:p,[h,V]=R(w),[I,N]=R(h),[T,k]=R(C),[y,A]=R(f),[K,z]=R(x),[O,G]=R(P);return s.createElement(Q,{...M,ref:t,isRoot:!0,hasBackground:v,appearance:g,accentColor:B,grayColor:S,material:h,panelBackground:I,radius:T,scaling:y,fontFamily:K,headingFontFamily:O,onAppearanceChange:D,onAccentColorChange:H,onGrayColorChange:F,onMaterialChange:V,onPanelBackgroundChange:N,onRadiusChange:k,onScalingChange:A,onFontFamilyChange:z,onHeadingFontFamilyChange:G})});pe.displayName="ThemeRoot";function Ne(){if(typeof navigator>"u")return;let e=navigator.userAgent;if(e.includes("Win"))return"windows";if(e.includes("Mac"))return"macos";if(e.includes("Linux"))return"linux"}var Q=s.forwardRef((e,t)=>{let n=s.useContext(U),{asChild:l,isRoot:c,hasBackground:b,appearance:p=e.appearance??n?.appearance??r.appearance.default,accentColor:C=e.accentColor??n?.accentColor??r.accentColor.default,grayColor:f=e.grayColor??n?.resolvedGrayColor??r.grayColor.default,material:x=e.material??n?.material??r.material.default,panelBackground:P=e.panelBackground??n?.panelBackground??r.panelBackground.default,radius:v=e.radius??n?.radius??r.radius.default,scaling:M=e.scaling??n?.scaling??r.scaling.default,fontFamily:g=e.fontFamily??n?.fontFamily??r.fontFamily.default,headingFontFamily:D=e.headingFontFamily??n?.headingFontFamily,onAppearanceChange:B=d,onAccentColorChange:H=d,onGrayColorChange:S=d,onMaterialChange:F=d,onPanelBackgroundChange:w=d,onRadiusChange:h=d,onScalingChange:V=d,onFontFamilyChange:I=d,onHeadingFontFamilyChange:N=d,...T}=e,k=l?L.Slot.Root:"div",y=f==="auto"?ne(C):f,A=e.appearance==="light"||e.appearance==="dark",K=b===void 0?c||A:b,z=s.useRef(null),O=(0,q.useComposedRefs)(t,z),G="data-os"in T;return(0,q.useLayoutEffect)(()=>{if(!c||G)return;let W=z.current;if(!W)return;let _=Ne();if(_)return W.setAttribute("data-os",_),()=>W.removeAttribute("data-os")},[c,G]),s.createElement(U.Provider,{value:s.useMemo(()=>({appearance:p,accentColor:C,grayColor:f,resolvedGrayColor:y,material:x,panelBackground:P,radius:v,scaling:M,fontFamily:g,headingFontFamily:D,onAppearanceChange:B,onAccentColorChange:H,onGrayColorChange:S,onMaterialChange:F,onPanelBackgroundChange:w,onRadiusChange:h,onScalingChange:V,onFontFamilyChange:I,onHeadingFontFamilyChange:N}),[p,C,f,y,x,P,v,M,g,D,B,H,S,F,w,h,V,I,N])},s.createElement(k,{"data-is-root-theme":c?"true":"false","data-accent-color":C,"data-gray-color":y,"data-has-background":K?"true":"false","data-material":x,"data-panel-background":P,"data-radius":v,"data-scaling":M,"data-font-family":g,"data-heading-font-family":D,ref:O,...T,className:(0,de.default)("radix-themes",{light:p==="light",dark:p==="dark"},T.className)}))});Q.displayName="ThemeImpl";var Ae=j.createContext({isInsideMenu:!1}),ze={1:24,2:32};function X(e,t){let n=t?parseFloat(t)/100:1;return ze[e]*(Number.isFinite(n)?n:1)}function fe(){return j.useContext(Ae)}var Ge=a.memo(function({label:t,isHighlighted:n,id:l,style:c,tabIndex:b,"data-highlighted":p,"data-index":C,onMouseEnter:f,onMouseLeave:x,onClick:P,onKeyDown:v}){return a.createElement("div",{id:l,role:"menuitem",className:(0,Y.default)("rt-reset","rt-BaseMenuItem","rt-VirtualMenuItem"),style:c,tabIndex:b,"data-highlighted":p,"data-index":C,onMouseEnter:f,onMouseLeave:x,onClick:P,onKeyDown:v},t)},(e,t)=>!(e.label!==t.label||e["data-highlighted"]!==t["data-highlighted"]||e.style.height!==t.style.height||e.style.transform!==t.style.transform||e.tabIndex!==t.tabIndex||e.id!==t.id));function he({items:e,itemLabel:t,renderItem:n,size:l,estimatedItemSize:c,overscan:b=5,onSelect:p,className:C,style:f,"aria-label":x}){let P=a.useId(),v=a.useRef(null),[M,g]=a.useState(-1),{isInsideMenu:D,size:B,itemHeight:H}=fe(),{scaling:S}=me(),F=c??(l?X(l,S):H??X(B??"2",S));if(!t&&!n)throw new Error("VirtualMenu requires either itemLabel or renderItem prop");let w=a.useMemo(()=>t?typeof t=="function"?t:o=>o[t]:null,[t]),h=a.useMemo(()=>e.length===0||M<0?-1:Math.min(M,e.length-1),[M,e.length]),V=a.useMemo(()=>typeof F=="function"?F:()=>F,[F]),I=(0,ge.useVirtualizer)({count:e.length,getScrollElement:()=>v.current,estimateSize:V,overscan:b}),N=I.getVirtualItems(),T=a.useRef(e),k=a.useRef(p);T.current=e,k.current=p;let y=a.useRef(I.scrollToIndex);y.current=I.scrollToIndex;let A=a.useRef(h);A.current=h;let K=a.useCallback(o=>{let m=o.currentTarget.dataset.index;m!=null&&g(Number(m))},[]),z=a.useCallback(o=>{let m=o.currentTarget.dataset.index;if(m!=null){let i=Number(m),u=T.current;i>=0&&i<u.length&&k.current?.(u[i],i)}},[]),O=a.useCallback(()=>{},[]),G=a.useCallback(o=>{if(o.key==="Enter"||o.key===" "){o.preventDefault();let m=o.currentTarget.dataset.index;if(m!=null){let i=Number(m),u=T.current;i>=0&&i<u.length&&k.current?.(u[i],i)}}},[]),W=a.useCallback(o=>{let m=T.current,i=A.current;switch(o.key){case"ArrowDown":{o.preventDefault();let u=i<m.length-1?i+1:0;g(u),y.current(u,{align:"auto"});break}case"ArrowUp":{o.preventDefault();let u=i>0?i-1:m.length-1;g(u),y.current(u,{align:"auto"});break}case"Home":{o.preventDefault(),g(0),y.current(0,{align:"start"});break}case"End":{o.preventDefault();let u=m.length-1;g(u),y.current(u,{align:"end"});break}case"Enter":case" ":{o.preventDefault(),i>=0&&i<m.length&&k.current?.(m[i],i);break}case"Tab":{o.preventDefault();break}case"Escape":{o.currentTarget.blur();break}}},[]),_=a.useCallback(o=>`${P}-item-${o}`,[P]),Ce=a.useMemo(()=>({overflow:"auto",position:"relative",...f}),[f]),Z=I.getTotalSize(),Pe=a.useMemo(()=>({height:`${Z}px`,width:"100%",position:"relative"}),[Z]);return a.createElement("div",{ref:v,role:D?"group":"menu","aria-label":x,"aria-activedescendant":h>=0?_(h):void 0,tabIndex:0,onKeyDown:W,className:(0,Y.default)("rt-VirtualMenuRoot",C),style:Ce},a.createElement("div",{className:"rt-VirtualMenuViewport",style:Pe},N.map(o=>{let m=e[o.index],i=o.index,u=h===i,ve={height:o.size,transform:`translateY(${o.start}px)`},ee={id:_(i),isHighlighted:u,style:ve,tabIndex:u?0:-1,"data-highlighted":u?!0:void 0,"data-index":i,onMouseEnter:K,onMouseLeave:O,onClick:z,onKeyDown:G};return n?a.createElement(n,{key:o.key,item:m,index:i,...ee}):a.createElement(Ge,{key:o.key,label:w(m),...ee})})))}he.displayName="VirtualMenu";var ye=a.forwardRef(({className:e,children:t,...n},l)=>a.createElement("div",{ref:l,role:"menuitem",className:(0,Y.default)("rt-reset","rt-BaseMenuItem","rt-VirtualMenuItem",e),...n},t));ye.displayName="VirtualMenu.Item";var Le=a.memo(ye,(e,t)=>{let n=e.style,l=t.style;return!(n?.height!==l?.height||n?.transform!==l?.transform||e["data-highlighted"]!==t["data-highlighted"]||e.tabIndex!==t.tabIndex||e.id!==t.id||e.className!==t.className||e.children!==t.children)}),je=Object.assign(he,{Item:Le});
|
|
2
2
|
//# sourceMappingURL=virtual-menu.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/virtual-menu.tsx", "../../../src/components/_internal/menu-context.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client';\n\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { useVirtualizer } from '@tanstack/react-virtual';\nimport { useMenuContext, menuSizeToItemHeight } from './_internal/menu-context.js';\n\n/**\n * VirtualMenu - A virtualized menu component for rendering large lists efficiently.\n *\n * Uses TanStack Virtual to render only visible items.\n * Works inside any container (DropdownMenu.Content, Popover.Content, etc.)\n *\n * @example\n * // Simple usage with itemLabel\n * <VirtualMenu\n * items={items}\n * itemLabel={(item) => item.name}\n * onSelect={handleSelect}\n * />\n *\n * @example\n * // Custom rendering with renderItem\n * const UserItem = React.memo(({ item, ...props }) => (\n * <VirtualMenu.Item {...props}>\n * <Avatar src={item.avatar} />\n * {item.name}\n * </VirtualMenu.Item>\n * ));\n *\n * <VirtualMenu items={users} renderItem={UserItem} onSelect={handleSelect} />\n */\n\n// ============================================================================\n// Types\n// ============================================================================\n\n/** Props passed to custom renderItem components */\ninterface VirtualMenuRenderItemProps<T> {\n /** The item data */\n item: T;\n /** Index in the items array */\n index: number;\n /** Whether this item is currently highlighted */\n isHighlighted: boolean;\n /** Unique ID for accessibility */\n id: string;\n /** Positioning styles - must be applied */\n style: React.CSSProperties;\n /** Tab index for focus management */\n tabIndex: number;\n /** Data attribute for CSS styling */\n 'data-highlighted': true | undefined;\n /** Data attribute for event delegation */\n 'data-index': number;\n /** Mouse enter handler */\n onMouseEnter: (e: React.MouseEvent<HTMLElement>) => void;\n /** Mouse leave handler */\n onMouseLeave: () => void;\n /** Click handler */\n onClick: (e: React.MouseEvent<HTMLElement>) => void;\n /** Keyboard handler for Enter/Space activation */\n onKeyDown: (e: React.KeyboardEvent<HTMLElement>) => void;\n}\n\ninterface VirtualMenuProps<T> {\n /** Array of items to render */\n items: T[];\n /**\n * Simple label accessor for basic text items.\n * Can be a property key or a function.\n * @example\n * itemLabel=\"name\"\n * itemLabel={(item) => item.name}\n */\n itemLabel?: keyof T | ((item: T) => React.ReactNode);\n /**\n * Custom component for rendering items.\n * Must be memoized (React.memo) for optimal performance.\n * @example\n * const MyItem = React.memo(({ item, ...props }) => (\n * <VirtualMenu.Item {...props}>{item.name}</VirtualMenu.Item>\n * ));\n * <VirtualMenu items={items} renderItem={MyItem} />\n */\n renderItem?: React.ComponentType<VirtualMenuRenderItemProps<T>>;\n /**\n * Menu size - controls item height.\n * Automatically inherited from parent DropdownMenu.Content/ContextMenu.Content.\n * Only set manually when using VirtualMenu outside of a menu context.\n * @default '2' (or inherited from context)\n */\n size?: '1' | '2';\n /**\n * Estimated height of each item in pixels.\n * Can be a number (same for all) or a function (per-item).\n * Usually not needed - height is automatically derived from size prop/context.\n * Use this only for custom item heights (e.g., variable height items).\n */\n estimatedItemSize?: number | ((index: number) => number);\n /** Number of items to render outside visible area */\n overscan?: number;\n /** Callback when an item is selected */\n onSelect?: (item: T, index: number) => void;\n /** Additional class name */\n className?: string;\n /** Additional styles */\n style?: React.CSSProperties;\n /** Accessible label for the menu */\n 'aria-label'?: string;\n}\n\n// ============================================================================\n// Internal Memoized Item Component\n// ============================================================================\n\ninterface SimpleItemProps {\n label: React.ReactNode;\n isHighlighted: boolean;\n id: string;\n style: React.CSSProperties;\n tabIndex: number;\n 'data-highlighted': true | undefined;\n 'data-index': number;\n onMouseEnter: (e: React.MouseEvent<HTMLElement>) => void;\n onMouseLeave: () => void;\n onClick: (e: React.MouseEvent<HTMLElement>) => void;\n onKeyDown: (e: React.KeyboardEvent<HTMLElement>) => void;\n}\n\nconst SimpleItem = React.memo(\n function SimpleItem({\n label,\n isHighlighted: _isHighlighted,\n id,\n style,\n tabIndex,\n 'data-highlighted': dataHighlighted,\n 'data-index': dataIndex,\n onMouseEnter,\n onMouseLeave,\n onClick,\n onKeyDown,\n }: SimpleItemProps) {\n return (\n <div\n id={id}\n role=\"menuitem\"\n className={classNames('rt-reset', 'rt-BaseMenuItem', 'rt-VirtualMenuItem')}\n style={style}\n tabIndex={tabIndex}\n data-highlighted={dataHighlighted}\n data-index={dataIndex}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n onClick={onClick}\n onKeyDown={onKeyDown}\n >\n {label}\n </div>\n );\n },\n (prev, next) => {\n // Custom comparison - only re-render if these change\n if (prev.label !== next.label) return false;\n if (prev['data-highlighted'] !== next['data-highlighted']) return false;\n if (prev.style.height !== next.style.height) return false;\n if (prev.style.transform !== next.style.transform) return false;\n if (prev.tabIndex !== next.tabIndex) return false;\n if (prev.id !== next.id) return false;\n // Event handlers are stable, skip comparison\n return true;\n },\n);\n\n// ============================================================================\n// VirtualMenu Component\n// ============================================================================\n\nfunction VirtualMenuRoot<T>({\n items,\n itemLabel,\n renderItem: RenderItem,\n size: sizeProp,\n estimatedItemSize: estimatedItemSizeProp,\n overscan = 5,\n onSelect,\n className,\n style,\n 'aria-label': ariaLabel,\n}: VirtualMenuProps<T>) {\n const menuId = React.useId();\n const parentRef = React.useRef<HTMLDivElement>(null);\n const [highlightedIndex, setHighlightedIndex] = React.useState<number>(-1);\n const { isInsideMenu, size: contextSize } = useMenuContext();\n\n // Resolve size: prop > context > default '2'\n const resolvedSize = sizeProp ?? contextSize ?? '2';\n \n // Resolve item height: explicit prop > derived from size\n const estimatedItemSize = estimatedItemSizeProp ?? menuSizeToItemHeight[resolvedSize];\n\n // Validate props\n if (!itemLabel && !RenderItem) {\n throw new Error('VirtualMenu requires either itemLabel or renderItem prop');\n }\n\n // Normalize itemLabel to a function\n const getLabel = React.useMemo(() => {\n if (!itemLabel) return null;\n if (typeof itemLabel === 'function') return itemLabel;\n return (item: T) => item[itemLabel] as React.ReactNode;\n }, [itemLabel]);\n\n // Derive safe highlighted index\n const safeHighlightedIndex = React.useMemo(() => {\n if (items.length === 0) return -1;\n if (highlightedIndex < 0) return -1;\n return Math.min(highlightedIndex, items.length - 1);\n }, [highlightedIndex, items.length]);\n\n // Normalize estimatedItemSize to a function\n const getItemSize = React.useMemo(\n () =>\n typeof estimatedItemSize === 'function'\n ? estimatedItemSize\n : () => estimatedItemSize,\n [estimatedItemSize],\n );\n\n const virtualizer = useVirtualizer({\n count: items.length,\n getScrollElement: () => parentRef.current,\n estimateSize: getItemSize,\n overscan,\n });\n\n const virtualItems = virtualizer.getVirtualItems();\n\n // Refs for stable handler references\n const itemsRef = React.useRef(items);\n const onSelectRef = React.useRef(onSelect);\n itemsRef.current = items;\n onSelectRef.current = onSelect;\n\n const scrollToIndexRef = React.useRef(virtualizer.scrollToIndex);\n scrollToIndexRef.current = virtualizer.scrollToIndex;\n\n const highlightedIndexRef = React.useRef(safeHighlightedIndex);\n highlightedIndexRef.current = safeHighlightedIndex;\n\n // Stable event handlers\n const handleItemMouseEnter = React.useCallback((e: React.MouseEvent<HTMLElement>) => {\n const index = e.currentTarget.dataset.index;\n if (index != null) {\n setHighlightedIndex(Number(index));\n }\n }, []);\n\n const handleItemClick = React.useCallback((e: React.MouseEvent<HTMLElement>) => {\n const index = e.currentTarget.dataset.index;\n if (index != null) {\n const idx = Number(index);\n const currentItems = itemsRef.current;\n if (idx >= 0 && idx < currentItems.length) {\n onSelectRef.current?.(currentItems[idx], idx);\n }\n }\n }, []);\n\n const noop = React.useCallback(() => {}, []);\n\n // Item-level keyboard handler for Enter/Space activation (satisfies a11y lint rule)\n const handleItemKeyDown = React.useCallback((e: React.KeyboardEvent<HTMLElement>) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n const index = e.currentTarget.dataset.index;\n if (index != null) {\n const idx = Number(index);\n const currentItems = itemsRef.current;\n if (idx >= 0 && idx < currentItems.length) {\n onSelectRef.current?.(currentItems[idx], idx);\n }\n }\n }\n }, []);\n\n // Keyboard navigation\n const handleKeyDown = React.useCallback((e: React.KeyboardEvent) => {\n const currentItems = itemsRef.current;\n const currentHighlightedIndex = highlightedIndexRef.current;\n\n switch (e.key) {\n case 'ArrowDown': {\n e.preventDefault();\n const nextIndex =\n currentHighlightedIndex < currentItems.length - 1 ? currentHighlightedIndex + 1 : 0;\n setHighlightedIndex(nextIndex);\n scrollToIndexRef.current(nextIndex, { align: 'auto' });\n break;\n }\n case 'ArrowUp': {\n e.preventDefault();\n const prevIndex =\n currentHighlightedIndex > 0 ? currentHighlightedIndex - 1 : currentItems.length - 1;\n setHighlightedIndex(prevIndex);\n scrollToIndexRef.current(prevIndex, { align: 'auto' });\n break;\n }\n case 'Home': {\n e.preventDefault();\n setHighlightedIndex(0);\n scrollToIndexRef.current(0, { align: 'start' });\n break;\n }\n case 'End': {\n e.preventDefault();\n const lastIndex = currentItems.length - 1;\n setHighlightedIndex(lastIndex);\n scrollToIndexRef.current(lastIndex, { align: 'end' });\n break;\n }\n case 'Enter':\n case ' ': {\n e.preventDefault();\n if (currentHighlightedIndex >= 0 && currentHighlightedIndex < currentItems.length) {\n onSelectRef.current?.(currentItems[currentHighlightedIndex], currentHighlightedIndex);\n }\n break;\n }\n case 'Tab': {\n e.preventDefault();\n break;\n }\n case 'Escape': {\n (e.currentTarget as HTMLElement).blur();\n break;\n }\n }\n }, []);\n\n // Item ID generator\n const getItemId = React.useCallback(\n (index: number) => `${menuId}-item-${index}`,\n [menuId],\n );\n\n // Memoize styles\n const rootStyle = React.useMemo(\n () => ({\n overflow: 'auto' as const,\n position: 'relative' as const,\n ...style,\n }),\n [style],\n );\n\n const totalSize = virtualizer.getTotalSize();\n const viewportStyle = React.useMemo(\n () => ({\n height: `${totalSize}px`,\n width: '100%' as const,\n position: 'relative' as const,\n }),\n [totalSize],\n );\n\n return (\n <div\n ref={parentRef}\n role={isInsideMenu ? 'group' : 'menu'}\n aria-label={ariaLabel}\n aria-activedescendant={safeHighlightedIndex >= 0 ? getItemId(safeHighlightedIndex) : undefined}\n tabIndex={0}\n onKeyDown={handleKeyDown}\n className={classNames('rt-VirtualMenuRoot', className)}\n style={rootStyle}\n >\n <div className=\"rt-VirtualMenuViewport\" style={viewportStyle}>\n {virtualItems.map((virtualRow) => {\n const item = items[virtualRow.index];\n const index = virtualRow.index;\n const isHighlighted = safeHighlightedIndex === index;\n\n const itemStyle: React.CSSProperties = {\n height: virtualRow.size,\n transform: `translateY(${virtualRow.start}px)`,\n };\n\n const commonProps = {\n id: getItemId(index),\n isHighlighted,\n style: itemStyle,\n tabIndex: isHighlighted ? 0 : -1,\n 'data-highlighted': isHighlighted ? true as const : undefined,\n 'data-index': index,\n onMouseEnter: handleItemMouseEnter,\n onMouseLeave: noop,\n onClick: handleItemClick,\n onKeyDown: handleItemKeyDown,\n };\n\n // Use renderItem if provided, otherwise use SimpleItem with itemLabel\n if (RenderItem) {\n return (\n <RenderItem\n key={virtualRow.key}\n item={item}\n index={index}\n {...commonProps}\n />\n );\n }\n\n return (\n <SimpleItem\n key={virtualRow.key}\n label={getLabel!(item)}\n {...commonProps}\n />\n );\n })}\n </div>\n </div>\n );\n}\n\nVirtualMenuRoot.displayName = 'VirtualMenu';\n\n// ============================================================================\n// VirtualMenu.Item Component (for custom renderItem usage)\n// ============================================================================\n\ninterface VirtualMenuItemProps extends React.ComponentPropsWithoutRef<'div'> {\n children: React.ReactNode;\n /** Data attribute for highlight styling */\n 'data-highlighted'?: true | undefined;\n /** Data attribute for event delegation */\n 'data-index'?: number;\n}\n\nconst VirtualMenuItemInner = React.forwardRef<HTMLDivElement, VirtualMenuItemProps>(\n ({ className, children, ...props }, forwardedRef) => {\n return (\n <div\n ref={forwardedRef}\n role=\"menuitem\"\n className={classNames('rt-reset', 'rt-BaseMenuItem', 'rt-VirtualMenuItem', className)}\n {...props}\n >\n {children}\n </div>\n );\n },\n);\n\nVirtualMenuItemInner.displayName = 'VirtualMenu.Item';\n\n// Memoized with custom comparison\nconst VirtualMenuItem = React.memo(VirtualMenuItemInner, (prevProps, nextProps) => {\n const prevStyle = prevProps.style as React.CSSProperties | undefined;\n const nextStyle = nextProps.style as React.CSSProperties | undefined;\n if (prevStyle?.height !== nextStyle?.height) return false;\n if (prevStyle?.transform !== nextStyle?.transform) return false;\n if (prevProps['data-highlighted'] !== nextProps['data-highlighted']) return false;\n if (prevProps.tabIndex !== nextProps.tabIndex) return false;\n if (prevProps.id !== nextProps.id) return false;\n if (prevProps.className !== nextProps.className) return false;\n if (prevProps.children !== nextProps.children) return false;\n return true;\n});\n\n// ============================================================================\n// Exports\n// ============================================================================\n\nconst VirtualMenu = Object.assign(VirtualMenuRoot, {\n Item: VirtualMenuItem,\n});\n\nexport { VirtualMenu };\nexport type { VirtualMenuProps, VirtualMenuItemProps, VirtualMenuRenderItemProps };\n", "'use client';\n\nimport * as React from 'react';\nimport type { Responsive } from '../../props/prop-def.js';\n\n/**\n * Context to detect if a component is rendered inside a menu (DropdownMenu, ContextMenu, etc.)\n * Used by VirtualMenu to adjust its behavior:\n * - Skip role=\"menu\" when inside a parent menu (parent owns the role)\n * - Delegate certain keyboard handling to parent\n * - Use the correct item height based on menu size\n */\n\nexport type MenuSize = '1' | '2';\n\ninterface MenuContextValue {\n /** Whether we're inside a menu that owns the menu role */\n isInsideMenu: boolean;\n /** Menu size for calculating item heights (resolved to non-responsive value) */\n size?: MenuSize;\n}\n\nconst MenuContext = React.createContext<MenuContextValue>({ isInsideMenu: false });\n\ninterface MenuProviderProps {\n children: React.ReactNode;\n /** Menu size passed from parent (DropdownMenu.Content, ContextMenu.Content, etc.) */\n size?: Responsive<MenuSize>;\n}\n\n/** Extract the base size from a potentially responsive value */\nfunction resolveSize(size: Responsive<MenuSize> | undefined): MenuSize | undefined {\n if (!size) return undefined;\n if (typeof size === 'string') return size;\n // For responsive objects, use the 'initial' value\n return size.initial;\n}\n\nexport function MenuProvider({ children, size }: MenuProviderProps) {\n const resolvedSize = resolveSize(size);\n const value = React.useMemo(() => ({ isInsideMenu: true, size: resolvedSize }), [resolvedSize]);\n return <MenuContext.Provider value={value}>{children}</MenuContext.Provider>;\n}\n\nexport function useMenuContext() {\n return React.useContext(MenuContext);\n}\n\n/** Map menu size to item height in pixels */\nexport const menuSizeToItemHeight: Record<MenuSize, number> = {\n '1': 24, // --space-5\n '2': 32, // --space-6\n};\n"],
|
|
5
|
-
"mappings": "+kBAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,iBAAAE,KAAA,eAAAC,GAAAH,IAEA,IAAAI,EAAuB,oBACvBC,EAAuB,yBACvBC,EAA+B,mCCF/B,IAAAC,EAAuB,oBAoBjBC,GAAoB,gBAAgC,CAAE,aAAc,EAAM,CAAC,EAsB1E,SAASC,GAAiB,CAC/B,OAAa,aAAWC,EAAW,CACrC,CAGO,IAAMC,EAAiD,CAC5D,EAAK,GACL,EAAK,EACP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W,EAAAxD,SAAW,WAAY,kBAAmB,qBAAsBW,CAAS,EACnF,GAAG4C,GAEHD,CACH,CAGN,EAEAD,EAAqB,YAAc,mBAGnC,IAAMI,GAAwB,OAAKJ,EAAsB,CAACK,EAAWC,IAAc,CACjF,IAAMC,EAAYF,EAAU,MACtBG,EAAYF,EAAU,MAO5B,MANI,EAAAC,GAAW,SAAWC,GAAW,QACjCD,GAAW,YAAcC,GAAW,WACpCH,EAAU,kBAAkB,IAAMC,EAAU,kBAAkB,GAC9DD,EAAU,WAAaC,EAAU,UACjCD,EAAU,KAAOC,EAAU,IAC3BD,EAAU,YAAcC,EAAU,WAClCD,EAAU,WAAaC,EAAU,SAEvC,CAAC,EAMKG,GAAc,OAAO,OAAO3D,EAAiB,CACjD,KAAMsD,EACR,CAAC",
|
|
6
|
-
"names": ["virtual_menu_exports", "__export", "VirtualMenu", "__toCommonJS", "React", "import_classnames", "import_react_virtual", "React", "
|
|
3
|
+
"sources": ["../../../src/components/virtual-menu.tsx", "../../../src/components/_internal/menu-context.tsx", "../../../src/components/theme.tsx", "../../../src/helpers/get-matching-gray-color.ts", "../../../src/hooks/use-prop-synced-state.ts", "../../../src/helpers/use-deprecation-warning.ts", "../../../src/props/as-child.prop.ts", "../../../src/props/color.prop.ts", "../../../src/props/radius.prop.ts", "../../../src/components/theme.props.tsx"],
|
|
4
|
+
"sourcesContent": ["'use client';\n\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { useVirtualizer } from '@tanstack/react-virtual';\nimport { useMenuContext, getMenuItemHeight } from './_internal/menu-context.js';\nimport { useThemeContext } from './theme.js';\n\n/**\n * VirtualMenu - A virtualized menu component for rendering large lists efficiently.\n *\n * Uses TanStack Virtual to render only visible items.\n * Works inside any container (DropdownMenu.Content, Popover.Content, etc.)\n *\n * @example\n * // Simple usage with itemLabel\n * <VirtualMenu\n * items={items}\n * itemLabel={(item) => item.name}\n * onSelect={handleSelect}\n * />\n *\n * @example\n * // Custom rendering with renderItem\n * const UserItem = React.memo(({ item, ...props }) => (\n * <VirtualMenu.Item {...props}>\n * <Avatar src={item.avatar} />\n * {item.name}\n * </VirtualMenu.Item>\n * ));\n *\n * <VirtualMenu items={users} renderItem={UserItem} onSelect={handleSelect} />\n */\n\n// ============================================================================\n// Types\n// ============================================================================\n\n/** Props passed to custom renderItem components */\ninterface VirtualMenuRenderItemProps<T> {\n /** The item data */\n item: T;\n /** Index in the items array */\n index: number;\n /** Whether this item is currently highlighted */\n isHighlighted: boolean;\n /** Unique ID for accessibility */\n id: string;\n /** Positioning styles - must be applied */\n style: React.CSSProperties;\n /** Tab index for focus management */\n tabIndex: number;\n /** Data attribute for CSS styling */\n 'data-highlighted': true | undefined;\n /** Data attribute for event delegation */\n 'data-index': number;\n /** Mouse enter handler */\n onMouseEnter: (e: React.MouseEvent<HTMLElement>) => void;\n /** Mouse leave handler */\n onMouseLeave: () => void;\n /** Click handler */\n onClick: (e: React.MouseEvent<HTMLElement>) => void;\n /** Keyboard handler for Enter/Space activation */\n onKeyDown: (e: React.KeyboardEvent<HTMLElement>) => void;\n}\n\ninterface VirtualMenuProps<T> {\n /** Array of items to render */\n items: T[];\n /**\n * Simple label accessor for basic text items.\n * Can be a property key or a function.\n * @example\n * itemLabel=\"name\"\n * itemLabel={(item) => item.name}\n */\n itemLabel?: keyof T | ((item: T) => React.ReactNode);\n /**\n * Custom component for rendering items.\n * Must be memoized (React.memo) for optimal performance.\n * @example\n * const MyItem = React.memo(({ item, ...props }) => (\n * <VirtualMenu.Item {...props}>{item.name}</VirtualMenu.Item>\n * ));\n * <VirtualMenu items={items} renderItem={MyItem} />\n */\n renderItem?: React.ComponentType<VirtualMenuRenderItemProps<T>>;\n /**\n * Menu size - controls item height.\n * Automatically inherited from parent DropdownMenu.Content/ContextMenu.Content.\n * Only set manually when using VirtualMenu outside of a menu context.\n * @default '2' (or inherited from context)\n */\n size?: '1' | '2';\n /**\n * Estimated height of each item in pixels.\n * Can be a number (same for all) or a function (per-item).\n * Usually not needed - height is automatically derived from size prop/context.\n * Use this only for custom item heights (e.g., variable height items).\n */\n estimatedItemSize?: number | ((index: number) => number);\n /** Number of items to render outside visible area */\n overscan?: number;\n /** Callback when an item is selected */\n onSelect?: (item: T, index: number) => void;\n /** Additional class name */\n className?: string;\n /** Additional styles */\n style?: React.CSSProperties;\n /** Accessible label for the menu */\n 'aria-label'?: string;\n}\n\n// ============================================================================\n// Internal Memoized Item Component\n// ============================================================================\n\ninterface SimpleItemProps {\n label: React.ReactNode;\n isHighlighted: boolean;\n id: string;\n style: React.CSSProperties;\n tabIndex: number;\n 'data-highlighted': true | undefined;\n 'data-index': number;\n onMouseEnter: (e: React.MouseEvent<HTMLElement>) => void;\n onMouseLeave: () => void;\n onClick: (e: React.MouseEvent<HTMLElement>) => void;\n onKeyDown: (e: React.KeyboardEvent<HTMLElement>) => void;\n}\n\nconst SimpleItem = React.memo(\n function SimpleItem({\n label,\n isHighlighted: _isHighlighted,\n id,\n style,\n tabIndex,\n 'data-highlighted': dataHighlighted,\n 'data-index': dataIndex,\n onMouseEnter,\n onMouseLeave,\n onClick,\n onKeyDown,\n }: SimpleItemProps) {\n return (\n <div\n id={id}\n role=\"menuitem\"\n className={classNames('rt-reset', 'rt-BaseMenuItem', 'rt-VirtualMenuItem')}\n style={style}\n tabIndex={tabIndex}\n data-highlighted={dataHighlighted}\n data-index={dataIndex}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n onClick={onClick}\n onKeyDown={onKeyDown}\n >\n {label}\n </div>\n );\n },\n (prev, next) => {\n // Custom comparison - only re-render if these change\n if (prev.label !== next.label) return false;\n if (prev['data-highlighted'] !== next['data-highlighted']) return false;\n if (prev.style.height !== next.style.height) return false;\n if (prev.style.transform !== next.style.transform) return false;\n if (prev.tabIndex !== next.tabIndex) return false;\n if (prev.id !== next.id) return false;\n // Event handlers are stable, skip comparison\n return true;\n },\n);\n\n// ============================================================================\n// VirtualMenu Component\n// ============================================================================\n\nfunction VirtualMenuRoot<T>({\n items,\n itemLabel,\n renderItem: RenderItem,\n size: sizeProp,\n estimatedItemSize: estimatedItemSizeProp,\n overscan = 5,\n onSelect,\n className,\n style,\n 'aria-label': ariaLabel,\n}: VirtualMenuProps<T>) {\n const menuId = React.useId();\n const parentRef = React.useRef<HTMLDivElement>(null);\n const [highlightedIndex, setHighlightedIndex] = React.useState<number>(-1);\n const { isInsideMenu, size: contextSize, itemHeight: contextItemHeight } = useMenuContext();\n const { scaling } = useThemeContext();\n\n // Resolve item height: explicit prop > own size > parent menu > default size '2'.\n // Heights follow the theme scaling, like the --base-menu-item-height token.\n const estimatedItemSize =\n estimatedItemSizeProp ??\n (sizeProp\n ? getMenuItemHeight(sizeProp, scaling)\n : (contextItemHeight ?? getMenuItemHeight(contextSize ?? '2', scaling)));\n\n // Validate props\n if (!itemLabel && !RenderItem) {\n throw new Error('VirtualMenu requires either itemLabel or renderItem prop');\n }\n\n // Normalize itemLabel to a function\n const getLabel = React.useMemo(() => {\n if (!itemLabel) return null;\n if (typeof itemLabel === 'function') return itemLabel;\n return (item: T) => item[itemLabel] as React.ReactNode;\n }, [itemLabel]);\n\n // Derive safe highlighted index\n const safeHighlightedIndex = React.useMemo(() => {\n if (items.length === 0) return -1;\n if (highlightedIndex < 0) return -1;\n return Math.min(highlightedIndex, items.length - 1);\n }, [highlightedIndex, items.length]);\n\n // Normalize estimatedItemSize to a function\n const getItemSize = React.useMemo(\n () =>\n typeof estimatedItemSize === 'function'\n ? estimatedItemSize\n : () => estimatedItemSize,\n [estimatedItemSize],\n );\n\n const virtualizer = useVirtualizer({\n count: items.length,\n getScrollElement: () => parentRef.current,\n estimateSize: getItemSize,\n overscan,\n });\n\n const virtualItems = virtualizer.getVirtualItems();\n\n // Refs for stable handler references\n const itemsRef = React.useRef(items);\n const onSelectRef = React.useRef(onSelect);\n itemsRef.current = items;\n onSelectRef.current = onSelect;\n\n const scrollToIndexRef = React.useRef(virtualizer.scrollToIndex);\n scrollToIndexRef.current = virtualizer.scrollToIndex;\n\n const highlightedIndexRef = React.useRef(safeHighlightedIndex);\n highlightedIndexRef.current = safeHighlightedIndex;\n\n // Stable event handlers\n const handleItemMouseEnter = React.useCallback((e: React.MouseEvent<HTMLElement>) => {\n const index = e.currentTarget.dataset.index;\n if (index != null) {\n setHighlightedIndex(Number(index));\n }\n }, []);\n\n const handleItemClick = React.useCallback((e: React.MouseEvent<HTMLElement>) => {\n const index = e.currentTarget.dataset.index;\n if (index != null) {\n const idx = Number(index);\n const currentItems = itemsRef.current;\n if (idx >= 0 && idx < currentItems.length) {\n onSelectRef.current?.(currentItems[idx], idx);\n }\n }\n }, []);\n\n const noop = React.useCallback(() => {}, []);\n\n // Item-level keyboard handler for Enter/Space activation (satisfies a11y lint rule)\n const handleItemKeyDown = React.useCallback((e: React.KeyboardEvent<HTMLElement>) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n const index = e.currentTarget.dataset.index;\n if (index != null) {\n const idx = Number(index);\n const currentItems = itemsRef.current;\n if (idx >= 0 && idx < currentItems.length) {\n onSelectRef.current?.(currentItems[idx], idx);\n }\n }\n }\n }, []);\n\n // Keyboard navigation\n const handleKeyDown = React.useCallback((e: React.KeyboardEvent) => {\n const currentItems = itemsRef.current;\n const currentHighlightedIndex = highlightedIndexRef.current;\n\n switch (e.key) {\n case 'ArrowDown': {\n e.preventDefault();\n const nextIndex =\n currentHighlightedIndex < currentItems.length - 1 ? currentHighlightedIndex + 1 : 0;\n setHighlightedIndex(nextIndex);\n scrollToIndexRef.current(nextIndex, { align: 'auto' });\n break;\n }\n case 'ArrowUp': {\n e.preventDefault();\n const prevIndex =\n currentHighlightedIndex > 0 ? currentHighlightedIndex - 1 : currentItems.length - 1;\n setHighlightedIndex(prevIndex);\n scrollToIndexRef.current(prevIndex, { align: 'auto' });\n break;\n }\n case 'Home': {\n e.preventDefault();\n setHighlightedIndex(0);\n scrollToIndexRef.current(0, { align: 'start' });\n break;\n }\n case 'End': {\n e.preventDefault();\n const lastIndex = currentItems.length - 1;\n setHighlightedIndex(lastIndex);\n scrollToIndexRef.current(lastIndex, { align: 'end' });\n break;\n }\n case 'Enter':\n case ' ': {\n e.preventDefault();\n if (currentHighlightedIndex >= 0 && currentHighlightedIndex < currentItems.length) {\n onSelectRef.current?.(currentItems[currentHighlightedIndex], currentHighlightedIndex);\n }\n break;\n }\n case 'Tab': {\n e.preventDefault();\n break;\n }\n case 'Escape': {\n (e.currentTarget as HTMLElement).blur();\n break;\n }\n }\n }, []);\n\n // Item ID generator\n const getItemId = React.useCallback(\n (index: number) => `${menuId}-item-${index}`,\n [menuId],\n );\n\n // Memoize styles\n const rootStyle = React.useMemo(\n () => ({\n overflow: 'auto' as const,\n position: 'relative' as const,\n ...style,\n }),\n [style],\n );\n\n const totalSize = virtualizer.getTotalSize();\n const viewportStyle = React.useMemo(\n () => ({\n height: `${totalSize}px`,\n width: '100%' as const,\n position: 'relative' as const,\n }),\n [totalSize],\n );\n\n return (\n <div\n ref={parentRef}\n role={isInsideMenu ? 'group' : 'menu'}\n aria-label={ariaLabel}\n aria-activedescendant={safeHighlightedIndex >= 0 ? getItemId(safeHighlightedIndex) : undefined}\n tabIndex={0}\n onKeyDown={handleKeyDown}\n className={classNames('rt-VirtualMenuRoot', className)}\n style={rootStyle}\n >\n <div className=\"rt-VirtualMenuViewport\" style={viewportStyle}>\n {virtualItems.map((virtualRow) => {\n const item = items[virtualRow.index];\n const index = virtualRow.index;\n const isHighlighted = safeHighlightedIndex === index;\n\n const itemStyle: React.CSSProperties = {\n height: virtualRow.size,\n transform: `translateY(${virtualRow.start}px)`,\n };\n\n const commonProps = {\n id: getItemId(index),\n isHighlighted,\n style: itemStyle,\n tabIndex: isHighlighted ? 0 : -1,\n 'data-highlighted': isHighlighted ? true as const : undefined,\n 'data-index': index,\n onMouseEnter: handleItemMouseEnter,\n onMouseLeave: noop,\n onClick: handleItemClick,\n onKeyDown: handleItemKeyDown,\n };\n\n // Use renderItem if provided, otherwise use SimpleItem with itemLabel\n if (RenderItem) {\n return (\n <RenderItem\n key={virtualRow.key}\n item={item}\n index={index}\n {...commonProps}\n />\n );\n }\n\n return (\n <SimpleItem\n key={virtualRow.key}\n label={getLabel!(item)}\n {...commonProps}\n />\n );\n })}\n </div>\n </div>\n );\n}\n\nVirtualMenuRoot.displayName = 'VirtualMenu';\n\n// ============================================================================\n// VirtualMenu.Item Component (for custom renderItem usage)\n// ============================================================================\n\ninterface VirtualMenuItemProps extends React.ComponentPropsWithoutRef<'div'> {\n children: React.ReactNode;\n /** Data attribute for highlight styling */\n 'data-highlighted'?: true | undefined;\n /** Data attribute for event delegation */\n 'data-index'?: number;\n}\n\nconst VirtualMenuItemInner = React.forwardRef<HTMLDivElement, VirtualMenuItemProps>(\n ({ className, children, ...props }, forwardedRef) => {\n return (\n <div\n ref={forwardedRef}\n role=\"menuitem\"\n className={classNames('rt-reset', 'rt-BaseMenuItem', 'rt-VirtualMenuItem', className)}\n {...props}\n >\n {children}\n </div>\n );\n },\n);\n\nVirtualMenuItemInner.displayName = 'VirtualMenu.Item';\n\n// Memoized with custom comparison\nconst VirtualMenuItem = React.memo(VirtualMenuItemInner, (prevProps, nextProps) => {\n const prevStyle = prevProps.style as React.CSSProperties | undefined;\n const nextStyle = nextProps.style as React.CSSProperties | undefined;\n if (prevStyle?.height !== nextStyle?.height) return false;\n if (prevStyle?.transform !== nextStyle?.transform) return false;\n if (prevProps['data-highlighted'] !== nextProps['data-highlighted']) return false;\n if (prevProps.tabIndex !== nextProps.tabIndex) return false;\n if (prevProps.id !== nextProps.id) return false;\n if (prevProps.className !== nextProps.className) return false;\n if (prevProps.children !== nextProps.children) return false;\n return true;\n});\n\n// ============================================================================\n// Exports\n// ============================================================================\n\nconst VirtualMenu = Object.assign(VirtualMenuRoot, {\n Item: VirtualMenuItem,\n});\n\nexport { VirtualMenu };\nexport type { VirtualMenuProps, VirtualMenuItemProps, VirtualMenuRenderItemProps };\n", "'use client';\n\nimport * as React from 'react';\n\nimport { useThemeContext } from '../theme.js';\nimport { useResolvedResponsiveValue } from './base-menu.utils.js';\n\nimport type { Responsive } from '../../props/prop-def.js';\n\n/**\n * Context to detect if a component is rendered inside a menu (DropdownMenu, ContextMenu, etc.)\n * Used by VirtualMenu to adjust its behavior:\n * - Skip role=\"menu\" when inside a parent menu (parent owns the role)\n * - Delegate certain keyboard handling to parent\n * - Use the correct item height based on menu size\n */\n\nexport type MenuSize = '1' | '2';\n\ninterface MenuContextValue {\n /** Whether we're inside a menu that owns the menu role */\n isInsideMenu: boolean;\n /** Menu size for the current breakpoint */\n size?: MenuSize;\n /** Item height in px for the current size and theme scaling */\n itemHeight?: number;\n}\n\nconst MenuContext = React.createContext<MenuContextValue>({ isInsideMenu: false });\n\ninterface MenuProviderProps {\n children: React.ReactNode;\n /** Menu size passed from parent (DropdownMenu.Content, ContextMenu.Content, etc.) */\n size?: Responsive<MenuSize>;\n}\n\n/** Map menu size to item height in pixels at 100% scaling */\nexport const menuSizeToItemHeight: Record<MenuSize, number> = {\n '1': 24, // --space-5\n '2': 32, // --space-6\n};\n\n/** Item height in px for a size at the given theme scaling (\"100%\", \"110%\"\u2026). */\nexport function getMenuItemHeight(size: MenuSize, scaling: string | undefined): number {\n const scale = scaling ? parseFloat(scaling) / 100 : 1;\n return menuSizeToItemHeight[size] * (Number.isFinite(scale) ? scale : 1);\n}\n\nexport function MenuProvider({ children, size }: MenuProviderProps) {\n const resolvedSize = useResolvedResponsiveValue<MenuSize | undefined>(size, undefined);\n const { scaling } = useThemeContext();\n const itemHeight = resolvedSize ? getMenuItemHeight(resolvedSize, scaling) : undefined;\n const value = React.useMemo(\n () => ({ isInsideMenu: true, size: resolvedSize, itemHeight }),\n [resolvedSize, itemHeight],\n );\n return <MenuContext.Provider value={value}>{children}</MenuContext.Provider>;\n}\n\nexport function useMenuContext() {\n return React.useContext(MenuContext);\n}\n", "'use client';\n\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { Direction, Slot, Tooltip as TooltipPrimitive } from 'radix-ui';\nimport { useComposedRefs, useLayoutEffect } from 'radix-ui/internal';\n\nimport { getMatchingGrayColor } from '../helpers/get-matching-gray-color.js';\nimport { usePropSyncedState } from '../hooks/use-prop-synced-state.js';\nimport { useDeprecatedPanelBackgroundWarning } from '../helpers/use-deprecation-warning.js';\nimport { themePropDefs } from './theme.props.js';\n\nimport type { ThemeOwnProps } from './theme.props.js';\nimport type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js';\n\nconst noop = () => {};\n\ntype ThemeAppearance = (typeof themePropDefs.appearance.values)[number];\ntype ThemeAccentColor = (typeof themePropDefs.accentColor.values)[number];\ntype ThemeGrayColor = (typeof themePropDefs.grayColor.values)[number];\ntype ThemeMaterial = (typeof themePropDefs.material.values)[number];\ntype ThemePanelBackground = (typeof themePropDefs.panelBackground.values)[number];\ntype ThemeRadius = (typeof themePropDefs.radius.values)[number];\ntype ThemeScaling = (typeof themePropDefs.scaling.values)[number];\ntype ThemeFontFamily = (typeof themePropDefs.fontFamily.values)[number];\n// Headings follow the body font until something sets this, so `undefined` is a\n// meaningful value here rather than a missing one.\ntype ThemeHeadingFontFamily = ThemeFontFamily | undefined;\n\ninterface ThemeChangeHandlers {\n onAppearanceChange: (appearance: ThemeAppearance) => void;\n onAccentColorChange: (accentColor: ThemeAccentColor) => void;\n onGrayColorChange: (grayColor: ThemeGrayColor) => void;\n onMaterialChange: (material: ThemeMaterial) => void;\n onPanelBackgroundChange: (panelBackground: ThemePanelBackground) => void;\n onRadiusChange: (radius: ThemeRadius) => void;\n onScalingChange: (scaling: ThemeScaling) => void;\n onFontFamilyChange: (fontFamily: ThemeFontFamily) => void;\n onHeadingFontFamilyChange: (headingFontFamily: ThemeHeadingFontFamily) => void;\n}\n\ninterface ThemeContextValue extends ThemeChangeHandlers {\n appearance: ThemeAppearance;\n accentColor: ThemeAccentColor;\n grayColor: ThemeGrayColor;\n resolvedGrayColor: ThemeGrayColor;\n material: ThemeMaterial;\n panelBackground: ThemePanelBackground;\n radius: ThemeRadius;\n scaling: ThemeScaling;\n fontFamily: ThemeFontFamily;\n headingFontFamily: ThemeHeadingFontFamily;\n}\n// Default theme values used when components render outside a Theme provider\nconst defaultThemeContext: ThemeContextValue = {\n appearance: themePropDefs.appearance.default,\n accentColor: themePropDefs.accentColor.default,\n grayColor: themePropDefs.grayColor.default,\n resolvedGrayColor: themePropDefs.grayColor.default,\n material: themePropDefs.material.default,\n panelBackground: themePropDefs.panelBackground.default,\n radius: themePropDefs.radius.default,\n scaling: themePropDefs.scaling.default,\n fontFamily: themePropDefs.fontFamily.default,\n headingFontFamily: undefined,\n onAppearanceChange: noop,\n onAccentColorChange: noop,\n onGrayColorChange: noop,\n onMaterialChange: noop,\n onPanelBackgroundChange: noop,\n onRadiusChange: noop,\n onScalingChange: noop,\n onFontFamilyChange: noop,\n onHeadingFontFamilyChange: noop,\n};\n\nconst ThemeContext = React.createContext<ThemeContextValue | undefined>(undefined);\n\nfunction useThemeContext() {\n const context = React.useContext(ThemeContext);\n // Return default context if used outside Theme provider (e.g., during SSR)\n return context ?? defaultThemeContext;\n}\n\ninterface ThemeProps extends ThemeImplPublicProps {}\nconst Theme = React.forwardRef<ThemeImplElement, ThemeProps>((props, forwardedRef) => {\n const context = React.useContext(ThemeContext);\n const isRoot = context === undefined;\n if (isRoot) {\n return (\n <TooltipPrimitive.Provider delayDuration={200}>\n <Direction.Provider dir=\"ltr\">\n <ThemeRoot {...props} ref={forwardedRef} />\n </Direction.Provider>\n </TooltipPrimitive.Provider>\n );\n }\n return <ThemeImpl {...props} ref={forwardedRef} />;\n});\nTheme.displayName = 'Theme';\n\nconst ThemeRoot = React.forwardRef<ThemeImplElement, ThemeImplPublicProps>(\n (props, forwardedRef) => {\n const {\n appearance: appearanceProp = themePropDefs.appearance.default,\n accentColor: accentColorProp = themePropDefs.accentColor.default,\n grayColor: grayColorProp = themePropDefs.grayColor.default,\n material: materialProp = themePropDefs.material.default,\n panelBackground: panelBackgroundProp = themePropDefs.panelBackground.default,\n radius: radiusProp = themePropDefs.radius.default,\n scaling: scalingProp = themePropDefs.scaling.default,\n fontFamily: fontFamilyProp = themePropDefs.fontFamily.default,\n headingFontFamily: headingFontFamilyProp,\n hasBackground = themePropDefs.hasBackground.default,\n ...rootProps\n } = props;\n\n useDeprecatedPanelBackgroundWarning(props.panelBackground);\n\n // Each of these follows its prop but stays independently settable, so\n // `ThemePanel` can change the theme at runtime. Syncing during render\n // rather than in an effect matters here: an effect would commit the old\n // theme first and re-render every consumer of the context a second time.\n const [appearance, setAppearance] = usePropSyncedState(appearanceProp);\n const [accentColor, setAccentColor] = usePropSyncedState(accentColorProp);\n const [grayColor, setGrayColor] = usePropSyncedState(grayColorProp);\n\n // Material takes precedence over panelBackground\n const effectiveMaterial =\n materialProp !== themePropDefs.material.default ? materialProp : panelBackgroundProp;\n const [material, setMaterial] = usePropSyncedState(effectiveMaterial);\n\n // Keep panelBackground in sync with material for backward compatibility\n const [panelBackground, setPanelBackground] = usePropSyncedState(material);\n\n const [radius, setRadius] = usePropSyncedState(radiusProp);\n const [scaling, setScaling] = usePropSyncedState(scalingProp);\n const [fontFamily, setFontFamily] = usePropSyncedState(fontFamilyProp);\n const [headingFontFamily, setHeadingFontFamily] = usePropSyncedState(headingFontFamilyProp);\n\n return (\n <ThemeImpl\n {...rootProps}\n ref={forwardedRef}\n isRoot\n hasBackground={hasBackground}\n //\n appearance={appearance}\n accentColor={accentColor}\n grayColor={grayColor}\n material={material}\n panelBackground={panelBackground}\n radius={radius}\n scaling={scaling}\n fontFamily={fontFamily}\n headingFontFamily={headingFontFamily}\n //\n onAppearanceChange={setAppearance}\n onAccentColorChange={setAccentColor}\n onGrayColorChange={setGrayColor}\n onMaterialChange={setMaterial}\n onPanelBackgroundChange={setPanelBackground}\n onRadiusChange={setRadius}\n onScalingChange={setScaling}\n onFontFamilyChange={setFontFamily}\n onHeadingFontFamilyChange={setHeadingFontFamily}\n />\n );\n },\n);\nThemeRoot.displayName = 'ThemeRoot';\n\ntype ThemeImplElement = React.ElementRef<'div'>;\ninterface ThemeImplProps extends ThemeImplPublicProps, ThemeImplPrivateProps {}\ninterface ThemeImplPublicProps\n extends ComponentPropsWithout<'div', RemovedProps | 'dir'>,\n ThemeOwnProps {}\ninterface ThemeImplPrivateProps extends Partial<ThemeChangeHandlers> {\n isRoot?: boolean;\n}\nfunction getClientOS(): 'windows' | 'macos' | 'linux' | undefined {\n if (typeof navigator === 'undefined') return undefined;\n const ua = navigator.userAgent;\n if (ua.includes('Win')) return 'windows';\n if (ua.includes('Mac')) return 'macos';\n if (ua.includes('Linux')) return 'linux';\n return undefined;\n}\n\nconst ThemeImpl = React.forwardRef<ThemeImplElement, ThemeImplProps>((props, forwardedRef) => {\n const context = React.useContext(ThemeContext);\n const {\n asChild,\n isRoot,\n hasBackground: hasBackgroundProp,\n //\n appearance = props.appearance ?? context?.appearance ?? themePropDefs.appearance.default,\n accentColor = props.accentColor ?? context?.accentColor ?? themePropDefs.accentColor.default,\n grayColor = props.grayColor ?? context?.resolvedGrayColor ?? themePropDefs.grayColor.default,\n material = props.material ?? context?.material ?? themePropDefs.material.default,\n panelBackground = props.panelBackground ??\n context?.panelBackground ??\n themePropDefs.panelBackground.default,\n radius = props.radius ?? context?.radius ?? themePropDefs.radius.default,\n scaling = props.scaling ?? context?.scaling ?? themePropDefs.scaling.default,\n fontFamily = props.fontFamily ?? context?.fontFamily ?? themePropDefs.fontFamily.default,\n headingFontFamily = props.headingFontFamily ?? context?.headingFontFamily,\n //\n onAppearanceChange = noop,\n onAccentColorChange = noop,\n onGrayColorChange = noop,\n onMaterialChange = noop,\n onPanelBackgroundChange = noop,\n onRadiusChange = noop,\n onScalingChange = noop,\n onFontFamilyChange = noop,\n onHeadingFontFamilyChange = noop,\n //\n ...themeProps\n } = props;\n const Comp = asChild ? Slot.Root : 'div';\n const resolvedGrayColor = grayColor === 'auto' ? getMatchingGrayColor(accentColor) : grayColor;\n const isExplicitAppearance = props.appearance === 'light' || props.appearance === 'dark';\n const hasBackground =\n hasBackgroundProp === undefined ? isRoot || isExplicitAppearance : hasBackgroundProp;\n\n // `data-os` can only be resolved on the client. Writing it straight to the\n // DOM keeps it out of the server markup \u2014 so hydration still matches \u2014 without\n // spending a render pass, and a state update here would re-render the whole\n // application on mount.\n const rootRef = React.useRef<ThemeImplElement>(null);\n const composedRef = useComposedRefs(forwardedRef, rootRef);\n const hasExplicitOS = 'data-os' in themeProps;\n\n useLayoutEffect(() => {\n if (!isRoot || hasExplicitOS) return;\n const node = rootRef.current;\n if (!node) return;\n\n const os = getClientOS();\n if (!os) return;\n node.setAttribute('data-os', os);\n return () => node.removeAttribute('data-os');\n }, [isRoot, hasExplicitOS]);\n\n return (\n <ThemeContext.Provider\n value={React.useMemo(\n () => ({\n appearance,\n accentColor,\n grayColor,\n resolvedGrayColor,\n material,\n panelBackground,\n radius,\n scaling,\n fontFamily,\n headingFontFamily,\n //\n onAppearanceChange,\n onAccentColorChange,\n onGrayColorChange,\n onMaterialChange,\n onPanelBackgroundChange,\n onRadiusChange,\n onScalingChange,\n onFontFamilyChange,\n onHeadingFontFamilyChange,\n }),\n [\n appearance,\n accentColor,\n grayColor,\n resolvedGrayColor,\n material,\n panelBackground,\n radius,\n scaling,\n fontFamily,\n headingFontFamily,\n //\n onAppearanceChange,\n onAccentColorChange,\n onGrayColorChange,\n onMaterialChange,\n onPanelBackgroundChange,\n onRadiusChange,\n onScalingChange,\n onFontFamilyChange,\n onHeadingFontFamilyChange,\n ],\n )}\n >\n <Comp\n data-is-root-theme={isRoot ? 'true' : 'false'}\n data-accent-color={accentColor}\n data-gray-color={resolvedGrayColor}\n // for nested `Theme` background\n data-has-background={hasBackground ? 'true' : 'false'}\n data-material={material}\n data-panel-background={panelBackground}\n data-radius={radius}\n data-scaling={scaling}\n data-font-family={fontFamily}\n data-heading-font-family={headingFontFamily}\n ref={composedRef}\n {...themeProps}\n className={classNames(\n 'radix-themes',\n {\n light: appearance === 'light',\n dark: appearance === 'dark',\n },\n themeProps.className,\n )}\n />\n </ThemeContext.Provider>\n );\n});\nThemeImpl.displayName = 'ThemeImpl';\n\nexport { Theme, ThemeContext, useThemeContext };\nexport type { ThemeProps, ThemeContextValue };\n", "import type { accentColors } from '../props/color.prop.js';\n\ntype ThemeAccentColor = (typeof accentColors)[number];\n\nexport function getMatchingGrayColor(accentColor: ThemeAccentColor) {\n switch (accentColor) {\n case 'tomato':\n case 'red':\n case 'ruby':\n case 'crimson':\n case 'pink':\n case 'plum':\n case 'purple':\n case 'violet':\n return 'mauve';\n case 'iris':\n case 'indigo':\n case 'blue':\n case 'sky':\n case 'cyan':\n return 'slate';\n case 'teal':\n case 'jade':\n case 'mint':\n case 'green':\n return 'sage';\n case 'grass':\n case 'lime':\n return 'olive';\n case 'yellow':\n case 'amber':\n case 'orange':\n case 'brown':\n case 'gold':\n case 'bronze':\n return 'sand';\n case 'gray':\n return 'gray';\n }\n}\n", "import * as React from 'react';\n\n/**\n * State that tracks a prop but can also be set imperatively \u2014 the shape `Theme`\n * needs, where a prop sets the value and `ThemePanel` can change it at runtime.\n *\n * Adjusts state during render rather than syncing in a `useEffect`. An effect\n * would commit one render carrying the *old* value and schedule a second one,\n * which for a provider means every consumer renders twice and the browser can\n * paint the stale value in between.\n *\n * @see https://react.dev/reference/react/useState#storing-information-from-previous-renders\n */\nexport function usePropSyncedState<T>(propValue: T) {\n const [value, setValue] = React.useState(propValue);\n const [previousPropValue, setPreviousPropValue] = React.useState(propValue);\n\n if (!Object.is(propValue, previousPropValue)) {\n setPreviousPropValue(propValue);\n setValue(propValue);\n }\n\n return [value, setValue] as const;\n}\n", "import * as React from 'react';\n\nconst PANEL_BACKGROUND_MESSAGE = 'Warning: The `panelBackground` prop is deprecated and will be removed in a future version. Use `material` prop instead.';\n\nconst warned = new Set<string>();\n\nfunction warnOnce(message: string) {\n if (warned.has(message)) return;\n warned.add(message);\n console.warn(message);\n}\n\n/**\n * Warns, in development only, that `panelBackground` is deprecated.\n *\n * The `process.env.NODE_ENV` check is a compile-time constant, so a production\n * bundle minifies the effect body away to an empty function instead of reading\n * props and formatting a message per mounted component. The message is also\n * logged once per session rather than once per component instance.\n */\nexport function useDeprecatedPanelBackgroundWarning(panelBackground: unknown) {\n React.useEffect(() => {\n if (process.env.NODE_ENV === 'production') return;\n if (panelBackground !== undefined) warnOnce(PANEL_BACKGROUND_MESSAGE);\n }, [panelBackground]);\n}\n", "import type { PropDef } from './prop-def.js';\n\nconst asChildPropDef = {\n /**\n * Composes the component into its immediate child instead of rendering its own HTML element.\n * You\u2019ll have to provide a single React Element child.\n */\n asChild: {\n type: 'boolean',\n },\n} satisfies {\n asChild: PropDef<boolean>;\n};\n\nexport { asChildPropDef };\n", "import type { PropDef } from './prop-def.js';\n\n// prettier-ignore\nconst accentColors = ['gray', 'gold', 'bronze', 'brown', 'yellow', 'amber', 'orange', 'tomato', 'red', 'ruby', 'crimson', 'pink', 'plum', 'purple', 'violet', 'iris', 'indigo', 'blue', 'cyan', 'teal', 'jade', 'green', 'grass', 'lime', 'mint', 'sky'] as const;\n\nconst grayColors = ['auto', 'gray', 'mauve', 'slate', 'sage', 'olive', 'sand'] as const;\n\nconst colorPropDef = {\n color: {\n type: 'enum',\n values: accentColors,\n default: undefined as (typeof accentColors)[number] | undefined,\n },\n} satisfies {\n color: PropDef<(typeof accentColors)[number]>;\n};\n\n// 1. When used on components that compose Text, sets the color of the text to the current accent.\n// 2. Defines accent color for descendant text components\u00A0with `highContrast={true}`.\nconst accentColorPropDef = {\n color: {\n type: 'enum',\n values: accentColors,\n default: '' as (typeof accentColors)[number],\n },\n} satisfies {\n color: PropDef<(typeof accentColors)[number]>;\n};\n\nexport {\n accentColorPropDef,\n colorPropDef,\n //\n accentColors,\n grayColors,\n};\n", "import type { PropDef } from './prop-def.js';\n\nconst radii = ['none', 'small', 'medium', 'large', 'full'] as const;\n\nconst radiusPropDef = {\n radius: {\n type: 'enum',\n values: radii,\n default: undefined,\n },\n} satisfies {\n radius: PropDef<(typeof radii)[number]>;\n};\n\nexport { radiusPropDef, radii };\n", "import { asChildPropDef } from '../props/as-child.prop.js';\nimport { accentColors, grayColors } from '../props/color.prop.js';\nimport { radii } from '../props/radius.prop.js';\n\nimport type { GetPropDefTypes, PropDef } from '../props/prop-def.js';\n\nconst appearances = ['inherit', 'light', 'dark'] as const;\nconst panelBackgrounds = ['solid', 'translucent'] as const;\nconst materials = ['solid', 'translucent'] as const;\nconst scalings = ['90%', '95%', '100%', '105%', '110%'] as const;\nconst fontFamilies = ['sans', 'mono', 'serif'] as const;\n\nconst themePropDefs = {\n ...asChildPropDef,\n /**\n * Whether to apply background color to the Theme element.\n *\n * Defaults to true for the root Theme and for Theme elements that\n * have an explicit light or dark appearance prop.\n */\n hasBackground: { type: 'boolean', default: true },\n /**\n * Sets the color scheme of the theme, typcially referred to as light and dark mode.\n *\n * @link\n * https://www.radix-ui.com/themes/docs/theme/dark-mode\n */\n appearance: { type: 'enum', values: appearances, default: 'inherit' },\n /**\n * Selects one of the accent color options to use in the Theme.\n *\n * @link\n * https://www.radix-ui.com/themes/docs/theme/color\n */\n accentColor: { type: 'enum', values: accentColors, default: 'blue' },\n /**\n * Selects one of the gray color options to use in the Theme.\n *\n * @link\n * https://www.radix-ui.com/themes/docs/theme/color\n */\n grayColor: { type: 'enum', values: grayColors, default: 'slate' },\n /**\n * Controls whether to use a solid or translucent background color on panelled\n * elements such as Card or Table is solid or translucent.\n *\n * @link\n * https://www.radix-ui.com/themes/docs/theme/visual-style\n */\n material: { type: 'enum', values: materials, default: 'translucent' },\n /**\n * Controls whether to use a solid or translucent background color on panelled\n * elements such as Card or Table is solid or translucent.\n *\n * @deprecated Use `material` prop instead. This prop will be removed in a future version.\n *\n * @link\n * https://www.radix-ui.com/themes/docs/theme/visual-style\n */\n panelBackground: { type: 'enum', values: panelBackgrounds, default: 'translucent' },\n /**\n * Sets the default radius of the components.\n *\n * @link\n * https://www.radix-ui.com/themes/docs/theme/visual-style\n */\n radius: { type: 'enum', values: radii, default: 'full' },\n /**\n * Sets a scaling multiplier for values like spacing, font sizes, line heights, etc. are scaled.\n *\n * @link\n * https://www.radix-ui.com/themes/docs/theme/layout\n */\n scaling: { type: 'enum', values: scalings, default: '100%' },\n /**\n * Sets the font family used for body text in the theme.\n *\n * Headings follow this unless `headingFontFamily` (or the `--font-heading`\n * token) says otherwise.\n *\n * @default 'sans'\n */\n fontFamily: { type: 'enum', values: fontFamilies, default: 'sans' },\n /**\n * Sets the font family used for `Heading`, independently of body text.\n *\n * Deliberately has no default: when it is left unset no attribute is\n * emitted and `--font-heading` keeps following `--font-body`, so a\n * `--font-heading` override in your own CSS survives a `fontFamily` switch.\n */\n headingFontFamily: { type: 'enum', values: fontFamilies },\n} satisfies {\n hasBackground: PropDef<boolean>;\n appearance: PropDef<(typeof appearances)[number]>;\n accentColor: PropDef<(typeof accentColors)[number]>;\n grayColor: PropDef<(typeof grayColors)[number]>;\n material: PropDef<(typeof materials)[number]>;\n panelBackground: PropDef<(typeof panelBackgrounds)[number]>;\n radius: PropDef<(typeof radii)[number]>;\n scaling: PropDef<(typeof scalings)[number]>;\n fontFamily: PropDef<(typeof fontFamilies)[number]>;\n headingFontFamily: PropDef<(typeof fontFamilies)[number]>;\n};\n\ntype ThemeOwnProps = GetPropDefTypes<typeof themePropDefs & typeof asChildPropDef>;\n\nexport { themePropDefs };\nexport type { ThemeOwnProps };\n"],
|
|
5
|
+
"mappings": "slBAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,iBAAAE,KAAA,eAAAC,GAAAH,IAEA,IAAAI,EAAuB,oBACvBC,EAAuB,yBACvBC,GAA+B,mCCF/B,IAAAC,EAAuB,oBCAvB,IAAAC,EAAuB,oBACvBC,GAAuB,yBACvBC,EAA6D,oBAC7DC,EAAiD,6BCD1C,SAASC,GAAqBC,EAA+B,CAClE,OAAQA,EAAa,CACnB,IAAK,SACL,IAAK,MACL,IAAK,OACL,IAAK,UACL,IAAK,OACL,IAAK,OACL,IAAK,SACL,IAAK,SACH,MAAO,QACT,IAAK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AcC,EAAU,WAClCD,EAAU,WAAaC,EAAU,SAEvC,CAAC,EAMKG,GAAc,OAAO,OAAO9D,GAAiB,CACjD,KAAMyD,EACR,CAAC",
|
|
6
|
+
"names": ["virtual_menu_exports", "__export", "VirtualMenu", "__toCommonJS", "React", "import_classnames", "import_react_virtual", "React", "React", "import_classnames", "import_radix_ui", "import_internal", "getMatchingGrayColor", "accentColor", "React", "usePropSyncedState", "propValue", "value", "setValue", "previousPropValue", "setPreviousPropValue", "React", "PANEL_BACKGROUND_MESSAGE", "warned", "warnOnce", "message", "useDeprecatedPanelBackgroundWarning", "panelBackground", "asChildPropDef", "accentColors", "grayColors", "radii", "appearances", "panelBackgrounds", "materials", "scalings", "fontFamilies", "themePropDefs", "asChildPropDef", "accentColors", "grayColors", "radii", "noop", "defaultThemeContext", "themePropDefs", "ThemeContext", "useThemeContext", "Theme", "props", "forwardedRef", "TooltipPrimitive", "ThemeRoot", "ThemeImpl", "appearanceProp", "accentColorProp", "grayColorProp", "materialProp", "panelBackgroundProp", "radiusProp", "scalingProp", "fontFamilyProp", "headingFontFamilyProp", "hasBackground", "rootProps", "useDeprecatedPanelBackgroundWarning", "appearance", "setAppearance", "usePropSyncedState", "accentColor", "setAccentColor", "grayColor", "setGrayColor", "effectiveMaterial", "material", "setMaterial", "panelBackground", "setPanelBackground", "radius", "setRadius", "scaling", "setScaling", "fontFamily", "setFontFamily", "headingFontFamily", "setHeadingFontFamily", "getClientOS", "ua", "context", "asChild", "isRoot", "hasBackgroundProp", "onAppearanceChange", "onAccentColorChange", "onGrayColorChange", "onMaterialChange", "onPanelBackgroundChange", "onRadiusChange", "onScalingChange", "onFontFamilyChange", "onHeadingFontFamilyChange", "themeProps", "Comp", "resolvedGrayColor", "getMatchingGrayColor", "isExplicitAppearance", "rootRef", "composedRef", "hasExplicitOS", "node", "os", "classNames", "MenuContext", "menuSizeToItemHeight", "getMenuItemHeight", "size", "scaling", "scale", "useMenuContext", "MenuContext", "SimpleItem", "label", "_isHighlighted", "id", "style", "tabIndex", "dataHighlighted", "dataIndex", "onMouseEnter", "onMouseLeave", "onClick", "onKeyDown", "classNames", "prev", "next", "VirtualMenuRoot", "items", "itemLabel", "RenderItem", "sizeProp", "estimatedItemSizeProp", "overscan", "onSelect", "className", "ariaLabel", "menuId", "parentRef", "highlightedIndex", "setHighlightedIndex", "isInsideMenu", "contextSize", "contextItemHeight", "useMenuContext", "scaling", "useThemeContext", "estimatedItemSize", "getMenuItemHeight", "getLabel", "item", "safeHighlightedIndex", "getItemSize", "virtualizer", "virtualItems", "itemsRef", "onSelectRef", "scrollToIndexRef", "highlightedIndexRef", "handleItemMouseEnter", "e", "index", "handleItemClick", "idx", "currentItems", "noop", "handleItemKeyDown", "handleKeyDown", "currentHighlightedIndex", "nextIndex", "prevIndex", "lastIndex", "getItemId", "rootStyle", "totalSize", "viewportStyle", "virtualRow", "isHighlighted", "itemStyle", "commonProps", "VirtualMenuItemInner", "children", "props", "forwardedRef", "VirtualMenuItem", "prevProps", "nextProps", "prevStyle", "nextStyle", "VirtualMenu"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var N=Object.create;var c=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var x=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty;var O=(n,e)=>{for(var t in e)c(n,t,{get:e[t],enumerable:!0})},v=(n,e,t,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of V(e))!k.call(n,o)&&o!==t&&c(n,o,{get:()=>e[o],enumerable:!(a=C(e,o))||a.enumerable});return n};var w=(n,e,t)=>(t=n!=null?N(x(n)):{},v(e||!n||!n.__esModule?c(t,"default",{value:n,enumerable:!0}):t,n)),j=n=>v(c({},"__esModule",{value:!0}),n);var M={};O(M,{extractProps:()=>q});module.exports=j(M);var T=w(require("classnames"));var $=[],E=new Set;function K(n){let e=Object.assign({},...n),t=[],a=[],o=new Set;for(let
|
|
1
|
+
"use strict";var N=Object.create;var c=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var x=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty;var O=(n,e)=>{for(var t in e)c(n,t,{get:e[t],enumerable:!0})},v=(n,e,t,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of V(e))!k.call(n,o)&&o!==t&&c(n,o,{get:()=>e[o],enumerable:!(a=C(e,o))||a.enumerable});return n};var w=(n,e,t)=>(t=n!=null?N(x(n)):{},v(e||!n||!n.__esModule?c(t,"default",{value:n,enumerable:!0}):t,n)),j=n=>v(c({},"__esModule",{value:!0}),n);var M={};O(M,{extractProps:()=>q});module.exports=j(M);var T=w(require("classnames"));var $=[],E=new Set;function K(n){let e=Object.assign({},...n),t=[],a=[],o=new Set;for(let i in e){let r=e[i],l=r.values??$,p={key:i,type:r.type,default:r.default,hasDefault:r.default!==void 0,responsive:"responsive"in r,className:r.className,customProperties:r.customProperties,parseValue:r.parseValue,values:l,valueSet:l.length>0?new Set(l):E,enumValueSet:r.type==="enum"?new Set([r.default,...l]):void 0};r.className?(t.push(p),o.add(i)):(p.hasDefault||r.type==="enum")&&a.push(p)}return{styling:t,passthrough:a,stylingKeys:o}}var G={children:new WeakMap};function S(n){let e=G;for(let t=0;t<n.length;t++){let a=n[t],o=e.children.get(a);o===void 0&&(o={children:new WeakMap},e.children.set(a,o)),e=o}return e.compiled??(e.compiled=K(n))}var B=["initial","xs","sm","md","lg","xl"],y=new Set(B);function m(n,e){return Object.prototype.hasOwnProperty.call(n,e)}var U=new Set(["initial","xs","sm","md","lg","xl"]);function d(n){if(typeof n!="object"||n===null)return!1;for(let e in n)if(U.has(e))return!0;return!1}function g(n,e,t){return e!==void 0?e.has(t):n.includes(t)}function b({className:n,customProperties:e,...t}){let a=P({allowArbitraryValues:!0,className:n,...t}),o=A({customProperties:e,...t});return[a,o]}function P({allowArbitraryValues:n,value:e,className:t,propValues:a,propValueSet:o,parseValue:i=r=>r}){if(e){if(typeof e=="string")return g(a,o,e)?h(t,e,i):n?t:void 0;if(d(e)){let r=e,l=[];for(let p in r){if(!m(r,p)||!y.has(p))continue;let s=r[p];if(s!==void 0){if(g(a,o,s)){let f=h(t,s,i),u=p==="initial"?f:`${p}:${f}`;l.push(u)}else if(n){let f=p==="initial"?t:`${p}:${t}`;l.push(f)}}}return l.length>0?l.join(" "):""}if(n)return t}}function h(n,e,t){let a=n?"-":"",o=t(e),i=o?.startsWith("-"),r=i?"-":"",l=i?o?.substring(1):o;return`${r}${n}${a}${l}`}function A({customProperties:n,value:e,propValues:t,propValueSet:a,parseValue:o=i=>i}){if(!e||typeof e=="string"&&g(t,a,e))return;let i;if(typeof e=="string"){let r=o(e);i={};for(let l of n)i[l]=r;return i}if(d(e)){let r=e;for(let l in r){if(!m(r,l)||!y.has(l))continue;let p=r[l];if(p===void 0||g(t,a,p))continue;let s=o(p);i??(i={});for(let f of n){let u=l==="initial"?f:`${f}-${l}`;i[u]=s}}}return i??{}}function D(...n){let e;for(let t of n)t&&(e===void 0&&(e={}),Object.assign(e,t));return e}function W(n,e){let t=n.initial,a=!1;return e.hasDefault&&t===void 0&&(t=e.default,a=!0),e.enumValueSet!==void 0&&!e.enumValueSet.has(t)&&(t=e.default,a=!0),a?{...n,initial:t}:n}function q(n,...e){let{styling:t,passthrough:a,stylingKeys:o}=S(e),i={};for(let p in n)o.has(p)||(i[p]=n[p]);for(let p=0;p<a.length;p++){let s=a[p],f=i[s.key];if(f===void 0){s.hasDefault&&(i[s.key]=s.default);continue}s.enumValueSet!==void 0&&!s.enumValueSet.has(f)&&!d(f)&&(i[s.key]=s.default)}let r,l=[];for(let p=0;p<t.length;p++){let s=t[p],f=n[s.key];if(f===void 0&&s.hasDefault&&(f=s.default),s.enumValueSet!==void 0&&!s.enumValueSet.has(f)&&!d(f)&&(f=s.default),!!f){if(d(f)){if(!s.responsive)continue;f=W(f,s)}if(s.type==="enum"){let u=P({allowArbitraryValues:!1,value:f,className:s.className,propValues:s.values,propValueSet:s.valueSet,parseValue:s.parseValue});u&&l.push(u);continue}if(s.type==="string"||s.type==="enum | string"){let[u,R]=b({className:s.className,customProperties:s.customProperties,propValues:s.type==="string"?[]:s.values,propValueSet:s.type==="string"?void 0:s.valueSet,parseValue:s.parseValue,value:f});R&&(r=D(r,R)),u&&l.push(u);continue}if(s.type==="boolean"){l.push(s.className);continue}}}return i.className=(0,T.default)(l.length>0?l.join(" "):void 0,n.className),i.style=D(r,n.style),i}
|
|
2
2
|
//# sourceMappingURL=extract-props.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/helpers/extract-props.ts", "../../../src/helpers/compile-prop-defs.ts", "../../../src/props/prop-def.ts", "../../../src/helpers/has-own-property.ts", "../../../src/helpers/is-responsive-object.ts", "../../../src/helpers/get-responsive-styles.ts", "../../../src/helpers/merge-styles.ts"],
|
|
4
4
|
"sourcesContent": ["import classNames from 'classnames';\n\nimport { getCompiledPropDefs } from './compile-prop-defs.js';\nimport { getResponsiveClassNames, getResponsiveStyles } from './get-responsive-styles.js';\nimport { isResponsiveObject } from './is-responsive-object.js';\nimport { mergeStyles } from './merge-styles.js';\n\nimport type { CompiledPropDef } from './compile-prop-defs.js';\nimport type * as React from 'react';\nimport type { PropDef } from '../props/prop-def.js';\n\ntype PropDefsWithClassName<T> = T extends Record<string, PropDef> ? { [K in keyof T]: T[K] extends { className: string } ? K : never }[keyof T] : never;\n\ntype ResponsiveValue = Record<string, string | undefined>;\n\n/**\n * Fills in the `initial` breakpoint of a responsive value from the prop def's\n * default, and coerces an invalid `initial` enum value back to that default.\n *\n * Returns the value untouched when nothing needs changing, and a copy otherwise\n * \u2014 callers routinely hoist responsive objects to module scope, so mutating the\n * caller's object would corrupt it for every later render.\n */\nfunction normalizeResponsiveValue(value: ResponsiveValue, propDef: CompiledPropDef) {\n let initial = value.initial;\n let changed = false;\n\n if (propDef.hasDefault && initial === undefined) {\n initial = propDef.default as string | undefined;\n changed = true;\n }\n\n if (propDef.enumValueSet !== undefined && !propDef.enumValueSet.has(initial)) {\n initial = propDef.default as string | undefined;\n changed = true;\n }\n\n return changed ? { ...value, initial } : value;\n}\n\n/**\n * Takes props, checks them against prop defs that have a `className` on them,\n * adds necessary CSS classes and inline styles, and returns the props without\n * the corresponding prop defs that were used to formulate the new `className`\n * and `style` values. Also applies prop def defaults to every prop.\n */\nfunction extractProps<P extends { className?: string; style?: React.CSSProperties; [key: string]: any }, T extends Record<string, PropDef>[]>(\n props: P,\n ...propDefs: T\n): Omit<P & { className?: string; style?: React.CSSProperties }, PropDefsWithClassName<T[number]>> {\n const { styling, passthrough, stylingKeys } = getCompiledPropDefs(propDefs);\n\n // Copy the props that survive to the element rather than spreading and then\n // deleting the styling keys. Deleting off a spread demotes the object to\n // dictionary mode in V8, and this object is on the render path of every\n // component in the library.\n const extractedProps: Record<string, any> = {};\n for (const key in props) {\n if (stylingKeys.has(key)) continue;\n extractedProps[key] = props[key];\n }\n\n for (let i = 0; i < passthrough.length; i++) {\n const propDef = passthrough[i];\n const value = extractedProps[propDef.key];\n\n if (value === undefined) {\n if (propDef.hasDefault) extractedProps[propDef.key] = propDef.default;\n continue;\n }\n\n // Fall back to the default when the value is not a valid enum value\n if (propDef.enumValueSet !== undefined && !propDef.enumValueSet.has(value) && !isResponsiveObject(value)) {\n extractedProps[propDef.key] = propDef.default;\n }\n }\n\n let style: ReturnType<typeof mergeStyles>;\n const classes: string[] = [];\n\n for (let i = 0; i < styling.length; i++) {\n const propDef = styling[i];\n let value = props[propDef.key];\n\n // Apply prop def defaults\n if (value === undefined && propDef.hasDefault) {\n value = propDef.default;\n }\n\n // Apply the default value if the value is not a valid enum value\n if (propDef.enumValueSet !== undefined && !propDef.enumValueSet.has(value) && !isResponsiveObject(value)) {\n value = propDef.default;\n }\n\n if (!value) continue;\n\n if (isResponsiveObject(value)) {\n // Make sure we are not threading through responsive values for non-responsive prop defs\n if (!propDef.responsive) continue;\n value = normalizeResponsiveValue(value, propDef);\n }\n\n if (propDef.type === 'enum') {\n const propClassName = getResponsiveClassNames({\n allowArbitraryValues: false,\n value,\n className: propDef.className!,\n propValues: propDef.values,\n propValueSet: propDef.valueSet,\n parseValue: propDef.parseValue,\n });\n\n if (propClassName) classes.push(propClassName);\n continue;\n }\n\n if (propDef.type === 'string' || propDef.type === 'enum | string') {\n const [propClassNames, propCustomProperties] = getResponsiveStyles({\n className: propDef.className!,\n customProperties: propDef.customProperties!,\n // `string` prop defs have no enum values, so every value is arbitrary\n propValues: propDef.type === 'string' ? [] : propDef.values,\n propValueSet: propDef.type === 'string' ? undefined : propDef.valueSet,\n parseValue: propDef.parseValue,\n value,\n });\n\n if (propCustomProperties) style = mergeStyles(style, propCustomProperties);\n if (propClassNames) classes.push(propClassNames);\n continue;\n }\n\n if (propDef.type === 'boolean') {\n // TODO handle responsive boolean props\n classes.push(propDef.className!);\n continue;\n }\n }\n\n extractedProps.className = classNames(classes.length > 0 ? classes.join(' ') : undefined, props.className);\n extractedProps.style = mergeStyles(style, props.style);\n return extractedProps as ReturnType<typeof extractProps<P, T>>;\n}\n\nexport { extractProps };\n", "import type { PropDef } from '../props/prop-def.js';\n\n/**\n * A prop def pre-processed into the exact shape `extractProps` needs at render\n * time. Everything that can be derived from the static prop def \u2014 enum\n * membership sets, whether the def is responsive, whether it carries a default\n * \u2014 is computed once here instead of on every render.\n */\ninterface CompiledPropDef {\n key: string;\n type: PropDef['type'];\n default: unknown;\n hasDefault: boolean;\n responsive: boolean;\n className?: string;\n customProperties?: `--${string}`[];\n parseValue?: (value: string) => string | undefined;\n /** The prop def's own enum values, kept for the responsive class name helpers. */\n values: readonly string[];\n /** O(1) membership for `values`. */\n valueSet: ReadonlySet<string>;\n /**\n * `values` plus the default, used to coerce invalid enum values back to the\n * default. Only present for `type: 'enum'` \u2014 `'enum | string'` props accept\n * arbitrary strings and must not be coerced.\n */\n enumValueSet?: ReadonlySet<unknown>;\n}\n\ninterface CompiledPropDefs {\n /** Defs that contribute a class name and/or custom properties. */\n styling: CompiledPropDef[];\n /**\n * Defs that pass through to the element but still need a default applied or\n * an invalid enum value coerced. Defs that can do neither are omitted\n * entirely \u2014 they are already correct as passed.\n */\n passthrough: CompiledPropDef[];\n /** Keys consumed by `styling`, so they can be skipped when copying props. */\n stylingKeys: ReadonlySet<string>;\n}\n\nconst EMPTY_VALUES: readonly string[] = [];\nconst EMPTY_SET: ReadonlySet<string> = new Set();\n\nfunction compile(propDefs: readonly Record<string, PropDef>[]): CompiledPropDefs {\n const merged: Record<string, PropDef> = Object.assign({}, ...propDefs);\n const styling: CompiledPropDef[] = [];\n const passthrough: CompiledPropDef[] = [];\n const stylingKeys = new Set<string>();\n\n for (const key in merged) {\n // The PropDef union is narrowed per-field below; reading the optional\n // members off the union directly is what the runtime actually needs.\n const def = merged[key] as PropDef & {\n default?: unknown;\n values?: readonly string[];\n className?: string;\n customProperties?: `--${string}`[];\n parseValue?: (value: string) => string | undefined;\n responsive?: true;\n };\n\n const values = def.values ?? EMPTY_VALUES;\n const compiled: CompiledPropDef = {\n key,\n type: def.type,\n default: def.default,\n hasDefault: def.default !== undefined,\n responsive: 'responsive' in def,\n className: def.className,\n customProperties: def.customProperties,\n parseValue: def.parseValue,\n values,\n valueSet: values.length > 0 ? new Set(values) : EMPTY_SET,\n enumValueSet: def.type === 'enum' ? new Set<unknown>([def.default, ...values]) : undefined,\n };\n\n if (def.className) {\n styling.push(compiled);\n stylingKeys.add(key);\n } else if (compiled.hasDefault || def.type === 'enum') {\n // Anything else is copied through untouched, so there is nothing to do.\n passthrough.push(compiled);\n }\n }\n\n return { styling, passthrough, stylingKeys };\n}\n\ninterface CacheNode {\n children: WeakMap<object, CacheNode>;\n compiled?: CompiledPropDefs;\n}\n\nconst cacheRoot: CacheNode = { children: new WeakMap() };\n\n/**\n * Compiles a set of prop defs, memoized on the identity of the prop def objects\n * themselves. Components always pass the same module-level constants, so after\n * the first render of a given component this is a couple of WeakMap lookups\n * instead of merging 50-odd prop defs into a fresh object.\n */\nfunction getCompiledPropDefs(propDefs: readonly Record<string, PropDef>[]): CompiledPropDefs {\n let node = cacheRoot;\n\n for (let i = 0; i < propDefs.length; i++) {\n const propDef = propDefs[i];\n let child = node.children.get(propDef);\n if (child === undefined) {\n child = { children: new WeakMap() };\n node.children.set(propDef, child);\n }\n node = child;\n }\n\n return (node.compiled ??= compile(propDefs));\n}\n\nexport { getCompiledPropDefs };\nexport type { CompiledPropDef, CompiledPropDefs };\n", "import type React from 'react';\n\n// Creates a union type of string literals with strings, but retains intellisense for the literals.\n// Union<string, 'foo' | 'bar'> => string | Omit<string, 'foo' | 'bar'>\ntype Union<S = string, T extends string | number = string> = T | Omit<S, T>;\n\nconst breakpoints = ['initial', 'xs', 'sm', 'md', 'lg', 'xl'] as const;\nconst breakpointSet: Set<string> = new Set(breakpoints);\ntype Breakpoint = (typeof breakpoints)[number];\ntype Responsive<T> = T | Partial<Record<Breakpoint, T>>;\n\ntype BooleanPropDef = {\n type: 'boolean';\n default?: boolean;\n required?: boolean;\n className?: string;\n};\ntype StringPropDef = {\n type: 'string';\n default?: string;\n required?: boolean;\n};\ntype ReactNodePropDef = {\n type: 'ReactNode';\n default?: React.ReactNode;\n required?: boolean;\n};\ntype EnumPropDef<T> = {\n type: 'enum';\n values: readonly T[];\n default?: T;\n required?: boolean;\n};\ntype EnumOrStringPropDef<T> = {\n type: 'enum | string';\n values: readonly T[];\n default?: T | string;\n required?: boolean;\n};\n\ntype NonStylingPropDef = {\n className?: never;\n customProperties?: never;\n parseValue?: never;\n};\n\ntype StylingPropDef = {\n className: string;\n parseValue?: (value: string) => string | undefined;\n};\n\ntype ArbitraryStylingPropDef = {\n className: string;\n customProperties: `--${string}`[];\n parseValue?: (value: string) => string | undefined;\n};\n\ntype RegularPropDef<T> =\n | ReactNodePropDef\n | BooleanPropDef\n | (StringPropDef & ArbitraryStylingPropDef)\n | (StringPropDef & NonStylingPropDef)\n | (EnumPropDef<T> & StylingPropDef)\n | (EnumPropDef<T> & NonStylingPropDef)\n | (EnumOrStringPropDef<T> & ArbitraryStylingPropDef)\n | (EnumOrStringPropDef<T> & NonStylingPropDef);\ntype ResponsivePropDef<T = any> = RegularPropDef<T> & { responsive: true };\ntype PropDef<T = any> = RegularPropDef<T> | ResponsivePropDef<T>;\n\n// prettier-ignore\ntype GetPropDefType<Def> =\n Def extends BooleanPropDef ? (Def extends ResponsivePropDef ? Responsive<boolean> : boolean)\n : Def extends StringPropDef ? (Def extends ResponsivePropDef ? Responsive<string> : string)\n : Def extends ReactNodePropDef ? (Def extends ResponsivePropDef ? Responsive<React.ReactNode> : React.ReactNode)\n : Def extends EnumOrStringPropDef<infer Type> ?\n Def extends ResponsivePropDef<infer Type extends string> ? Responsive<Union<string, Type>> : Type\n : Def extends EnumPropDef<infer Type> ? (Def extends ResponsivePropDef<infer Type> ? Responsive<Type> : Type)\n : never;\n\ntype GetPropDefTypes<P> = {\n [K in keyof P]?: GetPropDefType<P[K]>;\n};\n\nexport { breakpoints, breakpointSet };\nexport type {\n PropDef,\n GetPropDefTypes,\n ResponsivePropDef,\n //\n Breakpoint,\n Responsive,\n Union,\n};\n", "/** A util to check whether the object has a key, while inferring the correct key type */\nfunction hasOwnProperty<K extends string | number | symbol>(\n obj: Record<K, unknown>,\n key: string | number | symbol\n): key is K {\n return Object.prototype.hasOwnProperty.call(obj, key);\n}\n\nexport { hasOwnProperty };\n", "import type { Responsive, Breakpoint } from '../props/prop-def.js';\n\n// Use a Set for O(1) lookup instead of array.includes() which is O(n)\nconst breakpointSet = new Set<string>(['initial', 'xs', 'sm', 'md', 'lg', 'xl']);\n\nexport function isResponsiveObject<Value extends string>(\n obj: Responsive<Value | Omit<string, Value>> | undefined\n): obj is Record<Breakpoint, string> {\n if (typeof obj !== 'object' || obj === null) {\n return false;\n }\n // Use for...in to avoid Object.keys() array allocation\n for (const key in obj) {\n if (breakpointSet.has(key)) {\n return true;\n }\n }\n return false;\n}\n", "import { breakpointSet } from '../props/prop-def.js';\nimport { hasOwnProperty } from './has-own-property.js';\nimport { isResponsiveObject } from './is-responsive-object.js';\n\nimport type { Responsive, Union } from '../props/prop-def.js';\n\n/**\n * Membership test against a prop def's enum values. Callers that already hold a\n * compiled prop def pass `propValueSet` for an O(1) lookup; the handful of call\n * sites that build options inline fall back to scanning the array.\n */\nfunction includesValue(propValues: string[] | readonly string[], propValueSet: ReadonlySet<string> | undefined, value: string): boolean {\n return propValueSet !== undefined ? propValueSet.has(value) : propValues.includes(value);\n}\n\ninterface GetResponsiveStylesOptions {\n className: string;\n customProperties: `--${string}`[];\n value: Responsive<Union> | Responsive<string> | undefined;\n propValues: string[] | readonly string[];\n propValueSet?: ReadonlySet<string>;\n parseValue?: (value: string) => string | undefined;\n}\n\nfunction getResponsiveStyles({ className, customProperties, ...args }: GetResponsiveStylesOptions) {\n const responsiveClassNames = getResponsiveClassNames({\n allowArbitraryValues: true,\n className,\n ...args,\n });\n\n const responsiveCustomProperties = getResponsiveCustomProperties({ customProperties, ...args });\n return [responsiveClassNames, responsiveCustomProperties] as const;\n}\n\ninterface GetResponsiveClassNamesOptions {\n allowArbitraryValues?: boolean;\n className: string;\n value: Responsive<Union> | Responsive<string> | undefined;\n propValues: string[] | readonly string[];\n propValueSet?: ReadonlySet<string>;\n parseValue?: (value: string) => string | undefined;\n}\n\nfunction getResponsiveClassNames({ allowArbitraryValues, value, className, propValues, propValueSet, parseValue = (value) => value }: GetResponsiveClassNamesOptions): string | undefined {\n if (!value) {\n return undefined;\n }\n\n if (typeof value === 'string') {\n if (includesValue(propValues, propValueSet, value)) {\n return getBaseClassName(className, value, parseValue);\n }\n return allowArbitraryValues ? className : undefined;\n }\n\n if (isResponsiveObject(value)) {\n const object = value;\n const classNames: string[] = [];\n\n for (const bp in object) {\n // Make sure we are not iterating over keys that aren't breakpoints\n if (!hasOwnProperty(object, bp) || !breakpointSet.has(bp)) {\n continue;\n }\n\n const value = object[bp];\n\n if (value !== undefined) {\n if (includesValue(propValues, propValueSet, value)) {\n const baseClassName = getBaseClassName(className, value, parseValue);\n const bpClassName = bp === 'initial' ? baseClassName : `${bp}:${baseClassName}`;\n classNames.push(bpClassName);\n } else if (allowArbitraryValues) {\n const bpClassName = bp === 'initial' ? className : `${bp}:${className}`;\n classNames.push(bpClassName);\n }\n }\n }\n\n return classNames.length > 0 ? classNames.join(' ') : '';\n }\n\n if (allowArbitraryValues) {\n return className;\n }\n}\n\nfunction getBaseClassName(className: string, value: string, parseValue: (value: string) => string | undefined): string {\n const delimiter = className ? '-' : '';\n const matchedValue = parseValue(value);\n const isNegative = matchedValue?.startsWith('-');\n const minus = isNegative ? '-' : '';\n const absoluteValue = isNegative ? matchedValue?.substring(1) : matchedValue;\n return `${minus}${className}${delimiter}${absoluteValue}`;\n}\n\ninterface GetResponsiveCustomPropertiesOptions {\n customProperties: `--${string}`[];\n value: Responsive<Union> | Responsive<string> | undefined;\n propValues: string[] | readonly string[];\n propValueSet?: ReadonlySet<string>;\n parseValue?: (value: string) => string | undefined;\n}\n\nfunction getResponsiveCustomProperties({ customProperties, value, propValues, propValueSet, parseValue = (value) => value }: GetResponsiveCustomPropertiesOptions) {\n // Don't generate custom properties if the value is not arbitrary\n if (!value || (typeof value === 'string' && includesValue(propValues, propValueSet, value))) {\n return undefined;\n }\n\n let styles: Record<string, string | undefined> | undefined;\n\n if (typeof value === 'string') {\n const parsed = parseValue(value);\n styles = {};\n for (const customProperty of customProperties) {\n styles[customProperty] = parsed;\n }\n return styles;\n }\n\n if (isResponsiveObject(value)) {\n const object = value;\n\n for (const bp in object) {\n // Make sure we are not iterating over keys that aren't breakpoints\n if (!hasOwnProperty(object, bp) || !breakpointSet.has(bp)) {\n continue;\n }\n\n const value = object[bp];\n\n // Don't generate a custom property if the value is not arbitrary\n if (value === undefined || includesValue(propValues, propValueSet, value)) {\n continue;\n }\n\n const parsed = parseValue(value);\n styles ??= {};\n for (const customProperty of customProperties) {\n const bpProperty = bp === 'initial' ? customProperty : `${customProperty}-${bp}`;\n styles[bpProperty] = parsed;\n }\n }\n }\n\n return styles ?? {};\n}\n\nexport { getResponsiveStyles, getResponsiveCustomProperties, getResponsiveClassNames };\n", "type InlineStyle =\n | React.CSSProperties\n | Record<string, string | number | null | undefined>\n | undefined;\n\n// Merges CSS styles like `classNames` merges CSS classes\n// Optimized to avoid object spread in loop - uses Object.assign for in-place mutation\nexport function mergeStyles(...styles: Array<InlineStyle>): InlineStyle {\n let result: Record<string, string | number | null | undefined> | undefined;\n\n for (const style of styles) {\n if (style) {\n if (result === undefined) {\n // First non-empty style - create result object\n result = {};\n }\n Object.assign(result, style);\n }\n }\n\n return result;\n}\n"],
|
|
5
|
-
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,kBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAuB,yBC0CvB,IAAMC,EAAkC,CAAC,EACnCC,EAAiC,IAAI,IAE3C,SAASC,EAAQC,EAAgE,CAC/E,IAAMC,EAAkC,OAAO,OAAO,CAAC,EAAG,GAAGD,CAAQ,EAC/DE,EAA6B,CAAC,EAC9BC,EAAiC,CAAC,EAClCC,EAAc,IAAI,IAExB,QAAWC,KAAOJ,EAAQ,CAGxB,IAAMK,EAAML,EAAOI,CAAG,EAShBE,EAASD,EAAI,QAAUT,EACvBW,EAA4B,CAChC,IAAAH,EACA,KAAMC,EAAI,KACV,QAASA,EAAI,QACb,WAAYA,EAAI,UAAY,OAC5B,WAAY,eAAgBA,EAC5B,UAAWA,EAAI,UACf,iBAAkBA,EAAI,iBACtB,WAAYA,EAAI,WAChB,OAAAC,EACA,SAAUA,EAAO,OAAS,EAAI,IAAI,IAAIA,CAAM,EAAIT,EAChD,aAAcQ,EAAI,OAAS,OAAS,IAAI,IAAa,CAACA,EAAI,QAAS,GAAGC,CAAM,CAAC,EAAI,MACnF,EAEID,EAAI,WACNJ,EAAQ,KAAKM,CAAQ,EACrBJ,EAAY,IAAIC,CAAG,IACVG,EAAS,YAAcF,EAAI,OA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EAAQ,aAAa,IAAIC,CAAO,IACzEA,EAAUD,EAAQ,QAClBE,EAAU,IAGLA,EAAU,CAAE,GAAGH,EAAO,QAAAE,CAAQ,EAAIF,CAC3C,CAQA,SAASI,EACPC,KACGC,EAC8F,CACjG,GAAM,CAAE,QAAAC,EAAS,YAAAC,EAAa,YAAAC,CAAY,EAAIC,EAAoBJ,CAAQ,EAMpEK,EAAsC,CAAC,EAC7C,QAAWC,KAAOP,EACZI,EAAY,IAAIG,CAAG,IACvBD,EAAeC,CAAG,EAAIP,EAAMO,CAAG,GAGjC,
|
|
6
|
-
"names": ["extract_props_exports", "__export", "extractProps", "__toCommonJS", "import_classnames", "EMPTY_VALUES", "EMPTY_SET", "compile", "propDefs", "merged", "styling", "passthrough", "stylingKeys", "key", "def", "values", "compiled", "cacheRoot", "getCompiledPropDefs", "node", "i", "propDef", "child", "breakpoints", "breakpointSet", "hasOwnProperty", "obj", "key", "breakpointSet", "isResponsiveObject", "obj", "key", "includesValue", "propValues", "propValueSet", "value", "getResponsiveStyles", "className", "customProperties", "args", "responsiveClassNames", "getResponsiveClassNames", "responsiveCustomProperties", "getResponsiveCustomProperties", "allowArbitraryValues", "parseValue", "getBaseClassName", "isResponsiveObject", "object", "classNames", "bp", "hasOwnProperty", "breakpointSet", "baseClassName", "bpClassName", "delimiter", "matchedValue", "isNegative", "minus", "absoluteValue", "styles", "parsed", "customProperty", "bpProperty", "mergeStyles", "styles", "result", "style", "normalizeResponsiveValue", "value", "propDef", "initial", "changed", "extractProps", "props", "propDefs", "styling", "passthrough", "stylingKeys", "getCompiledPropDefs", "extractedProps", "key", "isResponsiveObject", "style", "classes", "propClassName", "getResponsiveClassNames", "propClassNames", "propCustomProperties", "getResponsiveStyles", "mergeStyles", "classNames"]
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,kBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAuB,yBC0CvB,IAAMC,EAAkC,CAAC,E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,EAAQ,OAAS,UAAW,CAE9Be,EAAQ,KAAKf,EAAQ,SAAU,EAC/B,QACF,EACF,CAEA,OAAAU,EAAe,aAAY,EAAAY,SAAWP,EAAQ,OAAS,EAAIA,EAAQ,KAAK,GAAG,EAAI,OAAWX,EAAM,SAAS,EACzGM,EAAe,MAAQW,EAAYP,EAAOV,EAAM,KAAK,EAC9CM,CACT",
|
|
6
|
+
"names": ["extract_props_exports", "__export", "extractProps", "__toCommonJS", "import_classnames", "EMPTY_VALUES", "EMPTY_SET", "compile", "propDefs", "merged", "styling", "passthrough", "stylingKeys", "key", "def", "values", "compiled", "cacheRoot", "getCompiledPropDefs", "node", "i", "propDef", "child", "breakpoints", "breakpointSet", "hasOwnProperty", "obj", "key", "breakpointSet", "isResponsiveObject", "obj", "key", "includesValue", "propValues", "propValueSet", "value", "getResponsiveStyles", "className", "customProperties", "args", "responsiveClassNames", "getResponsiveClassNames", "responsiveCustomProperties", "getResponsiveCustomProperties", "allowArbitraryValues", "parseValue", "getBaseClassName", "isResponsiveObject", "object", "classNames", "bp", "hasOwnProperty", "breakpointSet", "baseClassName", "bpClassName", "delimiter", "matchedValue", "isNegative", "minus", "absoluteValue", "styles", "parsed", "customProperty", "bpProperty", "mergeStyles", "styles", "result", "style", "normalizeResponsiveValue", "value", "propDef", "initial", "changed", "extractProps", "props", "propDefs", "styling", "passthrough", "stylingKeys", "getCompiledPropDefs", "extractedProps", "key", "i", "isResponsiveObject", "style", "classes", "propClassName", "getResponsiveClassNames", "propClassNames", "propCustomProperties", "getResponsiveStyles", "mergeStyles", "classNames"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var y=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var k=Object.prototype.hasOwnProperty;var V=(r,e)=>{for(var t in e)y(r,t,{get:e[t],enumerable:!0})},O=(r,e,t,
|
|
1
|
+
"use strict";var y=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var k=Object.prototype.hasOwnProperty;var V=(r,e)=>{for(var t in e)y(r,t,{get:e[t],enumerable:!0})},O=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of x(e))!k.call(r,n)&&n!==t&&y(r,n,{get:()=>e[n],enumerable:!(i=T(e,n))||i.enumerable});return r};var h=r=>O(y({},"__esModule",{value:!0}),r);var w={};V(w,{getMarginStyles:()=>E});module.exports=h(w);var C=["initial","xs","sm","md","lg","xl"],c=new Set(C);function d(r,e){return Object.prototype.hasOwnProperty.call(r,e)}var $=new Set(["initial","xs","sm","md","lg","xl"]);function P(r){if(typeof r!="object"||r===null)return!1;for(let e in r)if($.has(e))return!0;return!1}function l(r,e,t){return e!==void 0?e.has(t):r.includes(t)}function R({className:r,customProperties:e,...t}){let i=G({allowArbitraryValues:!0,className:r,...t}),n=j({customProperties:e,...t});return[i,n]}function G({allowArbitraryValues:r,value:e,className:t,propValues:i,propValueSet:n,parseValue:s=p=>p}){if(e){if(typeof e=="string")return l(i,n,e)?D(t,e,s):r?t:void 0;if(P(e)){let p=e,o=[];for(let a in p){if(!d(p,a)||!c.has(a))continue;let m=p[a];if(m!==void 0){if(l(i,n,m)){let u=D(t,m,s),g=a==="initial"?u:`${a}:${u}`;o.push(g)}else if(r){let u=a==="initial"?t:`${a}:${t}`;o.push(u)}}}return o.length>0?o.join(" "):""}if(r)return t}}function D(r,e,t){let i=r?"-":"",n=t(e),s=n?.startsWith("-"),p=s?"-":"",o=s?n?.substring(1):n;return`${p}${r}${i}${o}`}function j({customProperties:r,value:e,propValues:t,propValueSet:i,parseValue:n=s=>s}){if(!e||typeof e=="string"&&l(t,i,e))return;let s;if(typeof e=="string"){let p=n(e);s={};for(let o of r)s[o]=p;return s}if(P(e)){let p=e;for(let o in p){if(!d(p,o)||!c.has(o))continue;let a=p[o];if(a===void 0||l(t,i,a))continue;let m=n(a);s??(s={});for(let u of r){let g=o==="initial"?u:`${u}-${o}`;s[g]=m}}}return s??{}}function v(...r){let e;for(let t of r)t&&(e===void 0&&(e={}),Object.assign(e,t));return e}var f=["0","1","2","3","4","5","6","7","8","9","10","11","12","-1","-2","-3","-4","-5","-6","-7","-8","-9","-10","-11","-12"],b={m:{type:"enum | string",values:f,responsive:!0,className:"rt-r-m",customProperties:["--m"]},mx:{type:"enum | string",values:f,responsive:!0,className:"rt-r-mx",customProperties:["--ml","--mr"]},my:{type:"enum | string",values:f,responsive:!0,className:"rt-r-my",customProperties:["--mt","--mb"]},mt:{type:"enum | string",values:f,responsive:!0,className:"rt-r-mt",customProperties:["--mt"]},mr:{type:"enum | string",values:f,responsive:!0,className:"rt-r-mr",customProperties:["--mr"]},mb:{type:"enum | string",values:f,responsive:!0,className:"rt-r-mb",customProperties:["--mb"]},ml:{type:"enum | string",values:f,responsive:!0,className:"rt-r-ml",customProperties:["--ml"]}};var N=b.m.values,B=new Set(N),S=[{key:"m",className:"rt-r-m",customProperties:["--margin"]},{key:"mx",className:"rt-r-mx",customProperties:["--margin-left","--margin-right"]},{key:"my",className:"rt-r-my",customProperties:["--margin-top","--margin-bottom"]},{key:"mt",className:"rt-r-mt",customProperties:["--margin-top"]},{key:"mr",className:"rt-r-mr",customProperties:["--margin-right"]},{key:"mb",className:"rt-r-mb",customProperties:["--margin-bottom"]},{key:"ml",className:"rt-r-ml",customProperties:["--margin-left"]}];function E(r){let e,t;for(let i=0;i<S.length;i++){let{key:n,className:s,customProperties:p}=S[i],o=r[n];if(o===void 0)continue;let[a,m]=R({className:s,customProperties:p,propValues:N,propValueSet:B,value:o});a&&(e??(e=[])).push(a),m&&(t=v(t,m))}return[e!==void 0?e.join(" "):"",t]}
|
|
2
2
|
//# sourceMappingURL=get-margin-styles.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/helpers/get-margin-styles.ts", "../../../src/props/prop-def.ts", "../../../src/helpers/has-own-property.ts", "../../../src/helpers/is-responsive-object.ts", "../../../src/helpers/get-responsive-styles.ts", "../../../src/helpers/merge-styles.ts", "../../../src/props/margin.props.ts"],
|
|
4
4
|
"sourcesContent": ["import { getResponsiveStyles } from './get-responsive-styles.js';\nimport { mergeStyles } from './merge-styles.js';\nimport { marginPropDefs } from '../props/margin.props.js';\n\nimport type { MarginProps } from '../props/margin.props.js';\n\nconst marginValues = marginPropDefs.m.values;\nconst marginValueSet: ReadonlySet<string> = new Set(marginValues);\n\n// Static table so the common case \u2014 a component with no margin props at all \u2014\n// is seven property reads and nothing else.\nconst MARGIN_PROPS: ReadonlyArray<{\n key: keyof MarginProps;\n className: string;\n customProperties: `--${string}`[];\n}> = [\n { key: 'm', className: 'rt-r-m', customProperties: ['--margin'] },\n { key: 'mx', className: 'rt-r-mx', customProperties: ['--margin-left', '--margin-right'] },\n { key: 'my', className: 'rt-r-my', customProperties: ['--margin-top', '--margin-bottom'] },\n { key: 'mt', className: 'rt-r-mt', customProperties: ['--margin-top'] },\n { key: 'mr', className: 'rt-r-mr', customProperties: ['--margin-right'] },\n { key: 'mb', className: 'rt-r-mb', customProperties: ['--margin-bottom'] },\n { key: 'ml', className: 'rt-r-ml', customProperties: ['--margin-left'] },\n];\n\nexport function getMarginStyles(props: MarginProps) {\n let classes: string[] | undefined;\n let style: ReturnType<typeof mergeStyles>;\n\n for (let i = 0; i < MARGIN_PROPS.length; i++) {\n const { key, className, customProperties } = MARGIN_PROPS[i];\n const value = props[key];\n if (value === undefined) continue;\n\n const [propClassNames, propCustomProperties] = getResponsiveStyles({\n className,\n customProperties,\n propValues: marginValues,\n propValueSet: marginValueSet,\n value,\n });\n\n if (propClassNames) (classes ??= []).push(propClassNames);\n if (propCustomProperties) style = mergeStyles(style, propCustomProperties);\n }\n\n return [classes !== undefined ? classes.join(' ') : '', style] as const;\n}\n", "import type React from 'react';\n\n// Creates a union type of string literals with strings, but retains intellisense for the literals.\n// Union<string, 'foo' | 'bar'> => string | Omit<string, 'foo' | 'bar'>\ntype Union<S = string, T extends string | number = string> = T | Omit<S, T>;\n\nconst breakpoints = ['initial', 'xs', 'sm', 'md', 'lg', 'xl'] as const;\nconst breakpointSet: Set<string> = new Set(breakpoints);\ntype Breakpoint = (typeof breakpoints)[number];\ntype Responsive<T> = T | Partial<Record<Breakpoint, T>>;\n\ntype BooleanPropDef = {\n type: 'boolean';\n default?: boolean;\n required?: boolean;\n className?: string;\n};\ntype StringPropDef = {\n type: 'string';\n default?: string;\n required?: boolean;\n};\ntype ReactNodePropDef = {\n type: 'ReactNode';\n default?: React.ReactNode;\n required?: boolean;\n};\ntype EnumPropDef<T> = {\n type: 'enum';\n values: readonly T[];\n default?: T;\n required?: boolean;\n};\ntype EnumOrStringPropDef<T> = {\n type: 'enum | string';\n values: readonly T[];\n default?: T | string;\n required?: boolean;\n};\n\ntype NonStylingPropDef = {\n className?: never;\n customProperties?: never;\n parseValue?: never;\n};\n\ntype StylingPropDef = {\n className: string;\n parseValue?: (value: string) => string | undefined;\n};\n\ntype ArbitraryStylingPropDef = {\n className: string;\n customProperties: `--${string}`[];\n parseValue?: (value: string) => string | undefined;\n};\n\ntype RegularPropDef<T> =\n | ReactNodePropDef\n | BooleanPropDef\n | (StringPropDef & ArbitraryStylingPropDef)\n | (StringPropDef & NonStylingPropDef)\n | (EnumPropDef<T> & StylingPropDef)\n | (EnumPropDef<T> & NonStylingPropDef)\n | (EnumOrStringPropDef<T> & ArbitraryStylingPropDef)\n | (EnumOrStringPropDef<T> & NonStylingPropDef);\ntype ResponsivePropDef<T = any> = RegularPropDef<T> & { responsive: true };\ntype PropDef<T = any> = RegularPropDef<T> | ResponsivePropDef<T>;\n\n// prettier-ignore\ntype GetPropDefType<Def> =\n Def extends BooleanPropDef ? (Def extends ResponsivePropDef ? Responsive<boolean> : boolean)\n : Def extends StringPropDef ? (Def extends ResponsivePropDef ? Responsive<string> : string)\n : Def extends ReactNodePropDef ? (Def extends ResponsivePropDef ? Responsive<React.ReactNode> : React.ReactNode)\n : Def extends EnumOrStringPropDef<infer Type> ?\n Def extends ResponsivePropDef<infer Type extends string> ? Responsive<Union<string, Type>> : Type\n : Def extends EnumPropDef<infer Type> ? (Def extends ResponsivePropDef<infer Type> ? Responsive<Type> : Type)\n : never;\n\ntype GetPropDefTypes<P> = {\n [K in keyof P]?: GetPropDefType<P[K]>;\n};\n\nexport { breakpoints, breakpointSet };\nexport type {\n PropDef,\n GetPropDefTypes,\n ResponsivePropDef,\n //\n Breakpoint,\n Responsive,\n Union,\n};\n", "/** A util to check whether the object has a key, while inferring the correct key type */\nfunction hasOwnProperty<K extends string | number | symbol>(\n obj: Record<K, unknown>,\n key: string | number | symbol\n): key is K {\n return Object.prototype.hasOwnProperty.call(obj, key);\n}\n\nexport { hasOwnProperty };\n", "import type { Responsive, Breakpoint } from '../props/prop-def.js';\n\n// Use a Set for O(1) lookup instead of array.includes() which is O(n)\nconst breakpointSet = new Set<string>(['initial', 'xs', 'sm', 'md', 'lg', 'xl']);\n\nexport function isResponsiveObject<Value extends string>(\n obj: Responsive<Value | Omit<string, Value>> | undefined\n): obj is Record<Breakpoint, string> {\n if (typeof obj !== 'object' || obj === null) {\n return false;\n }\n // Use for...in to avoid Object.keys() array allocation\n for (const key in obj) {\n if (breakpointSet.has(key)) {\n return true;\n }\n }\n return false;\n}\n", "import { breakpointSet } from '../props/prop-def.js';\nimport { hasOwnProperty } from './has-own-property.js';\nimport { isResponsiveObject } from './is-responsive-object.js';\n\nimport type { Responsive, Union } from '../props/prop-def.js';\n\n/**\n * Membership test against a prop def's enum values. Callers that already hold a\n * compiled prop def pass `propValueSet` for an O(1) lookup; the handful of call\n * sites that build options inline fall back to scanning the array.\n */\nfunction includesValue(propValues: string[] | readonly string[], propValueSet: ReadonlySet<string> | undefined, value: string): boolean {\n return propValueSet !== undefined ? propValueSet.has(value) : propValues.includes(value);\n}\n\ninterface GetResponsiveStylesOptions {\n className: string;\n customProperties: `--${string}`[];\n value: Responsive<Union> | Responsive<string> | undefined;\n propValues: string[] | readonly string[];\n propValueSet?: ReadonlySet<string>;\n parseValue?: (value: string) => string | undefined;\n}\n\nfunction getResponsiveStyles({ className, customProperties, ...args }: GetResponsiveStylesOptions) {\n const responsiveClassNames = getResponsiveClassNames({\n allowArbitraryValues: true,\n className,\n ...args,\n });\n\n const responsiveCustomProperties = getResponsiveCustomProperties({ customProperties, ...args });\n return [responsiveClassNames, responsiveCustomProperties] as const;\n}\n\ninterface GetResponsiveClassNamesOptions {\n allowArbitraryValues?: boolean;\n className: string;\n value: Responsive<Union> | Responsive<string> | undefined;\n propValues: string[] | readonly string[];\n propValueSet?: ReadonlySet<string>;\n parseValue?: (value: string) => string | undefined;\n}\n\nfunction getResponsiveClassNames({ allowArbitraryValues, value, className, propValues, propValueSet, parseValue = (value) => value }: GetResponsiveClassNamesOptions): string | undefined {\n if (!value) {\n return undefined;\n }\n\n if (typeof value === 'string') {\n if (includesValue(propValues, propValueSet, value)) {\n return getBaseClassName(className, value, parseValue);\n }\n return allowArbitraryValues ? className : undefined;\n }\n\n if (isResponsiveObject(value)) {\n const object = value;\n const classNames: string[] = [];\n\n for (const bp in object) {\n // Make sure we are not iterating over keys that aren't breakpoints\n if (!hasOwnProperty(object, bp) || !breakpointSet.has(bp)) {\n continue;\n }\n\n const value = object[bp];\n\n if (value !== undefined) {\n if (includesValue(propValues, propValueSet, value)) {\n const baseClassName = getBaseClassName(className, value, parseValue);\n const bpClassName = bp === 'initial' ? baseClassName : `${bp}:${baseClassName}`;\n classNames.push(bpClassName);\n } else if (allowArbitraryValues) {\n const bpClassName = bp === 'initial' ? className : `${bp}:${className}`;\n classNames.push(bpClassName);\n }\n }\n }\n\n return classNames.length > 0 ? classNames.join(' ') : '';\n }\n\n if (allowArbitraryValues) {\n return className;\n }\n}\n\nfunction getBaseClassName(className: string, value: string, parseValue: (value: string) => string | undefined): string {\n const delimiter = className ? '-' : '';\n const matchedValue = parseValue(value);\n const isNegative = matchedValue?.startsWith('-');\n const minus = isNegative ? '-' : '';\n const absoluteValue = isNegative ? matchedValue?.substring(1) : matchedValue;\n return `${minus}${className}${delimiter}${absoluteValue}`;\n}\n\ninterface GetResponsiveCustomPropertiesOptions {\n customProperties: `--${string}`[];\n value: Responsive<Union> | Responsive<string> | undefined;\n propValues: string[] | readonly string[];\n propValueSet?: ReadonlySet<string>;\n parseValue?: (value: string) => string | undefined;\n}\n\nfunction getResponsiveCustomProperties({ customProperties, value, propValues, propValueSet, parseValue = (value) => value }: GetResponsiveCustomPropertiesOptions) {\n // Don't generate custom properties if the value is not arbitrary\n if (!value || (typeof value === 'string' && includesValue(propValues, propValueSet, value))) {\n return undefined;\n }\n\n let styles: Record<string, string | undefined> | undefined;\n\n if (typeof value === 'string') {\n const parsed = parseValue(value);\n styles = {};\n for (const customProperty of customProperties) {\n styles[customProperty] = parsed;\n }\n return styles;\n }\n\n if (isResponsiveObject(value)) {\n const object = value;\n\n for (const bp in object) {\n // Make sure we are not iterating over keys that aren't breakpoints\n if (!hasOwnProperty(object, bp) || !breakpointSet.has(bp)) {\n continue;\n }\n\n const value = object[bp];\n\n // Don't generate a custom property if the value is not arbitrary\n if (value === undefined || includesValue(propValues, propValueSet, value)) {\n continue;\n }\n\n const parsed = parseValue(value);\n styles ??= {};\n for (const customProperty of customProperties) {\n const bpProperty = bp === 'initial' ? customProperty : `${customProperty}-${bp}`;\n styles[bpProperty] = parsed;\n }\n }\n }\n\n return styles ?? {};\n}\n\nexport { getResponsiveStyles, getResponsiveCustomProperties, getResponsiveClassNames };\n", "type InlineStyle =\n | React.CSSProperties\n | Record<string, string | number | null | undefined>\n | undefined;\n\n// Merges CSS styles like `classNames` merges CSS classes\n// Optimized to avoid object spread in loop - uses Object.assign for in-place mutation\nexport function mergeStyles(...styles: Array<InlineStyle>): InlineStyle {\n let result: Record<string, string | number | null | undefined> | undefined;\n\n for (const style of styles) {\n if (style) {\n if (result === undefined) {\n // First non-empty style - create result object\n result = {};\n }\n Object.assign(result, style);\n }\n }\n\n return result;\n}\n", "import type { PropDef, GetPropDefTypes } from './prop-def.js';\n\n// prettier-ignore\nconst marginValues = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '-1', '-2', '-3', '-4', '-5', '-6', '-7', '-8', '-9', '-10', '-11', '-12'] as const;\n\nconst marginPropDefs = {\n /**\n * Sets the CSS **margin** property.\n * Supports space scale values, CSS strings, and responsive objects.\n *\n * @example\n * m=\"4\"\n * m=\"100px\"\n * m={{ sm: '6', lg: '9' }}\n *\n * @link\n * https://developer.mozilla.org/en-US/docs/Web/CSS/margin\n */\n m: {\n type: 'enum | string',\n values: marginValues,\n responsive: true,\n className: 'rt-r-m',\n customProperties: ['--m'],\n },\n /**\n * Sets the CSS **margin-left** and **margin-right** properties.\n * Supports space scale values, CSS strings, and responsive objects.\n *\n * @example\n * mx=\"4\"\n * mx=\"100px\"\n * mx={{ sm: '6', lg: '9' }}\n *\n * @link\n * https://developer.mozilla.org/en-US/docs/Web/CSS/margin-left\n * https://developer.mozilla.org/en-US/docs/Web/CSS/margin-right\n */\n mx: {\n type: 'enum | string',\n values: marginValues,\n responsive: true,\n className: 'rt-r-mx',\n customProperties: ['--ml', '--mr'],\n },\n /**\n * Sets the CSS **margin-top** and **margin-bottom** properties.\n * Supports space scale values, CSS strings, and responsive objects.\n *\n * @example\n * my=\"4\"\n * my=\"100px\"\n * my={{ sm: '6', lg: '9' }}\n *\n * @link\n * https://developer.mozilla.org/en-US/docs/Web/CSS/margin-top\n * https://developer.mozilla.org/en-US/docs/Web/CSS/margin-bottom\n */\n my: {\n type: 'enum | string',\n values: marginValues,\n responsive: true,\n className: 'rt-r-my',\n customProperties: ['--mt', '--mb'],\n },\n /**\n * Sets the CSS **margin-top** property.\n * Supports space scale values, CSS strings, and responsive objects.\n *\n * @example\n * mt=\"4\"\n * mt=\"100px\"\n * mt={{ sm: '6', lg: '9' }}\n *\n * @link\n * https://developer.mozilla.org/en-US/docs/Web/CSS/margin-top\n */\n mt: {\n type: 'enum | string',\n values: marginValues,\n responsive: true,\n className: 'rt-r-mt',\n customProperties: ['--mt'],\n },\n /**\n * Sets the CSS **margin-right** property.\n * Supports space scale values, CSS strings, and responsive objects.\n *\n * @example\n * mr=\"4\"\n * mr=\"100px\"\n * mr={{ sm: '6', lg: '9' }}\n *\n * @link\n * https://developer.mozilla.org/en-US/docs/Web/CSS/margin-right\n */\n mr: {\n type: 'enum | string',\n values: marginValues,\n responsive: true,\n className: 'rt-r-mr',\n customProperties: ['--mr'],\n },\n /**\n * Sets the CSS **margin-bottom** property.\n * Supports space scale values, CSS strings, and responsive objects.\n *\n * @example\n * mb=\"4\"\n * mb=\"100px\"\n * mb={{ sm: '6', lg: '9' }}\n *\n * @link\n * https://developer.mozilla.org/en-US/docs/Web/CSS/margin-bottom\n */\n mb: {\n type: 'enum | string',\n values: marginValues,\n responsive: true,\n className: 'rt-r-mb',\n customProperties: ['--mb'],\n },\n /**\n * Sets the CSS **margin-left** property.\n * Supports space scale values, CSS strings, and responsive objects.\n *\n * @example\n * ml=\"4\"\n * ml=\"100px\"\n * ml={{ sm: '6', lg: '9' }}\n *\n * @link\n * https://developer.mozilla.org/en-US/docs/Web/CSS/margin-left\n */\n ml: {\n type: 'enum | string',\n values: marginValues,\n responsive: true,\n className: 'rt-r-ml',\n customProperties: ['--ml'],\n },\n} satisfies {\n m: PropDef<(typeof marginValues)[number]>;\n mx: PropDef<(typeof marginValues)[number]>;\n my: PropDef<(typeof marginValues)[number]>;\n mt: PropDef<(typeof marginValues)[number]>;\n mr: PropDef<(typeof marginValues)[number]>;\n mb: PropDef<(typeof marginValues)[number]>;\n ml: PropDef<(typeof marginValues)[number]>;\n};\n\ntype MarginProps = GetPropDefTypes<typeof marginPropDefs>;\n\nexport { marginPropDefs };\nexport type { MarginProps };\n"],
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qBAAAE,IAAA,eAAAC,EAAAH,GCMA,IAAMI,EAAc,CAAC,UAAW,KAAM,KAAM,KAAM,KAAM,IAAI,EAC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MAAM,CAC3B,EAaA,GAAI,CACF,KAAM,gBACN,OAAQA,EACR,WAAY,GACZ,UAAW,UACX,iBAAkB,CAAC,MAAM,CAC3B,CACF,ENvIA,IAAME,EAAeC,EAAe,EAAE,OAChCC,EAAsC,IAAI,IAAIF,CAAY,EAI1DG,EAID,CACH,CAAE,IAAK,IAAK,UAAW,SAAU,iBAAkB,CAAC,UAAU,CAAE,EAChE,CAAE,IAAK,KAAM,UAAW,UAAW,iBAAkB,CAAC,gBAAiB,gBAAgB,CAAE,EACzF,CAAE,IAAK,KAAM,UAAW,UAAW,iBAAkB,CAAC,eAAgB,iBAAiB,CAAE,EACzF,CAAE,IAAK,KAAM,UAAW,UAAW,iBAAkB,CAAC,cAAc,CAAE,EACtE,CAAE,IAAK,KAAM,UAAW,UAAW,iBAAkB,CAAC,gBAAgB,CAAE,EACxE,CAAE,IAAK,KAAM,UAAW,UAAW,iBAAkB,CAAC,iBAAiB,CAAE,EACzE,CAAE,IAAK,KAAM,UAAW,UAAW,iBAAkB,CAAC,eAAe,CAAE,CACzE,EAEO,SAASC,EAAgBC,EAAoB,CAClD,IAAIC,EACAC,EAEJ,
|
|
6
|
-
"names": ["get_margin_styles_exports", "__export", "getMarginStyles", "__toCommonJS", "breakpoints", "breakpointSet", "hasOwnProperty", "obj", "key", "breakpointSet", "isResponsiveObject", "obj", "key", "includesValue", "propValues", "propValueSet", "value", "getResponsiveStyles", "className", "customProperties", "args", "responsiveClassNames", "getResponsiveClassNames", "responsiveCustomProperties", "getResponsiveCustomProperties", "allowArbitraryValues", "parseValue", "getBaseClassName", "isResponsiveObject", "object", "classNames", "bp", "hasOwnProperty", "breakpointSet", "baseClassName", "bpClassName", "delimiter", "matchedValue", "isNegative", "minus", "absoluteValue", "styles", "parsed", "customProperty", "bpProperty", "mergeStyles", "styles", "result", "style", "marginValues", "marginPropDefs", "marginValues", "marginPropDefs", "marginValueSet", "MARGIN_PROPS", "getMarginStyles", "props", "classes", "style", "
|
|
5
|
+
"mapp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AAOM,CAAoB,EAC3E,CAEA,MAAO,CAACP,IAAY,OAAYA,EAAQ,KAAK,GAAG,EAAI,GAAIC,CAAK,CAC/D",
|
|
6
|
+
"names": ["get_margin_styles_exports", "__export", "getMarginStyles", "__toCommonJS", "breakpoints", "breakpointSet", "hasOwnProperty", "obj", "key", "breakpointSet", "isResponsiveObject", "obj", "key", "includesValue", "propValues", "propValueSet", "value", "getResponsiveStyles", "className", "customProperties", "args", "responsiveClassNames", "getResponsiveClassNames", "responsiveCustomProperties", "getResponsiveCustomProperties", "allowArbitraryValues", "parseValue", "getBaseClassName", "isResponsiveObject", "object", "classNames", "bp", "hasOwnProperty", "breakpointSet", "baseClassName", "bpClassName", "delimiter", "matchedValue", "isNegative", "minus", "absoluteValue", "styles", "parsed", "customProperty", "bpProperty", "mergeStyles", "styles", "result", "style", "marginValues", "marginPropDefs", "marginValues", "marginPropDefs", "marginValueSet", "MARGIN_PROPS", "getMarginStyles", "props", "classes", "style", "key", "className", "customProperties", "value", "propClassNames", "propCustomProperties", "getResponsiveStyles", "mergeStyles"]
|
|
7
7
|
}
|
|
@@ -7,8 +7,11 @@ import { type Breakpoint } from '../components/shell.types.js';
|
|
|
7
7
|
* effect. On a client render the very first pass already has the real
|
|
8
8
|
* breakpoint, instead of rendering the whole shell at `initial` and correcting
|
|
9
9
|
* it after the browser has painted.
|
|
10
|
+
*
|
|
11
|
+
* Pass `enabled = false` to skip the subscription (the breakpoint then reads as
|
|
12
|
+
* `initial`).
|
|
10
13
|
*/
|
|
11
|
-
export declare function useBreakpoint(): {
|
|
14
|
+
export declare function useBreakpoint(enabled?: boolean): {
|
|
12
15
|
breakpoint: Breakpoint;
|
|
13
16
|
ready: boolean;
|
|
14
17
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-breakpoint.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-breakpoint.ts"],"names":[],"mappings":"AAGA,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"use-breakpoint.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-breakpoint.ts"],"names":[],"mappings":"AAGA,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAyF7E;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,OAAO,UAAO,GAAG;IAAE,UAAU,EAAE,UAAU,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,CAexF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";"use client";var
|
|
1
|
+
"use strict";"use client";var S=Object.create;var s=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var R=Object.getPrototypeOf,h=Object.prototype.hasOwnProperty;var v=(e,t)=>{for(var n in t)s(e,n,{get:t[n],enumerable:!0})},m=(e,t,n,u)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of P(t))!h.call(e,r)&&r!==n&&s(e,r,{get:()=>t[r],enumerable:!(u=b(t,r))||u.enumerable});return e};var g=(e,t,n)=>(n=e!=null?S(R(e)):{},m(t||!e||!e.__esModule?s(n,"default",{value:e,enumerable:!0}):n,e)),k=e=>m(s({},"__esModule",{value:!0}),e);var T={};v(T,{useBreakpoint:()=>C});module.exports=k(T);var a=g(require("react"));var f={xs:"(min-width: 520px)",sm:"(min-width: 768px)",md:"(min-width: 1024px)",lg:"(min-width: 1280px)",xl:"(min-width: 1640px)"};var B=Object.entries(f),d=null,o=new Set,i=null;function l(){return d??(d=B.map(([e,t])=>[e,window.matchMedia(t)])),d}function c(){let e="initial";for(let[t,n]of l())n.matches&&(e=t);return e}function p(){let e=c();e!==i&&(i=e,o.forEach(t=>t()))}function x(e){if(typeof window>"u")return()=>{};if(o.size===0){i=c();for(let[,t]of l())typeof t.addEventListener=="function"?t.addEventListener("change",p):t.addListener?.(p)}return o.add(e),()=>{if(o.delete(e),!(o.size>0)){for(let[,t]of l())try{typeof t.removeEventListener=="function"?t.removeEventListener("change",p):t.removeListener?.(p)}catch{}i=null}}}function z(){return typeof window>"u"?"initial":(i??(i=c()),i)}function E(){return"initial"}var w=()=>!0,M=()=>!1,y=()=>()=>{},L=()=>"initial";function C(e=!0){let t=a.useSyncExternalStore(e?x:y,e?z:L,E),n=a.useSyncExternalStore(e?x:y,w,M);return a.useMemo(()=>({breakpoint:t,ready:n}),[t,n])}
|
|
2
2
|
//# sourceMappingURL=use-breakpoint.js.map
|