@nordhealth/components 5.0.0-alpha.0 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +20657 -19988
- package/lib/Accordion.js.map +1 -1
- package/lib/AccordionHeader.js.map +1 -1
- package/lib/AccordionItem.js.map +1 -1
- package/lib/AccordionPanel.js.map +1 -1
- package/lib/AccordionTrigger.js +1 -1
- package/lib/AccordionTrigger.js.map +1 -1
- package/lib/Aside.js.map +1 -1
- package/lib/AsideDrawer.js.map +1 -1
- package/lib/Autocomplete.js +1 -1
- package/lib/Autocomplete.js.map +1 -1
- package/lib/Avatar.js.map +1 -1
- package/lib/Calendar-D47b20IT.js +2 -0
- package/lib/Calendar-D47b20IT.js.map +1 -0
- package/lib/Calendar.js +1 -1
- package/lib/Card.js.map +1 -1
- package/lib/Collapsible.js.map +1 -1
- package/lib/CollapsiblePanel.js.map +1 -1
- package/lib/CollapsibleTrigger.js.map +1 -1
- package/lib/Combobox-DBxXlbY7.js +2 -0
- package/lib/Combobox-DBxXlbY7.js.map +1 -0
- package/lib/Combobox.js +1 -1
- package/lib/Combobox.js.map +1 -1
- package/lib/ComboboxBase.js +1 -1
- package/lib/ComboboxBase.js.map +1 -1
- package/lib/CommandMenu.js +1 -1
- package/lib/CommandMenu.js.map +1 -1
- package/lib/DatePicker.js +1 -1
- package/lib/DatePicker.js.map +1 -1
- package/lib/DateRangePicker.js +1 -1
- package/lib/DateRangePicker.js.map +1 -1
- package/lib/Divider.js.map +1 -1
- package/lib/Drawer.js.map +1 -1
- package/lib/Dropdown.js +1 -1
- package/lib/Dropdown.js.map +1 -1
- package/lib/DropdownSubmenu.js +1 -1
- package/lib/DropdownSubmenu.js.map +1 -1
- package/lib/FilterAddButton.js +1 -1
- package/lib/FilterAddButton.js.map +1 -1
- package/lib/FilterDateRange.js +1 -1
- package/lib/FilterDateRange.js.map +1 -1
- package/lib/FilterDropdown.js +1 -1
- package/lib/FilterDropdown.js.map +1 -1
- package/lib/FilterField.js +1 -1
- package/lib/FilterField.js.map +1 -1
- package/lib/FilterInput.js +1 -1
- package/lib/FilterInput.js.map +1 -1
- package/lib/FilterResetButton.js +1 -1
- package/lib/FilterResetButton.js.map +1 -1
- package/lib/Footer.js.map +1 -1
- package/lib/Header.js.map +1 -1
- package/lib/Icon.js.map +1 -1
- package/lib/Kbd.js.map +1 -1
- package/lib/KbdGroup.js.map +1 -1
- package/lib/KeyboardController.js +1 -1
- package/lib/KeyboardController.js.map +1 -1
- package/lib/Layout.js +1 -1
- package/lib/Layout.js.map +1 -1
- package/lib/{LightDismissController-4pH8cdko.js → LightDismissController-wcL1ziJa.js} +2 -2
- package/lib/{LightDismissController-4pH8cdko.js.map → LightDismissController-wcL1ziJa.js.map} +1 -1
- package/lib/LocalizeController.js +1 -1
- package/lib/LocalizeController.js.map +1 -1
- package/lib/Message.js +1 -1
- package/lib/Message.js.map +1 -1
- package/lib/Meter.js +1 -1
- package/lib/Meter.js.map +1 -1
- 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/NavItem.js +1 -1
- package/lib/NavItem.js.map +1 -1
- package/lib/NavToggle.js +1 -1
- package/lib/Notification.js +1 -1
- package/lib/Notification.js.map +1 -1
- package/lib/NumberField.js +1 -1
- package/lib/NumberField.js.map +1 -1
- package/lib/OtpField.js +1 -1
- package/lib/OtpField.js.map +1 -1
- package/lib/Outline.js +2 -0
- package/lib/Outline.js.map +1 -0
- package/lib/OutlineItem.js +2 -0
- package/lib/OutlineItem.js.map +1 -0
- package/lib/Pagination.js +1 -1
- package/lib/Pagination.js.map +1 -1
- package/lib/{Popout-DpN7PP9h.js → Popout-CFtFoCaA.js} +2 -2
- package/lib/{Popout-DpN7PP9h.js.map → Popout-CFtFoCaA.js.map} +1 -1
- package/lib/Popout.js +1 -1
- package/lib/Qrcode.js.map +1 -1
- package/lib/ScrollArea.js.map +1 -1
- package/lib/ShortcutController-CV5b0BZl.js +2 -0
- package/lib/ShortcutController-CV5b0BZl.js.map +1 -0
- package/lib/Stack.js.map +1 -1
- package/lib/Tag.js +1 -1
- package/lib/Tag.js.map +1 -1
- package/lib/TagGroup.js.map +1 -1
- package/lib/Textarea.js +1 -1
- package/lib/Textarea.js.map +1 -1
- package/lib/TimePicker.js +1 -1
- package/lib/TimePicker.js.map +1 -1
- package/lib/TopBar.js.map +1 -1
- package/lib/Truncate.js.map +1 -1
- package/lib/VisuallyHidden.js.map +1 -1
- package/lib/bundle.js +13 -13
- package/lib/bundle.js.map +1 -1
- 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/index.js +1 -1
- package/lib/localization19.js +1 -1
- package/lib/localization19.js.map +1 -1
- package/lib/localization20.js +1 -1
- package/lib/localization20.js.map +1 -1
- package/lib/localization21.js +1 -1
- package/lib/localization21.js.map +1 -1
- package/lib/localization22.js +1 -1
- package/lib/localization22.js.map +1 -1
- package/lib/localization23.js +2 -0
- package/lib/localization23.js.map +1 -0
- package/lib/react.d.ts +15 -0
- package/lib/src/accordion/Accordion.d.ts +1 -1
- package/lib/src/accordion/AccordionHeader.d.ts +1 -1
- package/lib/src/accordion/AccordionItem.d.ts +1 -1
- package/lib/src/accordion/AccordionPanel.d.ts +1 -1
- package/lib/src/accordion/AccordionTrigger.d.ts +4 -3
- package/lib/src/aside/Aside.d.ts +1 -1
- package/lib/src/aside-drawer/AsideDrawer.d.ts +1 -1
- package/lib/src/autocomplete/Autocomplete.d.ts +4 -4
- package/lib/src/avatar/Avatar.d.ts +1 -1
- package/lib/src/calendar/Calendar.d.ts +1 -1
- package/lib/src/card/Card.d.ts +1 -1
- package/lib/src/collapsible/Collapsible.d.ts +1 -1
- package/lib/src/collapsible/CollapsiblePanel.d.ts +1 -1
- package/lib/src/collapsible/CollapsibleTrigger.d.ts +1 -1
- package/lib/src/combobox/ComboboxBase.d.ts +7 -7
- package/lib/src/common/controllers/ShortcutController.d.ts +5 -5
- package/lib/src/divider/Divider.d.ts +1 -1
- package/lib/src/drawer/Drawer.d.ts +1 -1
- package/lib/src/footer/Footer.d.ts +1 -1
- package/lib/src/header/Header.d.ts +1 -1
- package/lib/src/icon/Icon.d.ts +1 -1
- package/lib/src/index.d.ts +2 -0
- package/lib/src/kbd/Kbd.d.ts +1 -1
- package/lib/src/kbd/KbdGroup.d.ts +1 -1
- package/lib/src/layout/Layout.d.ts +1 -1
- package/lib/src/localization/en-us.d.ts +3 -0
- package/lib/src/localization/translation.d.ts +3 -0
- package/lib/src/otp-field/OtpField.d.ts +11 -0
- package/lib/src/outline/Outline.d.ts +111 -0
- package/lib/src/outline/OutlineItem.d.ts +42 -0
- package/lib/src/outline/localization.d.ts +4 -0
- package/lib/src/qrcode/Qrcode.d.ts +1 -1
- package/lib/src/scroll-area/ScrollArea.d.ts +1 -1
- package/lib/src/stack/Stack.d.ts +1 -1
- package/lib/src/tag/Tag.d.ts +1 -1
- package/lib/src/tag-group/TagGroup.d.ts +1 -1
- package/lib/src/top-bar/TopBar.d.ts +1 -1
- package/lib/src/truncate/Truncate.d.ts +1 -1
- package/lib/src/visually-hidden/VisuallyHidden.d.ts +1 -1
- package/lib/tinykeys-DwvDXsEb.js +2 -0
- package/lib/tinykeys-DwvDXsEb.js.map +1 -0
- package/lib/translation.js +1 -1
- package/lib/translation.js.map +1 -1
- package/lib/vue.d.ts +11 -0
- package/package.json +5 -5
- package/lib/Calendar-C1SxrlzN.js +0 -2
- package/lib/Calendar-C1SxrlzN.js.map +0 -1
- package/lib/Combobox-By4h1Sp-.js +0 -2
- package/lib/Combobox-By4h1Sp-.js.map +0 -1
- package/lib/ShortcutController-BIb3WGzH.js +0 -2
- package/lib/ShortcutController-BIb3WGzH.js.map +0 -1
- package/lib/tinykeys.module-_6MZt7MP.js +0 -2
- package/lib/tinykeys.module-_6MZt7MP.js.map +0 -1
package/lib/Autocomplete.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Autocomplete.js","sources":["../src/autocomplete/Autocomplete.ts"],"sourcesContent":["import type { ComboboxOption } from '../combobox/ComboboxBase.js'\nimport { nothing } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\nimport comboboxStyle from '../combobox/Combobox.css'\nimport ComboboxBase, { retagComboboxStyles } from '../combobox/ComboboxBase.js'\nimport { ComboboxClearEvent } from '../combobox/ComboboxEvents.js'\nimport { injectLightDomStyles } from '../common/light-dom-styles.js'\nimport { LocalizeController } from '../localization/LocalizeController.js'\n\nexport type { ComboboxOption } from '../combobox/ComboboxBase.js'\nexport { ComboboxClearEvent } from '../combobox/ComboboxEvents.js'\n\n/**\n * The shared combobox stylesheet is authored once against the `nord-combobox`\n * tag (see `Combobox.css`); re-prefix it for `nord-autocomplete` so this sibling\n * light-DOM control reuses the exact same `.n-*` rules without duplicating them.\n */\nconst style = retagComboboxStyles(comboboxStyle, 'nord-autocomplete')\n\n/**\n * Autocomplete is a free-text input with suggestions: the text the user types\n * is itself the committed `value` (a string), and the options are completion\n * aids. Picking a suggestion fills the input with the option's `label` and commits\n * that label. Use it when the answer is open-ended text but you can offer\n * helpful completions (a city, a tag, a username); reach for\n * [Combobox](/components/combobox/) instead when the value must be one of a\n * fixed set of options.\n *\n * Autocomplete is a control only — it has no built-in label, hint or error.\n * Compose it inside a [Field](/components/field/) to give it a label, hint and\n * error message, the same way you would a native input.\n *\n * Base UI parity: Autocomplete is the Combobox primitive with\n * `selectionMode=\"none\"` + `fillInputOnItemPress`.\n *\n * @status draft\n * @category form\n * @lightDom true\n *\n * @slot start - Optional slot used to place an icon or prefix at the start of the control.\n * @slot end - Optional slot used to place an icon or suffix at the end of the control.\n *\n * @fires {NordEvent} change - Dispatched when the committed value changes via user interaction.\n * @fires {NordEvent} input - Dispatched as the user types into the input.\n * @fires {NordEvent} open - Dispatched when the listbox is opened.\n * @fires {NordEvent} close - Dispatched when the listbox is closed.\n * @fires {ComboboxClearEvent} clear - Dispatched when the value is cleared via the clear button or `clear()`.\n *\n * @localization clearLabel - Accessible label for the clear button.\n * @localization noResults - Message shown when no options match the query.\n *\n * @cssprop [--n-combobox-list-inline-size] - Controls the inline size, or width, of the dropdown list. Defaults to the width of the control.\n * @cssprop [--n-combobox-block-size] - Controls the block size, or height, of the control. The medium default is `var(--n-space-xl)`; the s and l sizes scale from it.\n *\n * @attr {boolean} data-invalid - Present while the control is invalid (mirrors the `invalid` property). Style hook for the whole control.\n * @attr {boolean} data-focused - Present while the control has focus. Style hook for focus-within treatments.\n */\n@customElement('nord-autocomplete')\nexport default class Autocomplete extends ComboboxBase {\n /**\n * The value of the autocomplete. This is the free text the user has typed (or\n * the `label` of a picked suggestion) — always a single string.\n */\n @property({ attribute: false }) value = ''\n\n /**\n * Enables inline ghost-text completion. While an option is highlighted with\n * the keyboard, the input shows the typed query followed by the remainder of\n * the highlighted option's label, with that remainder text-selected so\n * continued typing overwrites it. Accepting (Enter, ArrowRight/End at the end\n * of the text, or an option click) commits the full label.\n */\n @property({ reflect: true, type: Boolean }) inline = false\n\n /**\n * Shows a clear (✕) button while there is text. Pressing it resets the value\n * to `''`, then fires `clear` and `change`.\n */\n @property({ reflect: true, type: Boolean }) clearable = false\n\n /**\n * Whether focusing the input opens the suggestion list. Defaults to `false`\n * for autocomplete — matching Base UI's `openOnInputClick={false}`, the list\n * appears as the user types rather than on focus. Set to `true` to also open\n * on focus.\n */\n @property({ reflect: true, type: Boolean, attribute: 'open-on-focus' }) override openOnFocus = false\n\n protected override localize = new LocalizeController<'nord-autocomplete'>(this)\n\n /**\n * Whether the active option last changed via the keyboard (arrows/Home/End)\n * rather than pointer hover. Inline ghost completion only fills on keyboard\n * navigation, mirroring Base UI's `keyboardActiveRef`. Reactive so toggling it\n * (even when `activeIndex` is unchanged, e.g. a single filtered option)\n * re-renders the ghost.\n */\n @state() private keyboardActive = false\n\n connectedCallback() {\n super.connectedCallback()\n injectLightDomStyles(this, style)\n }\n\n /**\n * The committed free-text `value` *is* the query, so a programmatically-set\n * `value` (e.g. `el.value = 'fea'`) filters the open list without the user\n * having typed, matching the text the input already displays.\n */\n protected override get filterQuery(): string {\n return this.value\n }\n\n /** The typed query an inline ghost is composed against (the committed value). */\n private get inlineQuery(): string {\n return this.value\n }\n\n /**\n * Whether an inline ghost suffix is currently showing: only in `inline` mode,\n * when the active option (reached via the keyboard) has a label that starts\n * with the typed query and extends it.\n */\n private get hasInlineGhost(): boolean {\n if (!this.inline || !this.keyboardActive || !this.open) {\n return false\n }\n\n const option = this.activeOption\n const query = this.inlineQuery\n\n if (!option || !query) {\n return false\n }\n\n const label = option.label\n return (\n label.length > query.length\n && label.toLocaleLowerCase().startsWith(query.toLocaleLowerCase())\n )\n }\n\n /** The text shown in the input. */\n protected override get displayValue(): string {\n // While an inline ghost is showing, present the typed query plus the\n // highlighted option's remaining label (with the original casing).\n if (this.hasInlineGhost) {\n const query = this.inlineQuery\n const { label } = this.activeOption!\n return query + label.slice(query.length)\n }\n\n // Otherwise the input always reflects the committed free-text value.\n return this.value\n }\n\n /** Free text is always present once non-empty (drives the clear affordance). */\n protected override get hasValue(): boolean {\n return this.value.length > 0\n }\n\n protected override get formValue(): string | undefined {\n return this.value || undefined\n }\n\n protected override get showClear(): boolean {\n return this.clearable && this.hasValue && !this.disabled\n }\n\n /**\n * Autocomplete is a search input with suggestions, not a picker — like Base\n * UI's autocomplete it renders no dropdown chevron (its `AriaCombobox` has no\n * `Trigger`). The list appears as you type, not on a toggle click.\n */\n protected override get showToggle(): boolean {\n return false\n }\n\n /**\n * The `aria-autocomplete` value for the inner input, mapping the `inline` +\n * `external-filtering` axes onto the four ARIA values:\n * - inline + internal filter → `both`\n * - inline + external-filtering → `inline` (static list + ghost)\n * - external-filtering (no inline) → `none` (static list, no ghost)\n * - otherwise → `list` (internal filter, no ghost)\n */\n protected override get ariaAutocomplete(): 'list' | 'both' | 'inline' | 'none' {\n if (this.inline) {\n return this.externalFiltering ? 'inline' : 'both'\n }\n return this.externalFiltering ? 'none' : 'list'\n }\n\n /**\n * Autocomplete renders no selection state — `aria-selected` is omitted\n * (`optionAriaSelected` → nothing) and the check is never shown\n * (`showCheck` → false) — so nothing is ever \"selected\".\n */\n protected override isSelected(): boolean {\n return false\n }\n\n /**\n * Autocomplete has no selection model, so the listbox does not advertise\n * `aria-multiselectable` at all (the base's `'false'` would imply a single-\n * select semantic it doesn't have).\n */\n protected override get ariaMultiselectable(): undefined {\n return undefined\n }\n\n /** Autocomplete never shows the selected-check icon (it is not a select). */\n protected override showCheck(): boolean {\n return false\n }\n\n /** No selection model, so no leading check gutter (avoids indenting suggestions). */\n protected override get rendersCheck(): boolean {\n return false\n }\n\n /** Autocomplete options are completion aids, not selectable values — omit aria-selected. */\n protected override optionAriaSelected(): typeof nothing {\n return nothing\n }\n\n /** Autocomplete keeps its committed free-text query when the listbox closes. */\n protected override onHide() {\n // Intentionally empty: the free-text value is the query, so it is not\n // discarded the way select mode's transient filter is.\n }\n\n /** Typing commits the typed text as the live value. */\n protected override onInput(input: HTMLInputElement): void {\n // Typing breaks any inline ghost suffix the keyboard had composed.\n this.keyboardActive = false\n // The typed text *is* the value, so it tracks the input live. `input` has\n // already fired (in the base); `commit()` emits the live `change`.\n this.value = input.value\n this.commit()\n }\n\n /**\n * Runs before the base's own key switch. Marks keyboard navigation (so the\n * inline ghost may compose) and owns the ArrowRight/End inline-accept. After\n * an accept the listbox is closed, so the base's own `End` branch (gated on\n * `this.open`) is skipped; the base still performs the moves for the arrows\n * and Home.\n */\n protected override onKeydown(e: KeyboardEvent): void {\n switch (e.key) {\n case 'ArrowDown':\n case 'ArrowUp':\n case 'Home':\n // The base performs the actual move (and opens a closed listbox); mark\n // it as keyboard navigation so the ghost composes after it.\n if (this.open) {\n this.keyboardActive = true\n }\n break\n case 'ArrowRight':\n case 'End':\n // Accept an inline ghost suffix: End always sits at the text end, and\n // ArrowRight accepts when the selection already reaches the end. When the\n // ghost suffix is selected, `selectionEnd` is the text length, so both\n // cases collapse to \"is the selection at the end?\". A bare `End` (no\n // ghost) falls through to the base's jump-to-last navigation, which we\n // mark as keyboard nav so the ghost composes for the newly-active row.\n if (this.inline && this.open && this.hasInlineGhost) {\n const input = this.inputRef.value\n const atEnd = !input || input.selectionEnd === input.value.length\n if (atEnd) {\n e.preventDefault()\n this.acceptInline()\n break\n }\n }\n if (e.key === 'End' && this.open) {\n this.keyboardActive = true\n }\n break\n case 'Backspace':\n case 'Delete':\n // A deletion breaks any inline ghost suffix.\n this.keyboardActive = false\n break\n }\n }\n\n protected override onMove(): void {\n this.keyboardActive = true\n }\n\n /**\n * Fully owns Enter when the listbox is open. An inline ghost or any\n * highlighted option fills+commits its label; otherwise the typed text is\n * already committed, so Enter just closes and does NOT preventDefault (the\n * owning form may submit). Returns `true` so the base does no further handling.\n */\n protected override handleEnter(e: KeyboardEvent): boolean {\n if (this.inline && this.hasInlineGhost && this.activeOption) {\n e.preventDefault()\n this.acceptInline()\n return true\n }\n\n // A navigated (arrow-key) highlight always commits. `autoHighlight` only\n // implicitly commits the first row when there is a query to complete — Base\n // UI does not highlight index 0 on an empty query, so a bare Enter with no\n // typed text just closes (and may submit the form).\n if ((this.navigated || (this.autoHighlight && this.hasQuery)) && this.activeOption) {\n e.preventDefault()\n this.selectOption(this.activeOption)\n return true\n }\n\n this.hide()\n return true\n }\n\n /** Whether the user has typed/committed any free text to complete against. */\n private get hasQuery(): boolean {\n return this.filterQuery.length > 0\n }\n\n /** Pointer hover never composes an inline ghost (mirrors keyboard-vs-pointer). */\n protected override onOptionHover(): void {\n this.keyboardActive = false\n }\n\n /**\n * Never silently commit an un-accepted inline suggestion: on blur drop the\n * ghost suffix and restore the input to the typed query (the actual value).\n */\n protected override onBlur(): void {\n if (this.inline && this.hasInlineGhost) {\n this.revertInline()\n }\n this.keyboardActive = false\n }\n\n /**\n * Lit binds the inner input's `.value` to the ghost-composed string, but the\n * suffix selection has to be applied imperatively after the DOM update so\n * continued typing overwrites it.\n */\n protected override afterUpdate(): void {\n if (this.hasInlineGhost) {\n const input = this.inputRef.value\n if (input) {\n input.setSelectionRange(this.inlineQuery.length, input.value.length)\n }\n }\n }\n\n /**\n * Picking a suggestion is a completion aid: fill the input with its label and\n * commit that label as the free-text value. No chips, no array, no toggle.\n */\n protected override selectOption(option: ComboboxOption): void {\n if (option.disabled) {\n return\n }\n\n // Remember the label so it survives the option leaving the result set.\n this.labelCache.set(option.value, option.label)\n\n this.keyboardActive = false\n this.value = option.label\n this.search = option.label\n this.commit()\n this.hide()\n // Restore focus to the input without re-opening the listbox.\n this.suppressFocusOpen = true\n this.focus()\n this.suppressFocusOpen = false\n }\n\n /** Commit the currently ghost-highlighted option's full label (inline mode). */\n private acceptInline() {\n const option = this.activeOption\n if (!option) {\n return\n }\n this.selectOption(option)\n }\n\n /**\n * Drop the transient inline ghost suffix, restoring the input to the typed\n * query (the actual committed `value`). Does not change `value`.\n */\n private revertInline() {\n this.keyboardActive = false\n\n const input = this.inputRef.value\n if (input) {\n input.value = this.value\n // Collapse any lingering suffix selection to the end of the typed text.\n input.setSelectionRange(this.value.length, this.value.length)\n }\n }\n\n /** A new query supersedes any inline ghost from the previous one. */\n protected override resetActiveIndex() {\n super.resetActiveIndex()\n this.keyboardActive = false\n }\n\n /** Clear the current value, firing `clear` then `change`. */\n override clear() {\n this.value = ''\n this.search = ''\n this.keyboardActive = false\n this.dispatchEvent(new ComboboxClearEvent())\n this.commit()\n this.focus()\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nord-autocomplete': Autocomplete\n }\n}\n"],"names":["style","retagComboboxStyles","comboboxStyle","Autocomplete","ComboboxBase","constructor","this","value","inline","clearable","openOnFocus","localize","LocalizeController","keyboardActive","connectedCallback","super","injectLightDomStyles","filterQuery","inlineQuery","hasInlineGhost","open","option","activeOption","query","label","length","toLocaleLowerCase","startsWith","displayValue","slice","hasValue","formValue","undefined","showClear","disabled","showToggle","ariaAutocomplete","externalFiltering","isSelected","ariaMultiselectable","showCheck","rendersCheck","optionAriaSelected","nothing","onHide","onInput","input","commit","onKeydown","e","key","inputRef","selectionEnd","preventDefault","acceptInline","onMove","handleEnter","navigated","autoHighlight","hasQuery","selectOption","hide","onOptionHover","onBlur","revertInline","afterUpdate","setSelectionRange","labelCache","set","search","suppressFocusOpen","focus","resetActiveIndex","clear","dispatchEvent","ComboboxClearEvent","__decorate","property","attribute","prototype","reflect","type","Boolean","state","customElement"],"mappings":"o8EAkBA,MAAMA,EAAQC,EAAoBC,EAAe,qBAyClC,IAAMC,EAAN,cAA2BC,EAA3B,WAAAC,uBAKmBC,KAAKC,MAAG,GASID,KAAME,QAAG,EAMTF,KAASG,WAAG,EAQyBH,KAAWI,aAAG,EAE5EJ,KAAAK,SAAW,IAAIC,EAAwCN,MASzDA,KAAcO,gBAAG,CAgUnC,CA9TC,iBAAAC,GACEC,MAAMD,oBACNE,EAAqBV,KAAMN,EAC5B,CAOD,eAAuBiB,GACrB,OAAOX,KAAKC,KACb,CAGD,eAAYW,GACV,OAAOZ,KAAKC,KACb,CAOD,kBAAYY,GACV,IAAKb,KAAKE,SAAWF,KAAKO,iBAAmBP,KAAKc,KAChD,OAAO,EAGT,MAAMC,EAASf,KAAKgB,aACdC,EAAQjB,KAAKY,YAEnB,IAAKG,IAAWE,EACd,OAAO,EAGT,MAAMC,EAAQH,EAAOG,MACrB,OACEA,EAAMC,OAASF,EAAME,QAClBD,EAAME,oBAAoBC,WAAWJ,EAAMG,oBAEjD,CAGD,gBAAuBE,GAGrB,GAAItB,KAAKa,eAAgB,CACvB,MAAMI,EAAQjB,KAAKY,aACbM,MAAEA,GAAUlB,KAAKgB,aACvB,OAAOC,EAAQC,EAAMK,MAAMN,EAAME,OAClC,CAGD,OAAOnB,KAAKC,KACb,CAGD,YAAuBuB,GACrB,OAAOxB,KAAKC,MAAMkB,OAAS,CAC5B,CAED,aAAuBM,GACrB,OAAOzB,KAAKC,YAASyB,CACtB,CAED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C,EAAS,CAAEG,SAAS,EAAMC,KAAMC,WAAyB/E,EAAA4E,UAAA,cAAA,GAMdH,EAAA,CAA3CC,EAAS,CAAEG,SAAS,EAAMC,KAAMC,WAA4B/E,EAAA4E,UAAA,iBAAA,GAQoBH,EAAA,CAAhFC,EAAS,CAAEG,SAAS,EAAMC,KAAMC,QAASJ,UAAW,mBAA+C3E,EAAA4E,UAAA,mBAAA,GAWnFH,EAAA,CAAhBO,KAAsChF,EAAA4E,UAAA,sBAAA,GAvCpB5E,EAAYyE,EAAA,CADhCQ,EAAc,sBACMjF,SAAAA"}
|
|
1
|
+
{"version":3,"file":"Autocomplete.js","sources":["../src/autocomplete/Autocomplete.ts"],"sourcesContent":["import type { ComboboxOption } from '../combobox/ComboboxBase.js'\nimport { nothing } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\nimport comboboxStyle from '../combobox/Combobox.css'\nimport ComboboxBase, { retagComboboxStyles } from '../combobox/ComboboxBase.js'\nimport { ComboboxClearEvent } from '../combobox/ComboboxEvents.js'\nimport { injectLightDomStyles } from '../common/light-dom-styles.js'\nimport { LocalizeController } from '../localization/LocalizeController.js'\n\nexport type { ComboboxOption } from '../combobox/ComboboxBase.js'\nexport { ComboboxClearEvent } from '../combobox/ComboboxEvents.js'\n\n/**\n * The shared combobox stylesheet is authored once against the `nord-combobox`\n * tag (see `Combobox.css`); re-prefix it for `nord-autocomplete` so this sibling\n * light-DOM control reuses the exact same `.n-*` rules without duplicating them.\n */\nconst style = retagComboboxStyles(comboboxStyle, 'nord-autocomplete')\n\n/**\n * Autocomplete is a free-text input with suggestions: the text the user types\n * is itself the committed `value` (a string), and the options are completion\n * aids. Picking a suggestion fills the input with the option's `label` and commits\n * that label. Use it when the answer is open-ended text but you can offer\n * helpful completions (a city, a tag, a username); reach for\n * [Combobox](/components/combobox/) instead when the value must be one of a\n * fixed set of options.\n *\n * Autocomplete is a control only — it has no built-in label, hint or error.\n * Compose it inside a [Field](/components/field/) to give it a label, hint and\n * error message, the same way you would a native input.\n *\n * Base UI parity: Autocomplete is the Combobox primitive with\n * `selectionMode=\"none\"` + `fillInputOnItemPress`.\n *\n * @status draft\n * @category form\n * @lightDom true\n *\n * @slot start - Optional slot used to place an icon or prefix at the start of the control.\n * @slot end - Optional slot used to place an icon or suffix at the end of the control.\n *\n * @fires {NordEvent} change - Dispatched when the committed value changes via user interaction.\n * @fires {NordEvent} input - Dispatched as the user types into the input.\n * @fires {NordEvent} open - Dispatched when the listbox is opened.\n * @fires {NordEvent} close - Dispatched when the listbox is closed.\n * @fires {ComboboxClearEvent} clear - Dispatched when the value is cleared via the clear button or `clear()`.\n *\n * @localization clearLabel - Accessible label for the clear button.\n * @localization noResults - Message shown when no options match the query.\n *\n * @cssprop [--n-combobox-list-inline-size] - Controls the inline size, or width, of the dropdown list. Defaults to the width of the control.\n * @cssprop [--n-combobox-block-size] - Controls the block size, or height, of the control. The medium default is `var(--n-space-xl)`; the s and l sizes scale from it.\n *\n * @attr {boolean} data-invalid - Present while the control is invalid (mirrors the `invalid` property). Style hook for the whole control.\n * @attr {boolean} data-focused - Present while the control has focus. Style hook for focus-within treatments.\n */\n@customElement('nord-autocomplete')\nexport default class Autocomplete extends ComboboxBase {\n /**\n * The value of the autocomplete. This is the free text the user has typed (or\n * the `label` of a picked suggestion) — always a single string.\n */\n @property({ attribute: false }) value = ''\n\n /**\n * Enables inline ghost-text completion. While an option is highlighted with\n * the keyboard, the input shows the typed query followed by the remainder of\n * the highlighted option's label, with that remainder text-selected so\n * continued typing overwrites it. Accepting (Enter, ArrowRight/End at the end\n * of the text, or an option click) commits the full label.\n */\n @property({ reflect: true, type: Boolean }) inline = false\n\n /**\n * Shows a clear (✕) button while there is text. Pressing it resets the value\n * to `''`, then fires `clear` and `change`.\n */\n @property({ reflect: true, type: Boolean }) clearable = false\n\n /**\n * Whether clicking the input opens the suggestion list. Defaults to `false`\n * for autocomplete — matching Base UI's `openOnInputClick={false}`, the list\n * appears as the user types rather than on click. Set to `true` to also open\n * on click.\n */\n @property({ reflect: true, type: Boolean, attribute: 'open-on-input-click' }) override openOnInputClick = false\n\n protected override localize = new LocalizeController<'nord-autocomplete'>(this)\n\n /**\n * Whether the active option last changed via the keyboard (arrows/Home/End)\n * rather than pointer hover. Inline ghost completion only fills on keyboard\n * navigation, mirroring Base UI's `keyboardActiveRef`. Reactive so toggling it\n * (even when `activeIndex` is unchanged, e.g. a single filtered option)\n * re-renders the ghost.\n */\n @state() private keyboardActive = false\n\n connectedCallback() {\n super.connectedCallback()\n injectLightDomStyles(this, style)\n }\n\n /**\n * The committed free-text `value` *is* the query, so a programmatically-set\n * `value` (e.g. `el.value = 'fea'`) filters the open list without the user\n * having typed, matching the text the input already displays.\n */\n protected override get filterQuery(): string {\n return this.value\n }\n\n /** The typed query an inline ghost is composed against (the committed value). */\n private get inlineQuery(): string {\n return this.value\n }\n\n /**\n * Whether an inline ghost suffix is currently showing: only in `inline` mode,\n * when the active option (reached via the keyboard) has a label that starts\n * with the typed query and extends it.\n */\n private get hasInlineGhost(): boolean {\n if (!this.inline || !this.keyboardActive || !this.open) {\n return false\n }\n\n const option = this.activeOption\n const query = this.inlineQuery\n\n if (!option || !query) {\n return false\n }\n\n const label = option.label\n return (\n label.length > query.length\n && label.toLocaleLowerCase().startsWith(query.toLocaleLowerCase())\n )\n }\n\n /** The text shown in the input. */\n protected override get displayValue(): string {\n // While an inline ghost is showing, present the typed query plus the\n // highlighted option's remaining label (with the original casing).\n if (this.hasInlineGhost) {\n const query = this.inlineQuery\n const { label } = this.activeOption!\n return query + label.slice(query.length)\n }\n\n // Otherwise the input always reflects the committed free-text value.\n return this.value\n }\n\n /** Free text is always present once non-empty (drives the clear affordance). */\n protected override get hasValue(): boolean {\n return this.value.length > 0\n }\n\n protected override get formValue(): string | undefined {\n return this.value || undefined\n }\n\n protected override get showClear(): boolean {\n return this.clearable && this.hasValue && !this.disabled && !this.readonly\n }\n\n /**\n * Autocomplete is a search input with suggestions, not a picker — like Base\n * UI's autocomplete it renders no dropdown chevron (its `AriaCombobox` has no\n * `Trigger`). The list appears as you type, not on a toggle click.\n */\n protected override get showToggle(): boolean {\n return false\n }\n\n /**\n * The `aria-autocomplete` value for the inner input, mapping the `inline` +\n * `external-filtering` axes onto the four ARIA values:\n * - inline + internal filter → `both`\n * - inline + external-filtering → `inline` (static list + ghost)\n * - external-filtering (no inline) → `none` (static list, no ghost)\n * - otherwise → `list` (internal filter, no ghost)\n */\n protected override get ariaAutocomplete(): 'list' | 'both' | 'inline' | 'none' {\n if (this.inline) {\n return this.externalFiltering ? 'inline' : 'both'\n }\n return this.externalFiltering ? 'none' : 'list'\n }\n\n /**\n * Autocomplete renders no selection state — `aria-selected` is omitted\n * (`optionAriaSelected` → nothing) and the check is never shown\n * (`showCheck` → false) — so nothing is ever \"selected\".\n */\n protected override isSelected(): boolean {\n return false\n }\n\n /**\n * Autocomplete has no selection model, so the listbox does not advertise\n * `aria-multiselectable` at all (the base's `'false'` would imply a single-\n * select semantic it doesn't have).\n */\n protected override get ariaMultiselectable(): undefined {\n return undefined\n }\n\n /** Autocomplete never shows the selected-check icon (it is not a select). */\n protected override showCheck(): boolean {\n return false\n }\n\n /** No selection model, so no leading check gutter (avoids indenting suggestions). */\n protected override get rendersCheck(): boolean {\n return false\n }\n\n /** Autocomplete options are completion aids, not selectable values — omit aria-selected. */\n protected override optionAriaSelected(): typeof nothing {\n return nothing\n }\n\n /** Autocomplete keeps its committed free-text query when the listbox closes. */\n protected override onHide() {\n // Intentionally empty: the free-text value is the query, so it is not\n // discarded the way select mode's transient filter is.\n }\n\n /** Typing commits the typed text as the live value. */\n protected override onInput(input: HTMLInputElement): void {\n // Typing breaks any inline ghost suffix the keyboard had composed.\n this.keyboardActive = false\n // The typed text *is* the value, so it tracks the input live. `input` has\n // already fired (in the base); `commit()` emits the live `change`.\n this.value = input.value\n this.commit()\n }\n\n /**\n * Runs before the base's own key switch. Marks keyboard navigation (so the\n * inline ghost may compose) and owns the ArrowRight/End inline-accept. After\n * an accept the listbox is closed, so the base's own `End` branch (gated on\n * `this.open`) is skipped; the base still performs the moves for the arrows\n * and Home.\n */\n protected override onKeydown(e: KeyboardEvent): void {\n switch (e.key) {\n case 'ArrowDown':\n case 'ArrowUp':\n case 'Home':\n // The base performs the actual move (and opens a closed listbox); mark\n // it as keyboard navigation so the ghost composes after it.\n if (this.open) {\n this.keyboardActive = true\n }\n break\n case 'ArrowRight':\n case 'End':\n // Accept an inline ghost suffix: End always sits at the text end, and\n // ArrowRight accepts when the selection already reaches the end. When the\n // ghost suffix is selected, `selectionEnd` is the text length, so both\n // cases collapse to \"is the selection at the end?\". A bare `End` (no\n // ghost) falls through to the base's jump-to-last navigation, which we\n // mark as keyboard nav so the ghost composes for the newly-active row.\n if (this.inline && this.open && this.hasInlineGhost) {\n const input = this.inputRef.value\n const atEnd = !input || input.selectionEnd === input.value.length\n if (atEnd) {\n e.preventDefault()\n this.acceptInline()\n break\n }\n }\n if (e.key === 'End' && this.open) {\n this.keyboardActive = true\n }\n break\n case 'Backspace':\n case 'Delete':\n // A deletion breaks any inline ghost suffix.\n this.keyboardActive = false\n break\n }\n }\n\n protected override onMove(): void {\n this.keyboardActive = true\n }\n\n /**\n * Fully owns Enter when the listbox is open. An inline ghost or any\n * highlighted option fills+commits its label; otherwise the typed text is\n * already committed, so Enter just closes and does NOT preventDefault (the\n * owning form may submit). Returns `true` so the base does no further handling.\n */\n protected override handleEnter(e: KeyboardEvent): boolean {\n if (this.inline && this.hasInlineGhost && this.activeOption) {\n e.preventDefault()\n this.acceptInline()\n return true\n }\n\n // A navigated (arrow-key) highlight always commits. `autoHighlight` only\n // implicitly commits the first row when there is a query to complete — Base\n // UI does not highlight index 0 on an empty query, so a bare Enter with no\n // typed text just closes (and may submit the form).\n if ((this.navigated || (this.autoHighlight && this.hasQuery)) && this.activeOption) {\n e.preventDefault()\n this.selectOption(this.activeOption)\n return true\n }\n\n this.hide()\n return true\n }\n\n /** Whether the user has typed/committed any free text to complete against. */\n private get hasQuery(): boolean {\n return this.filterQuery.length > 0\n }\n\n /** Pointer hover never composes an inline ghost (mirrors keyboard-vs-pointer). */\n protected override onOptionHover(): void {\n this.keyboardActive = false\n }\n\n /**\n * Never silently commit an un-accepted inline suggestion: on blur drop the\n * ghost suffix and restore the input to the typed query (the actual value).\n */\n protected override onBlur(): void {\n if (this.inline && this.hasInlineGhost) {\n this.revertInline()\n }\n this.keyboardActive = false\n }\n\n /**\n * Lit binds the inner input's `.value` to the ghost-composed string, but the\n * suffix selection has to be applied imperatively after the DOM update so\n * continued typing overwrites it.\n */\n protected override afterUpdate(): void {\n if (this.hasInlineGhost) {\n const input = this.inputRef.value\n if (input) {\n input.setSelectionRange(this.inlineQuery.length, input.value.length)\n }\n }\n }\n\n /**\n * Picking a suggestion is a completion aid: fill the input with its label and\n * commit that label as the free-text value. No chips, no array, no toggle.\n */\n protected override selectOption(option: ComboboxOption): void {\n if (option.disabled) {\n return\n }\n\n // Remember the label so it survives the option leaving the result set.\n this.labelCache.set(option.value, option.label)\n\n this.keyboardActive = false\n this.value = option.label\n this.search = option.label\n this.commit()\n this.hide()\n // Restore focus to the input. Focus alone never opens the listbox.\n this.focus()\n }\n\n /** Commit the currently ghost-highlighted option's full label (inline mode). */\n private acceptInline() {\n const option = this.activeOption\n if (!option) {\n return\n }\n this.selectOption(option)\n }\n\n /**\n * Drop the transient inline ghost suffix, restoring the input to the typed\n * query (the actual committed `value`). Does not change `value`.\n */\n private revertInline() {\n this.keyboardActive = false\n\n const input = this.inputRef.value\n if (input) {\n input.value = this.value\n // Collapse any lingering suffix selection to the end of the typed text.\n input.setSelectionRange(this.value.length, this.value.length)\n }\n }\n\n /** A new query supersedes any inline ghost from the previous one. */\n protected override resetActiveIndex() {\n super.resetActiveIndex()\n this.keyboardActive = false\n }\n\n /** Clear the current value, firing `clear` then `change`. */\n override clear() {\n this.value = ''\n this.search = ''\n this.keyboardActive = false\n this.dispatchEvent(new ComboboxClearEvent())\n this.commit()\n this.focus()\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nord-autocomplete': Autocomplete\n }\n}\n"],"names":["style","retagComboboxStyles","comboboxStyle","Autocomplete","ComboboxBase","constructor","this","value","inline","clearable","openOnInputClick","localize","LocalizeController","keyboardActive","connectedCallback","super","injectLightDomStyles","filterQuery","inlineQuery","hasInlineGhost","open","option","activeOption","query","label","length","toLocaleLowerCase","startsWith","displayValue","slice","hasValue","formValue","undefined","showClear","disabled","readonly","showToggle","ariaAutocomplete","externalFiltering","isSelected","ariaMultiselectable","showCheck","rendersCheck","optionAriaSelected","nothing","onHide","onInput","input","commit","onKeydown","e","key","inputRef","selectionEnd","preventDefault","acceptInline","onMove","handleEnter","navigated","autoHighlight","hasQuery","selectOption","hide","onOptionHover","onBlur","revertInline","afterUpdate","setSelectionRange","labelCache","set","search","focus","resetActiveIndex","clear","dispatchEvent","ComboboxClearEvent","__decorate","property","attribute","prototype","reflect","type","Boolean","state","customElement"],"mappings":"y9EAkBA,MAAMA,EAAQC,EAAoBC,EAAe,qBAyClC,IAAMC,EAAN,cAA2BC,EAA3B,WAAAC,uBAKmBC,KAAKC,MAAG,GASID,KAAME,QAAG,EAMTF,KAASG,WAAG,EAQ+BH,KAAgBI,kBAAG,EAEvFJ,KAAAK,SAAW,IAAIC,EAAwCN,MASzDA,KAAcO,gBAAG,CA8TnC,CA5TC,iBAAAC,GACEC,MAAMD,oBACNE,EAAqBV,KAAMN,EAC5B,CAOD,eAAuBiB,GACrB,OAAOX,KAAKC,KACb,CAGD,eAAYW,GACV,OAAOZ,KAAKC,KACb,CAOD,kBAAYY,GACV,IAAKb,KAAKE,SAAWF,KAAKO,iBAAmBP,KAAKc,KAChD,OAAO,EAGT,MAAMC,EAASf,KAAKgB,aACdC,EAAQjB,KAAKY,YAEnB,IAAKG,IAAWE,EACd,OAAO,EAGT,MAAMC,EAAQH,EAAOG,MACrB,OACEA,EAAMC,OAASF,EAAME,QAClBD,EAAME,oBAAoBC,WAAWJ,EAAMG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KAAKO,gBAAiB,CACvB,CAGQ,KAAA4D,GACPnE,KAAKC,MAAQ,GACbD,KAAKgE,OAAS,GACdhE,KAAKO,gBAAiB,EACtBP,KAAKoE,cAAc,IAAIC,GACvBrE,KAAK0C,SACL1C,KAAKiE,OACN,GA/V+BK,EAAA,CAA/BC,EAAS,CAAEC,WAAW,KAAmB3E,EAAA4E,UAAA,aAAA,GASEH,EAAA,CAA3CC,EAAS,CAAEG,SAAS,EAAMC,KAAMC,WAAyB/E,EAAA4E,UAAA,cAAA,GAMdH,EAAA,CAA3CC,EAAS,CAAEG,SAAS,EAAMC,KAAMC,WAA4B/E,EAAA4E,UAAA,iBAAA,GAQ0BH,EAAA,CAAtFC,EAAS,CAAEG,SAAS,EAAMC,KAAMC,QAASJ,UAAW,yBAA0D3E,EAAA4E,UAAA,wBAAA,GAW9FH,EAAA,CAAhBO,KAAsChF,EAAA4E,UAAA,sBAAA,GAvCpB5E,EAAYyE,EAAA,CADhCQ,EAAc,sBACMjF,SAAAA"}
|
package/lib/Avatar.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Avatar.js","sources":["../src/avatar/Avatar.ts"],"sourcesContent":["import type { States } from '../common/fsm.js'\nimport { html, LitElement, nothing } from 'lit'\n\nimport { customElement, property, state } from 'lit/decorators.js'\nimport { observe } from '../common/decorators/observe.js'\nimport { fsm } from '../common/fsm.js'\nimport componentStyle from '../common/styles/Component.css'\nimport style from './Avatar.css'\nimport '../visually-hidden/VisuallyHidden.js'\nimport '../icon/Icon.js'\n\nconst { transition } = fsm({\n initial: {\n 'src-set': 'loading',\n },\n loading: {\n 'load': 'loaded',\n 'error': 'initial',\n 'src-clear': 'initial',\n },\n loaded: {\n 'src-set': 'loading',\n 'src-clear': 'initial',\n },\n})\n\n/**\n * Avatar is used for showing a thumbnail representation of a single user or entity.\n * Default avatar illustration is displayed when no src is specified.\n *\n * @status ready\n * @category
|
|
1
|
+
{"version":3,"file":"Avatar.js","sources":["../src/avatar/Avatar.ts"],"sourcesContent":["import type { States } from '../common/fsm.js'\nimport { html, LitElement, nothing } from 'lit'\n\nimport { customElement, property, state } from 'lit/decorators.js'\nimport { observe } from '../common/decorators/observe.js'\nimport { fsm } from '../common/fsm.js'\nimport componentStyle from '../common/styles/Component.css'\nimport style from './Avatar.css'\nimport '../visually-hidden/VisuallyHidden.js'\nimport '../icon/Icon.js'\n\nconst { transition } = fsm({\n initial: {\n 'src-set': 'loading',\n },\n loading: {\n 'load': 'loaded',\n 'error': 'initial',\n 'src-clear': 'initial',\n },\n loaded: {\n 'src-set': 'loading',\n 'src-clear': 'initial',\n },\n})\n\n/**\n * Avatar is used for showing a thumbnail representation of a single user or entity.\n * Default avatar illustration is displayed when no src is specified.\n *\n * @status ready\n * @category content\n *\n * @cssprop [--n-avatar-color=var(--n-color-status-highlight)] - Controls the color of the avatar fallback, using [color tokens](/tokens/#color).\n * @cssprop [--n-avatar-size=var(--n-size-icon-l)] - Controls the size of the avatar, using [icon sizing tokens](/tokens/#size).\n * @cssprop [--n-avatar-box-shadow=none] - Controls the box shadow for the avatar.\n * @cssprop [--n-avatar-text-color=var(--n-color-text-on-accent)] - Controls the color of the avatar’s text and icon, using [color tokens](/tokens/#color).\n */\n\n@customElement('nord-avatar')\nexport default class Avatar extends LitElement {\n static styles = [componentStyle, style]\n\n @state() private state: States<typeof transition> = 'initial'\n\n /**\n * The size of the avatar.\n */\n @property({ reflect: true }) size: 's' | 'm' | 'l' | 'xl' | 'xxl' | 'xxxl' = 'm'\n\n /**\n * The URL of the avatar image uploaded by the user.\n */\n @property({ reflect: true }) src?: string\n\n /**\n * The name of the person or entity.\n */\n @property({ reflect: true }) name: string = ''\n\n /**\n * The fallback icon.\n */\n @property({ reflect: true }) icon?: string\n\n /**\n * The style variant of the avatar.\n */\n @property({ reflect: true }) variant: 'default' | 'square' = 'default'\n\n render() {\n return html`\n <div class=\"n-avatar\">\n ${this.state !== 'initial' ? this.renderImage() : nothing}\n ${this.state !== 'loaded' ? this.renderFallback() : nothing}\n </div>\n `\n }\n\n @observe('src')\n protected handleSrcChange() {\n const event = this.src ? 'src-set' : 'src-clear'\n this.state = transition(this.state, event)\n }\n\n protected renderImage() {\n return this.src\n ? html`\n <slot hidden></slot>\n <img\n class=\"n-${this.state}\"\n src=${this.src}\n @load=${this.handleLoad}\n @error=${this.handleError}\n alt=${this.name || ''}\n />\n `\n : nothing\n }\n\n protected renderFallback() {\n return html`\n <nord-visually-hidden>${this.name}</nord-visually-hidden>\n <div class=\"n-avatar-inner\" aria-hidden=\"true\">\n <slot></slot>\n </div>\n ${this.icon\n ? html`<nord-icon name=\"${this.icon}\"></nord-icon>`\n : html`\n <svg aria-hidden=\"true\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 27 27\">\n <rect fill=\"var(--_n-avatar-color)\" height=\"27\" rx=\"12\" width=\"27\" x=\"0\" y=\"0\"></rect>\n <g fill=\"#fff\" opacity=\".7\">\n <circle cx=\"13.5\" cy=\"30\" r=\"13\"></circle>\n <circle cx=\"13.5\" cy=\"11\" r=\"5\"></circle>\n </g>\n </svg>\n `}\n `\n }\n\n private handleLoad() {\n this.state = transition(this.state, 'load')\n }\n\n private handleError() {\n this.state = transition(this.state, 'error')\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nord-avatar': Avatar\n }\n}\n"],"names":["transition","fsm","initial","loading","load","error","loaded","Avatar","LitElement","constructor","this","state","size","name","variant","render","html","renderImage","nothing","renderFallback","handleSrcChange","event","src","handleLoad","handleError","icon","styles","componentStyle","style","__decorate","prototype","property","reflect","observe","customElement"],"mappings":"o2FAWMA,WAAEA,GAAeC,EAAI,CACzBC,QAAS,CACP,UAAW,WAEbC,QAAS,CACPC,KAAQ,SACRC,MAAS,UACT,YAAa,WAEfC,OAAQ,CACN,UAAW,UACX,YAAa,aAkBF,IAAMC,EAAN,cAAqBC,EAArB,WAAAC,uBAGIC,KAAKC,MAA8B,UAKvBD,KAAIE,KAA4C,IA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 +1,2 @@
|
|
|
1
|
+
import{_ as e}from"./tslib.es6-CmLYFWVC.js";import{css as a,LitElement as n,isServer as t,html as i}from"lit";import{query as r,property as s,state as o,customElement as d}from"lit/decorators.js";import{classMap as l}from"lit/directives/class-map.js";import{repeat as c}from"lit/directives/repeat.js";import{c as h}from"./tinykeys-DwvDXsEb.js";import{m as v,c as u}from"./collection-Dvg2XbxV.js";import{D as p}from"./DirectionController-ChvNGESZ.js";import{E as g}from"./EventController-BBOmvfLa.js";import{D as m,k as f,p as y,a as b,d as x,l as w,m as z,n as D,o as k,q as $,b as _,s as S,r as F,t as M,u as T,g as C,v as Y}from"./dates-C-ZvzXaC.js";import{o as j}from"./observe-D0n0zOfU.js";import{c as N}from"./cond-CI1KbneT.js";import{r as R}from"./number-Dg2vCfGd.js";import{s as E}from"./Component-BJ5O5n8k.js";import L from"./Icon.js";import{LocalizeController as O}from"./LocalizeController.js";import{DateRangeSelectEvent as X}from"./DateRangeSelectEvent.js";import{DateSelectEvent as W}from"./DateSelectEvent.js";import"./Button.js";import"./VisuallyHidden.js";var A=Object.freeze({__proto__:null,default:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m.100342 6.92903 2.121318-2.12132 7.77818 7.77819 7.77826-7.77828 2.1213 2.12132-8.4853 8.48536c-.7811.7811-2.04743.7811-2.82848 0z" fill="currentColor"/></svg>',tags:"nordicon arrow down small caret pointing triangle chevron",title:"arrow-down-small"});var U=Object.freeze({__proto__:null,default:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m13.0712.105225 2.1213 2.121315-7.77816 7.77816 7.77826 7.7783-2.1213 2.1213-8.48539-8.4854c-.78105-.781-.78105-2.04735 0-2.82839z" fill="currentColor"/></svg>',tags:"nordicon arrow left small caret pointing triangle chevron",title:"arrow-left-small"});var H=Object.freeze({__proto__:null,default:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m6.92903.100342-2.12132 2.121318 7.77819 7.77818-7.77828 7.77826 2.12132 2.1213 8.48536-8.4853c.7811-.7811.7811-2.04743 0-2.82848z" fill="currentColor"/></svg>',tags:"nordicon arrow right small caret pointing triangle chevron",title:"arrow-right-small"});const I=e=>e.preventDefault();class P{constructor(e,a){this.hadFirstUpdate=!1,this.initialTouchX=0,this.initialTouchY=0,this.handleTouchStart=e=>{const[{pageX:a,pageY:n}]=e.changedTouches;this.initialTouchX=a,this.initialTouchY=n},this.handleTouchEnd=e=>{const[{pageX:a,pageY:n}]=e.changedTouches,{matchesGesture:t,onSwipeEnd:i}=this.options,r=a-this.initialTouchX,s=n-this.initialTouchY,o={initialX:this.initialTouchX,initialY:this.initialTouchY,pageX:a,pageY:n,distX:r,distY:s};t(o)&&(e.preventDefault(),i(o))},e.addController(this),this.events=new g(e),this.options={target:()=>e,...a}}hostUpdated(){if(!this.hadFirstUpdate){this.hadFirstUpdate=!0;const e=this.options.target();this.events.listen(e,"touchstart",this.handleTouchStart),this.events.listen(e,"touchmove",I),this.events.listen(e,"touchend",this.handleTouchEnd)}}hostDisconnected(){this.hadFirstUpdate=!1}}function B({distX:e,distY:a}){return Math.abs(e)>=70&&Math.abs(a)<=70}function q({distX:e,distY:a}){return Math.abs(a)>=70&&Math.abs(e)<=70&&a>0}const V=a`:host{--_n-calendar-box-shadow:var(--n-calendar-box-shadow,var(--n-box-shadow-popout));--_n-calendar-border-radius:var(--n-calendar-border-radius,var(--n-border-radius-s));--_n-calendar-highlight-color:var(--n-calendar-highlight-color,var(--n-color-accent));--_n-calendar-padding-block-start:var(--n-calendar-padding-block,var(--n-space-m));--_n-calendar-padding-block-end:var(--n-calendar-padding-block,var(--n-space-m));--_n-calendar-padding-inline:var(--n-calendar-padding-inline,var(--n-space-m));--_n-calendar-day-size:var(--n-calendar-day-size,var(--n-space-xl));--_n-calendar-day-font-size:var(--n-calendar-day-font-size,var(--n-font-size-m));--_n-calendar-select-label-font-size:var(--n-calendar-select-label-font-size,var(--n-font-size-xl));--_n-calendar-nav-padding-inline:var(--n-calendar-nav-padding-inline,11px);--_n-calendar-nav-gap:var(--n-calendar-nav-gap,var(--n-space-xs));--_n-calendar-header-margin-block-end:var(--n-calendar-header-margin-block-end,var(--n-space-m));--_n-calendar-header-padding-block-end:var(--n-calendar-header-padding-block-end,0);--_n-calendar-header-gap:var(--n-calendar-header-gap,var(--n-space-s));--_n-calendar-inline-size:var(--n-calendar-inline-size,max-content);font-feature-settings:var(--n-font-features-reduced)}:host([size=s]){--_n-calendar-day-size:var(--n-calendar-day-size,calc(var(--n-space-l) + var(--n-space-xs)));--_n-calendar-day-font-size:var(--n-calendar-day-font-size,var(--n-font-size-s));--_n-calendar-select-label-font-size:var(--n-calendar-select-label-font-size,var(--n-font-size-l));--_n-calendar-nav-padding-inline:var(--n-calendar-nav-padding-inline,var(--n-space-s));--_n-calendar-header-margin-block-end:var(--n-calendar-header-margin-block-end,var(--n-space-s));--_n-calendar-header-padding-block-end:var(--n-calendar-header-padding-block-end,var(--n-space-xs))}.n-calendar{background:var(--n-color-surface);border-radius:var(--_n-calendar-border-radius);box-shadow:var(--_n-calendar-box-shadow);inline-size:var(--_n-calendar-inline-size);min-inline-size:min-content;padding-block-end:var(--_n-calendar-padding-block-end);padding-block-start:var(--_n-calendar-padding-block-start);padding-inline-end:var(--_n-calendar-padding-inline);padding-inline-start:var(--_n-calendar-padding-inline);user-select:none}:host([expand]){--_n-calendar-inline-size:var(--n-calendar-inline-size,100%)}.n-calendar-table{border-collapse:collapse;border-spacing:0;color:var(--n-color-text);font-size:var(--n-font-size-m);font-weight:var(--n-font-weight);inline-size:100%;text-align:center}.n-calendar-table-header{font-size:var(--n-font-size-s);font-weight:var(--n-font-weight-active);letter-spacing:1px;padding-block-end:var(--n-space-s);text-decoration:none;text-transform:uppercase}.n-calendar-cell{padding:1px;text-align:center}.n-calendar-day{appearance:none;background:#0000;block-size:var(--_n-calendar-day-size);border:0;border-radius:var(--n-border-radius-s);color:var(--n-color-text);cursor:pointer;display:inline-block;font-family:var(--n-font-family);font-size:var(--_n-calendar-day-font-size);font-variant-numeric:tabular-nums;font-weight:var(--n-font-weight);inline-size:var(--_n-calendar-day-size);padding:0 0 1px;position:relative;text-align:center;vertical-align:middle}.n-calendar-day[aria-current=date]{box-shadow:0 0 0 1px var(--n-color-text-link);color:var(--n-color-text-link);position:relative}.n-calendar-day:hover{background:var(--n-color-active)}.n-calendar-day:focus,.n-calendar-day[aria-pressed=true]{background:var(--n-color-accent);box-shadow:none;color:var(--n-color-text-on-accent);outline:0}.n-calendar-day:active{background:var(--n-color-accent);box-shadow:none!important;color:var(--n-color-text-on-accent)}.n-calendar-day:focus{box-shadow:0 0 5px var(--n-color-accent)}.n-calendar-day:not(.is-month){box-shadow:none}.n-calendar-day:not(.is-month),.n-calendar-day[aria-disabled=true]{background:#0000;color:var(--n-color-text-weakest)}.n-calendar-day[aria-disabled=true]{color:var(--n-color-text-weaker);cursor:default;text-decoration:line-through}.n-calendar-day:not(.is-month)[aria-disabled=true]{color:var(--n-color-text-weakest);text-decoration:none}.n-calendar-day[aria-disabled=true][aria-current=date]{box-shadow:0 0 0 1px var(--n-color-accent);color:var(--n-color-text-link)}.n-calendar-day[aria-disabled=true][aria-current=date]:focus{background:var(--n-color-accent);box-shadow:0 0 5px var(--n-color-accent);color:var(--n-color-text-on-accent)}.n-calendar-day[aria-disabled=true]:not([aria-current=date]):before{display:none}.n-calendar-day.is-outside{background:#0000;box-shadow:none;color:var(--n-color-text-weakest);cursor:default;pointer-events:none}.n-calendar-day.is-outside:before{display:none}:host([range]) .n-calendar-day.is-in-range{background:var(--n-color-active);color:var(--n-color-text)}.n-calendar-day.is-highlighted:after{--_n-calendar-highlight-size:5px;background-color:var(--_n-calendar-highlight-color);block-size:var(--_n-calendar-highlight-size);border-radius:var(--n-border-radius-circle);content:"";inline-size:var(--_n-calendar-highlight-size);inset-block-end:var(--n-space-xs);inset-inline-start:calc(50% - var(--_n-calendar-highlight-size)/2);position:absolute}.n-calendar-day.is-highlighted.is-month:is([aria-pressed=true],:focus):not([aria-disabled=true]):after{background-color:var(--n-color-text-on-accent)}.n-calendar-day.is-highlighted:is(:not(.is-month),.is-outside,[aria-disabled=true]):after{background-color:var(--n-color-text-weakest)}.n-calendar-header{align-items:center;column-gap:var(--_n-calendar-header-gap);display:flex;inline-size:100%;justify-content:space-between;margin-block-end:var(--_n-calendar-header-margin-block-end);padding-block-end:var(--_n-calendar-header-padding-block-end)}.n-calendar-header.is-static{column-gap:var(--n-space-xs)}.n-calendar-title{color:var(--n-color-text);flex:1;font-size:var(--n-font-size-m);font-weight:var(--n-font-weight-heading);margin:0;text-align:center}.n-calendar-header.is-static nord-button.is-hidden{visibility:hidden}.n-calendar.has-multiple-months{align-items:flex-start;display:flex;flex-direction:row;gap:var(--n-space-l)}.n-calendar.has-multiple-months .n-calendar-month{flex:1;min-inline-size:0}.n-calendar-nav{column-gap:var(--_n-calendar-nav-gap);display:flex;white-space:nowrap}.n-calendar-nav nord-button{--_n-button-padding-inline:var(--_n-calendar-nav-padding-inline)}.n-calendar-select{display:inline-flex;line-height:var(--n-line-height);position:relative}.n-calendar-select span{margin-inline-end:var(--n-space-s)}.n-calendar-select select{block-size:100%;cursor:pointer;font-size:var(--n-font-size-l);inline-size:100%;inset-block-start:0;inset-inline-start:0;opacity:0;position:absolute}.n-calendar-select select:focus+.n-calendar-select-label{box-shadow:0 0 0 2px var(--n-color-accent)}.n-calendar-select-label{align-items:center;border-radius:var(--n-border-radius-s);color:var(--n-color-text);display:flex;font-size:var(--_n-calendar-select-label-font-size);font-weight:var(--n-font-weight-active);inline-size:100%;padding-block:0;padding-inline-end:var(--n-space-xs);padding-inline-start:var(--n-space-s);pointer-events:none;position:relative}`;function G(e){return a=>{a.preventDefault(),e(a)}}L.registerIcon(H),L.registerIcon(U),L.registerIcon(A);const J=()=>!1,K=()=>!1;function Q(e,a){return null==e||null==a||e.getTime()<=a.getTime()?[e,a]:[a,e]}let Z=class extends n{constructor(){super(...arguments),this.direction=new p(this),this.swipe=new P(this,{matchesGesture:B,onSwipeEnd:({distX:e})=>this.addMonths(e<0?1:-1)}),this.shortcuts=h({ArrowRight:G((()=>this.addDays(this.direction.isLTR?1:-1))),ArrowLeft:G((()=>this.addDays(this.direction.isLTR?-1:1))),ArrowDown:G((()=>this.addDays(7))),ArrowUp:G((()=>this.addDays(-7))),Home:G((()=>this.startOfWeek())),End:G((()=>this.endOfWeek())),PageUp:G((()=>this.addMonths(-1))),PageDown:G((()=>this.addMonths(1))),"Shift+PageUp":G((()=>this.addYears(-1))),"Shift+PageDown":G((()=>this.addYears(1)))},{ignore:()=>!1}),this.localize=new O(this,{onLangChange:()=>this.handleLangChange()}),this.value="",this.firstDayOfWeek=m.Monday,this.expand=!1,this.size="m",this.isDateDisabled=J,this.isDateHighlighted=K,this.range=!1,this.months=1,this.activeFocus=!1,this.focusedDay=new Date,this.handleDaySelect=e=>{const a=f(e,y(this.min||""),y(this.max||"")),n=!this.isDateDisabled(e);a&&n&&(this.range?this.selectRangeDay(e):(this.value=b(e),this.dispatchEvent(new W("change",e))))},this.handleDayHover=e=>{this.range&&this.pendingRangeStart&&(this.hoveredDay=e)},this.handleMonthSelect=e=>{this.setMonth(Number.parseInt(e.target.value,10))},this.handleYearSelect=e=>{this.setYear(Number.parseInt(e.target.value,10))},this.handleNextMonthClick=e=>{e.preventDefault(),this.addMonths(1)},this.handlePreviousMonthClick=e=>{e.preventDefault(),this.addMonths(-1)},this.enableActiveFocus=()=>{this.activeFocus=!0},this.disableActiveFocus=e=>{const a=e.currentTarget,n=e.relatedTarget;n&&!a.contains(n)&&(this.activeFocus=!1)}}focus(e){var a;const n=null!==(a=null==e?void 0:e.target)&&void 0!==a?a:"day";"day"===n?this.focusedDayNode.focus():"month"===n&&this.monthSelectNode.focus()}render(){var e;const a=this.getToday(),n=y(this.value),r=y(this.rangeStart||""),s=y(this.rangeEnd||""),o=this.pendingRangeStart?null!==(e=this.hoveredDay)&&void 0!==e?e:this.focusedDay:void 0,[d,h]=this.pendingRangeStart?Q(this.pendingRangeStart,o):Q(r,s),p=y(this.min||""),g=y(this.max||""),m=p?x(p):void 0,b=g?w(g):void 0,k=a.getFullYear(),$=p?p.getFullYear():k-100,_=g?g.getFullYear():k+10;t&&this.handleLangChange();const S=Math.max(1,this.months),F=Array.from({length:S},((e,a)=>new Date(this.focusedDay.getFullYear(),this.focusedDay.getMonth()+a,1))),M=S>1,T=null!=p&&F.some((e=>z(p,e))),C=null!=g&&F.some((e=>z(g,e))),j=(e,t)=>{const r=z(e,t);if(M&&!r)return i`<td class="n-calendar-cell" aria-hidden="true"></td>`;const s=!f(e,p,g),o=Y(e,a),c=this.isDateDisabled(e),v=this.isDateHighlighted(e),u=this.dateFormatShort.format(e),m=this.range&&null!=d&&Y(e,d),y=this.range&&null!=h&&Y(e,h),b=this.range&&null!=d&&null!=h&&e>=d&&e<=h,x=this.range?m||y:Y(e,n),w=null!=d&&Y(d,h),D=v&&"string"==typeof v?`${u}, ${v}`:u;return i`<td class="n-calendar-cell"><button type="button" tabindex="${Y(e,this.focusedDay)?0:-1}" class="${l({"n-calendar-day":!0,"is-outside":s,"is-month":r,"is-highlighted":v,"is-in-range":b&&!x,"is-range-start":m&&!w,"is-range-end":y&&!w})}" @click="${()=>this.handleDaySelect(e)}" @mouseenter="${()=>this.handleDayHover(e)}" @keydown="${this.shortcuts}" ?disabled="${s}" aria-disabled="${N(c,"true")}" aria-pressed="${x?"true":"false"}" aria-current="${N(o,"date")}" aria-label="${D}"><span aria-hidden="true">${e.getDate()}</span></button></td>`},E=(e,a,n)=>{const t=e.getMonth(),r=e.getFullYear();if(M){const e=0===a,s=a===S-1;return i`<div class="n-calendar-header is-static"><nord-button class="${l({"n-calendar-prev":!0,"is-hidden":!e})}" size="${this.size}" square variant="plain" @click="${this.handlePreviousMonthClick}" ?disabled="${!e||T}" type="button"><nord-visually-hidden>${this.localize.term("prevMonthLabel")}</nord-visually-hidden><nord-icon name="${this.direction.isLTR?"arrow-left-small":"arrow-right-small"}" size="${"s"===this.size?"xs":"s"}"></nord-icon></nord-button><h2 class="n-calendar-title" id="${n}" aria-live="polite" aria-atomic="true">${this.monthNames[t]} ${r}</h2><nord-button class="${l({"n-calendar-next":!0,"is-hidden":!s})}" size="${this.size}" square variant="plain" @click="${this.handleNextMonthClick}" ?disabled="${!s||C}" type="button"><nord-visually-hidden>${this.localize.term("nextMonthLabel")}</nord-visually-hidden><nord-icon name="${this.direction.isLTR?"arrow-right-small":"arrow-left-small"}" size="${"s"===this.size?"xs":"s"}"></nord-icon></nord-button></div>`}return i`<div class="n-calendar-header"><div><nord-visually-hidden><h2 id="${n}" aria-live="polite" aria-atomic="true">${this.monthNames[t]}, ${r}</h2></nord-visually-hidden><div class="n-calendar-select"><select aria-label="${this.localize.term("monthSelectLabel")}" class="n-calendar-select-month" @input="${this.handleMonthSelect}">${this.monthNames.map(((e,a)=>i`<option value="${a}" ?selected="${a===t}" ?disabled="${!f(new Date(r,a,1),m,b)}">${e}</option>`))}</select><div class="n-calendar-select-label" aria-hidden="true"><span>${this.monthNamesShort[t]}</span><nord-icon color="var(--n-color-icon)" name="arrow-down-small" size="xxs"></nord-icon></div></div><div class="n-calendar-select"><select aria-label="${this.localize.term("yearSelectLabel")}" class="n-calendar-select-year" @input="${this.handleYearSelect}">${c(R($,_),(e=>e),(e=>i`<option ?selected="${e===r}">${e}</option>`))}</select><div class="n-calendar-select-label" aria-hidden="true"><span>${r}</span><nord-icon color="var(--n-color-icon)" name="arrow-down-small" size="xxs"></nord-icon></div></div></div><div class="n-calendar-nav"><nord-button class="n-calendar-prev" size="${this.size}" square @click="${this.handlePreviousMonthClick}" ?disabled="${z(p,e)}" type="button"><nord-visually-hidden>${this.localize.term("prevMonthLabel")}</nord-visually-hidden><nord-icon name="${this.direction.isLTR?"arrow-left-small":"arrow-right-small"}" size="${"s"===this.size?"xs":"s"}"></nord-icon></nord-button><nord-button class="n-calendar-next" size="${this.size}" square @click="${this.handleNextMonthClick}" ?disabled="${z(g,e)}" type="button"><nord-visually-hidden>${this.localize.term("nextMonthLabel")}</nord-visually-hidden><nord-icon name="${this.direction.isLTR?"arrow-right-small":"arrow-left-small"}" size="${"s"===this.size?"xs":"s"}"></nord-icon></nord-button></div></div>`};return i`<div class="${l({"n-calendar":!0,"has-multiple-months":M})}">${F.map(((e,a)=>{const n=`dialog-header-${a}`;return i`<div class="n-calendar-month">${E(e,a,n)}<table class="n-calendar-table" aria-labelledby="${n}" @focusin="${this.enableActiveFocus}" @focusout="${this.disableActiveFocus}"><thead><tr>${v(this.dayNames,this.firstDayOfWeek,((e,a)=>i`<th class="n-calendar-table-header" scope="col"><span aria-hidden="true">${this.dayNamesShort[a]}</span><nord-visually-hidden>${e}</nord-visually-hidden></th>`))}</tr></thead><tbody>${u(D(e,this.firstDayOfWeek),7).map((a=>i`<tr class="n-calendar-row">${a.map((a=>j(a,e)))}</tr>`))}</tbody></table></div>`}))}</div>`}handleValueChange(){this.range||this.setFocusedDay(y(this.value)||this.getToday())}handleRangeChange(){if(!this.range)return;const e=y(this.rangeStart||""),a=y(this.rangeEnd||"");this.setFocusedDay(e||a||this.getToday())}handleFocusedDayChange(){this.activeFocus&&this.focusedDayNode.focus()}handleLangChange(){const e=this.localize.resolvedLang;this.dateFormatShort=new Intl.DateTimeFormat(e,{day:"numeric",month:"long"}),this.monthNames=k(e,"long"),this.monthNamesShort=k(e,"short"),this.dayNames=$(e,"long"),this.dayNamesShort=$(e,"narrow")}selectRangeDay(e){if(!this.pendingRangeStart)return this.pendingRangeStart=e,this.hoveredDay=e,this.rangeStart=b(e),void(this.rangeEnd=b(e));const[a,n]=Q(this.pendingRangeStart,e);this.pendingRangeStart=void 0,this.hoveredDay=void 0,this.rangeStart=b(a),this.rangeEnd=b(n),this.dispatchEvent(new X("range-change",a,n))}getToday(){return y(this.today||"")||new Date}addDays(e){this.setFocusedDay(_(this.focusedDay,e))}addMonths(e){this.setMonth(this.focusedDay.getMonth()+e)}addYears(e){this.setYear(this.focusedDay.getFullYear()+e)}startOfWeek(){this.setFocusedDay(S(this.focusedDay,this.firstDayOfWeek))}endOfWeek(){this.setFocusedDay(F(this.focusedDay,this.firstDayOfWeek))}setMonth(e){const a=M(x(this.focusedDay),e),n=w(a),t=M(this.focusedDay,e);this.setFocusedDay(T(t,a,n))}setYear(e){const a=C(x(this.focusedDay),e),n=w(a),t=C(this.focusedDay,e);this.setFocusedDay(T(t,a,n))}setFocusedDay(e){this.focusedDay=T(e,y(this.min||""),y(this.max||"")),this.dispatchEvent(new W("nord-focus-date",this.focusedDay))}};Z.styles=[E,V],e([r(".n-calendar-select-month",!0)],Z.prototype,"monthSelectNode",void 0),e([r('button[tabindex="0"]')],Z.prototype,"focusedDayNode",void 0),e([s()],Z.prototype,"value",void 0),e([s({reflect:!0,type:Number,attribute:"first-day-of-week"})],Z.prototype,"firstDayOfWeek",void 0),e([s({reflect:!0})],Z.prototype,"min",void 0),e([s({reflect:!0})],Z.prototype,"max",void 0),e([s({reflect:!0})],Z.prototype,"today",void 0),e([s({reflect:!0,type:Boolean})],Z.prototype,"expand",void 0),e([s({reflect:!0})],Z.prototype,"size",void 0),e([s({attribute:!1})],Z.prototype,"isDateDisabled",void 0),e([s({attribute:!1})],Z.prototype,"isDateHighlighted",void 0),e([s({reflect:!0,type:Boolean})],Z.prototype,"range",void 0),e([s({reflect:!0,attribute:"range-start"})],Z.prototype,"rangeStart",void 0),e([s({reflect:!0,attribute:"range-end"})],Z.prototype,"rangeEnd",void 0),e([s({reflect:!0,type:Number})],Z.prototype,"months",void 0),e([o()],Z.prototype,"activeFocus",void 0),e([o()],Z.prototype,"focusedDay",void 0),e([o()],Z.prototype,"pendingRangeStart",void 0),e([o()],Z.prototype,"hoveredDay",void 0),e([j("value")],Z.prototype,"handleValueChange",null),e([j("rangeStart"),j("rangeEnd")],Z.prototype,"handleRangeChange",null),e([j("focusedDay","updated")],Z.prototype,"handleFocusedDayChange",null),Z=e([d("nord-calendar")],Z);var ee=Z;export{ee as C,P as S,q as i};
|
|
2
|
+
//# sourceMappingURL=Calendar-D47b20IT.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Calendar-D47b20IT.js","sources":["../../icons/lib/assets/arrow-down-small.js","../../icons/lib/assets/arrow-left-small.js","../../icons/lib/assets/arrow-right-small.js","../src/common/controllers/SwipeController.ts","../src/calendar/Calendar.ts"],"sourcesContent":["export default '<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"m.100342 6.92903 2.121318-2.12132 7.77818 7.77819 7.77826-7.77828 2.1213 2.12132-8.4853 8.48536c-.7811.7811-2.04743.7811-2.82848 0z\" fill=\"currentColor\"/></svg>';\nexport const title = \"arrow-down-small\";\nexport const tags = \"nordicon arrow down small caret pointing triangle chevron\";\n","export default '<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"m13.0712.105225 2.1213 2.121315-7.77816 7.77816 7.77826 7.7783-2.1213 2.1213-8.48539-8.4854c-.78105-.781-.78105-2.04735 0-2.82839z\" fill=\"currentColor\"/></svg>';\nexport const title = \"arrow-left-small\";\nexport const tags = \"nordicon arrow left small caret pointing triangle chevron\";\n","export default '<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"m6.92903.100342-2.12132 2.121318 7.77819 7.77818-7.77828 7.77826 2.12132 2.1213 8.48536-8.4853c.7811-.7811.7811-2.04743 0-2.82848z\" fill=\"currentColor\"/></svg>';\nexport const title = \"arrow-right-small\";\nexport const tags =\n \"nordicon arrow right small caret pointing triangle chevron\";\n","import type { ReactiveController, ReactiveElement } from 'lit'\nimport { EventController } from './EventController.js'\n\nexport interface SwipeDetails {\n initialX: number\n initialY: number\n pageX: number\n pageY: number\n distX: number\n distY: number\n}\n\nconst preventDefault = (e: Event) => e.preventDefault()\n\ntype SetRequired<T, K extends keyof T> = T & { [Property in K]-?: T[K] }\ninterface SwipeControllerOptions {\n target?: () => HTMLElement\n matchesGesture: (details: SwipeDetails) => boolean\n onSwipeEnd: (details: SwipeDetails) => void\n}\n\nexport class SwipeController implements ReactiveController {\n private events: EventController\n private hadFirstUpdate = false\n\n private initialTouchX: number = 0\n private initialTouchY: number = 0\n private options: SetRequired<SwipeControllerOptions, 'target'>\n\n constructor(host: ReactiveElement, options: SwipeControllerOptions) {\n host.addController(this)\n this.events = new EventController(host)\n\n this.options = {\n target: () => host,\n ...options,\n }\n }\n\n hostUpdated() {\n if (!this.hadFirstUpdate) {\n this.hadFirstUpdate = true\n\n const target = this.options.target()\n this.events.listen(target, 'touchstart', this.handleTouchStart)\n this.events.listen(target, 'touchmove', preventDefault)\n this.events.listen(target, 'touchend', this.handleTouchEnd)\n }\n }\n\n hostDisconnected() {\n this.hadFirstUpdate = false\n }\n\n private handleTouchStart = (event: TouchEvent) => {\n const [{ pageX, pageY }] = event.changedTouches\n this.initialTouchX = pageX\n this.initialTouchY = pageY\n }\n\n private handleTouchEnd = (event: TouchEvent) => {\n const [{ pageX, pageY }] = event.changedTouches\n const { matchesGesture, onSwipeEnd } = this.options\n\n const distX = pageX - this.initialTouchX\n const distY = pageY - this.initialTouchY\n const details = { initialX: this.initialTouchX, initialY: this.initialTouchY, pageX, pageY, distX, distY }\n\n if (matchesGesture(details)) {\n event.preventDefault()\n onSwipeEnd(details)\n }\n }\n}\n\nconst THRESHOLD = 70\n\nexport function isHorizontalSwipe({ distX, distY }: SwipeDetails) {\n return Math.abs(distX) >= THRESHOLD && Math.abs(distY) <= THRESHOLD\n}\n\nexport function isDownwardsSwipe({ distX, distY }: SwipeDetails) {\n return Math.abs(distY) >= THRESHOLD && Math.abs(distX) <= THRESHOLD && distY > 0\n}\n","import * as arrowDownIcon from '@nordhealth/icons/lib/assets/arrow-down-small.js'\nimport * as arrowLeftIcon from '@nordhealth/icons/lib/assets/arrow-left-small.js'\nimport * as arrowRightIcon from '@nordhealth/icons/lib/assets/arrow-right-small.js'\nimport { html, isServer, LitElement } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport { classMap } from 'lit/directives/class-map.js'\nimport { repeat } from 'lit/directives/repeat.js'\nimport { createKeybindingsHandler } from 'tinykeys'\n\nimport { chunk, mapWithOffset } from '../common/collection.js'\nimport { DirectionController } from '../common/controllers/DirectionController.js'\nimport { isHorizontalSwipe, SwipeController } from '../common/controllers/SwipeController.js'\n\nimport {\n addDays,\n clamp,\n DaysOfWeek,\n endOfMonth,\n endOfWeek,\n getDayNames,\n getMonthNames,\n getViewOfMonth,\n inRange,\n isEqual,\n isEqualMonth,\n parseISODate,\n printISODate,\n setMonth,\n setYear,\n startOfMonth,\n startOfWeek,\n} from '../common/dates.js'\nimport { observe } from '../common/decorators/observe.js'\nimport { cond } from '../common/directives/cond.js'\nimport { range } from '../common/number.js'\nimport componentStyle from '../common/styles/Component.css'\nimport Icon from '../icon/Icon.js'\nimport { LocalizeController } from '../localization/LocalizeController.js'\nimport style from './Calendar.css'\n\nimport { DateRangeSelectEvent } from './DateRangeSelectEvent.js'\nimport { DateSelectEvent } from './DateSelectEvent.js'\nimport '../button/Button.js'\nimport '../visually-hidden/VisuallyHidden.js'\n\nexport type DatePredicate = (date: Date) => boolean\n\nIcon.registerIcon(arrowRightIcon)\nIcon.registerIcon(arrowLeftIcon)\nIcon.registerIcon(arrowDownIcon)\n\nfunction preventDefault(fn: EventListener) {\n return (e: Event) => {\n e.preventDefault()\n fn(e)\n }\n}\n\nconst isDateDisabled: DatePredicate = () => false\nconst isDateHighlighted = () => false\n\nconst dialogLabelId = 'dialog-header'\n\n/**\n * Orders two (possibly undefined) dates ascending. Returns `[earlier, later]`,\n * preserving `undefined` slots so callers can render a partial range.\n */\nfunction orderDates(a?: Date, b?: Date): [Date | undefined, Date | undefined] {\n if (a == null || b == null) {\n return [a, b]\n }\n return a.getTime() <= b.getTime() ? [a, b] : [b, a]\n}\n\n/**\n * Calendar allows user to pick a date. It comes with built-in\n * functionality that allows you to set a minimum and a maximum allowed date.\n * Please note that the date must be passed in ISO-8601 format.\n *\n * @status ready\n * @category form\n * @fires {DateSelectEvent} change - Dispatched when a date is selected and the value changes.\n * @fires {DateRangeSelectEvent} range-change - Dispatched in `range` mode when a complete range (start and end) has been selected.\n * @fires {DateSelectEvent} nord-focus-date - Dispatched when the calendar's focused date changes.\n *\n * @cssprop [--n-calendar-border-radius=var(--n-border-radius)] - Controls how rounded the corners are, using [border radius tokens](/tokens/#border-radius).\n * @cssprop [--n-calendar-box-shadow=var(--n-box-shadow-popout)] - Controls the surrounding shadow, using [box shadow tokens](/tokens/#box-shadow).\n * @cssprop [--n-calendar-padding-block=var(--n-space-m)] - Controls the block padding of the calendar, using [space tokens](/tokens/#space).\n * @cssprop [--n-calendar-padding-inline=var(--n-space-m)] - Controls the inline padding of the calendar, using [space tokens](/tokens/#space).\n * @cssprop [--n-calendar-day-size=var(--n-space-xl)] - Controls the block and inline size of each day cell, using [space tokens](/tokens/#space).\n * @cssprop [--n-calendar-day-font-size=var(--n-font-size-m)] - Controls the font size of each day cell, using [font size tokens](/tokens/#font-size).\n * @cssprop [--n-calendar-select-label-font-size=var(--n-font-size-xl)] - Controls the font size of the month and year select labels, using [font size tokens](/tokens/#font-size).\n * @cssprop [--n-calendar-nav-padding-inline=11px] - Controls the inline padding of the previous and next month buttons.\n * @cssprop [--n-calendar-nav-gap=var(--n-space-xs)] - Controls the gap between the previous and next month buttons, using [space tokens](/tokens/#space).\n * @cssprop [--n-calendar-header-margin-block-end=var(--n-space-m)] - Controls the block-end margin of the calendar header, using [space tokens](/tokens/#space).\n * @cssprop [--n-calendar-header-padding-block-end=0] - Controls the block-end padding of the calendar header, using [space tokens](/tokens/#space).\n * @cssprop [--n-calendar-header-gap=var(--n-space-s)] - Controls the gap between the month/year selects and the navigation buttons, using [space tokens](/tokens/#space).\n * @cssprop [--n-calendar-inline-size=max-content] - Controls the inline size of the calendar. Defaults to `100%` when the `expand` attribute is set.\n *\n * @localization prevMonthLabel - Accessible label for the previous month button.\n * @localization nextMonthLabel - Accessible label for the next month button.\n * @localization monthSelectLabel - Accessible label for the month select.\n * @localization yearSelectLabel - Accessible label for the year select.\n */\n@customElement('nord-calendar')\nexport default class Calendar extends LitElement {\n static styles = [componentStyle, style]\n\n @query('.n-calendar-select-month', true) private monthSelectNode!: HTMLElement\n @query(`button[tabindex=\"0\"]`) private focusedDayNode!: HTMLButtonElement\n\n private direction = new DirectionController(this)\n private swipe = new SwipeController(this, {\n matchesGesture: isHorizontalSwipe,\n onSwipeEnd: ({ distX }) => this.addMonths(distX < 0 ? 1 : -1),\n })\n\n private shortcuts = createKeybindingsHandler(\n {\n 'ArrowRight': preventDefault(() => this.addDays(this.direction.isLTR ? 1 : -1)),\n 'ArrowLeft': preventDefault(() => this.addDays(this.direction.isLTR ? -1 : 1)),\n 'ArrowDown': preventDefault(() => this.addDays(7)),\n 'ArrowUp': preventDefault(() => this.addDays(-7)),\n 'Home': preventDefault(() => this.startOfWeek()),\n 'End': preventDefault(() => this.endOfWeek()),\n 'PageUp': preventDefault(() => this.addMonths(-1)),\n 'PageDown': preventDefault(() => this.addMonths(1)),\n 'Shift+PageUp': preventDefault(() => this.addYears(-1)),\n 'Shift+PageDown': preventDefault(() => this.addYears(1)),\n },\n // Opt out of tinykeys v4's default ignore so holding an arrow key keeps\n // moving the focused day (the default filter drops key-repeat events).\n { ignore: () => false },\n )\n\n private localize = new LocalizeController<'nord-calendar'>(this, {\n onLangChange: () => this.handleLangChange(),\n })\n\n /**\n * Whilst dateAdapter is used for handling the formatting/parsing dates in the input,\n * these are used to format dates exclusively for the benefit of screen readers.\n *\n * We prefer DateTimeFormat over date.toLocaleDateString, as the former has\n * better performance when formatting large number of dates. See:\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleDateString#Performance\n */\n private dateFormatShort!: Intl.DateTimeFormat\n private monthNames!: string[]\n private monthNamesShort!: string[]\n private dayNames!: string[]\n private dayNamesShort!: string[]\n\n /**\n * The selected date on the calendar. Must be in IS0-8601 format: YYYY-MM-DD.\n */\n @property() value: string = ''\n\n /**\n * Which day is considered first day of the week? `0` for Sunday, `1` for Monday, etc.\n * Default is Monday.\n */\n @property({ reflect: true, type: Number, attribute: 'first-day-of-week' }) firstDayOfWeek: DaysOfWeek\n = DaysOfWeek.Monday\n\n /**\n * Minimum date allowed to be picked. Must be in IS0-8601 format: YYYY-MM-DD.\n * This setting can be used alone or together with the max property.\n */\n @property({ reflect: true }) min?: string\n\n /**\n * Maximum date allowed to be picked. Must be in IS0-8601 format: YYYY-MM-DD.\n * This setting can be used alone or together with the min property.\n */\n @property({ reflect: true }) max?: string\n\n /**\n * The date that is considered today. Must be in IS0-8601 format: YYYY-MM-DD.\n * If not set, the current local date of the user is used.\n */\n @property({ reflect: true }) today?: string\n\n /**\n * Controls whether the calendar expands to fill the width of its container.\n */\n @property({ reflect: true, type: Boolean }) expand = false\n\n /**\n * Controls the size of the calendar.\n */\n @property({ reflect: true }) size: 's' | 'm' = 'm'\n\n /**\n * Controls which days are disabled and therefore disallowed.\n * For example, this can be used to disallow selection of weekends.\n */\n @property({ attribute: false }) isDateDisabled: DatePredicate = isDateDisabled\n\n /**\n * Controls which days are highlighted with a small indicator.\n * Returning a \"falsy\" value will not show an indicator.\n * Returning \"truthy\" value will show the indicator, but without an accessible label.\n * Returning a string will show the indicator, and use the string as accessible label.\n * It is recommended to return a string rather than a truthy value whenever possible.\n */\n @property({ attribute: false }) isDateHighlighted: (date: Date) => string | boolean = isDateHighlighted\n\n /**\n * Opt into range selection. When `true`, clicking selects a range start, and\n * the next click selects the end (the two clicks are swapped if the second is\n * earlier than the first). The in-range days are styled, and a hover preview\n * shows the range that would result. A completed range fires `range-change`.\n *\n * This is off by default, so the calendar keeps its single-date behaviour\n * (the `value`/`change` API) unless `range` is set.\n */\n @property({ reflect: true, type: Boolean }) range = false\n\n /**\n * The start of the selected range, in ISO-8601 format: YYYY-MM-DD. Only used\n * when `range` is set. Pair with `rangeEnd` to control the selection.\n */\n @property({ reflect: true, attribute: 'range-start' }) rangeStart?: string\n\n /**\n * The end of the selected range, in ISO-8601 format: YYYY-MM-DD. Only used\n * when `range` is set. Pair with `rangeStart` to control the selection.\n */\n @property({ reflect: true, attribute: 'range-end' }) rangeEnd?: string\n\n /**\n * The number of consecutive months to display side by side, starting from the\n * focused month. Defaults to `1`. Useful with `range` for picking a span that\n * crosses months without paging — the range and its hover preview span every\n * visible month, and the navigation arrows slide the whole window. With more\n * than one month the month/year dropdowns are replaced by static titles.\n */\n @property({ reflect: true, type: Number }) months = 1\n\n @state() private activeFocus = false\n @state() private focusedDay = new Date()\n\n /**\n * While picking a range, the first click is held here until the second click\n * completes the range. `undefined` means no in-progress pick.\n */\n @state() private pendingRangeStart?: Date\n\n /** The day currently hovered while a range pick is in progress (preview). */\n @state() private hoveredDay?: Date\n\n /**\n * Programmatically move focus to the calendar.\n * @param options An object which controls aspects of the focusing process.\n */\n focus(options?: FocusOptions & { target: 'day' | 'month' }) {\n const target = options?.target ?? 'day'\n\n if (target === 'day') {\n this.focusedDayNode.focus()\n }\n else if (target === 'month') {\n this.monthSelectNode.focus()\n }\n }\n\n render() {\n const today = this.getToday()\n const valueAsDate = parseISODate(this.value)\n\n // Resolve the visible range bounds for `range` mode. While a range pick is\n // in progress, the second bound follows the hovered/focused day so the user\n // sees a live preview of the range that would result.\n const committedStart = parseISODate(this.rangeStart || '')\n const committedEnd = parseISODate(this.rangeEnd || '')\n const previewEnd = this.pendingRangeStart ? (this.hoveredDay ?? this.focusedDay) : undefined\n const [rangeFrom, rangeTo] = this.pendingRangeStart\n ? orderDates(this.pendingRangeStart, previewEnd)\n : orderDates(committedStart, committedEnd)\n\n const minDate = parseISODate(this.min || '')\n const maxDate = parseISODate(this.max || '')\n const minDateStartOfMonth = minDate ? startOfMonth(minDate) : undefined\n const maxDateEndOfMonth = maxDate ? endOfMonth(maxDate) : undefined\n\n const currentYear = today.getFullYear()\n const minYear = minDate ? minDate.getFullYear() : currentYear - 100\n const maxYear = maxDate ? maxDate.getFullYear() : currentYear + 10\n\n if (isServer) {\n // Needed when run on a server, because the `onLangChange` callback does not get triggered, so we need to manually\n // call `handleLangChange` to set the localized values for month and day names, which the `render` method relies on.\n this.handleLangChange()\n }\n\n // Render `months` consecutive month grids, anchored on the focused month.\n // They all read the same range state, so a range (and its hover preview) spans\n // months automatically.\n const count = Math.max(1, this.months)\n const months = Array.from(\n { length: count },\n (_, i) => new Date(this.focusedDay.getFullYear(), this.focusedDay.getMonth() + i, 1),\n )\n const multi = count > 1\n\n // In multi-month mode adjacent months share the same overlap days (the\n // trailing days of one month are the leading days of the next), so rendering\n // the out-of-month days in every grid would emit the same date twice —\n // duplicating `tabindex=\"0\"`, `aria-pressed` and range styling. Disable\n // boundary navigation when ANY visible month already reaches the bound, so\n // the arrows never appear enabled-but-noop.\n const reachesMin = minDate != null && months.some(monthDate => isEqualMonth(minDate, monthDate))\n const reachesMax = maxDate != null && months.some(monthDate => isEqualMonth(maxDate, monthDate))\n\n const dayCell = (day: Date, monthDate: Date) => {\n const isInMonth = isEqualMonth(day, monthDate)\n\n // In multi-month mode the leading/trailing overlap days belong to the\n // adjacent grid, so each date is rendered (and owned) by exactly one\n // month. Render an inert placeholder here instead of a duplicate button.\n if (multi && !isInMonth) {\n return html`<td class=\"n-calendar-cell\" aria-hidden=\"true\"></td>`\n }\n\n const outsideRange = !inRange(day, minDate, maxDate)\n const isToday = isEqual(day, today)\n const isDisabled = this.isDateDisabled(day)\n const isHighlighted = this.isDateHighlighted(day)\n const formattedDate = this.dateFormatShort.format(day)\n\n // In range mode the \"selected\" days are the two range ends; otherwise it is\n // the single `value`.\n const isRangeStart = this.range && rangeFrom != null && isEqual(day, rangeFrom)\n const isRangeEnd = this.range && rangeTo != null && isEqual(day, rangeTo)\n const isInRange = this.range && rangeFrom != null && rangeTo != null && day >= rangeFrom && day <= rangeTo\n const isSelected = this.range ? isRangeStart || isRangeEnd : isEqual(day, valueAsDate)\n const sameDayRange = rangeFrom != null && isEqual(rangeFrom, rangeTo)\n\n const accessibleLabel\n = isHighlighted && typeof isHighlighted === 'string' ? `${formattedDate}, ${isHighlighted}` : formattedDate\n\n return html`\n <td class=\"n-calendar-cell\">\n <button\n type=\"button\"\n tabindex=${isEqual(day, this.focusedDay) ? 0 : -1}\n class=${classMap({\n 'n-calendar-day': true,\n 'is-outside': outsideRange,\n 'is-month': isInMonth,\n 'is-highlighted': isHighlighted,\n 'is-in-range': isInRange && !isSelected,\n 'is-range-start': isRangeStart && !sameDayRange,\n 'is-range-end': isRangeEnd && !sameDayRange,\n })}\n @click=${() => this.handleDaySelect(day)}\n @mouseenter=${() => this.handleDayHover(day)}\n @keydown=${this.shortcuts}\n ?disabled=${outsideRange}\n aria-disabled=${cond(isDisabled, 'true')}\n aria-pressed=${isSelected ? 'true' : 'false'}\n aria-current=${cond(isToday, 'date')}\n aria-label=${accessibleLabel}\n >\n <span aria-hidden=\"true\">${day.getDate()}</span>\n </button>\n </td>\n `\n }\n\n // The rich month/year selects only make sense for a single month. With more\n // than one month, each shows a static title with the prev/next arrows on the\n // first/last month, so navigation slides the whole window of months.\n const header = (monthDate: Date, index: number, labelId: string) => {\n const monthIndex = monthDate.getMonth()\n const monthYear = monthDate.getFullYear()\n if (multi) {\n const isFirst = index === 0\n const isLast = index === count - 1\n return html`\n <div class=\"n-calendar-header is-static\">\n <nord-button\n class=${classMap({ 'n-calendar-prev': true, 'is-hidden': !isFirst })}\n size=${this.size}\n square\n variant=\"plain\"\n @click=${this.handlePreviousMonthClick}\n ?disabled=${!isFirst || reachesMin}\n type=\"button\"\n >\n <nord-visually-hidden>${this.localize.term('prevMonthLabel')}</nord-visually-hidden>\n <nord-icon name=${this.direction.isLTR ? 'arrow-left-small' : 'arrow-right-small'} size=${this.size === 's' ? 'xs' : 's'}></nord-icon>\n </nord-button>\n\n <h2 class=\"n-calendar-title\" id=${labelId} aria-live=\"polite\" aria-atomic=\"true\">\n ${this.monthNames[monthIndex]} ${monthYear}\n </h2>\n\n <nord-button\n class=${classMap({ 'n-calendar-next': true, 'is-hidden': !isLast })}\n size=${this.size}\n square\n variant=\"plain\"\n @click=${this.handleNextMonthClick}\n ?disabled=${!isLast || reachesMax}\n type=\"button\"\n >\n <nord-visually-hidden>${this.localize.term('nextMonthLabel')}</nord-visually-hidden>\n <nord-icon name=${this.direction.isLTR ? 'arrow-right-small' : 'arrow-left-small'} size=${this.size === 's' ? 'xs' : 's'}></nord-icon>\n </nord-button>\n </div>\n `\n }\n return html`\n <div class=\"n-calendar-header\">\n <div>\n <nord-visually-hidden>\n <h2 id=${labelId} aria-live=\"polite\" aria-atomic=\"true\">${this.monthNames[monthIndex]}, ${monthYear}</h2>\n </nord-visually-hidden>\n\n <div class=\"n-calendar-select\">\n <select aria-label=${this.localize.term('monthSelectLabel')} class=\"n-calendar-select-month\" @input=${this.handleMonthSelect}>\n ${this.monthNames.map(\n (month, i) => html`\n <option\n value=${i}\n ?selected=${i === monthIndex}\n ?disabled=${!inRange(new Date(monthYear, i, 1), minDateStartOfMonth, maxDateEndOfMonth)}\n >\n ${month}\n </option>\n `,\n )}\n </select>\n <div class=\"n-calendar-select-label\" aria-hidden=\"true\">\n <span>${this.monthNamesShort[monthIndex]}</span>\n <nord-icon color=\"var(--n-color-icon)\" name=\"arrow-down-small\" size=\"xxs\"></nord-icon>\n </div>\n </div>\n\n <div class=\"n-calendar-select\">\n <select aria-label=${this.localize.term('yearSelectLabel')} class=\"n-calendar-select-year\" @input=${this.handleYearSelect}>\n ${repeat(\n range(minYear, maxYear),\n year => year,\n year => html`<option ?selected=${year === monthYear}>${year}</option>`,\n )}\n </select>\n <div class=\"n-calendar-select-label\" aria-hidden=\"true\">\n <span>${monthYear}</span>\n <nord-icon color=\"var(--n-color-icon)\" name=\"arrow-down-small\" size=\"xxs\"></nord-icon>\n </div>\n </div>\n </div>\n\n <div class=\"n-calendar-nav\">\n <nord-button\n class=\"n-calendar-prev\"\n size=${this.size}\n square\n @click=${this.handlePreviousMonthClick}\n ?disabled=${isEqualMonth(minDate, monthDate)}\n type=\"button\"\n >\n <nord-visually-hidden>${this.localize.term('prevMonthLabel')}</nord-visually-hidden>\n <nord-icon name=${this.direction.isLTR ? 'arrow-left-small' : 'arrow-right-small'} size=${this.size === 's' ? 'xs' : 's'}></nord-icon>\n </nord-button>\n\n <nord-button\n class=\"n-calendar-next\"\n size=${this.size}\n square\n @click=${this.handleNextMonthClick}\n ?disabled=${isEqualMonth(maxDate, monthDate)}\n type=\"button\"\n >\n <nord-visually-hidden>${this.localize.term('nextMonthLabel')}</nord-visually-hidden>\n <nord-icon name=${this.direction.isLTR ? 'arrow-right-small' : 'arrow-left-small'} size=${this.size === 's' ? 'xs' : 's'}></nord-icon>\n </nord-button>\n </div>\n </div>\n `\n }\n\n return html`\n <div class=${classMap({ 'n-calendar': true, 'has-multiple-months': multi })}>\n ${months.map((monthDate, index) => {\n const labelId = `${dialogLabelId}-${index}`\n return html`\n <div class=\"n-calendar-month\">\n ${header(monthDate, index, labelId)}\n\n <table\n class=\"n-calendar-table\"\n aria-labelledby=${labelId}\n @focusin=${this.enableActiveFocus}\n @focusout=${this.disableActiveFocus}\n >\n <thead>\n <tr>\n ${mapWithOffset(\n this.dayNames,\n this.firstDayOfWeek,\n (dayName, i) => html`\n <th class=\"n-calendar-table-header\" scope=\"col\">\n <span aria-hidden=\"true\">${this.dayNamesShort[i]}</span>\n <nord-visually-hidden>${dayName}</nord-visually-hidden>\n </th>\n `,\n )}\n </tr>\n </thead>\n <tbody>\n ${chunk(getViewOfMonth(monthDate, this.firstDayOfWeek), 7).map(\n week => html`<tr class=\"n-calendar-row\">${week.map(day => dayCell(day, monthDate))}</tr>`,\n )}\n </tbody>\n </table>\n </div>\n `\n })}\n </div>\n `\n }\n\n @observe('value')\n protected handleValueChange() {\n if (this.range) {\n return\n }\n this.setFocusedDay(parseISODate(this.value) || this.getToday())\n }\n\n @observe('rangeStart')\n @observe('rangeEnd')\n protected handleRangeChange() {\n if (!this.range) {\n return\n }\n // Focus the most relevant end of the committed range so the calendar opens\n // showing it, falling back to today when nothing is set.\n const start = parseISODate(this.rangeStart || '')\n const end = parseISODate(this.rangeEnd || '')\n this.setFocusedDay(start || end || this.getToday())\n }\n\n @observe('focusedDay', 'updated')\n protected handleFocusedDayChange() {\n if (this.activeFocus) {\n this.focusedDayNode.focus()\n }\n }\n\n private handleLangChange() {\n const lang = this.localize.resolvedLang\n this.dateFormatShort = new Intl.DateTimeFormat(lang, { day: 'numeric', month: 'long' })\n this.monthNames = getMonthNames(lang, 'long')\n this.monthNamesShort = getMonthNames(lang, 'short')\n this.dayNames = getDayNames(lang, 'long')\n this.dayNamesShort = getDayNames(lang, 'narrow')\n }\n\n private handleDaySelect = (day: Date) => {\n const isWithinBounds = inRange(day, parseISODate(this.min || ''), parseISODate(this.max || ''))\n const isAllowed = !this.isDateDisabled(day)\n\n if (!isWithinBounds || !isAllowed) {\n return\n }\n\n if (this.range) {\n this.selectRangeDay(day)\n return\n }\n\n this.value = printISODate(day)\n this.dispatchEvent(new DateSelectEvent('change', day))\n }\n\n /**\n * Two-click range selection: the first click starts a pending range, the\n * second completes it. The two ends are swapped if the second click is before\n * the first, so the committed range is always ordered `start <= end`.\n */\n private selectRangeDay(day: Date) {\n if (!this.pendingRangeStart) {\n this.pendingRangeStart = day\n this.hoveredDay = day\n this.rangeStart = printISODate(day)\n this.rangeEnd = printISODate(day)\n return\n }\n\n const [start, end] = orderDates(this.pendingRangeStart, day) as [Date, Date]\n this.pendingRangeStart = undefined\n this.hoveredDay = undefined\n this.rangeStart = printISODate(start)\n this.rangeEnd = printISODate(end)\n this.dispatchEvent(new DateRangeSelectEvent('range-change', start, end))\n }\n\n private handleDayHover = (day: Date) => {\n if (this.range && this.pendingRangeStart) {\n this.hoveredDay = day\n }\n }\n\n private getToday() {\n return parseISODate(this.today || '') || new Date()\n }\n\n private addDays(days: number) {\n this.setFocusedDay(addDays(this.focusedDay, days))\n }\n\n private addMonths(months: number) {\n this.setMonth(this.focusedDay.getMonth() + months)\n }\n\n private addYears(years: number) {\n this.setYear(this.focusedDay.getFullYear() + years)\n }\n\n private startOfWeek() {\n this.setFocusedDay(startOfWeek(this.focusedDay, this.firstDayOfWeek))\n }\n\n private endOfWeek() {\n this.setFocusedDay(endOfWeek(this.focusedDay, this.firstDayOfWeek))\n }\n\n private setMonth(month: number) {\n const min = setMonth(startOfMonth(this.focusedDay), month)\n const max = endOfMonth(min)\n const date = setMonth(this.focusedDay, month)\n\n this.setFocusedDay(clamp(date, min, max))\n }\n\n private setYear(year: number) {\n const min = setYear(startOfMonth(this.focusedDay), year)\n const max = endOfMonth(min)\n const date = setYear(this.focusedDay, year)\n\n this.setFocusedDay(clamp(date, min, max))\n }\n\n private setFocusedDay(day: Date) {\n this.focusedDay = clamp(day, parseISODate(this.min || ''), parseISODate(this.max || ''))\n this.dispatchEvent(new DateSelectEvent('nord-focus-date', this.focusedDay))\n }\n\n private handleMonthSelect = (e: Event) => {\n this.setMonth(Number.parseInt((e.target as HTMLSelectElement).value, 10))\n }\n\n private handleYearSelect = (e: Event) => {\n this.setYear(Number.parseInt((e.target as HTMLSelectElement).value, 10))\n }\n\n private handleNextMonthClick = (event: MouseEvent) => {\n event.preventDefault()\n this.addMonths(1)\n }\n\n private handlePreviousMonthClick = (event: MouseEvent) => {\n event.preventDefault()\n this.addMonths(-1)\n }\n\n private enableActiveFocus = () => {\n this.activeFocus = true\n }\n\n private disableActiveFocus = (e: FocusEvent) => {\n const table = e.currentTarget as Node\n const relatedTarget = e.relatedTarget as Node\n\n if (relatedTarget && !table.contains(relatedTarget)) {\n this.activeFocus = false\n }\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nord-calendar': Calendar\n }\n}\n"],"names":["preventDefault","e","SwipeController","constructor","host","options","this","hadFirstUpdate","initialTouchX","initialTouchY","handleTouchStart","event","pageX","pageY","changedTouches","handleTouchEnd","matchesGesture","onSwipeEnd","distX","distY","details","initialX","initialY","addController","events","EventController","target","hostUpdated","listen","hostDisconnected","isHorizontalSwipe","Math","abs","isDownwardsSwipe","fn","Icon","registerIcon","arrowRightIcon","arrowLeftIcon","arrowDownIcon","isDateDisabled","isDateHighlighted","orderDates","a","b","getTime","Calendar","LitElement","direction","DirectionController","swipe","addMonths","shortcuts","createKeybindingsHandler","ArrowRight","addDays","isLTR","ArrowLeft","ArrowDown","ArrowUp","Home","startOfWeek","End","endOfWeek","PageUp","PageDown","addYears","ignore","localize","LocalizeController","onLangChange","handleLangChange","value","firstDayOfWeek","DaysOfWeek","Monday","expand","size","range","months","activeFocus","focusedDay","Date","handleDaySelect","day","isWithinBounds","inRange","parseISODate","min","max","isAllowed","selectRangeDay","printISODate","dispatchEvent","DateSelectEvent","handleDayHover","pendingRangeStart","hoveredDay","handleMonthSelect","setMonth","Number","parseInt","handleYearSelect","setYear","handleNextMonthClick","handlePreviousMonthClick","enableActiveFocus","disableActiveFocus","table","currentTarget","relatedTarget","contains","focus","_a","focusedDayNode","monthSelectNode","render","today","getToday","valueAsDate","committedStart","rangeStart","committedEnd","rangeEnd","previewEnd","undefined","rangeFrom","rangeTo","minDate","maxDate","minDateStartOfMonth","startOfMonth","maxDateEndOfMonth","endOfMonth","currentYear","getFullYear","minYear","maxYear","isServer","count","Array","from","length","_","i","getMonth","multi","reachesMin","some","monthDate","isEqualMonth","reachesMax","dayCell","isInMonth","html","outsideRange","isToday","isEqual","isDisabled","isHighlighted","formattedDate","dateFormatShort","format","isRangeStart","isRangeEnd","isInRange","isSelected","sameDayRange","accessibleLabel","classMap","cond","getDate","header","index","labelId","monthIndex","monthYear","isFirst","isLast","term","monthNames","map","month","monthNamesShort","repeat","year","mapWithOffset","dayNames","dayName","dayNamesShort","chunk","getViewOfMonth","week","handleValueChange","setFocusedDay","handleRangeChange","start","end","handleFocusedDayChange","lang","resolvedLang","Intl","DateTimeFormat","getMonthNames","getDayNames","DateRangeSelectEvent","days","years","date","clamp","styles","componentStyle","style","__decorate","query","prototype","property","reflect","type","attribute","Boolean","state","observe","customElement"],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A,gBAAA,GAS3BF,EAAA,CAA1CG,EAAS,CAAEC,SAAS,EAAMC,KAAMtH,UAAoBtD,EAAAyK,UAAA,cAAA,GAEpCF,EAAA,CAAhBQ,KAAmC/K,EAAAyK,UAAA,mBAAA,GACnBF,EAAA,CAAhBQ,KAAuC/K,EAAAyK,UAAA,kBAAA,GAMvBF,EAAA,CAAhBQ,KAAwC/K,EAAAyK,UAAA,yBAAA,GAGxBF,EAAA,CAAhBQ,KAAiC/K,EAAAyK,UAAA,kBAAA,GAqRxBF,EAAA,CADTS,EAAQ,UAMRhL,EAAAyK,UAAA,oBAAA,MAISF,EAAA,CAFTS,EAAQ,cACRA,EAAQ,aAURhL,EAAAyK,UAAA,oBAAA,MAGSF,EAAA,CADTS,EAAQ,aAAc,YAKtBhL,EAAAyK,UAAA,yBAAA,MA/bkBzK,EAAQuK,EAAA,CAD5BU,EAAc,kBACMjL,UAAAA"}
|
package/lib/Calendar.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"./tslib.es6-CmLYFWVC.js";export{C as default}from"./Calendar-
|
|
1
|
+
import"./tslib.es6-CmLYFWVC.js";export{C as default}from"./Calendar-D47b20IT.js";import"lit";import"lit/decorators.js";import"lit/directives/class-map.js";import"lit/directives/repeat.js";import"./tinykeys-DwvDXsEb.js";import"./collection-Dvg2XbxV.js";import"./DirectionController-ChvNGESZ.js";import"./dates-C-ZvzXaC.js";import"./observe-D0n0zOfU.js";import"./cond-CI1KbneT.js";import"./number-Dg2vCfGd.js";import"./Component-BJ5O5n8k.js";import"./Icon.js";import"./LocalizeController.js";import"./DateRangeSelectEvent.js";import"./DateSelectEvent.js";import"./Button.js";import"./VisuallyHidden.js";import"./EventController-BBOmvfLa.js";import"lit/directives/if-defined.js";import"lit/directives/unsafe-html.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"./localization23.js";import"./events-Bv6wNHwJ.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";
|
|
2
2
|
//# sourceMappingURL=Calendar.js.map
|
package/lib/Card.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Card.js","sources":["../src/card/Card.ts"],"sourcesContent":["import { html, LitElement } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nimport { SlotController } from '../common/controllers/SlotController.js'\nimport componentStyle from '../common/styles/Component.css'\nimport style from './Card.css'\n\n/**\n * Cards are shadowed surfaces that display content and actions on a\n * single topic. They should be easy to scan for relevant and\n * actionable information.\n *\n * @status ready\n * @category
|
|
1
|
+
{"version":3,"file":"Card.js","sources":["../src/card/Card.ts"],"sourcesContent":["import { html, LitElement } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nimport { SlotController } from '../common/controllers/SlotController.js'\nimport componentStyle from '../common/styles/Component.css'\nimport style from './Card.css'\n\n/**\n * Cards are shadowed surfaces that display content and actions on a\n * single topic. They should be easy to scan for relevant and\n * actionable information.\n *\n * @status ready\n * @category container\n * @slot - The card content.\n * @slot header - Optional slot that holds a header for the card.\n * @slot header-end - Optional slot that positions content at the end of the header. Useful for actions or additional info.\n * @slot footer - Optional slot that holds footer content for the card.\n *\n * @cssprop [--n-card-background-color=var(--n-color-surface)] - Controls the background color of the card.\n * @cssprop [--n-card-border-radius=var(--n-border-radius)] - Controls how rounded the corners are, using [border radius tokens](/tokens/#border-radius).\n * @cssprop [--n-card-box-shadow=var(--n-box-shadow-popout)] - Controls the surrounding shadow, using [box shadow tokens](/tokens/#box-shadow).\n * @cssprop [--n-card-padding=var(--n-space-m)] - Controls the padding on all sides of the card.\n * @cssprop [--n-card-slot-padding=var(--n-space-m)] - Controls the padding of items slotted within the card. This does not affect the block padding of items slotted into the header.\n * @cssprop [--n-card-header-background=transparent] - Controls the background color of the card header.\n * @cssprop [--n-card-border-color=var(--n-color-border)] - Controls the border color of the card header and footer divider.\n * @cssprop [--n-card-header-padding-block=var(--n-space-m)] - Controls the block (top and bottom) padding of the card header.\n * @cssprop [--n-card-header-padding-inline=var(--n-card-slot-padding)] - Controls the inline (left and right) padding of the card header.\n * @cssprop [--n-card-header-slot-flex-grow=0] - Controls the flex-grow value of the header slot.\n * @cssprop [--n-card-header-end-margin-block-start=calc(var(--n-space-xs) * -1)] - Block-start margin of content slotted into `header-end`. The negative default lets buttons and similar controls sit within the header without inflating its height. Override (e.g. `0`) when slotting tall content that should occupy the full header height.\n * @cssprop [--n-card-header-end-margin-block-end=calc(var(--n-space-xs) * -1)] - Block-end margin of content slotted into `header-end`. The negative default lets buttons and similar controls sit within the header without inflating its height. Override (e.g. `0`) when slotting tall content that should occupy the full header height.\n */\n@customElement('nord-card')\nexport default class Card extends LitElement {\n static styles = [componentStyle, style]\n\n private headerSlot = new SlotController(this, 'header')\n private headerEndSlot = new SlotController(this, 'header-end')\n private footerSlot = new SlotController(this, 'footer')\n\n /**\n * Controls the padding of the card component. When set to “none”,\n * the header and footer slots will still have padding.\n */\n @property({ reflect: true }) padding: 'm' | 'l' | 'none' = 'm'\n\n /**\n * When set, adds a divider border above the footer slot.\n */\n @property({ type: Boolean, reflect: true, attribute: 'footer-divider' }) footerDivider = false\n\n render() {\n return html`\n <div class=\"n-card\">\n <div class=\"header\" ?hidden=${this.headerSlot.isEmpty && this.headerEndSlot.isEmpty}>\n <slot name=${this.headerSlot.slotName}></slot>\n <slot name=${this.headerEndSlot.slotName}></slot>\n </div>\n <slot></slot>\n <slot name=${this.footerSlot.slotName} ?hidden=${this.footerSlot.isEmpty}></slot>\n </div>\n `\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nord-card': Card\n }\n}\n"],"names":["Card","LitElement","constructor","this","headerSlot","SlotController","headerEndSlot","footerSlot","padding","footerDivider","render","html","isEmpty","slotName","styles","componentStyle","style","__decorate","property","reflect","prototype","type","Boolean","attribute","customElement"],"mappings":"o9FAgCe,IAAMA,EAAN,cAAmBC,EAAnB,WAAAC,uBAGLC,KAAUC,WAAG,IAAIC,EAAeF,KAAM,UACtCA,KAAaG,cAAG,IAAID,EAAeF,KAAM,cACzCA,KAAUI,WAAG,IAAIF,EAAeF,KAAM,UAMjBA,KAAOK,QAAuB,IAKcL,KAAaM,eAAG,CAc1F,CAZC,MAAAC,GACE,OAAOC,CAAI,oDAEuBR,KAAKC,WAAWQ,SAAWT,KAAKG,cAAcM,wBAC7DT,KAAKC,WAAWS,gCAChBV,KAAKG,cAAcO,mDAGrBV,KAAKI,WAAWM,sBAAoBV,KAAKI,WAAWK,wBAGtE,GA5BMZ,EAAAc,OAAS,CAACC,EAAgBC,GAUJC,EAAA,CAA5BC,EAAS,CAAEC,SAAS,KAAyCnB,EAAAoB,UAAA,eAAA,GAKWH,EAAA,CAAxEC,EAAS,CAAEG,KAAMC,QAASH,SAAS,EAAMI,UAAW,oBAAyCvB,EAAAoB,UAAA,qBAAA,GAhB3EpB,EAAIiB,EAAA,CADxBO,EAAc,cACMxB,SAAAA"}
|
package/lib/Collapsible.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Collapsible.js","sources":["../src/collapsible/Collapsible.ts"],"sourcesContent":["import type CollapsiblePanel from './CollapsiblePanel.js'\nimport type CollapsibleTrigger from './CollapsibleTrigger.js'\n\nimport { isServer, LitElement } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nimport { observe } from '../common/decorators/observe.js'\nimport { NordEvent } from '../common/events.js'\n\nimport { injectLightDomStyles } from '../common/light-dom-styles.js'\nimport { DraftComponentMixin } from '../common/mixins/DraftComponentMixin.js'\nimport style from './Collapsible.css'\n\nlet collapsibleCount = 1\n\n/**\n * Event dispatched when a collapsible is opened or closed, either by the user\n * activating its trigger or programmatically toggling the `open` property.\n */\nexport class CollapsibleToggleEvent extends NordEvent {\n declare open: boolean\n\n constructor(open: boolean) {\n super('toggle')\n Object.defineProperty(this, 'open', {\n value: open,\n enumerable: true,\n writable: false,\n })\n }\n}\n\n/**\n * Collapsible is a disclosure that shows or hides a section of content. It wires\n * together a [Collapsible Trigger](/components/collapsible-trigger/) and a\n * [Collapsible Panel](/components/collapsible-panel/), animating the panel\n * height as it opens and closes.\n *\n * @status draft\n * @category
|
|
1
|
+
{"version":3,"file":"Collapsible.js","sources":["../src/collapsible/Collapsible.ts"],"sourcesContent":["import type CollapsiblePanel from './CollapsiblePanel.js'\nimport type CollapsibleTrigger from './CollapsibleTrigger.js'\n\nimport { isServer, LitElement } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nimport { observe } from '../common/decorators/observe.js'\nimport { NordEvent } from '../common/events.js'\n\nimport { injectLightDomStyles } from '../common/light-dom-styles.js'\nimport { DraftComponentMixin } from '../common/mixins/DraftComponentMixin.js'\nimport style from './Collapsible.css'\n\nlet collapsibleCount = 1\n\n/**\n * Event dispatched when a collapsible is opened or closed, either by the user\n * activating its trigger or programmatically toggling the `open` property.\n */\nexport class CollapsibleToggleEvent extends NordEvent {\n declare open: boolean\n\n constructor(open: boolean) {\n super('toggle')\n Object.defineProperty(this, 'open', {\n value: open,\n enumerable: true,\n writable: false,\n })\n }\n}\n\n/**\n * Collapsible is a disclosure that shows or hides a section of content. It wires\n * together a [Collapsible Trigger](/components/collapsible-trigger/) and a\n * [Collapsible Panel](/components/collapsible-panel/), animating the panel\n * height as it opens and closes.\n *\n * @status draft\n * @category container\n * @lightDom true\n *\n * @slot - Default slot for the [Collapsible Trigger](/components/collapsible-trigger/), [Collapsible Panel](/components/collapsible-panel/) and any other content.\n *\n * @fires {CollapsibleToggleEvent} toggle - Dispatched when the collapsible is opened or closed. The event includes an `open` property reflecting the new state.\n */\n@customElement('nord-collapsible')\nexport default class Collapsible extends DraftComponentMixin(LitElement) {\n private collapsibleId = `nord-collapsible-${collapsibleCount++}`\n\n /**\n * Whether the collapsible is open.\n */\n @property({ reflect: true, type: Boolean }) open = false\n\n /**\n * Whether the collapsible should ignore user interaction.\n */\n @property({ reflect: true, type: Boolean }) disabled = false\n\n connectedCallback() {\n super.connectedCallback()\n injectLightDomStyles(this, style)\n this.setup()\n }\n\n // Render in the light DOM so the trigger and panel are the element's own\n // content and the injected stylesheet applies (no shadow boundary, like Table).\n protected createRenderRoot() {\n return this\n }\n\n private get trigger() {\n return this.querySelector<CollapsibleTrigger>('nord-collapsible-trigger')\n }\n\n private get panel() {\n return this.querySelector<CollapsiblePanel>('nord-collapsible-panel')\n }\n\n /**\n * Wire up the ARIA relationship between the trigger and the panel and reflect\n * the initial open state to both.\n */\n private setup() {\n if (isServer) {\n return\n }\n\n const { trigger, panel } = this\n\n if (panel) {\n panel.id ||= `${this.collapsibleId}-panel`\n panel.open = this.open\n }\n\n if (trigger) {\n trigger.id ||= `${this.collapsibleId}-trigger`\n trigger.open = this.open\n trigger.disabled = this.disabled\n if (panel) {\n trigger.setAttribute('aria-controls', panel.id)\n panel.setAttribute('aria-labelledby', trigger.id)\n }\n }\n }\n\n @observe('open')\n protected handleOpenChange(oldValue: boolean | undefined, newValue: boolean) {\n this.syncState()\n\n // Skip the initial assignment so we don't fire on first render.\n if (oldValue !== undefined && oldValue !== newValue) {\n this.dispatchEvent(new CollapsibleToggleEvent(newValue))\n }\n }\n\n @observe('disabled')\n protected handleDisabledChange() {\n const { trigger } = this\n if (trigger) {\n trigger.disabled = this.disabled\n }\n }\n\n /**\n * Push the current open state down to the trigger and panel.\n */\n private syncState() {\n const { trigger, panel } = this\n\n if (trigger) {\n trigger.open = this.open\n }\n\n if (panel) {\n panel.open = this.open\n }\n }\n\n /**\n * Toggle the collapsible open or closed. Called by the trigger.\n */\n toggle() {\n if (this.disabled) {\n return\n }\n\n this.open = !this.open\n }\n\n /**\n * Open the collapsible programmatically.\n */\n expand() {\n if (!this.disabled) {\n this.open = true\n }\n }\n\n /**\n * Close the collapsible programmatically.\n */\n collapse() {\n if (!this.disabled) {\n this.open = false\n }\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nord-collapsible': Collapsible\n }\n}\n"],"names":["collapsibleCount","CollapsibleToggleEvent","NordEvent","constructor","open","super","Object","defineProperty","this","value","enumerable","writable","Collapsible","DraftComponentMixin","LitElement","collapsibleId","disabled","connectedCallback","injectLightDomStyles","style","setup","createRenderRoot","trigger","querySelector","panel","isServer","id","setAttribute","handleOpenChange","oldValue","newValue","syncState","undefined","dispatchEvent","handleDisabledChange","toggle","expand","collapse","__decorate","property","reflect","type","Boolean","prototype","observe","customElement"],"mappings":"okBAYA,IAAIA,EAAmB,EAMjB,MAAOC,UAA+BC,EAG1C,WAAAC,CAAYC,GACVC,MAAM,UACNC,OAAOC,eAAeC,KAAM,OAAQ,CAClCC,MAAOL,EACPM,YAAY,EACZC,UAAU,GAEb,EAkBY,IAAMC,EAAN,cAA0BC,EAAoBC,IAA9C,WAAAX,uBACLK,KAAAO,cAAgB,oBAAoBf,IAKAQ,KAAIJ,MAAG,EAKPI,KAAQQ,UAAG,CA8GxD,CA5GC,iBAAAC,GACEZ,MAAMY,oBACNC,EAAqBV,KAAMW,GAC3BX,KAAKY,OACN,CAIS,gBAAAC,GACR,OAAOb,IACR,CAED,WAAYc,GACV,OAAOd,KAAKe,cAAkC,2BAC/C,CAED,SAAYC,GACV,OAAOhB,KAAKe,cAAgC,yBAC7C,CAMO,KAAAH,GACN,GAAIK,EACF,OAGF,MAAMH,QAAEA,EAAOE,MAAEA,GAAUhB,KAEvBgB,IACFA,EAAME,KAANF,EAAME,GAAO,GAAGlB,KAAKO,uBACrBS,EAAMpB,KAAOI,KAAKJ,MAGhBkB,IACFA,EAAQI,KAARJ,EAAQI,GAAO,GAAGlB,KAAKO,yBACvBO,EAAQlB,KAAOI,KAAKJ,KACpBkB,EAAQN,SAAWR,KAAKQ,SACpBQ,IACFF,EAAQK,aAAa,gBAAiBH,EAAME,IAC5CF,EAAMG,aAAa,kBAAmBL,EAAQI,KAGnD,CAGS,gBAAAE,CAAiBC,EAA+BC,GACxDtB,KAAKuB,iBAGYC,IAAbH,GAA0BA,IAAaC,GACzCtB,KAAKyB,cAAc,IAAIhC,EAAuB6B,GAEjD,CAGS,oBAAAI,GACR,MAAMZ,QAAEA,GAAYd,KAChBc,IACFA,EAAQN,SAAWR,KAAKQ,SAE3B,CAKO,SAAAe,GACN,MAAMT,QAAEA,EAAOE,MAAEA,GAAUhB,KAEvBc,IACFA,EAAQlB,KAAOI,KAAKJ,MAGlBoB,IACFA,EAAMpB,KAAOI,KAAKJ,KAErB,CAKD,MAAA+B,GACM3B,KAAKQ,WAITR,KAAKJ,MAAQI,KAAKJ,KACnB,CAKD,MAAAgC,GACO5B,KAAKQ,WACRR,KAAKJ,MAAO,EAEf,CAKD,QAAAiC,GACO7B,KAAKQ,WACRR,KAAKJ,MAAO,EAEf,GAlH2CkC,EAAA,CAA3CC,EAAS,CAAEC,SAAS,EAAMC,KAAMC,WAAuB9B,EAAA+B,UAAA,YAAA,GAKZL,EAAA,CAA3CC,EAAS,CAAEC,SAAS,EAAMC,KAAMC,WAA2B9B,EAAA+B,UAAA,gBAAA,GAkDlDL,EAAA,CADTM,EAAQ,SAQRhC,EAAA+B,UAAA,mBAAA,MAGSL,EAAA,CADTM,EAAQ,aAMRhC,EAAA+B,UAAA,uBAAA,MA5EkB/B,EAAW0B,EAAA,CAD/BO,EAAc,qBACMjC,SAAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CollapsiblePanel.js","sources":["../src/collapsible/CollapsiblePanel.ts"],"sourcesContent":["import { LitElement } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { CollapseController } from '../common/controllers/CollapseController.js'\nimport { injectLightDomStyles } from '../common/light-dom-styles.js'\n\nimport style from './CollapsiblePanel.css'\n\n/**\n * Collapsible Panel holds the content revealed by its\n * [Collapsible Trigger](/components/collapsible-trigger/). It must be placed\n * inside a [Collapsible](/components/collapsible/) and animates its height as it\n * opens and closes.\n *\n * @status draft\n * @category
|
|
1
|
+
{"version":3,"file":"CollapsiblePanel.js","sources":["../src/collapsible/CollapsiblePanel.ts"],"sourcesContent":["import { LitElement } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { CollapseController } from '../common/controllers/CollapseController.js'\nimport { injectLightDomStyles } from '../common/light-dom-styles.js'\n\nimport style from './CollapsiblePanel.css'\n\n/**\n * Collapsible Panel holds the content revealed by its\n * [Collapsible Trigger](/components/collapsible-trigger/). It must be placed\n * inside a [Collapsible](/components/collapsible/) and animates its height as it\n * opens and closes.\n *\n * @status draft\n * @category container\n * @lightDom true\n *\n * @slot - Default slot for the collapsible content.\n *\n * @attr {boolean} data-open - Present while the panel is open (or opening).\n * @attr {boolean} data-closed - Present while the panel is closed.\n * @attr {boolean} data-starting-style - Present for the first frame of the open transition.\n * @attr {boolean} data-ending-style - Present while the close transition runs.\n *\n * @cssprop [--n-collapsible-panel-height] - Set during the open/close animation to the measured content height. Read it to coordinate custom animations.\n */\n@customElement('nord-collapsible-panel')\nexport default class CollapsiblePanel extends LitElement {\n /**\n * Whether the panel is open. Set by the parent\n * [Collapsible](/components/collapsible/).\n */\n @property({ reflect: true, type: Boolean }) open = false\n\n // The height animation + transition-status data-attributes live in the shared\n // controller (also used by the accordion panel).\n private collapse = new CollapseController(this, {\n open: () => this.open,\n heightVar: '--n-collapsible-panel-height',\n })\n\n connectedCallback() {\n super.connectedCallback()\n injectLightDomStyles(this, style)\n this.setAttribute('role', 'region')\n // Reflect the initial state without animating.\n this.hidden = !this.open\n }\n\n // Render in the light DOM so the content is the element's own children and the\n // injected stylesheet applies (no shadow boundary).\n protected createRenderRoot() {\n return this\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nord-collapsible-panel': CollapsiblePanel\n }\n}\n"],"names":["CollapsiblePanel","LitElement","constructor","this","open","collapse","CollapseController","heightVar","connectedCallback","super","injectLightDomStyles","style","setAttribute","hidden","createRenderRoot","__decorate","property","reflect","type","Boolean","prototype","customElement"],"mappings":"4pBA4Be,IAAMA,EAAN,cAA+BC,EAA/B,WAAAC,uBAK+BC,KAAIC,MAAG,EAI3CD,KAAAE,SAAW,IAAIC,EAAmBH,KAAM,CAC9CC,KAAM,IAAMD,KAAKC,KACjBG,UAAW,gCAgBd,CAbC,iBAAAC,GACEC,MAAMD,oBACNE,EAAqBP,KAAMQ,GAC3BR,KAAKS,aAAa,OAAQ,UAE1BT,KAAKU,QAAUV,KAAKC,IACrB,CAIS,gBAAAU,GACR,OAAOX,IACR,GArB2CY,EAAA,CAA3CC,EAAS,CAAEC,SAAS,EAAMC,KAAMC,WAAuBnB,EAAAoB,UAAA,YAAA,GALrCpB,EAAgBe,EAAA,CADpCM,EAAc,2BACMrB,SAAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CollapsibleTrigger.js","sources":["../src/collapsible/CollapsibleTrigger.ts"],"sourcesContent":["import type Collapsible from './Collapsible.js'\nimport { LitElement } from 'lit'\n\nimport { customElement, property } from 'lit/decorators.js'\nimport { FocusableWhenDisabledController } from '../common/controllers/FocusableWhenDisabledController.js'\nimport { observe } from '../common/decorators/observe.js'\n\nimport { injectLightDomStyles } from '../common/light-dom-styles.js'\nimport style from './CollapsibleTrigger.css'\n\n/**\n * Collapsible Trigger is the interactive control that opens and closes its\n * [Collapsible](/components/collapsible/) panel. It must be placed inside a\n * [Collapsible](/components/collapsible/).\n *\n * @status draft\n * @category
|
|
1
|
+
{"version":3,"file":"CollapsibleTrigger.js","sources":["../src/collapsible/CollapsibleTrigger.ts"],"sourcesContent":["import type Collapsible from './Collapsible.js'\nimport { LitElement } from 'lit'\n\nimport { customElement, property } from 'lit/decorators.js'\nimport { FocusableWhenDisabledController } from '../common/controllers/FocusableWhenDisabledController.js'\nimport { observe } from '../common/decorators/observe.js'\n\nimport { injectLightDomStyles } from '../common/light-dom-styles.js'\nimport style from './CollapsibleTrigger.css'\n\n/**\n * Collapsible Trigger is the interactive control that opens and closes its\n * [Collapsible](/components/collapsible/) panel. It must be placed inside a\n * [Collapsible](/components/collapsible/).\n *\n * @status draft\n * @category container\n * @lightDom true\n *\n * @slot - Default slot for the trigger label and/or an icon.\n */\n@customElement('nord-collapsible-trigger')\nexport default class CollapsibleTrigger extends LitElement {\n /**\n * Whether the associated panel is open. Set by the parent\n * [Collapsible](/components/collapsible/); reflected so it can be styled.\n */\n @property({ reflect: true, type: Boolean }) open = false\n\n /**\n * Whether the trigger is disabled. Set by the parent\n * [Collapsible](/components/collapsible/).\n */\n @property({ reflect: true, type: Boolean }) disabled = false\n\n // Keeps the trigger focusable while disabled (aria-disabled + tabindex=0),\n // matching Base UI; activation is blocked by `activate()` below.\n private focusable = new FocusableWhenDisabledController(this, { disabled: () => this.disabled })\n\n connectedCallback() {\n super.connectedCallback()\n injectLightDomStyles(this, style)\n // The host itself is the focusable button: light DOM can't delegate focus\n // into a shadow `<button>`, so we apply button semantics directly.\n this.setAttribute('role', 'button')\n this.setAttribute('aria-expanded', `${this.open}`)\n this.addEventListener('click', this.handleClick)\n this.addEventListener('keydown', this.handleKeydown)\n }\n\n disconnectedCallback() {\n super.disconnectedCallback()\n this.removeEventListener('click', this.handleClick)\n this.removeEventListener('keydown', this.handleKeydown)\n }\n\n // Render in the light DOM so the trigger label/icon stay as the element's own\n // content (no shadow boundary, like Table and Kbd).\n protected createRenderRoot() {\n return this\n }\n\n private get collapsible() {\n return this.closest<Collapsible>('nord-collapsible')\n }\n\n @observe('open')\n protected handleOpenChange() {\n this.setAttribute('aria-expanded', `${this.open}`)\n }\n\n private activate() {\n if (this.disabled) {\n return\n }\n\n this.collapsible?.toggle()\n }\n\n private handleClick = () => {\n this.activate()\n }\n\n private handleKeydown = (event: KeyboardEvent) => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault()\n this.activate()\n }\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nord-collapsible-trigger': CollapsibleTrigger\n }\n}\n"],"names":["CollapsibleTrigger","LitElement","constructor","this","open","disabled","focusable","FocusableWhenDisabledController","handleClick","activate","handleKeydown","event","key","preventDefault","connectedCallback","super","injectLightDomStyles","style","setAttribute","addEventListener","disconnectedCallback","removeEventListener","createRenderRoot","collapsible","closest","handleOpenChange","_a","toggle","__decorate","property","reflect","type","Boolean","prototype","observe","customElement"],"mappings":"g2BAsBe,IAAMA,EAAN,cAAiCC,EAAjC,WAAAC,uBAK+BC,KAAIC,MAAG,EAMPD,KAAQE,UAAG,EAI/CF,KAAAG,UAAY,IAAIC,EAAgCJ,KAAM,CAAEE,SAAU,IAAMF,KAAKE,WA0C7EF,KAAWK,YAAG,KACpBL,KAAKM,UAAU,EAGTN,KAAAO,cAAiBC,IACL,UAAdA,EAAMC,KAAiC,MAAdD,EAAMC,MACjCD,EAAME,iBACNV,KAAKM,WACN,CAEJ,CAlDC,iBAAAK,GACEC,MAAMD,oBACNE,EAAqBb,KAAMc,GAG3Bd,KAAKe,aAAa,OAAQ,UAC1Bf,KAAKe,aAAa,gBAAiB,GAAGf,KAAKC,QAC3CD,KAAKgB,iBAAiB,QAAShB,KAAKK,aACpCL,KAAKgB,iBAAiB,UAAWhB,KAAKO,cACvC,CAED,oBAAAU,GACEL,MAAMK,uBACNjB,KAAKkB,oBAAoB,QAASlB,KAAKK,aACvCL,KAAKkB,oBAAoB,UAAWlB,KAAKO,cAC1C,CAIS,gBAAAY,GACR,OAAOnB,IACR,CAED,eAAYoB,GACV,OAAOpB,KAAKqB,QAAqB,mBAClC,CAGS,gBAAAC,GACRtB,KAAKe,aAAa,gBAAiB,GAAGf,KAAKC,OAC5C,CAEO,QAAAK,SACFN,KAAKE,UAIS,QAAlBqB,EAAAvB,KAAKoB,mBAAa,IAAAG,GAAAA,EAAAC,QACnB,GAlD2CC,EAAA,CAA3CC,EAAS,CAAEC,SAAS,EAAMC,KAAMC,WAAuBhC,EAAAiC,UAAA,YAAA,GAMZL,EAAA,CAA3CC,EAAS,CAAEC,SAAS,EAAMC,KAAMC,WAA2BhC,EAAAiC,UAAA,gBAAA,GAkClDL,EAAA,CADTM,EAAQ,SAGRlC,EAAAiC,UAAA,mBAAA,MA/CkBjC,EAAkB4B,EAAA,CADtCO,EAAc,6BACMnC,SAAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{css as o}from"lit";const n=o`nord-combobox,nord-combobox *,nord-combobox :after,nord-combobox :before{box-sizing:border-box}nord-combobox>.n-render-root{display:contents}nord-combobox-group,nord-combobox-option{display:none}nord-combobox{--_n-combobox-background:var(--n-input-background,var(--n-color-surface));--_n-combobox-border-color:var(--n-input-border-color,var(--n-color-border-strong));--_n-combobox-border-radius:var(--n-input-border-radius,var(--n-border-radius-s));--_n-combobox-block-size:var(--n-combobox-block-size,var(--n-space-xl));--_n-combobox-min-content-block-size:calc(var(--n-line-height-form) + var(--n-space-s)/1.6*2 + 2px);--_n-combobox-padding-block:calc(var(--_n-combobox-block-size)/2 - var(--n-line-height-form)/2 - 1px);--_n-combobox-padding-inline:calc(var(--n-space-s) + var(--n-space-xs));--_n-combobox-font-size:var(--n-font-size-m);--_n-combobox-divider-block-size:var(--n-space-m);--_n-combobox-tags-padding:calc(var(--n-space-xs)*0.75);display:block}nord-combobox[size=s]{--_n-combobox-block-size:var(--n-combobox-block-size,calc(var(--n-space-l) + var(--n-space-xs)));--_n-combobox-padding-block:calc(var(--_n-combobox-block-size)/2 - var(--n-line-height-form)/2 - 1px);--_n-combobox-padding-inline:calc(var(--n-space-xs)*1.5);--_n-combobox-divider-block-size:calc(var(--n-space-s) + var(--n-space-xs)/2);--_n-combobox-tags-padding:calc(var(--n-space-xs)/2)}nord-combobox[size=l]{--_n-combobox-border-radius:var(--n-input-border-radius,var(--n-border-radius));--_n-combobox-block-size:max(var(--n-combobox-block-size,calc(var(--n-space-xxl) - var(--n-space-l))),var(--_n-combobox-min-content-block-size));--_n-combobox-padding-block:calc(var(--_n-combobox-block-size)/2 - var(--n-line-height-form)/2 - 1px);--_n-combobox-padding-inline:calc(var(--n-space-s) + var(--n-space-xs));--_n-combobox-divider-block-size:var(--n-space-l)}nord-combobox .n-combobox{inline-size:100%;position:relative}nord-combobox .n-control{align-items:center;background:var(--_n-combobox-background);border:1px solid var(--_n-combobox-border-color);border-radius:var(--_n-combobox-border-radius);cursor:text;display:flex;gap:var(--n-space-s);inline-size:100%;min-block-size:var(--_n-combobox-block-size);padding-inline-end:var(--_n-combobox-padding-inline);padding-inline-start:var(--_n-combobox-padding-inline);transition:border var(--n-transition-quickly),box-shadow var(--n-transition-quickly),background var(--n-transition-quickly)}nord-combobox .n-tags{align-items:center;display:flex;flex:1;flex-wrap:wrap;gap:var(--_n-combobox-tags-padding);min-inline-size:0;padding-block-end:var(--_n-combobox-tags-padding);padding-block-start:var(--_n-combobox-tags-padding)}nord-combobox .n-tags .n-input{padding-block-end:0;padding-block-start:0}nord-combobox .n-control:hover{--_n-combobox-border-color:var(--n-input-border-color,var(--n-color-border-hover))}nord-combobox .n-control:focus-within{--_n-combobox-border-color:var(--n-input-border-color,var(--n-color-accent));box-shadow:0 0 0 1px var(--_n-combobox-border-color)}nord-combobox[disabled] .n-control{--_n-combobox-background:var(--n-input-background-inactive,var(--n-color-active));--_n-combobox-border-color:var(--n-input-border-color,var(--n-color-active));cursor:auto;pointer-events:none}nord-combobox[readonly] .n-control{--_n-combobox-background:var(--n-input-background-inactive,var(--n-color-active))}nord-combobox[readonly] input.n-input{background:#0000}nord-combobox .n-control.is-invalid{--_n-combobox-border-color:var(--n-color-border-danger)}nord-combobox .n-control.is-invalid:focus-within{--_n-combobox-border-color:var(--n-color-status-danger)}nord-combobox .n-slot{align-items:center;color:var(--n-color-icon);display:flex;flex-shrink:0}nord-combobox .n-slot:empty{display:none}nord-combobox[disabled] .n-slot{color:var(--n-color-text-weakest)}nord-combobox .n-slot nord-icon{--_n-icon-size:var(--n-size-icon-s)}nord-combobox .n-input{appearance:none;background:#0000;border:none;color:var(--n-color-text);flex:1;font-family:var(--n-font-family);font-feature-settings:var(--n-font-features);font-size:var(--_n-combobox-font-size);line-height:var(--n-line-height-form);margin:0;min-inline-size:3rem;outline:none;padding-block-end:var(--_n-combobox-padding-block);padding-block-start:var(--_n-combobox-padding-block);padding-inline-end:0;padding-inline-start:0}nord-combobox .n-control input.n-input:focus,nord-combobox .n-control input.n-input:focus-visible,nord-combobox .n-control input.n-input:focus-within{background:#0000;border:none;box-shadow:none;outline:none}nord-combobox .n-input::placeholder{color:var(--n-color-text-weakest);opacity:1}nord-combobox[disabled] .n-input{color:var(--n-color-text-weakest)}nord-combobox .n-divider{background:var(--n-color-border);block-size:var(--_n-combobox-divider-block-size);flex-shrink:0;inline-size:1px}nord-combobox .n-toggle{align-items:center;appearance:none;background:#0000;border:none;color:var(--n-color-icon);cursor:pointer;display:flex;flex-shrink:0;justify-content:center;margin:0;padding:0}nord-combobox .n-toggle nord-icon{--_n-icon-size:var(--n-size-icon-s)}nord-combobox[disabled] .n-toggle{color:var(--n-color-text-weakest);cursor:auto}nord-combobox .n-clear{align-items:center;appearance:none;background:#0000;border:none;border-radius:var(--n-border-radius-s);color:var(--n-color-icon);cursor:pointer;display:flex;flex-shrink:0;justify-content:center;margin:0;padding:0;transition:color var(--n-transition-quickly)}nord-combobox .n-clear:hover{color:var(--n-color-text)}nord-combobox .n-clear:focus-visible{outline:2px solid var(--n-color-accent);outline-offset:2px}nord-combobox .n-clear nord-icon{--_n-icon-size:var(--n-size-icon-xs)}nord-combobox .n-loading{flex-shrink:0}nord-combobox .n-chip{--n-tag-block-size:calc(var(--_n-combobox-block-size) - var(--n-space-s));flex-shrink:0}nord-combobox .n-listbox{inline-size:var(--n-combobox-list-inline-size,var(--_n-combobox-anchor-inline-size,100%));margin:0;max-block-size:calc(var(--n-space-xxl)*4);overflow-y:auto;padding-block-end:var(--n-space-s);padding-block-start:var(--n-space-s);padding-inline:0}nord-combobox .n-virtual-sizer{inline-size:100%;position:relative}nord-combobox .n-virtual-row{inset-block-start:0;inset-inline:0;position:absolute}nord-combobox .n-virtual-row>.n-option{block-size:100%;box-sizing:border-box;min-block-size:0;overflow:hidden}nord-combobox .n-group-label{color:var(--n-color-text-weaker);font-size:var(--n-font-size-xs);font-weight:var(--n-font-weight-heading);line-height:var(--n-line-height-tight);padding-block-end:var(--n-space-s);padding-block-start:var(--n-space-s);padding-inline-end:calc(var(--n-space-s) + var(--n-space-xs)/2);padding-inline-start:calc(var(--n-space-s) + var(--n-space-xs)/2)}nord-combobox [role=group]:not(:first-child):before{border-block-start:1px solid var(--n-color-border);content:"";display:block;margin-block-end:var(--n-space-s);margin-block-start:var(--n-space-s)}nord-combobox .n-option{align-items:center;color:var(--n-color-text);cursor:pointer;display:flex;font-size:var(--_n-combobox-font-size);gap:var(--n-space-s);line-height:var(--n-line-height);padding-block-end:calc(var(--n-space-xs)*1.5);padding-block-start:calc(var(--n-space-xs)*1.5);padding-inline-end:calc(var(--n-space-s) + var(--n-space-xs)/2);padding-inline-start:calc(var(--n-space-s) + var(--n-space-xs)/2);user-select:none}nord-combobox .n-option.is-active{background:var(--n-color-accent);color:var(--n-color-text-on-accent)}nord-combobox .n-option:active{opacity:.8}nord-combobox .n-option.is-disabled{color:var(--n-color-text-weakest);cursor:default;pointer-events:none}nord-combobox .n-option-label{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}nord-combobox .n-option-check{block-size:var(--n-space-m);color:var(--n-color-text-highlight);display:grid;flex:0 0 var(--n-space-m);inline-size:var(--n-space-m);place-items:center}nord-combobox .n-option.is-active .n-option-check{color:currentColor}nord-combobox .n-create{color:var(--n-color-text-link)}nord-combobox .n-create .n-option-label{font-weight:var(--n-font-weight-active)}nord-combobox .n-create-icon{--_n-icon-size:var(--n-size-icon-s);color:currentColor;flex-shrink:0}nord-combobox .n-create-kbd{flex-shrink:0}nord-combobox .n-empty{align-items:center;color:var(--n-color-text-weaker);display:flex;font-size:var(--_n-combobox-font-size);justify-content:center;padding:var(--n-space-s);text-align:center}`;export{n as s};
|
|
2
|
+
//# sourceMappingURL=Combobox-DBxXlbY7.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Combobox-DBxXlbY7.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/lib/Combobox.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{_ as t}from"./tslib.es6-CmLYFWVC.js";import{i}from"./context-provider-D8lrPLVi.js";import{a as e}from"./interface-add-small-B-hv2v9J.js";import{nothing as o,html as s}from"lit";import{property as r,state as l,customElement as a}from"lit/decorators.js";import{classMap as n}from"lit/directives/class-map.js";import{repeat as p}from"lit/directives/repeat.js";import{i as c}from"./light-dom-styles-DXsbiKU9.js";import m from"./Icon.js";import{comboboxRegistryContext as
|
|
1
|
+
import{_ as t}from"./tslib.es6-CmLYFWVC.js";import{i}from"./context-provider-D8lrPLVi.js";import{a as e}from"./interface-add-small-B-hv2v9J.js";import{nothing as o,html as s}from"lit";import{property as r,state as l,customElement as a}from"lit/decorators.js";import{classMap as n}from"lit/directives/class-map.js";import{repeat as p}from"lit/directives/repeat.js";import{i as c}from"./light-dom-styles-DXsbiKU9.js";import m from"./Icon.js";import{comboboxRegistryContext as h}from"./combobox-context.js";import{s as d}from"./Combobox-DBxXlbY7.js";import u from"./ComboboxBase.js";import{ComboboxClearEvent as j,ComboboxCreateEvent as v}from"./ComboboxEvents.js";import"./Kbd.js";import"./Tag.js";import"./ComboboxOption.js";import"./ComboboxGroup.js";import"./context-request-event-CCRlXoeR.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"./create-context-CJ69ntlY.js";import"./ActiveDescendantController-BnMqM79O.js";import"./number-Dg2vCfGd.js";import"./interface-close-small-CnpAFMO3.js";import"./interface-dropdown-small-CYvgxudU.js";import"lit/directives/ref.js";import"lit/directives/style-map.js";import"./collection-Dvg2XbxV.js";import"./FormDataController-OUt5L5uC.js";import"./LightDismissController-wcL1ziJa.js";import"./EventController-BBOmvfLa.js";import"./ShortcutController-CV5b0BZl.js";import"./tinykeys-DwvDXsEb.js";import"./ResizeController-14PUwRQy.js";import"./StateAttributesController-BIh96sXZ.js";import"./events-Bv6wNHwJ.js";import"./AutocompleteMixin-D8eiOxvO.js";import"./DraftComponentMixin-4qug5Rky.js";import"./FieldControlMixin-BXNZJXu9.js";import"./context-consumer-BJVUulGf.js";import"./field-context.js";import"./SlotController-Z6eG7LSZ.js";import"./VisuallyHidden.js";import"./Popout-CFtFoCaA.js";import"./positioning-D-K8Mueq.js";import"./DirectionController-ChvNGESZ.js";import"./ScrollbarController-BFC67Y2x.js";import"./InputMixin-LetXsCyv.js";import"./SizeMixin-CU9cLbLC.js";import"./LocalizeController.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"./localization23.js";import"./Spinner.js";import"./interface-checked-small-BQmkNgCI.js";import"./FocusableMixin-BlQLNPdJ.js";m.registerIcon(e);let b=class extends u{constructor(){super(...arguments),this.value="",this.multiple=!1,this.clearable=!0,this.creatable=!1,this.slottedOptions=[],this.createdOptions=[],this.optionElements=new Set,this.optionRegistry={add:t=>{this.optionElements.add(t),this.rebuildSlottedOptions()},remove:t=>{this.optionElements.delete(t),this.rebuildSlottedOptions()},notify:()=>this.rebuildSlottedOptions()},this.registryProvider=new i(this,{context:h,initialValue:this.optionRegistry})}connectedCallback(){super.connectedCallback(),c(this,d)}readOptionElement(t){var i,e,o,s,r;const l=(null===(i=t.closest("nord-combobox-group"))||void 0===i?void 0:i.getAttribute("label"))||void 0,a=null!==(s=null!==(e=t.getAttribute("label"))&&void 0!==e?e:null===(o=t.textContent)||void 0===o?void 0:o.trim())&&void 0!==s?s:"",n={value:null!==(r=t.getAttribute("value"))&&void 0!==r?r:"",label:a,disabled:t.hasAttribute("disabled")};return l&&(n.group=l),t.children.length>0&&(n.html=t.innerHTML),n}rebuildSlottedOptions(){const t=[...this.optionElements].sort(((t,i)=>t.compareDocumentPosition(i)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1));this.slottedOptions=t.map((t=>this.readOptionElement(t)))}get resolvedOptions(){const t=this.options.length?this.options:this.slottedOptions,i=this.createdOptions,e=this.resolvedCache;if(e&&e.options===this.options&&e.slotted===this.slottedOptions&&e.created===i)return e.result;const o=i.length?[...t,...i]:t;return this.resolvedCache={options:this.options,slotted:this.slottedOptions,created:i,result:o},o}get isMultiple(){return this.multiple}get showsQueryInInput(){return this.isMultiple||this.queryDirty}get inputPlaceholder(){return this.isMultiple&&this.hasValue?void 0:this.placeholder}get createIndex(){return this.canCreate?this.filteredOptions.length:-1}get canCreate(){const t=this.search.trim();return!(!this.creatable||!t)&&!this.resolvedOptions.some((i=>i.label.toLocaleLowerCase()===t.toLocaleLowerCase()))}get showClear(){return this.clearable&&this.hasValue&&!this.disabled&&!this.readonly}get ariaMultiselectable(){return this.isMultiple?"true":"false"}clear(){this.value=this.isMultiple?[]:"",this.search="",this.queryDirty=!1,this.dispatchEvent(new j),this.commit(),this.focus()}selectOption(t){if(!this.isMultiple)return super.selectOption(t);if(t.disabled)return;this.labelCache.set(t.value,t.label);const i=this.values.includes(t.value)?this.values.filter((i=>i!==t.value)):[...this.values,t.value];this.value=i,this.search="",this.queryDirty=!1,this.commit(),this.focus()}onInput(t){!this.isMultiple&&""===t.value&&this.hasValue&&(this.value="",this.commit())}emitCreate(){const t=this.search.trim();if(!t)return;if(!this.dispatchEvent(new v(t)))return;const i={value:t,label:t};this.resolvedOptions.some((t=>t.value===i.value))||(this.createdOptions=[...this.createdOptions,i]),this.labelCache.set(i.value,i.label),this.selectOption(i)}onUnhandledKeydown(t){"Backspace"===t.key&&this.isMultiple&&!this.search&&this.values.length&&this.removeValue(this.values[this.values.length-1])}removeValue(t){this.disabled||(this.value=this.values.filter((i=>i!==t)),this.commit(),this.focus())}renderLeadingControl(){return this.isMultiple?p(this.values,(t=>t),(t=>s`<nord-tag class="n-chip" size="s" variant="removable" ?disabled="${this.disabled}" @remove="${()=>this.removeValue(t)}" @click="${t=>t.stopPropagation()}">${this.labelFor(t)}</nord-tag>`)):o}renderCreate(){const t=this.activeDescendant.activeIndex===this.createIndex;return s`<div id="${this.createId}" class="${n({"n-option":!0,"n-create":!0,"is-active":t})}" role="option" aria-selected="false" @click="${this.emitCreate}" @mousemove="${()=>this.activeDescendant.setActiveIndex(this.createIndex)}"><nord-icon class="n-create-icon" name="interface-add-small"></nord-icon><span class="n-option-label">${this.localize.term("createLabel",this.search.trim())}</span><nord-kbd class="n-create-kbd" aria-hidden="true">⏎</nord-kbd></div>`}};t([r({attribute:!1})],b.prototype,"value",void 0),t([r({reflect:!0,type:Boolean})],b.prototype,"multiple",void 0),t([r({reflect:!0,type:Boolean})],b.prototype,"clearable",void 0),t([r({reflect:!0,type:Boolean})],b.prototype,"creatable",void 0),t([l()],b.prototype,"slottedOptions",void 0),t([l()],b.prototype,"createdOptions",void 0),b=t([a("nord-combobox")],b);var f=b;export{j as ComboboxClearEvent,v as ComboboxCreateEvent,f as default};
|
|
2
2
|
//# sourceMappingURL=Combobox.js.map
|