@puzzle-ui/ui 0.0.0-stage → 0.1.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/README.md +16 -2
- package/dist/LICENSE +21 -0
- package/dist/components/actions/button/button-content.cjs +41 -0
- package/dist/components/actions/button/button-content.cjs.map +1 -0
- package/dist/components/actions/button/button-content.js +41 -0
- package/dist/components/actions/button/button-content.js.map +1 -0
- package/dist/components/actions/button/button.css +191 -0
- package/dist/components/actions/button/button.types.d.cts +30 -0
- package/dist/components/actions/button/button.types.d.ts +30 -0
- package/dist/components/actions/button/index.cjs +80 -0
- package/dist/components/actions/button/index.cjs.map +1 -0
- package/dist/components/actions/button/index.d.cts +3 -0
- package/dist/components/actions/button/index.d.ts +3 -0
- package/dist/components/actions/button/index.js +80 -0
- package/dist/components/actions/button/index.js.map +1 -0
- package/dist/components/actions/button-group/button-group.css +64 -0
- package/dist/components/actions/button-group/index.cjs +25 -0
- package/dist/components/actions/button-group/index.cjs.map +1 -0
- package/dist/components/actions/button-group/index.d.cts +14 -0
- package/dist/components/actions/button-group/index.d.ts +14 -0
- package/dist/components/actions/button-group/index.js +25 -0
- package/dist/components/actions/button-group/index.js.map +1 -0
- package/dist/components/actions/toggle-group/index.cjs +124 -0
- package/dist/components/actions/toggle-group/index.cjs.map +1 -0
- package/dist/components/actions/toggle-group/index.d.cts +10 -0
- package/dist/components/actions/toggle-group/index.d.ts +10 -0
- package/dist/components/actions/toggle-group/index.js +124 -0
- package/dist/components/actions/toggle-group/index.js.map +1 -0
- package/dist/components/actions/toggle-group/toggle-group.css +67 -0
- package/dist/components/actions/toggle-group/toggle-group.types.d.cts +54 -0
- package/dist/components/actions/toggle-group/toggle-group.types.d.ts +54 -0
- package/dist/components/data-display/alert/alert.css +128 -0
- package/dist/components/data-display/alert/alert.types.d.cts +14 -0
- package/dist/components/data-display/alert/alert.types.d.ts +14 -0
- package/dist/components/data-display/alert/alert.utils.cjs +11 -0
- package/dist/components/data-display/alert/alert.utils.cjs.map +1 -0
- package/dist/components/data-display/alert/alert.utils.js +11 -0
- package/dist/components/data-display/alert/alert.utils.js.map +1 -0
- package/dist/components/data-display/alert/index.cjs +103 -0
- package/dist/components/data-display/alert/index.cjs.map +1 -0
- package/dist/components/data-display/alert/index.d.cts +3 -0
- package/dist/components/data-display/alert/index.d.ts +3 -0
- package/dist/components/data-display/alert/index.js +103 -0
- package/dist/components/data-display/alert/index.js.map +1 -0
- package/dist/components/data-display/avatar/avatar.css +30 -0
- package/dist/components/data-display/avatar/index.cjs +42 -0
- package/dist/components/data-display/avatar/index.cjs.map +1 -0
- package/dist/components/data-display/avatar/index.d.cts +10 -0
- package/dist/components/data-display/avatar/index.d.ts +10 -0
- package/dist/components/data-display/avatar/index.js +42 -0
- package/dist/components/data-display/avatar/index.js.map +1 -0
- package/dist/components/data-display/badge/badge.css +91 -0
- package/dist/components/data-display/badge/index.cjs +31 -0
- package/dist/components/data-display/badge/index.cjs.map +1 -0
- package/dist/components/data-display/badge/index.d.cts +18 -0
- package/dist/components/data-display/badge/index.d.ts +18 -0
- package/dist/components/data-display/badge/index.js +31 -0
- package/dist/components/data-display/badge/index.js.map +1 -0
- package/dist/components/data-display/card/card.css +164 -0
- package/dist/components/data-display/card/index.cjs +42 -0
- package/dist/components/data-display/card/index.cjs.map +1 -0
- package/dist/components/data-display/card/index.d.cts +29 -0
- package/dist/components/data-display/card/index.d.ts +29 -0
- package/dist/components/data-display/card/index.js +35 -0
- package/dist/components/data-display/card/index.js.map +1 -0
- package/dist/components/data-display/image/image.css +80 -0
- package/dist/components/data-display/image/image.types.d.cts +154 -0
- package/dist/components/data-display/image/image.types.d.ts +154 -0
- package/dist/components/data-display/image/image.utils.cjs +55 -0
- package/dist/components/data-display/image/image.utils.cjs.map +1 -0
- package/dist/components/data-display/image/image.utils.js +51 -0
- package/dist/components/data-display/image/image.utils.js.map +1 -0
- package/dist/components/data-display/image/index.cjs +176 -0
- package/dist/components/data-display/image/index.cjs.map +1 -0
- package/dist/components/data-display/image/index.d.cts +3 -0
- package/dist/components/data-display/image/index.d.ts +3 -0
- package/dist/components/data-display/image/index.js +176 -0
- package/dist/components/data-display/image/index.js.map +1 -0
- package/dist/components/data-display/image/use-image-state.cjs +54 -0
- package/dist/components/data-display/image/use-image-state.cjs.map +1 -0
- package/dist/components/data-display/image/use-image-state.js +54 -0
- package/dist/components/data-display/image/use-image-state.js.map +1 -0
- package/dist/components/data-display/paper/index.cjs +16 -0
- package/dist/components/data-display/paper/index.cjs.map +1 -0
- package/dist/components/data-display/paper/index.d.cts +8 -0
- package/dist/components/data-display/paper/index.d.ts +8 -0
- package/dist/components/data-display/paper/index.js +16 -0
- package/dist/components/data-display/paper/index.js.map +1 -0
- package/dist/components/data-display/paper/paper.css +40 -0
- package/dist/components/data-display/progress/circular-progress.cjs +75 -0
- package/dist/components/data-display/progress/circular-progress.cjs.map +1 -0
- package/dist/components/data-display/progress/circular-progress.css +21 -0
- package/dist/components/data-display/progress/circular-progress.d.cts +9 -0
- package/dist/components/data-display/progress/circular-progress.d.ts +9 -0
- package/dist/components/data-display/progress/circular-progress.js +75 -0
- package/dist/components/data-display/progress/circular-progress.js.map +1 -0
- package/dist/components/data-display/progress/linear-progress.cjs +32 -0
- package/dist/components/data-display/progress/linear-progress.cjs.map +1 -0
- package/dist/components/data-display/progress/linear-progress.css +39 -0
- package/dist/components/data-display/progress/linear-progress.d.cts +5 -0
- package/dist/components/data-display/progress/linear-progress.d.ts +5 -0
- package/dist/components/data-display/progress/linear-progress.js +32 -0
- package/dist/components/data-display/progress/linear-progress.js.map +1 -0
- package/dist/components/data-display/progress/types.d.cts +5 -0
- package/dist/components/data-display/progress/types.d.ts +5 -0
- package/dist/components/data-display/progress/utils.cjs +16 -0
- package/dist/components/data-display/progress/utils.cjs.map +1 -0
- package/dist/components/data-display/progress/utils.js +15 -0
- package/dist/components/data-display/progress/utils.js.map +1 -0
- package/dist/components/data-display/skeleton/index.cjs +18 -0
- package/dist/components/data-display/skeleton/index.cjs.map +1 -0
- package/dist/components/data-display/skeleton/index.d.cts +10 -0
- package/dist/components/data-display/skeleton/index.d.ts +10 -0
- package/dist/components/data-display/skeleton/index.js +18 -0
- package/dist/components/data-display/skeleton/index.js.map +1 -0
- package/dist/components/data-display/skeleton/skeleton.css +47 -0
- package/dist/components/editors/text-editor/editor.cjs +620 -0
- package/dist/components/editors/text-editor/editor.cjs.map +1 -0
- package/dist/components/editors/text-editor/editor.d.cts +1 -0
- package/dist/components/editors/text-editor/editor.d.ts +1 -0
- package/dist/components/editors/text-editor/editor.js +620 -0
- package/dist/components/editors/text-editor/editor.js.map +1 -0
- package/dist/components/editors/text-editor/index.cjs +39 -0
- package/dist/components/editors/text-editor/index.cjs.map +1 -0
- package/dist/components/editors/text-editor/index.d.cts +13 -0
- package/dist/components/editors/text-editor/index.d.ts +13 -0
- package/dist/components/editors/text-editor/index.js +38 -0
- package/dist/components/editors/text-editor/index.js.map +1 -0
- package/dist/components/editors/text-editor/text-document.cjs +406 -0
- package/dist/components/editors/text-editor/text-document.cjs.map +1 -0
- package/dist/components/editors/text-editor/text-document.js +391 -0
- package/dist/components/editors/text-editor/text-document.js.map +1 -0
- package/dist/components/editors/text-editor/text-editor-toolbar.cjs +251 -0
- package/dist/components/editors/text-editor/text-editor-toolbar.cjs.map +1 -0
- package/dist/components/editors/text-editor/text-editor-toolbar.css +16 -0
- package/dist/components/editors/text-editor/text-editor-toolbar.d.cts +7 -0
- package/dist/components/editors/text-editor/text-editor-toolbar.d.ts +7 -0
- package/dist/components/editors/text-editor/text-editor-toolbar.js +251 -0
- package/dist/components/editors/text-editor/text-editor-toolbar.js.map +1 -0
- package/dist/components/editors/text-editor/text-editor.css +116 -0
- package/dist/components/editors/text-editor/text-editor.types.d.cts +37 -0
- package/dist/components/editors/text-editor/text-editor.types.d.ts +37 -0
- package/dist/components/editors/text-editor/text-parser.cjs +262 -0
- package/dist/components/editors/text-editor/text-parser.cjs.map +1 -0
- package/dist/components/editors/text-editor/text-parser.js +261 -0
- package/dist/components/editors/text-editor/text-parser.js.map +1 -0
- package/dist/components/editors/text-editor/text-renderer.cjs +85 -0
- package/dist/components/editors/text-editor/text-renderer.cjs.map +1 -0
- package/dist/components/editors/text-editor/text-renderer.d.cts +7 -0
- package/dist/components/editors/text-editor/text-renderer.d.ts +7 -0
- package/dist/components/editors/text-editor/text-renderer.js +85 -0
- package/dist/components/editors/text-editor/text-renderer.js.map +1 -0
- package/dist/components/forms/autocomplete/autocomplete.css +384 -0
- package/dist/components/forms/autocomplete/autocomplete.types.d.cts +86 -0
- package/dist/components/forms/autocomplete/autocomplete.types.d.ts +86 -0
- package/dist/components/forms/autocomplete/autocomplete.utils.cjs +47 -0
- package/dist/components/forms/autocomplete/autocomplete.utils.cjs.map +1 -0
- package/dist/components/forms/autocomplete/autocomplete.utils.js +44 -0
- package/dist/components/forms/autocomplete/autocomplete.utils.js.map +1 -0
- package/dist/components/forms/autocomplete/index.cjs +532 -0
- package/dist/components/forms/autocomplete/index.cjs.map +1 -0
- package/dist/components/forms/autocomplete/index.d.cts +3 -0
- package/dist/components/forms/autocomplete/index.d.ts +3 -0
- package/dist/components/forms/autocomplete/index.js +532 -0
- package/dist/components/forms/autocomplete/index.js.map +1 -0
- package/dist/components/forms/checkbox/checkbox.css +146 -0
- package/dist/components/forms/checkbox/index.cjs +80 -0
- package/dist/components/forms/checkbox/index.cjs.map +1 -0
- package/dist/components/forms/checkbox/index.d.cts +20 -0
- package/dist/components/forms/checkbox/index.d.ts +20 -0
- package/dist/components/forms/checkbox/index.js +80 -0
- package/dist/components/forms/checkbox/index.js.map +1 -0
- package/dist/components/forms/date-picker/date-picker.css +478 -0
- package/dist/components/forms/date-picker/date-picker.types.d.cts +75 -0
- package/dist/components/forms/date-picker/date-picker.types.d.ts +75 -0
- package/dist/components/forms/date-picker/date-picker.utils.cjs +76 -0
- package/dist/components/forms/date-picker/date-picker.utils.cjs.map +1 -0
- package/dist/components/forms/date-picker/date-picker.utils.js +64 -0
- package/dist/components/forms/date-picker/date-picker.utils.js.map +1 -0
- package/dist/components/forms/date-picker/index.cjs +572 -0
- package/dist/components/forms/date-picker/index.cjs.map +1 -0
- package/dist/components/forms/date-picker/index.d.cts +3 -0
- package/dist/components/forms/date-picker/index.d.ts +3 -0
- package/dist/components/forms/date-picker/index.js +572 -0
- package/dist/components/forms/date-picker/index.js.map +1 -0
- package/dist/components/forms/file-upload/file-upload.css +290 -0
- package/dist/components/forms/file-upload/file-upload.types.d.cts +51 -0
- package/dist/components/forms/file-upload/file-upload.types.d.ts +51 -0
- package/dist/components/forms/file-upload/file-upload.utils.cjs +76 -0
- package/dist/components/forms/file-upload/file-upload.utils.cjs.map +1 -0
- package/dist/components/forms/file-upload/file-upload.utils.js +72 -0
- package/dist/components/forms/file-upload/file-upload.utils.js.map +1 -0
- package/dist/components/forms/file-upload/index.cjs +346 -0
- package/dist/components/forms/file-upload/index.cjs.map +1 -0
- package/dist/components/forms/file-upload/index.d.cts +3 -0
- package/dist/components/forms/file-upload/index.d.ts +3 -0
- package/dist/components/forms/file-upload/index.js +346 -0
- package/dist/components/forms/file-upload/index.js.map +1 -0
- package/dist/components/forms/form-field/form-field-state.cjs +25 -0
- package/dist/components/forms/form-field/form-field-state.cjs.map +1 -0
- package/dist/components/forms/form-field/form-field-state.js +25 -0
- package/dist/components/forms/form-field/form-field-state.js.map +1 -0
- package/dist/components/forms/form-field/form-field.css +44 -0
- package/dist/components/forms/form-field/index.cjs +61 -0
- package/dist/components/forms/form-field/index.cjs.map +1 -0
- package/dist/components/forms/form-field/index.d.cts +23 -0
- package/dist/components/forms/form-field/index.d.ts +23 -0
- package/dist/components/forms/form-field/index.js +61 -0
- package/dist/components/forms/form-field/index.js.map +1 -0
- package/dist/components/forms/input/index.d.cts +4 -0
- package/dist/components/forms/input/index.d.ts +4 -0
- package/dist/components/forms/input/input.css +153 -0
- package/dist/components/forms/input/number-input.cjs +192 -0
- package/dist/components/forms/input/number-input.cjs.map +1 -0
- package/dist/components/forms/input/number-input.d.cts +20 -0
- package/dist/components/forms/input/number-input.d.ts +20 -0
- package/dist/components/forms/input/number-input.js +192 -0
- package/dist/components/forms/input/number-input.js.map +1 -0
- package/dist/components/forms/input/text-area-input.cjs +47 -0
- package/dist/components/forms/input/text-area-input.cjs.map +1 -0
- package/dist/components/forms/input/text-area-input.d.cts +8 -0
- package/dist/components/forms/input/text-area-input.d.ts +8 -0
- package/dist/components/forms/input/text-area-input.js +47 -0
- package/dist/components/forms/input/text-area-input.js.map +1 -0
- package/dist/components/forms/input/text-input.cjs +47 -0
- package/dist/components/forms/input/text-input.cjs.map +1 -0
- package/dist/components/forms/input/text-input.d.cts +9 -0
- package/dist/components/forms/input/text-input.d.ts +9 -0
- package/dist/components/forms/input/text-input.js +47 -0
- package/dist/components/forms/input/text-input.js.map +1 -0
- package/dist/components/forms/label/index.cjs +26 -0
- package/dist/components/forms/label/index.cjs.map +1 -0
- package/dist/components/forms/label/index.d.cts +8 -0
- package/dist/components/forms/label/index.d.ts +8 -0
- package/dist/components/forms/label/index.js +26 -0
- package/dist/components/forms/label/index.js.map +1 -0
- package/dist/components/forms/label/label.css +22 -0
- package/dist/components/forms/radio-group/index.cjs +226 -0
- package/dist/components/forms/radio-group/index.cjs.map +1 -0
- package/dist/components/forms/radio-group/index.d.cts +5 -0
- package/dist/components/forms/radio-group/index.d.ts +5 -0
- package/dist/components/forms/radio-group/index.js +225 -0
- package/dist/components/forms/radio-group/index.js.map +1 -0
- package/dist/components/forms/radio-group/radio-group.css +222 -0
- package/dist/components/forms/radio-group/radio-group.types.d.cts +51 -0
- package/dist/components/forms/radio-group/radio-group.types.d.ts +51 -0
- package/dist/components/forms/radio-group/radio-group.utils.cjs +22 -0
- package/dist/components/forms/radio-group/radio-group.utils.cjs.map +1 -0
- package/dist/components/forms/radio-group/radio-group.utils.js +21 -0
- package/dist/components/forms/radio-group/radio-group.utils.js.map +1 -0
- package/dist/components/forms/select/index.cjs +468 -0
- package/dist/components/forms/select/index.cjs.map +1 -0
- package/dist/components/forms/select/index.d.cts +112 -0
- package/dist/components/forms/select/index.d.ts +112 -0
- package/dist/components/forms/select/index.js +468 -0
- package/dist/components/forms/select/index.js.map +1 -0
- package/dist/components/forms/select/select.css +363 -0
- package/dist/components/forms/slider/index.cjs +93 -0
- package/dist/components/forms/slider/index.cjs.map +1 -0
- package/dist/components/forms/slider/index.d.cts +37 -0
- package/dist/components/forms/slider/index.d.ts +37 -0
- package/dist/components/forms/slider/index.js +93 -0
- package/dist/components/forms/slider/index.js.map +1 -0
- package/dist/components/forms/slider/slider.css +202 -0
- package/dist/components/forms/stepper/index.cjs +113 -0
- package/dist/components/forms/stepper/index.cjs.map +1 -0
- package/dist/components/forms/stepper/index.d.cts +48 -0
- package/dist/components/forms/stepper/index.d.ts +48 -0
- package/dist/components/forms/stepper/index.js +113 -0
- package/dist/components/forms/stepper/index.js.map +1 -0
- package/dist/components/forms/stepper/stepper.css +241 -0
- package/dist/components/forms/switch/index.cjs +45 -0
- package/dist/components/forms/switch/index.cjs.map +1 -0
- package/dist/components/forms/switch/index.d.cts +11 -0
- package/dist/components/forms/switch/index.d.ts +11 -0
- package/dist/components/forms/switch/index.js +45 -0
- package/dist/components/forms/switch/index.js.map +1 -0
- package/dist/components/forms/switch/switch.css +142 -0
- package/dist/components/layout/app-bar/app-bar.css +197 -0
- package/dist/components/layout/app-bar/index.cjs +150 -0
- package/dist/components/layout/app-bar/index.cjs.map +1 -0
- package/dist/components/layout/app-bar/index.d.cts +21 -0
- package/dist/components/layout/app-bar/index.d.ts +21 -0
- package/dist/components/layout/app-bar/index.js +150 -0
- package/dist/components/layout/app-bar/index.js.map +1 -0
- package/dist/components/layout/background/background.css +160 -0
- package/dist/components/layout/background/index.cjs +34 -0
- package/dist/components/layout/background/index.cjs.map +1 -0
- package/dist/components/layout/background/index.d.cts +23 -0
- package/dist/components/layout/background/index.d.ts +23 -0
- package/dist/components/layout/background/index.js +34 -0
- package/dist/components/layout/background/index.js.map +1 -0
- package/dist/components/layout/bottom-navigation/bottom-navigation.css +108 -0
- package/dist/components/layout/bottom-navigation/index.cjs +51 -0
- package/dist/components/layout/bottom-navigation/index.cjs.map +1 -0
- package/dist/components/layout/bottom-navigation/index.d.cts +19 -0
- package/dist/components/layout/bottom-navigation/index.d.ts +19 -0
- package/dist/components/layout/bottom-navigation/index.js +50 -0
- package/dist/components/layout/bottom-navigation/index.js.map +1 -0
- package/dist/components/layout/breadcrumbs/breadcrumbs.css +80 -0
- package/dist/components/layout/breadcrumbs/index.cjs +38 -0
- package/dist/components/layout/breadcrumbs/index.cjs.map +1 -0
- package/dist/components/layout/breadcrumbs/index.d.cts +18 -0
- package/dist/components/layout/breadcrumbs/index.d.ts +18 -0
- package/dist/components/layout/breadcrumbs/index.js +38 -0
- package/dist/components/layout/breadcrumbs/index.js.map +1 -0
- package/dist/components/layout/collapsable-sidebar/collapsable-sidebar.css +240 -0
- package/dist/components/layout/collapsable-sidebar/index.cjs +107 -0
- package/dist/components/layout/collapsable-sidebar/index.cjs.map +1 -0
- package/dist/components/layout/collapsable-sidebar/index.d.cts +35 -0
- package/dist/components/layout/collapsable-sidebar/index.d.ts +35 -0
- package/dist/components/layout/collapsable-sidebar/index.js +107 -0
- package/dist/components/layout/collapsable-sidebar/index.js.map +1 -0
- package/dist/components/layout/container/container.css +24 -0
- package/dist/components/layout/container/container.utils.cjs +11 -0
- package/dist/components/layout/container/container.utils.cjs.map +1 -0
- package/dist/components/layout/container/container.utils.d.cts +1 -0
- package/dist/components/layout/container/container.utils.d.ts +1 -0
- package/dist/components/layout/container/container.utils.js +11 -0
- package/dist/components/layout/container/container.utils.js.map +1 -0
- package/dist/components/layout/container/index.cjs +17 -0
- package/dist/components/layout/container/index.cjs.map +1 -0
- package/dist/components/layout/container/index.d.cts +11 -0
- package/dist/components/layout/container/index.d.ts +11 -0
- package/dist/components/layout/container/index.js +17 -0
- package/dist/components/layout/container/index.js.map +1 -0
- package/dist/components/layout/page-layout/index.cjs +80 -0
- package/dist/components/layout/page-layout/index.cjs.map +1 -0
- package/dist/components/layout/page-layout/index.d.cts +61 -0
- package/dist/components/layout/page-layout/index.d.ts +61 -0
- package/dist/components/layout/page-layout/index.js +80 -0
- package/dist/components/layout/page-layout/index.js.map +1 -0
- package/dist/components/layout/page-layout/page-layout.css +88 -0
- package/dist/components/layout/section/index.cjs +15 -0
- package/dist/components/layout/section/index.cjs.map +1 -0
- package/dist/components/layout/section/index.d.cts +2 -0
- package/dist/components/layout/section/index.d.ts +2 -0
- package/dist/components/layout/section/index.js +15 -0
- package/dist/components/layout/section/index.js.map +1 -0
- package/dist/components/layout/section/section.css +71 -0
- package/dist/components/layout/section/types.d.cts +13 -0
- package/dist/components/layout/section/types.d.ts +13 -0
- package/dist/components/layout/section-stack/index.cjs +29 -0
- package/dist/components/layout/section-stack/index.cjs.map +1 -0
- package/dist/components/layout/section-stack/index.d.cts +8 -0
- package/dist/components/layout/section-stack/index.d.ts +8 -0
- package/dist/components/layout/section-stack/index.js +29 -0
- package/dist/components/layout/section-stack/index.js.map +1 -0
- package/dist/components/layout/sidebar/index.cjs +16 -0
- package/dist/components/layout/sidebar/index.cjs.map +1 -0
- package/dist/components/layout/sidebar/index.d.cts +7 -0
- package/dist/components/layout/sidebar/index.d.ts +7 -0
- package/dist/components/layout/sidebar/index.js +16 -0
- package/dist/components/layout/sidebar/index.js.map +1 -0
- package/dist/components/layout/sidebar/sidebar.css +21 -0
- package/dist/components/layout/stack/index.cjs +30 -0
- package/dist/components/layout/stack/index.cjs.map +1 -0
- package/dist/components/layout/stack/index.d.cts +31 -0
- package/dist/components/layout/stack/index.d.ts +31 -0
- package/dist/components/layout/stack/index.js +30 -0
- package/dist/components/layout/stack/index.js.map +1 -0
- package/dist/components/layout/stack/stack.css +303 -0
- package/dist/components/navigation/accordion/accordion.css +97 -0
- package/dist/components/navigation/accordion/index.cjs +107 -0
- package/dist/components/navigation/accordion/index.cjs.map +1 -0
- package/dist/components/navigation/accordion/index.d.cts +48 -0
- package/dist/components/navigation/accordion/index.d.ts +48 -0
- package/dist/components/navigation/accordion/index.js +107 -0
- package/dist/components/navigation/accordion/index.js.map +1 -0
- package/dist/components/navigation/carousel/carousel.css +283 -0
- package/dist/components/navigation/carousel/controller.cjs +46 -0
- package/dist/components/navigation/carousel/controller.cjs.map +1 -0
- package/dist/components/navigation/carousel/controller.d.cts +16 -0
- package/dist/components/navigation/carousel/controller.d.ts +16 -0
- package/dist/components/navigation/carousel/controller.js +45 -0
- package/dist/components/navigation/carousel/controller.js.map +1 -0
- package/dist/components/navigation/carousel/index.cjs +494 -0
- package/dist/components/navigation/carousel/index.cjs.map +1 -0
- package/dist/components/navigation/carousel/index.d.cts +27 -0
- package/dist/components/navigation/carousel/index.d.ts +27 -0
- package/dist/components/navigation/carousel/index.js +494 -0
- package/dist/components/navigation/carousel/index.js.map +1 -0
- package/dist/components/navigation/link/index.cjs +40 -0
- package/dist/components/navigation/link/index.cjs.map +1 -0
- package/dist/components/navigation/link/index.d.cts +3 -0
- package/dist/components/navigation/link/index.d.ts +3 -0
- package/dist/components/navigation/link/index.js +40 -0
- package/dist/components/navigation/link/index.js.map +1 -0
- package/dist/components/navigation/link/link.css +31 -0
- package/dist/components/navigation/link/types.d.cts +12 -0
- package/dist/components/navigation/link/types.d.ts +12 -0
- package/dist/components/navigation/tabs/index.cjs +111 -0
- package/dist/components/navigation/tabs/index.cjs.map +1 -0
- package/dist/components/navigation/tabs/index.d.cts +30 -0
- package/dist/components/navigation/tabs/index.d.ts +30 -0
- package/dist/components/navigation/tabs/index.js +110 -0
- package/dist/components/navigation/tabs/index.js.map +1 -0
- package/dist/components/navigation/tabs/tabs.css +216 -0
- package/dist/components/navigation/tree-view/index.cjs +455 -0
- package/dist/components/navigation/tree-view/index.cjs.map +1 -0
- package/dist/components/navigation/tree-view/index.d.cts +96 -0
- package/dist/components/navigation/tree-view/index.d.ts +96 -0
- package/dist/components/navigation/tree-view/index.js +455 -0
- package/dist/components/navigation/tree-view/index.js.map +1 -0
- package/dist/components/navigation/tree-view/tree-view.css +258 -0
- package/dist/components/overlays/backdrop/backdrop.css +10 -0
- package/dist/components/overlays/backdrop/index.cjs +70 -0
- package/dist/components/overlays/backdrop/index.cjs.map +1 -0
- package/dist/components/overlays/backdrop/index.d.cts +12 -0
- package/dist/components/overlays/backdrop/index.d.ts +12 -0
- package/dist/components/overlays/backdrop/index.js +70 -0
- package/dist/components/overlays/backdrop/index.js.map +1 -0
- package/dist/components/overlays/command/command.css +154 -0
- package/dist/components/overlays/command/command.types.d.cts +36 -0
- package/dist/components/overlays/command/command.types.d.ts +36 -0
- package/dist/components/overlays/command/command.utils.cjs +39 -0
- package/dist/components/overlays/command/command.utils.cjs.map +1 -0
- package/dist/components/overlays/command/command.utils.js +35 -0
- package/dist/components/overlays/command/command.utils.js.map +1 -0
- package/dist/components/overlays/command/index.cjs +274 -0
- package/dist/components/overlays/command/index.cjs.map +1 -0
- package/dist/components/overlays/command/index.d.cts +4 -0
- package/dist/components/overlays/command/index.d.ts +4 -0
- package/dist/components/overlays/command/index.js +273 -0
- package/dist/components/overlays/command/index.js.map +1 -0
- package/dist/components/overlays/dialog/dialog.css +121 -0
- package/dist/components/overlays/dialog/index.cjs +80 -0
- package/dist/components/overlays/dialog/index.cjs.map +1 -0
- package/dist/components/overlays/dialog/index.d.cts +35 -0
- package/dist/components/overlays/dialog/index.d.ts +35 -0
- package/dist/components/overlays/dialog/index.js +80 -0
- package/dist/components/overlays/dialog/index.js.map +1 -0
- package/dist/components/overlays/drawer/drawer.css +133 -0
- package/dist/components/overlays/drawer/index.cjs +90 -0
- package/dist/components/overlays/drawer/index.cjs.map +1 -0
- package/dist/components/overlays/drawer/index.d.cts +11 -0
- package/dist/components/overlays/drawer/index.d.ts +11 -0
- package/dist/components/overlays/drawer/index.js +90 -0
- package/dist/components/overlays/drawer/index.js.map +1 -0
- package/dist/components/overlays/drawer/use-resize-bar.cjs +152 -0
- package/dist/components/overlays/drawer/use-resize-bar.cjs.map +1 -0
- package/dist/components/overlays/drawer/use-resize-bar.js +152 -0
- package/dist/components/overlays/drawer/use-resize-bar.js.map +1 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu-content.cjs +120 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu-content.cjs.map +1 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu-content.d.cts +3 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu-content.d.ts +3 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu-content.js +120 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu-content.js.map +1 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu-items.cjs +136 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu-items.cjs.map +1 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu-items.d.cts +7 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu-items.d.ts +7 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu-items.js +132 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu-items.js.map +1 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu-radio.cjs +76 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu-radio.cjs.map +1 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu-radio.d.cts +4 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu-radio.d.ts +4 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu-radio.js +75 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu-radio.js.map +1 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu-trigger.cjs +96 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu-trigger.cjs.map +1 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu-trigger.d.cts +3 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu-trigger.d.ts +3 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu-trigger.js +96 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu-trigger.js.map +1 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu.cjs +111 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu.cjs.map +1 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu.context.cjs +21 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu.context.cjs.map +1 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu.context.js +18 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu.context.js.map +1 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu.css +127 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu.d.cts +3 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu.d.ts +3 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu.js +111 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu.js.map +1 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu.types.d.cts +66 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu.types.d.ts +66 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu.utils.cjs +44 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu.utils.cjs.map +1 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu.utils.js +39 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu.utils.js.map +1 -0
- package/dist/components/overlays/dropdown-menu/index.cjs +31 -0
- package/dist/components/overlays/dropdown-menu/index.cjs.map +1 -0
- package/dist/components/overlays/dropdown-menu/index.d.cts +19 -0
- package/dist/components/overlays/dropdown-menu/index.d.ts +19 -0
- package/dist/components/overlays/dropdown-menu/index.js +22 -0
- package/dist/components/overlays/dropdown-menu/index.js.map +1 -0
- package/dist/components/overlays/floating-position/calculate-position.cjs +94 -0
- package/dist/components/overlays/floating-position/calculate-position.cjs.map +1 -0
- package/dist/components/overlays/floating-position/calculate-position.js +89 -0
- package/dist/components/overlays/floating-position/calculate-position.js.map +1 -0
- package/dist/components/overlays/floating-position/use-floating-position.cjs +89 -0
- package/dist/components/overlays/floating-position/use-floating-position.cjs.map +1 -0
- package/dist/components/overlays/floating-position/use-floating-position.js +89 -0
- package/dist/components/overlays/floating-position/use-floating-position.js.map +1 -0
- package/dist/components/overlays/notification/index.cjs +142 -0
- package/dist/components/overlays/notification/index.cjs.map +1 -0
- package/dist/components/overlays/notification/index.d.cts +16 -0
- package/dist/components/overlays/notification/index.d.ts +16 -0
- package/dist/components/overlays/notification/index.js +139 -0
- package/dist/components/overlays/notification/index.js.map +1 -0
- package/dist/components/overlays/notification/notification-provider.cjs +69 -0
- package/dist/components/overlays/notification/notification-provider.cjs.map +1 -0
- package/dist/components/overlays/notification/notification-provider.d.cts +3 -0
- package/dist/components/overlays/notification/notification-provider.d.ts +3 -0
- package/dist/components/overlays/notification/notification-provider.js +68 -0
- package/dist/components/overlays/notification/notification-provider.js.map +1 -0
- package/dist/components/overlays/notification/notification.css +172 -0
- package/dist/components/overlays/notification/notification.types.d.cts +41 -0
- package/dist/components/overlays/notification/notification.types.d.ts +41 -0
- package/dist/components/overlays/notification/notification.utils.cjs +23 -0
- package/dist/components/overlays/notification/notification.utils.cjs.map +1 -0
- package/dist/components/overlays/notification/notification.utils.js +22 -0
- package/dist/components/overlays/notification/notification.utils.js.map +1 -0
- package/dist/components/overlays/notification/use-notification.cjs +12 -0
- package/dist/components/overlays/notification/use-notification.cjs.map +1 -0
- package/dist/components/overlays/notification/use-notification.d.cts +3 -0
- package/dist/components/overlays/notification/use-notification.d.ts +3 -0
- package/dist/components/overlays/notification/use-notification.js +12 -0
- package/dist/components/overlays/notification/use-notification.js.map +1 -0
- package/dist/components/overlays/overlay-stack/index.cjs +195 -0
- package/dist/components/overlays/overlay-stack/index.cjs.map +1 -0
- package/dist/components/overlays/overlay-stack/index.js +193 -0
- package/dist/components/overlays/overlay-stack/index.js.map +1 -0
- package/dist/components/overlays/popout/index.cjs +190 -0
- package/dist/components/overlays/popout/index.cjs.map +1 -0
- package/dist/components/overlays/popout/index.d.cts +26 -0
- package/dist/components/overlays/popout/index.d.ts +26 -0
- package/dist/components/overlays/popout/index.js +190 -0
- package/dist/components/overlays/popout/index.js.map +1 -0
- package/dist/components/overlays/popout/popout.css +15 -0
- package/dist/components/overlays/popover/index.cjs +163 -0
- package/dist/components/overlays/popover/index.cjs.map +1 -0
- package/dist/components/overlays/popover/index.d.cts +28 -0
- package/dist/components/overlays/popover/index.d.ts +28 -0
- package/dist/components/overlays/popover/index.js +163 -0
- package/dist/components/overlays/popover/index.js.map +1 -0
- package/dist/components/overlays/popover/popover.css +56 -0
- package/dist/components/overlays/portal/index.cjs +33 -0
- package/dist/components/overlays/portal/index.cjs.map +1 -0
- package/dist/components/overlays/portal/index.d.cts +15 -0
- package/dist/components/overlays/portal/index.d.ts +15 -0
- package/dist/components/overlays/portal/index.js +33 -0
- package/dist/components/overlays/portal/index.js.map +1 -0
- package/dist/components/overlays/portal/target.cjs +17 -0
- package/dist/components/overlays/portal/target.cjs.map +1 -0
- package/dist/components/overlays/portal/target.css +3 -0
- package/dist/components/overlays/portal/target.d.cts +7 -0
- package/dist/components/overlays/portal/target.d.ts +7 -0
- package/dist/components/overlays/portal/target.js +17 -0
- package/dist/components/overlays/portal/target.js.map +1 -0
- package/dist/components/overlays/tooltip/index.cjs +71 -0
- package/dist/components/overlays/tooltip/index.cjs.map +1 -0
- package/dist/components/overlays/tooltip/index.d.cts +24 -0
- package/dist/components/overlays/tooltip/index.d.ts +24 -0
- package/dist/components/overlays/tooltip/index.js +71 -0
- package/dist/components/overlays/tooltip/index.js.map +1 -0
- package/dist/components/overlays/tooltip/tooltip.css +67 -0
- package/dist/components/typography/heading.cjs +14 -0
- package/dist/components/typography/heading.cjs.map +1 -0
- package/dist/components/typography/heading.d.cts +11 -0
- package/dist/components/typography/heading.d.ts +11 -0
- package/dist/components/typography/heading.js +14 -0
- package/dist/components/typography/heading.js.map +1 -0
- package/dist/components/typography/text.cjs +14 -0
- package/dist/components/typography/text.cjs.map +1 -0
- package/dist/components/typography/text.d.cts +12 -0
- package/dist/components/typography/text.d.ts +12 -0
- package/dist/components/typography/text.js +14 -0
- package/dist/components/typography/text.js.map +1 -0
- package/dist/components/utilities/preview/highlight.cjs +79 -0
- package/dist/components/utilities/preview/highlight.cjs.map +1 -0
- package/dist/components/utilities/preview/highlight.js +79 -0
- package/dist/components/utilities/preview/highlight.js.map +1 -0
- package/dist/components/utilities/preview/index.cjs +391 -0
- package/dist/components/utilities/preview/index.cjs.map +1 -0
- package/dist/components/utilities/preview/index.d.cts +20 -0
- package/dist/components/utilities/preview/index.d.ts +20 -0
- package/dist/components/utilities/preview/index.js +391 -0
- package/dist/components/utilities/preview/index.js.map +1 -0
- package/dist/components/utilities/preview/preview.css +268 -0
- package/dist/components/utilities/scroll-lock/index.cjs +124 -0
- package/dist/components/utilities/scroll-lock/index.cjs.map +1 -0
- package/dist/components/utilities/scroll-lock/index.d.cts +6 -0
- package/dist/components/utilities/scroll-lock/index.d.ts +6 -0
- package/dist/components/utilities/scroll-lock/index.js +124 -0
- package/dist/components/utilities/scroll-lock/index.js.map +1 -0
- package/dist/components/utilities/transition/index.cjs +171 -0
- package/dist/components/utilities/transition/index.cjs.map +1 -0
- package/dist/components/utilities/transition/index.d.cts +27 -0
- package/dist/components/utilities/transition/index.d.ts +27 -0
- package/dist/components/utilities/transition/index.js +171 -0
- package/dist/components/utilities/transition/index.js.map +1 -0
- package/dist/components/utilities/transition/transition.css +130 -0
- package/dist/index.cjs +155 -0
- package/dist/index.d.cts +85 -0
- package/dist/index.d.ts +85 -0
- package/dist/index.js +69 -0
- package/package.json +65 -4
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { ComponentPropsWithRef, ReactNode } from "react";
|
|
2
|
+
type TreeViewSelectionMode = "none" | "single" | "multiple";
|
|
3
|
+
type TreeViewSize = "sm" | "md";
|
|
4
|
+
type TreeViewItem<TData = unknown> = {
|
|
5
|
+
/** Stable, unique identifier for this node. */
|
|
6
|
+
id: string;
|
|
7
|
+
/** Visible node label. Supply textValue when the label is not plain text. */
|
|
8
|
+
label: ReactNode;
|
|
9
|
+
/** Optional destination. When supplied, the complete row renders as a Puzzle Link. */
|
|
10
|
+
href?: string;
|
|
11
|
+
/** Plain-text value used by typeahead when label is not a string or number. */
|
|
12
|
+
textValue?: string;
|
|
13
|
+
/** Optional icon displayed before the label. */
|
|
14
|
+
icon?: ReactNode;
|
|
15
|
+
/** Optional, non-interactive content displayed after the label. */
|
|
16
|
+
endAdornment?: ReactNode;
|
|
17
|
+
/** Child nodes for a loaded branch. Omit for a leaf or a lazily loaded branch. */
|
|
18
|
+
children?: TreeViewItem<TData>[];
|
|
19
|
+
/** Marks a node as expandable before its children have been loaded. */
|
|
20
|
+
hasChildren?: boolean;
|
|
21
|
+
/** Prevents selection and activation; branches can still expand so descendants remain accessible. */
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
/** Allows a node to be excluded from selection without disabling expansion. */
|
|
24
|
+
selectable?: boolean;
|
|
25
|
+
/** Optional application data associated with the node. */
|
|
26
|
+
data?: TData;
|
|
27
|
+
};
|
|
28
|
+
type TreeViewItemState = {
|
|
29
|
+
expanded: boolean;
|
|
30
|
+
selected: boolean;
|
|
31
|
+
focused: boolean;
|
|
32
|
+
loading: boolean;
|
|
33
|
+
disabled: boolean;
|
|
34
|
+
hasChildren: boolean;
|
|
35
|
+
};
|
|
36
|
+
type TreeViewProps<TData = unknown> = Omit<ComponentPropsWithRef<"ul">, "children" | "onKeyDown" | "onFocusCapture" | "onBlurCapture" | "role" | "tabIndex" | "aria-multiselectable"> & ({
|
|
37
|
+
"aria-label": string;
|
|
38
|
+
"aria-labelledby"?: string;
|
|
39
|
+
} | {
|
|
40
|
+
"aria-labelledby": string;
|
|
41
|
+
"aria-label"?: string;
|
|
42
|
+
}) & {
|
|
43
|
+
/** Hierarchical data rendered by the tree. Node IDs must be unique. */
|
|
44
|
+
items: TreeViewItem<TData>[];
|
|
45
|
+
/** Selection behavior. Defaults to single selection. */
|
|
46
|
+
selectionMode?: TreeViewSelectionMode;
|
|
47
|
+
/** Initial expanded node IDs for uncontrolled usage. Defaults to []. */
|
|
48
|
+
defaultExpandedIds?: string[];
|
|
49
|
+
/** Expanded node IDs for controlled usage. */
|
|
50
|
+
expandedIds?: string[];
|
|
51
|
+
/** Called with the next expanded node IDs. */
|
|
52
|
+
onExpandedChange?: (expandedIds: string[]) => void;
|
|
53
|
+
/** Initial selected node IDs for uncontrolled usage. Defaults to []. */
|
|
54
|
+
defaultSelectedIds?: string[];
|
|
55
|
+
/** Selected node IDs for controlled usage. */
|
|
56
|
+
selectedIds?: string[];
|
|
57
|
+
/** Called with the next selected node IDs. */
|
|
58
|
+
onSelectionChange?: (selectedIds: string[]) => void;
|
|
59
|
+
/** Initial roving-focus target. Defaults to the first selected node, then the first root node. */
|
|
60
|
+
defaultFocusedId?: string;
|
|
61
|
+
/** Called when keyboard or pointer interaction moves focus to another node. */
|
|
62
|
+
onFocusedChange?: (focusedId: string) => void;
|
|
63
|
+
/** Loads the children of a node marked with hasChildren when it is first expanded. */
|
|
64
|
+
loadChildren?: (item: TreeViewItem<TData>) => Promise<TreeViewItem<TData>[]>;
|
|
65
|
+
/** Called when lazy loading fails. Re-collapse and re-expand the node to retry. */
|
|
66
|
+
onLoadChildrenError?: (item: TreeViewItem<TData>, error: unknown) => void;
|
|
67
|
+
/** Called when a node is activated with Enter. */
|
|
68
|
+
onItemActivate?: (item: TreeViewItem<TData>) => void;
|
|
69
|
+
/** Determines whether an item matches the current route. */
|
|
70
|
+
getItemActive?: (item: TreeViewItem<TData>) => boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Custom node renderer. Replaces the icon, label and adornment of a row; the
|
|
73
|
+
* expand indicator, row element and tree semantics are kept. Keep its contents non-interactive.
|
|
74
|
+
*/
|
|
75
|
+
renderItem?: (item: TreeViewItem<TData>, state: TreeViewItemState) => ReactNode;
|
|
76
|
+
/** Custom node-icon renderer. */
|
|
77
|
+
renderIcon?: (item: TreeViewItem<TData>, state: TreeViewItemState) => ReactNode;
|
|
78
|
+
/** Custom label renderer. Keep its contents non-interactive. */
|
|
79
|
+
renderLabel?: (item: TreeViewItem<TData>, state: TreeViewItemState) => ReactNode;
|
|
80
|
+
/** Clicking the label of a branch toggles it instead of selecting it. Defaults to false. */
|
|
81
|
+
expandOnItemClick?: boolean;
|
|
82
|
+
/** Visual density. Defaults to md. */
|
|
83
|
+
size?: TreeViewSize;
|
|
84
|
+
/** Indentation between hierarchy levels, in CSS units. Defaults to the theme spacing token. */
|
|
85
|
+
indentation?: string | number;
|
|
86
|
+
/** Enables character-based typeahead navigation. Defaults to true. */
|
|
87
|
+
typeahead?: boolean;
|
|
88
|
+
/** Text announced and displayed while lazy children are loading. */
|
|
89
|
+
loadingLabel?: string;
|
|
90
|
+
/** Text displayed when lazy loading fails. */
|
|
91
|
+
loadErrorLabel?: string;
|
|
92
|
+
/** Class applied to each tree item. */
|
|
93
|
+
itemClassName?: string;
|
|
94
|
+
};
|
|
95
|
+
declare const TreeView: <TData>({ items, selectionMode, defaultExpandedIds, expandedIds, onExpandedChange, defaultSelectedIds, selectedIds, onSelectionChange, defaultFocusedId, onFocusedChange, loadChildren, onLoadChildrenError, onItemActivate, getItemActive, renderItem, renderIcon, renderLabel, expandOnItemClick, typeahead, size, indentation, loadingLabel, loadErrorLabel, itemClassName, className, style, dir, ...rootProps }: TreeViewProps<TData>) => import("react").JSX.Element;
|
|
96
|
+
export { TreeView, type TreeViewItem, type TreeViewItemState, type TreeViewProps, type TreeViewSelectionMode, type TreeViewSize };
|
|
@@ -0,0 +1,455 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Link } from "../link/index.js";
|
|
3
|
+
import "./tree-view.css";
|
|
4
|
+
import { cn } from "@puzzle-ui/core";
|
|
5
|
+
import { useCallback, useEffect, useId, useMemo, useRef, useState } from "react";
|
|
6
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
// src/components/navigation/tree-view/index.tsx
|
|
8
|
+
const normalizeIds = (ids) => Array.from(new Set((ids ?? []).filter((id) => typeof id === "string" && id.length > 0)));
|
|
9
|
+
const getTextValue = (item) => {
|
|
10
|
+
if (item.textValue !== void 0) return item.textValue;
|
|
11
|
+
if (typeof item.label === "string" || typeof item.label === "number") return String(item.label);
|
|
12
|
+
return "";
|
|
13
|
+
};
|
|
14
|
+
const normalizeSearchText = (value) => value.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLocaleLowerCase();
|
|
15
|
+
const TreeView = ({ items, selectionMode = "single", defaultExpandedIds = [], expandedIds, onExpandedChange, defaultSelectedIds = [], selectedIds, onSelectionChange, defaultFocusedId, onFocusedChange, loadChildren, onLoadChildrenError, onItemActivate, getItemActive, renderItem, renderIcon, renderLabel, expandOnItemClick = false, typeahead = true, size = "md", indentation, loadingLabel = "Loading…", loadErrorLabel = "Could not load children. Collapse and expand to retry.", itemClassName, className, style, dir, ...rootProps }) => {
|
|
16
|
+
const generatedId = useId();
|
|
17
|
+
const isExpandedControlled = expandedIds !== void 0;
|
|
18
|
+
const isSelectionControlled = selectedIds !== void 0;
|
|
19
|
+
const [uncontrolledExpandedIds, setUncontrolledExpandedIds] = useState(() => normalizeIds(defaultExpandedIds));
|
|
20
|
+
const [uncontrolledSelectedIds, setUncontrolledSelectedIds] = useState(() => normalizeIds(defaultSelectedIds));
|
|
21
|
+
const [focusedId, setFocusedId] = useState(() => defaultFocusedId ?? (selectionMode === "none" ? void 0 : normalizeIds(selectedIds ?? defaultSelectedIds)[0]) ?? items[0]?.id);
|
|
22
|
+
const [loadedChildren, setLoadedChildren] = useState(() => /* @__PURE__ */ new Map());
|
|
23
|
+
const [loadingIds, setLoadingIds] = useState([]);
|
|
24
|
+
const [loadErrors, setLoadErrors] = useState(() => /* @__PURE__ */ new Map());
|
|
25
|
+
const itemRefs = useRef(/* @__PURE__ */ new Map());
|
|
26
|
+
const inFlightLoads = useRef(/* @__PURE__ */ new Set());
|
|
27
|
+
const previousExpandedIds = useRef(null);
|
|
28
|
+
const pendingFocusId = useRef(null);
|
|
29
|
+
const focusWithinTree = useRef(false);
|
|
30
|
+
const typeaheadState = useRef({
|
|
31
|
+
value: "",
|
|
32
|
+
time: 0
|
|
33
|
+
});
|
|
34
|
+
const currentExpandedIds = isExpandedControlled ? expandedIds ?? [] : uncontrolledExpandedIds;
|
|
35
|
+
const requestedSelectedIds = isSelectionControlled ? selectedIds ?? [] : uncontrolledSelectedIds;
|
|
36
|
+
const currentSelectedIds = selectionMode === "single" ? requestedSelectedIds.slice(0, 1) : requestedSelectedIds;
|
|
37
|
+
const expandedSet = useMemo(() => new Set(normalizeIds(currentExpandedIds)), [currentExpandedIds]);
|
|
38
|
+
const selectedSet = useMemo(() => new Set(normalizeIds(currentSelectedIds)), [currentSelectedIds]);
|
|
39
|
+
const loadingSet = useMemo(() => new Set(loadingIds), [loadingIds]);
|
|
40
|
+
const getChildren = useCallback((item) => item.children ?? loadedChildren.get(item.id) ?? [], [loadedChildren]);
|
|
41
|
+
const hasChildren = useCallback((item) => {
|
|
42
|
+
if (item.children !== void 0 || loadedChildren.has(item.id)) return getChildren(item).length > 0;
|
|
43
|
+
return Boolean(item.hasChildren);
|
|
44
|
+
}, [getChildren, loadedChildren]);
|
|
45
|
+
const visibleItems = useMemo(() => {
|
|
46
|
+
const result = [];
|
|
47
|
+
const visit = (nodes) => {
|
|
48
|
+
nodes.forEach((item) => {
|
|
49
|
+
result.push(item);
|
|
50
|
+
const children = getChildren(item);
|
|
51
|
+
if (expandedSet.has(item.id) && hasChildren(item) && children.length > 0) visit(children);
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
visit(items);
|
|
55
|
+
return result;
|
|
56
|
+
}, [
|
|
57
|
+
items,
|
|
58
|
+
expandedSet,
|
|
59
|
+
getChildren,
|
|
60
|
+
hasChildren
|
|
61
|
+
]);
|
|
62
|
+
const parentIds = useMemo(() => {
|
|
63
|
+
const result = /* @__PURE__ */ new Map();
|
|
64
|
+
const visit = (nodes, parentId) => {
|
|
65
|
+
nodes.forEach((item) => {
|
|
66
|
+
if (parentId !== void 0) result.set(item.id, parentId);
|
|
67
|
+
visit(getChildren(item), item.id);
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
visit(items);
|
|
71
|
+
return result;
|
|
72
|
+
}, [items, getChildren]);
|
|
73
|
+
const visibleIds = useMemo(() => new Set(visibleItems.map((item) => item.id)), [visibleItems]);
|
|
74
|
+
let effectiveFocusedId = focusedId;
|
|
75
|
+
if (!effectiveFocusedId || !visibleIds.has(effectiveFocusedId)) {
|
|
76
|
+
let ancestor = effectiveFocusedId;
|
|
77
|
+
while (ancestor && !visibleIds.has(ancestor)) ancestor = parentIds.get(ancestor);
|
|
78
|
+
effectiveFocusedId = ancestor ?? visibleItems[0]?.id;
|
|
79
|
+
}
|
|
80
|
+
useEffect(() => {
|
|
81
|
+
if (pendingFocusId.current && visibleIds.has(pendingFocusId.current)) {
|
|
82
|
+
itemRefs.current.get(pendingFocusId.current)?.focus();
|
|
83
|
+
pendingFocusId.current = null;
|
|
84
|
+
}
|
|
85
|
+
}, [visibleItems, visibleIds]);
|
|
86
|
+
useEffect(() => {
|
|
87
|
+
if (focusedId !== effectiveFocusedId && effectiveFocusedId) {
|
|
88
|
+
setFocusedId(effectiveFocusedId);
|
|
89
|
+
onFocusedChange?.(effectiveFocusedId);
|
|
90
|
+
if (focusWithinTree.current) itemRefs.current.get(effectiveFocusedId)?.focus();
|
|
91
|
+
}
|
|
92
|
+
}, [
|
|
93
|
+
effectiveFocusedId,
|
|
94
|
+
focusedId,
|
|
95
|
+
onFocusedChange
|
|
96
|
+
]);
|
|
97
|
+
const commitExpandedIds = (nextIds) => {
|
|
98
|
+
const next = normalizeIds(nextIds);
|
|
99
|
+
if (!isExpandedControlled) setUncontrolledExpandedIds(next);
|
|
100
|
+
onExpandedChange?.(next);
|
|
101
|
+
};
|
|
102
|
+
const commitSelectedIds = (nextIds) => {
|
|
103
|
+
const next = normalizeIds(nextIds);
|
|
104
|
+
if (!isSelectionControlled) setUncontrolledSelectedIds(next);
|
|
105
|
+
onSelectionChange?.(next);
|
|
106
|
+
};
|
|
107
|
+
const loadNodeChildren = useCallback(async (item) => {
|
|
108
|
+
if (!loadChildren || !item.hasChildren || item.children !== void 0) return;
|
|
109
|
+
if (loadedChildren.has(item.id) || inFlightLoads.current.has(item.id)) return;
|
|
110
|
+
inFlightLoads.current.add(item.id);
|
|
111
|
+
setLoadingIds((current) => [...current, item.id]);
|
|
112
|
+
setLoadErrors((current) => {
|
|
113
|
+
const next = new Map(current);
|
|
114
|
+
next.delete(item.id);
|
|
115
|
+
return next;
|
|
116
|
+
});
|
|
117
|
+
try {
|
|
118
|
+
const children = await loadChildren(item);
|
|
119
|
+
setLoadedChildren((current) => {
|
|
120
|
+
const next = new Map(current);
|
|
121
|
+
next.set(item.id, children);
|
|
122
|
+
return next;
|
|
123
|
+
});
|
|
124
|
+
} catch (error) {
|
|
125
|
+
setLoadErrors((current) => {
|
|
126
|
+
const next = new Map(current);
|
|
127
|
+
next.set(item.id, error);
|
|
128
|
+
return next;
|
|
129
|
+
});
|
|
130
|
+
onLoadChildrenError?.(item, error);
|
|
131
|
+
} finally {
|
|
132
|
+
inFlightLoads.current.delete(item.id);
|
|
133
|
+
setLoadingIds((current) => current.filter((id) => id !== item.id));
|
|
134
|
+
}
|
|
135
|
+
}, [
|
|
136
|
+
loadChildren,
|
|
137
|
+
loadedChildren,
|
|
138
|
+
onLoadChildrenError
|
|
139
|
+
]);
|
|
140
|
+
useEffect(() => {
|
|
141
|
+
const previous = new Set(previousExpandedIds.current ?? []);
|
|
142
|
+
const newlyExpandedIds = currentExpandedIds.filter((id) => !previous.has(id));
|
|
143
|
+
previousExpandedIds.current = normalizeIds(currentExpandedIds);
|
|
144
|
+
newlyExpandedIds.forEach((id) => {
|
|
145
|
+
const item = findItemById(items, id, getChildren);
|
|
146
|
+
if (item) loadNodeChildren(item);
|
|
147
|
+
});
|
|
148
|
+
}, [
|
|
149
|
+
currentExpandedIds,
|
|
150
|
+
items,
|
|
151
|
+
getChildren,
|
|
152
|
+
loadNodeChildren
|
|
153
|
+
]);
|
|
154
|
+
const toggleExpanded = (item) => {
|
|
155
|
+
if (!hasChildren(item)) return;
|
|
156
|
+
const next = new Set(currentExpandedIds);
|
|
157
|
+
if (next.has(item.id)) next.delete(item.id);
|
|
158
|
+
else {
|
|
159
|
+
next.add(item.id);
|
|
160
|
+
loadNodeChildren(item);
|
|
161
|
+
}
|
|
162
|
+
commitExpandedIds(Array.from(next));
|
|
163
|
+
};
|
|
164
|
+
const selectItem = (item, toggleSingle = false) => {
|
|
165
|
+
if (selectionMode === "none" || item.disabled || item.selectable === false) return;
|
|
166
|
+
if (selectionMode === "single") {
|
|
167
|
+
if (currentSelectedIds.length === 1 && currentSelectedIds[0] === item.id) {
|
|
168
|
+
if (toggleSingle) commitSelectedIds([]);
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
commitSelectedIds([item.id]);
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
const next = new Set(currentSelectedIds);
|
|
175
|
+
if (next.has(item.id)) next.delete(item.id);
|
|
176
|
+
else next.add(item.id);
|
|
177
|
+
commitSelectedIds(Array.from(next));
|
|
178
|
+
};
|
|
179
|
+
const focusItem = (id) => {
|
|
180
|
+
const element = itemRefs.current.get(id);
|
|
181
|
+
if (element) element.focus();
|
|
182
|
+
else {
|
|
183
|
+
setFocusedId(id);
|
|
184
|
+
onFocusedChange?.(id);
|
|
185
|
+
pendingFocusId.current = id;
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
const expandSiblings = (itemId) => {
|
|
189
|
+
const parentId = parentIds.get(itemId);
|
|
190
|
+
const parentItem = parentId ? findItemById(items, parentId, getChildren) : void 0;
|
|
191
|
+
const siblings = parentItem ? getChildren(parentItem) : items;
|
|
192
|
+
const next = new Set(currentExpandedIds);
|
|
193
|
+
let changed = false;
|
|
194
|
+
siblings.forEach((sibling) => {
|
|
195
|
+
if (hasChildren(sibling) && !next.has(sibling.id)) {
|
|
196
|
+
next.add(sibling.id);
|
|
197
|
+
changed = true;
|
|
198
|
+
loadNodeChildren(sibling);
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
if (changed) commitExpandedIds(Array.from(next));
|
|
202
|
+
};
|
|
203
|
+
const handleKeyDown = (event, item, parentId) => {
|
|
204
|
+
const eventTarget = event.target;
|
|
205
|
+
if (eventTarget.closest("[role=\"treeitem\"]") !== event.currentTarget) return;
|
|
206
|
+
if (eventTarget.closest("button, a, input, select, textarea, [contenteditable='true']")) return;
|
|
207
|
+
const index = visibleItems.findIndex((visibleItem) => visibleItem.id === item.id);
|
|
208
|
+
const inheritedDirection = event.currentTarget.closest("[dir]")?.getAttribute("dir");
|
|
209
|
+
const isRtl = dir === "rtl" || dir === void 0 && inheritedDirection === "rtl";
|
|
210
|
+
const openKey = isRtl ? "ArrowLeft" : "ArrowRight";
|
|
211
|
+
const closeKey = isRtl ? "ArrowRight" : "ArrowLeft";
|
|
212
|
+
let handled = false;
|
|
213
|
+
switch (event.key) {
|
|
214
|
+
case "ArrowDown":
|
|
215
|
+
if (index < visibleItems.length - 1) focusItem(visibleItems[index + 1].id);
|
|
216
|
+
handled = true;
|
|
217
|
+
break;
|
|
218
|
+
case "ArrowUp":
|
|
219
|
+
if (index > 0) focusItem(visibleItems[index - 1].id);
|
|
220
|
+
handled = true;
|
|
221
|
+
break;
|
|
222
|
+
case "Home":
|
|
223
|
+
if (visibleItems[0]) focusItem(visibleItems[0].id);
|
|
224
|
+
handled = true;
|
|
225
|
+
break;
|
|
226
|
+
case "End":
|
|
227
|
+
if (visibleItems.length > 0) focusItem(visibleItems[visibleItems.length - 1].id);
|
|
228
|
+
handled = true;
|
|
229
|
+
break;
|
|
230
|
+
case "Enter":
|
|
231
|
+
if (item.href) {
|
|
232
|
+
if (!item.disabled) {
|
|
233
|
+
event.currentTarget.querySelector("a.puzzle-tree__row")?.click();
|
|
234
|
+
onItemActivate?.(item);
|
|
235
|
+
}
|
|
236
|
+
} else if (hasChildren(item)) {
|
|
237
|
+
toggleExpanded(item);
|
|
238
|
+
if (!item.disabled) onItemActivate?.(item);
|
|
239
|
+
} else {
|
|
240
|
+
selectItem(item);
|
|
241
|
+
if (!item.disabled) onItemActivate?.(item);
|
|
242
|
+
}
|
|
243
|
+
handled = true;
|
|
244
|
+
break;
|
|
245
|
+
case " ":
|
|
246
|
+
case "Spacebar":
|
|
247
|
+
selectItem(item, true);
|
|
248
|
+
handled = true;
|
|
249
|
+
break;
|
|
250
|
+
case "*":
|
|
251
|
+
expandSiblings(item.id);
|
|
252
|
+
handled = true;
|
|
253
|
+
break;
|
|
254
|
+
default: if (event.key.length === 1 && !event.altKey && !event.ctrlKey && !event.metaKey) {
|
|
255
|
+
if (!typeahead) break;
|
|
256
|
+
const currentTime = event.timeStamp;
|
|
257
|
+
const previousValue = currentTime - typeaheadState.current.time > 500 ? "" : typeaheadState.current.value;
|
|
258
|
+
const normalizedPrevious = normalizeSearchText(previousValue);
|
|
259
|
+
const normalizedKey = normalizeSearchText(event.key);
|
|
260
|
+
const searchValue = normalizedPrevious.length > 0 && [...normalizedPrevious].every((character) => character === normalizedKey) ? event.key : `${previousValue}${event.key}`;
|
|
261
|
+
typeaheadState.current = {
|
|
262
|
+
value: searchValue,
|
|
263
|
+
time: currentTime
|
|
264
|
+
};
|
|
265
|
+
const normalizedSearch = normalizeSearchText(searchValue);
|
|
266
|
+
const match = [...visibleItems.slice(index + 1), ...visibleItems.slice(0, index + 1)].find((candidate) => normalizeSearchText(getTextValue(candidate)).startsWith(normalizedSearch));
|
|
267
|
+
if (match) focusItem(match.id);
|
|
268
|
+
handled = true;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
if (event.key === openKey) {
|
|
272
|
+
if (hasChildren(item)) {
|
|
273
|
+
if (!expandedSet.has(item.id)) toggleExpanded(item);
|
|
274
|
+
else {
|
|
275
|
+
const firstChild = getChildren(item)[0];
|
|
276
|
+
if (firstChild) focusItem(firstChild.id);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
handled = true;
|
|
280
|
+
} else if (event.key === closeKey) {
|
|
281
|
+
if (hasChildren(item) && expandedSet.has(item.id)) toggleExpanded(item);
|
|
282
|
+
else if (parentId) focusItem(parentId);
|
|
283
|
+
handled = true;
|
|
284
|
+
}
|
|
285
|
+
if (handled) event.preventDefault();
|
|
286
|
+
};
|
|
287
|
+
const handleItemClick = (event, item) => {
|
|
288
|
+
const target = event.target;
|
|
289
|
+
if (target.closest("[role=\"treeitem\"]") !== event.currentTarget) return;
|
|
290
|
+
if (target.closest("button, a, input, select, textarea, [data-tree-stop-selection]")) return;
|
|
291
|
+
focusItem(item.id);
|
|
292
|
+
if (hasChildren(item) && (target.closest("[data-tree-toggle]") || expandOnItemClick)) {
|
|
293
|
+
toggleExpanded(item);
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
selectItem(item);
|
|
297
|
+
};
|
|
298
|
+
/**
|
|
299
|
+
* Handles pointer activation of a linked row.
|
|
300
|
+
*
|
|
301
|
+
* The row link is the navigation target, but the tree item remains the
|
|
302
|
+
* roving-focus element. Clicking the expansion affordance is the exception:
|
|
303
|
+
* it expands the branch and deliberately does not navigate.
|
|
304
|
+
*/
|
|
305
|
+
const handleItemLinkClick = (event, item) => {
|
|
306
|
+
if (event.target.closest("[data-tree-toggle]")) {
|
|
307
|
+
event.preventDefault();
|
|
308
|
+
event.stopPropagation();
|
|
309
|
+
focusItem(item.id);
|
|
310
|
+
toggleExpanded(item);
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
if (item.disabled) {
|
|
314
|
+
event.preventDefault();
|
|
315
|
+
event.stopPropagation();
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
focusItem(item.id);
|
|
319
|
+
selectItem(item);
|
|
320
|
+
};
|
|
321
|
+
const renderItems = (nodes, depth = 0, parentId) => nodes.map((item, index) => {
|
|
322
|
+
const itemChildren = getChildren(item);
|
|
323
|
+
const itemHasChildren = hasChildren(item);
|
|
324
|
+
const expanded = itemHasChildren && expandedSet.has(item.id);
|
|
325
|
+
const disabled = Boolean(item.disabled);
|
|
326
|
+
const active = Boolean(getItemActive?.(item));
|
|
327
|
+
const selected = selectionMode !== "none" && selectedSet.has(item.id) && item.selectable !== false && !disabled;
|
|
328
|
+
const loading = loadingSet.has(item.id);
|
|
329
|
+
const focused = effectiveFocusedId === item.id;
|
|
330
|
+
const itemState = {
|
|
331
|
+
expanded,
|
|
332
|
+
selected,
|
|
333
|
+
focused,
|
|
334
|
+
loading,
|
|
335
|
+
disabled,
|
|
336
|
+
hasChildren: itemHasChildren
|
|
337
|
+
};
|
|
338
|
+
const iconContent = renderIcon ? renderIcon(item, itemState) : item.icon;
|
|
339
|
+
const itemId = `${generatedId}-item-${encodeURIComponent(item.id)}`;
|
|
340
|
+
const selectable = selectionMode !== "none" && item.selectable !== false && !disabled;
|
|
341
|
+
const hasLoadError = loadErrors.has(item.id);
|
|
342
|
+
const rowContent = /* @__PURE__ */ jsxs(Fragment$1, { children: [itemHasChildren ? /* @__PURE__ */ jsx("span", {
|
|
343
|
+
className: "puzzle-tree__toggle",
|
|
344
|
+
"data-tree-toggle": "true",
|
|
345
|
+
"data-expanded": expanded || void 0,
|
|
346
|
+
"aria-hidden": "true"
|
|
347
|
+
}) : /* @__PURE__ */ jsx("span", {
|
|
348
|
+
className: "puzzle-tree__toggle-spacer",
|
|
349
|
+
"aria-hidden": "true"
|
|
350
|
+
}), renderItem ? renderItem(item, itemState) : /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
351
|
+
iconContent != null && /* @__PURE__ */ jsx("span", {
|
|
352
|
+
className: "puzzle-tree__icon",
|
|
353
|
+
"aria-hidden": "true",
|
|
354
|
+
children: iconContent
|
|
355
|
+
}),
|
|
356
|
+
/* @__PURE__ */ jsx("span", {
|
|
357
|
+
className: "puzzle-tree__label",
|
|
358
|
+
children: renderLabel ? renderLabel(item, itemState) : item.label
|
|
359
|
+
}),
|
|
360
|
+
item.endAdornment != null && /* @__PURE__ */ jsx("span", {
|
|
361
|
+
className: "puzzle-tree__adornment",
|
|
362
|
+
children: item.endAdornment
|
|
363
|
+
})
|
|
364
|
+
] })] });
|
|
365
|
+
const row = item.href !== void 0 ? /* @__PURE__ */ jsx(Link, {
|
|
366
|
+
href: item.href,
|
|
367
|
+
className: "puzzle-tree__row",
|
|
368
|
+
tabIndex: -1,
|
|
369
|
+
"aria-current": active ? "page" : void 0,
|
|
370
|
+
"aria-disabled": disabled || void 0,
|
|
371
|
+
"data-tree-row-link": "true",
|
|
372
|
+
onClick: (event) => handleItemLinkClick(event, item),
|
|
373
|
+
children: rowContent
|
|
374
|
+
}) : /* @__PURE__ */ jsx("div", {
|
|
375
|
+
className: "puzzle-tree__row",
|
|
376
|
+
children: rowContent
|
|
377
|
+
});
|
|
378
|
+
return /* @__PURE__ */ jsxs("li", {
|
|
379
|
+
ref: (element) => {
|
|
380
|
+
if (element) itemRefs.current.set(item.id, element);
|
|
381
|
+
else itemRefs.current.delete(item.id);
|
|
382
|
+
},
|
|
383
|
+
id: itemId,
|
|
384
|
+
role: "treeitem",
|
|
385
|
+
"aria-level": depth + 1,
|
|
386
|
+
"aria-posinset": index + 1,
|
|
387
|
+
"aria-setsize": nodes.length,
|
|
388
|
+
"aria-expanded": itemHasChildren ? expanded : void 0,
|
|
389
|
+
"aria-selected": selectable ? selected : void 0,
|
|
390
|
+
"aria-disabled": disabled || void 0,
|
|
391
|
+
"aria-busy": loading || void 0,
|
|
392
|
+
tabIndex: focused ? 0 : -1,
|
|
393
|
+
className: cn("puzzle-tree__item", itemClassName),
|
|
394
|
+
"data-tree-item-id": item.id,
|
|
395
|
+
"data-active": active || void 0,
|
|
396
|
+
"data-selected": selected || void 0,
|
|
397
|
+
"data-disabled": disabled || void 0,
|
|
398
|
+
"data-expanded": itemHasChildren ? expanded : void 0,
|
|
399
|
+
onFocus: (event) => {
|
|
400
|
+
if (event.target !== event.currentTarget) return;
|
|
401
|
+
if (focusedId !== item.id) {
|
|
402
|
+
setFocusedId(item.id);
|
|
403
|
+
onFocusedChange?.(item.id);
|
|
404
|
+
}
|
|
405
|
+
},
|
|
406
|
+
onClick: (event) => handleItemClick(event, item),
|
|
407
|
+
onKeyDown: (event) => handleKeyDown(event, item, parentId),
|
|
408
|
+
children: [row, itemHasChildren && expanded && /* @__PURE__ */ jsxs("ul", {
|
|
409
|
+
className: "puzzle-tree__group",
|
|
410
|
+
role: "group",
|
|
411
|
+
children: [loading || hasLoadError ? /* @__PURE__ */ jsx("li", {
|
|
412
|
+
role: "none",
|
|
413
|
+
className: cn("puzzle-tree__status-row", hasLoadError && !loading && "puzzle-tree__status-row--error"),
|
|
414
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
415
|
+
role: "status",
|
|
416
|
+
"aria-live": "polite",
|
|
417
|
+
children: loading ? loadingLabel : loadErrorLabel
|
|
418
|
+
})
|
|
419
|
+
}) : null, renderItems(itemChildren, depth + 1, item.id)]
|
|
420
|
+
})]
|
|
421
|
+
}, item.id);
|
|
422
|
+
});
|
|
423
|
+
const rootStyle = {
|
|
424
|
+
...style,
|
|
425
|
+
...indentation !== void 0 ? { "--puzzle-tree-indentation": typeof indentation === "number" ? `${indentation}px` : indentation } : {}
|
|
426
|
+
};
|
|
427
|
+
return /* @__PURE__ */ jsx("ul", {
|
|
428
|
+
...rootProps,
|
|
429
|
+
role: "tree",
|
|
430
|
+
"aria-multiselectable": selectionMode === "multiple" || void 0,
|
|
431
|
+
className: cn("puzzle-tree", `puzzle-tree--${size}`, className),
|
|
432
|
+
style: rootStyle,
|
|
433
|
+
dir,
|
|
434
|
+
tabIndex: visibleItems.length === 0 ? 0 : void 0,
|
|
435
|
+
onFocusCapture: () => {
|
|
436
|
+
focusWithinTree.current = true;
|
|
437
|
+
},
|
|
438
|
+
onBlurCapture: (event) => {
|
|
439
|
+
const nextTarget = event.relatedTarget;
|
|
440
|
+
const target = event.target;
|
|
441
|
+
if (event.currentTarget.contains(target) && (nextTarget && !event.currentTarget.contains(nextTarget) || !nextTarget && target.isConnected)) focusWithinTree.current = false;
|
|
442
|
+
},
|
|
443
|
+
children: renderItems(items)
|
|
444
|
+
});
|
|
445
|
+
};
|
|
446
|
+
const findItemById = (nodes, id, getChildren) => {
|
|
447
|
+
for (const item of nodes) {
|
|
448
|
+
if (item.id === id) return item;
|
|
449
|
+
const found = findItemById(getChildren(item), id, getChildren);
|
|
450
|
+
if (found) return found;
|
|
451
|
+
}
|
|
452
|
+
};
|
|
453
|
+
export { TreeView };
|
|
454
|
+
|
|
455
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/navigation/tree-view/index.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n useCallback,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n type ComponentPropsWithRef,\n type CSSProperties,\n type KeyboardEvent,\n type MouseEvent,\n type ReactNode,\n} from \"react\";\nimport { cn } from \"@puzzle-ui/core\";\nimport { Link } from \"../link\";\nimport \"./tree-view.css\";\n\ntype TreeViewSelectionMode = \"none\" | \"single\" | \"multiple\";\ntype TreeViewSize = \"sm\" | \"md\";\n\ntype TreeViewItem<TData = unknown> = {\n /** Stable, unique identifier for this node. */\n id: string;\n\n /** Visible node label. Supply textValue when the label is not plain text. */\n label: ReactNode;\n\n /** Optional destination. When supplied, the complete row renders as a Puzzle Link. */\n href?: string;\n\n /** Plain-text value used by typeahead when label is not a string or number. */\n textValue?: string;\n\n /** Optional icon displayed before the label. */\n icon?: ReactNode;\n\n /** Optional, non-interactive content displayed after the label. */\n endAdornment?: ReactNode;\n\n /** Child nodes for a loaded branch. Omit for a leaf or a lazily loaded branch. */\n children?: TreeViewItem<TData>[];\n\n /** Marks a node as expandable before its children have been loaded. */\n hasChildren?: boolean;\n\n /** Prevents selection and activation; branches can still expand so descendants remain accessible. */\n disabled?: boolean;\n\n /** Allows a node to be excluded from selection without disabling expansion. */\n selectable?: boolean;\n\n /** Optional application data associated with the node. */\n data?: TData;\n};\n\ntype TreeViewItemState = {\n expanded: boolean;\n selected: boolean;\n focused: boolean;\n loading: boolean;\n disabled: boolean;\n hasChildren: boolean;\n};\n\ntype TreeViewProps<TData = unknown> = Omit<\n ComponentPropsWithRef<\"ul\">,\n | \"children\"\n | \"onKeyDown\"\n | \"onFocusCapture\"\n | \"onBlurCapture\"\n | \"role\"\n | \"tabIndex\"\n | \"aria-multiselectable\"\n> &\n (\n | { \"aria-label\": string; \"aria-labelledby\"?: string }\n | { \"aria-labelledby\": string; \"aria-label\"?: string }\n ) & {\n /** Hierarchical data rendered by the tree. Node IDs must be unique. */\n items: TreeViewItem<TData>[];\n\n /** Selection behavior. Defaults to single selection. */\n selectionMode?: TreeViewSelectionMode;\n\n /** Initial expanded node IDs for uncontrolled usage. Defaults to []. */\n defaultExpandedIds?: string[];\n\n /** Expanded node IDs for controlled usage. */\n expandedIds?: string[];\n\n /** Called with the next expanded node IDs. */\n onExpandedChange?: (expandedIds: string[]) => void;\n\n /** Initial selected node IDs for uncontrolled usage. Defaults to []. */\n defaultSelectedIds?: string[];\n\n /** Selected node IDs for controlled usage. */\n selectedIds?: string[];\n\n /** Called with the next selected node IDs. */\n onSelectionChange?: (selectedIds: string[]) => void;\n\n /** Initial roving-focus target. Defaults to the first selected node, then the first root node. */\n defaultFocusedId?: string;\n\n /** Called when keyboard or pointer interaction moves focus to another node. */\n onFocusedChange?: (focusedId: string) => void;\n\n /** Loads the children of a node marked with hasChildren when it is first expanded. */\n loadChildren?: (\n item: TreeViewItem<TData>,\n ) => Promise<TreeViewItem<TData>[]>;\n\n /** Called when lazy loading fails. Re-collapse and re-expand the node to retry. */\n onLoadChildrenError?: (item: TreeViewItem<TData>, error: unknown) => void;\n\n /** Called when a node is activated with Enter. */\n onItemActivate?: (item: TreeViewItem<TData>) => void;\n\n /** Determines whether an item matches the current route. */\n getItemActive?: (item: TreeViewItem<TData>) => boolean;\n\n /**\n * Custom node renderer. Replaces the icon, label and adornment of a row; the\n * expand indicator, row element and tree semantics are kept. Keep its contents non-interactive.\n */\n renderItem?: (\n item: TreeViewItem<TData>,\n state: TreeViewItemState,\n ) => ReactNode;\n\n /** Custom node-icon renderer. */\n renderIcon?: (\n item: TreeViewItem<TData>,\n state: TreeViewItemState,\n ) => ReactNode;\n\n /** Custom label renderer. Keep its contents non-interactive. */\n renderLabel?: (\n item: TreeViewItem<TData>,\n state: TreeViewItemState,\n ) => ReactNode;\n\n /** Clicking the label of a branch toggles it instead of selecting it. Defaults to false. */\n expandOnItemClick?: boolean;\n\n /** Visual density. Defaults to md. */\n size?: TreeViewSize;\n\n /** Indentation between hierarchy levels, in CSS units. Defaults to the theme spacing token. */\n indentation?: string | number;\n\n /** Enables character-based typeahead navigation. Defaults to true. */\n typeahead?: boolean;\n\n /** Text announced and displayed while lazy children are loading. */\n loadingLabel?: string;\n\n /** Text displayed when lazy loading fails. */\n loadErrorLabel?: string;\n\n /** Class applied to each tree item. */\n itemClassName?: string;\n };\n\nconst normalizeIds = (ids: string[] | undefined) =>\n Array.from(\n new Set(\n (ids ?? []).filter((id) => typeof id === \"string\" && id.length > 0),\n ),\n );\n\nconst getTextValue = <TData,>(item: TreeViewItem<TData>) => {\n if (item.textValue !== undefined) return item.textValue;\n\n if (typeof item.label === \"string\" || typeof item.label === \"number\") {\n return String(item.label);\n }\n\n return \"\";\n};\n\nconst normalizeSearchText = (value: string) =>\n value\n .normalize(\"NFD\")\n .replace(/[\\u0300-\\u036f]/g, \"\")\n .toLocaleLowerCase();\n\nconst TreeView = <TData,>({\n items,\n selectionMode = \"single\",\n defaultExpandedIds = [],\n expandedIds,\n onExpandedChange,\n defaultSelectedIds = [],\n selectedIds,\n onSelectionChange,\n defaultFocusedId,\n onFocusedChange,\n loadChildren,\n onLoadChildrenError,\n onItemActivate,\n getItemActive,\n renderItem,\n renderIcon,\n renderLabel,\n expandOnItemClick = false,\n typeahead = true,\n size = \"md\",\n indentation,\n loadingLabel = \"Loading…\",\n loadErrorLabel = \"Could not load children. Collapse and expand to retry.\",\n itemClassName,\n className,\n style,\n dir,\n ...rootProps\n}: TreeViewProps<TData>) => {\n const generatedId = useId();\n const isExpandedControlled = expandedIds !== undefined;\n const isSelectionControlled = selectedIds !== undefined;\n\n const [uncontrolledExpandedIds, setUncontrolledExpandedIds] = useState(() =>\n normalizeIds(defaultExpandedIds),\n );\n\n const [uncontrolledSelectedIds, setUncontrolledSelectedIds] = useState(() =>\n normalizeIds(defaultSelectedIds),\n );\n\n const [focusedId, setFocusedId] = useState<string | undefined>(\n () =>\n defaultFocusedId ??\n (selectionMode === \"none\"\n ? undefined\n : normalizeIds(selectedIds ?? defaultSelectedIds)[0]) ??\n items[0]?.id,\n );\n\n const [loadedChildren, setLoadedChildren] = useState<\n Map<string, TreeViewItem<TData>[]>\n >(() => new Map());\n\n const [loadingIds, setLoadingIds] = useState<string[]>([]);\n\n const [loadErrors, setLoadErrors] = useState<Map<string, unknown>>(\n () => new Map(),\n );\n\n const itemRefs = useRef(new Map<string, HTMLLIElement>());\n const inFlightLoads = useRef(new Set<string>());\n const previousExpandedIds = useRef<string[] | null>(null);\n const pendingFocusId = useRef<string | null>(null);\n const focusWithinTree = useRef(false);\n const typeaheadState = useRef({ value: \"\", time: 0 });\n\n const currentExpandedIds = isExpandedControlled\n ? (expandedIds ?? [])\n : uncontrolledExpandedIds;\n\n const requestedSelectedIds = isSelectionControlled\n ? (selectedIds ?? [])\n : uncontrolledSelectedIds;\n\n const currentSelectedIds =\n selectionMode === \"single\"\n ? requestedSelectedIds.slice(0, 1)\n : requestedSelectedIds;\n\n const expandedSet = useMemo(\n () => new Set(normalizeIds(currentExpandedIds)),\n [currentExpandedIds],\n );\n\n const selectedSet = useMemo(\n () => new Set(normalizeIds(currentSelectedIds)),\n [currentSelectedIds],\n );\n\n const loadingSet = useMemo(() => new Set(loadingIds), [loadingIds]);\n\n const getChildren = useCallback(\n (item: TreeViewItem<TData>) =>\n item.children ?? loadedChildren.get(item.id) ?? [],\n [loadedChildren],\n );\n\n const hasChildren = useCallback(\n (item: TreeViewItem<TData>) => {\n if (item.children !== undefined || loadedChildren.has(item.id)) {\n return getChildren(item).length > 0;\n }\n\n return Boolean(item.hasChildren);\n },\n [getChildren, loadedChildren],\n );\n\n const visibleItems = useMemo(() => {\n const result: TreeViewItem<TData>[] = [];\n\n const visit = (nodes: TreeViewItem<TData>[]) => {\n nodes.forEach((item) => {\n result.push(item);\n\n const children = getChildren(item);\n\n if (\n expandedSet.has(item.id) &&\n hasChildren(item) &&\n children.length > 0\n ) {\n visit(children);\n }\n });\n };\n\n visit(items);\n\n return result;\n }, [items, expandedSet, getChildren, hasChildren]);\n\n const parentIds = useMemo(() => {\n const result = new Map<string, string>();\n\n const visit = (nodes: TreeViewItem<TData>[], parentId?: string) => {\n nodes.forEach((item) => {\n if (parentId !== undefined) {\n result.set(item.id, parentId);\n }\n\n visit(getChildren(item), item.id);\n });\n };\n\n visit(items);\n\n return result;\n }, [items, getChildren]);\n\n const visibleIds = useMemo(\n () => new Set(visibleItems.map((item) => item.id)),\n [visibleItems],\n );\n\n let effectiveFocusedId = focusedId;\n\n if (!effectiveFocusedId || !visibleIds.has(effectiveFocusedId)) {\n let ancestor = effectiveFocusedId;\n\n while (ancestor && !visibleIds.has(ancestor)) {\n ancestor = parentIds.get(ancestor);\n }\n\n effectiveFocusedId = ancestor ?? visibleItems[0]?.id;\n }\n\n useEffect(() => {\n if (pendingFocusId.current && visibleIds.has(pendingFocusId.current)) {\n itemRefs.current.get(pendingFocusId.current)?.focus();\n pendingFocusId.current = null;\n }\n }, [visibleItems, visibleIds]);\n\n useEffect(() => {\n if (focusedId !== effectiveFocusedId && effectiveFocusedId) {\n setFocusedId(effectiveFocusedId);\n onFocusedChange?.(effectiveFocusedId);\n\n if (focusWithinTree.current) {\n itemRefs.current.get(effectiveFocusedId)?.focus();\n }\n }\n }, [effectiveFocusedId, focusedId, onFocusedChange]);\n\n const commitExpandedIds = (nextIds: string[]) => {\n const next = normalizeIds(nextIds);\n\n if (!isExpandedControlled) {\n setUncontrolledExpandedIds(next);\n }\n\n onExpandedChange?.(next);\n };\n\n const commitSelectedIds = (nextIds: string[]) => {\n const next = normalizeIds(nextIds);\n\n if (!isSelectionControlled) {\n setUncontrolledSelectedIds(next);\n }\n\n onSelectionChange?.(next);\n };\n\n const loadNodeChildren = useCallback(\n async (item: TreeViewItem<TData>) => {\n if (!loadChildren || !item.hasChildren || item.children !== undefined) {\n return;\n }\n\n if (loadedChildren.has(item.id) || inFlightLoads.current.has(item.id)) {\n return;\n }\n\n inFlightLoads.current.add(item.id);\n setLoadingIds((current) => [...current, item.id]);\n\n setLoadErrors((current) => {\n const next = new Map(current);\n next.delete(item.id);\n return next;\n });\n\n try {\n const children = await loadChildren(item);\n\n setLoadedChildren((current) => {\n const next = new Map(current);\n next.set(item.id, children);\n return next;\n });\n } catch (error) {\n setLoadErrors((current) => {\n const next = new Map(current);\n next.set(item.id, error);\n return next;\n });\n\n onLoadChildrenError?.(item, error);\n } finally {\n inFlightLoads.current.delete(item.id);\n setLoadingIds((current) => current.filter((id) => id !== item.id));\n }\n },\n [loadChildren, loadedChildren, onLoadChildrenError],\n );\n\n // Also load branches that were expanded through default or controlled props.\n // Tracking newly expanded IDs avoids retrying a failed request on unrelated renders.\n useEffect(() => {\n const previous = new Set(previousExpandedIds.current ?? []);\n\n const newlyExpandedIds = currentExpandedIds.filter(\n (id) => !previous.has(id),\n );\n\n previousExpandedIds.current = normalizeIds(currentExpandedIds);\n\n newlyExpandedIds.forEach((id) => {\n const item = findItemById(items, id, getChildren);\n if (item) void loadNodeChildren(item);\n });\n }, [currentExpandedIds, items, getChildren, loadNodeChildren]);\n\n const toggleExpanded = (item: TreeViewItem<TData>) => {\n if (!hasChildren(item)) return;\n\n const next = new Set(currentExpandedIds);\n\n if (next.has(item.id)) {\n next.delete(item.id);\n } else {\n next.add(item.id);\n void loadNodeChildren(item);\n }\n\n commitExpandedIds(Array.from(next));\n };\n\n const selectItem = (item: TreeViewItem<TData>, toggleSingle = false) => {\n if (\n selectionMode === \"none\" ||\n item.disabled ||\n item.selectable === false\n ) {\n return;\n }\n\n if (selectionMode === \"single\") {\n if (\n currentSelectedIds.length === 1 &&\n currentSelectedIds[0] === item.id\n ) {\n if (toggleSingle) commitSelectedIds([]);\n return;\n }\n\n commitSelectedIds([item.id]);\n return;\n }\n\n const next = new Set(currentSelectedIds);\n\n if (next.has(item.id)) {\n next.delete(item.id);\n } else {\n next.add(item.id);\n }\n\n commitSelectedIds(Array.from(next));\n };\n\n const focusItem = (id: string) => {\n const element = itemRefs.current.get(id);\n\n if (element) {\n element.focus();\n } else {\n setFocusedId(id);\n onFocusedChange?.(id);\n pendingFocusId.current = id;\n }\n };\n\n const expandSiblings = (itemId: string) => {\n const parentId = parentIds.get(itemId);\n\n const parentItem = parentId\n ? findItemById(items, parentId, getChildren)\n : undefined;\n\n const siblings = parentItem ? getChildren(parentItem) : items;\n const next = new Set(currentExpandedIds);\n let changed = false;\n\n siblings.forEach((sibling) => {\n if (hasChildren(sibling) && !next.has(sibling.id)) {\n next.add(sibling.id);\n changed = true;\n void loadNodeChildren(sibling);\n }\n });\n\n if (changed) {\n commitExpandedIds(Array.from(next));\n }\n };\n\n const handleKeyDown = (\n event: KeyboardEvent<HTMLLIElement>,\n item: TreeViewItem<TData>,\n parentId?: string,\n ) => {\n const eventTarget = event.target as HTMLElement;\n\n if (eventTarget.closest('[role=\"treeitem\"]') !== event.currentTarget) {\n return;\n }\n\n if (\n eventTarget.closest(\n \"button, a, input, select, textarea, [contenteditable='true']\",\n )\n ) {\n return;\n }\n\n const index = visibleItems.findIndex(\n (visibleItem) => visibleItem.id === item.id,\n );\n\n const inheritedDirection = event.currentTarget\n .closest(\"[dir]\")\n ?.getAttribute(\"dir\");\n\n const isRtl =\n dir === \"rtl\" || (dir === undefined && inheritedDirection === \"rtl\");\n\n const openKey = isRtl ? \"ArrowLeft\" : \"ArrowRight\";\n const closeKey = isRtl ? \"ArrowRight\" : \"ArrowLeft\";\n let handled = false;\n\n switch (event.key) {\n case \"ArrowDown\":\n if (index < visibleItems.length - 1) {\n focusItem(visibleItems[index + 1].id);\n }\n\n handled = true;\n break;\n\n case \"ArrowUp\":\n if (index > 0) {\n focusItem(visibleItems[index - 1].id);\n }\n\n handled = true;\n break;\n\n case \"Home\":\n if (visibleItems[0]) {\n focusItem(visibleItems[0].id);\n }\n\n handled = true;\n break;\n\n case \"End\":\n if (visibleItems.length > 0) {\n focusItem(visibleItems[visibleItems.length - 1].id);\n }\n\n handled = true;\n break;\n\n case \"Enter\":\n if (item.href) {\n if (!item.disabled) {\n event.currentTarget\n .querySelector<HTMLAnchorElement>(\"a.puzzle-tree__row\")\n ?.click();\n\n onItemActivate?.(item);\n }\n } else if (hasChildren(item)) {\n toggleExpanded(item);\n if (!item.disabled) onItemActivate?.(item);\n } else {\n selectItem(item);\n if (!item.disabled) onItemActivate?.(item);\n }\n\n handled = true;\n break;\n\n case \" \":\n case \"Spacebar\":\n selectItem(item, true);\n handled = true;\n break;\n\n case \"*\":\n expandSiblings(item.id);\n handled = true;\n break;\n\n default:\n if (\n event.key.length === 1 &&\n !event.altKey &&\n !event.ctrlKey &&\n !event.metaKey\n ) {\n if (!typeahead) break;\n\n const currentTime = event.timeStamp;\n const isExpired = currentTime - typeaheadState.current.time > 500;\n const previousValue = isExpired ? \"\" : typeaheadState.current.value;\n const normalizedPrevious = normalizeSearchText(previousValue);\n const normalizedKey = normalizeSearchText(event.key);\n\n const isRepeatedCharacter =\n normalizedPrevious.length > 0 &&\n [...normalizedPrevious].every(\n (character) => character === normalizedKey,\n );\n\n const searchValue = isRepeatedCharacter\n ? event.key\n : `${previousValue}${event.key}`;\n\n typeaheadState.current = {\n value: searchValue,\n time: currentTime,\n };\n\n const normalizedSearch = normalizeSearchText(searchValue);\n\n const orderedItems = [\n ...visibleItems.slice(index + 1),\n ...visibleItems.slice(0, index + 1),\n ];\n\n const match = orderedItems.find((candidate) =>\n normalizeSearchText(getTextValue(candidate)).startsWith(\n normalizedSearch,\n ),\n );\n\n if (match) {\n focusItem(match.id);\n }\n\n handled = true;\n }\n }\n\n if (event.key === openKey) {\n if (hasChildren(item)) {\n if (!expandedSet.has(item.id)) {\n toggleExpanded(item);\n } else {\n const firstChild = getChildren(item)[0];\n if (firstChild) focusItem(firstChild.id);\n }\n }\n\n handled = true;\n } else if (event.key === closeKey) {\n if (hasChildren(item) && expandedSet.has(item.id)) {\n toggleExpanded(item);\n } else if (parentId) {\n focusItem(parentId);\n }\n\n handled = true;\n }\n\n if (handled) {\n event.preventDefault();\n }\n };\n\n const handleItemClick = (\n event: MouseEvent<HTMLLIElement>,\n item: TreeViewItem<TData>,\n ) => {\n const target = event.target as HTMLElement;\n const targetTreeItem = target.closest('[role=\"treeitem\"]');\n\n // Ignore bubbled clicks from descendants and clicks on custom interactive adornments.\n if (targetTreeItem !== event.currentTarget) return;\n\n if (\n target.closest(\n \"button, a, input, select, textarea, [data-tree-stop-selection]\",\n )\n ) {\n return;\n }\n\n focusItem(item.id);\n\n if (\n hasChildren(item) &&\n (target.closest(\"[data-tree-toggle]\") || expandOnItemClick)\n ) {\n toggleExpanded(item);\n return;\n }\n\n selectItem(item);\n };\n\n /**\n * Handles pointer activation of a linked row.\n *\n * The row link is the navigation target, but the tree item remains the\n * roving-focus element. Clicking the expansion affordance is the exception:\n * it expands the branch and deliberately does not navigate.\n */\n const handleItemLinkClick = (\n event: MouseEvent<HTMLAnchorElement>,\n item: TreeViewItem<TData>,\n ) => {\n const target = event.target as Element;\n\n if (target.closest(\"[data-tree-toggle]\")) {\n event.preventDefault();\n event.stopPropagation();\n\n focusItem(item.id);\n toggleExpanded(item);\n return;\n }\n\n if (item.disabled) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n\n focusItem(item.id);\n selectItem(item);\n };\n\n const renderItems = (\n nodes: TreeViewItem<TData>[],\n depth = 0,\n parentId?: string,\n ): ReactNode =>\n nodes.map((item, index) => {\n const itemChildren = getChildren(item);\n const itemHasChildren = hasChildren(item);\n const expanded = itemHasChildren && expandedSet.has(item.id);\n const disabled = Boolean(item.disabled);\n const active = Boolean(getItemActive?.(item));\n\n const selected =\n selectionMode !== \"none\" &&\n selectedSet.has(item.id) &&\n item.selectable !== false &&\n !disabled;\n\n const loading = loadingSet.has(item.id);\n const focused = effectiveFocusedId === item.id;\n\n const itemState: TreeViewItemState = {\n expanded,\n selected,\n focused,\n loading,\n disabled,\n hasChildren: itemHasChildren,\n };\n\n const iconContent = renderIcon ? renderIcon(item, itemState) : item.icon;\n const itemId = `${generatedId}-item-${encodeURIComponent(item.id)}`;\n\n const selectable =\n selectionMode !== \"none\" && item.selectable !== false && !disabled;\n\n const hasLoadError = loadErrors.has(item.id);\n\n const rowContent = (\n <>\n {itemHasChildren ? (\n <span\n className=\"puzzle-tree__toggle\"\n data-tree-toggle=\"true\"\n data-expanded={expanded || undefined}\n aria-hidden=\"true\"\n />\n ) : (\n <span className=\"puzzle-tree__toggle-spacer\" aria-hidden=\"true\" />\n )}\n\n {renderItem ? (\n renderItem(item, itemState)\n ) : (\n <>\n {iconContent != null && (\n <span className=\"puzzle-tree__icon\" aria-hidden=\"true\">\n {iconContent}\n </span>\n )}\n\n <span className=\"puzzle-tree__label\">\n {renderLabel ? renderLabel(item, itemState) : item.label}\n </span>\n\n {item.endAdornment != null && (\n <span className=\"puzzle-tree__adornment\">\n {item.endAdornment}\n </span>\n )}\n </>\n )}\n </>\n );\n\n const row =\n item.href !== undefined ? (\n <Link\n href={item.href}\n className=\"puzzle-tree__row\"\n tabIndex={-1}\n aria-current={active ? \"page\" : undefined}\n aria-disabled={disabled || undefined}\n data-tree-row-link=\"true\"\n onClick={(event) => handleItemLinkClick(event, item)}\n >\n {rowContent}\n </Link>\n ) : (\n <div className=\"puzzle-tree__row\">{rowContent}</div>\n );\n\n return (\n <li\n key={item.id}\n ref={(element) => {\n if (element) {\n itemRefs.current.set(item.id, element);\n } else {\n itemRefs.current.delete(item.id);\n }\n }}\n id={itemId}\n role=\"treeitem\"\n aria-level={depth + 1}\n aria-posinset={index + 1}\n aria-setsize={nodes.length}\n aria-expanded={itemHasChildren ? expanded : undefined}\n aria-selected={selectable ? selected : undefined}\n aria-disabled={disabled || undefined}\n aria-busy={loading || undefined}\n tabIndex={focused ? 0 : -1}\n className={cn(\"puzzle-tree__item\", itemClassName)}\n data-tree-item-id={item.id}\n data-active={active || undefined}\n data-selected={selected || undefined}\n data-disabled={disabled || undefined}\n data-expanded={itemHasChildren ? expanded : undefined}\n onFocus={(event) => {\n if (event.target !== event.currentTarget) return;\n\n if (focusedId !== item.id) {\n setFocusedId(item.id);\n onFocusedChange?.(item.id);\n }\n }}\n onClick={(event) => handleItemClick(event, item)}\n onKeyDown={(event) => handleKeyDown(event, item, parentId)}\n >\n {row}\n\n {itemHasChildren && expanded && (\n <ul className=\"puzzle-tree__group\" role=\"group\">\n {loading || hasLoadError ? (\n <li\n role=\"none\"\n className={cn(\n \"puzzle-tree__status-row\",\n hasLoadError &&\n !loading &&\n \"puzzle-tree__status-row--error\",\n )}\n >\n <span role=\"status\" aria-live=\"polite\">\n {loading ? loadingLabel : loadErrorLabel}\n </span>\n </li>\n ) : null}\n\n {renderItems(itemChildren, depth + 1, item.id)}\n </ul>\n )}\n </li>\n );\n });\n\n const rootStyle = {\n ...style,\n ...(indentation !== undefined\n ? {\n \"--puzzle-tree-indentation\":\n typeof indentation === \"number\" ? `${indentation}px` : indentation,\n }\n : {}),\n } as CSSProperties;\n\n return (\n <ul\n {...rootProps}\n role=\"tree\"\n aria-multiselectable={selectionMode === \"multiple\" || undefined}\n className={cn(\"puzzle-tree\", `puzzle-tree--${size}`, className)}\n style={rootStyle}\n dir={dir}\n tabIndex={visibleItems.length === 0 ? 0 : undefined}\n onFocusCapture={() => {\n focusWithinTree.current = true;\n }}\n onBlurCapture={(event) => {\n const nextTarget = event.relatedTarget;\n const target = event.target as HTMLElement;\n\n if (\n event.currentTarget.contains(target) &&\n ((nextTarget && !event.currentTarget.contains(nextTarget as Node)) ||\n (!nextTarget && target.isConnected))\n ) {\n focusWithinTree.current = false;\n }\n }}\n >\n {renderItems(items)}\n </ul>\n );\n};\n\nconst findItemById = <TData,>(\n nodes: TreeViewItem<TData>[],\n id: string,\n getChildren: (item: TreeViewItem<TData>) => TreeViewItem<TData>[],\n): TreeViewItem<TData> | undefined => {\n for (const item of nodes) {\n if (item.id === id) return item;\n\n const found = findItemById(getChildren(item), id, getChildren);\n if (found) return found;\n }\n\n return undefined;\n};\n\nexport {\n TreeView,\n type TreeViewProps,\n type TreeViewItem,\n type TreeViewItemState,\n type TreeViewSelectionMode,\n type TreeViewSize,\n};\n"],"mappings":";;;;;;;AAuKA,MAAM,gBAAgB,QACpB,MAAM,KACJ,IAAI,KACD,OAAO,CAAC,EAAA,CAAG,QAAQ,OAAO,OAAO,OAAO,YAAY,GAAG,SAAS,CAAC,CACpE,CACF;AAEF,MAAM,gBAAwB,SAA8B;CAC1D,IAAI,KAAK,cAAc,KAAA,GAAW,OAAO,KAAK;CAE9C,IAAI,OAAO,KAAK,UAAU,YAAY,OAAO,KAAK,UAAU,UAC1D,OAAO,OAAO,KAAK,KAAK;CAG1B,OAAO;AACT;AAEA,MAAM,uBAAuB,UAC3B,MACG,UAAU,KAAK,CAAC,CAChB,QAAQ,oBAAoB,EAAE,CAAC,CAC/B,kBAAkB;AAEvB,MAAM,YAAoB,EACxB,OACA,gBAAgB,UAChB,qBAAqB,CAAC,GACtB,aACA,kBACA,qBAAqB,CAAC,GACtB,aACA,mBACA,kBACA,iBACA,cACA,qBACA,gBACA,eACA,YACA,YACA,aACA,oBAAoB,OACpB,YAAY,MACZ,OAAO,MACP,aACA,eAAe,YACf,iBAAiB,0DACjB,eACA,WACA,OACA,KACA,GAAG,gBACuB;CAC1B,MAAM,cAAc,MAAM;CAC1B,MAAM,uBAAuB,gBAAgB,KAAA;CAC7C,MAAM,wB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