@psnext/design-system 2.2.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 +214 -108
- package/dist/Header.cjs.map +1 -1
- package/dist/Header.js +214 -108
- 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 +7 -7
- package/dist/index10.d.ts.map +1 -1
- 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 +11 -11
- package/dist/index12.d.ts +13 -13
- package/dist/index12.d.ts.map +1 -1
- 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.cts.map +1 -1
- 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 +7 -7
- 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.cts.map +1 -1
- 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 +15 -15
- 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 +4 -4
- package/dist/index28.d.ts +6 -6
- package/dist/index28.d.ts.map +1 -1
- package/dist/index29.d.cts +4 -4
- package/dist/index29.d.cts.map +1 -1
- 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.ts +13 -13
- package/dist/index30.d.cts +42 -13
- package/dist/index30.d.cts.map +1 -1
- package/dist/index30.d.ts +43 -14
- 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 +6 -6
- package/dist/index32.d.cts.map +1 -1
- package/dist/index32.d.ts +6 -6
- package/dist/index33.d.cts +11 -11
- package/dist/index33.d.cts.map +1 -1
- package/dist/index33.d.ts +12 -12
- 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 +15 -15
- package/dist/index35.d.cts.map +1 -1
- package/dist/index35.d.ts +16 -16
- package/dist/index35.d.ts.map +1 -1
- package/dist/index36.d.cts +3 -3
- 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 +6 -6
- package/dist/index38.d.cts +2 -2
- 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/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/index42.d.ts.map +1 -1
- 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/index5.d.ts.map +1 -1
- 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 +26 -26
- package/dist/index53.d.cts.map +1 -1
- package/dist/index53.d.ts +27 -27
- 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/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.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/index6.d.cts +6 -6
- package/dist/index6.d.cts.map +1 -1
- package/dist/index6.d.ts +6 -6
- package/dist/index6.d.ts.map +1 -1
- package/dist/index60.d.cts +9 -9
- package/dist/index60.d.cts.map +1 -1
- package/dist/index60.d.ts +13 -13
- package/dist/index60.d.ts.map +1 -1
- package/dist/index61.d.cts +5 -5
- package/dist/index61.d.ts +6 -6
- package/dist/index62.d.cts +5 -5
- package/dist/index62.d.ts +5 -5
- package/dist/index62.d.ts.map +1 -1
- package/dist/index63.d.cts +2 -2
- package/dist/index63.d.cts.map +1 -1
- package/dist/index63.d.ts +2 -2
- package/dist/index63.d.ts.map +1 -1
- package/dist/index64.d.cts +6 -6
- package/dist/index64.d.cts.map +1 -1
- package/dist/index64.d.ts +7 -7
- package/dist/index65.d.cts +3 -3
- package/dist/index65.d.ts +4 -4
- package/dist/index65.d.ts.map +1 -1
- package/dist/index66.d.cts +4 -4
- package/dist/index66.d.cts.map +1 -1
- package/dist/index66.d.ts +6 -6
- package/dist/index66.d.ts.map +1 -1
- 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 -258
- package/dist/index71.d.cts.map +1 -1
- package/dist/index71.d.ts +77 -258
- 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 +5 -5
- package/dist/index8.d.ts +5 -5
- package/dist/index8.d.ts.map +1 -1
- package/dist/index9.d.cts +2 -2
- package/dist/index9.d.cts.map +1 -1
- package/dist/index9.d.ts +2 -2
- 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/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 +14 -14
- 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/SectionCard/index.d.ts.map +1 -1
- package/dist/patterns/SectionHeading/index.d.cts +2 -2
- package/dist/patterns/SectionHeading/index.d.ts +2 -2
- package/dist/patterns/SectionHeading/index.d.ts.map +1 -1
- 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
package/dist/Header.cjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const require_chunk = require("./chunk.cjs");
|
|
2
2
|
const require_cn = require("./cn.cjs");
|
|
3
|
+
const require_Icon = require("./Icon.cjs");
|
|
3
4
|
const require_primitives_Button_index = require("./primitives/Button/index.cjs");
|
|
4
5
|
const require_primitives_Avatar_index = require("./primitives/Avatar/index.cjs");
|
|
5
6
|
const require_primitives_Credits_index = require("./primitives/Credits/index.cjs");
|
|
@@ -12,8 +13,8 @@ const require_primitives_ThemeProvider_index = require("./primitives/ThemeProvid
|
|
|
12
13
|
let react = require("react");
|
|
13
14
|
let react$1 = require_chunk.__toESM(react, 1);
|
|
14
15
|
react = require_chunk.__toESM(react);
|
|
15
|
-
let lucide_react = require("lucide-react");
|
|
16
16
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
17
|
+
let lucide_react = require("lucide-react");
|
|
17
18
|
let _tanstack_react_query = require("@tanstack/react-query");
|
|
18
19
|
//#region src/patterns/Header/project-tree.ts
|
|
19
20
|
/** True when a node with the given id exists anywhere in the tree. */
|
|
@@ -28,6 +29,14 @@ function findProjectName(tree, id) {
|
|
|
28
29
|
if (found) return found;
|
|
29
30
|
}
|
|
30
31
|
}
|
|
32
|
+
/** First selectable node in the tree (depth-first, skipping context-only ancestors). */
|
|
33
|
+
function firstSelectableProject(tree) {
|
|
34
|
+
for (const node of tree) {
|
|
35
|
+
if (!node.isContextOnly) return node;
|
|
36
|
+
const found = firstSelectableProject(node.children);
|
|
37
|
+
if (found) return found;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
31
40
|
/** Filter the tree to nodes matching `term`, preserving ancestors of matches. */
|
|
32
41
|
function filterTree(nodes, term) {
|
|
33
42
|
if (!term) return nodes;
|
|
@@ -69,7 +78,10 @@ function ProjectPicker({ projectsTree, selectedProjectId, selectedProjectName, o
|
|
|
69
78
|
children: [projectLabel, ":"]
|
|
70
79
|
}),
|
|
71
80
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives_Skeleton_index.Skeleton, { className: "h-3 flex-1" }),
|
|
72
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
81
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Icon.Icon, {
|
|
82
|
+
as: lucide_react.ChevronDown,
|
|
83
|
+
className: "size-4 shrink-0 text-muted-txt opacity-40"
|
|
84
|
+
})
|
|
73
85
|
]
|
|
74
86
|
});
|
|
75
87
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_primitives_Popover_index.Popover, {
|
|
@@ -90,7 +102,10 @@ function ProjectPicker({ projectsTree, selectedProjectId, selectedProjectName, o
|
|
|
90
102
|
className: require_cn.cn("max-w-36 truncate", selectedName ? "font-medium" : "text-muted-txt"),
|
|
91
103
|
children: selectedName ?? projectPlaceholder
|
|
92
104
|
}),
|
|
93
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
105
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Icon.Icon, {
|
|
106
|
+
as: lucide_react.ChevronDown,
|
|
107
|
+
className: "ml-1 size-4 shrink-0 text-muted-txt"
|
|
108
|
+
})
|
|
94
109
|
]
|
|
95
110
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_primitives_Popover_index.PopoverContent, {
|
|
96
111
|
align: "start",
|
|
@@ -101,7 +116,10 @@ function ProjectPicker({ projectsTree, selectedProjectId, selectedProjectName, o
|
|
|
101
116
|
className: "border-b p-2",
|
|
102
117
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
103
118
|
className: "relative",
|
|
104
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
119
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Icon.Icon, {
|
|
120
|
+
as: lucide_react.Search,
|
|
121
|
+
className: "absolute top-1/2 left-2.5 size-3.5 -translate-y-1/2 text-muted-txt"
|
|
122
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives_Input_index.Input, {
|
|
105
123
|
size: "sm",
|
|
106
124
|
className: "pl-8",
|
|
107
125
|
placeholder: searchPlaceholder,
|
|
@@ -143,7 +161,13 @@ function TreeNode({ node, depth, selectedId, onSelect, collapsedIds, onToggleCol
|
|
|
143
161
|
"aria-label": isCollapsed ? `Expand ${node.name}` : `Collapse ${node.name}`,
|
|
144
162
|
onClick: () => onToggleCollapse(node.id),
|
|
145
163
|
className: "shrink-0 text-muted-txt hover:text-primary-txt",
|
|
146
|
-
children: isCollapsed ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
164
|
+
children: isCollapsed ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Icon.Icon, {
|
|
165
|
+
as: lucide_react.ChevronRight,
|
|
166
|
+
className: "size-3.5"
|
|
167
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Icon.Icon, {
|
|
168
|
+
as: lucide_react.ChevronDown,
|
|
169
|
+
className: "size-3.5"
|
|
170
|
+
})
|
|
147
171
|
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "inline-block w-3.5 shrink-0" }),
|
|
148
172
|
node.isContextOnly ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
149
173
|
className: "flex-1 text-left",
|
|
@@ -154,7 +178,10 @@ function TreeNode({ node, depth, selectedId, onSelect, collapsedIds, onToggleCol
|
|
|
154
178
|
className: "flex-1 text-left",
|
|
155
179
|
children: node.name
|
|
156
180
|
}),
|
|
157
|
-
isSelected && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
181
|
+
isSelected && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Icon.Icon, {
|
|
182
|
+
as: lucide_react.Check,
|
|
183
|
+
className: "ml-auto size-3.5 shrink-0 text-primary"
|
|
184
|
+
})
|
|
158
185
|
]
|
|
159
186
|
}), !isCollapsed && hasChildren && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
160
187
|
role: "group",
|
|
@@ -179,16 +206,14 @@ const DEFAULT_LABELS = {
|
|
|
179
206
|
searchPlaceholder: "Search project",
|
|
180
207
|
emptyStateText: "No projects found",
|
|
181
208
|
profileMenuLabel: "Profile menu",
|
|
182
|
-
logoutLabel: "Logout"
|
|
183
|
-
overlayTitle: "Select a Project",
|
|
184
|
-
overlayDescription: "Choose a project to get started. You can change it anytime from the header."
|
|
209
|
+
logoutLabel: "Logout"
|
|
185
210
|
};
|
|
186
|
-
|
|
187
|
-
|
|
211
|
+
/** Hard cap on project pages fetched — guards against a runaway loop. */
|
|
212
|
+
const PROJECTS_MAX_PAGES = 40;
|
|
188
213
|
const PATHS = {
|
|
189
214
|
token: "/api/v1/studio-auth/sessions/token",
|
|
190
215
|
logout: "/api/v1/studio-auth/sessions/logout",
|
|
191
|
-
projects: (clientId) => `/api/v1/
|
|
216
|
+
projects: (clientId) => `/api/v1/client-projects/getAllProjects?limit=50&page=1&sort=name&sortOrder=ASC&clientId=${encodeURIComponent(clientId)}&metaData=true`,
|
|
192
217
|
credits: "/save/api/v1/users"
|
|
193
218
|
};
|
|
194
219
|
/** Join a base URL and path without doubling slashes. */
|
|
@@ -209,16 +234,77 @@ async function fetchToken(endpoints, fetcher) {
|
|
|
209
234
|
const { accessToken } = await res.json();
|
|
210
235
|
return accessToken;
|
|
211
236
|
}
|
|
237
|
+
/**
|
|
238
|
+
* Return `url` with the `page` query param set to the given page (and `limit`
|
|
239
|
+
* backfilled when absent). Pagination stays owned by the header: host-provided
|
|
240
|
+
* endpoint URLs don't need — and can't break — the paging params. Handles
|
|
241
|
+
* absolute and relative URLs.
|
|
242
|
+
*/
|
|
243
|
+
function withPageParam(url, page) {
|
|
244
|
+
const isAbsolute = /^[a-z][a-z0-9+.-]*:\/\//i.test(url);
|
|
245
|
+
try {
|
|
246
|
+
const u = new URL(url, isAbsolute ? void 0 : "http://relative.invalid");
|
|
247
|
+
u.searchParams.set("page", String(page));
|
|
248
|
+
if (!u.searchParams.has("limit")) u.searchParams.set("limit", String(50));
|
|
249
|
+
return isAbsolute ? u.toString() : `${u.pathname}${u.search}${u.hash}`;
|
|
250
|
+
} catch {
|
|
251
|
+
return url;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
/** The `limit` query param already on a URL, else the default page size. */
|
|
255
|
+
function readLimitParam(url) {
|
|
256
|
+
try {
|
|
257
|
+
const limit = Number(new URL(url, "http://relative.invalid").searchParams.get("limit"));
|
|
258
|
+
return Number.isInteger(limit) && limit > 0 ? limit : 50;
|
|
259
|
+
} catch {
|
|
260
|
+
return 50;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
/** Total node count in a tree page (roots + descendants). */
|
|
264
|
+
function countNodes(tree) {
|
|
265
|
+
return tree.reduce((sum, node) => sum + 1 + countNodes(node.children ?? []), 0);
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Merge a page's tree into the accumulated tree. Nodes repeated across pages
|
|
269
|
+
* (e.g. a context-only ancestor whose children span a page boundary) are
|
|
270
|
+
* merged by id instead of duplicated.
|
|
271
|
+
*/
|
|
272
|
+
function mergeTrees(into, page) {
|
|
273
|
+
for (const node of page) {
|
|
274
|
+
const existing = into.find((n) => n.id === node.id);
|
|
275
|
+
if (existing) mergeTrees(existing.children, node.children ?? []);
|
|
276
|
+
else into.push({
|
|
277
|
+
...node,
|
|
278
|
+
children: [...node.children ?? []]
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Fetch ALL pages of the paginated projects endpoint and merge them into a
|
|
284
|
+
* single tree, so users with more projects than one page still see everything.
|
|
285
|
+
* The response carries no pagination metadata, so the first page that comes
|
|
286
|
+
* back with fewer than `limit` nodes is treated as the last one.
|
|
287
|
+
*/
|
|
212
288
|
async function fetchProjects(endpoints, clientId, accessToken, fetcher) {
|
|
213
|
-
const
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
289
|
+
const projectsTree = [];
|
|
290
|
+
let organizationName;
|
|
291
|
+
const baseUrl = endpoints.projects(clientId);
|
|
292
|
+
const pageLimit = readLimitParam(baseUrl);
|
|
293
|
+
for (let page = 1; page <= PROJECTS_MAX_PAGES; page++) {
|
|
294
|
+
const res = await fetcher(withPageParam(baseUrl, page), {
|
|
295
|
+
credentials: "include",
|
|
296
|
+
headers: { Authorization: `Bearer ${accessToken}` }
|
|
297
|
+
});
|
|
298
|
+
if (!res.ok) throw new Error(`projects request failed: ${res.status}`);
|
|
299
|
+
const body = await res.json();
|
|
300
|
+
const pageTree = body.response?.data?.projectsTree ?? [];
|
|
301
|
+
mergeTrees(projectsTree, pageTree);
|
|
302
|
+
organizationName ??= body.response?.data?.organization?.name;
|
|
303
|
+
if (countNodes(pageTree) < pageLimit) break;
|
|
304
|
+
}
|
|
219
305
|
return {
|
|
220
|
-
projectsTree
|
|
221
|
-
organizationName
|
|
306
|
+
projectsTree,
|
|
307
|
+
organizationName
|
|
222
308
|
};
|
|
223
309
|
}
|
|
224
310
|
async function fetchCredits(endpoints, accessToken, fetcher) {
|
|
@@ -242,6 +328,8 @@ async function callLogout(endpoints, fetcher) {
|
|
|
242
328
|
//#endregion
|
|
243
329
|
//#region src/patterns/Header/storage.ts
|
|
244
330
|
const PROJECT_KEY = "ds-header-project";
|
|
331
|
+
const LAST_PROJECT_KEY = "lastSelectedProject";
|
|
332
|
+
const PROJECTS_CACHE_KEY = "ds-header-projects-cache";
|
|
245
333
|
function getStoredProject() {
|
|
246
334
|
try {
|
|
247
335
|
const raw = sessionStorage.getItem(PROJECT_KEY);
|
|
@@ -260,6 +348,52 @@ function clearStoredProject() {
|
|
|
260
348
|
sessionStorage.removeItem(PROJECT_KEY);
|
|
261
349
|
} catch {}
|
|
262
350
|
}
|
|
351
|
+
/** The project the user last explicitly selected, in any tab (localStorage). */
|
|
352
|
+
function getLastSelectedProject() {
|
|
353
|
+
try {
|
|
354
|
+
const raw = localStorage.getItem(LAST_PROJECT_KEY);
|
|
355
|
+
return raw ? JSON.parse(raw) : null;
|
|
356
|
+
} catch {
|
|
357
|
+
return null;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
function setLastSelectedProject(project) {
|
|
361
|
+
try {
|
|
362
|
+
localStorage.setItem(LAST_PROJECT_KEY, JSON.stringify(project));
|
|
363
|
+
} catch {}
|
|
364
|
+
}
|
|
365
|
+
function projectsCacheKey(clientId, userId) {
|
|
366
|
+
return `${PROJECTS_CACHE_KEY}:${clientId}:${userId}`;
|
|
367
|
+
}
|
|
368
|
+
/** The session-cached projects result for this client + user, or null on miss. */
|
|
369
|
+
function getCachedProjects(clientId, userId) {
|
|
370
|
+
try {
|
|
371
|
+
const raw = sessionStorage.getItem(projectsCacheKey(clientId, userId));
|
|
372
|
+
if (!raw) return null;
|
|
373
|
+
const cached = JSON.parse(raw);
|
|
374
|
+
if (!Array.isArray(cached.projectsTree)) return null;
|
|
375
|
+
return {
|
|
376
|
+
projectsTree: cached.projectsTree,
|
|
377
|
+
organizationName: cached.organizationName
|
|
378
|
+
};
|
|
379
|
+
} catch {
|
|
380
|
+
return null;
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
function setCachedProjects(clientId, userId, data) {
|
|
384
|
+
try {
|
|
385
|
+
sessionStorage.setItem(projectsCacheKey(clientId, userId), JSON.stringify(data));
|
|
386
|
+
} catch {}
|
|
387
|
+
}
|
|
388
|
+
/** Drop every cached projects entry (all clients/users) — used on logout. */
|
|
389
|
+
function clearCachedProjects() {
|
|
390
|
+
try {
|
|
391
|
+
for (let i = sessionStorage.length - 1; i >= 0; i--) {
|
|
392
|
+
const key = sessionStorage.key(i);
|
|
393
|
+
if (key?.startsWith(PROJECTS_CACHE_KEY)) sessionStorage.removeItem(key);
|
|
394
|
+
}
|
|
395
|
+
} catch {}
|
|
396
|
+
}
|
|
263
397
|
//#endregion
|
|
264
398
|
//#region src/patterns/Header/header-store.ts
|
|
265
399
|
function initialState() {
|
|
@@ -295,14 +429,22 @@ const headerStore = {
|
|
|
295
429
|
getServerSnapshot() {
|
|
296
430
|
return SERVER_SNAPSHOT;
|
|
297
431
|
},
|
|
298
|
-
/**
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
432
|
+
/**
|
|
433
|
+
* Set the selected project. `name` is best-effort; the Header backfills it from
|
|
434
|
+
* the tree. Explicit selections are also remembered in localStorage as the
|
|
435
|
+
* cross-tab default; pass `remember: false` for internal backfill/auto-select
|
|
436
|
+
* writes so they don't overwrite the user's last explicit choice.
|
|
437
|
+
*/
|
|
438
|
+
setProject(id, name = "", clientId, { remember = true } = {}) {
|
|
439
|
+
if (id) {
|
|
440
|
+
const project = {
|
|
441
|
+
id,
|
|
442
|
+
name,
|
|
443
|
+
clientId: clientId ?? state.clientId
|
|
444
|
+
};
|
|
445
|
+
setStoredProject(project);
|
|
446
|
+
if (remember) setLastSelectedProject(project);
|
|
447
|
+
} else clearStoredProject();
|
|
306
448
|
state = {
|
|
307
449
|
...state,
|
|
308
450
|
selectedProjectId: id,
|
|
@@ -435,7 +577,7 @@ function isSessionValid(environmentId) {
|
|
|
435
577
|
const TOGGLE_PROJECT_DROPDOWN_EVENT = "toggle-project-dropdown";
|
|
436
578
|
const DEFAULT_STALE_TIME = 5 * 6e4;
|
|
437
579
|
const DEFAULT_GC_TIME = 10 * 6e4;
|
|
438
|
-
function useGlobalHeader({ apiBaseUrl, environmentId, clientId, _dangerouslyInjectAccessToken: injectedToken, showProjectDropdown = false, showProfile = false, showOrg = false, showCredits = false, endpoints: endpointOverrides, fetcher: fetcherProp, staleTime = DEFAULT_STALE_TIME, gcTime = DEFAULT_GC_TIME, onProjectChange }) {
|
|
580
|
+
function useGlobalHeader({ apiBaseUrl, environmentId, clientId, defaultProjectId, _dangerouslyInjectAccessToken: injectedToken, showProjectDropdown = false, showProfile = false, showOrg = false, showCredits = false, endpoints: endpointOverrides, fetcher: fetcherProp, staleTime = DEFAULT_STALE_TIME, gcTime = DEFAULT_GC_TIME, onProjectChange }) {
|
|
439
581
|
const fetcher = react$1.useMemo(() => fetcherProp ?? ((input, init) => fetch(input, init)), [fetcherProp]);
|
|
440
582
|
const endpoints = react$1.useMemo(() => buildEndpoints(apiBaseUrl, endpointOverrides), [apiBaseUrl, endpointOverrides]);
|
|
441
583
|
const isAuthenticated = isSessionValid(environmentId);
|
|
@@ -453,15 +595,25 @@ function useGlobalHeader({ apiBaseUrl, environmentId, clientId, _dangerouslyInje
|
|
|
453
595
|
});
|
|
454
596
|
const token = injectedToken ?? tokenQuery.data;
|
|
455
597
|
const effectiveClientId = clientId ?? claims?.clientId;
|
|
598
|
+
const wantsProjects = showProjectDropdown || showOrg;
|
|
599
|
+
const userId = claims?.userId ?? "";
|
|
456
600
|
const projectsQuery = (0, _tanstack_react_query.useQuery)({
|
|
457
601
|
queryKey: [
|
|
458
602
|
"ds-header",
|
|
459
603
|
"projects",
|
|
460
604
|
effectiveClientId,
|
|
605
|
+
userId,
|
|
461
606
|
token
|
|
462
607
|
],
|
|
463
|
-
queryFn: () =>
|
|
464
|
-
|
|
608
|
+
queryFn: async () => {
|
|
609
|
+
const id = effectiveClientId;
|
|
610
|
+
const cached = getCachedProjects(id, userId);
|
|
611
|
+
if (cached) return cached;
|
|
612
|
+
const fresh = await fetchProjects(endpoints, id, token, fetcher);
|
|
613
|
+
setCachedProjects(id, userId, fresh);
|
|
614
|
+
return fresh;
|
|
615
|
+
},
|
|
616
|
+
enabled: isAuthenticated && !!token && !!effectiveClientId && wantsProjects,
|
|
465
617
|
staleTime,
|
|
466
618
|
gcTime
|
|
467
619
|
});
|
|
@@ -487,6 +639,10 @@ function useGlobalHeader({ apiBaseUrl, environmentId, clientId, _dangerouslyInje
|
|
|
487
639
|
}
|
|
488
640
|
}, [apiBaseUrl]);
|
|
489
641
|
const selection = useHeaderStore();
|
|
642
|
+
const onProjectChangeRef = react$1.useRef(onProjectChange);
|
|
643
|
+
react$1.useEffect(() => {
|
|
644
|
+
onProjectChangeRef.current = onProjectChange;
|
|
645
|
+
});
|
|
490
646
|
react$1.useEffect(() => {
|
|
491
647
|
if (effectiveClientId) headerStore.reconcileClient(effectiveClientId);
|
|
492
648
|
}, [effectiveClientId]);
|
|
@@ -494,13 +650,29 @@ function useGlobalHeader({ apiBaseUrl, environmentId, clientId, _dangerouslyInje
|
|
|
494
650
|
if (!projectsQuery.data) return;
|
|
495
651
|
const tree = projectsQuery.data.projectsTree;
|
|
496
652
|
const id = headerStore.getSnapshot().selectedProjectId;
|
|
497
|
-
if (id &&
|
|
498
|
-
else if (id) {
|
|
653
|
+
if (id && nodeExistsInTree(tree, id)) {
|
|
499
654
|
const name = findProjectName(tree, id);
|
|
500
|
-
if (name && name !== headerStore.getSnapshot().selectedProjectName) headerStore.setProject(id, name, effectiveClientId);
|
|
655
|
+
if (name && name !== headerStore.getSnapshot().selectedProjectName) headerStore.setProject(id, name, effectiveClientId, { remember: false });
|
|
656
|
+
} else {
|
|
657
|
+
const last = getLastSelectedProject();
|
|
658
|
+
const fallback = last && nodeExistsInTree(tree, last.id) ? {
|
|
659
|
+
id: last.id,
|
|
660
|
+
name: findProjectName(tree, last.id) ?? last.name
|
|
661
|
+
} : defaultProjectId && nodeExistsInTree(tree, defaultProjectId) ? {
|
|
662
|
+
id: defaultProjectId,
|
|
663
|
+
name: findProjectName(tree, defaultProjectId) ?? ""
|
|
664
|
+
} : firstSelectableProject(tree);
|
|
665
|
+
if (fallback) {
|
|
666
|
+
headerStore.setProject(fallback.id, fallback.name, effectiveClientId, { remember: false });
|
|
667
|
+
onProjectChangeRef.current?.(fallback.id);
|
|
668
|
+
} else if (id) headerStore.clearProject();
|
|
501
669
|
}
|
|
502
670
|
headerStore.setOrganization(projectsQuery.data.organizationName, effectiveClientId);
|
|
503
|
-
}, [
|
|
671
|
+
}, [
|
|
672
|
+
projectsQuery.data,
|
|
673
|
+
effectiveClientId,
|
|
674
|
+
defaultProjectId
|
|
675
|
+
]);
|
|
504
676
|
react$1.useEffect(() => {
|
|
505
677
|
if (creditsQuery.data !== void 0) headerStore.setCredits(creditsQuery.data);
|
|
506
678
|
}, [creditsQuery.data]);
|
|
@@ -511,6 +683,7 @@ function useGlobalHeader({ apiBaseUrl, environmentId, clientId, _dangerouslyInje
|
|
|
511
683
|
};
|
|
512
684
|
const logout = () => {
|
|
513
685
|
headerStore.clearProject();
|
|
686
|
+
clearCachedProjects();
|
|
514
687
|
callLogout(endpoints, fetcher);
|
|
515
688
|
};
|
|
516
689
|
const [projectDropdownVisible, setProjectDropdownVisible] = react$1.useState(showProjectDropdown);
|
|
@@ -535,7 +708,6 @@ function useGlobalHeader({ apiBaseUrl, environmentId, clientId, _dangerouslyInje
|
|
|
535
708
|
credits: selection.credits,
|
|
536
709
|
creditsHref,
|
|
537
710
|
projectDropdownVisible,
|
|
538
|
-
showOverlay: isAuthenticated && projectDropdownVisible && !selection.selectedProjectId,
|
|
539
711
|
selectProject,
|
|
540
712
|
logout
|
|
541
713
|
};
|
|
@@ -647,7 +819,7 @@ function Header(props) {
|
|
|
647
819
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(HeaderInner, { ...props })
|
|
648
820
|
});
|
|
649
821
|
}
|
|
650
|
-
function HeaderInner({ logoType, logoHref, showOrg = false, showProjectDropdown = false, showProfile = false, showThemeSwitcher = false, showCredits = false, pageTitle, feedbackUrl, logoAddon,
|
|
822
|
+
function HeaderInner({ logoType, logoHref, showOrg = false, showProjectDropdown = false, showProfile = false, showThemeSwitcher = false, showCredits = false, pageTitle, feedbackUrl, logoAddon, actionsStart, actionsEnd, className, ...rest }) {
|
|
651
823
|
const { product } = require_primitives_ThemeProvider_index.useTheme();
|
|
652
824
|
const brand = logoType ?? product;
|
|
653
825
|
const state = useGlobalHeader({
|
|
@@ -661,8 +833,8 @@ function HeaderInner({ logoType, logoHref, showOrg = false, showProjectDropdown
|
|
|
661
833
|
const showOrgUi = showOrg && state.isAuthenticated;
|
|
662
834
|
const showProfileUi = showProfile && state.isAuthenticated;
|
|
663
835
|
const showCreditsUi = showCredits && state.isAuthenticated && state.credits !== void 0;
|
|
664
|
-
const showActions = showThemeSwitcher || showProfileUi || showCreditsUi || !!feedbackUrl;
|
|
665
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(
|
|
836
|
+
const showActions = showThemeSwitcher || showProfileUi || showCreditsUi || !!feedbackUrl || !!actionsStart || !!actionsEnd;
|
|
837
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(HeaderBar, {
|
|
666
838
|
className,
|
|
667
839
|
children: [
|
|
668
840
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(HeaderLogo, {
|
|
@@ -696,6 +868,7 @@ function HeaderInner({ logoType, logoHref, showOrg = false, showProjectDropdown
|
|
|
696
868
|
showActions && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
697
869
|
className: "ml-auto flex items-center gap-2",
|
|
698
870
|
children: [
|
|
871
|
+
actionsStart,
|
|
699
872
|
feedbackUrl && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives_Button_index.Button, {
|
|
700
873
|
variant: "ghost",
|
|
701
874
|
size: "icon",
|
|
@@ -718,78 +891,11 @@ function HeaderInner({ logoType, logoHref, showOrg = false, showProjectDropdown
|
|
|
718
891
|
showProfileUi && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ProfileMenu, {
|
|
719
892
|
email: state.userEmail,
|
|
720
893
|
onLogout: state.logout
|
|
721
|
-
})
|
|
894
|
+
}),
|
|
895
|
+
actionsEnd
|
|
722
896
|
]
|
|
723
897
|
})
|
|
724
898
|
]
|
|
725
|
-
}), showProjectUi && state.showOverlay && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ProjectOverlay, {
|
|
726
|
-
organizationName: state.organizationName,
|
|
727
|
-
projectsTree: state.projectsTree,
|
|
728
|
-
selectedProjectId: state.selectedProjectId,
|
|
729
|
-
onSelect: state.selectProject,
|
|
730
|
-
isLoading: state.isProjectsLoading,
|
|
731
|
-
onClose: onCloseProjectOverlay
|
|
732
|
-
})] });
|
|
733
|
-
}
|
|
734
|
-
function ProjectOverlay({ organizationName, projectsTree, selectedProjectId, onSelect, isLoading, onClose }) {
|
|
735
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
736
|
-
role: "dialog",
|
|
737
|
-
"aria-modal": "true",
|
|
738
|
-
"aria-label": DEFAULT_LABELS.overlayTitle,
|
|
739
|
-
className: "fixed inset-0 z-50 flex items-center justify-center bg-primary-bg/80 backdrop-blur-sm",
|
|
740
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
741
|
-
className: "relative mx-1 flex w-full max-w-md flex-col items-center gap-6 rounded-16 border bg-glass-none-bg p-2 text-primary-txt shadow-xl",
|
|
742
|
-
children: [
|
|
743
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_primitives_Button_index.Button, {
|
|
744
|
-
variant: "ghost",
|
|
745
|
-
size: "icon",
|
|
746
|
-
onClick: onClose ?? (() => window.history.back()),
|
|
747
|
-
className: "absolute top-4 right-4",
|
|
748
|
-
"aria-label": "Close",
|
|
749
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.X, { className: "size-5" })
|
|
750
|
-
}),
|
|
751
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
752
|
-
className: "flex flex-col items-center gap-3 text-center",
|
|
753
|
-
children: [
|
|
754
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
755
|
-
className: "rounded-full bg-primary/10 p-4",
|
|
756
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.FolderOpen, { className: "size-8 text-primary" })
|
|
757
|
-
}),
|
|
758
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h2", {
|
|
759
|
-
className: "font-semibold text-primary-txt text-xl",
|
|
760
|
-
children: DEFAULT_LABELS.overlayTitle
|
|
761
|
-
}),
|
|
762
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
763
|
-
className: "text-muted-txt text-sm",
|
|
764
|
-
children: DEFAULT_LABELS.overlayDescription
|
|
765
|
-
})
|
|
766
|
-
]
|
|
767
|
-
}),
|
|
768
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
769
|
-
className: "flex w-full justify-center gap-2",
|
|
770
|
-
children: [organizationName && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
771
|
-
className: require_cn.cn(PILL, "select-none"),
|
|
772
|
-
title: organizationName,
|
|
773
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
774
|
-
className: "shrink-0 text-muted-txt",
|
|
775
|
-
children: [DEFAULT_LABELS.orgLabel, ":"]
|
|
776
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
777
|
-
className: "max-w-52 truncate font-medium",
|
|
778
|
-
children: organizationName
|
|
779
|
-
})]
|
|
780
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ProjectPicker, {
|
|
781
|
-
projectsTree,
|
|
782
|
-
selectedProjectId,
|
|
783
|
-
onSelect,
|
|
784
|
-
projectLabel: DEFAULT_LABELS.projectLabel,
|
|
785
|
-
projectPlaceholder: DEFAULT_LABELS.projectPlaceholder,
|
|
786
|
-
searchPlaceholder: DEFAULT_LABELS.searchPlaceholder,
|
|
787
|
-
emptyStateText: DEFAULT_LABELS.emptyStateText,
|
|
788
|
-
isLoading
|
|
789
|
-
})]
|
|
790
|
-
})
|
|
791
|
-
]
|
|
792
|
-
})
|
|
793
899
|
});
|
|
794
900
|
}
|
|
795
901
|
//#endregion
|