@psnext/design-system 2.3.0 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DESIGN.md +466 -4
- package/README.md +3 -3
- package/SKILL.md +83 -5
- package/bin/install-agent-skill.mjs +39 -7
- package/dist/Header.cjs +151 -20
- package/dist/Header.cjs.map +1 -1
- package/dist/Header.js +151 -20
- package/dist/Header.js.map +1 -1
- package/dist/Icon.cjs +40 -8
- package/dist/Icon.cjs.map +1 -1
- package/dist/Icon.js +40 -8
- package/dist/Icon.js.map +1 -1
- package/dist/MultiColumn.cjs +354 -0
- package/dist/MultiColumn.cjs.map +1 -0
- package/dist/MultiColumn.js +335 -0
- package/dist/MultiColumn.js.map +1 -0
- package/dist/Sidebar.cjs +4 -3
- package/dist/Sidebar.cjs.map +1 -1
- package/dist/Sidebar.js +4 -3
- package/dist/Sidebar.js.map +1 -1
- package/dist/index.cjs +5 -1
- package/dist/index.d.cts +5 -5
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index10.d.cts +6 -6
- package/dist/index10.d.ts +6 -6
- package/dist/index11.d.cts +3 -3
- package/dist/index11.d.cts.map +1 -1
- package/dist/index11.d.ts +3 -3
- package/dist/index11.d.ts.map +1 -1
- package/dist/index12.d.cts +12 -12
- package/dist/index12.d.cts.map +1 -1
- package/dist/index12.d.ts +13 -13
- package/dist/index13.d.cts +6 -6
- package/dist/index13.d.cts.map +1 -1
- package/dist/index13.d.ts +6 -6
- package/dist/index13.d.ts.map +1 -1
- package/dist/index14.d.cts +5 -5
- package/dist/index14.d.ts +5 -5
- package/dist/index15.d.cts +3 -3
- package/dist/index15.d.cts.map +1 -1
- package/dist/index15.d.ts +3 -3
- package/dist/index15.d.ts.map +1 -1
- package/dist/index16.d.cts +2 -2
- package/dist/index16.d.cts.map +1 -1
- package/dist/index16.d.ts +2 -2
- package/dist/index16.d.ts.map +1 -1
- package/dist/index17.d.cts +4 -4
- package/dist/index17.d.cts.map +1 -1
- package/dist/index17.d.ts +4 -4
- package/dist/index18.d.cts +11 -11
- package/dist/index18.d.cts.map +1 -1
- package/dist/index18.d.ts +11 -11
- package/dist/index18.d.ts.map +1 -1
- package/dist/index19.d.cts +10 -10
- package/dist/index19.d.cts.map +1 -1
- package/dist/index19.d.ts +10 -10
- package/dist/index19.d.ts.map +1 -1
- package/dist/index2.d.cts +8 -8
- package/dist/index2.d.cts.map +1 -1
- package/dist/index2.d.ts +9 -9
- package/dist/index2.d.ts.map +1 -1
- package/dist/index20.d.cts +16 -16
- package/dist/index20.d.cts.map +1 -1
- package/dist/index20.d.ts +16 -16
- package/dist/index20.d.ts.map +1 -1
- package/dist/index21.d.cts +4 -4
- package/dist/index21.d.cts.map +1 -1
- package/dist/index21.d.ts +4 -4
- package/dist/index21.d.ts.map +1 -1
- package/dist/index22.d.cts +11 -11
- package/dist/index22.d.ts +11 -11
- package/dist/index23.d.cts +16 -16
- package/dist/index23.d.cts.map +1 -1
- package/dist/index23.d.ts +16 -16
- package/dist/index23.d.ts.map +1 -1
- package/dist/index24.d.cts +10 -10
- package/dist/index24.d.cts.map +1 -1
- package/dist/index24.d.ts +11 -11
- package/dist/index24.d.ts.map +1 -1
- package/dist/index25.d.cts +2 -2
- package/dist/index25.d.ts +2 -2
- package/dist/index25.d.ts.map +1 -1
- package/dist/index26.d.cts +13 -13
- package/dist/index26.d.cts.map +1 -1
- package/dist/index26.d.ts +14 -14
- package/dist/index26.d.ts.map +1 -1
- package/dist/index27.d.cts +7 -7
- package/dist/index27.d.cts.map +1 -1
- package/dist/index27.d.ts +7 -7
- package/dist/index27.d.ts.map +1 -1
- package/dist/index28.d.cts +6 -6
- package/dist/index28.d.cts.map +1 -1
- package/dist/index28.d.ts +5 -5
- package/dist/index28.d.ts.map +1 -1
- package/dist/index29.d.cts +4 -4
- package/dist/index29.d.ts +4 -4
- package/dist/index29.d.ts.map +1 -1
- package/dist/index3.d.cts +13 -13
- package/dist/index3.d.cts.map +1 -1
- package/dist/index3.d.ts +13 -13
- package/dist/index30.d.cts +41 -12
- package/dist/index30.d.cts.map +1 -1
- package/dist/index30.d.ts +42 -13
- package/dist/index30.d.ts.map +1 -1
- package/dist/index31.d.cts +5 -5
- package/dist/index31.d.cts.map +1 -1
- package/dist/index31.d.ts +6 -6
- package/dist/index31.d.ts.map +1 -1
- package/dist/index32.d.cts +5 -5
- package/dist/index32.d.cts.map +1 -1
- package/dist/index32.d.ts +6 -6
- package/dist/index33.d.cts +10 -10
- package/dist/index33.d.cts.map +1 -1
- package/dist/index33.d.ts +11 -11
- package/dist/index33.d.ts.map +1 -1
- package/dist/index34.d.cts +5 -5
- package/dist/index34.d.cts.map +1 -1
- package/dist/index34.d.ts +5 -5
- package/dist/index34.d.ts.map +1 -1
- package/dist/index35.d.cts +16 -16
- package/dist/index35.d.cts.map +1 -1
- package/dist/index35.d.ts +17 -17
- package/dist/index35.d.ts.map +1 -1
- package/dist/index36.d.cts +3 -3
- package/dist/index36.d.cts.map +1 -1
- package/dist/index36.d.ts +3 -3
- package/dist/index36.d.ts.map +1 -1
- package/dist/index37.d.cts +5 -5
- package/dist/index37.d.ts +3 -3
- package/dist/index38.d.cts +2 -2
- package/dist/index38.d.cts.map +1 -1
- package/dist/index38.d.ts +2 -2
- package/dist/index39.d.cts +17 -17
- package/dist/index39.d.cts.map +1 -1
- package/dist/index39.d.ts +17 -17
- package/dist/index39.d.ts.map +1 -1
- package/dist/index4.d.cts +2 -2
- package/dist/index4.d.ts +2 -2
- package/dist/index4.d.ts.map +1 -1
- package/dist/index40.d.cts +5 -5
- package/dist/index40.d.cts.map +1 -1
- package/dist/index40.d.ts +6 -6
- package/dist/index40.d.ts.map +1 -1
- package/dist/index41.d.cts +11 -11
- package/dist/index41.d.cts.map +1 -1
- package/dist/index41.d.ts +11 -11
- package/dist/index41.d.ts.map +1 -1
- package/dist/index42.d.cts +8 -8
- package/dist/index42.d.cts.map +1 -1
- package/dist/index42.d.ts +8 -8
- package/dist/index43.d.cts +9 -9
- package/dist/index43.d.cts.map +1 -1
- package/dist/index43.d.ts +9 -9
- package/dist/index43.d.ts.map +1 -1
- package/dist/index45.d.cts +8 -8
- package/dist/index45.d.cts.map +1 -1
- package/dist/index45.d.ts +8 -8
- package/dist/index45.d.ts.map +1 -1
- package/dist/index46.d.cts +2 -2
- package/dist/index46.d.cts.map +1 -1
- package/dist/index46.d.ts +2 -2
- package/dist/index46.d.ts.map +1 -1
- package/dist/index47.d.cts +4 -4
- package/dist/index47.d.cts.map +1 -1
- package/dist/index47.d.ts +4 -4
- package/dist/index47.d.ts.map +1 -1
- package/dist/index48.d.cts +4 -4
- package/dist/index48.d.cts.map +1 -1
- package/dist/index48.d.ts +4 -4
- package/dist/index48.d.ts.map +1 -1
- package/dist/index49.d.cts +3 -3
- package/dist/index49.d.ts +3 -3
- package/dist/index5.d.cts +7 -7
- package/dist/index5.d.ts +7 -7
- package/dist/index50.d.cts +11 -11
- package/dist/index50.d.cts.map +1 -1
- package/dist/index50.d.ts +11 -11
- package/dist/index50.d.ts.map +1 -1
- package/dist/index51.d.cts +9 -9
- package/dist/index51.d.cts.map +1 -1
- package/dist/index51.d.ts +9 -9
- package/dist/index51.d.ts.map +1 -1
- package/dist/index52.d.cts +5 -5
- package/dist/index52.d.ts +5 -5
- package/dist/index53.d.cts +27 -27
- package/dist/index53.d.cts.map +1 -1
- package/dist/index53.d.ts +28 -28
- package/dist/index53.d.ts.map +1 -1
- package/dist/index54.d.cts +5 -5
- package/dist/index54.d.ts +5 -5
- package/dist/index54.d.ts.map +1 -1
- package/dist/index55.d.cts +2 -2
- package/dist/index55.d.cts.map +1 -1
- package/dist/index55.d.ts +2 -2
- package/dist/index55.d.ts.map +1 -1
- package/dist/index56.d.cts +2 -2
- package/dist/index56.d.cts.map +1 -1
- package/dist/index56.d.ts +2 -2
- package/dist/index56.d.ts.map +1 -1
- package/dist/index57.d.cts +2 -2
- package/dist/index57.d.cts.map +1 -1
- package/dist/index57.d.ts +2 -2
- package/dist/index57.d.ts.map +1 -1
- package/dist/index58.d.cts +4 -4
- package/dist/index58.d.cts.map +1 -1
- package/dist/index58.d.ts +4 -4
- package/dist/index58.d.ts.map +1 -1
- package/dist/index59.d.cts +9 -9
- package/dist/index59.d.ts +9 -9
- package/dist/index59.d.ts.map +1 -1
- package/dist/index6.d.cts +5 -5
- package/dist/index6.d.cts.map +1 -1
- package/dist/index6.d.ts +6 -6
- package/dist/index60.d.cts +9 -9
- package/dist/index60.d.ts +9 -9
- package/dist/index60.d.ts.map +1 -1
- package/dist/index61.d.cts +8 -8
- package/dist/index61.d.cts.map +1 -1
- package/dist/index61.d.ts +7 -7
- package/dist/index61.d.ts.map +1 -1
- package/dist/index62.d.cts +4 -4
- package/dist/index62.d.cts.map +1 -1
- package/dist/index62.d.ts +5 -5
- package/dist/index63.d.cts +2 -2
- package/dist/index63.d.ts +2 -2
- package/dist/index64.d.cts +4 -4
- package/dist/index64.d.ts +7 -7
- package/dist/index64.d.ts.map +1 -1
- package/dist/index65.d.cts +3 -3
- package/dist/index65.d.ts +4 -4
- package/dist/index66.d.cts +4 -4
- package/dist/index66.d.ts +5 -5
- package/dist/index67.d.cts +83 -11
- package/dist/index67.d.cts.map +1 -1
- package/dist/index67.d.ts +83 -11
- package/dist/index67.d.ts.map +1 -1
- package/dist/index68.d.cts +12 -30
- package/dist/index68.d.cts.map +1 -1
- package/dist/index68.d.ts +12 -30
- package/dist/index68.d.ts.map +1 -1
- package/dist/index69.d.cts +28 -27
- package/dist/index69.d.cts.map +1 -1
- package/dist/index69.d.ts +29 -28
- package/dist/index69.d.ts.map +1 -1
- package/dist/index7.d.cts +8 -8
- package/dist/index7.d.cts.map +1 -1
- package/dist/index7.d.ts +8 -8
- package/dist/index7.d.ts.map +1 -1
- package/dist/index70.d.cts +33 -78
- package/dist/index70.d.cts.map +1 -1
- package/dist/index70.d.ts +33 -78
- package/dist/index70.d.ts.map +1 -1
- package/dist/index71.d.cts +77 -260
- package/dist/index71.d.cts.map +1 -1
- package/dist/index71.d.ts +77 -260
- package/dist/index71.d.ts.map +1 -1
- package/dist/index72.d.cts +278 -0
- package/dist/index72.d.cts.map +1 -0
- package/dist/index72.d.ts +278 -0
- package/dist/index72.d.ts.map +1 -0
- package/dist/index8.d.cts +4 -4
- package/dist/index8.d.cts.map +1 -1
- package/dist/index8.d.ts +5 -5
- package/dist/index9.d.cts +2 -2
- package/dist/index9.d.cts.map +1 -1
- package/dist/index9.d.ts +2 -2
- package/dist/index9.d.ts.map +1 -1
- package/dist/layouts/Container/index.cjs +2 -1
- package/dist/layouts/Container/index.cjs.map +1 -1
- package/dist/layouts/Container/index.js +1 -1
- package/dist/layouts/MultiColumn/index.cjs +5 -0
- package/dist/layouts/MultiColumn/index.d.cts +2 -0
- package/dist/layouts/MultiColumn/index.d.ts +2 -0
- package/dist/layouts/MultiColumn/index.js +2 -0
- package/dist/layouts/PageBackground/index.d.cts +1 -1
- package/dist/layouts/PageBackground/index.d.ts +1 -1
- package/dist/layouts/Stack/index.cjs +2 -1
- package/dist/layouts/Stack/index.cjs.map +1 -1
- package/dist/layouts/Stack/index.d.cts +1 -1
- package/dist/layouts/Stack/index.d.ts +1 -1
- package/dist/layouts/Stack/index.js +1 -1
- package/dist/layouts/TwoColumn/index.cjs +2 -1
- package/dist/layouts/TwoColumn/index.cjs.map +1 -1
- package/dist/layouts/TwoColumn/index.d.cts +1 -1
- package/dist/layouts/TwoColumn/index.d.ts +1 -1
- package/dist/layouts/TwoColumn/index.js +1 -1
- package/dist/layouts/index.cjs +4 -0
- package/dist/layouts/index.d.cts +5 -4
- package/dist/layouts/index.d.ts +5 -4
- package/dist/layouts/index.js +2 -1
- package/dist/patterns/DataTable/index.cjs +6 -2
- package/dist/patterns/DataTable/index.cjs.map +1 -1
- package/dist/patterns/DataTable/index.d.cts +3 -3
- package/dist/patterns/DataTable/index.d.cts.map +1 -1
- package/dist/patterns/DataTable/index.d.ts +3 -3
- package/dist/patterns/DataTable/index.d.ts.map +1 -1
- package/dist/patterns/DataTable/index.js +6 -2
- package/dist/patterns/DataTable/index.js.map +1 -1
- package/dist/patterns/Footer/index.d.cts +7 -7
- package/dist/patterns/Footer/index.d.cts.map +1 -1
- package/dist/patterns/Footer/index.d.ts +7 -7
- package/dist/patterns/Footer/index.d.ts.map +1 -1
- package/dist/patterns/Header/index.d.cts +1 -1
- package/dist/patterns/Header/index.d.ts +1 -1
- package/dist/patterns/MediaObject/index.cjs +1 -1
- package/dist/patterns/MediaObject/index.d.cts +11 -11
- package/dist/patterns/MediaObject/index.d.ts +12 -12
- package/dist/patterns/MediaObject/index.js +1 -1
- package/dist/patterns/NavRail/index.cjs +4 -2
- package/dist/patterns/NavRail/index.cjs.map +1 -1
- package/dist/patterns/NavRail/index.js +4 -2
- package/dist/patterns/NavRail/index.js.map +1 -1
- package/dist/patterns/SectionCard/index.d.cts +2 -2
- package/dist/patterns/SectionCard/index.d.ts +2 -2
- package/dist/patterns/SectionHeading/index.d.cts +2 -2
- package/dist/patterns/index.d.cts +1 -1
- package/dist/patterns/index.d.ts +1 -1
- package/dist/primitives/Accordion/index.cjs +6 -2
- package/dist/primitives/Accordion/index.cjs.map +1 -1
- package/dist/primitives/Accordion/index.js +6 -2
- package/dist/primitives/Accordion/index.js.map +1 -1
- package/dist/primitives/Alert/index.cjs +2 -1
- package/dist/primitives/Alert/index.cjs.map +1 -1
- package/dist/primitives/Alert/index.js +1 -1
- package/dist/primitives/AlertDialog/index.cjs +1 -1
- package/dist/primitives/AlertDialog/index.js +1 -1
- package/dist/primitives/AspectRatio/index.cjs +1 -1
- package/dist/primitives/AspectRatio/index.js +1 -1
- package/dist/primitives/Avatar/index.cjs +1 -1
- package/dist/primitives/Avatar/index.js +1 -1
- package/dist/primitives/Badge/index.cjs +3 -2
- package/dist/primitives/Badge/index.cjs.map +1 -1
- package/dist/primitives/Badge/index.js +2 -2
- package/dist/primitives/Breadcrumb/index.cjs +7 -3
- package/dist/primitives/Breadcrumb/index.cjs.map +1 -1
- package/dist/primitives/Breadcrumb/index.js +7 -3
- package/dist/primitives/Breadcrumb/index.js.map +1 -1
- package/dist/primitives/Button/index.cjs +3 -2
- package/dist/primitives/Button/index.cjs.map +1 -1
- package/dist/primitives/Button/index.js +2 -2
- package/dist/primitives/ButtonGroup/index.cjs +3 -2
- package/dist/primitives/ButtonGroup/index.cjs.map +1 -1
- package/dist/primitives/ButtonGroup/index.js +2 -2
- package/dist/primitives/Calendar/index.cjs +12 -11
- package/dist/primitives/Calendar/index.cjs.map +1 -1
- package/dist/primitives/Calendar/index.js +12 -11
- package/dist/primitives/Calendar/index.js.map +1 -1
- package/dist/primitives/Card/index.cjs +2 -1
- package/dist/primitives/Card/index.cjs.map +1 -1
- package/dist/primitives/Card/index.js +1 -1
- package/dist/primitives/Carousel/index.cjs +4 -3
- package/dist/primitives/Carousel/index.cjs.map +1 -1
- package/dist/primitives/Carousel/index.js +4 -3
- package/dist/primitives/Carousel/index.js.map +1 -1
- package/dist/primitives/Checkbox/index.cjs +9 -2
- package/dist/primitives/Checkbox/index.cjs.map +1 -1
- package/dist/primitives/Checkbox/index.js +9 -2
- package/dist/primitives/Checkbox/index.js.map +1 -1
- package/dist/primitives/CheckboxTree/index.cjs +6 -2
- package/dist/primitives/CheckboxTree/index.cjs.map +1 -1
- package/dist/primitives/CheckboxTree/index.js +6 -2
- package/dist/primitives/CheckboxTree/index.js.map +1 -1
- package/dist/primitives/Collapsible/index.cjs +1 -1
- package/dist/primitives/Collapsible/index.js +1 -1
- package/dist/primitives/Command/index.cjs +6 -2
- package/dist/primitives/Command/index.cjs.map +1 -1
- package/dist/primitives/Command/index.js +6 -2
- package/dist/primitives/Command/index.js.map +1 -1
- package/dist/primitives/ContextMenu/index.cjs +14 -4
- package/dist/primitives/ContextMenu/index.cjs.map +1 -1
- package/dist/primitives/ContextMenu/index.js +14 -4
- package/dist/primitives/ContextMenu/index.js.map +1 -1
- package/dist/primitives/Credits/index.cjs +8 -3
- package/dist/primitives/Credits/index.cjs.map +1 -1
- package/dist/primitives/Credits/index.js +7 -3
- package/dist/primitives/Credits/index.js.map +1 -1
- package/dist/primitives/Dialog/index.cjs +3 -2
- package/dist/primitives/Dialog/index.cjs.map +1 -1
- package/dist/primitives/Dialog/index.js +3 -2
- package/dist/primitives/Dialog/index.js.map +1 -1
- package/dist/primitives/DropdownMenu/index.cjs +14 -4
- package/dist/primitives/DropdownMenu/index.cjs.map +1 -1
- package/dist/primitives/DropdownMenu/index.js +14 -4
- package/dist/primitives/DropdownMenu/index.js.map +1 -1
- package/dist/primitives/Empty/index.cjs +1 -1
- package/dist/primitives/Empty/index.js +1 -1
- package/dist/primitives/Field/index.cjs +1 -1
- package/dist/primitives/Field/index.js +1 -1
- package/dist/primitives/Form/index.cjs +1 -1
- package/dist/primitives/Form/index.js +1 -1
- package/dist/primitives/Heading/index.cjs +2 -1
- package/dist/primitives/Heading/index.cjs.map +1 -1
- package/dist/primitives/Heading/index.js +1 -1
- package/dist/primitives/HoverCard/index.cjs +1 -1
- package/dist/primitives/HoverCard/index.js +1 -1
- package/dist/primitives/InfoBanner/index.cjs +6 -3
- package/dist/primitives/InfoBanner/index.cjs.map +1 -1
- package/dist/primitives/InfoBanner/index.js +5 -3
- package/dist/primitives/InfoBanner/index.js.map +1 -1
- package/dist/primitives/Input/index.cjs +2 -1
- package/dist/primitives/Input/index.cjs.map +1 -1
- package/dist/primitives/Input/index.js +1 -1
- package/dist/primitives/InputGroup/index.cjs +1 -1
- package/dist/primitives/InputGroup/index.js +1 -1
- package/dist/primitives/InputOtp/index.cjs +3 -2
- package/dist/primitives/InputOtp/index.cjs.map +1 -1
- package/dist/primitives/InputOtp/index.js +3 -2
- package/dist/primitives/InputOtp/index.js.map +1 -1
- package/dist/primitives/Item/index.cjs +2 -2
- package/dist/primitives/Item/index.js +2 -2
- package/dist/primitives/Label/index.cjs +1 -1
- package/dist/primitives/Label/index.js +1 -1
- package/dist/primitives/Link/index.cjs +3 -2
- package/dist/primitives/Link/index.cjs.map +1 -1
- package/dist/primitives/Link/index.js +2 -2
- package/dist/primitives/Menubar/index.cjs +14 -4
- package/dist/primitives/Menubar/index.cjs.map +1 -1
- package/dist/primitives/Menubar/index.js +14 -4
- package/dist/primitives/Menubar/index.js.map +1 -1
- package/dist/primitives/NativeSelect/index.cjs +6 -3
- package/dist/primitives/NativeSelect/index.cjs.map +1 -1
- package/dist/primitives/NativeSelect/index.js +5 -3
- package/dist/primitives/NativeSelect/index.js.map +1 -1
- package/dist/primitives/NavigationMenu/index.cjs +5 -3
- package/dist/primitives/NavigationMenu/index.cjs.map +1 -1
- package/dist/primitives/NavigationMenu/index.js +5 -3
- package/dist/primitives/NavigationMenu/index.js.map +1 -1
- package/dist/primitives/Pagination/index.cjs +6 -2
- package/dist/primitives/Pagination/index.cjs.map +1 -1
- package/dist/primitives/Pagination/index.js +6 -2
- package/dist/primitives/Pagination/index.js.map +1 -1
- package/dist/primitives/Popover/index.cjs +1 -1
- package/dist/primitives/Popover/index.js +1 -1
- package/dist/primitives/Progress/index.cjs +1 -1
- package/dist/primitives/Progress/index.js +1 -1
- package/dist/primitives/RadioGroup/index.cjs +6 -2
- package/dist/primitives/RadioGroup/index.cjs.map +1 -1
- package/dist/primitives/RadioGroup/index.js +6 -2
- package/dist/primitives/RadioGroup/index.js.map +1 -1
- package/dist/primitives/Resizable/index.cjs +6 -2
- package/dist/primitives/Resizable/index.cjs.map +1 -1
- package/dist/primitives/Resizable/index.js +6 -2
- package/dist/primitives/Resizable/index.js.map +1 -1
- package/dist/primitives/ScrollArea/index.cjs +1 -1
- package/dist/primitives/ScrollArea/index.js +1 -1
- package/dist/primitives/Select/index.cjs +18 -5
- package/dist/primitives/Select/index.cjs.map +1 -1
- package/dist/primitives/Select/index.js +18 -5
- package/dist/primitives/Select/index.js.map +1 -1
- package/dist/primitives/Separator/index.cjs +1 -1
- package/dist/primitives/Separator/index.js +1 -1
- package/dist/primitives/Sheet/index.cjs +6 -2
- package/dist/primitives/Sheet/index.cjs.map +1 -1
- package/dist/primitives/Sheet/index.js +6 -2
- package/dist/primitives/Sheet/index.js.map +1 -1
- package/dist/primitives/Slider/index.cjs +1 -1
- package/dist/primitives/Slider/index.js +1 -1
- package/dist/primitives/Sonner/index.cjs +22 -6
- package/dist/primitives/Sonner/index.cjs.map +1 -1
- package/dist/primitives/Sonner/index.js +22 -6
- package/dist/primitives/Sonner/index.js.map +1 -1
- package/dist/primitives/Spinner/index.cjs +4 -2
- package/dist/primitives/Spinner/index.cjs.map +1 -1
- package/dist/primitives/Spinner/index.js +4 -2
- package/dist/primitives/Spinner/index.js.map +1 -1
- package/dist/primitives/Switch/index.cjs +1 -1
- package/dist/primitives/Switch/index.js +1 -1
- package/dist/primitives/Tabs/index.cjs +2 -2
- package/dist/primitives/Tabs/index.js +2 -2
- package/dist/primitives/Text/index.cjs +2 -1
- package/dist/primitives/Text/index.cjs.map +1 -1
- package/dist/primitives/Text/index.js +1 -1
- package/dist/primitives/Textarea/index.cjs +2 -1
- package/dist/primitives/Textarea/index.cjs.map +1 -1
- package/dist/primitives/Textarea/index.js +1 -1
- package/dist/primitives/Toggle/index.cjs +3 -2
- package/dist/primitives/Toggle/index.cjs.map +1 -1
- package/dist/primitives/Toggle/index.js +2 -2
- package/dist/primitives/ToggleGroup/index.cjs +1 -1
- package/dist/primitives/ToggleGroup/index.js +1 -1
- package/dist/primitives/Tooltip/index.cjs +1 -1
- package/dist/primitives/Tooltip/index.js +1 -1
- package/dist/primitives/index.cjs +1 -1
- package/dist/primitives/index.js +1 -1
- package/package.json +2 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/primitives/Carousel/Carousel.tsx"],"sourcesContent":["\"use client\";\n\nimport useEmblaCarousel, { type UseEmblaCarouselType } from \"embla-carousel-react\";\nimport { ArrowLeft, ArrowRight } from \"lucide-react\";\nimport * as React from \"react\";\n\nimport { Button } from \"@/primitives/Button\";\nimport { cn } from \"@/utils\";\n\ntype CarouselApi = UseEmblaCarouselType[1];\ntype UseCarouselParameters = Parameters<typeof useEmblaCarousel>;\ntype CarouselOptions = UseCarouselParameters[0];\ntype CarouselPlugin = UseCarouselParameters[1];\n\ntype CarouselProps = {\n /** Embla carousel options (loop, align, dragFree, etc.). */\n opts?: CarouselOptions;\n /** Embla plugins (e.g. Autoplay) to extend the carousel behaviour. */\n plugins?: CarouselPlugin;\n /** Scroll axis of the carousel. */\n orientation?: \"horizontal\" | \"vertical\";\n /** Receives the Embla API instance once initialised, for external control. */\n setApi?: (api: CarouselApi) => void;\n};\n\ntype CarouselContextProps = {\n carouselRef: ReturnType<typeof useEmblaCarousel>[0];\n api: ReturnType<typeof useEmblaCarousel>[1];\n scrollPrev: () => void;\n scrollNext: () => void;\n canScrollPrev: boolean;\n canScrollNext: boolean;\n} & CarouselProps;\n\nconst CarouselContext = React.createContext<CarouselContextProps | null>(null);\n\nfunction useCarousel() {\n const context = React.useContext(CarouselContext);\n\n if (!context) {\n throw new Error(\"useCarousel must be used within a <Carousel />\");\n }\n\n return context;\n}\n\n/** Embla-backed carousel root: provides context and arrow-key navigation for its slides. */\nfunction Carousel({\n orientation = \"horizontal\",\n opts,\n setApi,\n plugins,\n className,\n children,\n ...props\n}: React.ComponentProps<\"div\"> & CarouselProps) {\n const [carouselRef, api] = useEmblaCarousel(\n {\n ...opts,\n axis: orientation === \"horizontal\" ? \"x\" : \"y\",\n },\n plugins,\n );\n const [canScrollPrev, setCanScrollPrev] = React.useState(false);\n const [canScrollNext, setCanScrollNext] = React.useState(false);\n\n const onSelect = React.useCallback((api: CarouselApi) => {\n if (!api) return;\n setCanScrollPrev(api.canScrollPrev());\n setCanScrollNext(api.canScrollNext());\n }, []);\n\n const scrollPrev = React.useCallback(() => {\n api?.scrollPrev();\n }, [api]);\n\n const scrollNext = React.useCallback(() => {\n api?.scrollNext();\n }, [api]);\n\n const handleKeyDown = React.useCallback(\n (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (event.key === \"ArrowLeft\") {\n event.preventDefault();\n scrollPrev();\n } else if (event.key === \"ArrowRight\") {\n event.preventDefault();\n scrollNext();\n }\n },\n [scrollPrev, scrollNext],\n );\n\n React.useEffect(() => {\n if (!api || !setApi) return;\n setApi(api);\n }, [api, setApi]);\n\n React.useEffect(() => {\n if (!api) return;\n onSelect(api);\n api.on(\"reInit\", onSelect);\n api.on(\"select\", onSelect);\n\n return () => {\n api?.off(\"select\", onSelect);\n };\n }, [api, onSelect]);\n\n return (\n <CarouselContext.Provider\n value={{\n carouselRef,\n api: api,\n opts,\n orientation: orientation || (opts?.axis === \"y\" ? \"vertical\" : \"horizontal\"),\n scrollPrev,\n scrollNext,\n canScrollPrev,\n canScrollNext,\n }}\n >\n <div\n onKeyDownCapture={handleKeyDown}\n className={cn(\"relative\", className)}\n role=\"region\"\n aria-roledescription=\"carousel\"\n data-slot=\"carousel\"\n {...props}\n >\n {children}\n </div>\n </CarouselContext.Provider>\n );\n}\n\n/** Scroll viewport that lays out the slides along the carousel's axis. */\nfunction CarouselContent({ className, ...props }: React.ComponentProps<\"div\">) {\n const { carouselRef, orientation } = useCarousel();\n\n return (\n <div ref={carouselRef} className=\"overflow-hidden\" data-slot=\"carousel-content\">\n <div\n className={cn(\"flex\", orientation === \"horizontal\" ? \"-ml-4\" : \"-mt-4 flex-col\", className)}\n {...props}\n />\n </div>\n );\n}\n\n/** A single slide within `CarouselContent`. */\nfunction CarouselItem({ className, ...props }: React.ComponentProps<\"div\">) {\n const { orientation } = useCarousel();\n\n return (\n <div\n role=\"group\"\n aria-roledescription=\"slide\"\n data-slot=\"carousel-item\"\n className={cn(\n \"min-w-0 shrink-0 grow-0 basis-full\",\n orientation === \"horizontal\" ? \"pl-4\" : \"pt-4\",\n className,\n )}\n {...props}\n />\n );\n}\n\n/** Button that scrolls to the previous slide; auto-disables at the start. */\nfunction CarouselPrevious({\n className,\n variant = \"outline\",\n size = \"icon\",\n ...props\n}: React.ComponentProps<typeof Button>) {\n const { orientation, scrollPrev, canScrollPrev } = useCarousel();\n\n return (\n <Button\n data-slot=\"carousel-previous\"\n variant={variant}\n size={size}\n className={cn(\n \"absolute size-9 rounded-8 border-primary-border\",\n orientation === \"horizontal\"\n ? \"top-1/2 -left-13 -translate-y-1/2\"\n : \"-top-13 left-1/2 -translate-x-1/2 rotate-90\",\n className,\n )}\n disabled={!canScrollPrev}\n onClick={scrollPrev}\n {...props}\n >\n <ArrowLeft />\n <span className=\"sr-only\">Previous slide</span>\n </Button>\n );\n}\n\n/** Button that scrolls to the next slide; auto-disables at the end. */\nfunction CarouselNext({\n className,\n variant = \"outline\",\n size = \"icon\",\n ...props\n}: React.ComponentProps<typeof Button>) {\n const { orientation, scrollNext, canScrollNext } = useCarousel();\n\n return (\n <Button\n data-slot=\"carousel-next\"\n variant={variant}\n size={size}\n className={cn(\n \"absolute size-9 rounded-8 border-primary-border\",\n orientation === \"horizontal\"\n ? \"top-1/2 -right-13 -translate-y-1/2\"\n : \"-bottom-13 left-1/2 -translate-x-1/2 rotate-90\",\n className,\n )}\n disabled={!canScrollNext}\n onClick={scrollNext}\n {...props}\n >\n <ArrowRight />\n <span className=\"sr-only\">Next slide</span>\n </Button>\n );\n}\n\nexport {\n type CarouselApi,\n Carousel,\n CarouselContent,\n CarouselItem,\n CarouselPrevious,\n CarouselNext,\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/primitives/Carousel/Carousel.tsx"],"sourcesContent":["\"use client\";\n\nimport { Icon } from \"@/primitives/Icon\";\nimport useEmblaCarousel, { type UseEmblaCarouselType } from \"embla-carousel-react\";\nimport { ArrowLeft, ArrowRight } from \"lucide-react\";\nimport * as React from \"react\";\n\nimport { Button } from \"@/primitives/Button\";\nimport { cn } from \"@/utils\";\n\ntype CarouselApi = UseEmblaCarouselType[1];\ntype UseCarouselParameters = Parameters<typeof useEmblaCarousel>;\ntype CarouselOptions = UseCarouselParameters[0];\ntype CarouselPlugin = UseCarouselParameters[1];\n\ntype CarouselProps = {\n /** Embla carousel options (loop, align, dragFree, etc.). */\n opts?: CarouselOptions;\n /** Embla plugins (e.g. Autoplay) to extend the carousel behaviour. */\n plugins?: CarouselPlugin;\n /** Scroll axis of the carousel. */\n orientation?: \"horizontal\" | \"vertical\";\n /** Receives the Embla API instance once initialised, for external control. */\n setApi?: (api: CarouselApi) => void;\n};\n\ntype CarouselContextProps = {\n carouselRef: ReturnType<typeof useEmblaCarousel>[0];\n api: ReturnType<typeof useEmblaCarousel>[1];\n scrollPrev: () => void;\n scrollNext: () => void;\n canScrollPrev: boolean;\n canScrollNext: boolean;\n} & CarouselProps;\n\nconst CarouselContext = React.createContext<CarouselContextProps | null>(null);\n\nfunction useCarousel() {\n const context = React.useContext(CarouselContext);\n\n if (!context) {\n throw new Error(\"useCarousel must be used within a <Carousel />\");\n }\n\n return context;\n}\n\n/** Embla-backed carousel root: provides context and arrow-key navigation for its slides. */\nfunction Carousel({\n orientation = \"horizontal\",\n opts,\n setApi,\n plugins,\n className,\n children,\n ...props\n}: React.ComponentProps<\"div\"> & CarouselProps) {\n const [carouselRef, api] = useEmblaCarousel(\n {\n ...opts,\n axis: orientation === \"horizontal\" ? \"x\" : \"y\",\n },\n plugins,\n );\n const [canScrollPrev, setCanScrollPrev] = React.useState(false);\n const [canScrollNext, setCanScrollNext] = React.useState(false);\n\n const onSelect = React.useCallback((api: CarouselApi) => {\n if (!api) return;\n setCanScrollPrev(api.canScrollPrev());\n setCanScrollNext(api.canScrollNext());\n }, []);\n\n const scrollPrev = React.useCallback(() => {\n api?.scrollPrev();\n }, [api]);\n\n const scrollNext = React.useCallback(() => {\n api?.scrollNext();\n }, [api]);\n\n const handleKeyDown = React.useCallback(\n (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (event.key === \"ArrowLeft\") {\n event.preventDefault();\n scrollPrev();\n } else if (event.key === \"ArrowRight\") {\n event.preventDefault();\n scrollNext();\n }\n },\n [scrollPrev, scrollNext],\n );\n\n React.useEffect(() => {\n if (!api || !setApi) return;\n setApi(api);\n }, [api, setApi]);\n\n React.useEffect(() => {\n if (!api) return;\n onSelect(api);\n api.on(\"reInit\", onSelect);\n api.on(\"select\", onSelect);\n\n return () => {\n api?.off(\"select\", onSelect);\n };\n }, [api, onSelect]);\n\n return (\n <CarouselContext.Provider\n value={{\n carouselRef,\n api: api,\n opts,\n orientation: orientation || (opts?.axis === \"y\" ? \"vertical\" : \"horizontal\"),\n scrollPrev,\n scrollNext,\n canScrollPrev,\n canScrollNext,\n }}\n >\n <div\n onKeyDownCapture={handleKeyDown}\n className={cn(\"relative\", className)}\n role=\"region\"\n aria-roledescription=\"carousel\"\n data-slot=\"carousel\"\n {...props}\n >\n {children}\n </div>\n </CarouselContext.Provider>\n );\n}\n\n/** Scroll viewport that lays out the slides along the carousel's axis. */\nfunction CarouselContent({ className, ...props }: React.ComponentProps<\"div\">) {\n const { carouselRef, orientation } = useCarousel();\n\n return (\n <div ref={carouselRef} className=\"overflow-hidden\" data-slot=\"carousel-content\">\n <div\n className={cn(\"flex\", orientation === \"horizontal\" ? \"-ml-4\" : \"-mt-4 flex-col\", className)}\n {...props}\n />\n </div>\n );\n}\n\n/** A single slide within `CarouselContent`. */\nfunction CarouselItem({ className, ...props }: React.ComponentProps<\"div\">) {\n const { orientation } = useCarousel();\n\n return (\n <div\n role=\"group\"\n aria-roledescription=\"slide\"\n data-slot=\"carousel-item\"\n className={cn(\n \"min-w-0 shrink-0 grow-0 basis-full\",\n orientation === \"horizontal\" ? \"pl-4\" : \"pt-4\",\n className,\n )}\n {...props}\n />\n );\n}\n\n/** Button that scrolls to the previous slide; auto-disables at the start. */\nfunction CarouselPrevious({\n className,\n variant = \"outline\",\n size = \"icon\",\n ...props\n}: React.ComponentProps<typeof Button>) {\n const { orientation, scrollPrev, canScrollPrev } = useCarousel();\n\n return (\n <Button\n data-slot=\"carousel-previous\"\n variant={variant}\n size={size}\n className={cn(\n \"absolute size-9 rounded-8 border-primary-border\",\n orientation === \"horizontal\"\n ? \"top-1/2 -left-13 -translate-y-1/2\"\n : \"-top-13 left-1/2 -translate-x-1/2 rotate-90\",\n className,\n )}\n disabled={!canScrollPrev}\n onClick={scrollPrev}\n {...props}\n >\n <Icon as={ArrowLeft} />\n <span className=\"sr-only\">Previous slide</span>\n </Button>\n );\n}\n\n/** Button that scrolls to the next slide; auto-disables at the end. */\nfunction CarouselNext({\n className,\n variant = \"outline\",\n size = \"icon\",\n ...props\n}: React.ComponentProps<typeof Button>) {\n const { orientation, scrollNext, canScrollNext } = useCarousel();\n\n return (\n <Button\n data-slot=\"carousel-next\"\n variant={variant}\n size={size}\n className={cn(\n \"absolute size-9 rounded-8 border-primary-border\",\n orientation === \"horizontal\"\n ? \"top-1/2 -right-13 -translate-y-1/2\"\n : \"-bottom-13 left-1/2 -translate-x-1/2 rotate-90\",\n className,\n )}\n disabled={!canScrollNext}\n onClick={scrollNext}\n {...props}\n >\n <Icon as={ArrowRight} />\n <span className=\"sr-only\">Next slide</span>\n </Button>\n );\n}\n\nexport {\n type CarouselApi,\n Carousel,\n CarouselContent,\n CarouselItem,\n CarouselPrevious,\n CarouselNext,\n};\n"],"mappings":";;;;;;;;AAmCA,MAAM,kBAAkB,MAAM,cAA2C,IAAI;AAE7E,SAAS,cAAc;CACrB,MAAM,UAAU,MAAM,WAAW,eAAe;CAEhD,IAAI,CAAC,SACH,MAAM,IAAI,MAAM,gDAAgD;CAGlE,OAAO;AACT;;AAGA,SAAS,SAAS,EAChB,cAAc,cACd,MACA,QACA,SACA,WACA,UACA,GAAG,SAC2C;CAC9C,MAAM,CAAC,aAAa,OAAO,iBACzB;EACE,GAAG;EACH,MAAM,gBAAgB,eAAe,MAAM;CAC7C,GACA,OACF;CACA,MAAM,CAAC,eAAe,oBAAoB,MAAM,SAAS,KAAK;CAC9D,MAAM,CAAC,eAAe,oBAAoB,MAAM,SAAS,KAAK;CAE9D,MAAM,WAAW,MAAM,aAAa,QAAqB;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D,oBAAC,OAAD;GACE,WAAW,GAAG,QAAQ,gBAAgB,eAAe,UAAU,kBAAkB,SAAS;GAC1F,GAAI;EACL,CAAA;CACE,CAAA;AAET;;AAGA,SAAS,aAAa,EAAE,WAAW,GAAG,SAAsC;CAC1E,MAAM,EAAE,gBAAgB,YAAY;CAEpC,OACE,oBAAC,OAAD;EACE,MAAK;EACL,wBAAqB;EACrB,aAAU;EACV,WAAW,GACT,sCACA,gBAAgB,eAAe,SAAS,QACxC,SACF;EACA,GAAI;CACL,CAAA;AAEL;;AAGA,SAAS,iBAAiB,EACxB,WACA,UAAU,WACV,OAAO,QACP,GAAG,SACmC;CACtC,MAAM,EAAE,aAAa,YAAY,kBAAkB,YAAY;CAE/D,OACE,qBAAC,QAAD;EACE,aAAU;EACD;EACH;EACN,WAAW,GACT,mDACA,gBAAgB,eACZ,sCACA,+CACJ,SACF;EACA,UAAU,CAAC;EACX,SAAS;EACT,GAAI;YAbN,CAeE,oBAAC,MAAD,EAAM,IAAI,UAAY,CAAA,GACtB,oBAAC,QAAD;GAAM,WAAU;aAAU;EAAoB,CAAA,CACxC;;AAEZ;;AAGA,SAAS,aAAa,EACpB,WACA,UAAU,WACV,OAAO,QACP,GAAG,SACmC;CACtC,MAAM,EAAE,aAAa,YAAY,kBAAkB,YAAY;CAE/D,OACE,qBAAC,QAAD;EACE,aAAU;EACD;EACH;EACN,WAAW,GACT,mDACA,gBAAgB,eACZ,uCACA,kDACJ,SACF;EACA,UAAU,CAAC;EACX,SAAS;EACT,GAAI;YAbN,CAeE,oBAAC,MAAD,EAAM,IAAI,WAAa,CAAA,GACvB,oBAAC,QAAD;GAAM,WAAU;aAAU;EAAgB,CAAA,CACpC;;AAEZ"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_cn = require("../../cn.cjs");
|
|
3
|
+
const require_Icon = require("../../Icon.cjs");
|
|
3
4
|
let react = require("react");
|
|
5
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
4
6
|
let lucide_react = require("lucide-react");
|
|
5
7
|
let radix_ui = require("radix-ui");
|
|
6
|
-
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
8
|
//#region src/primitives/Checkbox/Checkbox.tsx
|
|
8
9
|
/** A square toggle control built on Radix Checkbox, supporting checked, unchecked, indeterminate, error, and disabled states. */
|
|
9
10
|
function Checkbox({ className, ...props }) {
|
|
@@ -14,7 +15,13 @@ function Checkbox({ className, ...props }) {
|
|
|
14
15
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(radix_ui.Checkbox.Indicator, {
|
|
15
16
|
"data-slot": "checkbox-indicator",
|
|
16
17
|
className: "flex items-center justify-center text-current transition-none",
|
|
17
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
18
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Icon.Icon, {
|
|
19
|
+
as: lucide_react.CheckIcon,
|
|
20
|
+
className: "size-3.5 group-data-[state=indeterminate]/checkbox:hidden"
|
|
21
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Icon.Icon, {
|
|
22
|
+
as: lucide_react.MinusIcon,
|
|
23
|
+
className: "hidden size-3.5 group-data-[state=indeterminate]/checkbox:block"
|
|
24
|
+
})]
|
|
18
25
|
})
|
|
19
26
|
});
|
|
20
27
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["CheckboxPrimitive","cn","CheckIcon","MinusIcon"],"sources":["../../../src/primitives/Checkbox/Checkbox.tsx"],"sourcesContent":["import { CheckIcon, MinusIcon } from \"lucide-react\";\nimport { Checkbox as CheckboxPrimitive } from \"radix-ui\";\nimport { useId } from \"react\";\nimport type * as React from \"react\";\n\nimport { cn } from \"@/utils\";\n\n/** A square toggle control built on Radix Checkbox, supporting checked, unchecked, indeterminate, error, and disabled states. */\nfunction Checkbox({ className, ...props }: React.ComponentProps<typeof CheckboxPrimitive.Root>) {\n return (\n <CheckboxPrimitive.Root\n data-slot=\"checkbox\"\n className={cn(\n \"group/checkbox peer bg-input-bg size-4 shrink-0 rounded-4 border border-primary-invert-border transition-shadow outline-none disabled:cursor-not-allowed disabled:opacity-50 disabled:border-secondary-border\",\n // Checked + indeterminate: full-bleed inverted fill, no visible border (Figma).\n \"data-[state=checked]:bg-primary-invert-bg data-[state=checked]:text-primary-invert-txt data-[state=checked]:border-transparent\",\n \"data-[state=indeterminate]:bg-primary-invert-bg data-[state=indeterminate]:text-primary-invert-txt data-[state=indeterminate]:border-transparent\",\n \"focus-visible:ring-focus focus-visible:ring-3\",\n // Error: danger border when unchecked, danger fill when checked. Figma binds\n // the fill to content/status/danger (the 700-level danger color), so the\n // checked error fill is the -txt token used as a background on purpose.\n \"aria-invalid:border-danger-border aria-invalid:ring-focus-error\",\n \"aria-invalid:data-[state=checked]:bg-danger-txt aria-invalid:data-[state=checked]:border-transparent\",\n className,\n )}\n {...props}\n >\n <CheckboxPrimitive.Indicator\n data-slot=\"checkbox-indicator\"\n className=\"flex items-center justify-center text-current transition-none\"\n >\n <CheckIcon
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["CheckboxPrimitive","cn","Icon","CheckIcon","MinusIcon"],"sources":["../../../src/primitives/Checkbox/Checkbox.tsx"],"sourcesContent":["import { Icon } from \"@/primitives/Icon\";\nimport { CheckIcon, MinusIcon } from \"lucide-react\";\nimport { Checkbox as CheckboxPrimitive } from \"radix-ui\";\nimport { useId } from \"react\";\nimport type * as React from \"react\";\n\nimport { cn } from \"@/utils\";\n\n/** A square toggle control built on Radix Checkbox, supporting checked, unchecked, indeterminate, error, and disabled states. */\nfunction Checkbox({ className, ...props }: React.ComponentProps<typeof CheckboxPrimitive.Root>) {\n return (\n <CheckboxPrimitive.Root\n data-slot=\"checkbox\"\n className={cn(\n \"group/checkbox peer bg-input-bg size-4 shrink-0 rounded-4 border border-primary-invert-border transition-shadow outline-none disabled:cursor-not-allowed disabled:opacity-50 disabled:border-secondary-border\",\n // Checked + indeterminate: full-bleed inverted fill, no visible border (Figma).\n \"data-[state=checked]:bg-primary-invert-bg data-[state=checked]:text-primary-invert-txt data-[state=checked]:border-transparent\",\n \"data-[state=indeterminate]:bg-primary-invert-bg data-[state=indeterminate]:text-primary-invert-txt data-[state=indeterminate]:border-transparent\",\n \"focus-visible:ring-focus focus-visible:ring-3\",\n // Error: danger border when unchecked, danger fill when checked. Figma binds\n // the fill to content/status/danger (the 700-level danger color), so the\n // checked error fill is the -txt token used as a background on purpose.\n \"aria-invalid:border-danger-border aria-invalid:ring-focus-error\",\n \"aria-invalid:data-[state=checked]:bg-danger-txt aria-invalid:data-[state=checked]:border-transparent\",\n className,\n )}\n {...props}\n >\n <CheckboxPrimitive.Indicator\n data-slot=\"checkbox-indicator\"\n className=\"flex items-center justify-center text-current transition-none\"\n >\n <Icon\n as={CheckIcon}\n className=\"size-3.5 group-data-[state=indeterminate]/checkbox:hidden\"\n />\n <Icon\n as={MinusIcon}\n className=\"hidden size-3.5 group-data-[state=indeterminate]/checkbox:block\"\n />\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n );\n}\n\n/** A bordered card variant of {@link Checkbox} that pairs the control with a title and optional description. */\nfunction RichCheckbox({\n className,\n title,\n description,\n flipped = false,\n id,\n ...props\n}: Omit<React.ComponentProps<typeof Checkbox>, \"children\"> & {\n /** Primary label rendered next to the checkbox. */\n title?: React.ReactNode;\n /** Secondary helper text rendered beneath the title. */\n description?: React.ReactNode;\n /** When true, places the checkbox on the right (row-reverse) instead of the left. */\n flipped?: boolean;\n}) {\n const generatedId = useId();\n const checkboxId = id ?? generatedId;\n return (\n <label\n data-slot=\"rich-checkbox\"\n htmlFor={checkboxId}\n className={cn(\n \"flex cursor-pointer items-start gap-3 rounded-10 border border-primary-border bg-muted-bg p-3 text-primary-txt transition-colors has-[[data-state=checked]]:border-selected-border has-[:disabled]:cursor-not-allowed has-[:disabled]:opacity-50\",\n flipped ? \"flex-row-reverse\" : \"flex-row\",\n className,\n )}\n >\n <Checkbox data-slot=\"rich-checkbox-control\" id={checkboxId} className=\"mt-0.75\" {...props} />\n <span data-slot=\"rich-checkbox-content\" className=\"flex flex-1 flex-col gap-1.5\">\n {title != null && (\n <span data-slot=\"rich-checkbox-title\" className=\"text-sm leading-5\">\n {title}\n </span>\n )}\n {description != null && (\n <span data-slot=\"rich-checkbox-description\" className=\"text-xs leading-4 text-muted-txt\">\n {description}\n </span>\n )}\n </span>\n </label>\n );\n}\n\nexport { Checkbox, RichCheckbox };\n"],"mappings":";;;;;;;;;AASA,SAAS,SAAS,EAAE,WAAW,GAAG,SAA8D;CAC9F,OACE,iBAAA,GAAA,kBAAA,KAACA,SAAAA,SAAkB,MAAnB;EACE,aAAU;EACV,WAAWC,WAAAA,GACT,iNAEA,kIACA,oJACA,iDAIA,mEACA,wGACA,SACF;EACA,GAAI;YAEJ,iBAAA,GAAA,kBAAA,MAACD,SAAAA,SAAkB,WAAnB;GACE,aAAU;GACV,WAAU;aAFZ,CAIE,iBAAA,GAAA,kBAAA,KAACE,aAAAA,MAAD;IACE,IAAIC,aAAAA;IACJ,WAAU;GACX,CAAA,GACD,iBAAA,GAAA,kBAAA,KAACD,aAAAA,MAAD;IACE,IAAIE,aAAAA;IACJ,WAAU;GACX,CAAA,CAC0B;;CACP,CAAA;AAE5B;;AAGA,SAAS,aAAa,EACpB,WACA,OACA,aACA,UAAU,OACV,IACA,GAAG,SAQF;CACD,MAAM,eAAA,GAAA,MAAA,OAAoB;CAC1B,MAAM,aAAa,MAAM;CACzB,OACE,iBAAA,GAAA,kBAAA,MAAC,SAAD;EACE,aAAU;EACV,SAAS;EACT,WAAWH,WAAAA,GACT,oPACA,UAAU,qBAAqB,YAC/B,SACF;YAPF,CASE,iBAAA,GAAA,kBAAA,KAAC,UAAD;GAAU,aAAU;GAAwB,IAAI;GAAY,WAAU;GAAU,GAAI;EAAQ,CAAA,GAC5F,iBAAA,GAAA,kBAAA,MAAC,QAAD;GAAM,aAAU;GAAwB,WAAU;aAAlD,CACG,SAAS,QACR,iBAAA,GAAA,kBAAA,KAAC,QAAD;IAAM,aAAU;IAAsB,WAAU;cAC7C;GACG,CAAA,GAEP,eAAe,QACd,iBAAA,GAAA,kBAAA,KAAC,QAAD;IAAM,aAAU;IAA4B,WAAU;cACnD;GACG,CAAA,CAEJ;IACD;;AAEX"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { t as cn } from "../../cn.js";
|
|
2
|
+
import { t as Icon } from "../../Icon.js";
|
|
2
3
|
import { useId } from "react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
5
|
import { CheckIcon, MinusIcon } from "lucide-react";
|
|
4
6
|
import { Checkbox as Checkbox$1 } from "radix-ui";
|
|
5
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
7
|
//#region src/primitives/Checkbox/Checkbox.tsx
|
|
7
8
|
/** A square toggle control built on Radix Checkbox, supporting checked, unchecked, indeterminate, error, and disabled states. */
|
|
8
9
|
function Checkbox({ className, ...props }) {
|
|
@@ -13,7 +14,13 @@ function Checkbox({ className, ...props }) {
|
|
|
13
14
|
children: /* @__PURE__ */ jsxs(Checkbox$1.Indicator, {
|
|
14
15
|
"data-slot": "checkbox-indicator",
|
|
15
16
|
className: "flex items-center justify-center text-current transition-none",
|
|
16
|
-
children: [/* @__PURE__ */ jsx(
|
|
17
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
18
|
+
as: CheckIcon,
|
|
19
|
+
className: "size-3.5 group-data-[state=indeterminate]/checkbox:hidden"
|
|
20
|
+
}), /* @__PURE__ */ jsx(Icon, {
|
|
21
|
+
as: MinusIcon,
|
|
22
|
+
className: "hidden size-3.5 group-data-[state=indeterminate]/checkbox:block"
|
|
23
|
+
})]
|
|
17
24
|
})
|
|
18
25
|
});
|
|
19
26
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["CheckboxPrimitive"],"sources":["../../../src/primitives/Checkbox/Checkbox.tsx"],"sourcesContent":["import { CheckIcon, MinusIcon } from \"lucide-react\";\nimport { Checkbox as CheckboxPrimitive } from \"radix-ui\";\nimport { useId } from \"react\";\nimport type * as React from \"react\";\n\nimport { cn } from \"@/utils\";\n\n/** A square toggle control built on Radix Checkbox, supporting checked, unchecked, indeterminate, error, and disabled states. */\nfunction Checkbox({ className, ...props }: React.ComponentProps<typeof CheckboxPrimitive.Root>) {\n return (\n <CheckboxPrimitive.Root\n data-slot=\"checkbox\"\n className={cn(\n \"group/checkbox peer bg-input-bg size-4 shrink-0 rounded-4 border border-primary-invert-border transition-shadow outline-none disabled:cursor-not-allowed disabled:opacity-50 disabled:border-secondary-border\",\n // Checked + indeterminate: full-bleed inverted fill, no visible border (Figma).\n \"data-[state=checked]:bg-primary-invert-bg data-[state=checked]:text-primary-invert-txt data-[state=checked]:border-transparent\",\n \"data-[state=indeterminate]:bg-primary-invert-bg data-[state=indeterminate]:text-primary-invert-txt data-[state=indeterminate]:border-transparent\",\n \"focus-visible:ring-focus focus-visible:ring-3\",\n // Error: danger border when unchecked, danger fill when checked. Figma binds\n // the fill to content/status/danger (the 700-level danger color), so the\n // checked error fill is the -txt token used as a background on purpose.\n \"aria-invalid:border-danger-border aria-invalid:ring-focus-error\",\n \"aria-invalid:data-[state=checked]:bg-danger-txt aria-invalid:data-[state=checked]:border-transparent\",\n className,\n )}\n {...props}\n >\n <CheckboxPrimitive.Indicator\n data-slot=\"checkbox-indicator\"\n className=\"flex items-center justify-center text-current transition-none\"\n >\n <CheckIcon
|
|
1
|
+
{"version":3,"file":"index.js","names":["CheckboxPrimitive"],"sources":["../../../src/primitives/Checkbox/Checkbox.tsx"],"sourcesContent":["import { Icon } from \"@/primitives/Icon\";\nimport { CheckIcon, MinusIcon } from \"lucide-react\";\nimport { Checkbox as CheckboxPrimitive } from \"radix-ui\";\nimport { useId } from \"react\";\nimport type * as React from \"react\";\n\nimport { cn } from \"@/utils\";\n\n/** A square toggle control built on Radix Checkbox, supporting checked, unchecked, indeterminate, error, and disabled states. */\nfunction Checkbox({ className, ...props }: React.ComponentProps<typeof CheckboxPrimitive.Root>) {\n return (\n <CheckboxPrimitive.Root\n data-slot=\"checkbox\"\n className={cn(\n \"group/checkbox peer bg-input-bg size-4 shrink-0 rounded-4 border border-primary-invert-border transition-shadow outline-none disabled:cursor-not-allowed disabled:opacity-50 disabled:border-secondary-border\",\n // Checked + indeterminate: full-bleed inverted fill, no visible border (Figma).\n \"data-[state=checked]:bg-primary-invert-bg data-[state=checked]:text-primary-invert-txt data-[state=checked]:border-transparent\",\n \"data-[state=indeterminate]:bg-primary-invert-bg data-[state=indeterminate]:text-primary-invert-txt data-[state=indeterminate]:border-transparent\",\n \"focus-visible:ring-focus focus-visible:ring-3\",\n // Error: danger border when unchecked, danger fill when checked. Figma binds\n // the fill to content/status/danger (the 700-level danger color), so the\n // checked error fill is the -txt token used as a background on purpose.\n \"aria-invalid:border-danger-border aria-invalid:ring-focus-error\",\n \"aria-invalid:data-[state=checked]:bg-danger-txt aria-invalid:data-[state=checked]:border-transparent\",\n className,\n )}\n {...props}\n >\n <CheckboxPrimitive.Indicator\n data-slot=\"checkbox-indicator\"\n className=\"flex items-center justify-center text-current transition-none\"\n >\n <Icon\n as={CheckIcon}\n className=\"size-3.5 group-data-[state=indeterminate]/checkbox:hidden\"\n />\n <Icon\n as={MinusIcon}\n className=\"hidden size-3.5 group-data-[state=indeterminate]/checkbox:block\"\n />\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n );\n}\n\n/** A bordered card variant of {@link Checkbox} that pairs the control with a title and optional description. */\nfunction RichCheckbox({\n className,\n title,\n description,\n flipped = false,\n id,\n ...props\n}: Omit<React.ComponentProps<typeof Checkbox>, \"children\"> & {\n /** Primary label rendered next to the checkbox. */\n title?: React.ReactNode;\n /** Secondary helper text rendered beneath the title. */\n description?: React.ReactNode;\n /** When true, places the checkbox on the right (row-reverse) instead of the left. */\n flipped?: boolean;\n}) {\n const generatedId = useId();\n const checkboxId = id ?? generatedId;\n return (\n <label\n data-slot=\"rich-checkbox\"\n htmlFor={checkboxId}\n className={cn(\n \"flex cursor-pointer items-start gap-3 rounded-10 border border-primary-border bg-muted-bg p-3 text-primary-txt transition-colors has-[[data-state=checked]]:border-selected-border has-[:disabled]:cursor-not-allowed has-[:disabled]:opacity-50\",\n flipped ? \"flex-row-reverse\" : \"flex-row\",\n className,\n )}\n >\n <Checkbox data-slot=\"rich-checkbox-control\" id={checkboxId} className=\"mt-0.75\" {...props} />\n <span data-slot=\"rich-checkbox-content\" className=\"flex flex-1 flex-col gap-1.5\">\n {title != null && (\n <span data-slot=\"rich-checkbox-title\" className=\"text-sm leading-5\">\n {title}\n </span>\n )}\n {description != null && (\n <span data-slot=\"rich-checkbox-description\" className=\"text-xs leading-4 text-muted-txt\">\n {description}\n </span>\n )}\n </span>\n </label>\n );\n}\n\nexport { Checkbox, RichCheckbox };\n"],"mappings":";;;;;;;;AASA,SAAS,SAAS,EAAE,WAAW,GAAG,SAA8D;CAC9F,OACE,oBAACA,WAAkB,MAAnB;EACE,aAAU;EACV,WAAW,GACT,iNAEA,kIACA,oJACA,iDAIA,mEACA,wGACA,SACF;EACA,GAAI;YAEJ,qBAACA,WAAkB,WAAnB;GACE,aAAU;GACV,WAAU;aAFZ,CAIE,oBAAC,MAAD;IACE,IAAI;IACJ,WAAU;GACX,CAAA,GACD,oBAAC,MAAD;IACE,IAAI;IACJ,WAAU;GACX,CAAA,CAC0B;;CACP,CAAA;AAE5B;;AAGA,SAAS,aAAa,EACpB,WACA,OACA,aACA,UAAU,OACV,IACA,GAAG,SAQF;CACD,MAAM,cAAc,MAAM;CAC1B,MAAM,aAAa,MAAM;CACzB,OACE,qBAAC,SAAD;EACE,aAAU;EACV,SAAS;EACT,WAAW,GACT,oPACA,UAAU,qBAAqB,YAC/B,SACF;YAPF,CASE,oBAAC,UAAD;GAAU,aAAU;GAAwB,IAAI;GAAY,WAAU;GAAU,GAAI;EAAQ,CAAA,GAC5F,qBAAC,QAAD;GAAM,aAAU;GAAwB,WAAU;aAAlD,CACG,SAAS,QACR,oBAAC,QAAD;IAAM,aAAU;IAAsB,WAAU;cAC7C;GACG,CAAA,GAEP,eAAe,QACd,oBAAC,QAAD;IAAM,aAAU;IAA4B,WAAU;cACnD;GACG,CAAA,CAEJ;IACD;;AAEX"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_chunk = require("../../chunk.cjs");
|
|
3
3
|
const require_cn = require("../../cn.cjs");
|
|
4
|
+
const require_Icon = require("../../Icon.cjs");
|
|
4
5
|
const require_primitives_Checkbox_index = require("../Checkbox/index.cjs");
|
|
5
6
|
let react = require("react");
|
|
6
7
|
react = require_chunk.__toESM(react);
|
|
7
|
-
let lucide_react = require("lucide-react");
|
|
8
8
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
|
+
let lucide_react = require("lucide-react");
|
|
9
10
|
//#region src/primitives/CheckboxTree/CheckboxTree.tsx
|
|
10
11
|
/** All ids in a node's subtree (the node itself + every descendant). */
|
|
11
12
|
function collectIds(node) {
|
|
@@ -74,7 +75,10 @@ function TreeNode({ node, depth, selected, expanded, onToggleSelect, onToggleExp
|
|
|
74
75
|
onClick: () => onToggleExpand(node.id),
|
|
75
76
|
"aria-label": isExpanded ? "Collapse" : "Expand",
|
|
76
77
|
className: "flex size-5 shrink-0 items-center justify-center text-muted-txt hover:text-primary-txt",
|
|
77
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
78
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Icon.Icon, {
|
|
79
|
+
as: lucide_react.ChevronRight,
|
|
80
|
+
className: require_cn.cn("size-4 transition-transform", isExpanded && "rotate-90")
|
|
81
|
+
})
|
|
78
82
|
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "w-5 shrink-0" }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
79
83
|
htmlFor: checkboxId,
|
|
80
84
|
className: "flex flex-1 cursor-pointer items-center gap-2 rounded-6 px-2 py-1.5 transition-colors hover:bg-muted-bg/40",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["React","cn","ChevronRight","Checkbox"],"sources":["../../../src/primitives/CheckboxTree/CheckboxTree.tsx"],"sourcesContent":["\"use client\";\n\nimport { ChevronRight } from \"lucide-react\";\nimport * as React from \"react\";\n\nimport { Checkbox } from \"@/primitives/Checkbox\";\nimport { cn } from \"@/utils\";\n\n// CheckboxTree — a hierarchical checkbox list with expand/collapse and\n// tri-state (checked / unchecked / indeterminate) propagation: toggling a branch\n// toggles all its descendants, and a branch reflects its children\n// (checked when all are, indeterminate when some are). Controlled via `value`\n// (the set of selected node ids, branches included when fully selected).\n\n/** A single node in the tree: a stable id, a label, and optional children. */\nexport interface CheckboxTreeNode {\n /** Stable unique identifier used for selection and expansion tracking. */\n id: string;\n /** Content rendered next to the checkbox. */\n label: React.ReactNode;\n /** Nested child nodes; presence makes this node a collapsible branch. */\n children?: CheckboxTreeNode[];\n}\n\ntype NodeState = \"checked\" | \"unchecked\" | \"indeterminate\";\n\n/** All ids in a node's subtree (the node itself + every descendant). */\nfunction collectIds(node: CheckboxTreeNode): string[] {\n if (!node.children?.length) return [node.id];\n return [node.id, ...node.children.flatMap(collectIds)];\n}\n\n/** A leaf is checked iff selected; a branch derives its state from its children. */\nfunction getNodeState(node: CheckboxTreeNode, selected: Set<string>): NodeState {\n if (!node.children?.length) return selected.has(node.id) ? \"checked\" : \"unchecked\";\n const states = node.children.map((child) => getNodeState(child, selected));\n if (states.every((s) => s === \"checked\")) return \"checked\";\n if (states.every((s) => s === \"unchecked\")) return \"unchecked\";\n return \"indeterminate\";\n}\n\ninterface CheckboxTreeProps extends Omit<React.ComponentProps<\"div\">, \"onChange\"> {\n /** The hierarchical node data to render. */\n nodes: CheckboxTreeNode[];\n /** Selected node ids (controlled). Includes branch ids when fully selected. */\n value: string[];\n /** Called with the next selected ids whenever a node (and its subtree) is toggled. */\n onValueChange?: (value: string[]) => void;\n /** Node ids expanded on first render. */\n defaultExpandedIds?: string[];\n}\n\n/**\n * A hierarchical checkbox list with expand/collapse and tri-state\n * (checked / unchecked / indeterminate) propagation across each subtree.\n */\nfunction CheckboxTree({\n nodes,\n value,\n onValueChange,\n defaultExpandedIds,\n className,\n ...props\n}: CheckboxTreeProps) {\n const [expanded, setExpanded] = React.useState<Set<string>>(\n () => new Set(defaultExpandedIds ?? []),\n );\n const selected = React.useMemo(() => new Set(value), [value]);\n\n const toggleExpand = (id: string) =>\n setExpanded((prev) => {\n const next = new Set(prev);\n if (next.has(id)) next.delete(id);\n else next.add(id);\n return next;\n });\n\n const toggleSelect = (node: CheckboxTreeNode) => {\n const ids = collectIds(node);\n const allSelected = ids.every((id) => selected.has(id));\n const next = new Set(selected);\n for (const id of ids) {\n if (allSelected) next.delete(id);\n else next.add(id);\n }\n onValueChange?.([...next]);\n };\n\n return (\n <div\n role=\"tree\"\n data-slot=\"checkbox-tree\"\n className={cn(\"flex flex-col gap-1\", className)}\n {...props}\n >\n {nodes.map((node) => (\n <TreeNode\n key={node.id}\n node={node}\n depth={0}\n selected={selected}\n expanded={expanded}\n onToggleSelect={toggleSelect}\n onToggleExpand={toggleExpand}\n />\n ))}\n </div>\n );\n}\n\ninterface TreeNodeProps {\n /** The node rendered by this row. */\n node: CheckboxTreeNode;\n /** Nesting depth, used for indentation and heading emphasis. */\n depth: number;\n /** Set of currently selected node ids. */\n selected: Set<string>;\n /** Set of currently expanded node ids. */\n expanded: Set<string>;\n /** Toggles selection of the node and its subtree. */\n onToggleSelect: (node: CheckboxTreeNode) => void;\n /** Toggles the expanded/collapsed state of a branch. */\n onToggleExpand: (id: string) => void;\n}\n\n/** Renders a single tree row plus, when expanded, its child rows recursively. */\nfunction TreeNode({\n node,\n depth,\n selected,\n expanded,\n onToggleSelect,\n onToggleExpand,\n}: TreeNodeProps) {\n const hasChildren = !!node.children?.length;\n const isExpanded = expanded.has(node.id);\n const state = getNodeState(node, selected);\n const checkboxId = React.useId();\n\n return (\n <div\n role=\"treeitem\"\n aria-expanded={hasChildren ? isExpanded : undefined}\n aria-checked={state === \"indeterminate\" ? \"mixed\" : state === \"checked\"}\n >\n <div className=\"flex items-center gap-1\" style={{ paddingLeft: `${depth * 1.5}rem` }}>\n {hasChildren ? (\n <button\n type=\"button\"\n onClick={() => onToggleExpand(node.id)}\n aria-label={isExpanded ? \"Collapse\" : \"Expand\"}\n className=\"flex size-5 shrink-0 items-center justify-center text-muted-txt hover:text-primary-txt\"\n >\n <ChevronRight\n className={cn(\"size-4 transition-transform\", isExpanded && \"rotate-90\")}\n />\n </button>\n ) : (\n <span className=\"w-5 shrink-0\" />\n )}\n <label\n htmlFor={checkboxId}\n className=\"flex flex-1 cursor-pointer items-center gap-2 rounded-6 px-2 py-1.5 transition-colors hover:bg-muted-bg/40\"\n >\n <Checkbox\n id={checkboxId}\n checked={state === \"indeterminate\" ? \"indeterminate\" : state === \"checked\"}\n onCheckedChange={() => onToggleSelect(node)}\n />\n <span className={cn(\"text-sm\", depth === 0 && \"font-medium\")}>{node.label}</span>\n </label>\n </div>\n {hasChildren && isExpanded && (\n <div role=\"group\">\n {node.children?.map((child) => (\n <TreeNode\n key={child.id}\n node={child}\n depth={depth + 1}\n selected={selected}\n expanded={expanded}\n onToggleSelect={onToggleSelect}\n onToggleExpand={onToggleExpand}\n />\n ))}\n </div>\n )}\n </div>\n );\n}\n\nexport { CheckboxTree };\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["React","cn","Icon","ChevronRight","Checkbox"],"sources":["../../../src/primitives/CheckboxTree/CheckboxTree.tsx"],"sourcesContent":["\"use client\";\n\nimport { Icon } from \"@/primitives/Icon\";\nimport { ChevronRight } from \"lucide-react\";\nimport * as React from \"react\";\n\nimport { Checkbox } from \"@/primitives/Checkbox\";\nimport { cn } from \"@/utils\";\n\n// CheckboxTree — a hierarchical checkbox list with expand/collapse and\n// tri-state (checked / unchecked / indeterminate) propagation: toggling a branch\n// toggles all its descendants, and a branch reflects its children\n// (checked when all are, indeterminate when some are). Controlled via `value`\n// (the set of selected node ids, branches included when fully selected).\n\n/** A single node in the tree: a stable id, a label, and optional children. */\nexport interface CheckboxTreeNode {\n /** Stable unique identifier used for selection and expansion tracking. */\n id: string;\n /** Content rendered next to the checkbox. */\n label: React.ReactNode;\n /** Nested child nodes; presence makes this node a collapsible branch. */\n children?: CheckboxTreeNode[];\n}\n\ntype NodeState = \"checked\" | \"unchecked\" | \"indeterminate\";\n\n/** All ids in a node's subtree (the node itself + every descendant). */\nfunction collectIds(node: CheckboxTreeNode): string[] {\n if (!node.children?.length) return [node.id];\n return [node.id, ...node.children.flatMap(collectIds)];\n}\n\n/** A leaf is checked iff selected; a branch derives its state from its children. */\nfunction getNodeState(node: CheckboxTreeNode, selected: Set<string>): NodeState {\n if (!node.children?.length) return selected.has(node.id) ? \"checked\" : \"unchecked\";\n const states = node.children.map((child) => getNodeState(child, selected));\n if (states.every((s) => s === \"checked\")) return \"checked\";\n if (states.every((s) => s === \"unchecked\")) return \"unchecked\";\n return \"indeterminate\";\n}\n\ninterface CheckboxTreeProps extends Omit<React.ComponentProps<\"div\">, \"onChange\"> {\n /** The hierarchical node data to render. */\n nodes: CheckboxTreeNode[];\n /** Selected node ids (controlled). Includes branch ids when fully selected. */\n value: string[];\n /** Called with the next selected ids whenever a node (and its subtree) is toggled. */\n onValueChange?: (value: string[]) => void;\n /** Node ids expanded on first render. */\n defaultExpandedIds?: string[];\n}\n\n/**\n * A hierarchical checkbox list with expand/collapse and tri-state\n * (checked / unchecked / indeterminate) propagation across each subtree.\n */\nfunction CheckboxTree({\n nodes,\n value,\n onValueChange,\n defaultExpandedIds,\n className,\n ...props\n}: CheckboxTreeProps) {\n const [expanded, setExpanded] = React.useState<Set<string>>(\n () => new Set(defaultExpandedIds ?? []),\n );\n const selected = React.useMemo(() => new Set(value), [value]);\n\n const toggleExpand = (id: string) =>\n setExpanded((prev) => {\n const next = new Set(prev);\n if (next.has(id)) next.delete(id);\n else next.add(id);\n return next;\n });\n\n const toggleSelect = (node: CheckboxTreeNode) => {\n const ids = collectIds(node);\n const allSelected = ids.every((id) => selected.has(id));\n const next = new Set(selected);\n for (const id of ids) {\n if (allSelected) next.delete(id);\n else next.add(id);\n }\n onValueChange?.([...next]);\n };\n\n return (\n <div\n role=\"tree\"\n data-slot=\"checkbox-tree\"\n className={cn(\"flex flex-col gap-1\", className)}\n {...props}\n >\n {nodes.map((node) => (\n <TreeNode\n key={node.id}\n node={node}\n depth={0}\n selected={selected}\n expanded={expanded}\n onToggleSelect={toggleSelect}\n onToggleExpand={toggleExpand}\n />\n ))}\n </div>\n );\n}\n\ninterface TreeNodeProps {\n /** The node rendered by this row. */\n node: CheckboxTreeNode;\n /** Nesting depth, used for indentation and heading emphasis. */\n depth: number;\n /** Set of currently selected node ids. */\n selected: Set<string>;\n /** Set of currently expanded node ids. */\n expanded: Set<string>;\n /** Toggles selection of the node and its subtree. */\n onToggleSelect: (node: CheckboxTreeNode) => void;\n /** Toggles the expanded/collapsed state of a branch. */\n onToggleExpand: (id: string) => void;\n}\n\n/** Renders a single tree row plus, when expanded, its child rows recursively. */\nfunction TreeNode({\n node,\n depth,\n selected,\n expanded,\n onToggleSelect,\n onToggleExpand,\n}: TreeNodeProps) {\n const hasChildren = !!node.children?.length;\n const isExpanded = expanded.has(node.id);\n const state = getNodeState(node, selected);\n const checkboxId = React.useId();\n\n return (\n <div\n role=\"treeitem\"\n aria-expanded={hasChildren ? isExpanded : undefined}\n aria-checked={state === \"indeterminate\" ? \"mixed\" : state === \"checked\"}\n >\n <div className=\"flex items-center gap-1\" style={{ paddingLeft: `${depth * 1.5}rem` }}>\n {hasChildren ? (\n <button\n type=\"button\"\n onClick={() => onToggleExpand(node.id)}\n aria-label={isExpanded ? \"Collapse\" : \"Expand\"}\n className=\"flex size-5 shrink-0 items-center justify-center text-muted-txt hover:text-primary-txt\"\n >\n <Icon\n as={ChevronRight}\n className={cn(\"size-4 transition-transform\", isExpanded && \"rotate-90\")}\n />\n </button>\n ) : (\n <span className=\"w-5 shrink-0\" />\n )}\n <label\n htmlFor={checkboxId}\n className=\"flex flex-1 cursor-pointer items-center gap-2 rounded-6 px-2 py-1.5 transition-colors hover:bg-muted-bg/40\"\n >\n <Checkbox\n id={checkboxId}\n checked={state === \"indeterminate\" ? \"indeterminate\" : state === \"checked\"}\n onCheckedChange={() => onToggleSelect(node)}\n />\n <span className={cn(\"text-sm\", depth === 0 && \"font-medium\")}>{node.label}</span>\n </label>\n </div>\n {hasChildren && isExpanded && (\n <div role=\"group\">\n {node.children?.map((child) => (\n <TreeNode\n key={child.id}\n node={child}\n depth={depth + 1}\n selected={selected}\n expanded={expanded}\n onToggleSelect={onToggleSelect}\n onToggleExpand={onToggleExpand}\n />\n ))}\n </div>\n )}\n </div>\n );\n}\n\nexport { CheckboxTree };\n"],"mappings":";;;;;;;;;;;AA4BA,SAAS,WAAW,MAAkC;CACpD,IAAI,CAAC,KAAK,UAAU,QAAQ,OAAO,CAAC,KAAK,EAAE;CAC3C,OAAO,CAAC,KAAK,IAAI,GAAG,KAAK,SAAS,QAAQ,UAAU,CAAC;AACvD;;AAGA,SAAS,aAAa,MAAwB,UAAkC;CAC9E,IAAI,CAAC,KAAK,UAAU,QAAQ,OAAO,SAAS,IAAI,KAAK,EAAE,IAAI,YAAY;CACvE,MAAM,SAAS,KAAK,SAAS,KAAK,UAAU,aAAa,OAAO,QAAQ,CAAC;CACzE,IAAI,OAAO,OAAO,MAAM,MAAM,SAAS,GAAG,OAAO;CACjD,IAAI,OAAO,OAAO,MAAM,MAAM,WAAW,GAAG,OAAO;CACnD,OAAO;AACT;;;;;AAiBA,SAAS,aAAa,EACpB,OACA,OACA,eACA,oBACA,WACA,GAAG,SACiB;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U;YAHhE,CAKE,iBAAA,GAAA,kBAAA,MAAC,OAAD;GAAK,WAAU;GAA0B,OAAO,EAAE,aAAa,GAAG,QAAQ,IAAI,KAAK;aAAnF,CACG,cACC,iBAAA,GAAA,kBAAA,KAAC,UAAD;IACE,MAAK;IACL,eAAe,eAAe,KAAK,EAAE;IACrC,cAAY,aAAa,aAAa;IACtC,WAAU;cAEV,iBAAA,GAAA,kBAAA,KAACE,aAAAA,MAAD;KACE,IAAIC,aAAAA;KACJ,WAAWF,WAAAA,GAAG,+BAA+B,cAAc,WAAW;IACvE,CAAA;GACK,CAAA,IAER,iBAAA,GAAA,kBAAA,KAAC,QAAD,EAAM,WAAU,eAAgB,CAAA,GAElC,iBAAA,GAAA,kBAAA,MAAC,SAAD;IACE,SAAS;IACT,WAAU;cAFZ,CAIE,iBAAA,GAAA,kBAAA,KAACG,kCAAAA,UAAD;KACE,IAAI;KACJ,SAAS,UAAU,kBAAkB,kBAAkB,UAAU;KACjE,uBAAuB,eAAe,IAAI;IAC3C,CAAA,GACD,iBAAA,GAAA,kBAAA,KAAC,QAAD;KAAM,WAAWH,WAAAA,GAAG,WAAW,UAAU,KAAK,aAAa;eAAI,KAAK;IAAY,CAAA,CAC3E;KACJ;MACJ,eAAe,cACd,iBAAA,GAAA,kBAAA,KAAC,OAAD;GAAK,MAAK;aACP,KAAK,UAAU,KAAK,UACnB,iBAAA,GAAA,kBAAA,KAAC,UAAD;IAEE,MAAM;IACN,OAAO,QAAQ;IACL;IACA;IACM;IACA;GACjB,GAPM,MAAM,EAOZ,CACF;EACE,CAAA,CAEJ;;AAET"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { t as cn } from "../../cn.js";
|
|
2
|
+
import { t as Icon } from "../../Icon.js";
|
|
2
3
|
import { Checkbox } from "../Checkbox/index.js";
|
|
3
4
|
import * as React from "react";
|
|
4
|
-
import { ChevronRight } from "lucide-react";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { ChevronRight } from "lucide-react";
|
|
6
7
|
//#region src/primitives/CheckboxTree/CheckboxTree.tsx
|
|
7
8
|
/** All ids in a node's subtree (the node itself + every descendant). */
|
|
8
9
|
function collectIds(node) {
|
|
@@ -71,7 +72,10 @@ function TreeNode({ node, depth, selected, expanded, onToggleSelect, onToggleExp
|
|
|
71
72
|
onClick: () => onToggleExpand(node.id),
|
|
72
73
|
"aria-label": isExpanded ? "Collapse" : "Expand",
|
|
73
74
|
className: "flex size-5 shrink-0 items-center justify-center text-muted-txt hover:text-primary-txt",
|
|
74
|
-
children: /* @__PURE__ */ jsx(
|
|
75
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
76
|
+
as: ChevronRight,
|
|
77
|
+
className: cn("size-4 transition-transform", isExpanded && "rotate-90")
|
|
78
|
+
})
|
|
75
79
|
}) : /* @__PURE__ */ jsx("span", { className: "w-5 shrink-0" }), /* @__PURE__ */ jsxs("label", {
|
|
76
80
|
htmlFor: checkboxId,
|
|
77
81
|
className: "flex flex-1 cursor-pointer items-center gap-2 rounded-6 px-2 py-1.5 transition-colors hover:bg-muted-bg/40",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/primitives/CheckboxTree/CheckboxTree.tsx"],"sourcesContent":["\"use client\";\n\nimport { ChevronRight } from \"lucide-react\";\nimport * as React from \"react\";\n\nimport { Checkbox } from \"@/primitives/Checkbox\";\nimport { cn } from \"@/utils\";\n\n// CheckboxTree — a hierarchical checkbox list with expand/collapse and\n// tri-state (checked / unchecked / indeterminate) propagation: toggling a branch\n// toggles all its descendants, and a branch reflects its children\n// (checked when all are, indeterminate when some are). Controlled via `value`\n// (the set of selected node ids, branches included when fully selected).\n\n/** A single node in the tree: a stable id, a label, and optional children. */\nexport interface CheckboxTreeNode {\n /** Stable unique identifier used for selection and expansion tracking. */\n id: string;\n /** Content rendered next to the checkbox. */\n label: React.ReactNode;\n /** Nested child nodes; presence makes this node a collapsible branch. */\n children?: CheckboxTreeNode[];\n}\n\ntype NodeState = \"checked\" | \"unchecked\" | \"indeterminate\";\n\n/** All ids in a node's subtree (the node itself + every descendant). */\nfunction collectIds(node: CheckboxTreeNode): string[] {\n if (!node.children?.length) return [node.id];\n return [node.id, ...node.children.flatMap(collectIds)];\n}\n\n/** A leaf is checked iff selected; a branch derives its state from its children. */\nfunction getNodeState(node: CheckboxTreeNode, selected: Set<string>): NodeState {\n if (!node.children?.length) return selected.has(node.id) ? \"checked\" : \"unchecked\";\n const states = node.children.map((child) => getNodeState(child, selected));\n if (states.every((s) => s === \"checked\")) return \"checked\";\n if (states.every((s) => s === \"unchecked\")) return \"unchecked\";\n return \"indeterminate\";\n}\n\ninterface CheckboxTreeProps extends Omit<React.ComponentProps<\"div\">, \"onChange\"> {\n /** The hierarchical node data to render. */\n nodes: CheckboxTreeNode[];\n /** Selected node ids (controlled). Includes branch ids when fully selected. */\n value: string[];\n /** Called with the next selected ids whenever a node (and its subtree) is toggled. */\n onValueChange?: (value: string[]) => void;\n /** Node ids expanded on first render. */\n defaultExpandedIds?: string[];\n}\n\n/**\n * A hierarchical checkbox list with expand/collapse and tri-state\n * (checked / unchecked / indeterminate) propagation across each subtree.\n */\nfunction CheckboxTree({\n nodes,\n value,\n onValueChange,\n defaultExpandedIds,\n className,\n ...props\n}: CheckboxTreeProps) {\n const [expanded, setExpanded] = React.useState<Set<string>>(\n () => new Set(defaultExpandedIds ?? []),\n );\n const selected = React.useMemo(() => new Set(value), [value]);\n\n const toggleExpand = (id: string) =>\n setExpanded((prev) => {\n const next = new Set(prev);\n if (next.has(id)) next.delete(id);\n else next.add(id);\n return next;\n });\n\n const toggleSelect = (node: CheckboxTreeNode) => {\n const ids = collectIds(node);\n const allSelected = ids.every((id) => selected.has(id));\n const next = new Set(selected);\n for (const id of ids) {\n if (allSelected) next.delete(id);\n else next.add(id);\n }\n onValueChange?.([...next]);\n };\n\n return (\n <div\n role=\"tree\"\n data-slot=\"checkbox-tree\"\n className={cn(\"flex flex-col gap-1\", className)}\n {...props}\n >\n {nodes.map((node) => (\n <TreeNode\n key={node.id}\n node={node}\n depth={0}\n selected={selected}\n expanded={expanded}\n onToggleSelect={toggleSelect}\n onToggleExpand={toggleExpand}\n />\n ))}\n </div>\n );\n}\n\ninterface TreeNodeProps {\n /** The node rendered by this row. */\n node: CheckboxTreeNode;\n /** Nesting depth, used for indentation and heading emphasis. */\n depth: number;\n /** Set of currently selected node ids. */\n selected: Set<string>;\n /** Set of currently expanded node ids. */\n expanded: Set<string>;\n /** Toggles selection of the node and its subtree. */\n onToggleSelect: (node: CheckboxTreeNode) => void;\n /** Toggles the expanded/collapsed state of a branch. */\n onToggleExpand: (id: string) => void;\n}\n\n/** Renders a single tree row plus, when expanded, its child rows recursively. */\nfunction TreeNode({\n node,\n depth,\n selected,\n expanded,\n onToggleSelect,\n onToggleExpand,\n}: TreeNodeProps) {\n const hasChildren = !!node.children?.length;\n const isExpanded = expanded.has(node.id);\n const state = getNodeState(node, selected);\n const checkboxId = React.useId();\n\n return (\n <div\n role=\"treeitem\"\n aria-expanded={hasChildren ? isExpanded : undefined}\n aria-checked={state === \"indeterminate\" ? \"mixed\" : state === \"checked\"}\n >\n <div className=\"flex items-center gap-1\" style={{ paddingLeft: `${depth * 1.5}rem` }}>\n {hasChildren ? (\n <button\n type=\"button\"\n onClick={() => onToggleExpand(node.id)}\n aria-label={isExpanded ? \"Collapse\" : \"Expand\"}\n className=\"flex size-5 shrink-0 items-center justify-center text-muted-txt hover:text-primary-txt\"\n >\n <ChevronRight\n className={cn(\"size-4 transition-transform\", isExpanded && \"rotate-90\")}\n />\n </button>\n ) : (\n <span className=\"w-5 shrink-0\" />\n )}\n <label\n htmlFor={checkboxId}\n className=\"flex flex-1 cursor-pointer items-center gap-2 rounded-6 px-2 py-1.5 transition-colors hover:bg-muted-bg/40\"\n >\n <Checkbox\n id={checkboxId}\n checked={state === \"indeterminate\" ? \"indeterminate\" : state === \"checked\"}\n onCheckedChange={() => onToggleSelect(node)}\n />\n <span className={cn(\"text-sm\", depth === 0 && \"font-medium\")}>{node.label}</span>\n </label>\n </div>\n {hasChildren && isExpanded && (\n <div role=\"group\">\n {node.children?.map((child) => (\n <TreeNode\n key={child.id}\n node={child}\n depth={depth + 1}\n selected={selected}\n expanded={expanded}\n onToggleSelect={onToggleSelect}\n onToggleExpand={onToggleExpand}\n />\n ))}\n </div>\n )}\n </div>\n );\n}\n\nexport { CheckboxTree };\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/primitives/CheckboxTree/CheckboxTree.tsx"],"sourcesContent":["\"use client\";\n\nimport { Icon } from \"@/primitives/Icon\";\nimport { ChevronRight } from \"lucide-react\";\nimport * as React from \"react\";\n\nimport { Checkbox } from \"@/primitives/Checkbox\";\nimport { cn } from \"@/utils\";\n\n// CheckboxTree — a hierarchical checkbox list with expand/collapse and\n// tri-state (checked / unchecked / indeterminate) propagation: toggling a branch\n// toggles all its descendants, and a branch reflects its children\n// (checked when all are, indeterminate when some are). Controlled via `value`\n// (the set of selected node ids, branches included when fully selected).\n\n/** A single node in the tree: a stable id, a label, and optional children. */\nexport interface CheckboxTreeNode {\n /** Stable unique identifier used for selection and expansion tracking. */\n id: string;\n /** Content rendered next to the checkbox. */\n label: React.ReactNode;\n /** Nested child nodes; presence makes this node a collapsible branch. */\n children?: CheckboxTreeNode[];\n}\n\ntype NodeState = \"checked\" | \"unchecked\" | \"indeterminate\";\n\n/** All ids in a node's subtree (the node itself + every descendant). */\nfunction collectIds(node: CheckboxTreeNode): string[] {\n if (!node.children?.length) return [node.id];\n return [node.id, ...node.children.flatMap(collectIds)];\n}\n\n/** A leaf is checked iff selected; a branch derives its state from its children. */\nfunction getNodeState(node: CheckboxTreeNode, selected: Set<string>): NodeState {\n if (!node.children?.length) return selected.has(node.id) ? \"checked\" : \"unchecked\";\n const states = node.children.map((child) => getNodeState(child, selected));\n if (states.every((s) => s === \"checked\")) return \"checked\";\n if (states.every((s) => s === \"unchecked\")) return \"unchecked\";\n return \"indeterminate\";\n}\n\ninterface CheckboxTreeProps extends Omit<React.ComponentProps<\"div\">, \"onChange\"> {\n /** The hierarchical node data to render. */\n nodes: CheckboxTreeNode[];\n /** Selected node ids (controlled). Includes branch ids when fully selected. */\n value: string[];\n /** Called with the next selected ids whenever a node (and its subtree) is toggled. */\n onValueChange?: (value: string[]) => void;\n /** Node ids expanded on first render. */\n defaultExpandedIds?: string[];\n}\n\n/**\n * A hierarchical checkbox list with expand/collapse and tri-state\n * (checked / unchecked / indeterminate) propagation across each subtree.\n */\nfunction CheckboxTree({\n nodes,\n value,\n onValueChange,\n defaultExpandedIds,\n className,\n ...props\n}: CheckboxTreeProps) {\n const [expanded, setExpanded] = React.useState<Set<string>>(\n () => new Set(defaultExpandedIds ?? []),\n );\n const selected = React.useMemo(() => new Set(value), [value]);\n\n const toggleExpand = (id: string) =>\n setExpanded((prev) => {\n const next = new Set(prev);\n if (next.has(id)) next.delete(id);\n else next.add(id);\n return next;\n });\n\n const toggleSelect = (node: CheckboxTreeNode) => {\n const ids = collectIds(node);\n const allSelected = ids.every((id) => selected.has(id));\n const next = new Set(selected);\n for (const id of ids) {\n if (allSelected) next.delete(id);\n else next.add(id);\n }\n onValueChange?.([...next]);\n };\n\n return (\n <div\n role=\"tree\"\n data-slot=\"checkbox-tree\"\n className={cn(\"flex flex-col gap-1\", className)}\n {...props}\n >\n {nodes.map((node) => (\n <TreeNode\n key={node.id}\n node={node}\n depth={0}\n selected={selected}\n expanded={expanded}\n onToggleSelect={toggleSelect}\n onToggleExpand={toggleExpand}\n />\n ))}\n </div>\n );\n}\n\ninterface TreeNodeProps {\n /** The node rendered by this row. */\n node: CheckboxTreeNode;\n /** Nesting depth, used for indentation and heading emphasis. */\n depth: number;\n /** Set of currently selected node ids. */\n selected: Set<string>;\n /** Set of currently expanded node ids. */\n expanded: Set<string>;\n /** Toggles selection of the node and its subtree. */\n onToggleSelect: (node: CheckboxTreeNode) => void;\n /** Toggles the expanded/collapsed state of a branch. */\n onToggleExpand: (id: string) => void;\n}\n\n/** Renders a single tree row plus, when expanded, its child rows recursively. */\nfunction TreeNode({\n node,\n depth,\n selected,\n expanded,\n onToggleSelect,\n onToggleExpand,\n}: TreeNodeProps) {\n const hasChildren = !!node.children?.length;\n const isExpanded = expanded.has(node.id);\n const state = getNodeState(node, selected);\n const checkboxId = React.useId();\n\n return (\n <div\n role=\"treeitem\"\n aria-expanded={hasChildren ? isExpanded : undefined}\n aria-checked={state === \"indeterminate\" ? \"mixed\" : state === \"checked\"}\n >\n <div className=\"flex items-center gap-1\" style={{ paddingLeft: `${depth * 1.5}rem` }}>\n {hasChildren ? (\n <button\n type=\"button\"\n onClick={() => onToggleExpand(node.id)}\n aria-label={isExpanded ? \"Collapse\" : \"Expand\"}\n className=\"flex size-5 shrink-0 items-center justify-center text-muted-txt hover:text-primary-txt\"\n >\n <Icon\n as={ChevronRight}\n className={cn(\"size-4 transition-transform\", isExpanded && \"rotate-90\")}\n />\n </button>\n ) : (\n <span className=\"w-5 shrink-0\" />\n )}\n <label\n htmlFor={checkboxId}\n className=\"flex flex-1 cursor-pointer items-center gap-2 rounded-6 px-2 py-1.5 transition-colors hover:bg-muted-bg/40\"\n >\n <Checkbox\n id={checkboxId}\n checked={state === \"indeterminate\" ? \"indeterminate\" : state === \"checked\"}\n onCheckedChange={() => onToggleSelect(node)}\n />\n <span className={cn(\"text-sm\", depth === 0 && \"font-medium\")}>{node.label}</span>\n </label>\n </div>\n {hasChildren && isExpanded && (\n <div role=\"group\">\n {node.children?.map((child) => (\n <TreeNode\n key={child.id}\n node={child}\n depth={depth + 1}\n selected={selected}\n expanded={expanded}\n onToggleSelect={onToggleSelect}\n onToggleExpand={onToggleExpand}\n />\n ))}\n </div>\n )}\n </div>\n );\n}\n\nexport { CheckboxTree };\n"],"mappings":";;;;;;;;AA4BA,SAAS,WAAW,MAAkC;CACpD,IAAI,CAAC,KAAK,UAAU,QAAQ,OAAO,CAAC,K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ag, { value: "Module" });
|
|
2
|
-
let radix_ui = require("radix-ui");
|
|
3
2
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
3
|
+
let radix_ui = require("radix-ui");
|
|
4
4
|
//#region src/primitives/Collapsible/Collapsible.tsx
|
|
5
5
|
/** Root of an interactive panel that shows or hides its content when the trigger is toggled. */
|
|
6
6
|
function Collapsible({ ...props }) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Collapsible as Collapsible$1 } from "radix-ui";
|
|
2
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Collapsible as Collapsible$1 } from "radix-ui";
|
|
3
3
|
//#region src/primitives/Collapsible/Collapsible.tsx
|
|
4
4
|
/** Root of an interactive panel that shows or hides its content when the trigger is toggled. */
|
|
5
5
|
function Collapsible({ ...props }) {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_cn = require("../../cn.cjs");
|
|
3
|
+
const require_Icon = require("../../Icon.cjs");
|
|
3
4
|
const require_primitives_Dialog_index = require("../Dialog/index.cjs");
|
|
4
|
-
let lucide_react = require("lucide-react");
|
|
5
5
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
6
|
+
let lucide_react = require("lucide-react");
|
|
6
7
|
let cmdk = require("cmdk");
|
|
7
8
|
//#region src/primitives/Command/Command.tsx
|
|
8
9
|
/** Command palette root: a filterable list of commands built on `cmdk`. */
|
|
@@ -35,7 +36,10 @@ function CommandInput({ className, ...props }) {
|
|
|
35
36
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
36
37
|
"data-slot": "command-input-wrapper",
|
|
37
38
|
className: "flex h-9 items-center gap-2 border-b px-3",
|
|
38
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
39
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Icon.Icon, {
|
|
40
|
+
as: lucide_react.SearchIcon,
|
|
41
|
+
className: "size-4 shrink-0 text-muted-txt"
|
|
42
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(cmdk.Command.Input, {
|
|
39
43
|
"data-slot": "command-input",
|
|
40
44
|
className: require_cn.cn("flex h-10 w-full rounded-6 bg-transparent py-3 text-sm leading-5 outline-hidden placeholder:text-muted-txt disabled:cursor-not-allowed disabled:opacity-50", className),
|
|
41
45
|
...props
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["CommandPrimitive","cn","Dialog","DialogHeader","DialogTitle","DialogDescription","DialogContent","SearchIcon"],"sources":["../../../src/primitives/Command/Command.tsx"],"sourcesContent":["\"use client\";\n\nimport { Command as CommandPrimitive } from \"cmdk\";\nimport { SearchIcon } from \"lucide-react\";\nimport type * as React from \"react\";\n\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogHeader,\n DialogTitle,\n} from \"@/primitives/Dialog\";\nimport { cn } from \"@/utils\";\n\n/** Command palette root: a filterable list of commands built on `cmdk`. */\nfunction Command({ className, ...props }: React.ComponentProps<typeof CommandPrimitive>) {\n return (\n <CommandPrimitive\n data-slot=\"command\"\n className={cn(\n // Figma Command (66:5046): bg/primary panel, radius-12, shadow-md.\n \"flex h-full w-full flex-col overflow-hidden rounded-12 bg-primary-bg text-primary-txt\",\n className,\n )}\n {...props}\n />\n );\n}\n\n/** A `Command` rendered inside a centered, modal `Dialog` — the classic ⌘K palette. */\nfunction CommandDialog({\n title = \"Command Palette\",\n description = \"Search for a command to run...\",\n children,\n className,\n showCloseButton = true,\n ...props\n}: React.ComponentProps<typeof Dialog> & {\n /** Accessible (visually hidden) dialog title for screen readers. */\n title?: string;\n /** Accessible (visually hidden) dialog description for screen readers. */\n description?: string;\n /** Extra classes applied to the dialog content surface. */\n className?: string;\n /** Whether to render the dialog's top-right close button. */\n showCloseButton?: boolean;\n}) {\n return (\n <Dialog {...props}>\n <DialogHeader className=\"sr-only\">\n <DialogTitle>{title}</DialogTitle>\n <DialogDescription>{description}</DialogDescription>\n </DialogHeader>\n <DialogContent\n className={cn(\"overflow-hidden p-0\", className)}\n showCloseButton={showCloseButton}\n >\n <Command className=\"**:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-semibold [&_[cmdk-group-heading]]:text-secondary-txt [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:size-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:size-5\">\n {children}\n </Command>\n </DialogContent>\n </Dialog>\n );\n}\n\n/** The search field that filters the command list, with a leading search icon. */\nfunction CommandInput({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Input>) {\n return (\n <div data-slot=\"command-input-wrapper\" className=\"flex h-9 items-center gap-2 border-b px-3\">\n <SearchIcon className=\"size-4 shrink-0 text-muted-txt\" />\n <CommandPrimitive.Input\n data-slot=\"command-input\"\n className={cn(\n \"flex h-10 w-full rounded-6 bg-transparent py-3 text-sm leading-5 outline-hidden placeholder:text-muted-txt disabled:cursor-not-allowed disabled:opacity-50\",\n className,\n )}\n {...props}\n />\n </div>\n );\n}\n\n/** Scrollable container for command groups, items, and the empty state. */\nfunction CommandList({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.List>) {\n return (\n <CommandPrimitive.List\n data-slot=\"command-list\"\n className={cn(\"max-h-75 scroll-py-1 overflow-x-hidden overflow-y-auto\", className)}\n {...props}\n />\n );\n}\n\n/** Placeholder shown when the search query matches no items. */\nfunction CommandEmpty({ ...props }: React.ComponentProps<typeof CommandPrimitive.Empty>) {\n return (\n <CommandPrimitive.Empty\n data-slot=\"command-empty\"\n className=\"py-6 text-center text-sm\"\n {...props}\n />\n );\n}\n\n/** A labelled group of related command items, with an optional `heading`. */\nfunction CommandGroup({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Group>) {\n return (\n <CommandPrimitive.Group\n data-slot=\"command-group\"\n className={cn(\n // Group headings: paragraph small/bold on content/secondary (Figma).\n \"overflow-hidden p-1 text-primary-txt [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-sm [&_[cmdk-group-heading]]:leading-5 [&_[cmdk-group-heading]]:font-semibold [&_[cmdk-group-heading]]:text-secondary-txt\",\n className,\n )}\n {...props}\n />\n );\n}\n\n/** A thin divider line between command groups. */\nfunction CommandSeparator({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Separator>) {\n return (\n <CommandPrimitive.Separator\n data-slot=\"command-separator\"\n className={cn(\"-mx-1 h-px bg-primary-border\", className)}\n {...props}\n />\n );\n}\n\n/** A selectable command row supporting keyboard navigation and a disabled state. */\nfunction CommandItem({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Item>) {\n return (\n <CommandPrimitive.Item\n data-slot=\"command-item\"\n className={cn(\n // Figma Command Item: hover bg/muted, active/selected bg/secondary,\n // radius-6, 3px vertical padding.\n \"relative flex cursor-default items-center gap-2 rounded-6 px-2 py-0.75 text-sm leading-5 outline-hidden select-none hover:bg-muted-bg active:bg-secondary-bg data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[selected=true]:bg-secondary-bg [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-txt\",\n className,\n )}\n {...props}\n />\n );\n}\n\n/** Right-aligned keyboard-shortcut hint shown inside a `CommandItem`. */\nfunction CommandShortcut({ className, ...props }: React.ComponentProps<\"span\">) {\n return (\n <span\n data-slot=\"command-shortcut\"\n className={cn(\"ml-auto text-sm leading-5 text-muted-txt\", className)}\n {...props}\n />\n );\n}\n\nexport {\n Command,\n CommandDialog,\n CommandInput,\n CommandList,\n CommandEmpty,\n CommandGroup,\n CommandItem,\n CommandShortcut,\n CommandSeparator,\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["CommandPrimitive","cn","Dialog","DialogHeader","DialogTitle","DialogDescription","DialogContent","Icon","SearchIcon"],"sources":["../../../src/primitives/Command/Command.tsx"],"sourcesContent":["\"use client\";\n\nimport { Icon } from \"@/primitives/Icon\";\nimport { Command as CommandPrimitive } from \"cmdk\";\nimport { SearchIcon } from \"lucide-react\";\nimport type * as React from \"react\";\n\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogHeader,\n DialogTitle,\n} from \"@/primitives/Dialog\";\nimport { cn } from \"@/utils\";\n\n/** Command palette root: a filterable list of commands built on `cmdk`. */\nfunction Command({ className, ...props }: React.ComponentProps<typeof CommandPrimitive>) {\n return (\n <CommandPrimitive\n data-slot=\"command\"\n className={cn(\n // Figma Command (66:5046): bg/primary panel, radius-12, shadow-md.\n \"flex h-full w-full flex-col overflow-hidden rounded-12 bg-primary-bg text-primary-txt\",\n className,\n )}\n {...props}\n />\n );\n}\n\n/** A `Command` rendered inside a centered, modal `Dialog` — the classic ⌘K palette. */\nfunction CommandDialog({\n title = \"Command Palette\",\n description = \"Search for a command to run...\",\n children,\n className,\n showCloseButton = true,\n ...props\n}: React.ComponentProps<typeof Dialog> & {\n /** Accessible (visually hidden) dialog title for screen readers. */\n title?: string;\n /** Accessible (visually hidden) dialog description for screen readers. */\n description?: string;\n /** Extra classes applied to the dialog content surface. */\n className?: string;\n /** Whether to render the dialog's top-right close button. */\n showCloseButton?: boolean;\n}) {\n return (\n <Dialog {...props}>\n <DialogHeader className=\"sr-only\">\n <DialogTitle>{title}</DialogTitle>\n <DialogDescription>{description}</DialogDescription>\n </DialogHeader>\n <DialogContent\n className={cn(\"overflow-hidden p-0\", className)}\n showCloseButton={showCloseButton}\n >\n <Command className=\"**:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-semibold [&_[cmdk-group-heading]]:text-secondary-txt [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:size-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:size-5\">\n {children}\n </Command>\n </DialogContent>\n </Dialog>\n );\n}\n\n/** The search field that filters the command list, with a leading search icon. */\nfunction CommandInput({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Input>) {\n return (\n <div data-slot=\"command-input-wrapper\" className=\"flex h-9 items-center gap-2 border-b px-3\">\n <Icon as={SearchIcon} className=\"size-4 shrink-0 text-muted-txt\" />\n <CommandPrimitive.Input\n data-slot=\"command-input\"\n className={cn(\n \"flex h-10 w-full rounded-6 bg-transparent py-3 text-sm leading-5 outline-hidden placeholder:text-muted-txt disabled:cursor-not-allowed disabled:opacity-50\",\n className,\n )}\n {...props}\n />\n </div>\n );\n}\n\n/** Scrollable container for command groups, items, and the empty state. */\nfunction CommandList({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.List>) {\n return (\n <CommandPrimitive.List\n data-slot=\"command-list\"\n className={cn(\"max-h-75 scroll-py-1 overflow-x-hidden overflow-y-auto\", className)}\n {...props}\n />\n );\n}\n\n/** Placeholder shown when the search query matches no items. */\nfunction CommandEmpty({ ...props }: React.ComponentProps<typeof CommandPrimitive.Empty>) {\n return (\n <CommandPrimitive.Empty\n data-slot=\"command-empty\"\n className=\"py-6 text-center text-sm\"\n {...props}\n />\n );\n}\n\n/** A labelled group of related command items, with an optional `heading`. */\nfunction CommandGroup({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Group>) {\n return (\n <CommandPrimitive.Group\n data-slot=\"command-group\"\n className={cn(\n // Group headings: paragraph small/bold on content/secondary (Figma).\n \"overflow-hidden p-1 text-primary-txt [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-sm [&_[cmdk-group-heading]]:leading-5 [&_[cmdk-group-heading]]:font-semibold [&_[cmdk-group-heading]]:text-secondary-txt\",\n className,\n )}\n {...props}\n />\n );\n}\n\n/** A thin divider line between command groups. */\nfunction CommandSeparator({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Separator>) {\n return (\n <CommandPrimitive.Separator\n data-slot=\"command-separator\"\n className={cn(\"-mx-1 h-px bg-primary-border\", className)}\n {...props}\n />\n );\n}\n\n/** A selectable command row supporting keyboard navigation and a disabled state. */\nfunction CommandItem({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Item>) {\n return (\n <CommandPrimitive.Item\n data-slot=\"command-item\"\n className={cn(\n // Figma Command Item: hover bg/muted, active/selected bg/secondary,\n // radius-6, 3px vertical padding.\n \"relative flex cursor-default items-center gap-2 rounded-6 px-2 py-0.75 text-sm leading-5 outline-hidden select-none hover:bg-muted-bg active:bg-secondary-bg data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[selected=true]:bg-secondary-bg [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-txt\",\n className,\n )}\n {...props}\n />\n );\n}\n\n/** Right-aligned keyboard-shortcut hint shown inside a `CommandItem`. */\nfunction CommandShortcut({ className, ...props }: React.ComponentProps<\"span\">) {\n return (\n <span\n data-slot=\"command-shortcut\"\n className={cn(\"ml-auto text-sm leading-5 text-muted-txt\", className)}\n {...props}\n />\n );\n}\n\nexport {\n Command,\n CommandDialog,\n CommandInput,\n CommandList,\n CommandEmpty,\n CommandGroup,\n CommandItem,\n CommandShortcut,\n CommandSeparator,\n};\n"],"mappings":";;;;;;;;;AAiBA,SAAS,QAAQ,EAAE,WAAW,GAAG,SAAwD;CACvF,OACE,iBAAA,GAAA,kBAAA,KAACA,KAAAA,SAAD;EACE,aAAU;EACV,WAAWC,WAAAA,GAET,yFACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;;AAGA,SAAS,cAAc,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pB,WACA,GAAG,SACmD;CACtD,OACE,iBAAA,GAAA,kBAAA,KAACA,KAAAA,QAAiB,OAAlB;EACE,aAAU;EACV,WAAWC,WAAAA,GAET,6PACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;;AAGA,SAAS,iBAAiB,EACxB,WACA,GAAG,SACuD;CAC1D,OACE,iBAAA,GAAA,kBAAA,KAACD,KAAAA,QAAiB,WAAlB;EACE,aAAU;EACV,WAAWC,WAAAA,GAAG,gCAAgC,SAAS;EACvD,GAAI;CACL,CAAA;AAEL;;AAGA,SAAS,YAAY,EAAE,WAAW,GAAG,SAA6D;CAChG,OACE,iBAAA,GAAA,kBAAA,KAACD,KAAAA,QAAiB,MAAlB;EACE,aAAU;EACV,WAAWC,WAAAA,GAGT,6YACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;;AAGA,SAAS,gBAAgB,EAAE,WAAW,GAAG,SAAuC;CAC9E,OACE,iBAAA,GAAA,kBAAA,KAAC,QAAD;EACE,aAAU;EACV,WAAWA,WAAAA,GAAG,4CAA4C,SAAS;EACnE,GAAI;CACL,CAAA;AAEL"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { t as cn } from "../../cn.js";
|
|
2
|
+
import { t as Icon } from "../../Icon.js";
|
|
2
3
|
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from "../Dialog/index.js";
|
|
3
|
-
import { SearchIcon } from "lucide-react";
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { SearchIcon } from "lucide-react";
|
|
5
6
|
import { Command as Command$1 } from "cmdk";
|
|
6
7
|
//#region src/primitives/Command/Command.tsx
|
|
7
8
|
/** Command palette root: a filterable list of commands built on `cmdk`. */
|
|
@@ -34,7 +35,10 @@ function CommandInput({ className, ...props }) {
|
|
|
34
35
|
return /* @__PURE__ */ jsxs("div", {
|
|
35
36
|
"data-slot": "command-input-wrapper",
|
|
36
37
|
className: "flex h-9 items-center gap-2 border-b px-3",
|
|
37
|
-
children: [/* @__PURE__ */ jsx(
|
|
38
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
39
|
+
as: SearchIcon,
|
|
40
|
+
className: "size-4 shrink-0 text-muted-txt"
|
|
41
|
+
}), /* @__PURE__ */ jsx(Command$1.Input, {
|
|
38
42
|
"data-slot": "command-input",
|
|
39
43
|
className: cn("flex h-10 w-full rounded-6 bg-transparent py-3 text-sm leading-5 outline-hidden placeholder:text-muted-txt disabled:cursor-not-allowed disabled:opacity-50", className),
|
|
40
44
|
...props
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["CommandPrimitive"],"sources":["../../../src/primitives/Command/Command.tsx"],"sourcesContent":["\"use client\";\n\nimport { Command as CommandPrimitive } from \"cmdk\";\nimport { SearchIcon } from \"lucide-react\";\nimport type * as React from \"react\";\n\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogHeader,\n DialogTitle,\n} from \"@/primitives/Dialog\";\nimport { cn } from \"@/utils\";\n\n/** Command palette root: a filterable list of commands built on `cmdk`. */\nfunction Command({ className, ...props }: React.ComponentProps<typeof CommandPrimitive>) {\n return (\n <CommandPrimitive\n data-slot=\"command\"\n className={cn(\n // Figma Command (66:5046): bg/primary panel, radius-12, shadow-md.\n \"flex h-full w-full flex-col overflow-hidden rounded-12 bg-primary-bg text-primary-txt\",\n className,\n )}\n {...props}\n />\n );\n}\n\n/** A `Command` rendered inside a centered, modal `Dialog` — the classic ⌘K palette. */\nfunction CommandDialog({\n title = \"Command Palette\",\n description = \"Search for a command to run...\",\n children,\n className,\n showCloseButton = true,\n ...props\n}: React.ComponentProps<typeof Dialog> & {\n /** Accessible (visually hidden) dialog title for screen readers. */\n title?: string;\n /** Accessible (visually hidden) dialog description for screen readers. */\n description?: string;\n /** Extra classes applied to the dialog content surface. */\n className?: string;\n /** Whether to render the dialog's top-right close button. */\n showCloseButton?: boolean;\n}) {\n return (\n <Dialog {...props}>\n <DialogHeader className=\"sr-only\">\n <DialogTitle>{title}</DialogTitle>\n <DialogDescription>{description}</DialogDescription>\n </DialogHeader>\n <DialogContent\n className={cn(\"overflow-hidden p-0\", className)}\n showCloseButton={showCloseButton}\n >\n <Command className=\"**:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-semibold [&_[cmdk-group-heading]]:text-secondary-txt [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:size-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:size-5\">\n {children}\n </Command>\n </DialogContent>\n </Dialog>\n );\n}\n\n/** The search field that filters the command list, with a leading search icon. */\nfunction CommandInput({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Input>) {\n return (\n <div data-slot=\"command-input-wrapper\" className=\"flex h-9 items-center gap-2 border-b px-3\">\n <SearchIcon className=\"size-4 shrink-0 text-muted-txt\" />\n <CommandPrimitive.Input\n data-slot=\"command-input\"\n className={cn(\n \"flex h-10 w-full rounded-6 bg-transparent py-3 text-sm leading-5 outline-hidden placeholder:text-muted-txt disabled:cursor-not-allowed disabled:opacity-50\",\n className,\n )}\n {...props}\n />\n </div>\n );\n}\n\n/** Scrollable container for command groups, items, and the empty state. */\nfunction CommandList({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.List>) {\n return (\n <CommandPrimitive.List\n data-slot=\"command-list\"\n className={cn(\"max-h-75 scroll-py-1 overflow-x-hidden overflow-y-auto\", className)}\n {...props}\n />\n );\n}\n\n/** Placeholder shown when the search query matches no items. */\nfunction CommandEmpty({ ...props }: React.ComponentProps<typeof CommandPrimitive.Empty>) {\n return (\n <CommandPrimitive.Empty\n data-slot=\"command-empty\"\n className=\"py-6 text-center text-sm\"\n {...props}\n />\n );\n}\n\n/** A labelled group of related command items, with an optional `heading`. */\nfunction CommandGroup({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Group>) {\n return (\n <CommandPrimitive.Group\n data-slot=\"command-group\"\n className={cn(\n // Group headings: paragraph small/bold on content/secondary (Figma).\n \"overflow-hidden p-1 text-primary-txt [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-sm [&_[cmdk-group-heading]]:leading-5 [&_[cmdk-group-heading]]:font-semibold [&_[cmdk-group-heading]]:text-secondary-txt\",\n className,\n )}\n {...props}\n />\n );\n}\n\n/** A thin divider line between command groups. */\nfunction CommandSeparator({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Separator>) {\n return (\n <CommandPrimitive.Separator\n data-slot=\"command-separator\"\n className={cn(\"-mx-1 h-px bg-primary-border\", className)}\n {...props}\n />\n );\n}\n\n/** A selectable command row supporting keyboard navigation and a disabled state. */\nfunction CommandItem({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Item>) {\n return (\n <CommandPrimitive.Item\n data-slot=\"command-item\"\n className={cn(\n // Figma Command Item: hover bg/muted, active/selected bg/secondary,\n // radius-6, 3px vertical padding.\n \"relative flex cursor-default items-center gap-2 rounded-6 px-2 py-0.75 text-sm leading-5 outline-hidden select-none hover:bg-muted-bg active:bg-secondary-bg data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[selected=true]:bg-secondary-bg [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-txt\",\n className,\n )}\n {...props}\n />\n );\n}\n\n/** Right-aligned keyboard-shortcut hint shown inside a `CommandItem`. */\nfunction CommandShortcut({ className, ...props }: React.ComponentProps<\"span\">) {\n return (\n <span\n data-slot=\"command-shortcut\"\n className={cn(\"ml-auto text-sm leading-5 text-muted-txt\", className)}\n {...props}\n />\n );\n}\n\nexport {\n Command,\n CommandDialog,\n CommandInput,\n CommandList,\n CommandEmpty,\n CommandGroup,\n CommandItem,\n CommandShortcut,\n CommandSeparator,\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":["CommandPrimitive"],"sources":["../../../src/primitives/Command/Command.tsx"],"sourcesContent":["\"use client\";\n\nimport { Icon } from \"@/primitives/Icon\";\nimport { Command as CommandPrimitive } from \"cmdk\";\nimport { SearchIcon } from \"lucide-react\";\nimport type * as React from \"react\";\n\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogHeader,\n DialogTitle,\n} from \"@/primitives/Dialog\";\nimport { cn } from \"@/utils\";\n\n/** Command palette root: a filterable list of commands built on `cmdk`. */\nfunction Command({ className, ...props }: React.ComponentProps<typeof CommandPrimitive>) {\n return (\n <CommandPrimitive\n data-slot=\"command\"\n className={cn(\n // Figma Command (66:5046): bg/primary panel, radius-12, shadow-md.\n \"flex h-full w-full flex-col overflow-hidden rounded-12 bg-primary-bg text-primary-txt\",\n className,\n )}\n {...props}\n />\n );\n}\n\n/** A `Command` rendered inside a centered, modal `Dialog` — the classic ⌘K palette. */\nfunction CommandDialog({\n title = \"Command Palette\",\n description = \"Search for a command to run...\",\n children,\n className,\n showCloseButton = true,\n ...props\n}: React.ComponentProps<typeof Dialog> & {\n /** Accessible (visually hidden) dialog title for screen readers. */\n title?: string;\n /** Accessible (visually hidden) dialog description for screen readers. */\n description?: string;\n /** Extra classes applied to the dialog content surface. */\n className?: string;\n /** Whether to render the dialog's top-right close button. */\n showCloseButton?: boolean;\n}) {\n return (\n <Dialog {...props}>\n <DialogHeader className=\"sr-only\">\n <DialogTitle>{title}</DialogTitle>\n <DialogDescription>{description}</DialogDescription>\n </DialogHeader>\n <DialogContent\n className={cn(\"overflow-hidden p-0\", className)}\n showCloseButton={showCloseButton}\n >\n <Command className=\"**:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-semibold [&_[cmdk-group-heading]]:text-secondary-txt [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:size-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:size-5\">\n {children}\n </Command>\n </DialogContent>\n </Dialog>\n );\n}\n\n/** The search field that filters the command list, with a leading search icon. */\nfunction CommandInput({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Input>) {\n return (\n <div data-slot=\"command-input-wrapper\" className=\"flex h-9 items-center gap-2 border-b px-3\">\n <Icon as={SearchIcon} className=\"size-4 shrink-0 text-muted-txt\" />\n <CommandPrimitive.Input\n data-slot=\"command-input\"\n className={cn(\n \"flex h-10 w-full rounded-6 bg-transparent py-3 text-sm leading-5 outline-hidden placeholder:text-muted-txt disabled:cursor-not-allowed disabled:opacity-50\",\n className,\n )}\n {...props}\n />\n </div>\n );\n}\n\n/** Scrollable container for command groups, items, and the empty state. */\nfunction CommandList({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.List>) {\n return (\n <CommandPrimitive.List\n data-slot=\"command-list\"\n className={cn(\"max-h-75 scroll-py-1 overflow-x-hidden overflow-y-auto\", className)}\n {...props}\n />\n );\n}\n\n/** Placeholder shown when the search query matches no items. */\nfunction CommandEmpty({ ...props }: React.ComponentProps<typeof CommandPrimitive.Empty>) {\n return (\n <CommandPrimitive.Empty\n data-slot=\"command-empty\"\n className=\"py-6 text-center text-sm\"\n {...props}\n />\n );\n}\n\n/** A labelled group of related command items, with an optional `heading`. */\nfunction CommandGroup({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Group>) {\n return (\n <CommandPrimitive.Group\n data-slot=\"command-group\"\n className={cn(\n // Group headings: paragraph small/bold on content/secondary (Figma).\n \"overflow-hidden p-1 text-primary-txt [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-sm [&_[cmdk-group-heading]]:leading-5 [&_[cmdk-group-heading]]:font-semibold [&_[cmdk-group-heading]]:text-secondary-txt\",\n className,\n )}\n {...props}\n />\n );\n}\n\n/** A thin divider line between command groups. */\nfunction CommandSeparator({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Separator>) {\n return (\n <CommandPrimitive.Separator\n data-slot=\"command-separator\"\n className={cn(\"-mx-1 h-px bg-primary-border\", className)}\n {...props}\n />\n );\n}\n\n/** A selectable command row supporting keyboard navigation and a disabled state. */\nfunction CommandItem({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Item>) {\n return (\n <CommandPrimitive.Item\n data-slot=\"command-item\"\n className={cn(\n // Figma Command Item: hover bg/muted, active/selected bg/secondary,\n // radius-6, 3px vertical padding.\n \"relative flex cursor-default items-center gap-2 rounded-6 px-2 py-0.75 text-sm leading-5 outline-hidden select-none hover:bg-muted-bg active:bg-secondary-bg data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[selected=true]:bg-secondary-bg [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-txt\",\n className,\n )}\n {...props}\n />\n );\n}\n\n/** Right-aligned keyboard-shortcut hint shown inside a `CommandItem`. */\nfunction CommandShortcut({ className, ...props }: React.ComponentProps<\"span\">) {\n return (\n <span\n data-slot=\"command-shortcut\"\n className={cn(\"ml-auto text-sm leading-5 text-muted-txt\", className)}\n {...props}\n />\n );\n}\n\nexport {\n Command,\n CommandDialog,\n CommandInput,\n CommandList,\n CommandEmpty,\n CommandGroup,\n CommandItem,\n CommandShortcut,\n CommandSeparator,\n};\n"],"mappings":";;;;;;;;AAiBA,SAAS,QAAQ,EAAE,WAAW,GAAG,SAAwD;CACvF,OACE,oBAACA,WAAD;EACE,aAAU;EACV,WAAW,GAET,yFACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;;AAGA,SAAS,cAAc,EACrB,QAAQ,mBACR,cAAc,kCACd,UACA,WACA,kBAAkB,MAClB,GAAG,SAUF;CACD,OACE,q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ACL,CAAA;AAEL;;AAGA,SAAS,gBAAgB,EAAE,WAAW,GAAG,SAAuC;CAC9E,OACE,oBAAC,QAAD;EACE,aAAU;EACV,WAAW,GAAG,4CAA4C,SAAS;EACnE,GAAI;CACL,CAAA;AAEL"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_cn = require("../../cn.cjs");
|
|
3
|
+
const require_Icon = require("../../Icon.cjs");
|
|
4
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
3
5
|
let lucide_react = require("lucide-react");
|
|
4
6
|
let radix_ui = require("radix-ui");
|
|
5
|
-
let react_jsx_runtime = require("react/jsx-runtime");
|
|
6
7
|
//#region src/primitives/ContextMenu/ContextMenu.tsx
|
|
7
8
|
/** Root provider for a right-click context menu; wires the trigger to its portalled content. */
|
|
8
9
|
function ContextMenu({ ...props }) {
|
|
@@ -53,7 +54,10 @@ function ContextMenuSubTrigger({ className, inset, children, ...props }) {
|
|
|
53
54
|
"data-inset": inset,
|
|
54
55
|
className: require_cn.cn("flex min-h-8 cursor-default items-center gap-2 rounded-10 px-2 py-1.5 text-sm leading-5 outline-hidden select-none focus:bg-ghost-hover-bg data-[inset]:pl-8 data-[state=open]:bg-ghost-hover-bg [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-txt", className),
|
|
55
56
|
...props,
|
|
56
|
-
children: [children, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
57
|
+
children: [children, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Icon.Icon, {
|
|
58
|
+
as: lucide_react.ChevronRightIcon,
|
|
59
|
+
className: "ml-auto size-4"
|
|
60
|
+
})]
|
|
57
61
|
});
|
|
58
62
|
}
|
|
59
63
|
/** The popover surface for a nested submenu. */
|
|
@@ -91,7 +95,10 @@ function ContextMenuCheckboxItem({ className, children, checked, ...props }) {
|
|
|
91
95
|
...props,
|
|
92
96
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
93
97
|
className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",
|
|
94
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(radix_ui.ContextMenu.ItemIndicator, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
98
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(radix_ui.ContextMenu.ItemIndicator, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Icon.Icon, {
|
|
99
|
+
as: lucide_react.CheckIcon,
|
|
100
|
+
className: "size-4"
|
|
101
|
+
}) })
|
|
95
102
|
}), children]
|
|
96
103
|
});
|
|
97
104
|
}
|
|
@@ -103,7 +110,10 @@ function ContextMenuRadioItem({ className, children, ...props }) {
|
|
|
103
110
|
...props,
|
|
104
111
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
105
112
|
className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",
|
|
106
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(radix_ui.ContextMenu.ItemIndicator, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
113
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(radix_ui.ContextMenu.ItemIndicator, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Icon.Icon, {
|
|
114
|
+
as: lucide_react.CircleIcon,
|
|
115
|
+
className: "size-2 fill-current"
|
|
116
|
+
}) })
|
|
107
117
|
}), children]
|
|
108
118
|
});
|
|
109
119
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["ContextMenuPrimitive","cn","ChevronRightIcon","CheckIcon","CircleIcon"],"sources":["../../../src/primitives/ContextMenu/ContextMenu.tsx"],"sourcesContent":["import { CheckIcon, ChevronRightIcon, CircleIcon } from \"lucide-react\";\nimport { ContextMenu as ContextMenuPrimitive } from \"radix-ui\";\nimport type * as React from \"react\";\n\nimport { cn } from \"@/utils\";\n\n/** Root provider for a right-click context menu; wires the trigger to its portalled content. */\nfunction ContextMenu({ ...props }: React.ComponentProps<typeof ContextMenuPrimitive.Root>) {\n return <ContextMenuPrimitive.Root data-slot=\"context-menu\" {...props} />;\n}\n\n/** The target region that opens the menu on right-click (context menu). */\nfunction ContextMenuTrigger({\n ...props\n}: React.ComponentProps<typeof ContextMenuPrimitive.Trigger>) {\n return <ContextMenuPrimitive.Trigger data-slot=\"context-menu-trigger\" {...props} />;\n}\n\n/** Groups related items together for labelling and accessibility. */\nfunction ContextMenuGroup({ ...props }: React.ComponentProps<typeof ContextMenuPrimitive.Group>) {\n return <ContextMenuPrimitive.Group data-slot=\"context-menu-group\" {...props} />;\n}\n\n/** Portals the menu content into the document body. */\nfunction ContextMenuPortal({ ...props }: React.ComponentProps<typeof ContextMenuPrimitive.Portal>) {\n return <ContextMenuPrimitive.Portal data-slot=\"context-menu-portal\" {...props} />;\n}\n\n/** Wraps a nested submenu (pair with `ContextMenuSubTrigger` and `ContextMenuSubContent`). */\nfunction ContextMenuSub({ ...props }: React.ComponentProps<typeof ContextMenuPrimitive.Sub>) {\n return <ContextMenuPrimitive.Sub data-slot=\"context-menu-sub\" {...props} />;\n}\n\n/** Groups `ContextMenuRadioItem`s into a single-select set. */\nfunction ContextMenuRadioGroup({\n ...props\n}: React.ComponentProps<typeof ContextMenuPrimitive.RadioGroup>) {\n return <ContextMenuPrimitive.RadioGroup data-slot=\"context-menu-radio-group\" {...props} />;\n}\n\n/** Item that opens a nested submenu; renders a trailing chevron. */\nfunction ContextMenuSubTrigger({\n className,\n inset,\n children,\n ...props\n}: React.ComponentProps<typeof ContextMenuPrimitive.SubTrigger> & {\n /** Adds left padding so the label aligns with items that have a leading icon. */\n inset?: boolean;\n}) {\n return (\n <ContextMenuPrimitive.SubTrigger\n data-slot=\"context-menu-sub-trigger\"\n data-inset={inset}\n className={cn(\n \"flex min-h-8 cursor-default items-center gap-2 rounded-10 px-2 py-1.5 text-sm leading-5 outline-hidden select-none focus:bg-ghost-hover-bg data-[inset]:pl-8 data-[state=open]:bg-ghost-hover-bg [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-txt\",\n className,\n )}\n {...props}\n >\n {children}\n <ChevronRightIcon className=\"ml-auto size-4\" />\n </ContextMenuPrimitive.SubTrigger>\n );\n}\n\n/** The popover surface for a nested submenu. */\nfunction ContextMenuSubContent({\n className,\n ...props\n}: React.ComponentProps<typeof ContextMenuPrimitive.SubContent>) {\n return (\n <ContextMenuPrimitive.SubContent\n data-slot=\"context-menu-sub-content\"\n className={cn(\n \"z-50 min-w-32 origin-(--radix-context-menu-content-transform-origin) overflow-hidden rounded-12 border border-primary-border bg-glass-none-bg p-2 text-primary-txt shadow-sm data-[side=bottom]:slide-in-from-top-8 data-[side=left]:slide-in-from-right-8 data-[side=right]:slide-in-from-left-8 data-[side=top]:slide-in-from-bottom-8 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95\",\n // Vertical hierarchy: if any item reserves the 32px indicator column\n // (checkbox/radio items), plain items, labels and sub-triggers share it.\n \"[&:has([role=menuitemcheckbox],[role=menuitemradio])_[data-slot=context-menu-item]:not([data-inset])]:pl-8\",\n \"[&:has([role=menuitemcheckbox],[role=menuitemradio])_[data-slot=context-menu-label]:not([data-inset])]:pl-8\",\n \"[&:has([role=menuitemcheckbox],[role=menuitemradio])_[data-slot=context-menu-sub-trigger]:not([data-inset])]:pl-8\",\n className,\n )}\n {...props}\n />\n );\n}\n\n/** The portalled popover surface that holds the menu items. */\nfunction ContextMenuContent({\n className,\n ...props\n}: React.ComponentProps<typeof ContextMenuPrimitive.Content>) {\n return (\n <ContextMenuPrimitive.Portal>\n <ContextMenuPrimitive.Content\n data-slot=\"context-menu-content\"\n className={cn(\n \"z-50 max-h-(--radix-context-menu-content-available-height) min-w-32 origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-12 border border-primary-border bg-glass-none-bg p-2 text-primary-txt shadow-sm data-[side=bottom]:slide-in-from-top-8 data-[side=left]:slide-in-from-right-8 data-[side=right]:slide-in-from-left-8 data-[side=top]:slide-in-from-bottom-8 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95\",\n // Vertical hierarchy: if any item reserves the 32px indicator column\n // (checkbox/radio items), plain items, labels and sub-triggers share it.\n \"[&:has([role=menuitemcheckbox],[role=menuitemradio])_[data-slot=context-menu-item]:not([data-inset])]:pl-8\",\n \"[&:has([role=menuitemcheckbox],[role=menuitemradio])_[data-slot=context-menu-label]:not([data-inset])]:pl-8\",\n \"[&:has([role=menuitemcheckbox],[role=menuitemradio])_[data-slot=context-menu-sub-trigger]:not([data-inset])]:pl-8\",\n className,\n )}\n {...props}\n />\n </ContextMenuPrimitive.Portal>\n );\n}\n\n/** A selectable menu item; supports a `destructive` variant and `inset` alignment. */\nfunction ContextMenuItem({\n className,\n inset,\n variant = \"default\",\n ...props\n}: React.ComponentProps<typeof ContextMenuPrimitive.Item> & {\n /** Adds left padding so the label aligns with items that have a leading icon. */\n inset?: boolean;\n /** Visual intent; `destructive` colours the item with the danger palette. */\n variant?: \"default\" | \"destructive\";\n}) {\n return (\n <ContextMenuPrimitive.Item\n data-slot=\"context-menu-item\"\n data-inset={inset}\n data-variant={variant}\n className={cn(\n \"relative flex min-h-8 cursor-default items-center gap-2 rounded-10 px-2 py-1.5 text-sm leading-5 outline-hidden select-none focus:bg-ghost-hover-bg data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 data-[variant=destructive]:text-danger-txt data-[variant=destructive]:focus:bg-danger-bg [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-txt data-[variant=destructive]:*:[svg]:text-danger-txt!\",\n className,\n )}\n {...props}\n />\n );\n}\n\n/** A menu item with a toggleable checkmark indicator. */\nfunction ContextMenuCheckboxItem({\n className,\n children,\n checked,\n ...props\n}: React.ComponentProps<typeof ContextMenuPrimitive.CheckboxItem>) {\n return (\n <ContextMenuPrimitive.CheckboxItem\n data-slot=\"context-menu-checkbox-item\"\n className={cn(\n \"relative flex min-h-8 cursor-default items-center gap-2 rounded-10 py-1.5 pr-2 pl-8 text-sm leading-5 outline-hidden select-none focus:bg-ghost-hover-bg data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n className,\n )}\n checked={checked}\n {...props}\n >\n <span className=\"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center\">\n <ContextMenuPrimitive.ItemIndicator>\n <CheckIcon className=\"size-4\" />\n </ContextMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </ContextMenuPrimitive.CheckboxItem>\n );\n}\n\n/** A menu item with a radio indicator; use inside `ContextMenuRadioGroup`. */\nfunction ContextMenuRadioItem({\n className,\n children,\n ...props\n}: React.ComponentProps<typeof ContextMenuPrimitive.RadioItem>) {\n return (\n <ContextMenuPrimitive.RadioItem\n data-slot=\"context-menu-radio-item\"\n className={cn(\n \"relative flex min-h-8 cursor-default items-center gap-2 rounded-10 py-1.5 pr-2 pl-8 text-sm leading-5 outline-hidden select-none focus:bg-ghost-hover-bg data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n className,\n )}\n {...props}\n >\n <span className=\"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center\">\n <ContextMenuPrimitive.ItemIndicator>\n <CircleIcon className=\"size-2 fill-current\" />\n </ContextMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </ContextMenuPrimitive.RadioItem>\n );\n}\n\n/** A non-interactive heading that labels a group of items. */\nfunction ContextMenuLabel({\n className,\n inset,\n ...props\n}: React.ComponentProps<typeof ContextMenuPrimitive.Label> & {\n /** Adds left padding so the label aligns with items that have a leading icon. */\n inset?: boolean;\n}) {\n return (\n <ContextMenuPrimitive.Label\n data-slot=\"context-menu-label\"\n data-inset={inset}\n className={cn(\n \"px-2 py-1.5 text-xs leading-4 font-medium text-muted-txt data-[inset]:pl-8\",\n className,\n )}\n {...props}\n />\n );\n}\n\n/** A horizontal divider between groups of items. */\nfunction ContextMenuSeparator({\n className,\n ...props\n}: React.ComponentProps<typeof ContextMenuPrimitive.Separator>) {\n return (\n <ContextMenuPrimitive.Separator\n data-slot=\"context-menu-separator\"\n className={cn(\"my-1 h-px bg-primary-border\", className)}\n {...props}\n />\n );\n}\n\n/** Right-aligned text for a keyboard shortcut hint inside an item. */\nfunction ContextMenuShortcut({ className, ...props }: React.ComponentProps<\"span\">) {\n return (\n <span\n data-slot=\"context-menu-shortcut\"\n className={cn(\"ml-auto text-sm leading-5 text-muted-txt\", className)}\n {...props}\n />\n );\n}\n\nexport {\n ContextMenu,\n ContextMenuTrigger,\n ContextMenuContent,\n ContextMenuItem,\n ContextMenuCheckboxItem,\n ContextMenuRadioItem,\n ContextMenuLabel,\n ContextMenuSeparator,\n ContextMenuShortcut,\n ContextMenuGroup,\n ContextMenuPortal,\n ContextMenuSub,\n ContextMenuSubContent,\n ContextMenuSubTrigger,\n ContextMenuRadioGroup,\n};\n"],"mappings":";;;;;;;AAOA,SAAS,YAAY,EAAE,GAAG,SAAiE;CACzF,OAAO,iBAAA,GAAA,kBAAA,KAACA,SAAAA,YAAqB,MAAtB;EAA2B,aAAU;EAAe,GAAI;CAAQ,CAAA;AACzE;;AAGA,SAAS,mBAAmB,EAC1B,GAAG,SACyD;CAC5D,OAAO,iBAAA,GAAA,kBAAA,KAACA,SAA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SAIF;CACD,OACE,iBAAA,GAAA,kBAAA,KAACJ,SAAAA,YAAqB,OAAtB;EACE,aAAU;EACV,cAAY;EACZ,WAAWC,WAAAA,GACT,8EACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;;AAGA,SAAS,qBAAqB,EAC5B,WACA,GAAG,SAC2D;CAC9D,OACE,iBAAA,GAAA,kBAAA,KAACD,SAAAA,YAAqB,WAAtB;EACE,aAAU;EACV,WAAWC,WAAAA,GAAG,+BAA+B,SAAS;EACtD,GAAI;CACL,CAAA;AAEL;;AAGA,SAAS,oBAAoB,EAAE,WAAW,GAAG,SAAuC;CAClF,OACE,iBAAA,GAAA,kBAAA,KAAC,QAAD;EACE,aAAU;EACV,WAAWA,WAAAA,GAAG,4CAA4C,SAAS;EACnE,GAAI;CACL,CAAA;AAEL"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["ContextMenuPrimitive","cn","Icon","ChevronRightIcon","CheckIcon","CircleIcon"],"sources":["../../../src/primitives/ContextMenu/ContextMenu.tsx"],"sourcesContent":["import { Icon } from \"@/primitives/Icon\";\nimport { CheckIcon, ChevronRightIcon, CircleIcon } from \"lucide-react\";\nimport { ContextMenu as ContextMenuPrimitive } from \"radix-ui\";\nimport type * as React from \"react\";\n\nimport { cn } from \"@/utils\";\n\n/** Root provider for a right-click context menu; wires the trigger to its portalled content. */\nfunction ContextMenu({ ...props }: React.ComponentProps<typeof ContextMenuPrimitive.Root>) {\n return <ContextMenuPrimitive.Root data-slot=\"context-menu\" {...props} />;\n}\n\n/** The target region that opens the menu on right-click (context menu). */\nfunction ContextMenuTrigger({\n ...props\n}: React.ComponentProps<typeof ContextMenuPrimitive.Trigger>) {\n return <ContextMenuPrimitive.Trigger data-slot=\"context-menu-trigger\" {...props} />;\n}\n\n/** Groups related items together for labelling and accessibility. */\nfunction ContextMenuGroup({ ...props }: React.ComponentProps<typeof ContextMenuPrimitive.Group>) {\n return <ContextMenuPrimitive.Group data-slot=\"context-menu-group\" {...props} />;\n}\n\n/** Portals the menu content into the document body. */\nfunction ContextMenuPortal({ ...props }: React.ComponentProps<typeof ContextMenuPrimitive.Portal>) {\n return <ContextMenuPrimitive.Portal data-slot=\"context-menu-portal\" {...props} />;\n}\n\n/** Wraps a nested submenu (pair with `ContextMenuSubTrigger` and `ContextMenuSubContent`). */\nfunction ContextMenuSub({ ...props }: React.ComponentProps<typeof ContextMenuPrimitive.Sub>) {\n return <ContextMenuPrimitive.Sub data-slot=\"context-menu-sub\" {...props} />;\n}\n\n/** Groups `ContextMenuRadioItem`s into a single-select set. */\nfunction ContextMenuRadioGroup({\n ...props\n}: React.ComponentProps<typeof ContextMenuPrimitive.RadioGroup>) {\n return <ContextMenuPrimitive.RadioGroup data-slot=\"context-menu-radio-group\" {...props} />;\n}\n\n/** Item that opens a nested submenu; renders a trailing chevron. */\nfunction ContextMenuSubTrigger({\n className,\n inset,\n children,\n ...props\n}: React.ComponentProps<typeof ContextMenuPrimitive.SubTrigger> & {\n /** Adds left padding so the label aligns with items that have a leading icon. */\n inset?: boolean;\n}) {\n return (\n <ContextMenuPrimitive.SubTrigger\n data-slot=\"context-menu-sub-trigger\"\n data-inset={inset}\n className={cn(\n \"flex min-h-8 cursor-default items-center gap-2 rounded-10 px-2 py-1.5 text-sm leading-5 outline-hidden select-none focus:bg-ghost-hover-bg data-[inset]:pl-8 data-[state=open]:bg-ghost-hover-bg [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-txt\",\n className,\n )}\n {...props}\n >\n {children}\n <Icon as={ChevronRightIcon} className=\"ml-auto size-4\" />\n </ContextMenuPrimitive.SubTrigger>\n );\n}\n\n/** The popover surface for a nested submenu. */\nfunction ContextMenuSubContent({\n className,\n ...props\n}: React.ComponentProps<typeof ContextMenuPrimitive.SubContent>) {\n return (\n <ContextMenuPrimitive.SubContent\n data-slot=\"context-menu-sub-content\"\n className={cn(\n \"z-50 min-w-32 origin-(--radix-context-menu-content-transform-origin) overflow-hidden rounded-12 border border-primary-border bg-glass-none-bg p-2 text-primary-txt shadow-sm data-[side=bottom]:slide-in-from-top-8 data-[side=left]:slide-in-from-right-8 data-[side=right]:slide-in-from-left-8 data-[side=top]:slide-in-from-bottom-8 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95\",\n // Vertical hierarchy: if any item reserves the 32px indicator column\n // (checkbox/radio items), plain items, labels and sub-triggers share it.\n \"[&:has([role=menuitemcheckbox],[role=menuitemradio])_[data-slot=context-menu-item]:not([data-inset])]:pl-8\",\n \"[&:has([role=menuitemcheckbox],[role=menuitemradio])_[data-slot=context-menu-label]:not([data-inset])]:pl-8\",\n \"[&:has([role=menuitemcheckbox],[role=menuitemradio])_[data-slot=context-menu-sub-trigger]:not([data-inset])]:pl-8\",\n className,\n )}\n {...props}\n />\n );\n}\n\n/** The portalled popover surface that holds the menu items. */\nfunction ContextMenuContent({\n className,\n ...props\n}: React.ComponentProps<typeof ContextMenuPrimitive.Content>) {\n return (\n <ContextMenuPrimitive.Portal>\n <ContextMenuPrimitive.Content\n data-slot=\"context-menu-content\"\n className={cn(\n \"z-50 max-h-(--radix-context-menu-content-available-height) min-w-32 origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-12 border border-primary-border bg-glass-none-bg p-2 text-primary-txt shadow-sm data-[side=bottom]:slide-in-from-top-8 data-[side=left]:slide-in-from-right-8 data-[side=right]:slide-in-from-left-8 data-[side=top]:slide-in-from-bottom-8 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95\",\n // Vertical hierarchy: if any item reserves the 32px indicator column\n // (checkbox/radio items), plain items, labels and sub-triggers share it.\n \"[&:has([role=menuitemcheckbox],[role=menuitemradio])_[data-slot=context-menu-item]:not([data-inset])]:pl-8\",\n \"[&:has([role=menuitemcheckbox],[role=menuitemradio])_[data-slot=context-menu-label]:not([data-inset])]:pl-8\",\n \"[&:has([role=menuitemcheckbox],[role=menuitemradio])_[data-slot=context-menu-sub-trigger]:not([data-inset])]:pl-8\",\n className,\n )}\n {...props}\n />\n </ContextMenuPrimitive.Portal>\n );\n}\n\n/** A selectable menu item; supports a `destructive` variant and `inset` alignment. */\nfunction ContextMenuItem({\n className,\n inset,\n variant = \"default\",\n ...props\n}: React.ComponentProps<typeof ContextMenuPrimitive.Item> & {\n /** Adds left padding so the label aligns with items that have a leading icon. */\n inset?: boolean;\n /** Visual intent; `destructive` colours the item with the danger palette. */\n variant?: \"default\" | \"destructive\";\n}) {\n return (\n <ContextMenuPrimitive.Item\n data-slot=\"context-menu-item\"\n data-inset={inset}\n data-variant={variant}\n className={cn(\n \"relative flex min-h-8 cursor-default items-center gap-2 rounded-10 px-2 py-1.5 text-sm leading-5 outline-hidden select-none focus:bg-ghost-hover-bg data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 data-[variant=destructive]:text-danger-txt data-[variant=destructive]:focus:bg-danger-bg [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-txt data-[variant=destructive]:*:[svg]:text-danger-txt!\",\n className,\n )}\n {...props}\n />\n );\n}\n\n/** A menu item with a toggleable checkmark indicator. */\nfunction ContextMenuCheckboxItem({\n className,\n children,\n checked,\n ...props\n}: React.ComponentProps<typeof ContextMenuPrimitive.CheckboxItem>) {\n return (\n <ContextMenuPrimitive.CheckboxItem\n data-slot=\"context-menu-checkbox-item\"\n className={cn(\n \"relative flex min-h-8 cursor-default items-center gap-2 rounded-10 py-1.5 pr-2 pl-8 text-sm leading-5 outline-hidden select-none focus:bg-ghost-hover-bg data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n className,\n )}\n checked={checked}\n {...props}\n >\n <span className=\"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center\">\n <ContextMenuPrimitive.ItemIndicator>\n <Icon as={CheckIcon} className=\"size-4\" />\n </ContextMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </ContextMenuPrimitive.CheckboxItem>\n );\n}\n\n/** A menu item with a radio indicator; use inside `ContextMenuRadioGroup`. */\nfunction ContextMenuRadioItem({\n className,\n children,\n ...props\n}: React.ComponentProps<typeof ContextMenuPrimitive.RadioItem>) {\n return (\n <ContextMenuPrimitive.RadioItem\n data-slot=\"context-menu-radio-item\"\n className={cn(\n \"relative flex min-h-8 cursor-default items-center gap-2 rounded-10 py-1.5 pr-2 pl-8 text-sm leading-5 outline-hidden select-none focus:bg-ghost-hover-bg data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n className,\n )}\n {...props}\n >\n <span className=\"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center\">\n <ContextMenuPrimitive.ItemIndicator>\n <Icon as={CircleIcon} className=\"size-2 fill-current\" />\n </ContextMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </ContextMenuPrimitive.RadioItem>\n );\n}\n\n/** A non-interactive heading that labels a group of items. */\nfunction ContextMenuLabel({\n className,\n inset,\n ...props\n}: React.ComponentProps<typeof ContextMenuPrimitive.Label> & {\n /** Adds left padding so the label aligns with items that have a leading icon. */\n inset?: boolean;\n}) {\n return (\n <ContextMenuPrimitive.Label\n data-slot=\"context-menu-label\"\n data-inset={inset}\n className={cn(\n \"px-2 py-1.5 text-xs leading-4 font-medium text-muted-txt data-[inset]:pl-8\",\n className,\n )}\n {...props}\n />\n );\n}\n\n/** A horizontal divider between groups of items. */\nfunction ContextMenuSeparator({\n className,\n ...props\n}: React.ComponentProps<typeof ContextMenuPrimitive.Separator>) {\n return (\n <ContextMenuPrimitive.Separator\n data-slot=\"context-menu-separator\"\n className={cn(\"my-1 h-px bg-primary-border\", className)}\n {...props}\n />\n );\n}\n\n/** Right-aligned text for a keyboard shortcut hint inside an item. */\nfunction ContextMenuShortcut({ className, ...props }: React.ComponentProps<\"span\">) {\n return (\n <span\n data-slot=\"context-menu-shortcut\"\n className={cn(\"ml-auto text-sm leading-5 text-muted-txt\", className)}\n {...props}\n />\n );\n}\n\nexport {\n ContextMenu,\n ContextMenuTrigger,\n ContextMenuContent,\n ContextMenuItem,\n ContextMenuCheckboxItem,\n ContextMenuRadioItem,\n ContextMenuLabel,\n ContextMenuSeparator,\n ContextMenuShortcut,\n ContextMenuGroup,\n ContextMenuPortal,\n ContextMenuSub,\n ContextMenuSubContent,\n ContextMenuSubTrigger,\n ContextMenuRadioGroup,\n};\n"],"mappings":";;;;;;;;AAQA,SAAS,YAAY,EAAE,GAAG,SAAiE;CACzF,OAAO,iBAAA,GAAA,kBAAA,KAACA,SAAAA,YAAqB,MAAtB;EAA2B,aAAU;EAAe,GAAI;CAAQ,CAAA;AACzE;;AAGA,SAAS,mBAAmB,EAC1B,GAAG,SACyD;CAC5D,OAAO,iBAAA,GAAA,kBAAA,KAACA,SAAAA,YAAqB,SAAtB;EAA8B,aAAU;EAAuB,GAAI;CAAQ,CAAA;AACpF;;AAGA,SAAS,iBAAiB,EAAE,GAAG,SAAkE;CAC/F,OAAO,iBAAA,GAAA,kBAAA,KAACA,SAAAA,YAAqB,OAAtB;EAA4B,aAAU;EAAqB,GAAI;CAAQ,CAAA;AAChF;;AAGA,SAAS,kBAAkB,EAAE,GAAG,SAAmE;CACjG,OAAO,iBAAA,GAAA,kBAAA,KAACA,SAAAA,YAAqB,QAAtB;EAA6B,aAAU;EAAsB,GAAI;CAAQ,CAAA;AAClF;;AAGA,SAAS,eAAe,EAAE,GAAG,SAAgE;CAC3F,OAAO,iBAAA,GAAA,kBAAA,KAACA,SAAAA,YAAqB,KAAtB;EAA0B,aAAU;EAAmB,GAAI;CAAQ,CAA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