@nordhealth/components 4.26.1 → 5.0.0-alpha.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 +54613 -21826
- 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-C1SxrlzN.js +2 -0
- package/lib/Calendar-C1SxrlzN.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-By4h1Sp-.js +2 -0
- package/lib/Combobox-By4h1Sp-.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/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/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-DpN7PP9h.js +2 -0
- package/lib/Popout-DpN7PP9h.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/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/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/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/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 +505 -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 +47 -0
- package/lib/src/aside-drawer/AsideDrawer.d.ts +2 -0
- 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/badge/Badge.d.ts +1 -1
- package/lib/src/banner/Banner.d.ts +3 -0
- package/lib/src/button-group/ButtonGroup.d.ts +2 -1
- package/lib/src/calendar/Calendar.d.ts +44 -0
- package/lib/src/calendar/DateRangeSelectEvent.d.ts +16 -0
- 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/command-menu/ICommandMenuAction.d.ts +11 -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/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/FloatingComponentMixin.d.ts +2 -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/drawer/Drawer.d.ts +7 -0
- 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/index.d.ts +59 -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 +2 -2
- package/lib/src/localization/en-us.d.ts +85 -0
- package/lib/src/localization/translation.d.ts +85 -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 +177 -0
- package/lib/src/otp-field/OtpFieldEvents.d.ts +38 -0
- package/lib/src/otp-field/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 +11 -2
- package/lib/src/scroll-area/ScrollArea.d.ts +101 -0
- package/lib/src/segmented-control-item/SegmentedControlItem.d.ts +2 -0
- 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-group/TagGroup.d.ts +2 -0
- package/lib/src/textarea/Textarea.d.ts +2 -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/tooltip/Tooltip.d.ts +12 -0
- package/lib/src/truncate/Truncate.d.ts +12 -0
- package/lib/story-descriptions.js +2 -0
- package/lib/story-descriptions.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 +407 -0
- package/package.json +9 -12
- 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-DtEL0HZ0.js +0 -2
- package/lib/Popout-DtEL0HZ0.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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropdownSubmenu.js","sources":["../src/dropdown-submenu/DropdownSubmenu.ts"],"sourcesContent":["import type Dropdown from '../dropdown/Dropdown.js'\nimport type Popout from '../popout/Popout.js'\nimport { html, LitElement } from 'lit'\nimport { customElement, query, state } from 'lit/decorators.js'\nimport { classMap } from 'lit/directives/class-map.js'\nimport { EventController } from '../common/controllers/EventController.js'\nimport componentStyle from '../common/styles/Component.css'\nimport style from './DropdownSubmenu.css'\nimport '../popout/Popout.js'\n\nlet popoutCounter = 0\n\n/**\n * Dropdown submenu nests a secondary menu within a parent dropdown.\n *\n * @status ready\n * @category action\n *\n * @slot trigger - The element that opens the submenu (typically nord-dropdown-item).\n * @slot - The submenu content items.\n *\n * @fires {NordEvent} open - Forwarded from the internal nord-popout.\n * @fires {NordEvent} close - Forwarded from the internal nord-popout.\n * @fires {CustomEvent} nord-submenu-navigate - Fired when mobile stack navigation activates this submenu.\n */\n@customElement('nord-dropdown-submenu')\nexport default class DropdownSubmenu extends LitElement {\n static styles = [componentStyle, style]\n\n @query('nord-popout')\n private popout?: Popout\n\n /** @internal */\n @state() private mobileActive = false\n\n private readonly popoutId = `nord-dropdown-submenu-popout-${++popoutCounter}`\n private events = new EventController(this)\n private currentTriggerElement: HTMLElement | null = null\n private popoutOpen = false\n private readonly mobileMediaQuery = window.matchMedia('(max-width: 35.9375em)')\n @state() private isSmallScreen = this.mobileMediaQuery.matches\n @state() private parentDropdownAlwaysFloating = false\n private parentObserver?: MutationObserver\n\n private get shouldUseMobileStack(): boolean {\n return this.isSmallScreen && !this.parentDropdownAlwaysFloating\n }\n\n private get parentDropdown(): Dropdown | null {\n return this.closest<Dropdown>('nord-dropdown')\n }\n\n private get isInSubmenuStack(): boolean {\n const parent = this.parentDropdown\n if (!parent)\n return false\n return parent.submenuStackRef.includes(this)\n }\n\n private get isDeepestInStack(): boolean {\n const parent = this.parentDropdown\n if (!parent)\n return false\n return parent.deepestSubmenu === this\n }\n\n connectedCallback() {\n super.connectedCallback()\n\n // Set aria-haspopup on trigger before first render\n const triggerElement = this.querySelector<HTMLElement>('[slot=\"trigger\"]')\n triggerElement?.setAttribute('aria-haspopup', 'menu')\n\n // Read alwaysFloating from parent dropdown\n const parentDropdown = this.closest<Dropdown>('nord-dropdown')\n if (parentDropdown) {\n this.parentDropdownAlwaysFloating = parentDropdown.alwaysFloating\n // Close this submenu when a sibling regular item is hovered\n this.events.listen(parentDropdown, 'mouseover', this.handleParentDropdownMouseOver)\n\n // Observe always-floating attribute on parent dropdown for reactivity\n this.parentObserver = new MutationObserver((mutations) => {\n for (const mutation of mutations) {\n if (mutation.attributeName === 'always-floating') {\n this.parentDropdownAlwaysFloating = parentDropdown.alwaysFloating\n }\n }\n })\n this.parentObserver.observe(parentDropdown, {\n attributes: true,\n attributeFilter: ['always-floating'],\n })\n }\n\n // Listen for screen size changes (use correct breakpoint)\n this.events.listen(this.mobileMediaQuery, 'change', (event: MediaQueryListEvent) => {\n this.isSmallScreen = event.matches\n this.requestUpdate()\n })\n }\n\n disconnectedCallback() {\n super.disconnectedCallback()\n this.parentObserver?.disconnect()\n }\n\n render() {\n // Mobile stack navigation: show content inline when active\n if (this.shouldUseMobileStack && this.mobileActive) {\n // Add active class for any submenu in the stack, and is-deepest-active for the deepest one\n return html`\n <slot name=\"trigger\"></slot>\n <div class=${classMap({\n 'n-dropdown-submenu-content': true,\n 'active': this.isInSubmenuStack,\n 'is-deepest-active': this.isDeepestInStack,\n })} @keydown=${this.handleContentKeydown}>\n <slot></slot>\n </div>\n `\n }\n\n // Desktop/always-floating mode: show popout\n return html`\n <slot\n name=\"trigger\"\n aria-controls=${this.popoutId}\n @slotchange=${this.handleTriggerSlotChange}\n ></slot>\n <nord-popout\n id=${this.popoutId}\n position=\"inline-end\"\n always-floating\n @open=${this.handlePopoutOpen}\n @close=${this.handlePopoutClose}\n >\n <div\n class=\"n-dropdown-submenu-content\"\n @keydown=${this.handleContentKeydown}\n >\n <slot></slot>\n </div>\n </nord-popout>\n `\n }\n\n private handleTriggerSlotChange() {\n const slot = this.shadowRoot?.querySelector<HTMLSlotElement>('slot[name=\"trigger\"]')\n const triggerElement = slot?.assignedElements()[0] as HTMLElement | undefined\n\n // Remove listeners from previous trigger element\n if (this.currentTriggerElement && this.currentTriggerElement !== triggerElement) {\n this.currentTriggerElement.removeEventListener('mouseenter', this.handleTriggerMouseEnter)\n this.currentTriggerElement.removeEventListener('click', this.handleTriggerClick)\n this.currentTriggerElement.removeEventListener('keydown', this.handleTriggerKeydown)\n }\n\n this.currentTriggerElement = triggerElement ?? null\n\n if (!triggerElement)\n return\n\n triggerElement.setAttribute('aria-haspopup', 'menu')\n\n const isTouchDevice = !window.matchMedia('(hover: hover)').matches\n\n // Non-touch devices: hover to open\n this.events.listen(triggerElement, 'mouseenter', this.handleTriggerMouseEnter)\n // Non-touch devices or small screens: click to navigate/open\n if (!isTouchDevice || this.isSmallScreen) {\n this.events.listen(triggerElement, 'click', this.handleTriggerClick)\n }\n // Keyboard: arrow keys for navigation\n this.events.listen(triggerElement, 'keydown', this.handleTriggerKeydown)\n }\n\n private handleTriggerMouseEnter = () => {\n // On mobile, don't open popout on hover — only on click\n if (this.shouldUseMobileStack)\n return\n\n this.closeOtherSubmenus()\n this.popout?.show()\n }\n\n private handleTriggerClick = (event: MouseEvent) => {\n event.preventDefault()\n event.stopImmediatePropagation()\n\n if (this.shouldUseMobileStack) {\n this.navigateIntoSubmenu()\n return\n }\n\n this.closeOtherSubmenus()\n this.popout?.show()\n }\n\n private handleTriggerKeydown = (event: KeyboardEvent) => {\n if (event.key === 'ArrowRight' || event.key === 'Enter') {\n event.preventDefault()\n\n if (this.shouldUseMobileStack) {\n this.navigateIntoSubmenu()\n return\n }\n\n this.closeOtherSubmenus()\n this.popout?.show()\n this.updateComplete.then(() => {\n this.querySelector<HTMLElement>('nord-dropdown-item')?.focus()\n })\n }\n }\n\n private handleContentKeydown = (event: KeyboardEvent) => {\n if (event.key === 'ArrowLeft') {\n event.preventDefault()\n event.stopPropagation()\n\n if (this.shouldUseMobileStack && this.mobileActive) {\n this.closest<Dropdown>('nord-dropdown')?.navigateBack()\n return\n }\n\n this.popout?.hide(true)\n }\n }\n\n private handlePopoutOpen = () => {\n this.popoutOpen = true\n this.closeOtherSubmenus()\n }\n\n private handlePopoutClose = (event: Event) => {\n event.stopPropagation()\n this.popoutOpen = false\n }\n\n private handleParentDropdownMouseOver = (event: MouseEvent) => {\n // Don't close on mouseover during mobile stack navigation\n if (this.shouldUseMobileStack)\n return\n\n const target = event.target as HTMLElement\n const isRegularDropdownItem = target.tagName === 'NORD-DROPDOWN-ITEM' && !this.contains(target)\n if (isRegularDropdownItem && this.popoutOpen) {\n event.stopImmediatePropagation()\n this.popout?.hide()\n }\n }\n\n private closeOtherSubmenus() {\n // Don't close siblings during mobile stack navigation\n if (this.shouldUseMobileStack)\n return\n\n // Find the immediate parent container (dropdown or submenu)\n const immediateParent = this.parentElement?.closest('nord-dropdown, nord-dropdown-submenu')\n if (!immediateParent)\n return\n\n // Close only siblings at the same level\n Array.from(\n immediateParent.querySelectorAll<DropdownSubmenu>(':scope > nord-dropdown-submenu'),\n ).forEach((sibling) => {\n if (sibling !== this)\n sibling.close()\n })\n }\n\n /**\n * Deactivate mobile stack navigation (remove from stack).\n * @internal\n */\n deactivateMobile() {\n this.mobileActive = false\n\n // NATIVELY REMOVE THE ATTRIBUTE FROM THE HOST\n this.removeAttribute('mobile-active')\n\n // Clear aria-expanded that may have been set by Popout during hover\n const triggerSlot = this.shadowRoot?.querySelector<HTMLSlotElement>('slot[name=\"trigger\"]')\n const triggerElement = triggerSlot?.assignedElements()[0] as HTMLElement | undefined\n triggerElement?.removeAttribute('aria-expanded')\n }\n\n /**\n * Read trigger text for back button title in Dropdown.\n * @internal\n */\n get label(): string {\n const triggerSlot = this.shadowRoot?.querySelector<HTMLSlotElement>('slot[name=\"trigger\"]')\n return triggerSlot?.assignedElements()[0]?.textContent?.trim() ?? ''\n }\n\n /**\n * Close the submenu programmatically.\n * Returns a promise that resolves when the close animation completes.\n */\n close(): Promise<TransitionEvent | void> {\n if (this.mobileActive) {\n this.deactivateMobile()\n return Promise.resolve()\n }\n\n if (!this.popout) {\n return Promise.reject(new Error('DropdownSubmenu: popout component not found or not ready'))\n }\n return this.popout.hide()\n }\n\n /**\n * Navigate into this submenu using mobile stack navigation.\n * @internal\n */\n private navigateIntoSubmenu() {\n this.mobileActive = true\n this.setAttribute('mobile-active', '')\n this.dispatchEvent(\n new CustomEvent('nord-submenu-navigate', { bubbles: true, detail: { submenu: this } }),\n )\n this.updateComplete.then(() => {\n // Focus on first submenu item (not back button in header)\n const contentDiv = this.querySelector('.n-dropdown-submenu-content')\n const firstItem = contentDiv?.querySelector<HTMLElement>('nord-dropdown-item')\n firstItem?.focus()\n })\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nord-dropdown-submenu': DropdownSubmenu\n }\n}\n"],"names":["popoutCounter","DropdownSubmenu","LitElement","constructor","this","mobileActive","popoutId","events","EventController","currentTriggerElement","popoutOpen","mobileMediaQuery","window","matchMedia","isSmallScreen","matches","parentDropdownAlwaysFloating","handleTriggerMouseEnter","shouldUseMobileStack","closeOtherSubmenus","_a","popout","show","handleTriggerClick","event","preventDefault","stopImmediatePropagation","navigateIntoSubmenu","handleTriggerKeydown","key","updateComplete","then","querySelector","focus","handleContentKeydown","stopPropagation","closest","navigateBack","_b","hide","handlePopoutOpen","handlePopoutClose","handleParentDropdownMouseOver","target","tagName","contains","parentDropdown","isInSubmenuStack","parent","submenuStackRef","includes","isDeepestInStack","deepestSubmenu","connectedCallback","super","triggerElement","setAttribute","alwaysFloating","listen","parentObserver","MutationObserver","mutations","mutation","attributeName","observe","attributes","attributeFilter","requestUpdate","disconnectedCallback","disconnect","render","html","classMap","active","handleTriggerSlotChange","slot","shadowRoot","assignedElements","removeEventListener","isTouchDevice","immediateParent","parentElement","Array","from","querySelectorAll","forEach","sibling","close","deactivateMobile","removeAttribute","triggerSlot","label","_d","textContent","_c","trim","Promise","resolve","reject","Error","dispatchEvent","CustomEvent","bubbles","detail","submenu","contentDiv","firstItem","styles","componentStyle","style","__decorate","query","prototype","state","customElement"],"mappings":"8iEAUA,IAAIA,EAAgB,EAgBCC,EAAN,cAA8BC,EAA9B,WAAAC,uBAOIC,KAAYC,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H,SAAAA"}
|
|
1
|
+
{"version":3,"file":"DropdownSubmenu.js","sources":["../src/dropdown-submenu/DropdownSubmenu.ts"],"sourcesContent":["import type Dropdown from '../dropdown/Dropdown.js'\nimport type Popout from '../popout/Popout.js'\nimport { html, LitElement } from 'lit'\nimport { customElement, query, state } from 'lit/decorators.js'\nimport { classMap } from 'lit/directives/class-map.js'\nimport { EventController } from '../common/controllers/EventController.js'\nimport componentStyle from '../common/styles/Component.css'\nimport style from './DropdownSubmenu.css'\nimport '../popout/Popout.js'\n\nlet popoutCounter = 0\n\n/**\n * Dropdown submenu nests a secondary menu within a parent dropdown.\n *\n * @status ready\n * @category action\n *\n * @slot trigger - The element that opens the submenu (typically nord-dropdown-item).\n * @slot - The submenu content items.\n *\n * @fires {NordEvent} open - Forwarded from the internal nord-popout.\n * @fires {NordEvent} close - Forwarded from the internal nord-popout.\n * @fires {CustomEvent} nord-submenu-navigate - Fired when mobile stack navigation activates this submenu.\n *\n * @parent Dropdown\n */\n@customElement('nord-dropdown-submenu')\nexport default class DropdownSubmenu extends LitElement {\n static styles = [componentStyle, style]\n\n @query('nord-popout')\n private popout?: Popout\n\n /** @internal */\n @state() private mobileActive = false\n\n private readonly popoutId = `nord-dropdown-submenu-popout-${++popoutCounter}`\n private events = new EventController(this)\n private currentTriggerElement: HTMLElement | null = null\n private popoutOpen = false\n private readonly mobileMediaQuery = window.matchMedia('(max-width: 35.9375em)')\n @state() private isSmallScreen = this.mobileMediaQuery.matches\n @state() private parentDropdownAlwaysFloating = false\n private parentObserver?: MutationObserver\n\n private get shouldUseMobileStack(): boolean {\n return this.isSmallScreen && !this.parentDropdownAlwaysFloating\n }\n\n private get parentDropdown(): Dropdown | null {\n return this.closest<Dropdown>('nord-dropdown')\n }\n\n private get isInSubmenuStack(): boolean {\n const parent = this.parentDropdown\n if (!parent)\n return false\n return parent.submenuStackRef.includes(this)\n }\n\n private get isDeepestInStack(): boolean {\n const parent = this.parentDropdown\n if (!parent)\n return false\n return parent.deepestSubmenu === this\n }\n\n connectedCallback() {\n super.connectedCallback()\n\n // Set aria-haspopup on trigger before first render\n const triggerElement = this.querySelector<HTMLElement>('[slot=\"trigger\"]')\n triggerElement?.setAttribute('aria-haspopup', 'menu')\n\n // Read alwaysFloating from parent dropdown\n const parentDropdown = this.closest<Dropdown>('nord-dropdown')\n if (parentDropdown) {\n this.parentDropdownAlwaysFloating = parentDropdown.alwaysFloating\n // Close this submenu when a sibling regular item is hovered\n this.events.listen(parentDropdown, 'mouseover', this.handleParentDropdownMouseOver)\n\n // Observe always-floating attribute on parent dropdown for reactivity\n this.parentObserver = new MutationObserver((mutations) => {\n for (const mutation of mutations) {\n if (mutation.attributeName === 'always-floating') {\n this.parentDropdownAlwaysFloating = parentDropdown.alwaysFloating\n }\n }\n })\n this.parentObserver.observe(parentDropdown, {\n attributes: true,\n attributeFilter: ['always-floating'],\n })\n }\n\n // Listen for screen size changes (use correct breakpoint)\n this.events.listen(this.mobileMediaQuery, 'change', (event: MediaQueryListEvent) => {\n this.isSmallScreen = event.matches\n this.requestUpdate()\n })\n }\n\n disconnectedCallback() {\n super.disconnectedCallback()\n this.parentObserver?.disconnect()\n }\n\n render() {\n // Mobile stack navigation: show content inline when active\n if (this.shouldUseMobileStack && this.mobileActive) {\n // Add active class for any submenu in the stack, and is-deepest-active for the deepest one\n return html`\n <slot name=\"trigger\"></slot>\n <div class=${classMap({\n 'n-dropdown-submenu-content': true,\n 'active': this.isInSubmenuStack,\n 'is-deepest-active': this.isDeepestInStack,\n })} @keydown=${this.handleContentKeydown}>\n <slot></slot>\n </div>\n `\n }\n\n // Desktop/always-floating mode: show popout\n return html`\n <slot\n name=\"trigger\"\n aria-controls=${this.popoutId}\n @slotchange=${this.handleTriggerSlotChange}\n ></slot>\n <nord-popout\n id=${this.popoutId}\n position=\"inline-end\"\n always-floating\n @open=${this.handlePopoutOpen}\n @close=${this.handlePopoutClose}\n >\n <div\n class=\"n-dropdown-submenu-content\"\n @keydown=${this.handleContentKeydown}\n >\n <slot></slot>\n </div>\n </nord-popout>\n `\n }\n\n private handleTriggerSlotChange() {\n const slot = this.shadowRoot?.querySelector<HTMLSlotElement>('slot[name=\"trigger\"]')\n const triggerElement = slot?.assignedElements()[0] as HTMLElement | undefined\n\n // Remove listeners from previous trigger element\n if (this.currentTriggerElement && this.currentTriggerElement !== triggerElement) {\n this.currentTriggerElement.removeEventListener('mouseenter', this.handleTriggerMouseEnter)\n this.currentTriggerElement.removeEventListener('click', this.handleTriggerClick)\n this.currentTriggerElement.removeEventListener('keydown', this.handleTriggerKeydown)\n }\n\n this.currentTriggerElement = triggerElement ?? null\n\n if (!triggerElement)\n return\n\n triggerElement.setAttribute('aria-haspopup', 'menu')\n\n const isTouchDevice = !window.matchMedia('(hover: hover)').matches\n\n // Non-touch devices: hover to open\n this.events.listen(triggerElement, 'mouseenter', this.handleTriggerMouseEnter)\n // Non-touch devices or small screens: click to navigate/open\n if (!isTouchDevice || this.isSmallScreen) {\n this.events.listen(triggerElement, 'click', this.handleTriggerClick)\n }\n // Keyboard: arrow keys for navigation\n this.events.listen(triggerElement, 'keydown', this.handleTriggerKeydown)\n }\n\n private handleTriggerMouseEnter = () => {\n // On mobile, don't open popout on hover — only on click\n if (this.shouldUseMobileStack)\n return\n\n this.closeOtherSubmenus()\n this.popout?.show()\n }\n\n private handleTriggerClick = (event: MouseEvent) => {\n event.preventDefault()\n event.stopImmediatePropagation()\n\n if (this.shouldUseMobileStack) {\n this.navigateIntoSubmenu()\n return\n }\n\n this.closeOtherSubmenus()\n this.popout?.show()\n }\n\n private handleTriggerKeydown = (event: KeyboardEvent) => {\n if (event.key === 'ArrowRight' || event.key === 'Enter') {\n event.preventDefault()\n\n if (this.shouldUseMobileStack) {\n this.navigateIntoSubmenu()\n return\n }\n\n this.closeOtherSubmenus()\n this.popout?.show()\n this.updateComplete.then(() => {\n this.querySelector<HTMLElement>('nord-dropdown-item')?.focus()\n })\n }\n }\n\n private handleContentKeydown = (event: KeyboardEvent) => {\n if (event.key === 'ArrowLeft') {\n event.preventDefault()\n event.stopPropagation()\n\n if (this.shouldUseMobileStack && this.mobileActive) {\n this.closest<Dropdown>('nord-dropdown')?.navigateBack()\n return\n }\n\n this.popout?.hide(true)\n }\n }\n\n private handlePopoutOpen = () => {\n this.popoutOpen = true\n this.closeOtherSubmenus()\n }\n\n private handlePopoutClose = (event: Event) => {\n event.stopPropagation()\n this.popoutOpen = false\n }\n\n private handleParentDropdownMouseOver = (event: MouseEvent) => {\n // Don't close on mouseover during mobile stack navigation\n if (this.shouldUseMobileStack)\n return\n\n const target = event.target as HTMLElement\n const isRegularDropdownItem = target.tagName === 'NORD-DROPDOWN-ITEM' && !this.contains(target)\n if (isRegularDropdownItem && this.popoutOpen) {\n event.stopImmediatePropagation()\n this.popout?.hide()\n }\n }\n\n private closeOtherSubmenus() {\n // Don't close siblings during mobile stack navigation\n if (this.shouldUseMobileStack)\n return\n\n // Find the immediate parent container (dropdown or submenu)\n const immediateParent = this.parentElement?.closest('nord-dropdown, nord-dropdown-submenu')\n if (!immediateParent)\n return\n\n // Close only siblings at the same level\n Array.from(\n immediateParent.querySelectorAll<DropdownSubmenu>(':scope > nord-dropdown-submenu'),\n ).forEach((sibling) => {\n if (sibling !== this)\n sibling.close()\n })\n }\n\n /**\n * Deactivate mobile stack navigation (remove from stack).\n * @internal\n */\n deactivateMobile() {\n this.mobileActive = false\n\n // NATIVELY REMOVE THE ATTRIBUTE FROM THE HOST\n this.removeAttribute('mobile-active')\n\n // Clear aria-expanded that may have been set by Popout during hover\n const triggerSlot = this.shadowRoot?.querySelector<HTMLSlotElement>('slot[name=\"trigger\"]')\n const triggerElement = triggerSlot?.assignedElements()[0] as HTMLElement | undefined\n triggerElement?.removeAttribute('aria-expanded')\n }\n\n /**\n * Read trigger text for back button title in Dropdown.\n * @internal\n */\n get label(): string {\n const triggerSlot = this.shadowRoot?.querySelector<HTMLSlotElement>('slot[name=\"trigger\"]')\n return triggerSlot?.assignedElements()[0]?.textContent?.trim() ?? ''\n }\n\n /**\n * Close the submenu programmatically.\n * Returns a promise that resolves when the close animation completes.\n */\n close(): Promise<TransitionEvent | void> {\n if (this.mobileActive) {\n this.deactivateMobile()\n return Promise.resolve()\n }\n\n if (!this.popout) {\n return Promise.reject(new Error('DropdownSubmenu: popout component not found or not ready'))\n }\n return this.popout.hide()\n }\n\n /**\n * Navigate into this submenu using mobile stack navigation.\n * @internal\n */\n private navigateIntoSubmenu() {\n this.mobileActive = true\n this.setAttribute('mobile-active', '')\n this.dispatchEvent(\n new CustomEvent('nord-submenu-navigate', { bubbles: true, detail: { submenu: this } }),\n )\n this.updateComplete.then(() => {\n // Focus on first submenu item (not back button in header)\n const contentDiv = this.querySelector('.n-dropdown-submenu-content')\n const firstItem = contentDiv?.querySelector<HTMLElement>('nord-dropdown-item')\n firstItem?.focus()\n })\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nord-dropdown-submenu': DropdownSubmenu\n }\n}\n"],"names":["popoutCounter","DropdownSubmenu","LitElement","constructor","this","mobileActive","popoutId","events","EventController","currentTriggerElement","popoutOpen","mobileMediaQuery","window","matchMedia","isSmallScreen","matches","parentDropdownAlwaysFloating","handleTriggerMouseEnter","shouldUseMobileStack","closeOtherSubmenus","_a","popout","show","handleTriggerClick","event","preventDefault","stopImmediatePropagation","navigateIntoSubmenu","handleTriggerKeydown","key","updateComplete","then","querySelector","focus","handleContentKeydown","stopPropagation","closest","navigateBack","_b","hide","handlePopoutOpen","handlePopoutClose","handleParentDropdownMouseOver","target","tagName","contains","parentDropdown","isInSubmenuStack","parent","submenuStackRef","includes","isDeepestInStack","deepestSubmenu","connectedCallback","super","triggerElement","setAttribute","alwaysFloating","listen","parentObserver","MutationObserver","mutations","mutation","attributeName","observe","attributes","attributeFilter","requestUpdate","disconnectedCallback","disconnect","render","html","classMap","active","handleTriggerSlotChange","slot","shadowRoot","assignedElements","removeEventListener","isTouchDevice","immediateParent","parentElement","Array","from","querySelectorAll","forEach","sibling","close","deactivateMobile","removeAttribute","triggerSlot","label","_d","textContent","_c","trim","Promise","resolve","reject","Error","dispatchEvent","CustomEvent","bubbles","detail","submenu","contentDiv","firstItem","styles","componentStyle","style","__decorate","query","prototype","state","customElement"],"mappings":"4iEAUA,IAAIA,EAAgB,EAkBCC,EAAN,cAA8BC,EAA9B,WAAAC,uBAOIC,KAAYC,cAAG,EAEfD,KAAAE,SAAW,mCAAkCN,EACtDI,KAAAG,OAAS,IAAIC,EAAgBJ,MAC7BA,KAAqBK,sBAAuB,KAC5CL,KAAUM,YAAG,EACJN,KAAAO,iBAAmBC,OAAOC,WAAW,0BACrCT,KAAAU,cAAgBV,KAAKO,iBAAiBI,QACtCX,KAA4BY,8BAAG,EAuIxCZ,KAAuBa,wBAAG,WAE5Bb,KAAKc,uBAGTd,KAAKe,qBACQ,QAAbC,EAAAhB,KAAKiB,cAAQ,IAAAD,GAAAA,EAAAE,OAAM,EAGblB,KAAAmB,mBAAsBC,UAC5BA,EAAMC,iBACND,EAAME,2BAEFtB,KAAKc,qBACPd,KAAKuB,uBAIPvB,KAAKe,qBACQ,QAAbC,EAAAhB,KAAKiB,cAAQ,IAAAD,GAAAA,EAAAE,OAAM,EAGblB,KAAAwB,qBAAwBJ,UAC9B,GAAkB,eAAdA,EAAMK,KAAsC,UAAdL,EAAMK,IAAiB,CAGvD,GAFAL,EAAMC,iBAEFrB,KAAKc,qBAEP,YADAd,KAAKuB,sBAIPvB,KAAKe,qBACQ,QAAbC,EAAAhB,KAAKiB,cAAQ,IAAAD,GAAAA,EAAAE,OACblB,KAAK0B,eAAeC,MAAK,WAC8B,QAArDX,EAAAhB,KAAK4B,cAA2B,6BAAqB,IAAAZ,GAAAA,EAAEa,OAAO,GAEjE,GAGK7B,KAAA8B,qBAAwBV,YAC9B,GAAkB,cAAdA,EAAMK,IAAqB,CAI7B,GAHAL,EAAMC,iBACND,EAAMW,kBAEF/B,KAAKc,sBAAwBd,KAAKC,aAEpC,YADuC,QAAvCe,EAAAhB,K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,EAAA+G,UAAA,cAAA,GAGNF,EAAA,CAAhBG,KAAoChH,EAAA+G,UAAA,oBAAA,GAOpBF,EAAA,CAAhBG,KAA6DhH,EAAA+G,UAAA,qBAAA,GAC7CF,EAAA,CAAhBG,KAAoDhH,EAAA+G,UAAA,oCAAA,GAflC/G,EAAe6G,EAAA,CADnCI,EAAc,0BACMjH,SAAAA"}
|
package/lib/EmptyState.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{_ as t}from"./tslib.es6-CmLYFWVC.js";import{css as e,LitElement as n,html as a}from"lit";import{customElement as r}from"lit/decorators.js";import{s as o}from"./Component-
|
|
1
|
+
import{_ as t}from"./tslib.es6-CmLYFWVC.js";import{css as e,LitElement as n,html as a}from"lit";import{customElement as r}from"lit/decorators.js";import{s as o}from"./Component-BJ5O5n8k.js";const i=e`:host{background:var(--n-color-surface);color:var(--n-color-text)}.n-empty-state{align-items:center;display:flex;flex-direction:column;justify-content:center;padding:var(--n-space-xl);text-align:center}@media (max-width:500px){.n-empty-state{padding:var(--n-space-l) var(--n-space-m)}}::slotted(:is(h1,h2,h3,h4,h5,h6)){color:var(--n-color-text)!important;font-size:var(--n-font-size-xl)!important;font-weight:var(--n-font-weight-heading)!important;line-height:var(--n-line-height-heading)!important;margin:0 0 var(--n-space-m)!important}::slotted(p){color:var(--n-color-text-weaker)!important;font-size:var(--n-font-size-m)!important;line-height:var(--n-line-height)!important;margin:0 0 var(--n-space-l)!important;max-inline-size:var(--n-empty-state-text-width,400px)}::slotted(:is(h1,h2,h3,h4,h5,h6,p)){text-wrap:balance!important}`;let s=class extends n{render(){return a`<div class="n-empty-state"><slot></slot></div>`}};s.styles=[o,i],s=t([r("nord-empty-state")],s);var l=s;export{l as default};
|
|
2
2
|
//# sourceMappingURL=EmptyState.js.map
|
package/lib/EmptyState.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmptyState.js","sources":["../src/empty-state/EmptyState.ts"],"sourcesContent":["import { html, LitElement } from 'lit'\nimport { customElement } from 'lit/decorators.js'\n\nimport componentStyle from '../common/styles/Component.css'\nimport style from './EmptyState.css'\n\n/**\n * Empty state can be used when there is no data to display to\n * describe what the user can do next. Empty state provides\n * explanation and guidance to help user progress.\n *\n * @status ready\n * @category feedback\n * @slot - default slot\n */\n@customElement('nord-empty-state')\nexport default class EmptyState extends LitElement {\n static styles = [componentStyle, style]\n\n render() {\n return html`<div class=\"n-empty-state\">\n <slot></slot>\n </div>`\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nord-empty-state': EmptyState\n }\n}\n"],"names":["EmptyState","LitElement","render","html","styles","componentStyle","style","__decorate","customElement"],"mappings":"
|
|
1
|
+
{"version":3,"file":"EmptyState.js","sources":["../src/empty-state/EmptyState.ts"],"sourcesContent":["import { html, LitElement } from 'lit'\nimport { customElement } from 'lit/decorators.js'\n\nimport componentStyle from '../common/styles/Component.css'\nimport style from './EmptyState.css'\n\n/**\n * Empty state can be used when there is no data to display to\n * describe what the user can do next. Empty state provides\n * explanation and guidance to help user progress.\n *\n * @status ready\n * @category feedback\n * @slot - default slot\n */\n@customElement('nord-empty-state')\nexport default class EmptyState extends LitElement {\n static styles = [componentStyle, style]\n\n render() {\n return html`<div class=\"n-empty-state\">\n <slot></slot>\n </div>`\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nord-empty-state': EmptyState\n }\n}\n"],"names":["EmptyState","LitElement","render","html","styles","componentStyle","style","__decorate","customElement"],"mappings":"2gCAgBe,IAAMA,EAAN,cAAyBC,EAGtC,MAAAC,GACE,OAAOC,CAAI,gDAGZ,GANMH,EAAAI,OAAS,CAACC,EAAgBC,GADdN,EAAUO,EAAA,CAD9BC,EAAc,qBACMR,SAAAA"}
|
package/lib/Field.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{_ as e}from"./tslib.es6-CmLYFWVC.js";import{i as t}from"./context-provider-D8lrPLVi.js";import{css as i,LitElement as r}from"lit";import{property as o,customElement as l}from"lit/decorators.js";import{S as s}from"./StateAttributesController-BIh96sXZ.js";import{i as d}from"./light-dom-styles-DXsbiKU9.js";import{D as n}from"./DraftComponentMixin-4qug5Rky.js";import{fieldContext as a}from"./field-context.js";import"./context-request-event-CCRlXoeR.js";import"./create-context-CJ69ntlY.js";const c=i`nord-field{--_n-field-gap:var(--n-field-gap,var(--n-space-s));color:var(--n-color-text);display:flex;flex-direction:column;font-family:var(--n-font-family);font-feature-settings:var(--n-font-features);gap:var(--_n-field-gap)}nord-field,nord-field *,nord-field :after,nord-field :before{box-sizing:border-box}nord-field[orientation=horizontal]{align-items:center;flex-direction:row;gap:var(--n-space-m)}nord-field[orientation=horizontal]>nord-field-content{flex:1}@container (min-width: 28rem){nord-field[orientation=responsive]{align-items:center;flex-direction:row;gap:var(--n-space-m)}nord-field[orientation=responsive]>nord-field-content{flex:1}}`;let b=0,v=0,h=class extends(n(r)){constructor(){super(...arguments),this.orientation="vertical",this.invalid=!1,this.disabled=!1,this.provider=new t(this,{context:a,initialValue:void 0}),this.controlRequired=!1,this.stateAttributes=new s(this,(()=>({invalid:this.invalid,disabled:this.disabled})),{trackFocus:!0}),this.managedDescribedBy=[],this.setRequired=e=>{this.controlRequired=e,this.syncLabelIndicator()}}connectedCallback(){var e,t;super.connectedCallback(),d(this,c),null!==(e=this.childObserver)&&void 0!==e||(this.childObserver=new MutationObserver((()=>this.updateContext()))),this.childObserver.observe(this,{childList:!0,subtree:!0});const i=this.closest("nord-field-set");i&&(null!==(t=this.fieldSetObserver)&&void 0!==t||(this.fieldSetObserver=new MutationObserver((()=>this.updateContext()))),this.fieldSetObserver.observe(i,{attributes:!0,attributeFilter:["disabled"]}))}disconnectedCallback(){var e,t;super.disconnectedCallback(),null===(e=this.childObserver)||void 0===e||e.disconnect(),this.childObserver=void 0,null===(t=this.fieldSetObserver)||void 0===t||t.disconnect(),this.fieldSetObserver=void 0}createRenderRoot(){return this}firstUpdated(){this.updateContext()}updated(e){(e.has("invalid")||e.has("disabled"))&&this.updateContext()}updateContext(){const e=this.closest("nord-field-set"),t={invalid:this.invalid,disabled:this.disabled||Boolean(null==e?void 0:e.disabled),labelId:this.resolveLabelId(),labelText:this.resolveLabelText(),describedById:this.collectDescribedById(),setRequired:this.setRequired};this.provider.setValue(t),this.syncLabelIndicator(),this.linkNativeControl(t)}get labelElement(){return this.querySelector("nord-field-label")}resolveLabelId(){const e=this.labelElement;if(e)return e.id||(e.id="n-field-label-"+v++),e.id}resolveLabelText(){var e,t;return(null===(t=null===(e=this.labelElement)||void 0===e?void 0:e.textContent)||void 0===t?void 0:t.trim())||void 0}collectDescribedById(){const e=Array.from(this.querySelectorAll("nord-field-description, nord-field-error")).map((e=>(e.id||(e.id="n-field-helper-"+b++),e.id)));return e.length?e.join(" "):void 0}syncLabelIndicator(){var e;null===(e=this.labelElement)||void 0===e||e.toggleAttribute("required",this.controlRequired)}linkNativeControl(e){var t;const i=this.querySelector(":scope > input, :scope > select, :scope > textarea, :scope > [contenteditable]");if(!i)return;e.labelId&&i.setAttribute("aria-labelledby",e.labelId);const r=e.describedById?e.describedById.split(/\s+/):[],o=(null!==(t=i.getAttribute("aria-describedby"))&&void 0!==t?t:"").split(/\s+/).filter(Boolean).filter((e=>!this.managedDescribedBy.includes(e)&&!r.includes(e)));this.managedDescribedBy=r;const l=[...o,...r].join(" ");l?i.setAttribute("aria-describedby",l):i.removeAttribute("aria-describedby"),e.invalid?i.setAttribute("aria-invalid","true"):i.removeAttribute("aria-invalid"),this.setRequired(i.matches("[required]"))}};e([o({reflect:!0})],h.prototype,"orientation",void 0),e([o({reflect:!0,type:Boolean})],h.prototype,"invalid",void 0),e([o({reflect:!0,type:Boolean})],h.prototype,"disabled",void 0),h=e([l("nord-field")],h);var f=h;export{f as default};
|
|
2
|
+
//# sourceMappingURL=Field.js.map
|
package/lib/Field.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Field.js","sources":["../src/field/Field.ts"],"sourcesContent":["import type { FieldContextValue } from './field-context.js'\nimport { ContextProvider } from '@lit/context'\nimport { LitElement } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { StateAttributesController } from '../common/controllers/StateAttributesController.js'\nimport { injectLightDomStyles } from '../common/light-dom-styles.js'\nimport { DraftComponentMixin } from '../common/mixins/DraftComponentMixin.js'\nimport { fieldContext } from './field-context.js'\nimport style from './Field.css'\n\n/** Per-instance counters so generated label/helper ids stay unique. */\nlet fieldHelperId = 0\nlet fieldLabelId = 0\n\n/**\n * Field is the wrapper for a single form control. It lays out a\n * [Field Label](/components/field-label/), a control (such as an\n * [Input](/components/input/)), an optional\n * [Field Description](/components/field-description/) and a\n * [Field Error](/components/field-error/) with consistent spacing.\n *\n * Combine several together in a [Field Group](/components/field-group/) and\n * group related groups with a [Field Set](/components/field-set/).\n *\n * The Field shares its state with the control through context: a Nord control\n * placed inside a Field suppresses its own built-in label/hint/error and takes\n * its accessible name, description and invalid/disabled state from the Field.\n *\n * @status draft\n * @category form\n * @lightDom true\n *\n * @slot - Default slot for the field parts (label, control, content, description, error).\n *\n * @attr {boolean} data-invalid - Present while the field is invalid (mirrors the `invalid` property). Style hook for the whole field.\n * @attr {boolean} data-disabled - Present while the field is disabled (mirrors the `disabled` property).\n * @attr {boolean} data-focused - Present while the field's control has focus. Style hook for focus-within treatments across the field.\n *\n * @cssprop [--n-field-gap=var(--n-space-s)] - Controls the spacing between the field parts, using our [spacing tokens](/tokens/#space).\n */\n@customElement('nord-field')\nexport default class Field extends DraftComponentMixin(LitElement) {\n /**\n * The layout of the field.\n *\n * - `vertical` (default) stacks the label, control and helper text.\n * - `horizontal` places the label and control side by side, vertically centered.\n * - `responsive` lays out horizontally in a wide enough container, otherwise vertical.\n */\n @property({ reflect: true }) orientation: 'vertical' | 'horizontal' | 'responsive' = 'vertical'\n\n /**\n * Marks the field as invalid, enabling error styling hooks. Also reflected as\n * `data-invalid` and propagated to the control via context.\n */\n @property({ reflect: true, type: Boolean }) invalid = false\n\n /**\n * Disables the field and, via context, its control. Reflected as `data-disabled`.\n */\n @property({ reflect: true, type: Boolean }) disabled = false\n\n /** Provides {@link fieldContext} to the control inside this field. */\n private provider = new ContextProvider(this, { context: fieldContext, initialValue: undefined })\n\n /**\n * The control's published `required`, used to drive the label's indicator.\n * Not reactive — it only toggles an attribute imperatively via syncLabelIndicator.\n */\n private controlRequired = false\n\n /**\n * Reflects the field's state onto `data-*` attributes (the Lit equivalent of\n * Base UI's `stateAttributesMapping`): `data-invalid`/`data-disabled` from the\n * properties and `data-focused` tracked automatically.\n */\n private stateAttributes = new StateAttributesController(\n this,\n () => ({ invalid: this.invalid, disabled: this.disabled }),\n { trackFocus: true },\n )\n\n /** Observes child additions/removals so the shared context stays in sync. */\n private childObserver?: MutationObserver\n /** Observes an enclosing Field Set's `disabled` so the cascade stays in sync. */\n private fieldSetObserver?: MutationObserver\n /** `aria-describedby` ids this field added to a native control on its last run. */\n private managedDescribedBy: string[] = []\n\n connectedCallback() {\n super.connectedCallback()\n injectLightDomStyles(this, style)\n\n // Re-publish context whenever children change (e.g. an error or label is\n // added/removed, or a generated id lands).\n this.childObserver ??= new MutationObserver(() => this.updateContext())\n this.childObserver.observe(this, { childList: true, subtree: true })\n\n const fieldSet = this.closest('nord-field-set')\n if (fieldSet) {\n this.fieldSetObserver ??= new MutationObserver(() => this.updateContext())\n this.fieldSetObserver.observe(fieldSet, { attributes: true, attributeFilter: ['disabled'] })\n }\n }\n\n disconnectedCallback() {\n super.disconnectedCallback()\n this.childObserver?.disconnect()\n this.childObserver = undefined\n this.fieldSetObserver?.disconnect()\n this.fieldSetObserver = undefined\n }\n\n protected createRenderRoot() {\n return this\n }\n\n protected firstUpdated() {\n this.updateContext()\n }\n\n protected updated(changed: Map<string, unknown>) {\n if (changed.has('invalid') || changed.has('disabled')) {\n this.updateContext()\n }\n }\n\n /** The control publishes its `required` here; we drive the label indicator. */\n private setRequired = (required: boolean) => {\n this.controlRequired = required\n this.syncLabelIndicator()\n }\n\n /**\n * Recompute and publish the shared context. The provider compares by identity,\n * so we always hand it a fresh object.\n */\n private updateContext() {\n const fieldSet = this.closest('nord-field-set') as (HTMLElement & { disabled?: boolean }) | null\n\n const value: FieldContextValue = {\n invalid: this.invalid,\n disabled: this.disabled || Boolean(fieldSet?.disabled),\n labelId: this.resolveLabelId(),\n labelText: this.resolveLabelText(),\n describedById: this.collectDescribedById(),\n setRequired: this.setRequired,\n }\n\n this.provider.setValue(value)\n this.syncLabelIndicator()\n this.linkNativeControl(value)\n }\n\n private get labelElement(): HTMLElement | null {\n return this.querySelector('nord-field-label')\n }\n\n /** Ensure the label has an id (for `aria-labelledby` on light-DOM controls). */\n private resolveLabelId(): string | undefined {\n const label = this.labelElement\n if (!label) {\n return undefined\n }\n if (!label.id) {\n label.id = `n-field-label-${fieldLabelId++}`\n }\n return label.id\n }\n\n /** The label text (for `aria-label` on shadow-DOM controls). */\n private resolveLabelText(): string | undefined {\n return this.labelElement?.textContent?.trim() || undefined\n }\n\n /**\n * Collect the ids of any description/error elements (in DOM order, generating\n * ids as needed) for the control's `aria-describedby`.\n */\n private collectDescribedById(): string | undefined {\n const helpers = Array.from(this.querySelectorAll('nord-field-description, nord-field-error'))\n const ids = helpers.map((helper) => {\n if (!helper.id) {\n helper.id = `n-field-helper-${fieldHelperId++}`\n }\n return helper.id\n })\n return ids.length ? ids.join(' ') : undefined\n }\n\n private syncLabelIndicator() {\n this.labelElement?.toggleAttribute('required', this.controlRequired)\n }\n\n /**\n * Context only reaches Nord controls (consumers). A native `<input>`/`<select>`/\n * `<textarea>` placed directly in a Field is wired here instead — light-DOM\n * IDREFs resolve in-tree. This is the only remaining imperative path, mirroring\n * Base UI's `Field.Control` being for native elements.\n */\n private linkNativeControl(value: FieldContextValue) {\n const native = this.querySelector<HTMLElement>(\n ':scope > input, :scope > select, :scope > textarea, :scope > [contenteditable]',\n )\n if (!native) {\n return\n }\n\n if (value.labelId) {\n native.setAttribute('aria-labelledby', value.labelId)\n }\n\n // Merge our helper ids with any consumer-set aria-describedby rather than\n // clobbering it; drop the ids we added on a previous run.\n const managed = value.describedById ? value.describedById.split(/\\s+/) : []\n const current = (native.getAttribute('aria-describedby') ?? '').split(/\\s+/).filter(Boolean)\n const preserved = current.filter(token => !this.managedDescribedBy.includes(token) && !managed.includes(token))\n this.managedDescribedBy = managed\n const describedBy = [...preserved, ...managed].join(' ')\n if (describedBy) {\n native.setAttribute('aria-describedby', describedBy)\n }\n else {\n native.removeAttribute('aria-describedby')\n }\n\n if (value.invalid) {\n native.setAttribute('aria-invalid', 'true')\n }\n else {\n native.removeAttribute('aria-invalid')\n }\n\n // Surface a natively-required control on the label indicator.\n this.setRequired(native.matches('[required]'))\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nord-field': Field\n }\n}\n"],"names":["fieldHelperId","fieldLabelId","Field","DraftComponentMixin","LitElement","constructor","this","orientation","invalid","disabled","provider","ContextProvider","context","fieldContext","initialValue","undefined","controlRequired","stateAttributes","StateAttributesController","trackFocus","managedDescribedBy","setRequired","required","syncLabelIndicator","connectedCallback","super","injectLightDomStyles","style","_a","childObserver","MutationObserver","updateContext","observe","childList","subtree","fieldSet","closest","_b","fieldSetObserver","attributes","attributeFilter","disconnectedCallback","disconnect","createRenderRoot","firstUpdated","updated","changed","has","value","Boolean","labelId","resolveLabelId","labelText","resolveLabelText","describedById","collectDescribedById","setValue","linkNativeControl","labelElement","querySelector","label","id","textContent","trim","ids","Array","from","querySelectorAll","map","helper","length","join","toggleAttribute","native","setAttribute","managed","split","preserved","getAttribute","filter","token","includes","describedBy","removeAttribute","matches","__decorate","property","reflect","prototype","type","customElement"],"mappings":"soCAYA,IAAIA,EAAgB,EAChBC,EAAe,EA6BEC,EAAN,cAAoBC,EAAoBC,IAAxC,WAAAC,uBAQgBC,KAAWC,YAA6C,WAMzCD,KAAOE,SAAG,EAKVF,KAAQG,UAAG,EAG/CH,KAAAI,SAAW,IAAIC,EAAgBL,KAA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W,EACFT,EAAOC,aAAa,mBAAoBQ,GAGxCT,EAAOU,gBAAgB,oBAGrBnC,EAAMxC,QACRiE,EAAOC,aAAa,eAAgB,QAGpCD,EAAOU,gBAAgB,gBAIzB7E,KAAKe,YAAYoD,EAAOW,QAAQ,cACjC,GA1L4BC,EAAA,CAA5BC,EAAS,CAAEC,SAAS,KAA0ErF,EAAAsF,UAAA,mBAAA,GAMnDH,EAAA,CAA3CC,EAAS,CAAEC,SAAS,EAAME,KAAMxC,WAA0B/C,EAAAsF,UAAA,eAAA,GAKfH,EAAA,CAA3CC,EAAS,CAAEC,SAAS,EAAME,KAAMxC,WAA2B/C,EAAAsF,UAAA,gBAAA,GAnBzCtF,EAAKmF,EAAA,CADzBK,EAAc,eACMxF,SAAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{_ as e}from"./tslib.es6-CmLYFWVC.js";import{css as o,LitElement as t}from"lit";import{customElement as r}from"lit/decorators.js";import{i as n}from"./light-dom-styles-DXsbiKU9.js";const l=o`nord-field-content{box-sizing:border-box;display:flex;flex-direction:column;gap:var(--n-space-xs)}nord-field-content>nord-field-label{margin-block-end:0}`;let s=class extends t{connectedCallback(){super.connectedCallback(),n(this,l)}createRenderRoot(){return this}};s=e([r("nord-field-content")],s);var i=s;export{i as default};
|
|
2
|
+
//# sourceMappingURL=FieldContent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FieldContent.js","sources":["../src/field/FieldContent.ts"],"sourcesContent":["import { LitElement } from 'lit'\nimport { customElement } from 'lit/decorators.js'\n\nimport { injectLightDomStyles } from '../common/light-dom-styles.js'\nimport style from './FieldContent.css'\n\n/**\n * Field Content wraps a [Field Label](/components/field-label/) and\n * [Field Description](/components/field-description/) so they stay aligned as a\n * single text block, which is especially useful in horizontal\n * [Field](/components/field/) layouts.\n *\n * @status draft\n * @category form\n * @lightDom true\n *\n * @slot - Default slot for the label and description.\n */\n@customElement('nord-field-content')\nexport default class FieldContent extends LitElement {\n connectedCallback() {\n super.connectedCallback()\n injectLightDomStyles(this, style)\n }\n\n protected createRenderRoot() {\n return this\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nord-field-content': FieldContent\n }\n}\n"],"names":["FieldContent","LitElement","connectedCallback","super","injectLightDomStyles","this","style","createRenderRoot","__decorate","customElement"],"mappings":"gWAmBe,IAAMA,EAAN,cAA2BC,EACxC,iBAAAC,GACEC,MAAMD,oBACNE,EAAqBC,KAAMC,EAC5B,CAES,gBAAAC,GACR,OAAOF,IACR,GARkBL,EAAYQ,EAAA,CADhCC,EAAc,uBACMT,SAAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{_ as e}from"./tslib.es6-CmLYFWVC.js";import{s as i}from"./context-consumer-BJVUulGf.js";import{css as t,nothing as r,html as l}from"lit";import{property as n}from"lit/decorators.js";import{fieldContext as o}from"./field-context.js";import{S as s}from"./SlotController-Z6eG7LSZ.js";import{i as d}from"./light-dom-styles-DXsbiKU9.js";import"./VisuallyHidden.js";const a=t`[data-field-control] .n-caption{font-size:var(--n-font-size-s);line-height:var(--n-line-height-caption)}[data-field-control] .n-label-container{display:inline-block;margin-block-end:var(--n-space-s)}[data-field-control] .n-label,[data-field-control] label{color:var(--n-label-color,var(--n-color-text));display:block;font-family:var(--n-font-family);font-size:var(--n-font-size-m);font-weight:var(--n-font-weight-heading);line-height:var(--n-line-height-heading);margin:0}[data-field-control] .n-hint{color:var(--n-color-text-weaker);padding-block-start:var(--n-space-xs)}[data-field-control][hint-below] .n-hint{margin-block-start:var(--n-space-s);padding-block-start:0}[data-field-control][hint-below] .n-error:not([hidden])+.n-hint{margin-block-start:var(--n-space-xs)}[data-field-control][size=s] .n-label,[data-field-control][size=s] label{font-size:var(--n-font-size-s)}[data-field-control] .n-error{color:var(--n-color-text-error);margin-block-start:var(--n-space-s)}[data-field-control] .n-required{color:var(--n-color-status-danger);margin-inline-start:var(--n-space-xs)}`;function h(t){class h extends t{constructor(){super(...arguments),this.labelSlot=new s(this,"label"),this.errorSlot=new s(this,"error"),this.hintSlot=new s(this,"hint"),this.inputId="input",this.errorId="error",this.hintId="hint",this.label="",this.hintBelow=!1,this.hideLabel=!1,this.required=!1,this.hideRequired=!1,this.fieldConsumer=new i(this,{context:o,subscribe:!0,callback:()=>this.publishRequired()}),this.handleLabelFocus=e=>{var i;e.preventDefault(),null===(i=this.focus)||void 0===i||i.call(this,{focusVisible:!0})}}get insideField(){return void 0!==this.fieldConsumer.value}get effectiveDisabled(){var e,i;return null!==(i=null===(e=this.fieldConsumer.value)||void 0===e?void 0:e.disabled)&&void 0!==i&&i||Boolean(this.disabled)}get ownInvalid(){return this.hasError}get effectiveInvalid(){var e,i;return null!==(i=null===(e=this.fieldConsumer.value)||void 0===e?void 0:e.invalid)&&void 0!==i&&i||this.ownInvalid}connectedCallback(){super.connectedCallback(),this.publishRequired()}disconnectedCallback(){var e;null===(e=this.fieldConsumer.value)||void 0===e||e.setRequired(!1),super.disconnectedCallback()}get isLightDom(){return!(this.renderRoot instanceof ShadowRoot)}firstUpdated(e){super.firstUpdated(e),this.isLightDom&&(this.setAttribute("data-field-control",""),d(this,a,"n-field-control-light"))}updated(e){super.updated(e),e.has("required")&&this.publishRequired()}publishRequired(){var e;null===(e=this.fieldConsumer.value)||void 0===e||e.setRequired(this.required)}get labelFocusOnly(){return!1}renderLabel(e){if(this.insideField)return r;const i=l`<label for="${this.inputId}" @click="${this.labelFocusOnly?this.handleLabelFocus:r}"><slot name="label">${this.label}</slot><span ?hidden="${!this.required||this.hideRequired}" aria-hidden="true" class="n-required">*</span> ${e}</label>`;return this.hideLabel?l`<nord-visually-hidden>${i} ${this.isHintBelow?r:this.renderHint()}</nord-visually-hidden>`:l`<div class="n-label-container">${i} ${this.isHintBelow?r:this.renderHint()}</div>`}renderHint(){return this.insideField?r:l`<div class="n-caption n-hint" id="${this.hintId}" ?hidden="${!this.hasHint}"><slot name="hint">${this.hint}</slot></div>`}renderError(){return this.insideField?r:l`<div class="n-caption n-error" id="${this.errorId}" role="alert" ?hidden="${!this.hasError}"><slot name="error">${this.error}</slot></div>`}getDescribedBy(){const{hasHint:e,hasError:i}=this;return e&&i?this.isHintBelow?`${this.errorId} ${this.hintId}`:`${this.hintId} ${this.errorId}`:e?this.hintId:i?this.errorId:void 0}getInvalid(){return this.hasError?"true":void 0}get controlAriaLabel(){var e,i;const t=this.insideField&&!this.isLightDom?null===(e=this.fieldConsumer.value)||void 0===e?void 0:e.labelText:void 0;return null!==(i=null!=t?t:this.getAttribute("aria-label"))&&void 0!==i?i:void 0}get controlAriaLabelledby(){var e,i;if(!this.isLightDom)return;const t=this.insideField?null===(e=this.fieldConsumer.value)||void 0===e?void 0:e.labelId:void 0;return null!==(i=null!=t?t:this.getAttribute("aria-labelledby"))&&void 0!==i?i:void 0}get controlAriaDescribedby(){var e;return[this.insideField?null===(e=this.fieldConsumer.value)||void 0===e?void 0:e.describedById:this.getDescribedBy(),this.getAttribute("aria-describedby")].filter(Boolean).join(" ")||void 0}get controlAriaInvalid(){return this.effectiveInvalid?"true":void 0}get hasHint(){return!this.insideField&&(Boolean(this.hint)||this.hintSlot.hasContent)}get hasError(){return!this.insideField&&(Boolean(this.error)||this.errorSlot.hasContent)}get isHintBelow(){return this.hintBelow}}return e([n({reflect:!0})],h.prototype,"label",void 0),e([n({reflect:!0})],h.prototype,"hint",void 0),e([n({reflect:!0,type:Boolean,attribute:"hint-below"})],h.prototype,"hintBelow",void 0),e([n({reflect:!0,type:Boolean,attribute:"hide-label"})],h.prototype,"hideLabel",void 0),e([n({reflect:!0})],h.prototype,"error",void 0),e([n({reflect:!0,type:Boolean})],h.prototype,"required",void 0),e([n({reflect:!0,type:Boolean,attribute:"hide-required"})],h.prototype,"hideRequired",void 0),h}export{h as F};
|
|
2
|
+
//# sourceMappingURL=FieldControlMixin-BXNZJXu9.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FieldControlMixin-BXNZJXu9.js","sources":["../src/common/mixins/FieldControlMixin.ts"],"sourcesContent":["import type { LitElement, PropertyValues, TemplateResult } from 'lit'\nimport { ContextConsumer } from '@lit/context'\nimport { html, nothing } from 'lit'\nimport { property } from 'lit/decorators.js'\nimport { fieldContext } from '../../field/field-context.js'\nimport { SlotController } from '../controllers/SlotController.js'\nimport { injectLightDomStyles } from '../light-dom-styles.js'\nimport fieldControlLightStyle from '../styles/FieldControlLight.css'\nimport '../../visually-hidden/VisuallyHidden.js'\n\ntype Constructor<T = Record<string, unknown>> = new (...args: any[]) => T\n\nexport declare class FieldControlMixinInterface {\n label: string\n hint?: string\n hintBelow: boolean\n hideLabel: boolean\n error?: string\n required: boolean\n hideRequired: boolean\n\n protected inputId: string\n protected errorId: string\n protected hintId: string\n protected labelSlot: SlotController\n protected hintSlot: SlotController\n protected errorSlot: SlotController\n\n /** True while the control is inside a `<nord-field>` (reactive). */\n readonly insideField: boolean\n\n /** `disabled` merged with the field's disabled (either activates it). */\n protected get effectiveDisabled(): boolean\n /** `invalid` merged from the field and the control's own invalid state. */\n protected get effectiveInvalid(): boolean\n /** The control's own invalid state. Defaults to `hasError`; override on controls with an `invalid` prop. */\n protected get ownInvalid(): boolean\n\n protected get hasHint(): boolean\n protected get hasError(): boolean\n protected get isHintBelow(): boolean\n /** When true, a label click focuses the control instead of activating it. */\n protected get labelFocusOnly(): boolean\n\n /** `aria-label` for the inner focusable — shadow-DOM controls inside a field only. */\n protected get controlAriaLabel(): string | undefined\n /** `aria-labelledby` for the inner focusable — light-DOM controls inside a field only. */\n protected get controlAriaLabelledby(): string | undefined\n /** `aria-describedby` for the inner focusable — field ids inside a field, built-in ids standalone. */\n protected get controlAriaDescribedby(): string | undefined\n /** `aria-invalid` for the inner focusable. */\n protected get controlAriaInvalid(): 'true' | undefined\n\n protected renderLabel(additionalContent?: TemplateResult): TemplateResult | typeof nothing\n protected renderHint(): TemplateResult | typeof nothing\n protected renderError(): TemplateResult | typeof nothing\n protected getDescribedBy(): string | undefined\n protected getInvalid(): 'true' | undefined\n}\n\n/**\n * Gives a form control its built-in field UI (label, hint, error, required\n * indicator) AND makes it a consumer of the [Field](/components/field/) context.\n *\n * - **Standalone:** the control renders its own label/hint/error from these props.\n * - **Inside `<nord-field>`:** the control suppresses its built-in field UI and\n * the field parts take over. The control reads its accessible name,\n * description and invalid/disabled state from the field context.\n *\n * The control owns `required`; it publishes it up so `<nord-field-label>` can\n * render the indicator.\n */\nexport function FieldControlMixin<T extends Constructor<LitElement>>(superClass: T) {\n /**\n * @slot label - Use when a label requires more than plain text.\n * @slot hint - Optional slot that holds hint text for the control.\n * @slot error - Optional slot that holds error text for the control.\n */\n class FieldControlElement extends superClass {\n protected labelSlot = new SlotController(this, 'label')\n protected errorSlot = new SlotController(this, 'error')\n protected hintSlot = new SlotController(this, 'hint')\n\n protected inputId = 'input'\n protected errorId = 'error'\n protected hintId = 'hint'\n\n /**\n * Label for the control. Ignored when the control is wrapped in a\n * `<nord-field>`, which provides the label via `<nord-field-label>`.\n */\n @property({ reflect: true }) label: string = ''\n\n /**\n * Optional hint text shown with the control. Ignored inside a `<nord-field>`,\n * which provides it via `<nord-field-description>`.\n */\n @property({ reflect: true }) hint?: string\n\n /**\n * Renders the hint below the control and any error instead of below the label.\n */\n @property({ reflect: true, type: Boolean, attribute: 'hint-below' }) hintBelow = false\n\n /**\n * Visually hide the label, but still expose it to assistive technologies.\n */\n @property({ reflect: true, type: Boolean, attribute: 'hide-label' }) hideLabel = false\n\n /**\n * Optional error shown with the control. Ignored inside a `<nord-field>`,\n * which provides it via `<nord-field-error>`.\n */\n @property({ reflect: true }) error?: string\n\n /**\n * Determines whether the control is required or not.\n * A required control is announced as such to assistive technology and, inside\n * a `<nord-field>`, drives the required indicator on the `<nord-field-label>`.\n * When using this property you need to also set “novalidate” attribute on a form element to prevent browser from displaying its own validation errors.\n */\n @property({ reflect: true, type: Boolean }) required = false\n\n /**\n * Visually hide the required indicator, but still expose the required state\n * to assistive technologies.\n */\n @property({ reflect: true, type: Boolean, attribute: 'hide-required' }) hideRequired = false\n\n /** Reactive consumer of the enclosing Field's context. */\n private fieldConsumer = new ContextConsumer(this, {\n context: fieldContext,\n subscribe: true,\n // Re-publish `required` whenever the field context resolves or changes, so\n // a control that upgraded before its Field still surfaces its indicator.\n callback: () => this.publishRequired(),\n })\n\n get insideField() {\n return this.fieldConsumer.value !== undefined\n }\n\n protected get effectiveDisabled() {\n // Every form control exposes `disabled` (via InputMixin or its own prop),\n // but we don't constrain the superclass to it so control-only components\n // can keep their own. Read it loosely.\n return (this.fieldConsumer.value?.disabled ?? false) || Boolean((this as { disabled?: boolean }).disabled)\n }\n\n protected get ownInvalid() {\n return this.hasError\n }\n\n protected get effectiveInvalid() {\n return (this.fieldConsumer.value?.invalid ?? false) || this.ownInvalid\n }\n\n connectedCallback() {\n super.connectedCallback()\n this.publishRequired()\n }\n\n disconnectedCallback() {\n // Stop marking the field required when the control leaves it.\n this.fieldConsumer.value?.setRequired(false)\n super.disconnectedCallback()\n }\n\n /**\n * Whether the control renders in light DOM. True both when the render root is\n * the host itself and when it is a light-DOM child wrapper (e.g. the combobox\n * renders into a `.n-render-root` div so it can keep slotted children). Only a\n * real `ShadowRoot` counts as shadow DOM.\n */\n protected get isLightDom() {\n return !(this.renderRoot instanceof ShadowRoot)\n }\n\n protected firstUpdated(changed: PropertyValues) {\n super.firstUpdated(changed)\n // Light-DOM controls render the field UI in light DOM, so they need the field\n // styles injected (scoped under data-field-control so they don't leak).\n // Shadow-DOM controls already bundle FormField.css.\n if (this.isLightDom) {\n this.setAttribute('data-field-control', '')\n injectLightDomStyles(this, fieldControlLightStyle, 'n-field-control-light')\n }\n }\n\n protected updated(changed: PropertyValues) {\n super.updated(changed)\n if (changed.has('required')) {\n this.publishRequired()\n }\n }\n\n private publishRequired() {\n this.fieldConsumer.value?.setRequired(this.required)\n }\n\n /**\n * When true, clicking the label focuses the control (showing the focus ring)\n * instead of activating it — for popup-trigger controls (e.g. Date Range\n * Picker) where a native `<label for>` would otherwise open the popup on\n * click. Keyboard Space/Enter on the focused control still activates it.\n */\n protected get labelFocusOnly(): boolean {\n return false\n }\n\n private handleLabelFocus = (e: Event) => {\n // Don't let the label forward an activating click to the control; focus it\n // (with the keyboard focus ring) instead.\n e.preventDefault()\n ;(this as unknown as { focus: (o?: FocusOptions) => void }).focus?.({ focusVisible: true } as FocusOptions)\n }\n\n protected renderLabel(additionalContent?: TemplateResult) {\n // Inside a Field, the <nord-field-label> is the only visible label.\n if (this.insideField) {\n return nothing\n }\n\n const label = html`\n <label for=${this.inputId} @click=${this.labelFocusOnly ? this.handleLabelFocus : nothing}>\n <slot name=\"label\">${this.label}</slot\n ><span ?hidden=${!this.required || this.hideRequired} aria-hidden=\"true\" class=\"n-required\">*</span>\n ${additionalContent}\n </label>\n `\n\n if (this.hideLabel) {\n return html`\n <nord-visually-hidden>\n ${label}\n ${this.isHintBelow ? nothing : this.renderHint()}\n </nord-visually-hidden>\n `\n }\n\n return html`\n <div class=\"n-label-container\">\n ${label}\n ${this.isHintBelow ? nothing : this.renderHint()}\n </div>\n `\n }\n\n protected renderHint() {\n if (this.insideField) {\n return nothing\n }\n return html`\n <div class=\"n-caption n-hint\" id=${this.hintId} ?hidden=${!this.hasHint}>\n <slot name=\"hint\">${this.hint}</slot>\n </div>\n `\n }\n\n protected renderError() {\n if (this.insideField) {\n return nothing\n }\n return html`\n <div class=\"n-caption n-error\" id=${this.errorId} role=\"alert\" ?hidden=${!this.hasError}>\n <slot name=\"error\">${this.error}</slot>\n </div>\n `\n }\n\n protected getDescribedBy() {\n const { hasHint, hasError } = this\n\n if (hasHint && hasError) {\n if (this.isHintBelow) {\n return `${this.errorId} ${this.hintId}`\n }\n return `${this.hintId} ${this.errorId}`\n }\n if (hasHint) {\n return this.hintId\n }\n if (hasError) {\n return this.errorId\n }\n\n return undefined\n }\n\n protected getInvalid() {\n return this.hasError ? 'true' : undefined\n }\n\n protected get controlAriaLabel() {\n // Shadow-DOM controls can't reference the light-DOM label id, so they take\n // the label text as an aria-label instead. A consumer-set host `aria-label`\n // is honoured as a fallback (and lets a composing parent name the inner control).\n const fromContext = this.insideField && !this.isLightDom ? this.fieldConsumer.value?.labelText : undefined\n return fromContext ?? this.getAttribute('aria-label') ?? undefined\n }\n\n protected get controlAriaLabelledby() {\n // Only light-DOM controls can resolve a light-DOM IDREF across the tree.\n if (!this.isLightDom) {\n return undefined\n }\n const fromContext = this.insideField ? this.fieldConsumer.value?.labelId : undefined\n return fromContext ?? this.getAttribute('aria-labelledby') ?? undefined\n }\n\n protected get controlAriaDescribedby() {\n const fromField = this.insideField ? this.fieldConsumer.value?.describedById : this.getDescribedBy()\n // Merge a consumer-set host `aria-describedby` (e.g. a composing parent).\n return [fromField, this.getAttribute('aria-describedby')].filter(Boolean).join(' ') || undefined\n }\n\n protected get controlAriaInvalid() {\n return this.effectiveInvalid ? 'true' : undefined\n }\n\n protected get hasHint() {\n return !this.insideField && (Boolean(this.hint) || this.hintSlot.hasContent)\n }\n\n protected get hasError() {\n return !this.insideField && (Boolean(this.error) || this.errorSlot.hasContent)\n }\n\n protected get isHintBelow() {\n return this.hintBelow\n }\n }\n\n return FieldControlElement as unknown as Constructor<FieldControlMixinInterface> & T\n}\n"],"names":["FieldControlMixin","superClass","FieldControlElement","constructor","this","labelSlot","SlotController","errorSlot","hintSlot","inputId","errorId","hintId","label","hintBelow","hideLabel","required","hideRequired","fieldConsumer","ContextConsumer","context","fieldContext","subscribe","callback","publishRequired","handleLabelFocus","e","preventDefault","_b","focus","call","focusVisible","insideField","undefined","value","effectiveDisabled","_a","disabled","Boolean","ownInvalid","hasError","effectiveInvalid","invalid","connectedCallback","super","disconnectedCallback","setRequired","isLightDom","renderRoot","ShadowRoot","firstUpdated","changed","setAttribute","injectLightDomStyles","fieldControlLightStyle","updated","has","labelFocusOnly","renderLabel","additionalContent","nothing","html","isHintBelow","renderHint","hasHint","hint","renderError","error","getDescribedBy","getInvalid","controlAriaLabel","fromContext","labelText","getAttribute","controlAriaLabelledby","labelId","controlAriaDescribedby","describedById","filter","join","controlAriaInvalid","hasContent","__decorate","property","reflect","prototype","type","attribute"],"mappings":"m7CAwEM,SAAUA,EAAqDC,GAMnE,MAAMC,UAA4BD,EAAlC,WAAAE,uBACYC,KAASC,UAAG,IAAIC,EAAeF,KAAM,SACrCA,KAASG,UAAG,IAAID,EAAeF,KAAM,SACrCA,KAAQI,SAAG,IAAIF,EAAeF,KAAM,QAEpCA,KAAOK,QAAG,QACVL,KAAOM,QAAG,QACVN,KAAMO,OAAG,OAMUP,KAAKQ,MAAW,GAWwBR,KAASS,WAAG,EAKZT,KAASU,WAAG,EAcrCV,KAAQW,UAAG,EAMiBX,KAAYY,cAAG,EAG/EZ,KAAAa,cAAgB,IAAIC,EAAgBd,KAAM,CAChDe,QAASC,EACTC,WAAW,EAGXC,SAAU,IAAMlB,KAAKmB,oBA2EfnB,KAAAoB,iBAAoBC,UAG1BA,EAAEC,iBAC+D,QAAhEC,EAACvB,KAA0DwB,aAAK,IAAAD,GAAAA,EAAAE,KAA/DzB,KAAkE,CAAE0B,cAAc,GAAuB,CAqH9G,CAjMC,eAAIC,GACF,YAAoCC,IAA7B5B,KAAKa,cAAcgB,KAC3B,CAED,qBAAcC,WAIZ,iBAAkC,QAA1BC,EAAA/B,KAAKa,cAAcgB,aAAO,IAAAE,OAAA,EAAAA,EAAAC,0BAAsBC,QAASjC,KAAgCgC,SAClG,CAED,cAAcE,GACZ,OAAOlC,KAAKmC,QACb,CAED,oBAAcC,WACZ,eAAQb,EAA0B,QAA1BQ,EAAA/B,KAAKa,cAAcgB,aAAO,IAAAE,OAAA,EAAAA,EAAAM,yBAAqBrC,KAAKkC,UAC7D,CAED,iBAAAI,GACEC,MAAMD,oBACNtC,KAAKmB,iBACN,CAED,oBAAAqB,iBAEET,EAAA/B,KAAKa,cAAcgB,sBAAOY,aAAY,GACtCF,MAAMC,sBACP,CAQD,cAAcE,GACZ,QAAS1C,KAAK2C,sBAAsBC,WACrC,CA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,CAApEC,EAAS,CAAEC,SAAS,EAAME,KAAMhD,QAASiD,UAAW,gBAAiCpF,EAAAkF,UAAA,iBAAA,GAMzDH,EAAA,CAA5BC,EAAS,CAAEC,SAAS,KAAsBjF,EAAAkF,UAAA,aAAA,GAQCH,EAAA,CAA3CC,EAAS,CAAEC,SAAS,EAAME,KAAMhD,WAA2BnC,EAAAkF,UAAA,gBAAA,GAMYH,EAAA,CAAvEC,EAAS,CAAEC,SAAS,EAAME,KAAMhD,QAASiD,UAAW,mBAAuCpF,EAAAkF,UAAA,oBAAA,GA8MvFlF,CACT"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{_ as o}from"./tslib.es6-CmLYFWVC.js";import{css as t,LitElement as e}from"lit";import{customElement as r}from"lit/decorators.js";import{i}from"./light-dom-styles-DXsbiKU9.js";const n=t`nord-field-description{box-sizing:border-box;color:var(--n-color-text-weaker);display:block;font-family:var(--n-font-family);font-size:var(--n-font-size-s);line-height:var(--n-line-height-caption);margin:0}`;let s=class extends e{connectedCallback(){super.connectedCallback(),i(this,n)}createRenderRoot(){return this}};s=o([r("nord-field-description")],s);var a=s;export{a as default};
|
|
2
|
+
//# sourceMappingURL=FieldDescription.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FieldDescription.js","sources":["../src/field/FieldDescription.ts"],"sourcesContent":["import { LitElement } from 'lit'\nimport { customElement } from 'lit/decorators.js'\n\nimport { injectLightDomStyles } from '../common/light-dom-styles.js'\nimport style from './FieldDescription.css'\n\n/**\n * Field Description is the helper or hint text for a [Field](/components/field/).\n * It is styled to match the hint text used by Nord form controls such as\n * [Input](/components/input/).\n *\n * @status draft\n * @category form\n * @lightDom true\n *\n * @slot - Default slot for the description text.\n */\n@customElement('nord-field-description')\nexport default class FieldDescription extends LitElement {\n connectedCallback() {\n super.connectedCallback()\n injectLightDomStyles(this, style)\n }\n\n protected createRenderRoot() {\n return this\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nord-field-description': FieldDescription\n }\n}\n"],"names":["FieldDescription","LitElement","connectedCallback","super","injectLightDomStyles","this","style","createRenderRoot","__decorate","customElement"],"mappings":"gZAkBe,IAAMA,EAAN,cAA+BC,EAC5C,iBAAAC,GACEC,MAAMD,oBACNE,EAAqBC,KAAMC,EAC5B,CAES,gBAAAC,GACR,OAAOF,IACR,GARkBL,EAAgBQ,EAAA,CADpCC,EAAc,2BACMT,SAAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{_ as t}from"./tslib.es6-CmLYFWVC.js";import{css as r,LitElement as e}from"lit";import{customElement as i}from"lit/decorators.js";import{i as o}from"./light-dom-styles-DXsbiKU9.js";const s=r`nord-field-error{box-sizing:border-box;color:var(--n-color-text-error);display:block;font-family:var(--n-font-family);font-size:var(--n-font-size-s);line-height:var(--n-line-height-caption);margin:0}`;let a=class extends e{connectedCallback(){super.connectedCallback(),o(this,s),this.hasAttribute("role")||this.setAttribute("role","alert"),this.hasAttribute("aria-live")||this.setAttribute("aria-live","polite")}createRenderRoot(){return this}};a=t([i("nord-field-error")],a);var l=a;export{l as default};
|
|
2
|
+
//# sourceMappingURL=FieldError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FieldError.js","sources":["../src/field/FieldError.ts"],"sourcesContent":["import { LitElement } from 'lit'\nimport { customElement } from 'lit/decorators.js'\n\nimport { injectLightDomStyles } from '../common/light-dom-styles.js'\nimport style from './FieldError.css'\n\n/**\n * Field Error displays validation error text for a [Field](/components/field/).\n * It is styled to match the error text used by Nord form controls such as\n * [Input](/components/input/).\n *\n * Exposes itself as a live region (`role=\"alert\"`, `aria-live=\"polite\"`) so the\n * message is announced when it appears. The message is supplied as the\n * element's children.\n *\n * @status draft\n * @category form\n * @lightDom true\n *\n * @slot - Default slot for the error message(s).\n */\n@customElement('nord-field-error')\nexport default class FieldError extends LitElement {\n connectedCallback() {\n super.connectedCallback()\n injectLightDomStyles(this, style)\n\n if (!this.hasAttribute('role')) {\n this.setAttribute('role', 'alert')\n }\n if (!this.hasAttribute('aria-live')) {\n this.setAttribute('aria-live', 'polite')\n }\n }\n\n protected createRenderRoot() {\n return this\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nord-field-error': FieldError\n }\n}\n"],"names":["FieldError","LitElement","connectedCallback","super","injectLightDomStyles","this","style","hasAttribute","setAttribute","createRenderRoot","__decorate","customElement"],"mappings":"8YAsBe,IAAMA,EAAN,cAAyBC,EACtC,iBAAAC,GACEC,MAAMD,oBACNE,EAAqBC,KAAMC,GAEtBD,KAAKE,aAAa,SACrBF,KAAKG,aAAa,OAAQ,SAEvBH,KAAKE,aAAa,cACrBF,KAAKG,aAAa,YAAa,SAElC,CAES,gBAAAC,GACR,OAAOJ,IACR,GAfkBL,EAAUU,EAAA,CAD9BC,EAAc,qBACMX,SAAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{_ as r}from"./tslib.es6-CmLYFWVC.js";import{css as o,LitElement as e}from"lit";import{customElement as a}from"lit/decorators.js";import{i as l}from"./light-dom-styles-DXsbiKU9.js";import{D as i}from"./DraftComponentMixin-4qug5Rky.js";const n=o`nord-field-group{--_n-field-group-gap:var(--n-field-group-gap,var(--n-space-l));display:flex;flex-direction:column;gap:var(--_n-field-group-gap)}nord-field-group,nord-field-group *,nord-field-group :after,nord-field-group :before{box-sizing:border-box}nord-field-group>nord-field-separator{margin-block-end:calc((var(--n-space-l) - var(--_n-field-group-gap))/2);margin-block-start:calc((var(--n-space-l) - var(--_n-field-group-gap))/2)}`;let d=class extends(i(e)){connectedCallback(){super.connectedCallback(),l(this,n)}createRenderRoot(){return this}};d=r([a("nord-field-group")],d);var p=d;export{p as default};
|
|
2
|
+
//# sourceMappingURL=FieldGroup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FieldGroup.js","sources":["../src/field/FieldGroup.ts"],"sourcesContent":["import { LitElement } from 'lit'\nimport { customElement } from 'lit/decorators.js'\n\nimport { injectLightDomStyles } from '../common/light-dom-styles.js'\nimport { DraftComponentMixin } from '../common/mixins/DraftComponentMixin.js'\nimport style from './FieldGroup.css'\n\n/**\n * Field Group stacks a set of [Field](/components/field/) controls vertically\n * with consistent spacing. Separate sections with a\n * [Field Separator](/components/field-separator/) when needed.\n *\n * @status draft\n * @category form\n * @lightDom true\n *\n * @slot - Default slot for [Field](/components/field/) and [Field Separator](/components/field-separator/) elements.\n *\n * @cssprop [--n-field-group-gap=var(--n-space-l)] - Controls the spacing between fields, using our [spacing tokens](/tokens/#space).\n */\n@customElement('nord-field-group')\nexport default class FieldGroup extends DraftComponentMixin(LitElement) {\n connectedCallback() {\n super.connectedCallback()\n injectLightDomStyles(this, style)\n }\n\n protected createRenderRoot() {\n return this\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nord-field-group': FieldGroup\n }\n}\n"],"names":["FieldGroup","DraftComponentMixin","LitElement","connectedCallback","super","injectLightDomStyles","this","style","createRenderRoot","__decorate","customElement"],"mappings":"irBAqBe,IAAMA,EAAN,cAAyBC,EAAoBC,IAC1D,iBAAAC,GACEC,MAAMD,oBACNE,EAAqBC,KAAMC,EAC5B,CAES,gBAAAC,GACR,OAAOF,IACR,GARkBN,EAAUS,EAAA,CAD9BC,EAAc,qBACMV,SAAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{_ as t}from"./tslib.es6-CmLYFWVC.js";import{css as e,LitElement as o}from"lit";import{property as n,customElement as l}from"lit/decorators.js";import{i}from"./light-dom-styles-DXsbiKU9.js";const r=e`nord-field-label{box-sizing:border-box;color:var(--n-color-text);display:block;font-family:var(--n-font-family);font-size:var(--n-font-size-m);font-weight:var(--n-font-weight-heading);line-height:var(--n-line-height-heading);margin:0}nord-field-label[for]{cursor:pointer;inline-size:fit-content}nord-field-label[required]:after{color:var(--n-color-status-danger);content:"*";margin-inline-start:var(--n-space-xs)}`;let s=0,c=class extends o{constructor(){super(...arguments),this.handleClick=t=>{var e,o;const n=this.controlForLabel();if(!n)return;const l=t.target;l instanceof Node&&(n===l||n.contains(l))||(n.labelFocusOnly?null===(o=(e=n).focus)||void 0===o||o.call(e,{focusVisible:!0}):("function"==typeof n.click&&n.click(),"function"==typeof n.focus&&n.focus()))}}connectedCallback(){super.connectedCallback(),i(this,r),this.id||(this.id="n-field-label-"+s++),this.addEventListener("click",this.handleClick)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("click",this.handleClick)}createRenderRoot(){return this}controlForLabel(){var t,e;if(this.for){const o=this.getRootNode();return null!==(e=null===(t=o.getElementById)||void 0===t?void 0:t.call(o,this.for))&&void 0!==e?e:null}const o=this.closest("nord-field");return o?this.controlInField(o):null}controlInField(t){for(const e of Array.from(t.children))if(e!==this&&!e.localName.startsWith("nord-field"))return e;return null}};t([n({reflect:!0})],c.prototype,"for",void 0),c=t([l("nord-field-label")],c);var a=c;export{a as default};
|
|
2
|
+
//# sourceMappingURL=FieldLabel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FieldLabel.js","sources":["../src/field/FieldLabel.ts"],"sourcesContent":["import { LitElement } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { injectLightDomStyles } from '../common/light-dom-styles.js'\nimport style from './FieldLabel.css'\n\nlet fieldLabelId = 0\n\n/**\n * Field Label is the label for a control inside a [Field](/components/field/).\n * It is styled to match the labels used by Nord form controls such as\n * [Input](/components/input/).\n *\n * The enclosing Field shares this label's id and text with the control through\n * context, so the control names itself (`aria-labelledby` for light-DOM controls,\n * `aria-label` for shadow-DOM ones) — no wiring needed. Set the `for` attribute to\n * a control's `id` to additionally get native-style click-to-focus.\n *\n * The required indicator is driven by the control: mark the control `required`\n * and the Field toggles this label's `required` attribute automatically.\n *\n * @status draft\n * @category form\n * @lightDom true\n *\n * @slot - Default slot for the label text.\n * @attr {boolean} required - Present while the control is required (set by the Field; not a settable prop).\n */\n@customElement('nord-field-label')\nexport default class FieldLabel extends LitElement {\n /**\n * The `id` of the control this label describes. Enables native-style\n * click-to-focus, mirroring the native `<label for>` attribute.\n */\n @property({ reflect: true }) for?: string\n\n private handleClick = (event: MouseEvent) => {\n const control = this.controlForLabel()\n if (!control) {\n return\n }\n\n // If the click originated from the control itself (e.g. the label wraps a\n // checkbox in a choice card), let the control handle it natively — otherwise\n // we'd re-dispatch click() and toggle it twice. This mirrors native `<label>`.\n const target = event.target\n if (target instanceof Node && (control === target || control.contains(target))) {\n return\n }\n\n // Popup-trigger controls (e.g. Date Range Picker) should focus on label click\n // — showing the focus ring — not open. Keyboard Space/Enter then activates.\n if ((control as { labelFocusOnly?: boolean }).labelFocusOnly) {\n ;(control as HTMLElement & { focus: (o?: FocusOptions) => void }).focus?.({ focusVisible: true } as FocusOptions)\n return\n }\n\n // Replicate native label behaviour: activate the associated control. Form\n // controls (checkbox, toggle, radio) toggle on click; text controls focus.\n if (typeof (control as HTMLElement & { click?: () => void }).click === 'function') {\n ;(control as HTMLElement & { click: () => void }).click()\n }\n if (typeof (control as HTMLElement & { focus?: () => void }).focus === 'function') {\n ;(control as HTMLElement & { focus: () => void }).focus()\n }\n }\n\n connectedCallback() {\n super.connectedCallback()\n injectLightDomStyles(this, style)\n\n if (!this.id) {\n this.id = `n-field-label-${fieldLabelId++}`\n }\n\n this.addEventListener('click', this.handleClick)\n }\n\n disconnectedCallback() {\n super.disconnectedCallback()\n this.removeEventListener('click', this.handleClick)\n }\n\n protected createRenderRoot() {\n return this\n }\n\n /** The control this label activates on click. */\n private controlForLabel(): Element | null {\n if (this.for) {\n const root = this.getRootNode() as Document | ShadowRoot\n return root.getElementById?.(this.for) ?? null\n }\n\n // No explicit `for`: activate the control in the enclosing Field, so\n // `<nord-field><nord-field-label>…</nord-field-label><nord-input></nord-input></nord-field>`\n // remains clickable.\n const field = this.closest('nord-field')\n return field ? this.controlInField(field) : null\n }\n\n /** The form control inside a Field — the first child that isn't a field part. */\n private controlInField(field: Element): Element | null {\n for (const el of Array.from(field.children)) {\n if (el === this || el.localName.startsWith('nord-field')) {\n continue\n }\n return el\n }\n return null\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nord-field-label': FieldLabel\n }\n}\n"],"names":["fieldLabelId","FieldLabel","LitElement","constructor","this","handleClick","event","control","controlForLabel","target","Node","contains","labelFocusOnly","_b","_a","focus","call","focusVisible","click","connectedCallback","super","injectLightDomStyles","style","id","addEventListener","disconnectedCallback","removeEventListener","createRenderRoot","for","root","getRootNode","getElementById","field","closest","controlInField","el","Array","from","children","localName","startsWith","__decorate","property","reflect","prototype","customElement"],"mappings":"6mBAMA,IAAIA,EAAe,EAuBEC,EAAN,cAAyBC,EAAzB,WAAAC,uBAOLC,KAAAC,YAAeC,YACrB,MAAMC,EAAUH,KAAKI,kBACrB,IAAKD,EACH,OAMF,MAAME,EAASH,EAAMG,OACjBA,aAAkBC,OAASH,IAAYE,GAAUF,EAAQI,SAASF,MAMjEF,EAAyCK,eAC2B,QAAtEC,GAAAC,EAACP,GAAgEQ,aAAK,IAAAF,GAAAA,EAAAG,KAAAF,EAAG,CAAEG,cAAc,KAMrB,mBAA3DV,EAAiDW,OACzDX,EAAgDW,QAEmB,mBAA3DX,EAAiDQ,OACzDR,EAAgDQ,SACnD,CA+CJ,CA5CC,iBAAAI,GACEC,MAAMD,oBACNE,EAAqBjB,KAAMkB,GAEtBlB,KAAKmB,KACRnB,KAAKmB,GAAK,iBAAiBvB,KAG7BI,KAAKoB,iBAAiB,QAASpB,KAAKC,YACrC,CAED,oBAAAoB,GACEL,MAAMK,uBACNrB,KAAKsB,oBAAoB,QAAStB,KAAKC,YACxC,CAES,gBAAAsB,GACR,OAAOvB,IACR,CAGO,eAAAI,WACN,GAAIJ,KAAKwB,IAAK,CACZ,MAAMC,EAAOzB,KAAK0B,cAClB,OAA0C,QAAnCjB,EAAmB,QAAnBC,EAAAe,EAAKE,sBAAc,IAAAjB,OAAA,EAAAA,EAAAE,KAAAa,EAAGzB,KAAKwB,YAAQ,IAAAf,EAAAA,EAAA,IAC3C,CAKD,MAAMmB,EAAQ5B,KAAK6B,QAAQ,cAC3B,OAAOD,EAAQ5B,KAAK8B,eAAeF,GAAS,IAC7C,CAGO,cAAAE,CAAeF,GACrB,IAAK,MAAMG,KAAMC,MAAMC,KAAKL,EAAMM,UAChC,GAAIH,IAAO/B,OAAQ+B,EAAGI,UAAUC,WAAW,cAG3C,OAAOL,EAET,OAAO,IACR,GA5E4BM,EAAA,CAA5BC,EAAS,CAAEC,SAAS,KAAoB1C,EAAA2C,UAAA,WAAA,GALtB3C,EAAUwC,EAAA,CAD9BI,EAAc,qBACM5C,SAAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{_ as e}from"./tslib.es6-CmLYFWVC.js";import{css as t,LitElement as i}from"lit";import{customElement as o}from"lit/decorators.js";import{i as n}from"./light-dom-styles-DXsbiKU9.js";const r=t`nord-field-legend{box-sizing:border-box;color:var(--n-color-text);display:block;font-family:var(--n-font-family);font-size:var(--n-font-size-l);font-weight:var(--n-font-weight-heading);line-height:var(--n-line-height-heading);margin:0}`;let l=0,s=class extends i{connectedCallback(){super.connectedCallback(),n(this,r),this.id||(this.id="n-field-legend-"+l++)}createRenderRoot(){return this}};s=e([o("nord-field-legend")],s);var a=s;export{a as default};
|
|
2
|
+
//# sourceMappingURL=FieldLegend.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FieldLegend.js","sources":["../src/field/FieldLegend.ts"],"sourcesContent":["import { LitElement } from 'lit'\nimport { customElement } from 'lit/decorators.js'\n\nimport { injectLightDomStyles } from '../common/light-dom-styles.js'\nimport style from './FieldLegend.css'\n\nlet fieldLegendId = 0\n\n/**\n * Field Legend labels a [Field Set](/components/field-set/), naming the group of\n * fields for assistive technology. Place it as the first child of a Field Set.\n *\n * @status draft\n * @category form\n * @lightDom true\n *\n * @slot - Default slot for the legend text.\n */\n@customElement('nord-field-legend')\nexport default class FieldLegend extends LitElement {\n connectedCallback() {\n super.connectedCallback()\n injectLightDomStyles(this, style)\n\n // A stable id lets the enclosing Field Set reference it via aria-labelledby.\n if (!this.id) {\n this.id = `n-field-legend-${fieldLegendId++}`\n }\n }\n\n protected createRenderRoot() {\n return this\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nord-field-legend': FieldLegend\n }\n}\n"],"names":["fieldLegendId","FieldLegend","LitElement","connectedCallback","super","injectLightDomStyles","this","style","id","createRenderRoot","__decorate","customElement"],"mappings":"kbAMA,IAAIA,EAAgB,EAaCC,EAAN,cAA0BC,EACvC,iBAAAC,GACEC,MAAMD,oBACNE,EAAqBC,KAAMC,GAGtBD,KAAKE,KACRF,KAAKE,GAAK,kBAAkBR,IAE/B,CAES,gBAAAS,GACR,OAAOH,IACR,GAbkBL,EAAWS,EAAA,CAD/BC,EAAc,sBACMV,SAAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{_ as r}from"./tslib.es6-CmLYFWVC.js";import{css as e,LitElement as t,html as o}from"lit";import{customElement as s}from"lit/decorators.js";import{i as a}from"./light-dom-styles-DXsbiKU9.js";const i=e`nord-field-separator{box-sizing:border-box;display:block}nord-field-separator hr{block-size:0;border:none;border-block-start:1px solid var(--n-color-border);margin:0}`;let d=class extends t{connectedCallback(){super.connectedCallback(),a(this,i),this.hasAttribute("aria-hidden")||this.setAttribute("aria-hidden","true")}createRenderRoot(){return this}render(){return o`<hr part="separator">`}};d=r([s("nord-field-separator")],d);var l=d;export{l as default};
|
|
2
|
+
//# sourceMappingURL=FieldSeparator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FieldSeparator.js","sources":["../src/field/FieldSeparator.ts"],"sourcesContent":["import { html, LitElement } from 'lit'\nimport { customElement } from 'lit/decorators.js'\n\nimport { injectLightDomStyles } from '../common/light-dom-styles.js'\nimport style from './FieldSeparator.css'\n\n/**\n * Field Separator draws a thin divider between sections inside a\n * [Field Group](/components/field-group/).\n *\n * @status draft\n * @category form\n * @lightDom true\n *\n * @part separator - The dividing line.\n */\n@customElement('nord-field-separator')\nexport default class FieldSeparator extends LitElement {\n connectedCallback() {\n super.connectedCallback()\n injectLightDomStyles(this, style)\n\n // A purely visual divider; hide it from assistive technology.\n if (!this.hasAttribute('aria-hidden')) {\n this.setAttribute('aria-hidden', 'true')\n }\n }\n\n // Renders its own divider markup; there are no user children to preserve.\n protected createRenderRoot() {\n return this\n }\n\n render() {\n return html`<hr part=\"separator\" />`\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nord-field-separator': FieldSeparator\n }\n}\n"],"names":["FieldSeparator","LitElement","connectedCallback","super","injectLightDomStyles","this","style","hasAttribute","setAttribute","createRenderRoot","render","html","__decorate","customElement"],"mappings":"uXAiBe,IAAMA,EAAN,cAA6BC,EAC1C,iBAAAC,GACEC,MAAMD,oBACNE,EAAqBC,KAAMC,GAGtBD,KAAKE,aAAa,gBACrBF,KAAKG,aAAa,cAAe,OAEpC,CAGS,gBAAAC,GACR,OAAOJ,IACR,CAED,MAAAK,GACE,OAAOC,CAAI,uBACZ,GAlBkBX,EAAcY,EAAA,CADlCC,EAAc,yBACMb,SAAAA"}
|
package/lib/FieldSet.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{_ as e}from"./tslib.es6-CmLYFWVC.js";import{css as t,LitElement as i}from"lit";import{property as r,customElement as o}from"lit/decorators.js";import{i as s}from"./light-dom-styles-DXsbiKU9.js";const d=t`nord-field-set{border:none;display:flex;flex-direction:column;gap:var(--n-space-m);margin:0;min-inline-size:0;padding:0}nord-field-set,nord-field-set *,nord-field-set :after,nord-field-set :before{box-sizing:border-box}`;let l=0,n=class extends i{constructor(){super(...arguments),this.disabled=!1}connectedCallback(){super.connectedCallback(),s(this,d),this.hasAttribute("role")||this.setAttribute("role","group")}createRenderRoot(){return this}firstUpdated(){this.linkLegend()}linkLegend(){const e=this.querySelector(":scope > nord-field-legend");e&&(e.id||(e.id="n-field-set-legend-"+l++),this.setAttribute("aria-labelledby",e.id))}};e([r({reflect:!0,type:Boolean})],n.prototype,"disabled",void 0),n=e([o("nord-field-set")],n);var a=n;export{a as default};
|
|
2
|
+
//# sourceMappingURL=FieldSet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FieldSet.js","sources":["../src/field/FieldSet.ts"],"sourcesContent":["import { LitElement } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { injectLightDomStyles } from '../common/light-dom-styles.js'\nimport style from './FieldSet.css'\n\nlet fallbackLegendId = 0\n\n/**\n * Field Set groups related fields under a [Field Legend](/components/field-legend/)\n * for semantic, accessible grouping. It exposes `role=\"group\"` named by its\n * legend; wrap a [Field Group](/components/field-group/) inside.\n *\n * @status draft\n * @category form\n * @lightDom true\n *\n * @slot - Default slot for a [Field Legend](/components/field-legend/) and a [Field Group](/components/field-group/).\n */\n@customElement('nord-field-set')\nexport default class FieldSet extends LitElement {\n /**\n * Disables every field in the set. Each enclosed [Field](/components/field/)\n * reads this and cascades it to its control.\n */\n @property({ reflect: true, type: Boolean }) disabled = false\n\n connectedCallback() {\n super.connectedCallback()\n injectLightDomStyles(this, style)\n\n if (!this.hasAttribute('role')) {\n this.setAttribute('role', 'group')\n }\n }\n\n protected createRenderRoot() {\n return this\n }\n\n protected firstUpdated() {\n this.linkLegend()\n }\n\n // Name the group with its legend via aria-labelledby (the light-DOM\n // equivalent of a native `<fieldset>`/`<legend>` relationship).\n private linkLegend() {\n const legend = this.querySelector(':scope > nord-field-legend')\n if (!legend) {\n return\n }\n if (!legend.id) {\n legend.id = `n-field-set-legend-${fallbackLegendId++}`\n }\n this.setAttribute('aria-labelledby', legend.id)\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nord-field-set': FieldSet\n }\n}\n"],"names":["fallbackLegendId","FieldSet","LitElement","constructor","this","disabled","connectedCallback","super","injectLightDomStyles","style","hasAttribute","setAttribute","createRenderRoot","firstUpdated","linkLegend","legend","querySelector","id","__decorate","property","reflect","type","Boolean","prototype","customElement"],"mappings":"gbAMA,IAAIA,EAAmB,EAcFC,EAAN,cAAuBC,EAAvB,WAAAC,uBAK+BC,KAAQC,UAAG,CA+BxD,CA7BC,iBAAAC,GACEC,MAAMD,oBACNE,EAAqBJ,KAAMK,GAEtBL,KAAKM,aAAa,SACrBN,KAAKO,aAAa,OAAQ,QAE7B,CAES,gBAAAC,GACR,OAAOR,IACR,CAES,YAAAS,GACRT,KAAKU,YACN,CAIO,UAAAA,GACN,MAAMC,EAASX,KAAKY,cAAc,8BAC7BD,IAGAA,EAAOE,KACVF,EAAOE,GAAK,sBAAsBjB,KAEpCI,KAAKO,aAAa,kBAAmBI,EAAOE,IAC7C,GA9B2CC,EAAA,CAA3CC,EAAS,CAAEC,SAAS,EAAMC,KAAMC,WAA2BrB,EAAAsB,UAAA,gBAAA,GALzCtB,EAAQiB,EAAA,CAD5BM,EAAc,mBACMvB,SAAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{_ as t}from"./tslib.es6-CmLYFWVC.js";import{css as e,LitElement as i}from"lit";import{customElement as o}from"lit/decorators.js";import{i as r}from"./light-dom-styles-DXsbiKU9.js";const n=e`nord-field-title{align-items:center;box-sizing:border-box;color:var(--n-color-text);display:flex;font-family:var(--n-font-family);font-size:var(--n-font-size-m);font-weight:var(--n-font-weight-active);gap:var(--n-space-s);line-height:var(--n-line-height-heading)}`;let a=class extends i{connectedCallback(){super.connectedCallback(),r(this,n)}createRenderRoot(){return this}};a=t([o("nord-field-title")],a);var l=a;export{l as default};
|
|
2
|
+
//# sourceMappingURL=FieldTitle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FieldTitle.js","sources":["../src/field/FieldTitle.ts"],"sourcesContent":["import { LitElement } from 'lit'\nimport { customElement } from 'lit/decorators.js'\n\nimport { injectLightDomStyles } from '../common/light-dom-styles.js'\nimport style from './FieldTitle.css'\n\n/**\n * Field Title is an emphasized inline title used inside choice-card style\n * [Field](/components/field/) layouts, where a [Field Label](/components/field-label/)\n * wraps a whole selectable field.\n *\n * @status draft\n * @category form\n * @lightDom true\n *\n * @slot - Default slot for the title text.\n */\n@customElement('nord-field-title')\nexport default class FieldTitle extends LitElement {\n connectedCallback() {\n super.connectedCallback()\n injectLightDomStyles(this, style)\n }\n\n protected createRenderRoot() {\n return this\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nord-field-title': FieldTitle\n }\n}\n"],"names":["FieldTitle","LitElement","connectedCallback","super","injectLightDomStyles","this","style","createRenderRoot","__decorate","customElement"],"mappings":"8cAkBe,IAAMA,EAAN,cAAyBC,EACtC,iBAAAC,GACEC,MAAMD,oBACNE,EAAqBC,KAAMC,EAC5B,CAES,gBAAAC,GACR,OAAOF,IACR,GARkBL,EAAUQ,EAAA,CAD9BC,EAAc,qBACMT,SAAAA"}
|
package/lib/Fieldset2.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{_ as e}from"./tslib.es6-CmLYFWVC.js";import{css as t,LitElement as i,html as r,nothing as o}from"lit";import{property as s,customElement as n}from"lit/decorators.js";import{S as h}from"./SlotController-Z6eG7LSZ.js";import{c as l}from"./cond-CI1KbneT.js";import{s as d}from"./Component-BJ5O5n8k.js";import{s as a}from"./FormField-CMgEFZCK.js";import"./EventController-BBOmvfLa.js";const p=t`fieldset{border:none}.n-label-container{margin-block-end:calc(var(--n-space-s)*2)}:host([size=s]) .n-label-container{margin-block-end:var(--n-space-s)}.n-hidden{overflow:hidden;position:absolute;clip:rect(0 0 0 0);block-size:1px;clip-path:inset(50%);inline-size:1px;white-space:nowrap}`;let c=class extends i{constructor(){super(...arguments),this.errorSlot=new h(this,"error"),this.hintSlot=new h(this,"hint"),this.errorId="error",this.hintId="hint",this.label="",this.hintBelow=!1,this.required=!1,this.hideRequired=!1,this.hideLabel=!1,this.size="m"}render(){const{hasError:e}=this;return r`<fieldset aria-invalid="${l(e,"true")}" aria-describedby="${l(this.getDescribedBy())}" aria-required="${l(this.required,"true")}"><legend class="n-label-container ${this.hideLabel?"n-hidden":""}"><div class="n-label"><slot name="label">${this.label}</slot><span aria-hidden="true" class="n-required" ?hidden="${!this.required||this.hideRequired}">*</span></div>${this.isHintBelow?o:this.renderHint()}</legend><slot></slot><div class="n-caption n-error" id="${this.errorId}" role="alert" ?hidden="${!this.hasError}"><slot name="error">${this.error}</slot></div>${this.isHintBelow?this.renderHint():o}</fieldset>`}renderHint(){return r`<div class="n-caption n-hint" id="${this.hintId}" ?hidden="${!this.hasHint}"><slot name="hint">${this.hint}</slot></div>`}getDescribedBy(){return this.isHintBelow?this.hasHint&&this.hasError?`${this.errorId} ${this.hintId}`:this.hasError?this.errorId:this.hasHint?this.hintId:void 0:this.hasError?this.errorId:void 0}get hasHint(){return Boolean(this.hint)||this.hintSlot.hasContent}get hasError(){return Boolean(this.error)||this.errorSlot.hasContent}get isHintBelow(){return this.hintBelow}};c.styles=[d,a,p],e([s({reflect:!0})],c.prototype,"label",void 0),e([s({reflect:!0})],c.prototype,"hint",void 0),e([s({reflect:!0,type:Boolean,attribute:"hint-below"})],c.prototype,"hintBelow",void 0),e([s({reflect:!0})],c.prototype,"error",void 0),e([s({reflect:!0,type:Boolean})],c.prototype,"required",void 0),e([s({reflect:!0,type:Boolean,attribute:"hide-required"})],c.prototype,"hideRequired",void 0),e([s({reflect:!0,type:Boolean,attribute:"hide-label"})],c.prototype,"hideLabel",void 0),e([s({reflect:!0})],c.prototype,"size",void 0),c=e([n("nord-fieldset")],c);var b=c;export{b as default};
|
|
2
|
+
//# sourceMappingURL=Fieldset2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Fieldset2.js","sources":["../src/fieldset/Fieldset.ts"],"sourcesContent":["import { html, LitElement, nothing } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nimport { SlotController } from '../common/controllers/SlotController.js'\nimport { cond } from '../common/directives/cond.js'\n\nimport componentStyle from '../common/styles/Component.css'\nimport formFieldStyle from '../common/styles/FormField.css'\nimport style from './Fieldset.css'\n\n/**\n * Deprecated: for new code, group related controls with the composable Field\n * family — see [grouping fields with Field](/components/field#radio).\n * `nord-fieldset` remains supported for backwards compatibility and is not\n * scheduled for removal.\n *\n * Fieldset is used for grouping sets of input components. It is necessary to use a\n * fieldset with radio and checkbox components, and can also be useful for logically\n * grouping other types of inputs.\n *\n * @deprecated Group related controls with the composable Field family instead — see\n * [grouping fields with Field](/components/field#radio). Kept for backwards\n * compatibility; not scheduled for removal.\n * @status deprecated\n * @category form\n * @slot label - Use when a label requires more than plain text.\n * @slot hint - Optional slot that holds hint text for the fieldset.\n * @slot error - Optional slot that holds error text for the fieldset.\n *\n * @cssprop [--n-label-color=var(--n-color-text)] - Controls the text color of the label, using our [color tokens](/tokens/#color).\n */\n@customElement('nord-fieldset')\nexport default class Fieldset extends LitElement {\n static styles = [componentStyle, formFieldStyle, style]\n\n private errorSlot = new SlotController(this, 'error')\n private hintSlot = new SlotController(this, 'hint')\n private errorId = 'error'\n private hintId = 'hint'\n\n /**\n * Label for the fieldset. Rendered as a `<legend>` element.\n */\n @property({ reflect: true }) label: string = ''\n\n /**\n * Optional hint text to be displayed with the input. Alternatively use the hint slot.\n */\n @property({ reflect: true }) hint?: string\n\n /**\n * Renders the hint below the grouped controls and any error instead of below the legend.\n */\n @property({ reflect: true, type: Boolean, attribute: 'hint-below' }) hintBelow = false\n\n /**\n * Optional error to be shown with the fieldset. Alternatively use the error slot.\n */\n @property({ reflect: true }) error?: string\n\n /**\n * Determines whether the fieldset is required or not.\n * A fieldset marked as required will be announced as such to users of assistive technology.\n * When using this property you need to also set “novalidate” attribute on a form element to prevent browser from displaying its own validation errors.\n */\n @property({ reflect: true, type: Boolean }) required = false\n\n /**\n * Visually hide the required indicator, but still show\n * required attribute to assistive technologies like screen readers.\n */\n @property({ reflect: true, type: Boolean, attribute: 'hide-required' }) hideRequired = false\n\n /**\n * Visually hide the label, but still show it to assistive technologies like screen readers.\n */\n @property({ reflect: true, type: Boolean, attribute: 'hide-label' }) hideLabel = false\n\n /**\n * The size of the label.\n */\n @property({ reflect: true }) size: 's' | 'm' = 'm'\n\n render() {\n const { hasError } = this\n\n return html`\n <fieldset\n aria-invalid=${cond(hasError, 'true')}\n aria-describedby=${cond(this.getDescribedBy())}\n aria-required=${cond(this.required, 'true')}\n >\n <legend class=\"n-label-container ${this.hideLabel ? 'n-hidden' : ''}\">\n <div class=\"n-label\">\n <slot name=\"label\">${this.label}</slot\n ><span aria-hidden=\"true\" class=\"n-required\" ?hidden=${!this.required || this.hideRequired}>*</span>\n </div>\n\n ${this.isHintBelow ? nothing : this.renderHint()}\n </legend>\n\n <slot></slot>\n\n <div class=\"n-caption n-error\" id=${this.errorId} role=\"alert\" ?hidden=${!this.hasError}>\n <slot name=\"error\">${this.error}</slot>\n </div>\n ${this.isHintBelow ? this.renderHint() : nothing}\n </fieldset>\n `\n }\n\n private renderHint() {\n return html`\n <div class=\"n-caption n-hint\" id=${this.hintId} ?hidden=${!this.hasHint}>\n <slot name=\"hint\">${this.hint}</slot>\n </div>\n `\n }\n\n private getDescribedBy() {\n if (!this.isHintBelow) {\n return this.hasError ? this.errorId : undefined\n }\n\n if (this.hasHint && this.hasError) {\n return `${this.errorId} ${this.hintId}`\n }\n\n if (this.hasError) {\n return this.errorId\n }\n\n if (this.hasHint) {\n return this.hintId\n }\n\n return undefined\n }\n\n protected get hasHint() {\n return Boolean(this.hint) || this.hintSlot.hasContent\n }\n\n protected get hasError() {\n return Boolean(this.error) || this.errorSlot.hasContent\n }\n\n private get isHintBelow() {\n return this.hintBelow\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nord-fieldset': Fieldset\n }\n}\n"],"names":["Fieldset","LitElement","constructor","this","errorSlot","SlotController","hintSlot","errorId","hintId","label","hintBelow","required","hideRequired","hideLabel","size","render","hasError","html","cond","getDescribedBy","isHintBelow","nothing","renderHint","error","hasHint","hint","undefined","Boolean","hasContent","styles","componentStyle","formFieldStyle","style","__decorate","property","reflect","prototype","type","attribute","customElement"],"mappings":"4qBA+Be,IAAMA,EAAN,cAAuBC,EAAvB,WAAAC,uBAGLC,KAASC,UAAG,IAAIC,EAAeF,KAAM,SACrCA,KAAQG,SAAG,IAAID,EAAeF,KAAM,QACpCA,KAAOI,QAAG,QACVJ,KAAMK,OAAG,OAKYL,KAAKM,MAAW,GAUwBN,KAASO,WAAG,EAYrCP,KAAQQ,UAAG,EAMiBR,KAAYS,cAAG,EAKlBT,KAASU,WAAG,EAKpDV,KAAIW,KAAc,GAqEhD,CAnEC,MAAAC,GACE,MAAMC,SAAEA,GAAab,KAErB,OAAOc,CAAI,2BAEQC,EAAKF,EAAU,8BACXE,EAAKf,KAAKgB,qCACbD,EAAKf,KAAKQ,SAAU,6CAEDR,KAAKU,UAAY,WAAa,+CAExCV,KAAKM,qEAC8BN,KAAKQ,UAAYR,KAAKS,+BAG9ET,KAAKiB,YAAcC,EAAUlB,KAAKmB,wEAKFnB,KAAKI,mCAAiCJ,KAAKa,gCACxDb,KAAKoB,qBAE1BpB,KAAKiB,YAAcjB,KAAKmB,aAAeD,cAG9C,CAEO,UAAAC,GACN,OAAOL,CAAI,qCAC0Bd,KAAKK,qBAAmBL,KAAKqB,8BAC1CrB,KAAKsB,mBAG9B,CAEO,cAAAN,GACN,OAAKhB,KAAKiB,YAINjB,KAAKqB,SAAWrB,KAAKa,SAChB,GAAGb,KAAKI,WAAWJ,KAAKK,SAG7BL,KAAKa,SACAb,KAAKI,QAGVJ,KAAKqB,QACArB,KAAKK,YADd,EAXSL,KAAKa,SAAWb,KAAKI,aAAUmB,CAgBzC,CAED,WAAcF,GACZ,OAAOG,QAAQxB,KAAKsB,OAAStB,KAAKG,SAASsB,UAC5C,CAED,YAAcZ,GACZ,OAAOW,QAAQxB,KAAKoB,QAAUpB,KAAKC,UAAUwB,UAC9C,CAED,eAAYR,GACV,OAAOjB,KAAKO,SACb,GApHMV,EAAM6B,OAAG,CAACC,EAAgBC,EAAgBC,GAUpBC,EAAA,CAA5BC,EAAS,CAAEC,SAAS,KAA0BnC,EAAAoC,UAAA,aAAA,GAKlBH,EAAA,CAA5BC,EAAS,CAAEC,SAAS,KAAqBnC,EAAAoC,UAAA,YAAA,GAK2BH,EAAA,CAApEC,EAAS,CAAEC,SAAS,EAAME,KAAMV,QAASW,UAAW,gBAAiCtC,EAAAoC,UAAA,iBAAA,GAKzDH,EAAA,CAA5BC,EAAS,CAAEC,SAAS,KAAsBnC,EAAAoC,UAAA,aAAA,GAOCH,EAAA,CAA3CC,EAAS,CAAEC,SAAS,EAAME,KAAMV,WAA2B3B,EAAAoC,UAAA,gBAAA,GAMYH,EAAA,CAAvEC,EAAS,CAAEC,SAAS,EAAME,KAAMV,QAASW,UAAW,mBAAuCtC,EAAAoC,UAAA,oBAAA,GAKvBH,EAAA,CAApEC,EAAS,CAAEC,SAAS,EAAME,KAAMV,QAASW,UAAW,gBAAiCtC,EAAAoC,UAAA,iBAAA,GAKzDH,EAAA,CAA5BC,EAAS,CAAEC,SAAS,KAA6BnC,EAAAoC,UAAA,YAAA,GAjD/BpC,EAAQiC,EAAA,CAD5BM,EAAc,kBACMvC,SAAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{_ as o}from"./tslib.es6-CmLYFWVC.js";import{css as t,html as i,nothing as r,LitElement as e}from"lit";import{query as n,property as s,customElement as l}from"lit/decorators.js";import{repeat as d}from"lit/directives/repeat.js";import{L as a}from"./LightDismissController-4pH8cdko.js";import{O as p}from"./OpenStateController-CCnZ7up6.js";import{i as c}from"./light-dom-styles-DXsbiKU9.js";import{D as m}from"./DraftComponentMixin-4qug5Rky.js";import h from"./Icon.js";import{LocalizeController as u}from"./LocalizeController.js";import{FilterAddButtonSelectEvent as j}from"./FilterAddButtonEvents.js";import"./Button.js";import"./DropdownGroup.js";import"./DropdownItem.js";import"./Popout-DpN7PP9h.js";import"./EventController-BBOmvfLa.js";import"./ShortcutController-BIb3WGzH.js";import"./tinykeys.module-_6MZt7MP.js";import"./events-Bv6wNHwJ.js";import"lit/directives/if-defined.js";import"lit/directives/unsafe-html.js";import"./observe-D0n0zOfU.js";import"./cond-CI1KbneT.js";import"./Component-BJ5O5n8k.js";import"./IconManager.js";import"./translation.js";import"./en-us.js";import"./localization.js";import"./localization2.js";import"./localization3.js";import"./localization4.js";import"./localization5.js";import"./localization6.js";import"./localization7.js";import"./localization8.js";import"./localization9.js";import"./localization10.js";import"./localization11.js";import"./localization12.js";import"./localization13.js";import"./localization14.js";import"./localization15.js";import"./localization16.js";import"./localization17.js";import"./localization18.js";import"./localization19.js";import"./localization20.js";import"./localization21.js";import"./localization22.js";import"lit/directives/ref.js";import"./LightDomController-DIwtVelV.js";import"./SlotController-Z6eG7LSZ.js";import"./FocusableMixin-BlQLNPdJ.js";import"./InputMixin-LetXsCyv.js";import"./Spinner.js";import"./DropdownItem-BYbOLth6.js";import"./positioning-D-K8Mueq.js";import"./DirectionController-ChvNGESZ.js";import"./ScrollbarController-BFC67Y2x.js";var f=Object.freeze({__proto__:null,default:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m20 11h-9v9h-2v-9h-9v-2h9v-9h2v9h9z" fill="currentColor"/></svg>',tags:"nordicon interface add plus adding more",title:"interface-add"});const b=t`nord-filter-add-button{--_n-filter-add-button-list-inline-size:var(--n-filter-add-button-list-inline-size,250px);display:inline-flex}nord-filter-add-button .n-filter-add-list{max-block-size:330px;max-inline-size:calc(var(--_n-filter-add-button-list-inline-size)*1.5);min-inline-size:var(--_n-filter-add-button-list-inline-size);overflow-y:auto;padding-block-end:var(--n-space-s);padding-block-start:var(--n-space-s);padding-inline-end:var(--n-space-s);padding-inline-start:var(--n-space-s)}nord-filter-add-button .n-filter-add-list nord-dropdown-group{border-block-end:1px solid var(--n-color-border);display:block;margin-block-end:var(--n-space-s);padding-block-end:var(--n-space-s)}nord-filter-add-button .n-filter-add-list nord-dropdown-group:last-child{border-block-end:0;margin-block-end:0;padding-block-end:0}nord-filter-add-button .n-filter-add-list nord-dropdown-item:hover{--n-dropdown-item-background-color:var(--n-color-active);--n-dropdown-item-color:var(--n-color-text)}@media (width <= 35.9375em){nord-filter-add-button .n-filter-add-list{max-block-size:70vh;max-inline-size:none}}`;h.registerIcon(f);let v=1,z=class extends(m(e)){constructor(){super(...arguments),this.filterAddButtonId="nord-filter-add-button-"+v++,this.localize=new u(this),this.dismiss=new a(this,{isOpen:()=>this.open,onDismiss:()=>this.hide(),isDismissible:o=>o!==this}),this.openState=new p(this,{isOpen:()=>this.open,setOpen:o=>{this.open=o},popout:()=>this.popout,isInert:()=>this.disabled}),this.options=[],this.disabled=!1,this.open=!1,this.size="s",this.handleTriggerClick=()=>{this.openState.toggle()}}connectedCallback(){super.connectedCallback(),c(this,b)}createRenderRoot(){return this}get groups(){const o=this.options;if(0===o.length)return[];return o.some((o=>!("id"in o)))?o:[{options:o}]}show(){this.openState.show()}hide(){this.openState.hide()}handleSelect(o){this.disabled||o.disabled||(this.dispatchEvent(new j(o.id)),this.hide())}render(){const o=`${this.filterAddButtonId}-popout`;return i`<nord-button class="n-filter-add-button" type="button" variant="dashed" size="${this.size}" aria-controls="${o}" aria-haspopup="menu" aria-expanded="${this.open?"true":"false"}" ?disabled="${this.disabled}" @click="${this.handleTriggerClick}"><nord-icon slot="start" name="interface-add" size="xs"></nord-icon>${this.localize.term("label")}</nord-button><nord-popout id="${o}" controlled always-floating @open="${this.openState.onPopoutOpen}" @close="${this.openState.onPopoutClose}"><div class="n-filter-add-list">${0===this.groups.length?r:d(this.groups,((o,t)=>t),(o=>{var t;return i`<nord-dropdown-group heading="${null!==(t=o.heading)&&void 0!==t?t:r}">${d(o.options,(o=>o.id),(o=>i`<nord-dropdown-item ?disabled="${o.disabled}" @click="${()=>this.handleSelect(o)}">${o.label}</nord-dropdown-item>`))}</nord-dropdown-group>`}))}</div></nord-popout>`}};o([n("nord-popout",!0)],z.prototype,"popout",void 0),o([s({attribute:!1})],z.prototype,"options",void 0),o([s({reflect:!0,type:Boolean})],z.prototype,"disabled",void 0),o([s({reflect:!0,type:Boolean})],z.prototype,"open",void 0),o([s({reflect:!0})],z.prototype,"size",void 0),z=o([l("nord-filter-add-button")],z);var g=z;export{j as FilterAddButtonSelectEvent,g as default};
|
|
2
|
+
//# sourceMappingURL=FilterAddButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FilterAddButton.js","sources":["../../icons/lib/assets/interface-add.js","../src/filter-add-button/FilterAddButton.ts"],"sourcesContent":["export default '<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"m20 11h-9v9h-2v-9h-9v-2h9v-9h2v9h9z\" fill=\"currentColor\"/></svg>';\nexport const title = \"interface-add\";\nexport const tags = \"nordicon interface add plus adding more\";\n","import * as addIcon from '@nordhealth/icons/lib/assets/interface-add.js'\nimport { html, LitElement, nothing } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\nimport { repeat } from 'lit/directives/repeat.js'\n\nimport { LightDismissController } from '../common/controllers/LightDismissController.js'\nimport { OpenStateController } from '../common/controllers/OpenStateController.js'\nimport { injectLightDomStyles } from '../common/light-dom-styles.js'\nimport { DraftComponentMixin } from '../common/mixins/DraftComponentMixin.js'\nimport Icon from '../icon/Icon.js'\nimport { LocalizeController } from '../localization/LocalizeController.js'\nimport style from './FilterAddButton.css'\nimport { FilterAddButtonSelectEvent } from './FilterAddButtonEvents.js'\nimport '../button/Button.js'\nimport '../dropdown-group/DropdownGroup.js'\nimport '../dropdown-item/DropdownItem.js'\nimport '../popout/Popout.js'\n\nIcon.registerIcon(addIcon)\n\nexport { FilterAddButtonSelectEvent } from './FilterAddButtonEvents.js'\n\n/** Per-instance counter so the popout/trigger ids stay unique in the light DOM. */\nlet filterAddButtonCount = 1\n\n/** A single, selectable option offered by the add-filter popout. */\nexport interface FilterAddOption {\n /** Identifies the option; sent in the `select` event when chosen. */\n id: string\n /** The human-readable label shown in the list. */\n label: string\n /** When `true`, the option cannot be selected. */\n disabled?: boolean\n}\n\n/** A heading-labelled cluster of options. */\nexport interface FilterAddGroup {\n /** Optional heading shown above the group's options. */\n heading?: string\n /** The options within the group. */\n options: FilterAddOption[]\n}\n\n/**\n * Filter Add Button opens a popout of available filters and emits the chosen one\n * so your app can add it to the bar. Pass a flat list of options, or group them\n * under headings; selecting one fires a `select` event with the option's `id`\n * and closes the popout.\n *\n * Like the other filter primitives it is intent-only: it does not track which\n * filters are active. Your app owns the active filters and decides what to do on\n * `select` (typically render a new [Filter Field](/components/filter-field/)).\n * Mirrors the Provet Cloud filter add button.\n *\n * @status draft\n * @category form\n * @lightDom true\n *\n * @fires {FilterAddButtonSelectEvent} select - Dispatched with the chosen option's `id` when an option is selected.\n * @fires {NordEvent} open - Dispatched when the popout is opened.\n * @fires {NordEvent} close - Dispatched when the popout is closed.\n *\n * @localization label - The text label for the add-filter button.\n *\n * @cssprop [--n-filter-add-button-list-inline-size=250px] - Controls the inline size, or width, of the popout list.\n *\n * @parent FilterBar\n */\n@customElement('nord-filter-add-button')\nexport default class FilterAddButton extends DraftComponentMixin(LitElement) {\n private filterAddButtonId = `nord-filter-add-button-${filterAddButtonCount++}`\n\n private localize = new LocalizeController<'nord-filter-add-button'>(this)\n\n @query('nord-popout', true) private popout?: HTMLElement & {\n show: () => Promise<unknown>\n hide: (moveFocusToButton?: boolean) => Promise<unknown>\n }\n\n private dismiss = new LightDismissController(this, {\n isOpen: () => this.open,\n onDismiss: () => this.hide(),\n isDismissible: node => node !== this,\n })\n\n // Coordinates `open` with the popout (drive show/hide, sync from its events,\n // emit one canonical open/close, reject opening while disabled).\n private openState = new OpenStateController(this, {\n isOpen: () => this.open,\n setOpen: (open) => { this.open = open },\n popout: () => this.popout,\n isInert: () => this.disabled,\n })\n\n /**\n * The options to offer in the popout. Either a flat list of options, or an\n * array of groups (each with an optional `heading` and its own `options`),\n * which renders dividers between the groups.\n */\n @property({ attribute: false }) options: FilterAddOption[] | FilterAddGroup[] = []\n\n /**\n * Makes the component disabled. This prevents users from being able to\n * interact with it and conveys its inactive state to assistive technologies.\n */\n @property({ reflect: true, type: Boolean }) disabled = false\n\n /**\n * Whether the popout is open. Set it to open or close the popout\n * programmatically.\n */\n @property({ reflect: true, type: Boolean }) open = false\n\n /**\n * The size of the button.\n */\n @property({ reflect: true }) size: 's' | 'm' | 'l' = 's'\n\n connectedCallback() {\n super.connectedCallback()\n injectLightDomStyles(this, style)\n }\n\n protected createRenderRoot() {\n return this\n }\n\n /** Normalises the options into groups, wrapping a flat list in a single group. */\n private get groups(): FilterAddGroup[] {\n const options = this.options\n if (options.length === 0) {\n return []\n }\n\n const isGrouped = options.some(option => !('id' in option))\n if (isGrouped) {\n return options as FilterAddGroup[]\n }\n\n return [{ options: options as FilterAddOption[] }]\n }\n\n /** Open the popout. */\n show() {\n this.openState.show()\n }\n\n /** Close the popout. */\n hide() {\n this.openState.hide()\n }\n\n private handleTriggerClick = () => {\n this.openState.toggle()\n }\n\n private handleSelect(option: FilterAddOption) {\n if (this.disabled || option.disabled) {\n return\n }\n\n /**\n * Dispatched with the chosen option's `id`. The consumer adds the\n * corresponding filter; the button does not mutate `options`.\n */\n this.dispatchEvent(new FilterAddButtonSelectEvent(option.id))\n this.hide()\n }\n\n render() {\n const popoutId = `${this.filterAddButtonId}-popout`\n\n return html`\n <nord-button\n class=\"n-filter-add-button\"\n type=\"button\"\n variant=\"dashed\"\n size=${this.size}\n aria-controls=${popoutId}\n aria-haspopup=\"menu\"\n aria-expanded=${this.open ? 'true' : 'false'}\n ?disabled=${this.disabled}\n @click=${this.handleTriggerClick}\n >\n <nord-icon slot=\"start\" name=\"interface-add\" size=\"xs\"></nord-icon>\n ${this.localize.term('label')}\n </nord-button>\n\n <nord-popout\n id=${popoutId}\n controlled\n always-floating\n @open=${this.openState.onPopoutOpen}\n @close=${this.openState.onPopoutClose}\n >\n <div class=\"n-filter-add-list\">\n ${this.groups.length === 0\n ? nothing\n : repeat(\n this.groups,\n (_group, index) => index,\n group => html`\n <nord-dropdown-group heading=${group.heading ?? nothing}>\n ${repeat(\n group.options,\n option => option.id,\n option => html`\n <nord-dropdown-item\n ?disabled=${option.disabled}\n @click=${() => this.handleSelect(option)}\n >\n ${option.label}\n </nord-dropdown-item>\n `,\n )}\n </nord-dropdown-group>\n `,\n )}\n </div>\n </nord-popout>\n `\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nord-filter-add-button': FilterAddButton\n }\n}\n"],"names":["Icon","registerIcon","addIcon","filterAddButtonCount","FilterAddButton","DraftComponentMixin","LitElement","constructor","this","filterAddButtonId","localize","LocalizeController","dismiss","LightDismissController","isOpen","open","onDismiss","hide","isDismissible","node","openState","OpenStateController","setOpen","popout","isInert","disabled","options","size","handleTriggerClick","toggle","connectedCallback","super","injectLightDomStyles","style","createRenderRoot","groups","length","some","option","show","handleSelect","dispatchEvent","FilterAddButtonSelectEvent","id","render","popoutId","html","term","onPopoutOpen","onPopoutClose","nothing","repeat","_group","index","group","_a","heading","label","__decorate","query","prototype","property","attribute","reflect","type","Boolean","customElement"],"mappings":"2iEAAe,6IAEK,gDADC,qmCCiBrBA,EAAKC,aAAaC,GAKlB,IAAIC,EAAuB,EA8CNC,EAAN,cAA8BC,EAAoBC,IAAlD,WAAAC,uBACLC,KAAAC,kBAAoB,0BAA0BN,IAE9CK,KAAAE,SAAW,IAAIC,EAA6CH,MAO5DA,KAAAI,QAAU,IAAIC,EAAuBL,KAAM,CACjDM,OAAQ,IAAMN,KAAKO,KACnBC,UAAW,IAAMR,KAAKS,OACtBC,cAAeC,GAAQA,IAASX,OAK1BA,KAAAY,UAAY,IAAIC,EAAoBb,KAAM,CAChDM,OAAQ,IAAMN,KAAKO,KACnBO,QAAUP,IAAWP,KAAKO,KAAOA,CAAI,EACrCQ,OAAQ,IAAMf,KAAKe,OACnBC,QAAS,IAAMhB,KAAKiB,WAQUjB,KAAOkB,QAA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EAAA,CAA/BG,EAAS,CAAEC,WAAW,KAA2D1D,EAAAwD,UAAA,eAAA,GAMtCF,EAAA,CAA3CG,EAAS,CAAEE,SAAS,EAAMC,KAAMC,WAA2B7D,EAAAwD,UAAA,gBAAA,GAMhBF,EAAA,CAA3CG,EAAS,CAAEE,SAAS,EAAMC,KAAMC,WAAuB7D,EAAAwD,UAAA,YAAA,GAK3BF,EAAA,CAA5BG,EAAS,CAAEE,SAAS,KAAmC3D,EAAAwD,UAAA,YAAA,GA/CrCxD,EAAesD,EAAA,CADnCQ,EAAc,2BACM9D,SAAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FilterAddButtonEvents.js","sources":["../src/filter-add-button/FilterAddButtonEvents.ts"],"sourcesContent":["import { NordEvent } from '../common/events.js'\n\n/**\n * Dispatched when the user chooses an option from the add-filter popout. Carries\n * the chosen option's `id`. The button does not track which filters are active —\n * the consumer adds the corresponding filter (and removes the option from the\n * list if it should not be addable twice).\n */\nexport class FilterAddButtonSelectEvent extends NordEvent {\n static eventName = 'select'\n\n constructor(\n /** The `id` of the chosen option. */\n public readonly value: string,\n ) {\n super(FilterAddButtonSelectEvent.eventName)\n }\n\n /** Convenience accessor mirroring `CustomEvent.detail`. */\n get detail() {\n return this.value\n }\n}\n"],"names":["FilterAddButtonSelectEvent","NordEvent","constructor","value","super","eventName","this","detail"],"mappings":"yCAQM,MAAOA,UAAmCC,EAG9C,WAAAC,CAEkBC,GAEhBC,MAAMJ,EAA2BK,WAFjBC,KAAKH,MAALA,CAGjB,CAGD,UAAII,GACF,OAAOD,KAAKH,KACb,EAZMH,EAASK,UAAG"}
|
package/lib/FilterBar.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{_ as r}from"./tslib.es6-CmLYFWVC.js";import{css as t,LitElement as a}from"lit";import{property as e,customElement as i}from"lit/decorators.js";import{i as l}from"./light-dom-styles-DXsbiKU9.js";import{D as n}from"./DraftComponentMixin-4qug5Rky.js";const s=t`nord-filter-bar{--_n-filter-bar-gap:var(--n-filter-bar-gap,var(--n-space-s));--_n-filter-bar-align-items:var(--n-filter-bar-align-items,center);align-items:var(--_n-filter-bar-align-items);display:flex;flex-wrap:wrap;gap:var(--_n-filter-bar-gap)}nord-filter-bar[align=start]{--_n-filter-bar-align-items:var(--n-filter-bar-align-items,flex-start)}nord-filter-bar[align=end]{--_n-filter-bar-align-items:var(--n-filter-bar-align-items,flex-end)}`;let o=class extends(n(a)){constructor(){super(...arguments),this.align="center"}connectedCallback(){super.connectedCallback(),l(this,s)}createRenderRoot(){return this}};r([e({reflect:!0})],o.prototype,"align",void 0),o=r([i("nord-filter-bar")],o);var f=o;export{f as default};
|
|
2
|
+
//# sourceMappingURL=FilterBar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FilterBar.js","sources":["../src/filter-bar/FilterBar.ts"],"sourcesContent":["import { LitElement } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { injectLightDomStyles } from '../common/light-dom-styles.js'\nimport { DraftComponentMixin } from '../common/mixins/DraftComponentMixin.js'\nimport style from './FilterBar.css'\n\n/**\n * Filter Bar is a layout wrapper for a row of filter controls. It lays its\n * children out in a wrapping flex row with a consistent gap, so you can drop in\n * [Filter Field](/components/filter-field/), [Filter Input](/components/filter-input/),\n * [Filter Add Button](/components/filter-add-button/) and\n * [Filter Reset Button](/components/filter-reset-button/) (or any controls) and\n * have them align without extra styling.\n *\n * Like [Pagination](/components/pagination/), it is composition-first: it owns no\n * filter state and emits no events. Your app owns the active filters and any URL\n * or query-string syncing; the filter primitives only emit intent.\n *\n * @status draft\n * @category form\n * @lightDom true\n *\n * @slot - Default slot for the filter controls.\n *\n * @cssprop [--n-filter-bar-gap=var(--n-space-s)] - Controls the spacing between the filter controls.\n * @cssprop [--n-filter-bar-align-items=center] - Controls the cross-axis alignment of the controls.\n */\n@customElement('nord-filter-bar')\nexport default class FilterBar extends DraftComponentMixin(LitElement) {\n /**\n * The cross-axis alignment of the controls within the bar.\n */\n @property({ reflect: true }) align: 'start' | 'center' | 'end' = 'center'\n\n connectedCallback() {\n super.connectedCallback()\n injectLightDomStyles(this, style)\n }\n\n // No render() — the filter controls are the element's own light-DOM content;\n // we only lay them out and style them (no shadow boundary, like Pagination).\n protected createRenderRoot() {\n return this\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nord-filter-bar': FilterBar\n }\n}\n"],"names":["FilterBar","DraftComponentMixin","LitElement","constructor","this","align","connectedCallback","super","injectLightDomStyles","style","createRenderRoot","__decorate","property","reflect","prototype","customElement"],"mappings":"qsBA6Be,IAAMA,EAAN,cAAwBC,EAAoBC,IAA5C,WAAAC,uBAIgBC,KAAKC,MAA+B,QAYlE,CAVC,iBAAAC,GACEC,MAAMD,oBACNE,EAAqBJ,KAAMK,EAC5B,CAIS,gBAAAC,GACR,OAAON,IACR,GAX4BO,EAAA,CAA5BC,EAAS,CAAEC,SAAS,KAAoDb,EAAAc,UAAA,aAAA,GAJtDd,EAASW,EAAA,CAD7BI,EAAc,oBACMf,SAAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{_ as t}from"./tslib.es6-CmLYFWVC.js";import{c as e}from"./interface-calendar-Cw2bJfbS.js";import{css as i,html as o,LitElement as r}from"lit";import{query as a,property as s,customElement as l}from"lit/decorators.js";import{ifDefined as n}from"lit/directives/if-defined.js";import{O as p}from"./OpenStateController-CCnZ7up6.js";import{p as d}from"./dates-C-ZvzXaC.js";import{i as m}from"./light-dom-styles-DXsbiKU9.js";import{D as c}from"./DraftComponentMixin-4qug5Rky.js";import h from"./Icon.js";import{LocalizeController as j}from"./LocalizeController.js";import{FilterDateRangeChangeEvent as u,FilterDateRangeClearEvent as f,FilterDateRangeRemoveEvent as v}from"./FilterDateRangeEvents.js";import"./FilterField.js";import"./Popout-DpN7PP9h.js";import"./DateRangePicker.js";import"./events-Bv6wNHwJ.js";import"lit/directives/unsafe-html.js";import"./observe-D0n0zOfU.js";import"./cond-CI1KbneT.js";import"./Component-BJ5O5n8k.js";import"./IconManager.js";import"./translation.js";import"./en-us.js";import"./localization.js";import"./localization2.js";import"./localization3.js";import"./localization4.js";import"./localization5.js";import"./localization6.js";import"./localization7.js";import"./localization8.js";import"./localization9.js";import"./localization10.js";import"./localization11.js";import"./localization12.js";import"./localization13.js";import"./localization14.js";import"./localization15.js";import"./localization16.js";import"./localization17.js";import"./localization18.js";import"./localization19.js";import"./localization20.js";import"./localization21.js";import"./localization22.js";import"./interface-close-small-CnpAFMO3.js";import"./interface-filter-CCsx9-u6.js";import"./filter-chip-C97zd4PT.js";import"./FilterFieldEvents.js";import"./Button.js";import"lit/directives/ref.js";import"./EventController-BBOmvfLa.js";import"./LightDomController-DIwtVelV.js";import"./SlotController-Z6eG7LSZ.js";import"./FocusableMixin-BlQLNPdJ.js";import"./InputMixin-LetXsCyv.js";import"./Spinner.js";import"./ButtonGroup.js";import"lit/directives/class-map.js";import"./DirectionController-ChvNGESZ.js";import"./VisuallyHidden.js";import"./positioning-D-K8Mueq.js";import"./LightDismissController-4pH8cdko.js";import"./ShortcutController-BIb3WGzH.js";import"./tinykeys.module-_6MZt7MP.js";import"./ScrollbarController-BFC67Y2x.js";import"./interface-dropdown-small-CYvgxudU.js";import"./FormAssociatedMixin-D9aPREgv.js";import"./FormDataController-OUt5L5uC.js";import"./FieldControlMixin-BXNZJXu9.js";import"./context-consumer-BJVUulGf.js";import"./context-request-event-CCRlXoeR.js";import"./field-context.js";import"./create-context-CJ69ntlY.js";import"./ReadonlyMixin-BdJPGtQ3.js";import"./SizeMixin-CU9cLbLC.js";import"./DateRangeChangeEvent.js";import"./Input.js";import"./navigation-search-CBbIGzo2.js";import"lit/directives/style-map.js";import"./ResizeController-14PUwRQy.js";import"./AutocompleteMixin-D8eiOxvO.js";import"./TextSelectableMixin-Cfv__lHS.js";import"./FormField-CMgEFZCK.js";import"./TextField-CSKvieoG.js";import"./Calendar-C1SxrlzN.js";import"lit/directives/repeat.js";import"./collection-Dvg2XbxV.js";import"./number-Dg2vCfGd.js";import"./DateRangeSelectEvent.js";import"./DateSelectEvent.js";import"./Stack.js";const g=i`nord-filter-date-range{display:inline-flex;max-inline-size:100%}nord-filter-date-range .n-filter-date-range-popout{inline-size:var(--n-filter-date-range-popout-inline-size,max-content);max-inline-size:100%;padding:0}nord-filter-date-range nord-date-range-picker[inline] .n-drp{background:none;border:none;padding:0}`;h.registerIcon(e);let y=1,b=class extends(c(r)){constructor(){super(...arguments),this.filterDateRangeId="nord-filter-date-range-"+y++,this.localize=new j(this),this.openState=new p(this,{isOpen:()=>this.open,setOpen:t=>{this.open=t},popout:()=>this.popout,isInert:()=>this.disabled}),this.label="",this.value="",this.hidePresets=!1,this.removable=!1,this.clearable=!0,this.disabled=!1,this.size="s",this.name="",this.open=!1,this.handleTriggerClick=()=>{this.openState.toggle()},this.handleInnerChange=t=>{t.stopPropagation(),this.disabled||(this.value=t.value,this.dispatchEvent(new u({value:t.value,startDate:t.startDate,endDate:t.endDate})),this.hide())},this.handleInnerInput=t=>{t.stopPropagation()},this.handleClear=t=>{t.stopPropagation(),this.disabled||(this.value="",this.dispatchEvent(new u({value:"",startDate:"",endDate:""})),this.dispatchEvent(new f))},this.handleRemove=t=>{t.stopPropagation(),this.disabled||this.dispatchEvent(new v)}}get startDate(){var t;return null!==(t=this.value.split("/")[0])&&void 0!==t?t:""}get endDate(){var t;return null!==(t=this.value.split("/")[1])&&void 0!==t?t:""}connectedCallback(){super.connectedCallback(),m(this,g)}createRenderRoot(){return this}get displayValue(){if(!this.value)return"";const t=d(this.startDate),e=d(this.endDate);if(!t||!e)return this.value;const i=new Intl.DateTimeFormat(this.localize.resolvedLang,{day:"numeric",month:"short",year:"numeric"});return`${i.format(t)} ${this.localize.term("rangeSeparator")} ${i.format(e)}`}show(){this.openState.show()}hide(){this.openState.hide()}render(){const t=`${this.filterDateRangeId}-popout`;return o`<nord-filter-field aria-controls="${t}" aria-haspopup="dialog" aria-expanded="${this.open?"true":"false"}" label="${this.label}" value="${this.displayValue}" icon="interface-calendar" size="${this.size}" name="${n(this.name||void 0)}" ?removable="${this.removable}" ?clearable="${this.clearable}" ?disabled="${this.disabled}" @click="${this.handleTriggerClick}" @clear="${this.handleClear}" @remove="${this.handleRemove}"></nord-filter-field><nord-popout id="${t}" controlled always-floating @open="${this.openState.onPopoutOpen}" @close="${this.openState.onPopoutClose}"><div class="n-filter-date-range-popout"><nord-date-range-picker inline label="${this.label}" hide-label value="${this.value}" min="${n(this.min)}" max="${n(this.max)}" today="${n(this.today)}" first-day-of-week="${n(this.firstDayOfWeek)}" ?hide-presets="${this.hidePresets}" ?disabled="${this.disabled}" @change="${this.handleInnerChange}" @input="${this.handleInnerInput}"></nord-date-range-picker></div></nord-popout>`}};t([a("nord-popout",!0)],b.prototype,"popout",void 0),t([s({reflect:!0})],b.prototype,"label",void 0),t([s({reflect:!0})],b.prototype,"value",void 0),t([s({reflect:!0})],b.prototype,"min",void 0),t([s({reflect:!0})],b.prototype,"max",void 0),t([s({reflect:!0,type:Boolean,attribute:"hide-presets"})],b.prototype,"hidePresets",void 0),t([s({reflect:!0,type:Number,attribute:"first-day-of-week"})],b.prototype,"firstDayOfWeek",void 0),t([s({reflect:!0})],b.prototype,"today",void 0),t([s({reflect:!0,type:Boolean})],b.prototype,"removable",void 0),t([s({reflect:!0,type:Boolean})],b.prototype,"clearable",void 0),t([s({reflect:!0,type:Boolean})],b.prototype,"disabled",void 0),t([s({reflect:!0})],b.prototype,"size",void 0),t([s({reflect:!0})],b.prototype,"name",void 0),t([s({reflect:!0,type:Boolean})],b.prototype,"open",void 0),b=t([l("nord-filter-date-range")],b);var z=b;export{u as FilterDateRangeChangeEvent,f as FilterDateRangeClearEvent,v as FilterDateRangeRemoveEvent,z as default};
|
|
2
|
+
//# sourceMappingURL=FilterDateRange.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FilterDateRange.js","sources":["../src/filter-date-range/FilterDateRange.ts"],"sourcesContent":["import type { DateRangeChangeEvent } from '../date-range-picker/DateRangeChangeEvent.js'\nimport * as calendarIcon from '@nordhealth/icons/lib/assets/interface-calendar.js'\nimport { html, LitElement } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\nimport { ifDefined } from 'lit/directives/if-defined.js'\n\nimport { OpenStateController } from '../common/controllers/OpenStateController.js'\nimport { parseISODate } from '../common/dates.js'\nimport { injectLightDomStyles } from '../common/light-dom-styles.js'\nimport { DraftComponentMixin } from '../common/mixins/DraftComponentMixin.js'\nimport Icon from '../icon/Icon.js'\nimport { LocalizeController } from '../localization/LocalizeController.js'\nimport style from './FilterDateRange.css'\nimport { FilterDateRangeChangeEvent, FilterDateRangeClearEvent, FilterDateRangeRemoveEvent } from './FilterDateRangeEvents.js'\nimport '../filter-field/FilterField.js'\nimport '../popout/Popout.js'\nimport '../date-range-picker/DateRangePicker.js'\n\nIcon.registerIcon(calendarIcon)\n\nexport {\n FilterDateRangeChangeEvent,\n FilterDateRangeClearEvent,\n FilterDateRangeRemoveEvent,\n} from './FilterDateRangeEvents.js'\n\n/** Per-instance counter so the popout id stays unique in the light DOM. */\nlet filterDateRangeCount = 1\n\n/**\n * Filter Date Range is a self-contained date-range **filter**: a chip that opens\n * a popout containing an inline [Date Range Picker](/components/date-range-picker/)\n * (presets + two-month calendar + Apply). It is the date-range counterpart to\n * [Filter Dropdown](/components/filter-dropdown/) and renders the shared filter\n * chip via [Filter Field](/components/filter-field/).\n *\n * Composition-first: it emits `change`/`clear`/`remove` and leaves the active\n * filters and any URL/query state to your app.\n *\n * @status draft\n * @category form\n * @lightDom true\n *\n * @fires {FilterDateRangeChangeEvent} change - Dispatched when the committed range changes (Apply or clear).\n * @fires {FilterDateRangeClearEvent} clear - Dispatched when the chip's clear affordance is pressed.\n * @fires {FilterDateRangeRemoveEvent} remove - Dispatched when the chip's remove affordance is pressed.\n * @fires {NordEvent} open - Dispatched when the popout is opened.\n * @fires {NordEvent} close - Dispatched when the popout is closed.\n *\n * @localization filterIconLabel - Accessible label for the leading calendar icon.\n * @localization clearLabel - Accessible label for the clear button.\n * @localization removeLabel - Accessible label for the remove button.\n * @localization rangeSeparator - Character shown between the start and end dates on the chip.\n *\n * @cssprop [--n-filter-date-range-popout-inline-size] - Controls the inline size of the popout content.\n *\n * @parent FilterBar\n */\n@customElement('nord-filter-date-range')\nexport default class FilterDateRange extends DraftComponentMixin(LitElement) {\n private filterDateRangeId = `nord-filter-date-range-${filterDateRangeCount++}`\n\n private localize = new LocalizeController<'nord-filter-date-range'>(this)\n\n @query('nord-popout', true) private popout?: HTMLElement & {\n show: () => Promise<unknown>\n hide: (moveFocusToButton?: boolean) => Promise<unknown>\n }\n\n // Coordinates `open` with the popout (drive show/hide, sync from its events,\n // emit one canonical open/close, reject opening while disabled).\n private openState = new OpenStateController(this, {\n isOpen: () => this.open,\n setOpen: (open) => { this.open = open },\n popout: () => this.popout,\n isInert: () => this.disabled,\n })\n\n /** The label naming what this filter targets, shown on the chip. */\n @property({ reflect: true }) label = ''\n\n /**\n * The committed range as an ISO-8601 interval string `YYYY-MM-DD/YYYY-MM-DD`,\n * or `\"\"` for no selection.\n */\n @property({ reflect: true }) value = ''\n\n /** Earliest selectable date (ISO-8601). */\n @property({ reflect: true }) min?: string\n\n /** Latest selectable date (ISO-8601). */\n @property({ reflect: true }) max?: string\n\n /** Hides the built-in preset list, leaving only the calendar. */\n @property({ reflect: true, type: Boolean, attribute: 'hide-presets' }) hidePresets = false\n\n /** First day of the week (0 = Sunday … 6 = Saturday). */\n @property({ reflect: true, type: Number, attribute: 'first-day-of-week' }) firstDayOfWeek?: number\n\n /** Overrides \"today\" (ISO-8601), mainly for deterministic tests/demos. */\n @property({ reflect: true }) today?: string\n\n /**\n * Whether the whole filter can be removed. When `true` the trailing affordance\n * is a remove button that fires `remove`; otherwise it is a clear button.\n */\n @property({ reflect: true, type: Boolean }) removable = false\n\n /** Shows a clear (✕) button while there is a selection. Defaults to `true`. */\n @property({ reflect: true, type: Boolean }) clearable = true\n\n /** Makes the component disabled. */\n @property({ reflect: true, type: Boolean }) disabled = false\n\n /** The size of the chip controls. */\n @property({ reflect: true }) size: 's' | 'm' | 'l' = 's'\n\n /** Identifies the filter (e.g. for your app's active-filter state). */\n @property({ reflect: true }) name = ''\n\n /** Whether the popout is open. */\n @property({ reflect: true, type: Boolean }) open = false\n\n /** The committed start date (ISO-8601), derived from `value`. */\n get startDate(): string {\n return this.value.split('/')[0] ?? ''\n }\n\n /** The committed end date (ISO-8601), derived from `value`. */\n get endDate(): string {\n return this.value.split('/')[1] ?? ''\n }\n\n connectedCallback() {\n super.connectedCallback()\n injectLightDomStyles(this, style)\n }\n\n protected createRenderRoot() {\n return this\n }\n\n /** The chip text: the formatted range, or `\"\"` while inactive. */\n private get displayValue(): string {\n // Genuinely empty → inactive chip.\n if (!this.value) {\n return ''\n }\n const start = parseISODate(this.startDate)\n const end = parseISODate(this.endDate)\n // A non-empty but unparseable/partial `value` still represents an active\n // filter — show it raw rather than silently rendering the chip as inactive.\n if (!start || !end) {\n return this.value\n }\n const fmt = new Intl.DateTimeFormat(this.localize.resolvedLang, { day: 'numeric', month: 'short', year: 'numeric' })\n return `${fmt.format(start)} ${this.localize.term('rangeSeparator')} ${fmt.format(end)}`\n }\n\n /** Open the popout. */\n show() {\n this.openState.show()\n }\n\n /** Close the popout. */\n hide() {\n this.openState.hide()\n }\n\n // The popout is `controlled`, so the chip click is the only thing that opens\n // it — mirror the date-range-picker's trigger. (FilterField stops propagation\n // on its clear/remove buttons, so those don't reach this handler.)\n private handleTriggerClick = () => {\n this.openState.toggle()\n }\n\n // The inline picker commits on Apply (and clears on its Clear); mirror its\n // committed value, re-emit a single canonical `change`, and close.\n private handleInnerChange = (e: DateRangeChangeEvent) => {\n e.stopPropagation()\n if (this.disabled) {\n return\n }\n\n this.value = e.value\n this.dispatchEvent(new FilterDateRangeChangeEvent({ value: e.value, startDate: e.startDate, endDate: e.endDate }))\n this.hide()\n }\n\n // Swallow the inline picker's live `input` so consumers only see our `change`.\n private handleInnerInput = (e: Event) => {\n e.stopPropagation()\n }\n\n private handleClear = (e: Event) => {\n e.stopPropagation()\n if (this.disabled) {\n return\n }\n\n this.value = ''\n this.dispatchEvent(new FilterDateRangeChangeEvent({ value: '', startDate: '', endDate: '' }))\n this.dispatchEvent(new FilterDateRangeClearEvent())\n }\n\n private handleRemove = (e: Event) => {\n e.stopPropagation()\n if (this.disabled) {\n return\n }\n\n this.dispatchEvent(new FilterDateRangeRemoveEvent())\n }\n\n render() {\n const popoutId = `${this.filterDateRangeId}-popout`\n\n return html`\n <nord-filter-field\n aria-controls=${popoutId}\n aria-haspopup=\"dialog\"\n aria-expanded=${this.open ? 'true' : 'false'}\n label=${this.label}\n value=${this.displayValue}\n icon=\"interface-calendar\"\n size=${this.size}\n name=${ifDefined(this.name || undefined)}\n ?removable=${this.removable}\n ?clearable=${this.clearable}\n ?disabled=${this.disabled}\n @click=${this.handleTriggerClick}\n @clear=${this.handleClear}\n @remove=${this.handleRemove}\n ></nord-filter-field>\n\n <nord-popout\n id=${popoutId}\n controlled\n always-floating\n @open=${this.openState.onPopoutOpen}\n @close=${this.openState.onPopoutClose}\n >\n <div class=\"n-filter-date-range-popout\">\n <nord-date-range-picker\n inline\n label=${this.label}\n hide-label\n value=${this.value}\n min=${ifDefined(this.min)}\n max=${ifDefined(this.max)}\n today=${ifDefined(this.today)}\n first-day-of-week=${ifDefined(this.firstDayOfWeek)}\n ?hide-presets=${this.hidePresets}\n ?disabled=${this.disabled}\n @change=${this.handleInnerChange}\n @input=${this.handleInnerInput}\n ></nord-date-range-picker>\n </div>\n </nord-popout>\n `\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nord-filter-date-range': FilterDateRange\n }\n}\n"],"names":["Icon","registerIcon","calendarIcon","filterDateRangeCount","FilterDateRange","DraftComponentMixin","LitElement","constructor","this","filterDateRangeId","localize","LocalizeController","openState","OpenStateController","isOpen","open","setOpen","popout","isInert","disabled","label","value","hidePresets","removable","clearable","size","name","handleTriggerClick","toggle","handleInnerChange","e","stopPropagation","dispatchEvent","FilterDateRangeChangeEvent","startDate","endDate","hide","handleInnerInput","handleClear","FilterDateRangeClearEvent","handleRemove","FilterDateRangeRemoveEvent","_a","split","connectedCallback","super","injectLightDomStyles","style","createRenderRoot","displayValue","start","parseISODate","end","fmt","Intl","DateTimeFormat","resolvedLang","day","month","year","format","term","show","render","popoutId","html","ifDefined","undefined","onPopoutOpen","onPopoutClose","min","max","today","firstDayOfWeek","__decorate","query","prototype","property","reflect","type","Boolean","attribute","Number","customElement"],"mappings":"igHAkBAA,EAAKC,aAAaC,GASlB,IAAIC,EAAuB,EAgCNC,EAAN,cAA8BC,EAAoBC,IAAlD,WAAAC,uBACLC,KAAAC,kBAAoB,0BAA0BN,IAE9CK,KAAAE,SAAW,IAAIC,EAA6CH,MAS5DA,KAAAI,UAAY,IAAIC,EAAoBL,KAAM,CAChDM,OAAQ,IAAMN,KAAKO,KACnBC,QAAUD,IAAWP,KAAKO,KAAOA,CAAI,EACrCE,OAAQ,IAAMT,KAAKS,OACnBC,QAAS,IAAMV,KAAKW,WAIOX,KAAKY,MAAG,GAMRZ,KAAKa,MAAG,GASkCb,KAAWc,aAAG,EAYzCd,KAASe,WAAG,EAGZf,KAASgB,WAAG,EAGZhB,KAAQW,UAAG,EAG1BX,KAAIiB,KAAoB,IAGxBjB,KAAIkB,KAAG,GAGQlB,KAAIO,MAAG,EAmD3CP,KAAkBmB,mBAAG,KAC3BnB,KAAKI,UAAUgB,QAAQ,EAKjBpB,KAAAqB,kBAAqBC,IAC3BA,EAAEC,kBACEvB,KAAKW,WAITX,KAAKa,MAAQS,EAAET,MACfb,KAAKwB,cAAc,IAAIC,EAA2B,CAAEZ,MAAOS,EAAET,MAAOa,UAAWJ,EAAEI,UAAWC,QAASL,EAAEK,WACvG3B,KAAK4B,OAAM,EAIL5B,KAAA6B,iBAAoBP,IAC1BA,EAAEC,iBAAiB,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A,GAG/BF,EAAA,CAA5BG,EAAS,CAAEC,SAAS,KAAmC1E,EAAAwE,UAAA,YAAA,GAG3BF,EAAA,CAA5BG,EAAS,CAAEC,SAAS,KAAiB1E,EAAAwE,UAAA,YAAA,GAGMF,EAAA,CAA3CG,EAAS,CAAEC,SAAS,EAAMC,KAAMC,WAAuB5E,EAAAwE,UAAA,YAAA,GA9DrCxE,EAAesE,EAAA,CADnCS,EAAc,2BACM/E,SAAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{N as e}from"./events-Bv6wNHwJ.js";class t extends e{constructor(e){super(t.eventName),this._detail=e}get detail(){return this._detail}}t.eventName="change";class s extends e{constructor(){super(s.eventName)}}s.eventName="clear";class r extends e{constructor(){super(r.eventName)}}r.eventName="remove";export{t as FilterDateRangeChangeEvent,s as FilterDateRangeClearEvent,r as FilterDateRangeRemoveEvent};
|
|
2
|
+
//# sourceMappingURL=FilterDateRangeEvents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FilterDateRangeEvents.js","sources":["../src/filter-date-range/FilterDateRangeEvents.ts"],"sourcesContent":["import { NordEvent } from '../common/events.js'\n\n/** The payload carried by a {@link FilterDateRangeChangeEvent}. */\nexport interface FilterDateRangeChangeDetail {\n /** The committed interval string `YYYY-MM-DD/YYYY-MM-DD`, or `\"\"` when empty. */\n value: string\n /** The committed start date in ISO-8601 format, or `\"\"` when empty. */\n startDate: string\n /** The committed end date in ISO-8601 format, or `\"\"` when empty. */\n endDate: string\n}\n\n/**\n * Dispatched when the committed range changes (the user applies a range inside\n * the popout, or clears it).\n */\nexport class FilterDateRangeChangeEvent extends NordEvent {\n static eventName = 'change'\n\n constructor(\n private readonly _detail: FilterDateRangeChangeDetail,\n ) {\n super(FilterDateRangeChangeEvent.eventName)\n }\n\n /** Convenience accessor mirroring `CustomEvent.detail`. */\n get detail(): FilterDateRangeChangeDetail {\n return this._detail\n }\n}\n\n/**\n * Dispatched when the range is cleared via the chip's clear affordance. The\n * value is emptied; your app resets any active-filter/URL state in the handler.\n */\nexport class FilterDateRangeClearEvent extends NordEvent {\n static eventName = 'clear'\n\n constructor() {\n super(FilterDateRangeClearEvent.eventName)\n }\n}\n\n/**\n * Dispatched when the filter is removed via the chip's remove affordance. The\n * consumer removes the field from the bar (and clears its filter) in the handler.\n */\nexport class FilterDateRangeRemoveEvent extends NordEvent {\n static eventName = 'remove'\n\n constructor() {\n super(FilterDateRangeRemoveEvent.eventName)\n }\n}\n"],"names":["FilterDateRangeChangeEvent","NordEvent","constructor","_detail","super","eventName","this","detail","FilterDateRangeClearEvent","FilterDateRangeRemoveEvent"],"mappings":"yCAgBM,MAAOA,UAAmCC,EAG9C,WAAAC,CACmBC,GAEjBC,MAAMJ,EAA2BK,WAFhBC,KAAOH,QAAPA,CAGlB,CAGD,UAAII,GACF,OAAOD,KAAKH,OACb,EAXMH,EAASK,UAAG,SAkBf,MAAOG,UAAkCP,EAG7C,WAAAC,GACEE,MAAMI,EAA0BH,UACjC,EAJMG,EAASH,UAAG,QAWf,MAAOI,UAAmCR,EAG9C,WAAAC,GACEE,MAAMK,EAA2BJ,UAClC,EAJMI,EAASJ,UAAG"}
|