@nordhealth/components 4.26.2 → 5.0.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/custom-elements.json +51620 -18552
- package/lib/Accordion.js +2 -0
- package/lib/Accordion.js.map +1 -0
- package/lib/AccordionHeader.js +2 -0
- package/lib/AccordionHeader.js.map +1 -0
- package/lib/AccordionItem.js +2 -0
- package/lib/AccordionItem.js.map +1 -0
- package/lib/AccordionPanel.js +2 -0
- package/lib/AccordionPanel.js.map +1 -0
- package/lib/AccordionTrigger.js +2 -0
- package/lib/AccordionTrigger.js.map +1 -0
- package/lib/ActiveDescendantController-BnMqM79O.js +2 -0
- package/lib/ActiveDescendantController-BnMqM79O.js.map +1 -0
- package/lib/Aside.js +5 -7
- package/lib/Aside.js.map +1 -1
- package/lib/AsideDrawer.js +7 -11
- package/lib/AsideDrawer.js.map +1 -1
- package/lib/AsideTrigger.js +3 -4
- package/lib/AsideTrigger.js.map +1 -1
- package/lib/Autocomplete.js +2 -0
- package/lib/Autocomplete.js.map +1 -0
- package/lib/Avatar.js +1 -1
- package/lib/Avatar.js.map +1 -1
- package/lib/Badge.js +1 -1
- package/lib/Badge.js.map +1 -1
- package/lib/Banner.js +1 -1
- package/lib/Banner.js.map +1 -1
- package/lib/Button.js +7 -12
- package/lib/Button.js.map +1 -1
- package/lib/ButtonGroup.js +1 -1
- package/lib/ButtonGroup.js.map +1 -1
- package/lib/Calendar-D47b20IT.js +2 -0
- package/lib/Calendar-D47b20IT.js.map +1 -0
- package/lib/Calendar.js +1 -1
- package/lib/Card.js +1 -1
- package/lib/Card.js.map +1 -1
- package/lib/Checkbox.js +1 -1
- package/lib/Checkbox.js.map +1 -1
- package/lib/CollapseController-BtKNFNyJ.js +2 -0
- package/lib/CollapseController-BtKNFNyJ.js.map +1 -0
- package/lib/Collapsible.js +2 -0
- package/lib/Collapsible.js.map +1 -0
- package/lib/CollapsiblePanel.js +2 -0
- package/lib/CollapsiblePanel.js.map +1 -0
- package/lib/CollapsibleTrigger.js +2 -0
- package/lib/CollapsibleTrigger.js.map +1 -0
- package/lib/Combobox-DBxXlbY7.js +2 -0
- package/lib/Combobox-DBxXlbY7.js.map +1 -0
- package/lib/Combobox.js +2 -0
- package/lib/Combobox.js.map +1 -0
- package/lib/ComboboxBase.js +2 -0
- package/lib/ComboboxBase.js.map +1 -0
- package/lib/ComboboxEvents.js +2 -0
- package/lib/ComboboxEvents.js.map +1 -0
- package/lib/ComboboxGroup.js +2 -0
- package/lib/ComboboxGroup.js.map +1 -0
- package/lib/ComboboxOption.js +2 -0
- package/lib/ComboboxOption.js.map +1 -0
- package/lib/CommandMenu.js +1 -1
- package/lib/CommandMenu.js.map +1 -1
- package/lib/CommandMenuAction.js +1 -1
- package/lib/CommandMenuAction.js.map +1 -1
- package/lib/Component-BJ5O5n8k.js +2 -0
- package/lib/Component-BJ5O5n8k.js.map +1 -0
- package/lib/DatePicker.js +1 -1
- package/lib/DatePicker.js.map +1 -1
- package/lib/DateRangeChangeEvent.js +2 -0
- package/lib/DateRangeChangeEvent.js.map +1 -0
- package/lib/DateRangePicker.js +2 -0
- package/lib/DateRangePicker.js.map +1 -0
- package/lib/DateRangeSelectEvent.js +2 -0
- package/lib/DateRangeSelectEvent.js.map +1 -0
- package/lib/Divider.js +1 -1
- package/lib/Divider.js.map +1 -1
- package/lib/DraftComponentMixin-4qug5Rky.js +2 -0
- package/lib/DraftComponentMixin-4qug5Rky.js.map +1 -0
- package/lib/Drawer.js +1 -1
- package/lib/Drawer.js.map +1 -1
- package/lib/Dropdown.js +1 -1
- package/lib/Dropdown.js.map +1 -1
- package/lib/DropdownGroup.js +1 -1
- package/lib/DropdownGroup.js.map +1 -1
- package/lib/DropdownItem-BYbOLth6.js +2 -0
- package/lib/DropdownItem-BYbOLth6.js.map +1 -0
- package/lib/DropdownItem.js +1 -1
- package/lib/DropdownItem.js.map +1 -1
- package/lib/DropdownSubmenu.js +1 -1
- package/lib/DropdownSubmenu.js.map +1 -1
- package/lib/EmptyState.js +1 -1
- package/lib/EmptyState.js.map +1 -1
- package/lib/Field.js +2 -0
- package/lib/Field.js.map +1 -0
- package/lib/FieldContent.js +2 -0
- package/lib/FieldContent.js.map +1 -0
- package/lib/FieldControlMixin-BXNZJXu9.js +2 -0
- package/lib/FieldControlMixin-BXNZJXu9.js.map +1 -0
- package/lib/FieldDescription.js +2 -0
- package/lib/FieldDescription.js.map +1 -0
- package/lib/FieldError.js +2 -0
- package/lib/FieldError.js.map +1 -0
- package/lib/FieldGroup.js +2 -0
- package/lib/FieldGroup.js.map +1 -0
- package/lib/FieldLabel.js +2 -0
- package/lib/FieldLabel.js.map +1 -0
- package/lib/FieldLegend.js +2 -0
- package/lib/FieldLegend.js.map +1 -0
- package/lib/FieldSeparator.js +2 -0
- package/lib/FieldSeparator.js.map +1 -0
- package/lib/FieldSet.js +2 -0
- package/lib/FieldSet.js.map +1 -0
- package/lib/FieldTitle.js +2 -0
- package/lib/FieldTitle.js.map +1 -0
- package/lib/Fieldset2.js +2 -0
- package/lib/Fieldset2.js.map +1 -0
- package/lib/FilterAddButton.js +2 -0
- package/lib/FilterAddButton.js.map +1 -0
- package/lib/FilterAddButtonEvents.js +2 -0
- package/lib/FilterAddButtonEvents.js.map +1 -0
- package/lib/FilterBar.js +2 -0
- package/lib/FilterBar.js.map +1 -0
- package/lib/FilterDateRange.js +2 -0
- package/lib/FilterDateRange.js.map +1 -0
- package/lib/FilterDateRangeEvents.js +2 -0
- package/lib/FilterDateRangeEvents.js.map +1 -0
- package/lib/FilterDropdown.js +2 -0
- package/lib/FilterDropdown.js.map +1 -0
- package/lib/FilterDropdownEvents.js +2 -0
- package/lib/FilterDropdownEvents.js.map +1 -0
- package/lib/FilterField.js +2 -0
- package/lib/FilterField.js.map +1 -0
- package/lib/FilterFieldEvents.js +2 -0
- package/lib/FilterFieldEvents.js.map +1 -0
- package/lib/FilterInput.js +2 -0
- package/lib/FilterInput.js.map +1 -0
- package/lib/FilterResetButton.js +2 -0
- package/lib/FilterResetButton.js.map +1 -0
- package/lib/FocusableWhenDisabledController-C_Mn1mfN.js +2 -0
- package/lib/FocusableWhenDisabledController-C_Mn1mfN.js.map +1 -0
- package/lib/Footer.js +1 -1
- package/lib/Footer.js.map +1 -1
- package/lib/FormAssociatedMixin-D9aPREgv.js +2 -0
- package/lib/FormAssociatedMixin-D9aPREgv.js.map +1 -0
- package/lib/FormField-CMgEFZCK.js +2 -0
- package/lib/FormField-CMgEFZCK.js.map +1 -0
- package/lib/Header.js +1 -1
- package/lib/Header.js.map +1 -1
- package/lib/Icon.js +1 -1
- package/lib/Icon.js.map +1 -1
- package/lib/Input.js +1 -1
- package/lib/Input.js.map +1 -1
- package/lib/Item.js +2 -0
- package/lib/Item.js.map +1 -0
- package/lib/ItemActions.js +2 -0
- package/lib/ItemActions.js.map +1 -0
- package/lib/ItemContent.js +2 -0
- package/lib/ItemContent.js.map +1 -0
- package/lib/ItemDescription.js +2 -0
- package/lib/ItemDescription.js.map +1 -0
- package/lib/ItemFooter.js +2 -0
- package/lib/ItemFooter.js.map +1 -0
- package/lib/ItemGroup.js +2 -0
- package/lib/ItemGroup.js.map +1 -0
- package/lib/ItemHeader.js +2 -0
- package/lib/ItemHeader.js.map +1 -0
- package/lib/ItemMedia.js +2 -0
- package/lib/ItemMedia.js.map +1 -0
- package/lib/ItemSeparator.js +2 -0
- package/lib/ItemSeparator.js.map +1 -0
- package/lib/ItemTitle.js +2 -0
- package/lib/ItemTitle.js.map +1 -0
- package/lib/Kbd.js +2 -0
- package/lib/Kbd.js.map +1 -0
- package/lib/KbdGroup.js +2 -0
- package/lib/KbdGroup.js.map +1 -0
- package/lib/KeyboardController.js +1 -1
- package/lib/KeyboardController.js.map +1 -1
- package/lib/Layout.js +1 -3
- package/lib/Layout.js.map +1 -1
- package/lib/{LightDismissController-4pH8cdko.js → LightDismissController-wcL1ziJa.js} +2 -2
- package/lib/{LightDismissController-4pH8cdko.js.map → LightDismissController-wcL1ziJa.js.map} +1 -1
- package/lib/LocalizeController.js +1 -1
- package/lib/LocalizeController.js.map +1 -1
- package/lib/Message.js +1 -1
- package/lib/Message.js.map +1 -1
- package/lib/Meter.js +2 -0
- package/lib/Meter.js.map +1 -0
- package/lib/Modal.js +1 -1
- package/lib/Modal.js.map +1 -1
- package/lib/ModalController.js +1 -1
- package/lib/ModalController.js.map +1 -1
- package/lib/NavGroup.js +1 -1
- package/lib/NavGroup.js.map +1 -1
- package/lib/NavItem.js +1 -1
- package/lib/NavItem.js.map +1 -1
- package/lib/NavToggle-BY83xpx0.js +2 -0
- package/lib/NavToggle-BY83xpx0.js.map +1 -0
- package/lib/NavToggle.js +1 -1
- package/lib/Navigation.js +1 -1
- package/lib/Navigation.js.map +1 -1
- package/lib/Notification.js +1 -1
- package/lib/Notification.js.map +1 -1
- package/lib/NotificationGroup.js +1 -1
- package/lib/NotificationGroup.js.map +1 -1
- package/lib/NumberField.js +2 -0
- package/lib/NumberField.js.map +1 -0
- package/lib/NumberFieldEvents.js +2 -0
- package/lib/NumberFieldEvents.js.map +1 -0
- package/lib/OpenStateController-CCnZ7up6.js +2 -0
- package/lib/OpenStateController-CCnZ7up6.js.map +1 -0
- package/lib/OtpField.js +2 -0
- package/lib/OtpField.js.map +1 -0
- package/lib/OtpFieldEvents.js +2 -0
- package/lib/OtpFieldEvents.js.map +1 -0
- package/lib/Outline.js +2 -0
- package/lib/Outline.js.map +1 -0
- package/lib/OutlineItem.js +2 -0
- package/lib/OutlineItem.js.map +1 -0
- package/lib/Pagination.js +2 -0
- package/lib/Pagination.js.map +1 -0
- package/lib/PaginationContent.js +2 -0
- package/lib/PaginationContent.js.map +1 -0
- package/lib/PaginationEllipsis.js +2 -0
- package/lib/PaginationEllipsis.js.map +1 -0
- package/lib/PaginationItem.js +2 -0
- package/lib/PaginationItem.js.map +1 -0
- package/lib/PaginationLink.js +2 -0
- package/lib/PaginationLink.js.map +1 -0
- package/lib/PaginationNext.js +2 -0
- package/lib/PaginationNext.js.map +1 -0
- package/lib/PaginationPrevious.js +2 -0
- package/lib/PaginationPrevious.js.map +1 -0
- package/lib/Popout-CFtFoCaA.js +2 -0
- package/lib/Popout-CFtFoCaA.js.map +1 -0
- package/lib/Popout.js +1 -1
- package/lib/Progress.js +1 -1
- package/lib/Progress.js.map +1 -1
- package/lib/ProgressBar.js +1 -1
- package/lib/ProgressBar.js.map +1 -1
- package/lib/Qrcode.js +2 -2
- package/lib/Qrcode.js.map +1 -1
- package/lib/Radio.js +1 -1
- package/lib/Radio.js.map +1 -1
- package/lib/Range.js +1 -1
- package/lib/Range.js.map +1 -1
- package/lib/ReadonlyMixin-BdJPGtQ3.js +2 -0
- package/lib/ReadonlyMixin-BdJPGtQ3.js.map +1 -0
- package/lib/ResizeController-14PUwRQy.js +2 -0
- package/lib/ResizeController-14PUwRQy.js.map +1 -0
- package/lib/ScrollArea.js +2 -0
- package/lib/ScrollArea.js.map +1 -0
- package/lib/SegmentedControl.js +1 -1
- package/lib/SegmentedControl.js.map +1 -1
- package/lib/SegmentedControlItem.js +23 -40
- package/lib/SegmentedControlItem.js.map +1 -1
- package/lib/Select.js +1 -1
- package/lib/Select.js.map +1 -1
- package/lib/ShortcutController-CV5b0BZl.js +2 -0
- package/lib/ShortcutController-CV5b0BZl.js.map +1 -0
- package/lib/Skeleton.js +1 -1
- package/lib/Skeleton.js.map +1 -1
- package/lib/Spinner.js +1 -1
- package/lib/Spinner.js.map +1 -1
- package/lib/Stack.js +1 -1
- package/lib/Stack.js.map +1 -1
- package/lib/StateAttributesController-BIh96sXZ.js +2 -0
- package/lib/StateAttributesController-BIh96sXZ.js.map +1 -0
- package/lib/Sticky-CZImMrGj.js +2 -0
- package/lib/Sticky-CZImMrGj.js.map +1 -0
- package/lib/Tab.js +1 -1
- package/lib/Tab.js.map +1 -1
- package/lib/TabGroup.js +1 -1
- package/lib/TabGroup.js.map +1 -1
- package/lib/TabPanel.js +1 -1
- package/lib/TabPanel.js.map +1 -1
- package/lib/Table.js +1 -1
- package/lib/Table.js.map +1 -1
- package/lib/Tag.js +1 -1
- package/lib/Tag.js.map +1 -1
- package/lib/TagGroup.js +1 -1
- package/lib/TagGroup.js.map +1 -1
- package/lib/TextField-CSKvieoG.js +2 -0
- package/lib/TextField-CSKvieoG.js.map +1 -0
- package/lib/TextSelectableMixin-Cfv__lHS.js.map +1 -1
- package/lib/Textarea.js +1 -1
- package/lib/Textarea.js.map +1 -1
- package/lib/TimePicker.js +2 -0
- package/lib/TimePicker.js.map +1 -0
- package/lib/Toast.js +1 -1
- package/lib/Toast.js.map +1 -1
- package/lib/ToastGroup.js +1 -1
- package/lib/ToastGroup.js.map +1 -1
- package/lib/Toggle.js +1 -1
- package/lib/Toggle.js.map +1 -1
- package/lib/Tooltip.js +1 -1
- package/lib/Tooltip.js.map +1 -1
- package/lib/TopBar.js +1 -1
- package/lib/TopBar.js.map +1 -1
- package/lib/Truncate.js +1 -1
- package/lib/Truncate.js.map +1 -1
- package/lib/VisuallyHidden.js +1 -1
- package/lib/VisuallyHidden.js.map +1 -1
- package/lib/bundle.js +91 -91
- package/lib/bundle.js.map +1 -1
- package/lib/combobox-context.js +2 -0
- package/lib/combobox-context.js.map +1 -0
- package/lib/context-consumer-BJVUulGf.js +7 -0
- package/lib/context-consumer-BJVUulGf.js.map +1 -0
- package/lib/context-provider-D8lrPLVi.js +12 -0
- package/lib/context-provider-D8lrPLVi.js.map +1 -0
- package/lib/context-request-event-CCRlXoeR.js +7 -0
- package/lib/context-request-event-CCRlXoeR.js.map +1 -0
- package/lib/create-context-CJ69ntlY.js +7 -0
- package/lib/create-context-CJ69ntlY.js.map +1 -0
- package/lib/currency.js +2 -0
- package/lib/currency.js.map +1 -0
- package/lib/date-adapter.js +1 -1
- package/lib/dates-C-ZvzXaC.js +2 -0
- package/lib/dates-C-ZvzXaC.js.map +1 -0
- package/lib/dates.js +2 -0
- package/lib/dates.js.map +1 -0
- package/lib/dismiss.js +2 -0
- package/lib/dismiss.js.map +1 -0
- package/lib/en-us.js +1 -1
- package/lib/en-us.js.map +1 -1
- package/lib/fi-fi.js +1 -1
- package/lib/fi-fi.js.map +1 -1
- package/lib/field-context.js +2 -0
- package/lib/field-context.js.map +1 -0
- package/lib/filter-chip-C97zd4PT.js +2 -0
- package/lib/filter-chip-C97zd4PT.js.map +1 -0
- package/lib/format.js +2 -0
- package/lib/format.js.map +1 -0
- package/lib/index.js +1 -1
- package/lib/interface-add-small-B-hv2v9J.js +2 -0
- package/lib/interface-add-small-B-hv2v9J.js.map +1 -0
- package/lib/interface-calendar-Cw2bJfbS.js +2 -0
- package/lib/interface-calendar-Cw2bJfbS.js.map +1 -0
- package/lib/interface-close-BvKnv9eh.js +2 -0
- package/lib/interface-close-BvKnv9eh.js.map +1 -0
- package/lib/interface-dropdown-small-CYvgxudU.js +2 -0
- package/lib/interface-dropdown-small-CYvgxudU.js.map +1 -0
- package/lib/interface-filter-CCsx9-u6.js +2 -0
- package/lib/interface-filter-CCsx9-u6.js.map +1 -0
- package/lib/interface-remove-small-DUaWSs90.js +2 -0
- package/lib/interface-remove-small-DUaWSs90.js.map +1 -0
- package/lib/light-dom-styles-DXsbiKU9.js +2 -0
- package/lib/light-dom-styles-DXsbiKU9.js.map +1 -0
- package/lib/localization.js +1 -1
- package/lib/localization.js.map +1 -1
- package/lib/localization10.js +2 -0
- package/lib/localization10.js.map +1 -0
- package/lib/localization11.js +2 -0
- package/lib/localization11.js.map +1 -0
- package/lib/localization12.js +2 -0
- package/lib/localization12.js.map +1 -0
- package/lib/localization13.js +2 -0
- package/lib/localization13.js.map +1 -0
- package/lib/localization14.js +2 -0
- package/lib/localization14.js.map +1 -0
- package/lib/localization15.js +2 -0
- package/lib/localization15.js.map +1 -0
- package/lib/localization16.js +2 -0
- package/lib/localization16.js.map +1 -0
- package/lib/localization17.js +2 -0
- package/lib/localization17.js.map +1 -0
- package/lib/localization18.js +2 -0
- package/lib/localization18.js.map +1 -0
- package/lib/localization19.js +2 -0
- package/lib/localization19.js.map +1 -0
- package/lib/localization2.js +1 -1
- package/lib/localization2.js.map +1 -1
- package/lib/localization20.js +2 -0
- package/lib/localization20.js.map +1 -0
- package/lib/localization21.js +2 -0
- package/lib/localization21.js.map +1 -0
- package/lib/localization22.js +2 -0
- package/lib/localization22.js.map +1 -0
- package/lib/localization23.js +2 -0
- package/lib/localization23.js.map +1 -0
- package/lib/localization3.js +1 -1
- package/lib/localization3.js.map +1 -1
- package/lib/localization4.js +1 -1
- package/lib/localization4.js.map +1 -1
- package/lib/localization5.js +1 -1
- package/lib/localization5.js.map +1 -1
- package/lib/localization6.js +1 -1
- package/lib/localization6.js.map +1 -1
- package/lib/localization7.js +1 -1
- package/lib/localization7.js.map +1 -1
- package/lib/localization8.js +1 -1
- package/lib/localization8.js.map +1 -1
- package/lib/localization9.js +1 -1
- package/lib/localization9.js.map +1 -1
- package/lib/navigation-search-CBbIGzo2.js +2 -0
- package/lib/navigation-search-CBbIGzo2.js.map +1 -0
- package/lib/paginate.js +2 -0
- package/lib/paginate.js.map +1 -0
- package/lib/parse.js +2 -0
- package/lib/parse.js.map +1 -0
- package/lib/primitives-Dj0vyf1-.js +2 -0
- package/lib/primitives-Dj0vyf1-.js.map +1 -0
- package/lib/react.d.ts +520 -0
- package/lib/src/accordion/Accordion.d.ts +121 -0
- package/lib/src/accordion/AccordionHeader.d.ts +28 -0
- package/lib/src/accordion/AccordionItem.d.ts +68 -0
- package/lib/src/accordion/AccordionPanel.d.ts +35 -0
- package/lib/src/accordion/AccordionTrigger.d.ts +48 -0
- package/lib/src/aside/Aside.d.ts +1 -1
- package/lib/src/aside-drawer/AsideDrawer.d.ts +3 -1
- package/lib/src/aside-trigger/AsideTrigger.d.ts +2 -0
- package/lib/src/autocomplete/Autocomplete.d.ts +190 -0
- package/lib/src/autocomplete/localization.d.ts +5 -0
- package/lib/src/avatar/Avatar.d.ts +1 -1
- package/lib/src/badge/Badge.d.ts +1 -1
- package/lib/src/banner/Banner.d.ts +3 -0
- package/lib/src/button-group/ButtonGroup.d.ts +1 -1
- package/lib/src/calendar/Calendar.d.ts +45 -1
- package/lib/src/calendar/DateRangeSelectEvent.d.ts +16 -0
- package/lib/src/card/Card.d.ts +1 -1
- package/lib/src/collapsible/Collapsible.d.ts +69 -0
- package/lib/src/collapsible/CollapsiblePanel.d.ts +35 -0
- package/lib/src/collapsible/CollapsibleTrigger.d.ts +38 -0
- package/lib/src/combobox/Combobox.d.ts +131 -0
- package/lib/src/combobox/ComboboxBase.d.ts +421 -0
- package/lib/src/combobox/ComboboxEvents.d.ts +25 -0
- package/lib/src/combobox/ComboboxGroup.d.ts +34 -0
- package/lib/src/combobox/ComboboxOption.d.ts +47 -0
- package/lib/src/combobox/combobox-context.d.ts +18 -0
- package/lib/src/combobox/localization.d.ts +6 -0
- package/lib/src/common/controllers/ActiveDescendantController.d.ts +45 -0
- package/lib/src/common/controllers/CollapseController.d.ts +50 -0
- package/lib/src/common/controllers/FocusableWhenDisabledController.d.ts +29 -0
- package/lib/src/common/controllers/OpenStateController.d.ts +58 -0
- package/lib/src/common/controllers/RovingFocusController.d.ts +40 -0
- package/lib/src/common/controllers/ShortcutController.d.ts +5 -5
- package/lib/src/common/controllers/StateAttributesController.d.ts +47 -0
- package/lib/src/common/controllers/TransitionStatusController.d.ts +48 -0
- package/lib/src/common/dates.d.ts +13 -0
- package/lib/src/common/light-dom-styles.d.ts +17 -0
- package/lib/src/common/mixins/FieldControlMixin.d.ts +60 -0
- package/lib/src/common/mixins/FormAssociatedMixin.d.ts +8 -25
- package/lib/src/common/mixins/TextSelectableMixin.d.ts +1 -0
- package/lib/src/common/prefers-reduced-motion.d.ts +7 -0
- package/lib/src/date-picker/DatePicker.d.ts +2 -0
- package/lib/src/date-range-picker/DateRangeChangeEvent.d.ts +27 -0
- package/lib/src/date-range-picker/DateRangePicker.d.ts +307 -0
- package/lib/src/date-range-picker/localization.d.ts +42 -0
- package/lib/src/divider/Divider.d.ts +1 -1
- package/lib/src/drawer/Drawer.d.ts +1 -1
- package/lib/src/dropdown/Dropdown.d.ts +1 -1
- package/lib/src/dropdown-group/DropdownGroup.d.ts +3 -1
- package/lib/src/dropdown-item/DropdownItem.d.ts +3 -1
- package/lib/src/dropdown-submenu/DropdownSubmenu.d.ts +2 -0
- package/lib/src/field/Field.d.ts +102 -0
- package/lib/src/field/FieldContent.d.ts +22 -0
- package/lib/src/field/FieldDescription.d.ts +21 -0
- package/lib/src/field/FieldError.d.ts +25 -0
- package/lib/src/field/FieldGroup.d.ts +25 -0
- package/lib/src/field/FieldLabel.d.ts +41 -0
- package/lib/src/field/FieldLegend.d.ts +20 -0
- package/lib/src/field/FieldSeparator.d.ts +21 -0
- package/lib/src/field/FieldSet.d.ts +28 -0
- package/lib/src/field/FieldTitle.d.ts +21 -0
- package/lib/src/field/field-context.d.ts +47 -0
- package/lib/src/fieldset/Fieldset.d.ts +12 -4
- package/lib/src/filter-add-button/FilterAddButton.d.ts +91 -0
- package/lib/src/filter-add-button/FilterAddButtonEvents.d.ts +17 -0
- package/lib/src/filter-add-button/localization.d.ts +4 -0
- package/lib/src/filter-bar/FilterBar.d.ts +37 -0
- package/lib/src/filter-date-range/FilterDateRange.d.ts +96 -0
- package/lib/src/filter-date-range/FilterDateRangeEvents.d.ts +37 -0
- package/lib/src/filter-date-range/localization.d.ts +11 -0
- package/lib/src/filter-dropdown/FilterDropdown.d.ts +247 -0
- package/lib/src/filter-dropdown/FilterDropdownEvents.d.ts +57 -0
- package/lib/src/filter-dropdown/localization.d.ts +14 -0
- package/lib/src/filter-field/FilterField.d.ts +89 -0
- package/lib/src/filter-field/FilterFieldEvents.d.ts +18 -0
- package/lib/src/filter-field/localization.d.ts +8 -0
- package/lib/src/filter-input/FilterInput.d.ts +102 -0
- package/lib/src/filter-input/localization.d.ts +5 -0
- package/lib/src/filter-reset-button/FilterResetButton.d.ts +50 -0
- package/lib/src/filter-reset-button/localization.d.ts +4 -0
- package/lib/src/footer/Footer.d.ts +1 -1
- package/lib/src/header/Header.d.ts +1 -1
- package/lib/src/icon/Icon.d.ts +1 -1
- package/lib/src/index.d.ts +61 -0
- package/lib/src/input/Input.d.ts +2 -1
- package/lib/src/item/Item.d.ts +44 -0
- package/lib/src/item/ItemActions.d.ts +20 -0
- package/lib/src/item/ItemContent.d.ts +22 -0
- package/lib/src/item/ItemDescription.d.ts +20 -0
- package/lib/src/item/ItemFooter.d.ts +20 -0
- package/lib/src/item/ItemGroup.d.ts +22 -0
- package/lib/src/item/ItemHeader.d.ts +20 -0
- package/lib/src/item/ItemMedia.d.ts +28 -0
- package/lib/src/item/ItemSeparator.d.ts +21 -0
- package/lib/src/item/ItemTitle.d.ts +19 -0
- package/lib/src/kbd/Kbd.d.ts +54 -0
- package/lib/src/kbd/KbdGroup.d.ts +22 -0
- package/lib/src/layout/Layout.d.ts +3 -3
- package/lib/src/localization/en-us.d.ts +88 -0
- package/lib/src/localization/translation.d.ts +88 -0
- package/lib/src/meter/Meter.d.ts +76 -0
- package/lib/src/nav-group/NavGroup.d.ts +2 -0
- package/lib/src/nav-item/NavItem.d.ts +2 -0
- package/lib/src/nav-toggle/NavToggle.d.ts +3 -1
- package/lib/src/notification-group/NotificationGroup.d.ts +2 -0
- package/lib/src/number-field/NumberField.d.ts +377 -0
- package/lib/src/number-field/NumberFieldEvents.d.ts +37 -0
- package/lib/src/number-field/currency.d.ts +24 -0
- package/lib/src/number-field/format.d.ts +8 -0
- package/lib/src/number-field/localization.d.ts +6 -0
- package/lib/src/number-field/parse.d.ts +44 -0
- package/lib/src/number-field/validate.d.ts +24 -0
- package/lib/src/otp-field/OtpField.d.ts +188 -0
- package/lib/src/otp-field/OtpFieldEvents.d.ts +38 -0
- package/lib/src/otp-field/localization.d.ts +4 -0
- package/lib/src/outline/Outline.d.ts +111 -0
- package/lib/src/outline/OutlineItem.d.ts +42 -0
- package/lib/src/outline/localization.d.ts +4 -0
- package/lib/src/pagination/Pagination.d.ts +51 -0
- package/lib/src/pagination/PaginationContent.d.ts +27 -0
- package/lib/src/pagination/PaginationEllipsis.d.ts +27 -0
- package/lib/src/pagination/PaginationItem.d.ts +24 -0
- package/lib/src/pagination/PaginationLink.d.ts +30 -0
- package/lib/src/pagination/PaginationNext.d.ts +24 -0
- package/lib/src/pagination/PaginationPrevious.d.ts +24 -0
- package/lib/src/pagination/localization.d.ts +4 -0
- package/lib/src/pagination/paginate.d.ts +20 -0
- package/lib/src/popout/Popout.d.ts +9 -0
- package/lib/src/qrcode/Qrcode.d.ts +1 -1
- package/lib/src/scroll-area/ScrollArea.d.ts +101 -0
- package/lib/src/segmented-control-item/SegmentedControlItem.d.ts +2 -0
- package/lib/src/stack/Stack.d.ts +1 -1
- package/lib/src/storybook-utils/dates.d.ts +2 -0
- package/lib/src/storybook-utils/dismiss.d.ts +1 -0
- package/lib/src/storybook-utils/story-descriptions.d.ts +2 -0
- package/lib/src/tab-group/TabGroup.d.ts +2 -0
- package/lib/src/tab-panel/TabPanel.d.ts +2 -0
- package/lib/src/tag/Tag.d.ts +1 -1
- package/lib/src/tag-group/TagGroup.d.ts +3 -1
- package/lib/src/time-picker/TimePicker.d.ts +105 -0
- package/lib/src/time-picker/localization.d.ts +4 -0
- package/lib/src/toast-group/ToastGroup.d.ts +11 -0
- package/lib/src/top-bar/TopBar.d.ts +1 -1
- package/lib/src/truncate/Truncate.d.ts +1 -1
- package/lib/src/visually-hidden/VisuallyHidden.d.ts +1 -1
- package/lib/story-descriptions.js +2 -0
- package/lib/story-descriptions.js.map +1 -0
- package/lib/tinykeys-DwvDXsEb.js +2 -0
- package/lib/tinykeys-DwvDXsEb.js.map +1 -0
- package/lib/translation.js +1 -1
- package/lib/translation.js.map +1 -1
- package/lib/validate.js +2 -0
- package/lib/validate.js.map +1 -0
- package/lib/vue.d.ts +418 -0
- package/package.json +10 -13
- package/lib/Calendar-ChNZdVRO.js +0 -2
- package/lib/Calendar-ChNZdVRO.js.map +0 -1
- package/lib/Component-DSU3Qp0O.js +0 -2
- package/lib/Component-DSU3Qp0O.js.map +0 -1
- package/lib/DropdownItem-Cb-7cHMg.js +0 -2
- package/lib/DropdownItem-Cb-7cHMg.js.map +0 -1
- package/lib/Fieldset.js +0 -2
- package/lib/Fieldset.js.map +0 -1
- package/lib/FormAssociatedMixin-B4Qj-CQN.js +0 -2
- package/lib/FormAssociatedMixin-B4Qj-CQN.js.map +0 -1
- package/lib/FormField-BFaVzUjk.js +0 -2
- package/lib/FormField-BFaVzUjk.js.map +0 -1
- package/lib/NavToggle-DzKbd-El.js +0 -2
- package/lib/NavToggle-DzKbd-El.js.map +0 -1
- package/lib/Popout-CYqn_dZu.js +0 -2
- package/lib/Popout-CYqn_dZu.js.map +0 -1
- package/lib/ShortcutController-BIb3WGzH.js +0 -2
- package/lib/ShortcutController-BIb3WGzH.js.map +0 -1
- package/lib/Sticky-DqnqENYN.js +0 -2
- package/lib/Sticky-DqnqENYN.js.map +0 -1
- package/lib/TextField-B955GOhe.js +0 -2
- package/lib/TextField-B955GOhe.js.map +0 -1
- package/lib/dates-CAAlPKZi.js +0 -2
- package/lib/dates-CAAlPKZi.js.map +0 -1
- package/lib/tinykeys.module-_6MZt7MP.js +0 -2
- package/lib/tinykeys.module-_6MZt7MP.js.map +0 -1
package/lib/Accordion.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{_ as t}from"./tslib.es6-CmLYFWVC.js";import{css as e,isServer as i,LitElement as s}from"lit";import{property as o,customElement as r}from"lit/decorators.js";import{D as l}from"./DirectionController-ChvNGESZ.js";import{w as n}from"./number-Dg2vCfGd.js";import{o as a}from"./observe-D0n0zOfU.js";import{N as u}from"./events-Bv6wNHwJ.js";import{i as c}from"./light-dom-styles-DXsbiKU9.js";import{D as d}from"./DraftComponentMixin-4qug5Rky.js";class h{constructor(t,e){this.host=t,this.options=e}handleKeydown(t){var e,i,s,o,r,l;const n=null!==(s=null===(i=(e=this.options).orientation)||void 0===i?void 0:i.call(e))&&void 0!==s?s:"vertical",a="vertical"===n||"both"===n,u="horizontal"===n||"both"===n,c=null!==(l=null===(r=(o=this.options).isRTL)||void 0===r?void 0:r.call(o))&&void 0!==l&&l;switch(t.key){case"ArrowDown":return!!a&&this.move(1,t);case"ArrowUp":return!!a&&this.move(-1,t);case"ArrowRight":return!!u&&this.move(c?-1:1,t);case"ArrowLeft":return!!u&&this.move(c?1:-1,t);case"Home":return t.preventDefault(),this.focusFirst(),!0;case"End":return t.preventDefault(),this.focusLast(),!0;default:return!1}}focusFirst(){const t=this.options.items(),e=this.nextFocusable(t,0,1,!1);-1!==e&&t[e].focus()}focusLast(){const t=this.options.items(),e=this.nextFocusable(t,t.length-1,-1,!1);-1!==e&&t[e].focus()}get loop(){var t,e,i;return null===(i=null===(e=(t=this.options).loop)||void 0===e?void 0:e.call(t))||void 0===i||i}isFocusable(t){var e,i,s;return null===(s=null===(i=(e=this.options).isFocusable)||void 0===i?void 0:i.call(e,t))||void 0===s||s}move(t,e){const i=this.options.items(),s=i.length;if(0===s)return!1;const o=i.indexOf(document.activeElement),r=o<0?t>0?0:s-1:o+t,l=this.nextFocusable(i,r,t,this.loop);return-1!==l&&(e.preventDefault(),i[l].focus(),!0)}nextFocusable(t,e,i,s){const o=t.length;if(0===o)return-1;let r=e;if(r<0||r>=o){if(!s)return-1;r=n(r,0,o-1)}for(let e=0;e<o;e++){if(this.isFocusable(t[r]))return r;const e=r+i;if(e<0||e>=o){if(!s)return-1;r=n(e,0,o-1)}else r=e}return-1}}const p=e`nord-accordion{display:block;font-family:var(--n-font-family);font-feature-settings:var(--n-font-features)}nord-accordion,nord-accordion *,nord-accordion :after,nord-accordion :before{box-sizing:border-box}`;let v=1;function b(t){return Array.isArray(t)?t:null==t||""===t?[]:t.split(",").map((t=>t.trim())).filter(Boolean)}class f extends u{constructor(t){super("change"),Object.defineProperty(this,"value",{value:t,enumerable:!0,writable:!1})}}let m=class extends(d(s)){constructor(){super(...arguments),this.accordionId="nord-accordion-"+v++,this.direction=new l(this),this.rovingFocus=new h(this,{items:()=>[...this.querySelectorAll("nord-accordion-trigger")],orientation:()=>this.orientation,loop:()=>this.loopFocus,isRTL:()=>this.direction.isRTL,isFocusable:t=>!t.disabled}),this.setupScheduled=!1,this.multiple=!1,this.disabled=!1,this.orientation="vertical",this.loopFocus=!0,this.value=[],this.itemIdCount=1}static get observedAttributes(){return[...super.observedAttributes,"value"]}connectedCallback(){super.connectedCallback(),c(this,p),this.setAttribute("role","region"),this.adoptValueAttribute(),this.seedDefaultValue(),this.setup(),this.observeChildren()}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this.childObserver)||void 0===t||t.disconnect(),this.childObserver=void 0}attributeChangedCallback(t,e,i){super.attributeChangedCallback(t,e,i),"value"===t&&e!==i&&(this.value=b(i))}adoptValueAttribute(){if(i||this.value.length>0)return;const t=this.getAttribute("value");t&&(this.value=b(t))}observeChildren(){i||this.childObserver||(this.childObserver=new MutationObserver((()=>this.scheduleSetup())),this.childObserver.observe(this,{childList:!0,subtree:!0}))}scheduleSetup(){this.setupScheduled||(this.setupScheduled=!0,this.updateComplete.then((()=>{this.setupScheduled=!1,this.isConnected&&this.setup()})))}createRenderRoot(){return this}get items(){return[...this.querySelectorAll("nord-accordion-item")]}seedDefaultValue(){if(i||this.value.length>0)return;const t=this.items.filter((t=>t.open)).map((t=>t.value));t.length>0&&(this.value=this.multiple?t:t.slice(0,1))}setup(){i||(this.items.forEach((t=>{var e;const i=null!==(e=t.partsId)&&void 0!==e?e:`${this.accordionId}-item-${this.itemIdCount++}`;t.partsId=i,t.setupParts(i)})),this.syncState())}handleValueChange(t){this.syncState(),void 0!==t&&this.dispatchEvent(new f(this.value))}handleDisabledChange(){this.items.forEach((t=>{t.parentDisabled=this.disabled}))}syncState(){this.items.forEach((t=>{t.parentDisabled=this.disabled,t.open=this.value.includes(t.value),t.propagate()}))}setItemOpen(t,e){let i;i=e?this.multiple?[...this.value,t]:[t]:this.value.filter((e=>e!==t)),this.value=i}activateTrigger(t){const e=t.closest("nord-accordion-item");if(!e||e.disabled||this.disabled)return;const i=this.value.includes(e.value);this.multiple?this.setItemOpen(e.value,!i):this.value=i?[]:[e.value]}handleTriggerKeydown(t){this.rovingFocus.handleKeydown(t)}};t([o({reflect:!0,type:Boolean})],m.prototype,"multiple",void 0),t([o({reflect:!0,type:Boolean})],m.prototype,"disabled",void 0),t([o({reflect:!0})],m.prototype,"orientation",void 0),t([o({reflect:!0,type:Boolean,attribute:"loop-focus"})],m.prototype,"loopFocus",void 0),t([o({type:Array,attribute:!1})],m.prototype,"value",void 0),t([a("value","updated")],m.prototype,"handleValueChange",null),t([a("disabled")],m.prototype,"handleDisabledChange",null),m=t([r("nord-accordion")],m);var g=m;export{f as AccordionChangeEvent,g as default};
|
|
2
|
+
//# sourceMappingURL=Accordion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Accordion.js","sources":["../src/common/controllers/RovingFocusController.ts","../src/accordion/Accordion.ts"],"sourcesContent":["import type { ReactiveControllerHost } from 'lit'\n\nimport { wrap } from '../number.js'\n\nexport type Orientation = 'vertical' | 'horizontal' | 'both'\n\nexport interface RovingFocusOptions {\n /** The focusable items, in DOM order. */\n items: () => HTMLElement[]\n /** Which arrow keys move focus. Defaults to `vertical`. */\n orientation?: () => Orientation\n /** Wrap focus at the ends. Defaults to `true`. */\n loop?: () => boolean\n /** Flips the horizontal arrow direction. Defaults to `false`. */\n isRTL?: () => boolean\n /** Whether an item can receive focus (skip disabled ones). Defaults to all. */\n isFocusable?: (item: HTMLElement) => boolean\n}\n\n/**\n * Manages arrow-key focus movement across a set of items (the shared mechanics\n * behind Base UI's `Composite`). The host calls {@link handleKeydown} from its\n * own `keydown`; the controller moves real DOM focus to the next/previous\n * focusable item, honouring orientation, looping, RTL and Home/End.\n */\nexport class RovingFocusController {\n // A host-bound helper rather than a lifecycle ReactiveController: it moves real\n // DOM focus on demand and owns no connect/update hooks, so it doesn't register\n // via `addController`. The host reference is kept for parity with the other\n // controllers and any future host-driven behaviour.\n constructor(\n private host: ReactiveControllerHost & HTMLElement,\n private options: RovingFocusOptions,\n ) {}\n\n /** Handle a navigation keydown. Returns `true` if it moved focus. */\n handleKeydown(event: KeyboardEvent): boolean {\n const orientation = this.options.orientation?.() ?? 'vertical'\n const vertical = orientation === 'vertical' || orientation === 'both'\n const horizontal = orientation === 'horizontal' || orientation === 'both'\n const rtl = this.options.isRTL?.() ?? false\n\n switch (event.key) {\n case 'ArrowDown':\n return vertical ? this.move(1, event) : false\n case 'ArrowUp':\n return vertical ? this.move(-1, event) : false\n case 'ArrowRight':\n return horizontal ? this.move(rtl ? -1 : 1, event) : false\n case 'ArrowLeft':\n return horizontal ? this.move(rtl ? 1 : -1, event) : false\n case 'Home':\n event.preventDefault()\n this.focusFirst()\n return true\n case 'End':\n event.preventDefault()\n this.focusLast()\n return true\n default:\n return false\n }\n }\n\n /** Focus the first focusable item. */\n focusFirst() {\n const items = this.options.items()\n const index = this.nextFocusable(items, 0, 1, false)\n if (index !== -1) {\n items[index].focus()\n }\n }\n\n /** Focus the last focusable item. */\n focusLast() {\n const items = this.options.items()\n const index = this.nextFocusable(items, items.length - 1, -1, false)\n if (index !== -1) {\n items[index].focus()\n }\n }\n\n private get loop(): boolean {\n return this.options.loop?.() ?? true\n }\n\n private isFocusable(item: HTMLElement): boolean {\n return this.options.isFocusable?.(item) ?? true\n }\n\n private move(direction: number, event: KeyboardEvent): boolean {\n const items = this.options.items()\n const length = items.length\n if (length === 0) {\n return false\n }\n const from = items.indexOf(document.activeElement as HTMLElement)\n // With nothing focused, start from the matching end; otherwise step off the\n // current item.\n const start = from < 0 ? (direction > 0 ? 0 : length - 1) : from + direction\n const target = this.nextFocusable(items, start, direction, this.loop)\n if (target === -1) {\n return false\n }\n event.preventDefault()\n items[target].focus()\n return true\n }\n\n /**\n * The next focusable item from `start` (checked first), stepping by `direction`\n * and skipping non-focusable items, wrapping at the ends when `loop`. Returns\n * `-1` if none is found.\n */\n private nextFocusable(items: HTMLElement[], start: number, direction: number, loop: boolean): number {\n const length = items.length\n if (length === 0) {\n return -1\n }\n\n let index = start\n if (index < 0 || index >= length) {\n if (!loop) {\n return -1\n }\n index = wrap(index, 0, length - 1)\n }\n\n for (let i = 0; i < length; i++) {\n if (this.isFocusable(items[index])) {\n return index\n }\n const stepped = index + direction\n if (stepped < 0 || stepped >= length) {\n if (!loop) {\n return -1\n }\n index = wrap(stepped, 0, length - 1)\n }\n else {\n index = stepped\n }\n }\n return -1\n }\n}\n","import type AccordionItem from './AccordionItem.js'\nimport { isServer, LitElement } from 'lit'\n\nimport { customElement, property } from 'lit/decorators.js'\nimport { DirectionController } from '../common/controllers/DirectionController.js'\nimport { RovingFocusController } from '../common/controllers/RovingFocusController.js'\nimport { observe } from '../common/decorators/observe.js'\nimport { NordEvent } from '../common/events.js'\nimport { injectLightDomStyles } from '../common/light-dom-styles.js'\n\nimport { DraftComponentMixin } from '../common/mixins/DraftComponentMixin.js'\nimport style from './Accordion.css'\n\nlet accordionCount = 1\n\n/**\n * Parse a string attribute (`value=\"a,b\"`) into an array of item values, while\n * leaving an array assigned via the property untouched.\n */\nfunction parseValue(value: string | string[] | null): string[] {\n if (Array.isArray(value)) {\n return value\n }\n\n if (value == null || value === '') {\n return []\n }\n\n return value\n .split(',')\n .map(part => part.trim())\n .filter(Boolean)\n}\n\n/**\n * Event dispatched when the set of open accordion items changes.\n */\nexport class AccordionChangeEvent extends NordEvent {\n declare value: string[]\n\n constructor(value: string[]) {\n super('change')\n Object.defineProperty(this, 'value', {\n value,\n enumerable: true,\n writable: false,\n })\n }\n}\n\n/**\n * Accordion is a set of collapsible sections, each with a header that toggles\n * the visibility of its content. It coordinates a group of\n * [Accordion Item](/components/accordion-item/) elements, keyboard focus\n * movement between them, and which items are open.\n *\n * @status draft\n * @category container\n * @lightDom true\n *\n * @slot - Default slot for [Accordion Item](/components/accordion-item/) elements.\n *\n * @fires {AccordionChangeEvent} change - Dispatched when an item is expanded or collapsed. The event includes a `value` array of the currently open item values.\n *\n * @cssprop --n-accordion-item-gap - Spacing between accordion items.\n *\n * @remarks\n * `value` is the source of truth as an array property. The `value` attribute is\n * only read as a comma-separated seed: it is adopted on connect and again\n * whenever the attribute is set (e.g. `el.setAttribute('value', 'a,b')`), but it\n * is **not** reflected back to the DOM as the open set changes via interaction.\n * Read `accordion.value` (the property) to get the current open set; do not rely\n * on the `value` attribute staying in sync after the user interacts.\n */\n@customElement('nord-accordion')\nexport default class Accordion extends DraftComponentMixin(LitElement) {\n // Watch `value` so `setAttribute('value', …)` re-adopts the seed even after\n // the property has been mutated by interaction (the property itself is not\n // reflected, so the attribute would otherwise freeze).\n static get observedAttributes() {\n return [...super.observedAttributes, 'value']\n }\n\n private accordionId = `nord-accordion-${accordionCount++}`\n\n private direction = new DirectionController(this)\n\n // Roving arrow-key focus across the trigger buttons (skips disabled ones,\n // honours orientation / loop / RTL).\n private rovingFocus = new RovingFocusController(this, {\n items: () => [...this.querySelectorAll<HTMLElement>('nord-accordion-trigger')],\n orientation: () => this.orientation,\n loop: () => this.loopFocus,\n isRTL: () => this.direction.isRTL,\n isFocusable: trigger => !(trigger as HTMLElement & { disabled: boolean }).disabled,\n })\n\n // Observes light-DOM children so dynamically added / reordered items get\n // wired up (ids, ARIA, open-state seeding).\n private childObserver?: MutationObserver\n\n // Guards against re-entrant re-setup scheduling.\n private setupScheduled = false\n\n /**\n * Whether multiple items can be open at the same time.\n */\n @property({ reflect: true, type: Boolean }) multiple = false\n\n /**\n * Whether the component should ignore user interaction.\n */\n @property({ reflect: true, type: Boolean }) disabled = false\n\n /**\n * The visual orientation of the accordion. Controls whether roving focus uses\n * left/right or up/down arrow keys.\n */\n @property({ reflect: true }) orientation: 'vertical' | 'horizontal' = 'vertical'\n\n /**\n * Whether to loop keyboard focus back to the first item when the end of the\n * list is reached while using the arrow keys.\n */\n @property({ reflect: true, type: Boolean, attribute: 'loop-focus' }) loopFocus = true\n\n /**\n * The value(s) of the item(s) that are open. Assign an array via the property,\n * or provide an initial comma-separated `value=\"a,b\"` attribute.\n */\n @property({ type: Array, attribute: false }) value: string[] = []\n\n connectedCallback() {\n super.connectedCallback()\n injectLightDomStyles(this, style)\n this.setAttribute('role', 'region')\n this.adoptValueAttribute()\n this.seedDefaultValue()\n this.setup()\n this.observeChildren()\n }\n\n disconnectedCallback() {\n super.disconnectedCallback()\n this.childObserver?.disconnect()\n this.childObserver = undefined\n }\n\n attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null) {\n super.attributeChangedCallback(name, oldValue, newValue)\n\n // `value` is not a reactive property attribute (it's `attribute: false`), so\n // Lit won't react to it. Re-adopt the comma-separated seed when it changes\n // so `setAttribute('value', …)` keeps working after interaction.\n if (name === 'value' && oldValue !== newValue) {\n this.value = parseValue(newValue)\n }\n }\n\n /**\n * Seed the open set from a `value=\"a,b\"` attribute the first time we connect.\n * The property is the source of truth thereafter.\n */\n private adoptValueAttribute() {\n if (isServer || this.value.length > 0) {\n return\n }\n\n const attr = this.getAttribute('value')\n if (attr) {\n this.value = parseValue(attr)\n }\n }\n\n /**\n * Watch for items being added, removed, or reordered so newly slotted items\n * get wired up (ids / ARIA / open-state). Re-runs `setup()` deferred to a\n * microtask to avoid measuring/reflecting mid-mutation (reflection race).\n */\n private observeChildren() {\n if (isServer || this.childObserver) {\n return\n }\n\n this.childObserver = new MutationObserver(() => this.scheduleSetup())\n this.childObserver.observe(this, { childList: true, subtree: true })\n }\n\n private scheduleSetup() {\n if (this.setupScheduled) {\n return\n }\n\n this.setupScheduled = true\n // Defer to the update cycle so DOM mutations settle before we measure and\n // reflect (avoids the MutationObserver reflection race).\n void this.updateComplete.then(() => {\n this.setupScheduled = false\n if (this.isConnected) {\n // Wiring only on re-setup; do not re-seed (seeding must not fire change\n // after the initial connect).\n this.setup()\n }\n })\n }\n\n // Render in the light DOM so the items are the element's own content and the\n // injected stylesheet applies (no shadow boundary, like Table).\n protected createRenderRoot() {\n return this\n }\n\n private get items() {\n return [...this.querySelectorAll<AccordionItem>('nord-accordion-item')]\n }\n\n /**\n * If no `value` was provided but items declare `open`, adopt those as the\n * initial open set (mirrors `defaultValue` from open items).\n */\n private seedDefaultValue() {\n if (isServer || this.value.length > 0) {\n return\n }\n\n const openValues = this.items.filter(item => item.open).map(item => item.value)\n if (openValues.length > 0) {\n this.value = this.multiple ? openValues : openValues.slice(0, 1)\n }\n }\n\n /**\n * Wire up ids and ARIA relationships, delegate trigger activation, and reflect\n * the open state of every item.\n */\n private setup() {\n if (isServer) {\n return\n }\n\n this.items.forEach((item) => {\n // Reuse a stable id once assigned so re-running setup (e.g. after an item\n // is inserted in the middle) never reassigns ids to items that already\n // have them, which would break existing aria-controls/aria-labelledby.\n const id = item.partsId ?? `${this.accordionId}-item-${this.itemIdCount++}`\n item.partsId = id\n item.setupParts(id)\n })\n\n this.syncState()\n }\n\n // Monotonic per-accordion counter for stable item ids (never reused).\n private itemIdCount = 1\n\n @observe('value', 'updated')\n protected handleValueChange(oldValue: string[] | undefined) {\n this.syncState()\n\n if (oldValue !== undefined) {\n this.dispatchEvent(new AccordionChangeEvent(this.value))\n }\n }\n\n @observe('disabled')\n protected handleDisabledChange() {\n this.items.forEach((item) => {\n item.parentDisabled = this.disabled\n })\n }\n\n /**\n * Reflect the current open set onto every item.\n */\n private syncState() {\n this.items.forEach((item) => {\n item.parentDisabled = this.disabled\n item.open = this.value.includes(item.value)\n // Push open state to the trigger/panel synchronously so ARIA is correct\n // immediately, rather than waiting for the item's own update cycle.\n item.propagate()\n })\n }\n\n /**\n * Open or close a single item, respecting the `multiple` setting.\n */\n private setItemOpen(itemValue: string, open: boolean) {\n let next: string[]\n\n if (open) {\n next = this.multiple ? [...this.value, itemValue] : [itemValue]\n }\n else {\n next = this.value.filter(v => v !== itemValue)\n }\n\n this.value = next\n }\n\n /**\n * Toggle an item when its trigger is activated. Called directly by the\n * [Accordion Trigger](/components/accordion-trigger/).\n * @internal\n */\n activateTrigger(trigger: HTMLElement) {\n const item = trigger.closest<AccordionItem>('nord-accordion-item')\n\n if (!item || item.disabled || this.disabled) {\n return\n }\n\n const isOpen = this.value.includes(item.value)\n\n if (!this.multiple) {\n this.value = isOpen ? [] : [item.value]\n }\n else {\n this.setItemOpen(item.value, !isOpen)\n }\n }\n\n /**\n * Move keyboard focus between triggers. Called by triggers on arrow/Home/End.\n * The focused trigger is the current item, so the shared roving controller\n * resolves it from the active element.\n */\n handleTriggerKeydown(event: KeyboardEvent) {\n this.rovingFocus.handleKeydown(event)\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nord-accordion': Accordion\n }\n}\n"],"names":["RovingFocusController","constructor","host","options","this","handleKeydown","event","orientation","_c","_b","_a","call","vertical","horizontal","rtl","_f","_e","_d","isRTL","key","move","preventDefault","focusFirst","focusLast","items","index","nextFocusable","focus","length","loop","isFocusable","item","direction","from","indexOf","document","activeElement","start","target","wrap","i","stepped","accordionCount","parseValue","value","Array","isArray","split","map","part","trim","filter","Boolean","AccordionChangeEvent","NordEvent","super","Object","defineProperty","enumerable","writable","Accordion","DraftComponentMixin","LitElement","accordionId","DirectionController","rovingFocus","querySelectorAll","loopFocus","trigger","disabled","setupScheduled","multiple","itemIdCount","observedAttributes","connectedCallback","injectLightDomStyles","style","setAttribute","adoptValueAttribute","seedDefaultValue","setup","observeChildren","disconnectedCallback","childObserver","disconnect","undefined","attributeChangedCallback","name","oldValue","newValue","isServer","attr","getAttribute","MutationObserver","scheduleSetup","observe","childList","subtree","updateComplete","then","isConnected","createRenderRoot","openValues","open","slice","forEach","id","partsId","setupParts","syncState","handleValueChange","dispatchEvent","handleDisabledChange","parentDisabled","includes","propagate","setItemOpen","itemValue","next","v","activateTrigger","closest","isOpen","handleTriggerKeydown","__decorate","property","reflect","type","prototype","attribute","customElement"],"mappings":"qcAyBaA,EAKX,WAAAC,CACUC,EACAC,GADAC,KAAIF,KAAJA,EACAE,KAAOD,QAAPA,CACN,CAGJ,aAAAE,CAAcC,mBACZ,MAAMC,EAA0C,QAA5BC,EAA4B,QAA5BC,GAAAC,EAAAN,KAAKD,SAAQI,mBAAe,IAAAE,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6-CmLYFWVC.js";import{css as t,LitElement as r}from"lit";import{property as o,customElement as l}from"lit/decorators.js";import{o as s}from"./observe-D0n0zOfU.js";import{i as a}from"./light-dom-styles-DXsbiKU9.js";const i=t`nord-accordion-header{display:flex;font-family:var(--n-font-family);font-feature-settings:var(--n-font-features);margin:0}`;let n=class extends r{constructor(){super(...arguments),this.level=3}connectedCallback(){super.connectedCallback(),a(this,i),this.setAttribute("role","heading"),this.setAttribute("aria-level",`${this.level}`)}createRenderRoot(){return this}handleLevelChange(){this.setAttribute("aria-level",`${this.level}`)}};e([o({reflect:!0,type:Number})],n.prototype,"level",void 0),e([s("level")],n.prototype,"handleLevelChange",null),n=e([l("nord-accordion-header")],n);var d=n;export{d as default};
|
|
2
|
+
//# sourceMappingURL=AccordionHeader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccordionHeader.js","sources":["../src/accordion/AccordionHeader.ts"],"sourcesContent":["import { LitElement } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { observe } from '../common/decorators/observe.js'\nimport { injectLightDomStyles } from '../common/light-dom-styles.js'\n\nimport style from './AccordionHeader.css'\n\n/**\n * Accordion Header is the heading that labels an\n * [Accordion Panel](/components/accordion-panel/). Following the WAI-ARIA\n * accordion pattern, its [Accordion Trigger](/components/accordion-trigger/)\n * button is wrapped in a heading element.\n *\n * @status draft\n * @category container\n * @lightDom true\n *\n * @slot - Default slot for an [Accordion Trigger](/components/accordion-trigger/).\n */\n@customElement('nord-accordion-header')\nexport default class AccordionHeader extends LitElement {\n /**\n * The heading level exposed to assistive technology, matching the surrounding\n * document outline.\n */\n @property({ reflect: true, type: Number }) level = 3\n\n connectedCallback() {\n super.connectedCallback()\n injectLightDomStyles(this, style)\n this.setAttribute('role', 'heading')\n this.setAttribute('aria-level', `${this.level}`)\n }\n\n // Render in the light DOM so the trigger stays the element's own content and\n // the injected stylesheet applies (no shadow boundary, like Table).\n protected createRenderRoot() {\n return this\n }\n\n @observe('level')\n protected handleLevelChange() {\n this.setAttribute('aria-level', `${this.level}`)\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nord-accordion-header': AccordionHeader\n }\n}\n"],"names":["AccordionHeader","LitElement","constructor","this","level","connectedCallback","super","injectLightDomStyles","style","setAttribute","createRenderRoot","handleLevelChange","__decorate","property","reflect","type","Number","prototype","observe","customElement"],"mappings":"yXAqBe,IAAMA,EAAN,cAA8BC,EAA9B,WAAAC,uBAK8BC,KAAKC,MAAG,CAmBpD,CAjBC,iBAAAC,GACEC,MAAMD,oBACNE,EAAqBJ,KAAMK,GAC3BL,KAAKM,aAAa,OAAQ,WAC1BN,KAAKM,aAAa,aAAc,GAAGN,KAAKC,QACzC,CAIS,gBAAAM,GACR,OAAOP,IACR,CAGS,iBAAAQ,GACRR,KAAKM,aAAa,aAAc,GAAGN,KAAKC,QACzC,GAlB0CQ,EAAA,CAA1CC,EAAS,CAAEC,SAAS,EAAMC,KAAMC,UAAmBhB,EAAAiB,UAAA,aAAA,GAgB1CL,EAAA,CADTM,EAAQ,UAGRlB,EAAAiB,UAAA,oBAAA,MAvBkBjB,EAAeY,EAAA,CADnCO,EAAc,0BACMnB,SAAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{_ as e}from"./tslib.es6-CmLYFWVC.js";import{css as t,LitElement as o}from"lit";import{property as r,customElement as i}from"lit/decorators.js";import{o as s}from"./observe-D0n0zOfU.js";import{i as a}from"./light-dom-styles-DXsbiKU9.js";const n=t`nord-accordion-item{border-block-end:1px solid var(--n-color-border);box-sizing:border-box;display:block}nord-accordion-item:last-of-type{border-block-end:none}`;let d=class extends o{constructor(){super(...arguments),this.value="",this.open=!1,this.disabled=!1,this.parentDisabled=!1}connectedCallback(){super.connectedCallback(),a(this,n)}createRenderRoot(){return this}get trigger(){return this.querySelector("nord-accordion-trigger")}get panel(){return this.querySelector("nord-accordion-panel")}get isDisabled(){return this.disabled||this.parentDisabled}setupParts(e){const{trigger:t,panel:o}=this;t&&(t.id||(t.id=`${e}-trigger`),t.open=this.open,t.disabled=this.isDisabled),o&&(o.id||(o.id=`${e}-panel`),o.open=this.open,t&&(t.setAttribute("aria-controls",o.id),o.setAttribute("aria-labelledby",t.id)))}handleOpenChange(){this.propagate()}propagate(){const{trigger:e,panel:t}=this;e&&(e.open=this.open,e.setAttribute("aria-expanded",`${this.open}`)),t&&(t.open=this.open)}handleDisabledChange(){this.updateTriggerDisabled()}updateTriggerDisabled(){const{trigger:e}=this;e&&(e.disabled=this.isDisabled)}};e([r({reflect:!0})],d.prototype,"value",void 0),e([r({reflect:!0,type:Boolean})],d.prototype,"open",void 0),e([r({reflect:!0,type:Boolean})],d.prototype,"disabled",void 0),e([r({attribute:!1})],d.prototype,"parentDisabled",void 0),e([s("open")],d.prototype,"handleOpenChange",null),e([s("disabled"),s("parentDisabled")],d.prototype,"handleDisabledChange",null),d=e([i("nord-accordion-item")],d);var l=d;export{l as default};
|
|
2
|
+
//# sourceMappingURL=AccordionItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccordionItem.js","sources":["../src/accordion/AccordionItem.ts"],"sourcesContent":["import type AccordionPanel from './AccordionPanel.js'\nimport type AccordionTrigger from './AccordionTrigger.js'\n\nimport { LitElement } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { observe } from '../common/decorators/observe.js'\nimport { injectLightDomStyles } from '../common/light-dom-styles.js'\nimport style from './AccordionItem.css'\n\n/**\n * Accordion Item groups an [Accordion Header](/components/accordion-header/) and\n * its [Accordion Panel](/components/accordion-panel/) within an\n * [Accordion](/components/accordion/).\n *\n * @status draft\n * @category container\n * @lightDom true\n *\n * @slot - Default slot for an [Accordion Header](/components/accordion-header/) and an [Accordion Panel](/components/accordion-panel/).\n */\n@customElement('nord-accordion-item')\nexport default class AccordionItem extends LitElement {\n /**\n * A unique value identifying this item within its\n * [Accordion](/components/accordion/). Used to track which items are open.\n */\n @property({ reflect: true }) value = ''\n\n /**\n * Whether this item is open. Coordinated by the parent\n * [Accordion](/components/accordion/).\n */\n @property({ reflect: true, type: Boolean }) open = false\n\n /**\n * Whether this item is disabled.\n */\n @property({ reflect: true, type: Boolean }) disabled = false\n\n /**\n * Whether the parent [Accordion](/components/accordion/) is disabled. Combined\n * with `disabled` to determine the effective disabled state. Reactive (and\n * observed below) so toggling the parent's `disabled` after setup re-syncs the\n * trigger's disabled/aria-disabled/tabindex.\n * @internal\n */\n @property({ attribute: false }) parentDisabled = false\n\n /**\n * Stable id base assigned by the parent [Accordion](/components/accordion/).\n * Persists across re-setup so ids are never reassigned to an item that\n * already has them.\n * @internal\n */\n partsId?: string\n\n connectedCallback() {\n super.connectedCallback()\n injectLightDomStyles(this, style)\n }\n\n // Render in the light DOM so the header and panel stay the element's own\n // content and the injected stylesheet applies (no shadow boundary, like Table).\n protected createRenderRoot() {\n return this\n }\n\n private get trigger() {\n return this.querySelector<AccordionTrigger>('nord-accordion-trigger')\n }\n\n private get panel() {\n return this.querySelector<AccordionPanel>('nord-accordion-panel')\n }\n\n private get isDisabled() {\n return this.disabled || this.parentDisabled\n }\n\n /**\n * Wire up the ARIA relationship between the trigger and the panel. Called by\n * the parent [Accordion](/components/accordion/).\n * @internal\n */\n setupParts(id: string) {\n const { trigger, panel } = this\n\n if (trigger) {\n trigger.id ||= `${id}-trigger`\n trigger.open = this.open\n trigger.disabled = this.isDisabled\n }\n\n if (panel) {\n panel.id ||= `${id}-panel`\n panel.open = this.open\n if (trigger) {\n trigger.setAttribute('aria-controls', panel.id)\n panel.setAttribute('aria-labelledby', trigger.id)\n }\n }\n }\n\n @observe('open')\n protected handleOpenChange() {\n this.propagate()\n }\n\n /**\n * Synchronously push the open state (and ARIA) to the trigger and panel.\n * Called by the parent [Accordion](/components/accordion/) and on local changes.\n * @internal\n */\n propagate() {\n const { trigger, panel } = this\n if (trigger) {\n trigger.open = this.open\n trigger.setAttribute('aria-expanded', `${this.open}`)\n }\n if (panel) {\n panel.open = this.open\n }\n }\n\n @observe('disabled')\n @observe('parentDisabled')\n protected handleDisabledChange() {\n this.updateTriggerDisabled()\n }\n\n private updateTriggerDisabled() {\n const { trigger } = this\n if (trigger) {\n trigger.disabled = this.isDisabled\n }\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nord-accordion-item': AccordionItem\n }\n}\n"],"names":["AccordionItem","LitElement","constructor","this","value","open","disabled","parentDisabled","connectedCallback","super","injectLightDomStyles","style","createRenderRoot","trigger","querySelector","panel","isDisabled","setupParts","id","setAttribute","handleOpenChange","propagate","handleDisabledChange","updateTriggerDisabled","__decorate","property","reflect","prototype","type","Boolean","attribute","observe","customElement"],"mappings":"+ZAsBe,IAAMA,EAAN,cAA4BC,EAA5B,WAAAC,uBAKgBC,KAAKC,MAAG,GAMOD,KAAIE,MAAG,EAKPF,KAAQG,UAAG,EASvBH,KAAcI,gBAAG,CA0FlD,CAhFC,iBAAAC,GACEC,MAAMD,oBACNE,EAAqBP,KAAMQ,EAC5B,CAIS,gBAAAC,GACR,OAAOT,IACR,CAED,WAAYU,GACV,OAAOV,KAAKW,cAAgC,yBAC7C,CAED,SAAYC,GACV,OAAOZ,KAAKW,cAA8B,uBAC3C,CAED,cAAYE,GACV,OAAOb,KAAKG,UAAYH,KAAKI,cAC9B,CAOD,UAAAU,CAAWC,GACT,MAAML,QAAEA,EAAOE,MAAEA,GAAUZ,KAEvBU,IACFA,EAAQK,KAARL,EAAQK,GAAO,GAAGA,aAClBL,EAAQR,KAAOF,KAAKE,KACpBQ,EAAQP,SAAWH,KAAKa,YAGtBD,IACFA,EAAMG,KAANH,EAAMG,GAAO,GAAGA,WAChBH,EAAMV,KAAOF,KAAKE,KACdQ,IACFA,EAAQM,aAAa,gBAAiBJ,EAAMG,IAC5CH,EAAMI,aAAa,kBAAmBN,EAAQK,KAGnD,CAGS,gBAAAE,GACRjB,KAAKkB,WACN,CAOD,SAAAA,GACE,MAAMR,QAAEA,EAAOE,MAAEA,GAAUZ,KACvBU,IACFA,EAAQR,KAAOF,KAAKE,KACpBQ,EAAQM,aAAa,gBAAiB,GAAGhB,KAAKE,SAE5CU,IACFA,EAAMV,KAAOF,KAAKE,KAErB,CAIS,oBAAAiB,GACRnB,KAAKoB,uBACN,CAEO,qBAAAA,GACN,MAAMV,QAAEA,GAAYV,KAChBU,IACFA,EAAQP,SAAWH,KAAKa,WAE3B,GA7G4BQ,EAAA,CAA5BC,EAAS,CAAEC,SAAS,KAAkB1B,EAAA2B,UAAA,aAAA,GAMKH,EAAA,CAA3CC,EAAS,CAAEC,SAAS,EAAME,KAAMC,WAAuB7B,EAAA2B,UAAA,YAAA,GAKZH,EAAA,CAA3CC,EAAS,CAAEC,SAAS,EAAME,KAAMC,WAA2B7B,EAAA2B,UAAA,gBAAA,GAS5BH,EAAA,CAA/BC,EAAS,CAAEK,WAAW,KAA+B9B,EAAA2B,UAAA,sBAAA,GA0D5CH,EAAA,CADTO,EAAQ,SAGR/B,EAAA2B,UAAA,mBAAA,MAoBSH,EAAA,CAFTO,EAAQ,YACRA,EAAQ,mBAGR/B,EAAA2B,UAAA,uBAAA,MA3GkB3B,EAAawB,EAAA,CADjCQ,EAAc,wBACMhC,SAAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{_ as o}from"./tslib.es6-CmLYFWVC.js";import{css as e,LitElement as t}from"lit";import{property as n,customElement as r}from"lit/decorators.js";import{C as i}from"./CollapseController-BtKNFNyJ.js";import{i as s}from"./light-dom-styles-DXsbiKU9.js";import"./StateAttributesController-BIh96sXZ.js";import"./events-Bv6wNHwJ.js";const a=e`nord-accordion-panel{box-sizing:border-box;color:var(--n-color-text-weaker);display:block;font-family:var(--n-font-family);font-feature-settings:var(--n-font-features);font-size:var(--n-font-size-s);line-height:var(--n-line-height);overflow:hidden;transition:block-size var(--n-transition-slowly)}nord-accordion-panel[hidden]{display:none}nord-accordion-panel:after{block-size:var(--n-space-m);content:"";display:block}@media (prefers-reduced-motion:reduce){nord-accordion-panel{transition:none}}`;let l=class extends t{constructor(){super(...arguments),this.open=!1,this.collapse=new i(this,{open:()=>this.open,heightVar:"--n-accordion-panel-height"})}connectedCallback(){super.connectedCallback(),s(this,a),this.setAttribute("role","region"),this.hidden=!this.open}createRenderRoot(){return this}};o([n({reflect:!0,type:Boolean})],l.prototype,"open",void 0),l=o([r("nord-accordion-panel")],l);var c=l;export{c as default};
|
|
2
|
+
//# sourceMappingURL=AccordionPanel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccordionPanel.js","sources":["../src/accordion/AccordionPanel.ts"],"sourcesContent":["import { LitElement } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { CollapseController } from '../common/controllers/CollapseController.js'\nimport { injectLightDomStyles } from '../common/light-dom-styles.js'\n\nimport style from './AccordionPanel.css'\n\n/**\n * Accordion Panel holds the content revealed by its\n * [Accordion Trigger](/components/accordion-trigger/). It must be placed inside\n * an [Accordion Item](/components/accordion-item/) and animates its height as it\n * opens and closes.\n *\n * @status draft\n * @category container\n * @lightDom true\n *\n * @slot - Default slot for the panel content.\n *\n * @attr {boolean} data-open - Present while the panel is open (or opening).\n * @attr {boolean} data-closed - Present while the panel is closed.\n * @attr {boolean} data-starting-style - Present for the first frame of the open transition.\n * @attr {boolean} data-ending-style - Present while the close transition runs.\n *\n * @cssprop [--n-accordion-panel-height] - Set during the open/close animation to the measured content height. Read it to coordinate custom animations.\n */\n@customElement('nord-accordion-panel')\nexport default class AccordionPanel extends LitElement {\n /**\n * Whether the panel is open. Set by the parent\n * [Accordion Item](/components/accordion-item/).\n */\n @property({ reflect: true, type: Boolean }) open = false\n\n // The height animation + transition-status data-attributes live in the shared\n // controller (also used by the collapsible panel).\n private collapse = new CollapseController(this, {\n open: () => this.open,\n heightVar: '--n-accordion-panel-height',\n })\n\n connectedCallback() {\n super.connectedCallback()\n injectLightDomStyles(this, style)\n this.setAttribute('role', 'region')\n // Reflect the initial state without animating.\n this.hidden = !this.open\n }\n\n // Render in the light DOM so the content is the element's own children and the\n // injected stylesheet applies (no shadow boundary, like Table).\n protected createRenderRoot() {\n return this\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nord-accordion-panel': AccordionPanel\n }\n}\n"],"names":["AccordionPanel","LitElement","constructor","this","open","collapse","CollapseController","heightVar","connectedCallback","super","injectLightDomStyles","style","setAttribute","hidden","createRenderRoot","__decorate","property","reflect","type","Boolean","prototype","customElement"],"mappings":"u0BA4Be,IAAMA,EAAN,cAA6BC,EAA7B,WAAAC,uBAK+BC,KAAIC,MAAG,EAI3CD,KAAAE,SAAW,IAAIC,EAAmBH,KAAM,CAC9CC,KAAM,IAAMD,KAAKC,KACjBG,UAAW,8BAgBd,CAbC,iBAAAC,GACEC,MAAMD,oBACNE,EAAqBP,KAAMQ,GAC3BR,KAAKS,aAAa,OAAQ,UAE1BT,KAAKU,QAAUV,KAAKC,IACrB,CAIS,gBAAAU,GACR,OAAOX,IACR,GArB2CY,EAAA,CAA3CC,EAAS,CAAEC,SAAS,EAAMC,KAAMC,WAAuBnB,EAAAoB,UAAA,YAAA,GALrCpB,EAAce,EAAA,CADlCM,EAAc,yBACMrB,SAAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{_ as e}from"./tslib.es6-CmLYFWVC.js";import{css as t,LitElement as r}from"lit";import{property as n,customElement as o}from"lit/decorators.js";import{F as i}from"./FocusableWhenDisabledController-C_Mn1mfN.js";import{o as a}from"./observe-D0n0zOfU.js";import{i as s}from"./light-dom-styles-DXsbiKU9.js";const c=t`nord-accordion-trigger{align-items:center;box-sizing:border-box;cursor:pointer;display:flex;flex:1;font-family:var(--n-font-family);font-size:var(--n-font-size-s);font-weight:var(--n-font-weight-active);gap:var(--n-accordion-trigger-gap,var(--n-space-xs));inline-size:100%;justify-content:space-between;line-height:var(--n-line-height-tight);padding-block-end:var(--n-space-m);padding-block-start:var(--n-space-m);text-align:start;user-select:none}nord-accordion-trigger,nord-accordion-trigger:hover>:last-child{color:var(--n-color-text)}nord-accordion-trigger:focus-visible{border-radius:var(--n-border-radius-s);outline:2px solid var(--n-color-accent);outline-offset:2px}nord-accordion-trigger[aria-disabled=true]{color:var(--n-color-text-weaker);cursor:not-allowed}nord-accordion-trigger[justify-content=start]{justify-content:flex-start}nord-accordion-trigger[justify-content=center]{justify-content:center}nord-accordion-trigger[justify-content=end]{justify-content:flex-end}nord-accordion-trigger[justify-content=space-between]{justify-content:space-between}nord-accordion-trigger[justify-content=space-around]{justify-content:space-around}nord-accordion-trigger[justify-content=space-evenly]{justify-content:space-evenly}nord-accordion-trigger>:last-child{color:var(--n-color-text-weaker);flex-shrink:0;transition:transform var(--n-transition-slowly),color var(--n-transition-quickly)}nord-accordion-trigger[open]>:last-child{transform:rotate(180deg)}@media (prefers-reduced-motion:reduce){nord-accordion-trigger>:last-child{transition:none}}`;let d=class extends r{constructor(){super(...arguments),this.open=!1,this.disabled=!1,this.focusable=new i(this,{disabled:()=>this.disabled}),this.handleClick=()=>{this.activate()},this.handleKeydown=e=>{var t;if("Enter"===e.key||" "===e.key)return e.preventDefault(),void this.activate();null===(t=this.accordion)||void 0===t||t.handleTriggerKeydown(e)}}connectedCallback(){super.connectedCallback(),s(this,c),this.setAttribute("role","button"),this.setAttribute("aria-expanded",`${this.open}`),this.addEventListener("click",this.handleClick),this.addEventListener("keydown",this.handleKeydown)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("click",this.handleClick),this.removeEventListener("keydown",this.handleKeydown)}createRenderRoot(){return this}get accordion(){return this.closest("nord-accordion")}handleOpenChange(){this.setAttribute("aria-expanded",`${this.open}`)}activate(){var e;this.disabled||null===(e=this.accordion)||void 0===e||e.activateTrigger(this)}};e([n({reflect:!0,type:Boolean})],d.prototype,"open",void 0),e([n({reflect:!0,type:Boolean})],d.prototype,"disabled",void 0),e([n({reflect:!0,attribute:"justify-content"})],d.prototype,"justifyContent",void 0),e([a("open")],d.prototype,"handleOpenChange",null),d=e([o("nord-accordion-trigger")],d);var l=d;export{l as default};
|
|
2
|
+
//# sourceMappingURL=AccordionTrigger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccordionTrigger.js","sources":["../src/accordion/AccordionTrigger.ts"],"sourcesContent":["import type Accordion from './Accordion.js'\nimport { LitElement } from 'lit'\n\nimport { customElement, property } from 'lit/decorators.js'\nimport { FocusableWhenDisabledController } from '../common/controllers/FocusableWhenDisabledController.js'\nimport { observe } from '../common/decorators/observe.js'\n\nimport { injectLightDomStyles } from '../common/light-dom-styles.js'\nimport style from './AccordionTrigger.css'\n\n/**\n * Accordion Trigger is the button that opens and closes its\n * [Accordion Panel](/components/accordion-panel/). It must be placed inside an\n * [Accordion Header](/components/accordion-header/).\n *\n * @status draft\n * @category container\n * @lightDom true\n *\n * @slot - Default slot for the trigger label and an icon. The icon is the last\n * child, so any element or web component can be used; set its size on the\n * element itself (for example `<nord-icon size=\"xxs\">`).\n *\n * @cssprop [--n-accordion-trigger-gap=var(--n-space-xs)] - The gap between the label and the icon, using our [spacing tokens](/tokens/#space).\n */\n@customElement('nord-accordion-trigger')\nexport default class AccordionTrigger extends LitElement {\n /**\n * Whether the associated panel is open. Set by the parent\n * [Accordion Item](/components/accordion-item/); reflected so it can be styled.\n */\n @property({ reflect: true, type: Boolean }) open = false\n\n /**\n * Whether the trigger is disabled. Set by the parent\n * [Accordion Item](/components/accordion-item/).\n */\n @property({ reflect: true, type: Boolean }) disabled = false\n\n /**\n * How to justify the label and icon along the trigger. Defaults to\n * `space-between`, pushing the icon to the far end; set `start` to sit the\n * label and icon next to each other.\n */\n @property({ reflect: true, attribute: 'justify-content' }) justifyContent?:\n | 'start'\n | 'center'\n | 'end'\n | 'space-between'\n | 'space-around'\n | 'space-evenly'\n\n // Keeps the trigger focusable while disabled (aria-disabled + tabindex=0),\n // matching Base UI; activation is blocked by `activate()` below.\n private focusable = new FocusableWhenDisabledController(this, { disabled: () => this.disabled })\n\n connectedCallback() {\n super.connectedCallback()\n injectLightDomStyles(this, style)\n // The host itself is the focusable button: light DOM can't delegate focus\n // into a shadow `<button>`, so we apply button semantics directly.\n this.setAttribute('role', 'button')\n this.setAttribute('aria-expanded', `${this.open}`)\n this.addEventListener('click', this.handleClick)\n this.addEventListener('keydown', this.handleKeydown)\n }\n\n disconnectedCallback() {\n super.disconnectedCallback()\n this.removeEventListener('click', this.handleClick)\n this.removeEventListener('keydown', this.handleKeydown)\n }\n\n // Render in the light DOM so the label/icon stay the element's own content and\n // the injected stylesheet applies (no shadow boundary, like Table).\n protected createRenderRoot() {\n return this\n }\n\n private get accordion() {\n return this.closest<Accordion>('nord-accordion')\n }\n\n @observe('open')\n protected handleOpenChange() {\n this.setAttribute('aria-expanded', `${this.open}`)\n }\n\n private activate() {\n if (this.disabled) {\n return\n }\n\n // Call the parent Accordion directly (no bubbling event), mirroring how\n // CollapsibleTrigger calls its Collapsible.\n this.accordion?.activateTrigger(this)\n }\n\n private handleClick = () => {\n this.activate()\n }\n\n private handleKeydown = (event: KeyboardEvent) => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault()\n this.activate()\n return\n }\n\n this.accordion?.handleTriggerKeydown(event)\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nord-accordion-trigger': AccordionTrigger\n }\n}\n"],"names":["AccordionTrigger","LitElement","constructor","this","open","disabled","focusable","FocusableWhenDisabledController","handleClick","activate","handleKeydown","event","key","preventDefault","_a","accordion","handleTriggerKeydown","connectedCallback","super","injectLightDomStyles","style","setAttribute","addEventListener","disconnectedCallback","removeEventListener","createRenderRoot","closest","handleOpenChange","activateTrigger","__decorate","property","reflect","type","Boolean","prototype","attribute","observe","customElement"],"mappings":"80DA0Be,IAAMA,EAAN,cAA+BC,EAA/B,WAAAC,uBAK+BC,KAAIC,MAAG,EAMPD,KAAQE,UAAG,EAiB/CF,KAAAG,UAAY,IAAIC,EAAgCJ,KAAM,CAAEE,SAAU,IAAMF,KAAKE,WA4C7E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Dg2vCfGd.js";var e=Object.freeze({__proto__:null,default:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m18.7249 4.67008-10 11.00002c-.18.2-.44.32-.72.33h-.02c-.27 0-.52-.1-.71-.29l-6-6.00002 1.41-1.41 5.26 5.26002 9.3-10.23002 1.48 1.35z" fill="currentColor"/></svg>',tags:"nordicon interface checked symbol checkmark done ready",title:"interface-checked"});class n{constructor(t,e){this.host=t,this.options=e,this._activeIndex=-1}get activeIndex(){return this._activeIndex}get activeDescendant(){var t,e;return this._activeIndex>=0?null===(e=(t=this.options).optionId)||void 0===e?void 0:e.call(t,this._activeIndex):void 0}setActiveIndex(t){t!==this._activeIndex&&(this._activeIndex=t,this.host.requestUpdate())}reset(){this.setActiveIndex(-1)}nextEnabledIndex(e,n){var i,s,o;const r=this.options.count();if(0===r)return-1;const c=null===(o=null===(s=(i=this.options).loop)||void 0===s?void 0:s.call(i))||void 0===o||o;let d=e;if(d<0||d>=r){if(!c)return-1;d=t(d,0,r-1)}for(let e=0;e<r;e++){if(this.options.isEnabled(d))return d;const e=d+n;if(e<0||e>=r){if(!c)return-1;d=t(e,0,r-1)}else d=e}return-1}move(t){const e=this.options.count();if(0===e)return!1;const n=t>0?1:-1,i=this._activeIndex<0?this.nextEnabledIndex(t>0?0:e-1,n):this.nextEnabledIndex(this._activeIndex+t,n);return-1!==i&&(this.setActiveIndex(i),!0)}first(){const t=this.nextEnabledIndex(0,1);return-1!==t&&(this.setActiveIndex(t),!0)}last(){const t=this.nextEnabledIndex(this.options.count()-1,-1);return-1!==t&&(this.setActiveIndex(t),!0)}}export{n as A,e as c};
|
|
2
|
+
//# sourceMappingURL=ActiveDescendantController-BnMqM79O.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ActiveDescendantController-BnMqM79O.js","sources":["../../icons/lib/assets/interface-checked.js","../src/common/controllers/ActiveDescendantController.ts"],"sourcesContent":["export default '<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"m18.7249 4.67008-10 11.00002c-.18.2-.44.32-.72.33h-.02c-.27 0-.52-.1-.71-.29l-6-6.00002 1.41-1.41 5.26 5.26002 9.3-10.23002 1.48 1.35z\" fill=\"currentColor\"/></svg>';\nexport const title = \"interface-checked\";\nexport const tags = \"nordicon interface checked symbol checkmark done ready\";\n","import type { ReactiveControllerHost } from 'lit'\n\nimport { wrap } from '../number.js'\n\nexport interface ActiveDescendantOptions {\n /** The number of navigable rows. */\n count: () => number\n /** Whether the row at `index` can be activated (skip disabled rows). */\n isEnabled: (index: number) => boolean\n /** Wrap at the ends. Defaults to `true`. */\n loop?: () => boolean\n /** The DOM id of the row at `index`, used for `aria-activedescendant`. */\n optionId?: (index: number) => string | undefined\n}\n\n/**\n * Tracks the active row of a virtual-focus listbox (combobox / filter dropdown):\n * the focus stays on the input/trigger while an `activeIndex` roams the rows and\n * is surfaced as `aria-activedescendant`. Centralises the `nextEnabledIndex` /\n * `move` / wrap math the combobox and filter-dropdown previously duplicated.\n */\nexport class ActiveDescendantController {\n private _activeIndex = -1\n\n // A host-bound helper rather than a lifecycle ReactiveController: it owns no\n // connect/update hooks, it only reads/writes the active index and asks the\n // host to re-render, so it doesn't register via `addController`.\n constructor(\n private host: ReactiveControllerHost & HTMLElement,\n private options: ActiveDescendantOptions,\n ) {}\n\n /** The active row index, or `-1` when nothing is active. */\n get activeIndex(): number {\n return this._activeIndex\n }\n\n /** The active row's id for `aria-activedescendant`, or `undefined`. */\n get activeDescendant(): string | undefined {\n return this._activeIndex >= 0 ? this.options.optionId?.(this._activeIndex) : undefined\n }\n\n /** Set the active index, requesting a host update when it changes. */\n setActiveIndex(index: number) {\n if (index !== this._activeIndex) {\n this._activeIndex = index\n this.host.requestUpdate()\n }\n }\n\n /** Clear the active row. */\n reset() {\n this.setActiveIndex(-1)\n }\n\n /**\n * The next enabled row from `from` stepping by `dir`, wrapping (when looping)\n * and skipping disabled rows. Returns `-1` if no row is enabled.\n */\n nextEnabledIndex(from: number, dir: 1 | -1): number {\n const count = this.options.count()\n if (count === 0) {\n return -1\n }\n const loop = this.options.loop?.() ?? true\n\n let index = from\n if (index < 0 || index >= count) {\n if (!loop) {\n return -1\n }\n index = wrap(index, 0, count - 1)\n }\n\n for (let i = 0; i < count; i++) {\n if (this.options.isEnabled(index)) {\n return index\n }\n const stepped = index + dir\n if (stepped < 0 || stepped >= count) {\n if (!loop) {\n return -1\n }\n index = wrap(stepped, 0, count - 1)\n }\n else {\n index = stepped\n }\n }\n return -1\n }\n\n /**\n * Move the active row by `delta` (its sign is the direction). Starts from the\n * matching end when nothing is active. Returns `true` if it moved.\n */\n move(delta: number): boolean {\n const count = this.options.count()\n if (count === 0) {\n return false\n }\n const dir = delta > 0 ? 1 : -1\n const next = this._activeIndex < 0\n ? this.nextEnabledIndex(delta > 0 ? 0 : count - 1, dir)\n : this.nextEnabledIndex(this._activeIndex + delta, dir)\n\n if (next === -1) {\n return false\n }\n this.setActiveIndex(next)\n return true\n }\n\n /** Activate the first enabled row (Home). Returns `true` if one was found. */\n first(): boolean {\n const next = this.nextEnabledIndex(0, 1)\n if (next === -1) {\n return false\n }\n this.setActiveIndex(next)\n return true\n }\n\n /** Activate the last enabled row (End). Returns `true` if one was found. */\n last(): boolean {\n const next = this.nextEnabledIndex(this.options.count() - 1, -1)\n if (next === -1) {\n return false\n }\n this.setActiveIndex(next)\n return true\n }\n}\n"],"names":["ActiveDescendantController","constructor","host","options","this","_activeIndex","activeIndex","activeDescendant","_b","_a","optionId","call","undefined","setActiveIndex","index","requestUpdate","reset","nextEnabledIndex","from","dir","count","loop","_c","wrap","i","isEnabled","stepped","move","delta","next","first","last"],"mappings":"qFAAe,gPAEK,+DADC,4BCoBRA,EAMX,WAAAC,CACUC,EACAC,GADAC,KAAIF,KAAJA,EACAE,KAAOD,QAAPA,EAPFC,KAAYC,cAAI,CAQpB,CAGJ,eAAIC,GACF,OAAOF,KAAKC,YACb,CAGD,oBAAIE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egB,IACb,EACR,CAGD,KAAAC,GACE,MAAMD,EAAOzB,KAAKa,iBAAiB,EAAG,GACtC,OAAc,IAAVY,IAGJzB,KAAKS,eAAegB,IACb,EACR,CAGD,IAAAE,GACE,MAAMF,EAAOzB,KAAKa,iBAAiBb,KAAKD,QAAQiB,QAAU,GAAI,GAC9D,OAAc,IAAVS,IAGJzB,KAAKS,eAAegB,IACb,EACR"}
|
package/lib/Aside.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import{_ as e}from"./tslib.es6-CmLYFWVC.js";import{css as t,LitElement as i,html as r,nothing as a}from"lit";import{property as n,state as s,query as o,customElement as l}from"lit/decorators.js";import{classMap as d}from"lit/directives/class-map.js";import{S as c}from"./SlotController-Z6eG7LSZ.js";import{o as h}from"./observe-D0n0zOfU.js";import{N as u}from"./events-Bv6wNHwJ.js";import{g as p}from"./focus-D8oSvIcN.js";import{s as v}from"./Component-
|
|
2
|
-
--n-aside-drawer-floating-inset-block-start,
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
--n-aside-drawer-floating-inset-block-end,
|
|
6
|
-
calc(var(--_n-aside-rail-narrow-block-size) - var(--_n-aside-drawer-floating-bottom-offset))
|
|
7
|
-
);--_n-aside-backdrop-background:var(--n-aside-backdrop-background, var(--n-color-overlay));--_n-aside-drawer-slide-duration:var(--n-aside-drawer-slide-duration, 300ms);--_n-aside-drawer-slide-easing:var(--n-aside-drawer-slide-easing, cubic-bezier(0.4, 0, 0.2, 1));--_n-aside-z-backdrop:var(--n-aside-z-backdrop, calc(var(--n-index-top-bar, 1000) + 2));--_n-aside-z-drawer-floating:var(--n-aside-z-drawer-floating, calc(var(--n-index-top-bar, 1000) + 3));--_n-aside-z-rail-narrow:var(--n-aside-z-rail-narrow, calc(var(--n-index-top-bar, 1000) + 4));display:flex;position:relative;background:var(--_n-aside-background-color);block-size:100%;min-block-size:100%;align-self:stretch}.n-aside{display:flex;flex:1;flex-direction:row;align-items:stretch;gap:var(--_n-aside-rail-gap);position:relative;block-size:100%}.n-aside-rail{order:99;flex:0 0 auto;inline-size:var(--_n-aside-rail-width);block-size:100%;display:flex;flex-direction:column;align-items:center;padding-inline-start:var(--_n-aside-rail-padding-inline);padding-inline-end:var(--_n-aside-rail-padding-inline);padding-block-start:var(--_n-aside-rail-padding-block);padding-block-end:var(--_n-aside-rail-padding-block);box-sizing:border-box;background:var(--_n-aside-rail-background-color);border-inline-start:var(--_n-aside-rail-border-width) solid var(--_n-aside-rail-border-color);box-shadow:var(--_n-aside-rail-box-shadow);margin-inline-start:auto;position:relative;z-index:calc(var(--_n-aside-z-index) + 1)}:host([data-fullscreen]) .n-aside-rail{z-index:calc(var(--_n-aside-z-index-fullscreen) + 1)}.n-aside-rail ::slotted(*){display:block}.n-aside-drawers{display:flex;flex:0 0 auto;margin-inline-start:var(--_n-aside-drawers-margin-inline-start)}:host(:is([active-drawer=''],:not([active-drawer]))) .n-aside-drawers{display:contents}.n-resize{touch-action:none;user-select:none;position:absolute;block-size:var(--_n-aside-resize-block-size);inset-block:0;margin-block:auto;inset-inline-start:calc(var(--_n-aside-drawers-margin-inline-start) - 4px);inline-size:10px;background:0 0;border:0;padding:0;z-index:calc(var(--n-index-nav) + 1)}.n-resize[data-handle-mode=col-resize]{cursor:col-resize}.n-resize[data-handle-mode=pointer]{cursor:pointer}.n-resize[data-handle-mode=default]{cursor:default}.n-resize::after{content:'';position:absolute;inset-block:0;inset-inline:0;margin-inline:auto;inline-size:3px;background:var(--_n-aside-resize-color);transition:opacity var(--n-transition-slowly);opacity:0}.n-resize:not([data-handle-mode=default]):focus-visible::after,.n-resize:not([data-handle-mode=default]):hover::after{opacity:1;transition-delay:.15s}.n-aside.n-dragging .n-resize::after{opacity:1}.n-resize:focus{outline:0}.n-resize[aria-disabled=true]::after{display:none}@media (max-width:767px){.n-resize{display:none}}.n-aside.n-dragging{cursor:col-resize;user-select:none}.n-resize-tooltip{transform:translateY(var(--n-resize-tooltip-y,0))}.n-aside.n-dragging .n-resize-tooltip{visibility:hidden!important;opacity:0!important}.n-aside-backdrop{display:none}:host([data-narrow-floating-drawer]) .n-aside-backdrop{display:block;position:fixed;inset-block-start:0;inset-inline-start:0;inset-inline-end:0;inset-block-end:var(--_n-aside-rail-narrow-block-size);background:var(--_n-aside-backdrop-background);pointer-events:auto;z-index:var(--_n-aside-z-backdrop)}:host([data-narrow-floating-drawer]:not([data-narrow-rail-bottom])) .n-aside-backdrop{inset-block-end:0}@media (max-width:767px){:host([data-narrow-floating-drawer]) .n-aside,:host([data-narrow-rail-bottom]) .n-aside{display:contents}:host([data-narrow-rail-bottom]) .n-aside-rail{position:fixed;inset-inline-start:0;inset-inline-end:0;inset-block-end:var(--n-aside-rail-narrow-inset-block-end,0);block-size:var(--_n-aside-rail-narrow-block-size);inline-size:auto;flex-direction:row;justify-content:flex-start;align-items:center;padding-inline-start:var(--_n-aside-rail-narrow-padding-inline);padding-inline-end:var(--_n-aside-rail-narrow-padding-inline);padding-block-start:var(--_n-aside-rail-narrow-padding-block);padding-block-end:var(--_n-aside-rail-narrow-padding-block);margin-inline-start:0;border-inline-start:0;border-block-start:var(--_n-aside-rail-narrow-border-block-start-width) solid var(--_n-aside-rail-narrow-border-color);overflow-x:auto;overflow-y:hidden;scroll-snap-type:x mandatory;scrollbar-width:none;pointer-events:auto;z-index:var(--_n-aside-z-rail-narrow)}:host([data-narrow-rail-bottom]) .n-aside-rail::-webkit-scrollbar{display:none}:host([data-narrow-rail-bottom]) .n-aside-rail ::slotted(*){inline-size:auto;flex:0 0 auto;scroll-snap-align:start}:host([data-narrow-floating-drawer]) .n-aside-drawers{position:fixed;inset-block-start:var(--_n-aside-drawer-floating-inset-block-start);inset-inline-start:var(--_n-aside-drawer-floating-inset-inline);inline-size:calc(100vw - (var(--_n-aside-drawer-floating-inset-inline) * 2));block-size:calc(100vh - var(--_n-aside-drawer-floating-inset-block-start) - var(--_n-aside-drawer-floating-inset-block-end));margin-inline-start:0;overscroll-behavior:contain;pointer-events:auto;z-index:var(--_n-aside-z-drawer-floating);animation:n-aside-drawer-slide-up var(--_n-aside-drawer-slide-duration) var(--_n-aside-drawer-slide-easing)}@keyframes n-aside-drawer-slide-up{from{transform:translateY(100%)}to{transform:translateY(0)}}:host([data-narrow-floating-drawer]) ::slotted(nord-aside-drawer){inline-size:100%!important;max-inline-size:100%!important;min-inline-size:0!important;block-size:100%;margin-block:0;margin-inline:0}:host([data-narrow-floating-drawer]) ::slotted(nord-aside-drawer nord-drawer){box-shadow:var(--n-box-shadow-popout);border-radius:var(--n-border-radius)}:host(:not([data-narrow-floating-drawer])) .n-aside-drawers{pointer-events:none}}`;let m=0;class k extends u{constructor(e,t){super("active-drawer-change"),Object.defineProperties(this,{activeDrawer:{value:e,enumerable:!0,writable:!1},previousDrawer:{value:t,enumerable:!0,writable:!1}})}}class D extends u{constructor(e){super("drawer-open"),Object.defineProperty(this,"activeDrawer",{value:e,enumerable:!0,writable:!1})}}class z extends u{constructor(e){super("drawer-close"),Object.defineProperty(this,"previousDrawer",{value:e,enumerable:!0,writable:!1})}}class x extends u{constructor(e,t){super("drawer-resize"),Object.defineProperties(this,{drawerId:{value:e,enumerable:!0,writable:!1},width:{value:t,enumerable:!0,writable:!1}})}}class S extends u{constructor(e,t){super("handle-mode-change"),Object.defineProperties(this,{mode:{value:e,enumerable:!0,writable:!1},previous:{value:t,enumerable:!0,writable:!1}})}}const C=["a[href]","button","input","select","textarea","[tabindex]","audio[controls]","video[controls]",'[contenteditable]:not([contenteditable="false"])',"details > summary:first-of-type"].join(","),_="undefined"!=typeof matchMedia?matchMedia("(min-width: 768px)"):{matches:!1,addEventListener(){},removeEventListener(){}};new WeakSet;let L=class extends i{constructor(){super(...arguments),this.activeDrawer="",this.railWidth=48,this.railGap=0,this.handleClick="toggle",this.lastDrawer="",this.isDragging=!1,this.wideScreen=_.matches,this.hasRailItems=!1,this.tooltipSlot=new c(this,"tooltip-divider"),this.resizeTooltipId="n-aside-resize-tip-"+ ++m,this.dragStartX=0,this.hasDragged=!1,this.handleRailSlotChange=e=>{const t=e.target.assignedElements({flatten:!0}).length>0;t!==this.hasRailItems&&(this.hasRailItems=t,this.syncNarrowState())},this.handleBackdropClick=()=>{this.activeDrawer&&(this.lastDrawer=this.activeDrawer,this.activeDrawer="")},this.handleMediaChange=e=>{this.wideScreen=e.matches,this.syncNarrowState(),this.syncLayoutDrawerSize()},this.handleHostKeyDown=e=>{"Escape"===e.key&&(this.wideScreen||this.activeDrawer&&(e.defaultPrevented||(this.lastDrawer=this.activeDrawer,this.activeDrawer="",e.stopPropagation())))},this.holdsBodyScrollLock=!1,this.floatingFocusActive=!1,this.floatingFocusReturnElement=null,this.trappedDrawer=null,this.handleFloatingFocusKeydown=e=>{if("Tab"!==e.key)return;const t=this.trappedDrawer;if(!t)return;const i=this.focusableElementsInDrawer(t);if(0===i.length)return e.preventDefault(),t.tabIndex=-1,void t.focus();const r=i[0],a=i[i.length-1],n=p(document);e.shiftKey?n!==r&&this.drawerContainsFocus(t,n)||(e.preventDefault(),a.focus()):n!==a&&this.drawerContainsFocus(t,n)||(e.preventDefault(),r.focus())},this.handleDrawerWidthChange=e=>{const t=e,i=e.target;i instanceof HTMLElement&&"NORD-ASIDE-DRAWER"===i.tagName&&(this.dispatchEvent(new x(i.id,t.width)),this.syncLayoutDrawerSize())},this.startDragging=e=>{if(0!==e.button||!this.wideScreen)return;const t=e.currentTarget;try{t.setPointerCapture(e.pointerId)}catch(e){}this.isDragging=!0,this.dragStartX=e.clientX,this.hasDragged=!1,this.dragGeometry={rect:this.getBoundingClientRect(),styles:getComputedStyle(this)}},this.stopDragging=e=>{if(!this.isDragging)return;const t=!this.hasDragged;if(this.isDragging=!1,this.hasDragged=!1,this.dragGeometry=void 0,e){const t=e.currentTarget;try{t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId)}catch(e){}}t&&this.handleHandleClick()},this.handlePointerLeave=e=>{var t;this.isDragging&&this.stopDragging(e),null===(t=this.resizeTooltipEl)||void 0===t||t.style.removeProperty("--n-resize-tooltip-y")},this.handleResizeHoverMove=e=>{const t=e.currentTarget;if(!t||!this.resizeTooltipEl)return;const i=t.getBoundingClientRect(),r=e.clientY-(i.top+i.height/2);this.resizeTooltipEl.style.setProperty("--n-resize-tooltip-y",`${r}px`)},this.handleDrag=e=>{var t;if(!this.activeDrawerEl)return void(Math.abs(e.clientX-this.dragStartX)>=4&&(this.hasDragged=!0));if(!this.hasDragged&&Math.abs(e.clientX-this.dragStartX)<4)return;this.hasDragged=!0;const i=this.activeDrawerEl;if(i.isPinned)return;const r=null!==(t=this.dragGeometry)&&void 0!==t?t:{rect:this.getBoundingClientRect(),styles:getComputedStyle(this)},a=r.rect.right-e.clientX-this.railWidth-this.railGap,n=this.drawerWidthAtCapWithMainFloor(r),s=void 0!==n?Math.min(a,n):a;i.setWidth(s,"drag")},this.scheduleLeftCapReconcile=()=>{this.leftCapReconcileScheduled||(this.leftCapReconcileScheduled=!0,requestAnimationFrame((()=>{this.leftCapReconcileScheduled=!1;const e={rect:this.getBoundingClientRect(),styles:getComputedStyle(this)};this.flushFullscreenAvailable(e),this.flushDragCap(e)})))},this.leftCapReconcileScheduled=!1,this.handleLayoutNavChange=()=>{this.scheduleLeftCapReconcile()},this.handleViewportResize=()=>{this.scheduleLeftCapReconcile()},this.handleKeyboardResize=e=>{const t=this.activeDrawerEl;if(!t||!this.wideScreen)return;const i=this.drawerWidthAtCapWithMainFloor(),r=e=>void 0!==i?Math.min(e,i):e;switch(e.key){case"ArrowLeft":t.setWidth(r(t.width+30),"keyboard");break;case"ArrowRight":t.setWidth(t.width-30,"keyboard");break;case"Home":t.setWidth(t.minWidth,"keyboard");break;case"End":t.setWidth(r(t.maxWidth),"keyboard");break;default:return}e.preventDefault()}}render(){const e=this.handleInteractive,t=e.tooltip&&!this.isDragging;if(this.dataset.handleMode!==e.cursor){const t=this.dataset.handleMode;this.dataset.handleMode=e.cursor,void 0!==t&&this.dispatchEvent(new S(e.cursor,t))}return r`<div class="${d({"n-aside":!0,"n-dragging":this.isDragging})}" part="aside"><button type="button" class="n-resize" part="resize" role="separator" aria-orientation="vertical" aria-label="Resize drawer" aria-disabled="${e.enabled?"false":"true"}" aria-describedby="${t?this.resizeTooltipId:a}" data-handle-mode="${e.cursor}" tabindex="${e.dragOk?"0":"-1"}" ?hidden="${!this.wideScreen||!this.activeDrawer}" @pointerdown="${this.startDragging}" @pointermove="${this.isDragging?this.handleDrag:this.handleResizeHoverMove}" @pointerleave="${this.handlePointerLeave}" @pointerup="${this.stopDragging}" @keydown="${this.handleKeyboardResize}"></button> ${this.tooltipSlot.hasContent?r`<nord-tooltip id="${this.resizeTooltipId}" position="inline-start" class="n-resize-tooltip"><slot name="tooltip-divider"></slot></nord-tooltip>`:a}<div class="n-aside-rail" part="rail"><slot name="rail" @slotchange="${this.handleRailSlotChange}"></slot></div><div class="n-aside-drawers" part="drawers"><slot></slot></div><div class="n-aside-backdrop" part="backdrop" aria-hidden="true" @click="${this.handleBackdropClick}"></div></div>`}connectedCallback(){super.connectedCallback(),this.applyRailVars(),this.observeChildren(),_.addEventListener("change",this.handleMediaChange),this.addEventListener("width-change",this.handleDrawerWidthChange),this.addEventListener("keydown",this.handleHostKeyDown),window.addEventListener("resize",this.handleViewportResize,{passive:!0}),queueMicrotask((()=>{this.attachLayoutSync(),this.syncNarrowState()}))}disconnectedCallback(){var e;super.disconnectedCallback(),null===(e=this.childObserver)||void 0===e||e.disconnect(),this.childObserver=void 0,_.removeEventListener("change",this.handleMediaChange),this.removeEventListener("width-change",this.handleDrawerWidthChange),this.removeEventListener("keydown",this.handleHostKeyDown),window.removeEventListener("resize",this.handleViewportResize),this.clearNarrowState(),this.detachLayoutSync()}syncNarrowState(){const e=this.hostLayout,t=!this.wideScreen,i=t&&this.hasRailItems,r=t&&!!this.activeDrawer;this.toggleAttribute("data-narrow-rail-bottom",i),this.toggleAttribute("data-narrow-floating-drawer",r),null==e||e.toggleAttribute("data-narrow-rail-bottom",i),null==e||e.toggleAttribute("data-narrow-floating-drawer",r),this.style.removeProperty("--n-aside-rail-narrow-inset-block-end"),r&&!this.holdsBodyScrollLock?(!function(){if("undefined"==typeof document)return;if(w++,w>1)return;g=window.scrollY||window.pageYOffset||0;const e=document.body;b={position:e.style.position,top:e.style.top,insetInlineStart:e.style.insetInlineStart,insetInlineEnd:e.style.insetInlineEnd,inlineSize:e.style.inlineSize,overflow:e.style.overflow},e.style.position="fixed",e.style.top=`-${g}px`,e.style.insetInlineStart="0",e.style.insetInlineEnd="0",e.style.inlineSize="100%",e.style.overflow="hidden"}(),this.holdsBodyScrollLock=!0):!r&&this.holdsBodyScrollLock&&(f(),this.holdsBodyScrollLock=!1),r&&!this.floatingFocusActive?this.enterFloatingFocus():!r&&this.floatingFocusActive&&this.exitFloatingFocus()}enterFloatingFocus(){if("undefined"==typeof document)return;const e=this.activeDrawerEl;if(!e)return;this.floatingFocusActive=!0,this.trappedDrawer=e,e.floating=!0;const t=p(document);this.floatingFocusReturnElement=t instanceof HTMLElement?t:null,document.addEventListener("keydown",this.handleFloatingFocusKeydown,!0),requestAnimationFrame((()=>{const t=this.firstFocusableInDrawer(e);t?t.focus():(e.tabIndex=-1,e.focus())}))}exitFloatingFocus(){this.floatingFocusActive=!1,"undefined"!=typeof document&&document.removeEventListener("keydown",this.handleFloatingFocusKeydown,!0);const e=this.trappedDrawer;e&&(e.floating=!1,"-1"===e.getAttribute("tabindex")&&e.removeAttribute("tabindex")),this.trappedDrawer=null;const t=this.floatingFocusReturnElement;this.floatingFocusReturnElement=null,t&&t.isConnected&&t.focus()}drawerContainsFocus(e,t){return null!=t&&(e===t||e.contains(t))}focusableElementsInDrawer(e){const t=e.querySelectorAll(C);return Array.from(t).filter((e=>this.isFocusable(e)))}firstFocusableInDrawer(e){var t;return null!==(t=this.focusableElementsInDrawer(e)[0])&&void 0!==t?t:null}isFocusable(e){return!e.hasAttribute("disabled")&&("true"!==e.getAttribute("aria-hidden")&&(!(e.tabIndex<0)&&(null!==e.offsetParent||e.getClientRects().length>0)))}clearNarrowState(){const e=this.hostLayout;this.removeAttribute("data-narrow-rail-bottom"),this.removeAttribute("data-narrow-floating-drawer"),null==e||e.removeAttribute("data-narrow-rail-bottom"),null==e||e.removeAttribute("data-narrow-floating-drawer"),this.style.removeProperty("--n-aside-rail-narrow-inset-block-end"),this.holdsBodyScrollLock&&(f(),this.holdsBodyScrollLock=!1),this.floatingFocusActive&&this.exitFloatingFocus()}get hostLayout(){return"drawer"!==this.getAttribute("slot")?null:this.closest("nord-layout")}attachLayoutSync(){const e=this.hostLayout;if(!e)return;this.syncedLayout=e,this.syncLayoutDrawerSize(),e.addEventListener("nav-open-change",this.handleLayoutNavChange),e.addEventListener("nav-resize",this.handleLayoutNavChange);const t=e.querySelector("nord-navigation");t&&"undefined"!=typeof ResizeObserver&&(this.navResizeObserver=new ResizeObserver((()=>this.scheduleLeftCapReconcile())),this.navResizeObserver.observe(t))}detachLayoutSync(){var e;this.syncedLayout&&(this.syncedLayout.removeEventListener("nav-open-change",this.handleLayoutNavChange),this.syncedLayout.removeEventListener("nav-resize",this.handleLayoutNavChange),null===(e=this.navResizeObserver)||void 0===e||e.disconnect(),this.navResizeObserver=void 0,this.syncedLayout=void 0)}syncLayoutDrawerSize(){var e,t;const i=this.hostLayout;if(!i)return;if(!this.wideScreen)return i.style.setProperty("--n-layout-drawer-inline-size","0px"),void i.style.setProperty("--n-layout-drawer-min-inline-size","0px");let r=this.railWidth;if(this.activeDrawer){const i=this.findDrawer(this.activeDrawer),a=null!==(t=null!==(e=null==i?void 0:i.width)&&void 0!==e?e:null==i?void 0:i.defaultWidth)&&void 0!==t?t:0;if(a){const e=i?getComputedStyle(i):null,t=e&&Number.parseFloat(e.marginInlineStart)||0,n=e&&Number.parseFloat(e.marginInlineEnd)||0,s=this.renderRoot.querySelector(".n-aside-drawers");r+=a+t+n+(s&&Number.parseFloat(getComputedStyle(s).marginInlineStart)||0)+this.railGap}}i.style.setProperty("--n-layout-drawer-inline-size",`${r}px`),i.style.setProperty("--n-layout-drawer-min-inline-size",`${this.railWidth}px`)}applyRailVars(){this.style.setProperty("--_n-aside-rail-width",`${this.railWidth}px`),this.style.setProperty("--_n-aside-rail-gap",`${this.railGap}px`),this.syncLayoutDrawerSize()}handleActiveDrawerChange(e,t){if(e!==t){if(t){const i=this.findDrawer(t);if(!i||i.disabled)return void(this.activeDrawer=e);this.lastDrawer=t}this.updateDrawerVisibility(),this.syncLayoutDrawerSize(),this.scheduleLeftCapReconcile(),this.syncNarrowState(),this.dispatchEvent(new k(t,e)),t&&!e?this.dispatchEvent(new D(t)):!t&&e&&this.dispatchEvent(new z(e))}}findDrawer(e){return e?this.querySelector(`:scope > nord-aside-drawer#${CSS.escape(e)}`):null}get activeDrawerEl(){return this.activeDrawer?this.findDrawer(this.activeDrawer):null}updateDrawerVisibility(){this.querySelectorAll(":scope > nord-aside-drawer").forEach((e=>{const t=!!this.activeDrawer&&e.id===this.activeDrawer;e.toggleAttribute("hidden",!t)}))}observeChildren(){this.childObserver=new MutationObserver((e=>{let t=!1,i=!1;for(const r of e){if("childList"===r.type){t=!0,i=!0;continue}if("attributes"!==r.type)continue;const e=r.target;"NORD-ASIDE-DRAWER"===e.tagName&&e.parentElement===this&&("id"===r.attributeName&&r.oldValue&&this.activeDrawer===r.oldValue&&(this.activeDrawer=e.id,this.lastDrawer===r.oldValue&&(this.lastDrawer=e.id)),"fullscreen"!==r.attributeName&&"data-animating-fullscreen"!==r.attributeName||(i=!0),t=!0)}t&&(this.activeDrawer&&!this.findDrawer(this.activeDrawer)?this.activeDrawer="":this.updateDrawerVisibility()),i&&this.syncFullscreenAttr()})),this.childObserver.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["id","disabled","fullscreen","data-animating-fullscreen"],attributeOldValue:!0}),this.updateDrawerVisibility(),this.syncFullscreenAttr()}syncFullscreenAttr(){const e=this.querySelectorAll(":scope > nord-aside-drawer");let t=!1;e.forEach((e=>{(e.hasAttribute("fullscreen")||e.hasAttribute("data-animating-fullscreen"))&&(t=!0)})),this.toggleAttribute("data-fullscreen",t);const i=this.activeDrawerEl;(null==i?void 0:i.hasAttribute("fullscreen"))?this.scheduleLeftCapReconcile():this.clearFullscreenSizeOverride()}getLeftCapViewportX(){const e=this.hostLayout;if(!e)return;const t=e.querySelector("nord-navigation"),i=t?t.getBoundingClientRect().right:0;return"rail"===e.getAttribute("collapse-mode")?Math.max(0,i):Math.max(i,54)}drawerWidthAtCap(e){return this.computeDrawerWidthAtCap(!1,e)}drawerWidthAtCapWithMainFloor(e){return this.computeDrawerWidthAtCap(!0,e)}computeDrawerWidthAtCap(e,t){var i,r;const a=this.getLeftCapViewportX();if(void 0===a)return;const n=null!==(i=null==t?void 0:t.rect)&&void 0!==i?i:this.getBoundingClientRect(),s=null!==(r=null==t?void 0:t.styles)&&void 0!==r?r:getComputedStyle(this),o=e?this.parseLengthVar(s,"--n-layout-main-min-inline-size"):0;return Math.max(0,n.right-this.railWidth-this.railGap-a-o)}parseLengthVar(e,t){return Number.parseFloat(e.getPropertyValue(t))||0}flushFullscreenAvailable(e){const t=this.activeDrawerEl;if(!t)return;const i=this.drawerWidthAtCap(e);if(void 0===i)return void t.style.removeProperty("--_n-aside-drawer-fullscreen-available");const r=e.styles,a=this.parseLengthVar(r,"--n-aside-drawer-border-width");t.style.setProperty("--_n-aside-drawer-fullscreen-available",`${Math.max(0,i-a)}px`)}flushDragCap(e){const t=this.activeDrawerEl;if(!t||t.hasAttribute("fullscreen")||this.isDragging)return;const i=this.drawerWidthAtCapWithMainFloor(e);void 0!==i&&t.width>i&&t.setWidth(i,"attribute")}clearFullscreenSizeOverride(){var e;null===(e=this.activeDrawerEl)||void 0===e||e.style.removeProperty("--_n-aside-drawer-fullscreen-available")}handleHandleClick(){if("none"===this.handleClick)return;if(!!this.activeDrawer)return this.lastDrawer=this.activeDrawer,void(this.activeDrawer="");if("toggle"!==this.handleClick)return;if(this.lastDrawer){const e=this.findDrawer(this.lastDrawer);if(e&&!e.disabled)return void(this.activeDrawer=this.lastDrawer)}const e=this.findFirstTriggerDrawer();e&&(this.activeDrawer=e)}findFirstTriggerDrawer(){const e=this.querySelectorAll("nord-aside-trigger[drawer]");for(const t of e){const e=t.getAttribute("drawer");if(!e)continue;const i=this.findDrawer(e);if(i&&!i.disabled)return e;0}return null}get handleInteractive(){if(!this.wideScreen)return{enabled:!1,dragOk:!1,clickOk:!1,cursor:"default",tooltip:!1};const e=this.activeDrawerEl,t=!!e,i=t&&!e.isPinned&&!e.fullscreen;let r;switch(this.handleClick){case"toggle":r=!0;break;case"close":r=t;break;default:r=!1}const a=i||r;let n;n=i?"col-resize":r?"pointer":"default";return{enabled:a,dragOk:i,clickOk:r,cursor:n,tooltip:a&&this.tooltipSlot.hasContent}}};L.styles=[v,y],e([n({reflect:!0,attribute:"active-drawer"})],L.prototype,"activeDrawer",void 0),e([n({reflect:!0,type:Number,attribute:"rail-width"})],L.prototype,"railWidth",void 0),e([n({reflect:!0,type:Number,attribute:"rail-gap"})],L.prototype,"railGap",void 0),e([n({reflect:!0,attribute:"handle-click"})],L.prototype,"handleClick",void 0),e([s()],L.prototype,"lastDrawer",void 0),e([s()],L.prototype,"isDragging",void 0),e([s()],L.prototype,"wideScreen",void 0),e([s()],L.prototype,"hasRailItems",void 0),e([o(".n-resize")],L.prototype,"handleEl",void 0),e([o(".n-resize-tooltip")],L.prototype,"resizeTooltipEl",void 0),e([h("railWidth"),h("railGap")],L.prototype,"applyRailVars",null),e([h("activeDrawer")],L.prototype,"handleActiveDrawerChange",null),L=e([l("nord-aside")],L);var E=L;export{k as AsideActiveDrawerChangeEvent,z as AsideDrawerCloseEvent,D as AsideDrawerOpenEvent,x as AsideDrawerResizeEvent,S as AsideHandleModeChangeEvent,E as default};
|
|
1
|
+
import{_ as e}from"./tslib.es6-CmLYFWVC.js";import{css as t,LitElement as i,html as r,nothing as a}from"lit";import{property as n,state as s,query as o,customElement as l}from"lit/decorators.js";import{classMap as d}from"lit/directives/class-map.js";import{S as c}from"./SlotController-Z6eG7LSZ.js";import{o as h}from"./observe-D0n0zOfU.js";import{N as u}from"./events-Bv6wNHwJ.js";import{g as p}from"./focus-D8oSvIcN.js";import{s as v}from"./Component-BJ5O5n8k.js";import"./Tooltip.js";import"./EventController-BBOmvfLa.js";import"./positioning-D-K8Mueq.js";import"./fsm-Bq5jMQrK.js";let w=0,g=0,b=null;function f(){if("undefined"==typeof document)return;if(0===w)return;if(w--,w>0)return;const e=document.body;b&&(e.style.position=b.position,e.style.top=b.top,e.style.insetInlineStart=b.insetInlineStart,e.style.insetInlineEnd=b.insetInlineEnd,e.style.inlineSize=b.inlineSize,e.style.overflow=b.overflow,b=null),window.scrollTo(0,g)}const y=t`:host{--_n-aside-rail-width:var(--n-aside-rail-width,48px);--_n-aside-rail-gap:var(--n-aside-rail-gap,0);--_n-aside-rail-padding-inline:var(--n-aside-rail-padding-inline,8px);--_n-aside-rail-padding-block:var(--n-aside-rail-padding-block,8px);--_n-aside-rail-border-color:var(--n-aside-rail-border-color,var(--n-color-border));--_n-aside-rail-border-width:var(--n-aside-rail-border-width,1px);--_n-aside-rail-box-shadow:var(--n-aside-rail-box-shadow,none);--_n-aside-rail-background-color:var(--n-aside-rail-background-color,var(--n-color-surface));--_n-aside-background-color:var(--n-aside-background-color,var(--n-color-background));--_n-aside-drawers-margin-inline-start:var(--n-aside-drawers-margin-inline-start,0px);--_n-aside-resize-block-size:var(--n-aside-resize-block-size,100%);--_n-aside-resize-color:var(--n-aside-resize-color,var(--n-layout-resize-color,var(--n-color-accent)));--_n-aside-z-index:var(--n-aside-z-index,var(--n-index-nav));--_n-aside-z-index-fullscreen:var(--n-aside-z-index-fullscreen,var(--n-index-top-bar,1000));--_n-aside-rail-narrow-block-size:var(--n-aside-rail-narrow-block-size,56px);--_n-aside-rail-narrow-padding-inline:var(--n-aside-rail-narrow-padding-inline,var(--n-space-m,16px));--_n-aside-rail-narrow-padding-block:var(--n-aside-rail-narrow-padding-block,var(--n-space-s,8px));--_n-aside-rail-narrow-border-block-start-width:var(--n-aside-rail-narrow-border-block-start-width,1px);--_n-aside-rail-narrow-border-color:var(--n-aside-rail-narrow-border-color,var(--_n-aside-rail-border-color));--_n-aside-drawer-floating-inset-block-start:var(
|
|
2
|
+
--n-aside-drawer-floating-inset-block-start,var(--n-layout-header-block-size,60px)
|
|
3
|
+
);--_n-aside-drawer-floating-inset-inline:var(--n-aside-drawer-floating-inset-inline,0px);--_n-aside-drawer-floating-bottom-offset:var(--n-aside-drawer-floating-bottom-offset,0px);--_n-aside-drawer-floating-inset-block-end:var(
|
|
4
|
+
--n-aside-drawer-floating-inset-block-end,calc(var(--_n-aside-rail-narrow-block-size) - var(--_n-aside-drawer-floating-bottom-offset))
|
|
5
|
+
);--_n-aside-backdrop-background:var(--n-aside-backdrop-background,var(--n-color-overlay));--_n-aside-drawer-slide-duration:var(--n-aside-drawer-slide-duration,300ms);--_n-aside-drawer-slide-easing:var(--n-aside-drawer-slide-easing,cubic-bezier(0.4,0,0.2,1));--_n-aside-z-backdrop:var(--n-aside-z-backdrop,calc(var(--n-index-top-bar, 1000) + 2));--_n-aside-z-drawer-floating:var(--n-aside-z-drawer-floating,calc(var(--n-index-top-bar, 1000) + 3));--_n-aside-z-rail-narrow:var(--n-aside-z-rail-narrow,calc(var(--n-index-top-bar, 1000) + 4));align-self:stretch;background:var(--_n-aside-background-color);block-size:100%;display:flex;min-block-size:100%;position:relative}.n-aside{align-items:stretch;flex:1;flex-direction:row;gap:var(--_n-aside-rail-gap)}.n-aside,.n-aside-rail{block-size:100%;display:flex;position:relative}.n-aside-rail{align-items:center;background:var(--_n-aside-rail-background-color);border-inline-start:var(--_n-aside-rail-border-width) solid var(--_n-aside-rail-border-color);box-shadow:var(--_n-aside-rail-box-shadow);box-sizing:border-box;flex:0 0 auto;flex-direction:column;inline-size:var(--_n-aside-rail-width);margin-inline-start:auto;order:99;padding-block-end:var(--_n-aside-rail-padding-block);padding-block-start:var(--_n-aside-rail-padding-block);padding-inline-end:var(--_n-aside-rail-padding-inline);padding-inline-start:var(--_n-aside-rail-padding-inline);z-index:calc(var(--_n-aside-z-index) + 1)}:host([data-fullscreen]) .n-aside-rail{z-index:calc(var(--_n-aside-z-index-fullscreen) + 1)}.n-aside-rail ::slotted(*){display:block}.n-aside-drawers{display:flex;flex:0 0 auto;margin-inline-start:var(--_n-aside-drawers-margin-inline-start)}:host(:is([active-drawer=""],:not([active-drawer]))) .n-aside-drawers{display:contents}.n-resize{background:#0000;block-size:var(--_n-aside-resize-block-size);border:0;inline-size:10px;inset-block:0;inset-inline-start:calc(var(--_n-aside-drawers-margin-inline-start) - 4px);margin-block:auto;padding:0;position:absolute;touch-action:none;user-select:none;z-index:calc(var(--n-index-nav) + 1)}.n-resize[data-handle-mode=col-resize]{cursor:col-resize}.n-resize[data-handle-mode=pointer]{cursor:pointer}.n-resize[data-handle-mode=default]{cursor:default}.n-resize:after{background:var(--_n-aside-resize-color);content:"";inline-size:3px;inset-block:0;inset-inline:0;margin-inline:auto;opacity:0;position:absolute;transition:opacity var(--n-transition-slowly)}.n-resize:not([data-handle-mode=default]):focus-visible:after,.n-resize:not([data-handle-mode=default]):hover:after{opacity:1;transition-delay:.15s}.n-aside.n-dragging .n-resize:after{opacity:1}.n-resize:focus{outline:none}.n-resize[aria-disabled=true]:after{display:none}@media (max-width:767px){.n-resize{display:none}}.n-aside.n-dragging{cursor:col-resize;user-select:none}.n-resize-tooltip{transform:translateY(var(--n-resize-tooltip-y,0))}.n-aside.n-dragging .n-resize-tooltip{opacity:0!important;visibility:hidden!important}.n-aside-backdrop{display:none}:host([data-narrow-floating-drawer]) .n-aside-backdrop{background:var(--_n-aside-backdrop-background);display:block;inset-block-end:var(--_n-aside-rail-narrow-block-size);inset-block-start:0;inset-inline-end:0;inset-inline-start:0;pointer-events:auto;position:fixed;z-index:var(--_n-aside-z-backdrop)}:host([data-narrow-floating-drawer]:not([data-narrow-rail-bottom])) .n-aside-backdrop{inset-block-end:0}@media (max-width:767px){:host([data-narrow-floating-drawer]) .n-aside,:host([data-narrow-rail-bottom]) .n-aside{display:contents}:host([data-narrow-rail-bottom]) .n-aside-rail{align-items:center;block-size:var(--_n-aside-rail-narrow-block-size);border-block-start:var(--_n-aside-rail-narrow-border-block-start-width) solid var(--_n-aside-rail-narrow-border-color);border-inline-start:0;flex-direction:row;inline-size:auto;inset-block-end:var(--n-aside-rail-narrow-inset-block-end,0);inset-inline-end:0;inset-inline-start:0;justify-content:flex-start;margin-inline-start:0;overflow-x:auto;overflow-y:hidden;padding-block-end:var(--_n-aside-rail-narrow-padding-block);padding-block-start:var(--_n-aside-rail-narrow-padding-block);padding-inline-end:var(--_n-aside-rail-narrow-padding-inline);padding-inline-start:var(--_n-aside-rail-narrow-padding-inline);pointer-events:auto;position:fixed;scroll-snap-type:x mandatory;scrollbar-width:none;z-index:var(--_n-aside-z-rail-narrow)}:host([data-narrow-rail-bottom]) .n-aside-rail::-webkit-scrollbar{display:none}:host([data-narrow-rail-bottom]) .n-aside-rail ::slotted(*){flex:0 0 auto;inline-size:auto;scroll-snap-align:start}:host([data-narrow-floating-drawer]) .n-aside-drawers{animation:n-aside-drawer-slide-up var(--_n-aside-drawer-slide-duration) var(--_n-aside-drawer-slide-easing);block-size:calc(100vh - var(--_n-aside-drawer-floating-inset-block-start) - var(--_n-aside-drawer-floating-inset-block-end));inline-size:calc(100vw - var(--_n-aside-drawer-floating-inset-inline)*2);inset-block-start:var(--_n-aside-drawer-floating-inset-block-start);inset-inline-start:var(--_n-aside-drawer-floating-inset-inline);margin-inline-start:0;overscroll-behavior:contain;pointer-events:auto;position:fixed;z-index:var(--_n-aside-z-drawer-floating)}@keyframes n-aside-drawer-slide-up{0%{transform:translateY(100%)}to{transform:translateY(0)}}:host([data-narrow-floating-drawer]) ::slotted(nord-aside-drawer){block-size:100%;inline-size:100%!important;margin-block:0;margin-inline:0;max-inline-size:100%!important;min-inline-size:0!important}:host([data-narrow-floating-drawer]) ::slotted(nord-aside-drawer nord-drawer){border-radius:var(--n-border-radius);box-shadow:var(--n-box-shadow-popout)}:host(:not([data-narrow-floating-drawer])) .n-aside-drawers{pointer-events:none}}`;let m=0;class k extends u{constructor(e,t){super("active-drawer-change"),Object.defineProperties(this,{activeDrawer:{value:e,enumerable:!0,writable:!1},previousDrawer:{value:t,enumerable:!0,writable:!1}})}}class D extends u{constructor(e){super("drawer-open"),Object.defineProperty(this,"activeDrawer",{value:e,enumerable:!0,writable:!1})}}class z extends u{constructor(e){super("drawer-close"),Object.defineProperty(this,"previousDrawer",{value:e,enumerable:!0,writable:!1})}}class x extends u{constructor(e,t){super("drawer-resize"),Object.defineProperties(this,{drawerId:{value:e,enumerable:!0,writable:!1},width:{value:t,enumerable:!0,writable:!1}})}}class S extends u{constructor(e,t){super("handle-mode-change"),Object.defineProperties(this,{mode:{value:e,enumerable:!0,writable:!1},previous:{value:t,enumerable:!0,writable:!1}})}}const C=["a[href]","button","input","select","textarea","[tabindex]","audio[controls]","video[controls]",'[contenteditable]:not([contenteditable="false"])',"details > summary:first-of-type"].join(","),_="undefined"!=typeof matchMedia?matchMedia("(min-width: 768px)"):{matches:!1,addEventListener(){},removeEventListener(){}};new WeakSet;let L=class extends i{constructor(){super(...arguments),this.activeDrawer="",this.railWidth=48,this.railGap=0,this.handleClick="toggle",this.lastDrawer="",this.isDragging=!1,this.wideScreen=_.matches,this.hasRailItems=!1,this.tooltipSlot=new c(this,"tooltip-divider"),this.resizeTooltipId="n-aside-resize-tip-"+ ++m,this.dragStartX=0,this.hasDragged=!1,this.handleRailSlotChange=e=>{const t=e.target.assignedElements({flatten:!0}).length>0;t!==this.hasRailItems&&(this.hasRailItems=t,this.syncNarrowState())},this.handleBackdropClick=()=>{this.activeDrawer&&(this.lastDrawer=this.activeDrawer,this.activeDrawer="")},this.handleMediaChange=e=>{this.wideScreen=e.matches,this.syncNarrowState(),this.syncLayoutDrawerSize()},this.handleHostKeyDown=e=>{"Escape"===e.key&&(this.wideScreen||this.activeDrawer&&(e.defaultPrevented||(this.lastDrawer=this.activeDrawer,this.activeDrawer="",e.stopPropagation())))},this.holdsBodyScrollLock=!1,this.floatingFocusActive=!1,this.floatingFocusReturnElement=null,this.trappedDrawer=null,this.handleFloatingFocusKeydown=e=>{if("Tab"!==e.key)return;const t=this.trappedDrawer;if(!t)return;const i=this.focusableElementsInDrawer(t);if(0===i.length)return e.preventDefault(),t.tabIndex=-1,void t.focus();const r=i[0],a=i[i.length-1],n=p(document);e.shiftKey?n!==r&&this.drawerContainsFocus(t,n)||(e.preventDefault(),a.focus()):n!==a&&this.drawerContainsFocus(t,n)||(e.preventDefault(),r.focus())},this.handleDrawerWidthChange=e=>{const t=e,i=e.target;i instanceof HTMLElement&&"NORD-ASIDE-DRAWER"===i.tagName&&(this.dispatchEvent(new x(i.id,t.width)),this.syncLayoutDrawerSize())},this.startDragging=e=>{if(0!==e.button||!this.wideScreen)return;const t=e.currentTarget;try{t.setPointerCapture(e.pointerId)}catch(e){}this.isDragging=!0,this.dragStartX=e.clientX,this.hasDragged=!1,this.dragGeometry={rect:this.getBoundingClientRect(),styles:getComputedStyle(this)}},this.stopDragging=e=>{if(!this.isDragging)return;const t=!this.hasDragged;if(this.isDragging=!1,this.hasDragged=!1,this.dragGeometry=void 0,e){const t=e.currentTarget;try{t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId)}catch(e){}}t&&this.handleHandleClick()},this.handlePointerLeave=e=>{var t;this.isDragging&&this.stopDragging(e),null===(t=this.resizeTooltipEl)||void 0===t||t.style.removeProperty("--n-resize-tooltip-y")},this.handleResizeHoverMove=e=>{const t=e.currentTarget;if(!t||!this.resizeTooltipEl)return;const i=t.getBoundingClientRect(),r=e.clientY-(i.top+i.height/2);this.resizeTooltipEl.style.setProperty("--n-resize-tooltip-y",`${r}px`)},this.handleDrag=e=>{var t;if(!this.activeDrawerEl)return void(Math.abs(e.clientX-this.dragStartX)>=4&&(this.hasDragged=!0));if(!this.hasDragged&&Math.abs(e.clientX-this.dragStartX)<4)return;this.hasDragged=!0;const i=this.activeDrawerEl;if(i.isPinned)return;const r=null!==(t=this.dragGeometry)&&void 0!==t?t:{rect:this.getBoundingClientRect(),styles:getComputedStyle(this)},a=r.rect.right-e.clientX-this.railWidth-this.railGap,n=this.drawerWidthAtCapWithMainFloor(r),s=void 0!==n?Math.min(a,n):a;i.setWidth(s,"drag")},this.scheduleLeftCapReconcile=()=>{this.leftCapReconcileScheduled||(this.leftCapReconcileScheduled=!0,requestAnimationFrame((()=>{this.leftCapReconcileScheduled=!1;const e={rect:this.getBoundingClientRect(),styles:getComputedStyle(this)};this.flushFullscreenAvailable(e),this.flushDragCap(e)})))},this.leftCapReconcileScheduled=!1,this.handleLayoutNavChange=()=>{this.scheduleLeftCapReconcile()},this.handleViewportResize=()=>{this.scheduleLeftCapReconcile()},this.handleKeyboardResize=e=>{const t=this.activeDrawerEl;if(!t||!this.wideScreen)return;const i=this.drawerWidthAtCapWithMainFloor(),r=e=>void 0!==i?Math.min(e,i):e;switch(e.key){case"ArrowLeft":t.setWidth(r(t.width+30),"keyboard");break;case"ArrowRight":t.setWidth(t.width-30,"keyboard");break;case"Home":t.setWidth(t.minWidth,"keyboard");break;case"End":t.setWidth(r(t.maxWidth),"keyboard");break;default:return}e.preventDefault()}}render(){const e=this.handleInteractive,t=e.tooltip&&!this.isDragging;if(this.dataset.handleMode!==e.cursor){const t=this.dataset.handleMode;this.dataset.handleMode=e.cursor,void 0!==t&&this.dispatchEvent(new S(e.cursor,t))}return r`<div class="${d({"n-aside":!0,"n-dragging":this.isDragging})}" part="aside"><button type="button" class="n-resize" part="resize" role="separator" aria-orientation="vertical" aria-label="Resize drawer" aria-disabled="${e.enabled?"false":"true"}" aria-describedby="${t?this.resizeTooltipId:a}" data-handle-mode="${e.cursor}" tabindex="${e.dragOk?"0":"-1"}" ?hidden="${!this.wideScreen||!this.activeDrawer}" @pointerdown="${this.startDragging}" @pointermove="${this.isDragging?this.handleDrag:this.handleResizeHoverMove}" @pointerleave="${this.handlePointerLeave}" @pointerup="${this.stopDragging}" @keydown="${this.handleKeyboardResize}"></button> ${this.tooltipSlot.hasContent?r`<nord-tooltip id="${this.resizeTooltipId}" position="inline-start" class="n-resize-tooltip"><slot name="tooltip-divider"></slot></nord-tooltip>`:a}<div class="n-aside-rail" part="rail"><slot name="rail" @slotchange="${this.handleRailSlotChange}"></slot></div><div class="n-aside-drawers" part="drawers"><slot></slot></div><div class="n-aside-backdrop" part="backdrop" aria-hidden="true" @click="${this.handleBackdropClick}"></div></div>`}connectedCallback(){super.connectedCallback(),this.applyRailVars(),this.observeChildren(),_.addEventListener("change",this.handleMediaChange),this.addEventListener("width-change",this.handleDrawerWidthChange),this.addEventListener("keydown",this.handleHostKeyDown),window.addEventListener("resize",this.handleViewportResize,{passive:!0}),queueMicrotask((()=>{this.attachLayoutSync(),this.syncNarrowState()}))}disconnectedCallback(){var e;super.disconnectedCallback(),null===(e=this.childObserver)||void 0===e||e.disconnect(),this.childObserver=void 0,_.removeEventListener("change",this.handleMediaChange),this.removeEventListener("width-change",this.handleDrawerWidthChange),this.removeEventListener("keydown",this.handleHostKeyDown),window.removeEventListener("resize",this.handleViewportResize),this.clearNarrowState(),this.detachLayoutSync()}syncNarrowState(){const e=this.hostLayout,t=!this.wideScreen,i=t&&this.hasRailItems,r=t&&!!this.activeDrawer;this.toggleAttribute("data-narrow-rail-bottom",i),this.toggleAttribute("data-narrow-floating-drawer",r),null==e||e.toggleAttribute("data-narrow-rail-bottom",i),null==e||e.toggleAttribute("data-narrow-floating-drawer",r),this.style.removeProperty("--n-aside-rail-narrow-inset-block-end"),r&&!this.holdsBodyScrollLock?(!function(){if("undefined"==typeof document)return;if(w++,w>1)return;g=window.scrollY||window.pageYOffset||0;const e=document.body;b={position:e.style.position,top:e.style.top,insetInlineStart:e.style.insetInlineStart,insetInlineEnd:e.style.insetInlineEnd,inlineSize:e.style.inlineSize,overflow:e.style.overflow},e.style.position="fixed",e.style.top=`-${g}px`,e.style.insetInlineStart="0",e.style.insetInlineEnd="0",e.style.inlineSize="100%",e.style.overflow="hidden"}(),this.holdsBodyScrollLock=!0):!r&&this.holdsBodyScrollLock&&(f(),this.holdsBodyScrollLock=!1),r&&!this.floatingFocusActive?this.enterFloatingFocus():!r&&this.floatingFocusActive&&this.exitFloatingFocus()}enterFloatingFocus(){if("undefined"==typeof document)return;const e=this.activeDrawerEl;if(!e)return;this.floatingFocusActive=!0,this.trappedDrawer=e,e.floating=!0;const t=p(document);this.floatingFocusReturnElement=t instanceof HTMLElement?t:null,document.addEventListener("keydown",this.handleFloatingFocusKeydown,!0),requestAnimationFrame((()=>{const t=this.firstFocusableInDrawer(e);t?t.focus():(e.tabIndex=-1,e.focus())}))}exitFloatingFocus(){this.floatingFocusActive=!1,"undefined"!=typeof document&&document.removeEventListener("keydown",this.handleFloatingFocusKeydown,!0);const e=this.trappedDrawer;e&&(e.floating=!1,"-1"===e.getAttribute("tabindex")&&e.removeAttribute("tabindex")),this.trappedDrawer=null;const t=this.floatingFocusReturnElement;this.floatingFocusReturnElement=null,t&&t.isConnected&&t.focus()}drawerContainsFocus(e,t){return null!=t&&(e===t||e.contains(t))}focusableElementsInDrawer(e){const t=e.querySelectorAll(C);return Array.from(t).filter((e=>this.isFocusable(e)))}firstFocusableInDrawer(e){var t;return null!==(t=this.focusableElementsInDrawer(e)[0])&&void 0!==t?t:null}isFocusable(e){return!e.hasAttribute("disabled")&&("true"!==e.getAttribute("aria-hidden")&&(!(e.tabIndex<0)&&(null!==e.offsetParent||e.getClientRects().length>0)))}clearNarrowState(){const e=this.hostLayout;this.removeAttribute("data-narrow-rail-bottom"),this.removeAttribute("data-narrow-floating-drawer"),null==e||e.removeAttribute("data-narrow-rail-bottom"),null==e||e.removeAttribute("data-narrow-floating-drawer"),this.style.removeProperty("--n-aside-rail-narrow-inset-block-end"),this.holdsBodyScrollLock&&(f(),this.holdsBodyScrollLock=!1),this.floatingFocusActive&&this.exitFloatingFocus()}get hostLayout(){return"drawer"!==this.getAttribute("slot")?null:this.closest("nord-layout")}attachLayoutSync(){const e=this.hostLayout;if(!e)return;this.syncedLayout=e,this.syncLayoutDrawerSize(),e.addEventListener("nav-open-change",this.handleLayoutNavChange),e.addEventListener("nav-resize",this.handleLayoutNavChange);const t=e.querySelector("nord-navigation");t&&"undefined"!=typeof ResizeObserver&&(this.navResizeObserver=new ResizeObserver((()=>this.scheduleLeftCapReconcile())),this.navResizeObserver.observe(t))}detachLayoutSync(){var e;this.syncedLayout&&(this.syncedLayout.removeEventListener("nav-open-change",this.handleLayoutNavChange),this.syncedLayout.removeEventListener("nav-resize",this.handleLayoutNavChange),null===(e=this.navResizeObserver)||void 0===e||e.disconnect(),this.navResizeObserver=void 0,this.syncedLayout=void 0)}syncLayoutDrawerSize(){var e,t;const i=this.hostLayout;if(!i)return;if(!this.wideScreen)return i.style.setProperty("--n-layout-drawer-inline-size","0px"),void i.style.setProperty("--n-layout-drawer-min-inline-size","0px");let r=this.railWidth;if(this.activeDrawer){const i=this.findDrawer(this.activeDrawer),a=null!==(t=null!==(e=null==i?void 0:i.width)&&void 0!==e?e:null==i?void 0:i.defaultWidth)&&void 0!==t?t:0;if(a){const e=i?getComputedStyle(i):null,t=e&&Number.parseFloat(e.marginInlineStart)||0,n=e&&Number.parseFloat(e.marginInlineEnd)||0,s=this.renderRoot.querySelector(".n-aside-drawers");r+=a+t+n+(s&&Number.parseFloat(getComputedStyle(s).marginInlineStart)||0)+this.railGap}}i.style.setProperty("--n-layout-drawer-inline-size",`${r}px`),i.style.setProperty("--n-layout-drawer-min-inline-size",`${this.railWidth}px`)}applyRailVars(){this.style.setProperty("--_n-aside-rail-width",`${this.railWidth}px`),this.style.setProperty("--_n-aside-rail-gap",`${this.railGap}px`),this.syncLayoutDrawerSize()}handleActiveDrawerChange(e,t){if(e!==t){if(t){const i=this.findDrawer(t);if(!i||i.disabled)return void(this.activeDrawer=e);this.lastDrawer=t}this.updateDrawerVisibility(),this.syncLayoutDrawerSize(),this.scheduleLeftCapReconcile(),this.syncNarrowState(),this.dispatchEvent(new k(t,e)),t&&!e?this.dispatchEvent(new D(t)):!t&&e&&this.dispatchEvent(new z(e))}}findDrawer(e){return e?this.querySelector(`:scope > nord-aside-drawer#${CSS.escape(e)}`):null}get activeDrawerEl(){return this.activeDrawer?this.findDrawer(this.activeDrawer):null}updateDrawerVisibility(){this.querySelectorAll(":scope > nord-aside-drawer").forEach((e=>{const t=!!this.activeDrawer&&e.id===this.activeDrawer;e.toggleAttribute("hidden",!t)}))}observeChildren(){this.childObserver=new MutationObserver((e=>{let t=!1,i=!1;for(const r of e){if("childList"===r.type){t=!0,i=!0;continue}if("attributes"!==r.type)continue;const e=r.target;"NORD-ASIDE-DRAWER"===e.tagName&&e.parentElement===this&&("id"===r.attributeName&&r.oldValue&&this.activeDrawer===r.oldValue&&(this.activeDrawer=e.id,this.lastDrawer===r.oldValue&&(this.lastDrawer=e.id)),"fullscreen"!==r.attributeName&&"data-animating-fullscreen"!==r.attributeName||(i=!0),t=!0)}t&&(this.activeDrawer&&!this.findDrawer(this.activeDrawer)?this.activeDrawer="":this.updateDrawerVisibility()),i&&this.syncFullscreenAttr()})),this.childObserver.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["id","disabled","fullscreen","data-animating-fullscreen"],attributeOldValue:!0}),this.updateDrawerVisibility(),this.syncFullscreenAttr()}syncFullscreenAttr(){const e=this.querySelectorAll(":scope > nord-aside-drawer");let t=!1;e.forEach((e=>{(e.hasAttribute("fullscreen")||e.hasAttribute("data-animating-fullscreen"))&&(t=!0)})),this.toggleAttribute("data-fullscreen",t);const i=this.activeDrawerEl;(null==i?void 0:i.hasAttribute("fullscreen"))?this.scheduleLeftCapReconcile():this.clearFullscreenSizeOverride()}getLeftCapViewportX(){const e=this.hostLayout;if(!e)return;const t=e.querySelector("nord-navigation"),i=t?t.getBoundingClientRect().right:0;return"rail"===e.getAttribute("collapse-mode")?Math.max(0,i):Math.max(i,54)}drawerWidthAtCap(e){return this.computeDrawerWidthAtCap(!1,e)}drawerWidthAtCapWithMainFloor(e){return this.computeDrawerWidthAtCap(!0,e)}computeDrawerWidthAtCap(e,t){var i,r;const a=this.getLeftCapViewportX();if(void 0===a)return;const n=null!==(i=null==t?void 0:t.rect)&&void 0!==i?i:this.getBoundingClientRect(),s=null!==(r=null==t?void 0:t.styles)&&void 0!==r?r:getComputedStyle(this),o=e?this.parseLengthVar(s,"--n-layout-main-min-inline-size"):0;return Math.max(0,n.right-this.railWidth-this.railGap-a-o)}parseLengthVar(e,t){return Number.parseFloat(e.getPropertyValue(t))||0}flushFullscreenAvailable(e){const t=this.activeDrawerEl;if(!t)return;const i=this.drawerWidthAtCap(e);if(void 0===i)return void t.style.removeProperty("--_n-aside-drawer-fullscreen-available");const r=e.styles,a=this.parseLengthVar(r,"--n-aside-drawer-border-width");t.style.setProperty("--_n-aside-drawer-fullscreen-available",`${Math.max(0,i-a)}px`)}flushDragCap(e){const t=this.activeDrawerEl;if(!t||t.hasAttribute("fullscreen")||this.isDragging)return;const i=this.drawerWidthAtCapWithMainFloor(e);void 0!==i&&t.width>i&&t.setWidth(i,"attribute")}clearFullscreenSizeOverride(){var e;null===(e=this.activeDrawerEl)||void 0===e||e.style.removeProperty("--_n-aside-drawer-fullscreen-available")}handleHandleClick(){if("none"===this.handleClick)return;if(!!this.activeDrawer)return this.lastDrawer=this.activeDrawer,void(this.activeDrawer="");if("toggle"!==this.handleClick)return;if(this.lastDrawer){const e=this.findDrawer(this.lastDrawer);if(e&&!e.disabled)return void(this.activeDrawer=this.lastDrawer)}const e=this.findFirstTriggerDrawer();e&&(this.activeDrawer=e)}findFirstTriggerDrawer(){const e=this.querySelectorAll("nord-aside-trigger[drawer]");for(const t of e){const e=t.getAttribute("drawer");if(!e)continue;const i=this.findDrawer(e);if(i&&!i.disabled)return e;0}return null}get handleInteractive(){if(!this.wideScreen)return{enabled:!1,dragOk:!1,clickOk:!1,cursor:"default",tooltip:!1};const e=this.activeDrawerEl,t=!!e,i=t&&!e.isPinned&&!e.fullscreen;let r;switch(this.handleClick){case"toggle":r=!0;break;case"close":r=t;break;default:r=!1}const a=i||r;let n;n=i?"col-resize":r?"pointer":"default";return{enabled:a,dragOk:i,clickOk:r,cursor:n,tooltip:a&&this.tooltipSlot.hasContent}}};L.styles=[v,y],e([n({reflect:!0,attribute:"active-drawer"})],L.prototype,"activeDrawer",void 0),e([n({reflect:!0,type:Number,attribute:"rail-width"})],L.prototype,"railWidth",void 0),e([n({reflect:!0,type:Number,attribute:"rail-gap"})],L.prototype,"railGap",void 0),e([n({reflect:!0,attribute:"handle-click"})],L.prototype,"handleClick",void 0),e([s()],L.prototype,"lastDrawer",void 0),e([s()],L.prototype,"isDragging",void 0),e([s()],L.prototype,"wideScreen",void 0),e([s()],L.prototype,"hasRailItems",void 0),e([o(".n-resize")],L.prototype,"handleEl",void 0),e([o(".n-resize-tooltip")],L.prototype,"resizeTooltipEl",void 0),e([h("railWidth"),h("railGap")],L.prototype,"applyRailVars",null),e([h("activeDrawer")],L.prototype,"handleActiveDrawerChange",null),L=e([l("nord-aside")],L);var E=L;export{k as AsideActiveDrawerChangeEvent,z as AsideDrawerCloseEvent,D as AsideDrawerOpenEvent,x as AsideDrawerResizeEvent,S as AsideHandleModeChangeEvent,E as default};
|
|
8
6
|
//# sourceMappingURL=Aside.js.map
|