@nvidia-elements/core 2.19.0 → 2.20.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/CHANGELOG.md +18 -0
- package/dist/_virtual/_rolldown/runtime.js +17 -0
- package/dist/accordion/accordion2.js +60 -57
- package/dist/accordion/accordion2.js.map +1 -1
- package/dist/alert/alert-group2.js +1 -1
- package/dist/alert/alert2.js +37 -31
- package/dist/alert/alert2.js.map +1 -1
- package/dist/avatar/avatar-group2.js +1 -1
- package/dist/avatar/avatar2.js +1 -1
- package/dist/badge/badge.d.ts +0 -6
- package/dist/badge/badge2.js +31 -36
- package/dist/badge/badge2.js.map +1 -1
- package/dist/breadcrumb/breadcrumb2.js +1 -1
- package/dist/bundle.d.ts +2 -0
- package/dist/bundles/index.d.ts +153 -27
- package/dist/bundles/index.js +9 -9
- package/dist/button/button2.js +1 -1
- package/dist/button-group/button-group2.js +1 -1
- package/dist/card/card2.js +4 -4
- package/dist/chat-message/chat-message2.js +1 -1
- package/dist/checkbox/checkbox-group2.js +1 -1
- package/dist/checkbox/checkbox2.js +1 -1
- package/dist/color/color.d.ts +2 -0
- package/dist/color/color2.js +7 -4
- package/dist/color/color2.js.map +1 -1
- package/dist/combobox/combobox.d.ts +2 -0
- package/dist/combobox/combobox2.js +14 -6
- package/dist/combobox/combobox2.js.map +1 -1
- package/dist/copy-button/copy-button2.js +26 -23
- package/dist/copy-button/copy-button2.js.map +1 -1
- package/dist/custom-elements-jsx.d.ts +166 -4
- package/dist/custom-elements-vue.d.ts +160 -4
- package/dist/custom-elements.json +1239 -220
- package/dist/data.html.json +117 -10
- package/dist/date/date.d.ts +2 -0
- package/dist/date/date2.js +7 -4
- package/dist/date/date2.js.map +1 -1
- package/dist/datetime/datetime.d.ts +2 -0
- package/dist/datetime/datetime2.js +7 -4
- package/dist/datetime/datetime2.js.map +1 -1
- package/dist/dialog/dialog-footer2.js +1 -1
- package/dist/dialog/dialog-header2.js +1 -1
- package/dist/dialog/dialog2.js +27 -27
- package/dist/dialog/dialog2.js.map +1 -1
- package/dist/divider/divider2.js +1 -1
- package/dist/dot/dot2.js +1 -1
- package/dist/drag-handle/drag-handle2.js +1 -1
- package/dist/drawer/drawer-content2.js +1 -1
- package/dist/drawer/drawer-footer2.js +1 -1
- package/dist/drawer/drawer-header2.js +1 -1
- package/dist/drawer/drawer2.js +27 -27
- package/dist/drawer/drawer2.js.map +1 -1
- package/dist/dropdown/dropdown-footer2.js +1 -1
- package/dist/dropdown/dropdown-header2.js +1 -1
- package/dist/dropdown/dropdown2.js +23 -23
- package/dist/dropdown/dropdown2.js.map +1 -1
- package/dist/dropdown-group/dropdown-group.js +1 -1
- package/dist/dropzone/dropzone2.js +28 -22
- package/dist/dropzone/dropzone2.js.map +1 -1
- package/dist/file/file2.js +1 -1
- package/dist/format-bytes/format-bytes2.js +1 -1
- package/dist/format-datetime/format-datetime2.js +1 -1
- package/dist/format-number/format-number2.js +1 -1
- package/dist/format-relative-time/format-relative-time2.js +1 -1
- package/dist/format-truncate/format-truncate2.js +1 -1
- package/dist/forms/control/control.d.ts +3 -0
- package/dist/forms/control/control2.js +34 -31
- package/dist/forms/control/control2.js.map +1 -1
- package/dist/forms/control-group/control-group2.js +1 -1
- package/dist/forms/control-message/control-message2.js +1 -1
- package/dist/gauge/gauge2.js +26 -21
- package/dist/gauge/gauge2.js.map +1 -1
- package/dist/grid/cell/cell2.js +1 -1
- package/dist/grid/column/column2.js +1 -1
- package/dist/grid/footer/footer2.js +1 -1
- package/dist/grid/grid2.js +1 -1
- package/dist/grid/header/header2.js +1 -1
- package/dist/grid/placeholder/placeholder2.js +1 -1
- package/dist/grid/row/row2.js +1 -1
- package/dist/icon/icon2.js +2 -2
- package/dist/icon-button/icon-button2.js +1 -1
- package/dist/iframe/iframe2.js +1 -1
- package/dist/index.js +5 -6
- package/dist/input/input-group2.js +1 -1
- package/dist/input/input2.js +1 -1
- package/dist/internal/index.d.ts +1 -2
- package/dist/internal/index.js +150 -33
- package/dist/internal/index.js.map +1 -0
- package/dist/internal/types/index.d.ts +1 -1
- package/dist/internal/types/index.js.map +1 -1
- package/dist/joystick/define.d.ts +6 -0
- package/dist/joystick/define.js +7 -0
- package/dist/joystick/define.js.map +1 -0
- package/dist/joystick/index.d.ts +1 -0
- package/dist/joystick/index.js +2 -0
- package/dist/joystick/joystick.d.ts +126 -0
- package/dist/joystick/joystick.examples.js +6 -0
- package/dist/joystick/joystick.examples.js.map +1 -0
- package/dist/joystick/joystick.examples.json +107 -0
- package/dist/joystick/joystick.js +6 -0
- package/dist/joystick/joystick.js.map +1 -0
- package/dist/joystick/joystick2.js +347 -0
- package/dist/joystick/joystick2.js.map +1 -0
- package/dist/logo/logo2.js +1 -1
- package/dist/menu/menu-group2.js +1 -1
- package/dist/menu/menu-item2.js +1 -1
- package/dist/menu/menu2.js +1 -1
- package/dist/month/month.d.ts +2 -0
- package/dist/month/month2.js +7 -4
- package/dist/month/month2.js.map +1 -1
- package/dist/notification/notification-group2.js +1 -1
- package/dist/notification/notification2.js +38 -32
- package/dist/notification/notification2.js.map +1 -1
- package/dist/page/page-panel/page-panel-content2.js +1 -1
- package/dist/page/page-panel/page-panel-footer2.js +1 -1
- package/dist/page/page-panel/page-panel-header2.js +1 -1
- package/dist/page/page-panel/page-panel.d.ts +0 -7
- package/dist/page/page-panel/page-panel2.js +18 -20
- package/dist/page/page-panel/page-panel2.js.map +1 -1
- package/dist/page/page2.js +1 -1
- package/dist/page-header/page-header2.js +1 -1
- package/dist/page-loader/page-loader2.js +1 -1
- package/dist/pagination/pagination2.js +45 -38
- package/dist/pagination/pagination2.js.map +1 -1
- package/dist/panel/panel2.js +43 -38
- package/dist/panel/panel2.js.map +1 -1
- package/dist/password/password.d.ts +2 -0
- package/dist/password/password2.js +10 -4
- package/dist/password/password2.js.map +1 -1
- package/dist/preferences-input/preferences-input2.js +32 -27
- package/dist/preferences-input/preferences-input2.js.map +1 -1
- package/dist/progress-bar/progress-bar2.js +1 -1
- package/dist/progress-dot/progress-dot2.js +17 -17
- package/dist/progress-dot/progress-dot2.js.map +1 -1
- package/dist/progress-ring/progress-ring2.js +27 -22
- package/dist/progress-ring/progress-ring2.js.map +1 -1
- package/dist/progressive-filter-chip/progressive-filter-chip2.js +30 -30
- package/dist/progressive-filter-chip/progressive-filter-chip2.js.map +1 -1
- package/dist/pulse/pulse2.js +1 -1
- package/dist/radio/radio-group2.js +1 -1
- package/dist/radio/radio2.js +1 -1
- package/dist/range/range2.js +1 -1
- package/dist/resize-handle/resize-handle2.js +17 -17
- package/dist/resize-handle/resize-handle2.js.map +1 -1
- package/dist/search/search2.js +1 -1
- package/dist/select/select2.js +44 -41
- package/dist/select/select2.js.map +1 -1
- package/dist/skeleton/skeleton2.js +1 -1
- package/dist/sort-button/sort-button2.js +20 -20
- package/dist/sort-button/sort-button2.js.map +1 -1
- package/dist/sparkline/sparkline2.js +1 -1
- package/dist/star-rating/star-rating2.js +1 -1
- package/dist/steps/steps2.js +2 -2
- package/dist/switch/switch-group2.js +1 -1
- package/dist/switch/switch2.js +1 -1
- package/dist/tabs/tabs-group2.js +1 -1
- package/dist/tabs/tabs-item-group2.js +1 -1
- package/dist/tabs/tabs2.js +2 -2
- package/dist/tag/tag2.js +19 -19
- package/dist/tag/tag2.js.map +1 -1
- package/dist/textarea/textarea2.js +1 -1
- package/dist/time/time.d.ts +2 -0
- package/dist/time/time2.js +7 -4
- package/dist/time/time2.js.map +1 -1
- package/dist/toast/toast2.js +35 -29
- package/dist/toast/toast2.js.map +1 -1
- package/dist/toggletip/toggletip-footer2.js +1 -1
- package/dist/toggletip/toggletip-header2.js +1 -1
- package/dist/toggletip/toggletip2.js +25 -25
- package/dist/toggletip/toggletip2.js.map +1 -1
- package/dist/toolbar/toolbar2.js +1 -1
- package/dist/tooltip/tooltip2.js +1 -1
- package/dist/tree/tree-node2.js +45 -45
- package/dist/tree/tree-node2.js.map +1 -1
- package/dist/tree/tree2.js +1 -1
- package/dist/week/week.d.ts +2 -0
- package/dist/week/week2.js +7 -4
- package/dist/week/week2.js.map +1 -1
- package/package.json +14 -2
- package/dist/internal/controllers/i18n.controller.d.ts +0 -19
- package/dist/internal/controllers/i18n.controller.examples.js +0 -6
- package/dist/internal/controllers/i18n.controller.examples.js.map +0 -1
- package/dist/internal/controllers/i18n.controller.examples.json +0 -16
- package/dist/internal/controllers/i18n.controller.js +0 -38
- package/dist/internal/controllers/i18n.controller.js.map +0 -1
- package/dist/internal/services/i18n.service.d.ts +0 -64
- package/dist/internal/services/i18n.service.js +0 -73
- package/dist/internal/services/i18n.service.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pagination2.js","names":[],"sources":["../../src/pagination/pagination.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { html, LitElement, nothing } from 'lit';\nimport { property } from 'lit/decorators/property.js';\nimport { FormControlMixin } from '@nvidia-elements/forms/mixins';\nimport type { KeynavListConfig } from '@nvidia-elements/core/internal';\nimport {\n attachInternals,\n I18nController,\n formatStandardNumber,\n keyNavigationList,\n typeSSR,\n useStyles,\n scopedRegistry\n} from '@nvidia-elements/core/internal';\nimport { IconButton } from '@nvidia-elements/core/icon-button';\nimport { Select } from '@nvidia-elements/core/select';\nimport styles from './pagination.css?inline';\n\n/* eslint-disable jsdoc/no-types */\n// explicit jsdoc annotation due to inheritance context lost with CEM generator\n\n/**\n * @element nve-pagination\n * @description Pagination is a control that enables users to navigate through pages of content.\n * @documentation https://nvidia.github.io/elements/docs/elements/pagination/\n * @since 0.11.0\n * @entrypoint \\@nvidia-elements/core/pagination\n * @event input - Dispatched when the value (page) has changed\n * @event change - Dispatched when the value (page) has changed\n * @event first-page - Dispatched when the first page is active\n * @event last-page - Dispatched when the last page is active\n * @event step-change - Dispatched after the page size changes with the current page size in `detail`. The event bubbles and crosses shadow boundaries.\n * @slot suffix-label - Overrides the \"of total\" label when the total is an approximation.\n * @cssprop --background\n * @cssprop --font-size\n * @cssprop --width\n * @csspart icon-button - Base part applied to all icon button elements\n * @csspart previous-icon-button - The previous page icon button\n * @csspart next-icon-button - The next page icon button\n * @csspart start-icon-button - The first page icon button\n * @csspart end-icon-button - The last page icon button\n * @csspart select - The page size select element\n * @aria https://www.w3.org/WAI/ARIA/apg/patterns/toolbar/\n * @property {number} value - value the current page number\n * @attribute {string} step-sizes - A JSON-serialized array of page-size options available in the selector.\n */\n@typeSSR()\n@keyNavigationList<Pagination>()\n@scopedRegistry()\nexport class Pagination extends FormControlMixin<typeof LitElement, number>(LitElement) {\n /**\n * The number of items per page.\n */\n @property({ type: Number }) step = 10;\n /**\n * Page-size options available in the selector.\n */\n @property({ type: Array, attribute: 'step-sizes' }) stepSizes: number[] = [10, 20, 50, 100];\n\n /**\n * The total number of items.\n */\n @property({ type: Number }) items: number;\n\n /**\n * Whether the pagination is skippable to start/end.\n */\n @property({ type: Boolean }) skippable: boolean;\n\n /**\n * Whether the step selector has a disabled state.\n */\n @property({ type: Boolean, attribute: 'disable-step' }) disableStep: boolean;\n\n /**\n * Determines the container styles of component. Flat applies when nesting within other containers. Inline applies when placing within other inline content.\n */\n @property({ type: String, reflect: true }) container?: 'flat' | 'inline';\n\n #i18nController: I18nController<this> = new I18nController<this>(this);\n\n /**\n * Enables updating internal string values for internationalization.\n */\n @property({ type: Object }) i18n = this.#i18nController.i18n;\n\n static styles = useStyles([styles]);\n\n static readonly metadata = {\n tag: 'nve-pagination',\n version: '0.0.0',\n valueSchema: {\n type: 'number' as const\n }\n };\n\n static elementDefinitions = {\n [IconButton.metadata.tag]: IconButton,\n [Select.metadata.tag]: Select\n };\n\n /** @private */\n get keynavListConfig(): KeynavListConfig {\n return {\n items: this.shadowRoot!.querySelectorAll<HTMLElement>(`${IconButton.metadata.tag}, input, select`),\n layout: 'horizontal'\n };\n }\n\n get #currentPage() {\n return (this.value! - 1) * this.step + this.step;\n }\n\n get #isLastPage() {\n return this.items / this.value! === this.step;\n }\n\n get #isFirstPage() {\n return this.value === 1;\n }\n\n get #selectLabel() {\n const start = (this.value! - 1) * this.step + 1;\n const end = Math.min(this.value! * this.step, this.items || Infinity);\n return `${formatStandardNumber(start)}-${formatStandardNumber(end)}`;\n }\n\n get #label() {\n return this.items\n ? html`<label><slot name=\"suffix-label\">${this.i18n.of} ${formatStandardNumber(this.items)}</slot></label>`\n : nothing;\n }\n\n get #previousButton() {\n return html`<nve-icon-button part=\"icon-button previous-icon-button\"\n @click=${() => this.#setValue(this.value! - 1)}\n .disabled=${this.disabled || this.#currentPage <= this.step}\n .ariaLabel=${this.i18n.previous}\n container=\"inline\"\n icon-name=\"chevron\"\n direction=\"left\"\n ></nve-icon-button>`;\n }\n\n get #nextButton() {\n return html`<nve-icon-button part=\"icon-button next-icon-button\"\n @click=${() => this.#setValue(this.value! + 1)}\n .disabled=${this.disabled || this.#currentPage >= this.items}\n .ariaLabel=${this.i18n.next}\n container=\"inline\"\n icon-name=\"chevron\"\n direction=\"right\"\n ></nve-icon-button>`;\n }\n\n get #startButton() {\n return html`<nve-icon-button part=\"icon-button start-icon-button\"\n @click=${() => this.#setValue(1)}\n .disabled=${this.disabled || this.#currentPage <= this.step}\n .ariaLabel=${this.i18n.start}\n container=\"inline\"\n icon-name=\"arrow-stop\"\n direction=\"left\"\n ></nve-icon-button>`;\n }\n\n get #endButton() {\n return html`<nve-icon-button part=\"icon-button end-icon-button\"\n @click=${() => this.#setValue(this.items / this.step)}\n .disabled=${this.disabled || (this.value! - 1) * this.step + this.step >= this.items}\n .ariaLabel=${this.i18n.end}\n container=\"inline\"\n icon-name=\"arrow-stop\"\n direction=\"right\"\n ></nve-icon-button>`;\n }\n\n #resizeObserver: ResizeObserver;\n\n get #select() {\n return this.disableStep\n ? html`<label>${this.#selectLabel} </label>`\n : html`\n <nve-select part=\"select\" .container=${this.container}>\n <select\n .ariaLabel=${this.i18n.currentPage}\n @change=${(e: Event) => this.#setStep(parseInt((e.target as HTMLSelectElement).value, 10))}\n value=${this.step}\n .disabled=${this.disabled || this.disableStep}\n >\n ${this.stepSizes.map(i => html`<option ?selected=${this.step === i} value=${i}>${i}</option>`)}\n </select>\n <div class=\"select-label\">${this.#selectLabel}</div>\n </nve-select>\n `;\n }\n\n render() {\n return html`\n <div internal-host role=\"presentation\">\n ${\n this.skippable && this.items\n ? html`\n ${this.#startButton} ${this.#previousButton} ${this.#select} ${this.#label} ${this.#nextButton}\n ${this.#endButton}\n `\n : html` ${this.#select} ${this.#label} ${this.#previousButton} ${this.#nextButton} `\n }\n </div>\n `;\n }\n\n constructor() {\n super();\n this.value = 1;\n }\n\n async connectedCallback() {\n super.connectedCallback();\n attachInternals(this);\n this._internals.role = 'toolbar';\n await this.updateComplete;\n this.#setupLabelWidth();\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n this.#resizeObserver?.unobserve(this);\n }\n\n #setupLabelWidth() {\n const label = this.shadowRoot!.querySelector('.select-label');\n const select = this.shadowRoot!.querySelector('select');\n if (label && select) {\n this.#resizeObserver = new ResizeObserver(\n entries => (select!.style.minWidth = `${entries[0]!.contentRect.width + 36}px`)\n );\n this.#resizeObserver.observe(label);\n }\n }\n\n #setStep(value: number) {\n /* eslint-disable-next-line */\n this.step = value; // stateful due to internalized select element\n this.dispatchEvent(new CustomEvent('step-change', { detail: this.step, bubbles: true, composed: true }));\n this.#setValue(this.value!);\n }\n\n #setValue(value: number) {\n if (this.value !== value) {\n this.value = value;\n this.dispatchInputEvent();\n this.dispatchChangeEvent();\n }\n\n if (this.#isLastPage) {\n this.dispatchEvent(new CustomEvent('last-page', { bubbles: true, composed: true }));\n }\n\n if (this.#isFirstPage) {\n this.dispatchEvent(new CustomEvent('first-page', { bubbles: true, composed: true }));\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAmDO,IAAM,IAAN,cAAyB,EAA4C,CAAU,CAAC,CAAC;CA8BtF;;EAOgB,KAAA,SAAA,EAA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A,GAKrD,EAAA,CAAA,EAAS;CAAE,MAAM;CAAQ,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,aAAA,KAAA,CAAA,GAOxC,EAAA,CAAA,EAAS,EAAE,MAAM,OAAO,CAAC,CAAA,GAAA,EAAA,WAAA,QAAA,KAAA,CAAA;CAtC3B,EAAQ;CACR,EAA8B;CAC9B,EAAe"}
|
|
1
|
+
{"version":3,"file":"pagination2.js","names":[],"sources":["../../src/pagination/pagination.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { html, LitElement, nothing } from 'lit';\nimport { property } from 'lit/decorators/property.js';\nimport { FormControlMixin } from '@nvidia-elements/forms/mixins';\nimport type { KeynavListConfig } from '@nvidia-elements/core/internal';\nimport {\n attachInternals,\n formatStandardNumber,\n keyNavigationList,\n typeSSR,\n useStyles,\n scopedRegistry\n} from '@nvidia-elements/core/internal';\nimport { I18nController, type I18nDefaults } from '@nvidia-elements/foundations/internal/i18n';\nimport { IconButton } from '@nvidia-elements/core/icon-button';\nimport { Select } from '@nvidia-elements/core/select';\nimport styles from './pagination.css?inline';\n\nconst i18nDefaults = {\n of: 'of',\n previous: 'previous',\n next: 'next',\n start: 'start',\n end: 'end',\n currentPage: 'current page'\n} satisfies I18nDefaults;\n\n/* eslint-disable jsdoc/no-types */\n// explicit jsdoc annotation due to inheritance context lost with CEM generator\n\n/**\n * @element nve-pagination\n * @description Pagination is a control that enables users to navigate through pages of content.\n * @documentation https://nvidia.github.io/elements/docs/elements/pagination/\n * @since 0.11.0\n * @entrypoint \\@nvidia-elements/core/pagination\n * @event input - Dispatched when the value (page) has changed\n * @event change - Dispatched when the value (page) has changed\n * @event first-page - Dispatched when the first page is active\n * @event last-page - Dispatched when the last page is active\n * @event step-change - Dispatched after the page size changes with the current page size in `detail`. The event bubbles and crosses shadow boundaries.\n * @slot suffix-label - Overrides the \"of total\" label when the total is an approximation.\n * @cssprop --background\n * @cssprop --font-size\n * @cssprop --width\n * @csspart icon-button - Base part applied to all icon button elements\n * @csspart previous-icon-button - The previous page icon button\n * @csspart next-icon-button - The next page icon button\n * @csspart start-icon-button - The first page icon button\n * @csspart end-icon-button - The last page icon button\n * @csspart select - The page size select element\n * @aria https://www.w3.org/WAI/ARIA/apg/patterns/toolbar/\n * @property {number} value - value the current page number\n * @attribute {string} step-sizes - A JSON-serialized array of page-size options available in the selector.\n */\n@typeSSR()\n@keyNavigationList<Pagination>()\n@scopedRegistry()\nexport class Pagination extends FormControlMixin<typeof LitElement, number>(LitElement) {\n /**\n * The number of items per page.\n */\n @property({ type: Number }) step = 10;\n /**\n * Page-size options available in the selector.\n */\n @property({ type: Array, attribute: 'step-sizes' }) stepSizes: number[] = [10, 20, 50, 100];\n\n /**\n * The total number of items.\n */\n @property({ type: Number }) items: number;\n\n /**\n * Whether the pagination is skippable to start/end.\n */\n @property({ type: Boolean }) skippable: boolean;\n\n /**\n * Whether the step selector has a disabled state.\n */\n @property({ type: Boolean, attribute: 'disable-step' }) disableStep: boolean;\n\n /**\n * Determines the container styles of component. Flat applies when nesting within other containers. Inline applies when placing within other inline content.\n */\n @property({ type: String, reflect: true }) container?: 'flat' | 'inline';\n\n #i18nController: I18nController<this> = new I18nController<this>(this, i18nDefaults);\n\n /**\n * Enables updating internal string values for internationalization.\n */\n @property({ type: Object }) i18n = this.#i18nController.i18n;\n\n static styles = useStyles([styles]);\n\n static readonly metadata = {\n tag: 'nve-pagination',\n version: '0.0.0',\n valueSchema: {\n type: 'number' as const\n }\n };\n\n static elementDefinitions = {\n [IconButton.metadata.tag]: IconButton,\n [Select.metadata.tag]: Select\n };\n\n /** @private */\n get keynavListConfig(): KeynavListConfig {\n return {\n items: this.shadowRoot!.querySelectorAll<HTMLElement>(`${IconButton.metadata.tag}, input, select`),\n layout: 'horizontal'\n };\n }\n\n get #currentPage() {\n return (this.value! - 1) * this.step + this.step;\n }\n\n get #isLastPage() {\n return this.items / this.value! === this.step;\n }\n\n get #isFirstPage() {\n return this.value === 1;\n }\n\n get #selectLabel() {\n const start = (this.value! - 1) * this.step + 1;\n const end = Math.min(this.value! * this.step, this.items || Infinity);\n return `${formatStandardNumber(start)}-${formatStandardNumber(end)}`;\n }\n\n get #label() {\n return this.items\n ? html`<label><slot name=\"suffix-label\">${this.i18n.of} ${formatStandardNumber(this.items)}</slot></label>`\n : nothing;\n }\n\n get #previousButton() {\n return html`<nve-icon-button part=\"icon-button previous-icon-button\"\n @click=${() => this.#setValue(this.value! - 1)}\n .disabled=${this.disabled || this.#currentPage <= this.step}\n .ariaLabel=${this.i18n.previous}\n container=\"inline\"\n icon-name=\"chevron\"\n direction=\"left\"\n ></nve-icon-button>`;\n }\n\n get #nextButton() {\n return html`<nve-icon-button part=\"icon-button next-icon-button\"\n @click=${() => this.#setValue(this.value! + 1)}\n .disabled=${this.disabled || this.#currentPage >= this.items}\n .ariaLabel=${this.i18n.next}\n container=\"inline\"\n icon-name=\"chevron\"\n direction=\"right\"\n ></nve-icon-button>`;\n }\n\n get #startButton() {\n return html`<nve-icon-button part=\"icon-button start-icon-button\"\n @click=${() => this.#setValue(1)}\n .disabled=${this.disabled || this.#currentPage <= this.step}\n .ariaLabel=${this.i18n.start}\n container=\"inline\"\n icon-name=\"arrow-stop\"\n direction=\"left\"\n ></nve-icon-button>`;\n }\n\n get #endButton() {\n return html`<nve-icon-button part=\"icon-button end-icon-button\"\n @click=${() => this.#setValue(this.items / this.step)}\n .disabled=${this.disabled || (this.value! - 1) * this.step + this.step >= this.items}\n .ariaLabel=${this.i18n.end}\n container=\"inline\"\n icon-name=\"arrow-stop\"\n direction=\"right\"\n ></nve-icon-button>`;\n }\n\n #resizeObserver: ResizeObserver;\n\n get #select() {\n return this.disableStep\n ? html`<label>${this.#selectLabel} </label>`\n : html`\n <nve-select part=\"select\" .container=${this.container}>\n <select\n .ariaLabel=${this.i18n.currentPage}\n @change=${(e: Event) => this.#setStep(parseInt((e.target as HTMLSelectElement).value, 10))}\n value=${this.step}\n .disabled=${this.disabled || this.disableStep}\n >\n ${this.stepSizes.map(i => html`<option ?selected=${this.step === i} value=${i}>${i}</option>`)}\n </select>\n <div class=\"select-label\">${this.#selectLabel}</div>\n </nve-select>\n `;\n }\n\n render() {\n return html`\n <div internal-host role=\"presentation\">\n ${\n this.skippable && this.items\n ? html`\n ${this.#startButton} ${this.#previousButton} ${this.#select} ${this.#label} ${this.#nextButton}\n ${this.#endButton}\n `\n : html` ${this.#select} ${this.#label} ${this.#previousButton} ${this.#nextButton} `\n }\n </div>\n `;\n }\n\n constructor() {\n super();\n this.value = 1;\n }\n\n async connectedCallback() {\n super.connectedCallback();\n attachInternals(this);\n this._internals.role = 'toolbar';\n await this.updateComplete;\n this.#setupLabelWidth();\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n this.#resizeObserver?.unobserve(this);\n }\n\n #setupLabelWidth() {\n const label = this.shadowRoot!.querySelector('.select-label');\n const select = this.shadowRoot!.querySelector('select');\n if (label && select) {\n this.#resizeObserver = new ResizeObserver(\n entries => (select!.style.minWidth = `${entries[0]!.contentRect.width + 36}px`)\n );\n this.#resizeObserver.observe(label);\n }\n }\n\n #setStep(value: number) {\n /* eslint-disable-next-line */\n this.step = value; // stateful due to internalized select element\n this.dispatchEvent(new CustomEvent('step-change', { detail: this.step, bubbles: true, composed: true }));\n this.#setValue(this.value!);\n }\n\n #setValue(value: number) {\n if (this.value !== value) {\n this.value = value;\n this.dispatchInputEvent();\n this.dispatchChangeEvent();\n }\n\n if (this.#isLastPage) {\n this.dispatchEvent(new CustomEvent('last-page', { bubbles: true, composed: true }));\n }\n\n if (this.#isFirstPage) {\n this.dispatchEvent(new CustomEvent('first-page', { bubbles: true, composed: true }));\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAoBA,IAAM,IAAe;CACnB,IAAI;CACJ,UAAU;CACV,MAAM;CACN,OAAO;CACP,KAAK;CACL,aAAa;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,CAAA,EAAS;CAAE,MAAM;CAAS,WAAW;AAAe,CAAC,CAAA,GAAA,EAAA,WAAA,eAAA,KAAA,CAAA,GAKrD,EAAA,CAAA,EAAS;CAAE,MAAM;CAAQ,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,aAAA,KAAA,CAAA,GAOxC,EAAA,CAAA,EAAS,EAAE,MAAM,OAAO,CAAC,CAAA,GAAA,EAAA,WAAA,QAAA,KAAA,CAAA;CAtC3B,EAAQ;CACR,EAA8B;CAC9B,EAAe"}
|
package/dist/panel/panel2.js
CHANGED
|
@@ -1,79 +1,84 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import o from "../
|
|
8
|
-
import
|
|
9
|
-
import c from "./panel.js";
|
|
10
|
-
import l from "./panel-
|
|
11
|
-
import u from "./panel-
|
|
12
|
-
import d from "
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
1
|
+
import { attachInternals as e } from "../internal/utils/a11y.js";
|
|
2
|
+
import { stateExpanded as t } from "../internal/controllers/state-expanded.controller.js";
|
|
3
|
+
import { TypeExpandableController as n } from "../internal/controllers/type-expandable.controller.js";
|
|
4
|
+
import { scopedRegistry as r } from "../internal/decorators/scoped-registry.js";
|
|
5
|
+
import { useStyles as i } from "../internal/styles/index.js";
|
|
6
|
+
import a from "../_virtual/_@oxc-project_runtime@0.147.0/helpers/esm/decorate.js";
|
|
7
|
+
import { IconButton as o } from "../icon-button/icon-button2.js";
|
|
8
|
+
import s from "./panel.js";
|
|
9
|
+
import c from "./panel-header.js";
|
|
10
|
+
import l from "./panel-content.js";
|
|
11
|
+
import u from "./panel-footer.js";
|
|
12
|
+
import { LitElement as d, html as f } from "lit";
|
|
13
|
+
import { property as p } from "lit/decorators/property.js";
|
|
14
|
+
import { I18nController as m } from "@nvidia-elements/foundations/internal/i18n";
|
|
15
15
|
import { when as h } from "lit/directives/when.js";
|
|
16
16
|
//#region src/panel/panel.ts
|
|
17
|
-
var g =
|
|
17
|
+
var g = {
|
|
18
|
+
close: "close",
|
|
19
|
+
expand: "expand",
|
|
20
|
+
hide: "hide",
|
|
21
|
+
show: "show"
|
|
22
|
+
}, _ = class extends d {
|
|
18
23
|
static {
|
|
19
|
-
this.styles =
|
|
24
|
+
this.styles = i([c]);
|
|
20
25
|
}
|
|
21
26
|
static {
|
|
22
27
|
this.metadata = {
|
|
23
28
|
tag: "nve-panel-header",
|
|
24
|
-
version: "2.
|
|
29
|
+
version: "2.20.0"
|
|
25
30
|
};
|
|
26
31
|
}
|
|
27
32
|
render() {
|
|
28
|
-
return
|
|
33
|
+
return f`<div internal-host><div id="titles"><slot name="title"></slot><slot name="subtitle"></slot><slot></slot></div><slot name="action-icon"></slot></div>`;
|
|
29
34
|
}
|
|
30
35
|
connectedCallback() {
|
|
31
36
|
super.connectedCallback(), this.slot = "header";
|
|
32
37
|
}
|
|
33
|
-
},
|
|
38
|
+
}, v = class extends d {
|
|
34
39
|
static {
|
|
35
|
-
this.styles =
|
|
40
|
+
this.styles = i([l]);
|
|
36
41
|
}
|
|
37
42
|
static {
|
|
38
43
|
this.metadata = {
|
|
39
44
|
tag: "nve-panel-content",
|
|
40
|
-
version: "2.
|
|
45
|
+
version: "2.20.0"
|
|
41
46
|
};
|
|
42
47
|
}
|
|
43
48
|
render() {
|
|
44
|
-
return
|
|
49
|
+
return f`<slot></slot>`;
|
|
45
50
|
}
|
|
46
|
-
},
|
|
51
|
+
}, y = class extends d {
|
|
47
52
|
static {
|
|
48
|
-
this.styles =
|
|
53
|
+
this.styles = i([u]);
|
|
49
54
|
}
|
|
50
55
|
static {
|
|
51
56
|
this.metadata = {
|
|
52
57
|
tag: "nve-panel-footer",
|
|
53
|
-
version: "2.
|
|
58
|
+
version: "2.20.0"
|
|
54
59
|
};
|
|
55
60
|
}
|
|
56
61
|
render() {
|
|
57
|
-
return
|
|
62
|
+
return f`<footer internal-host><slot></slot></footer>`;
|
|
58
63
|
}
|
|
59
64
|
connectedCallback() {
|
|
60
65
|
super.connectedCallback(), this.slot = "footer";
|
|
61
66
|
}
|
|
62
|
-
},
|
|
63
|
-
constructor(...
|
|
64
|
-
super(...
|
|
67
|
+
}, b = class extends d {
|
|
68
|
+
constructor(...e) {
|
|
69
|
+
super(...e), this.expanded = !1, this.closable = !1, this.behaviorExpand = !1, this.side = "left", this.#e = new m(this, g), this.#t = new n(this), this.i18n = this.#e.i18n;
|
|
65
70
|
}
|
|
66
71
|
static {
|
|
67
|
-
this.styles =
|
|
72
|
+
this.styles = i([s]);
|
|
68
73
|
}
|
|
69
74
|
static {
|
|
70
75
|
this.metadata = {
|
|
71
76
|
tag: "nve-panel",
|
|
72
|
-
version: "2.
|
|
77
|
+
version: "2.20.0"
|
|
73
78
|
};
|
|
74
79
|
}
|
|
75
80
|
static {
|
|
76
|
-
this.elementDefinitions = { [
|
|
81
|
+
this.elementDefinitions = { [o.metadata.tag]: o };
|
|
77
82
|
}
|
|
78
83
|
#e;
|
|
79
84
|
#t;
|
|
@@ -81,20 +86,20 @@ var g = class extends f {
|
|
|
81
86
|
return this.side === "left" ? this.expanded ? "left" : "right" : this.expanded ? "right" : "left";
|
|
82
87
|
}
|
|
83
88
|
render() {
|
|
84
|
-
return
|
|
89
|
+
return f`<div internal-host><div class="header"><slot name="header"></slot>${h(!this.closable, () => f`<nve-icon-button part="icon-button" exportparts="icon:icon-button-icon" .container="${this.expanded ? "flat" : void 0}" icon-name="double-chevron" @click="${() => this.#t.toggle()}" .direction="${this.#n}" .expanded="${this.expanded}" .ariaLabel="${this.expanded ? this.i18n.close : this.i18n.expand}"></nve-icon-button>`, () => f`<nve-icon-button part="icon-button" exportparts="icon:icon-button-icon" container="flat" icon-name="cancel" @click="${() => this.#t.close()}" .expanded="${this.expanded}" .ariaLabel="${this.expanded ? this.i18n.hide : this.i18n.show}"></nve-icon-button>`)}</div><div class="content"><slot></slot></div><slot name="footer"></slot></div>`;
|
|
85
90
|
}
|
|
86
91
|
connectedCallback() {
|
|
87
|
-
super.connectedCallback(),
|
|
92
|
+
super.connectedCallback(), e(this), this._internals.role = "region";
|
|
88
93
|
}
|
|
89
94
|
};
|
|
90
|
-
|
|
95
|
+
a([p({
|
|
91
96
|
type: Boolean,
|
|
92
97
|
reflect: !0
|
|
93
|
-
})],
|
|
98
|
+
})], b.prototype, "expanded", void 0), a([p({ type: Boolean })], b.prototype, "closable", void 0), a([p({
|
|
94
99
|
type: Boolean,
|
|
95
100
|
attribute: "behavior-expand"
|
|
96
|
-
})],
|
|
101
|
+
})], b.prototype, "behaviorExpand", void 0), a([p({ type: String })], b.prototype, "side", void 0), a([p({ type: Object })], b.prototype, "i18n", void 0), b = a([r(), t()], b);
|
|
97
102
|
//#endregion
|
|
98
|
-
export {
|
|
103
|
+
export { b as Panel, v as PanelContent, y as PanelFooter, _ as PanelHeader };
|
|
99
104
|
|
|
100
105
|
//# sourceMappingURL=panel2.js.map
|
package/dist/panel/panel2.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"panel2.js","names":[],"sources":["../../src/panel/panel.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { html, LitElement } from 'lit';\nimport { property } from 'lit/decorators/property.js';\nimport { when } from 'lit/directives/when.js';\nimport {\n stateExpanded,\n I18nController,\n TypeExpandableController,\n useStyles,\n attachInternals,\n scopedRegistry\n} from '@nvidia-elements/core/internal';\nimport { IconButton } from '@nvidia-elements/core/icon-button';\nimport panelStyleSheet from './panel.css?inline';\nimport panelHeaderStyleSheet from './panel-header.css?inline';\nimport panelContentStyleSheet from './panel-content.css?inline';\nimport panelFooterStyleSheet from './panel-footer.css?inline';\n\n/**\n * @element nve-panel-header\n * @description Displays the title, subtitle, and optional action controls at the top of a panel.\n * @documentation https://nvidia.github.io/elements/docs/elements/panel/\n * @since 0.10.0\n * @entrypoint \\@nvidia-elements/core/panel\n * @slot - default content slot\n * @slot title - Title Text\n * @slot subtitle - Subtitle Text\n * @slot action-icon - Extra Action Button\n * @cssprop --padding\n * @cssprop --border-bottom\n * @aria https://www.w3.org/WAI/ARIA/apg/patterns/disclosure/\n * @deprecated use `nve-page-panel-header` with `nve-page-panel` instead\n */\nexport class PanelHeader extends LitElement {\n static styles = useStyles([panelHeaderStyleSheet]);\n\n static readonly metadata = {\n tag: 'nve-panel-header',\n version: '0.0.0'\n };\n\n render() {\n return html`\n <div internal-host>\n <div id=\"titles\">\n <slot name=\"title\"></slot>\n <slot name=\"subtitle\"></slot>\n <slot></slot>\n </div>\n\n <slot name=\"action-icon\"></slot>\n </div>\n `;\n }\n\n connectedCallback() {\n super.connectedCallback(); // Do not override connectedCallback w/out supering\n this.slot = 'header';\n }\n}\n\n/**\n * @element nve-panel-content\n * @description Contains the main body content within a panel, providing a structured region for detailed information.\n * @documentation https://nvidia.github.io/elements/docs/elements/panel/\n * @since 0.10.0\n * @entrypoint \\@nvidia-elements/core/panel\n * @slot - This is a default/unnamed slot for panel content\n * @cssprop --padding\n * @aria https://www.w3.org/WAI/ARIA/apg/patterns/disclosure/\n * @deprecated use `nve-page-panel-content` with `nve-page-panel` instead\n */\nexport class PanelContent extends LitElement {\n static styles = useStyles([panelContentStyleSheet]);\n\n static readonly metadata = {\n tag: 'nve-panel-content',\n version: '0.0.0'\n };\n\n render() {\n return html`\n <slot></slot>\n `;\n }\n}\n\n/**\n * @element nve-panel-footer\n * @description Provides a designated area at the bottom of a panel for actions or supplementary controls.\n * @documentation https://nvidia.github.io/elements/docs/elements/panel/\n * @since 0.10.0\n * @entrypoint \\@nvidia-elements/core/panel\n * @slot - This is a default/unnamed slot for panel footer content\n * @cssprop --padding\n * @cssprop --border-top\n * @cssprop --gap\n * @aria https://www.w3.org/WAI/ARIA/apg/patterns/disclosure/\n * @deprecated use `nve-page-panel-footer` with `nve-page-panel` instead\n */\nexport class PanelFooter extends LitElement {\n static styles = useStyles([panelFooterStyleSheet]);\n\n static readonly metadata = {\n tag: 'nve-panel-footer',\n version: '0.0.0'\n };\n\n render() {\n return html`\n <footer internal-host>\n <slot></slot>\n </footer>\n `;\n }\n\n connectedCallback() {\n super.connectedCallback(); // Do not override connectedCallback w/out supering\n this.slot = 'footer';\n }\n}\n\n/**\n * @element nve-panel\n * @description Panel is inline container for content that couples to the content on the page (details, extra actions/options). Or [Drawer](./docs/elements/drawer/) is out of context of the rest of the page (notifications, navigations, settings).\n * @documentation https://nvidia.github.io/elements/docs/elements/panel/\n * @since 0.10.0\n * @entrypoint \\@nvidia-elements/core/panel\n * @event open - Dispatched when the panel opens.\n * @event close - Dispatched when the panel closes.\n * @slot - This is a default/unnamed slot for panel content\n * @slot header - header element (Use `panel-header` or custom content)\n * @slot content - content element (Use `panel-content` or custom content)\n * @slot footer - footer element (Use `panel-footer` or custom content)\n * @cssprop --background\n * @cssprop --color\n * @cssprop --box-shadow\n * @cssprop --panel-button-border-radius - Border radius of the panel expand/collapse button\n * @csspart icon-button - The expand/collapse icon button element\n * @aria https://www.w3.org/WAI/ARIA/apg/patterns/disclosure/\n * @deprecated use `nve-page-panel` with `nve-page` instead\n */\n\n@scopedRegistry()\n@stateExpanded<Panel>()\nexport class Panel extends LitElement {\n /**\n * Determines whether the panel is fully expanded, displaying its contents, or not.\n */\n @property({ type: Boolean, reflect: true }) expanded = false;\n\n /**\n * Determines whether the panel collapses down to an expand icon, or fully hides.\n */\n @property({ type: Boolean }) closable = false;\n\n /**\n * Determines whether the panel should handle auto-closing behavior vs. defaults to off.\n */\n @property({ type: Boolean, attribute: 'behavior-expand' }) behaviorExpand = false;\n\n /**\n * Sets the proper collapse icon and collapse animation, based on which side of the page the panel occupies.\n */\n @property({ type: String }) side: 'left' | 'right' = 'left';\n\n static styles = useStyles([panelStyleSheet]);\n\n static readonly metadata = {\n tag: 'nve-panel',\n version: '0.0.0'\n };\n\n static elementDefinitions = {\n [IconButton.metadata.tag]: IconButton\n };\n\n /** @private */\n declare _internals: ElementInternals;\n\n #i18nController: I18nController<this> = new I18nController<this>(this);\n #typeExpandableController = new TypeExpandableController(this);\n\n /**\n * Enables updating internal string values for internationalization.\n */\n @property({ type: Object }) i18n = this.#i18nController.i18n;\n\n get #direction() {\n if (this.side === 'left') {\n return this.expanded ? 'left' : 'right';\n } else {\n return this.expanded ? 'right' : 'left';\n }\n }\n\n render() {\n return html`\n <div internal-host>\n <div class=\"header\">\n <slot name=\"header\"></slot>\n\n ${when(\n !this.closable,\n () => html`\n <nve-icon-button part=\"icon-button\" exportparts=\"icon:icon-button-icon\" .container=${this.expanded ? 'flat' : undefined} icon-name=\"double-chevron\"\n @click=${() => this.#typeExpandableController.toggle()}\n .direction=${this.#direction}\n .expanded=${this.expanded}\n .ariaLabel=${this.expanded ? this.i18n.close : this.i18n.expand}\n ></nve-icon-button>\n `,\n () => html`\n <nve-icon-button part=\"icon-button\" exportparts=\"icon:icon-button-icon\" container=\"flat\" icon-name=\"cancel\"\n @click=${() => this.#typeExpandableController.close()}\n .expanded=${this.expanded}\n .ariaLabel=${this.expanded ? this.i18n.hide : this.i18n.show}\n ></nve-icon-button>\n `\n )}\n </div>\n\n <div class=\"content\">\n <slot></slot>\n </div>\n\n <slot name=\"footer\"></slot>\n </div>\n `;\n }\n\n connectedCallback() {\n super.connectedCallback();\n attachInternals(this);\n this._internals.role = 'region';\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAmCA,IAAa,IAAb,cAAiC,EAAW;;EAC1B,KAAA,SAAA,EAAU,CAAC,CAAqB,CAAC;;;EAEtB,KAAA,WAAA;GACzB,KAAK;GACL,SAAS;EACX;;CAEA,SAAS;EACP,OAAO,CAAI;CAWb;CAEA,oBAAoB;EAElB,AADA,MAAM,kBAAkB,GACxB,KAAK,OAAO;CACd;AACF,GAaa,IAAb,cAAkC,EAAW;;EAC3B,KAAA,SAAA,EAAU,CAAC,CAAsB,CAAC;;;EAEvB,K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O;CACzB;AACF;AAvFG,EAAA,CAAA,EAAS;CAAE,MAAM;CAAS,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,YAAA,KAAA,CAAA,GAKzC,EAAA,CAAA,EAAS,EAAE,MAAM,QAAQ,CAAC,CAAA,GAAA,EAAA,WAAA,YAAA,KAAA,CAAA,GAK1B,EAAA,CAAA,EAAS;CAAE,MAAM;CAAS,WAAW;AAAkB,CAAC,CAAA,GAAA,EAAA,WAAA,kBAAA,KAAA,CAAA,GAKxD,EAAA,CAAA,EAAS,EAAE,MAAM,OAAO,CAAC,CAAA,GAAA,EAAA,WAAA,QAAA,KAAA,CAAA,GAsBzB,EAAA,CAAA,EAAS,EAAE,MAAM,OAAO,CAAC,CAAA,GAAA,EAAA,WAAA,QAAA,KAAA,CAAA,GA3C3B,IAAA,EAAA,CAAA,EAAe,GACf,EAAqB,CAAA,GAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"panel2.js","names":[],"sources":["../../src/panel/panel.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { html, LitElement } from 'lit';\nimport { property } from 'lit/decorators/property.js';\nimport { when } from 'lit/directives/when.js';\nimport {\n stateExpanded,\n TypeExpandableController,\n useStyles,\n attachInternals,\n scopedRegistry\n} from '@nvidia-elements/core/internal';\nimport { I18nController, type I18nDefaults } from '@nvidia-elements/foundations/internal/i18n';\nimport { IconButton } from '@nvidia-elements/core/icon-button';\nimport panelStyleSheet from './panel.css?inline';\nimport panelHeaderStyleSheet from './panel-header.css?inline';\nimport panelContentStyleSheet from './panel-content.css?inline';\nimport panelFooterStyleSheet from './panel-footer.css?inline';\n\nconst i18nDefaults = {\n close: 'close',\n expand: 'expand',\n hide: 'hide',\n show: 'show'\n} satisfies I18nDefaults;\n\n/**\n * @element nve-panel-header\n * @description Displays the title, subtitle, and optional action controls at the top of a panel.\n * @documentation https://nvidia.github.io/elements/docs/elements/panel/\n * @since 0.10.0\n * @entrypoint \\@nvidia-elements/core/panel\n * @slot - default content slot\n * @slot title - Title Text\n * @slot subtitle - Subtitle Text\n * @slot action-icon - Extra Action Button\n * @cssprop --padding\n * @cssprop --border-bottom\n * @aria https://www.w3.org/WAI/ARIA/apg/patterns/disclosure/\n * @deprecated use `nve-page-panel-header` with `nve-page-panel` instead\n */\nexport class PanelHeader extends LitElement {\n static styles = useStyles([panelHeaderStyleSheet]);\n\n static readonly metadata = {\n tag: 'nve-panel-header',\n version: '0.0.0'\n };\n\n render() {\n return html`\n <div internal-host>\n <div id=\"titles\">\n <slot name=\"title\"></slot>\n <slot name=\"subtitle\"></slot>\n <slot></slot>\n </div>\n\n <slot name=\"action-icon\"></slot>\n </div>\n `;\n }\n\n connectedCallback() {\n super.connectedCallback(); // Do not override connectedCallback w/out supering\n this.slot = 'header';\n }\n}\n\n/**\n * @element nve-panel-content\n * @description Contains the main body content within a panel, providing a structured region for detailed information.\n * @documentation https://nvidia.github.io/elements/docs/elements/panel/\n * @since 0.10.0\n * @entrypoint \\@nvidia-elements/core/panel\n * @slot - This is a default/unnamed slot for panel content\n * @cssprop --padding\n * @aria https://www.w3.org/WAI/ARIA/apg/patterns/disclosure/\n * @deprecated use `nve-page-panel-content` with `nve-page-panel` instead\n */\nexport class PanelContent extends LitElement {\n static styles = useStyles([panelContentStyleSheet]);\n\n static readonly metadata = {\n tag: 'nve-panel-content',\n version: '0.0.0'\n };\n\n render() {\n return html`\n <slot></slot>\n `;\n }\n}\n\n/**\n * @element nve-panel-footer\n * @description Provides a designated area at the bottom of a panel for actions or supplementary controls.\n * @documentation https://nvidia.github.io/elements/docs/elements/panel/\n * @since 0.10.0\n * @entrypoint \\@nvidia-elements/core/panel\n * @slot - This is a default/unnamed slot for panel footer content\n * @cssprop --padding\n * @cssprop --border-top\n * @cssprop --gap\n * @aria https://www.w3.org/WAI/ARIA/apg/patterns/disclosure/\n * @deprecated use `nve-page-panel-footer` with `nve-page-panel` instead\n */\nexport class PanelFooter extends LitElement {\n static styles = useStyles([panelFooterStyleSheet]);\n\n static readonly metadata = {\n tag: 'nve-panel-footer',\n version: '0.0.0'\n };\n\n render() {\n return html`\n <footer internal-host>\n <slot></slot>\n </footer>\n `;\n }\n\n connectedCallback() {\n super.connectedCallback(); // Do not override connectedCallback w/out supering\n this.slot = 'footer';\n }\n}\n\n/**\n * @element nve-panel\n * @description Panel is inline container for content that couples to the content on the page (details, extra actions/options). Or [Drawer](./docs/elements/drawer/) is out of context of the rest of the page (notifications, navigations, settings).\n * @documentation https://nvidia.github.io/elements/docs/elements/panel/\n * @since 0.10.0\n * @entrypoint \\@nvidia-elements/core/panel\n * @event open - Dispatched when the panel opens.\n * @event close - Dispatched when the panel closes.\n * @slot - This is a default/unnamed slot for panel content\n * @slot header - header element (Use `panel-header` or custom content)\n * @slot content - content element (Use `panel-content` or custom content)\n * @slot footer - footer element (Use `panel-footer` or custom content)\n * @cssprop --background\n * @cssprop --color\n * @cssprop --box-shadow\n * @cssprop --panel-button-border-radius - Border radius of the panel expand/collapse button\n * @csspart icon-button - The expand/collapse icon button element\n * @aria https://www.w3.org/WAI/ARIA/apg/patterns/disclosure/\n * @deprecated use `nve-page-panel` with `nve-page` instead\n */\n\n@scopedRegistry()\n@stateExpanded<Panel>()\nexport class Panel extends LitElement {\n /**\n * Determines whether the panel is fully expanded, displaying its contents, or not.\n */\n @property({ type: Boolean, reflect: true }) expanded = false;\n\n /**\n * Determines whether the panel collapses down to an expand icon, or fully hides.\n */\n @property({ type: Boolean }) closable = false;\n\n /**\n * Determines whether the panel should handle auto-closing behavior vs. defaults to off.\n */\n @property({ type: Boolean, attribute: 'behavior-expand' }) behaviorExpand = false;\n\n /**\n * Sets the proper collapse icon and collapse animation, based on which side of the page the panel occupies.\n */\n @property({ type: String }) side: 'left' | 'right' = 'left';\n\n static styles = useStyles([panelStyleSheet]);\n\n static readonly metadata = {\n tag: 'nve-panel',\n version: '0.0.0'\n };\n\n static elementDefinitions = {\n [IconButton.metadata.tag]: IconButton\n };\n\n /** @private */\n declare _internals: ElementInternals;\n\n #i18nController: I18nController<this> = new I18nController<this>(this, i18nDefaults);\n #typeExpandableController = new TypeExpandableController(this);\n\n /**\n * Enables updating internal string values for internationalization.\n */\n @property({ type: Object }) i18n = this.#i18nController.i18n;\n\n get #direction() {\n if (this.side === 'left') {\n return this.expanded ? 'left' : 'right';\n } else {\n return this.expanded ? 'right' : 'left';\n }\n }\n\n render() {\n return html`\n <div internal-host>\n <div class=\"header\">\n <slot name=\"header\"></slot>\n\n ${when(\n !this.closable,\n () => html`\n <nve-icon-button part=\"icon-button\" exportparts=\"icon:icon-button-icon\" .container=${this.expanded ? 'flat' : undefined} icon-name=\"double-chevron\"\n @click=${() => this.#typeExpandableController.toggle()}\n .direction=${this.#direction}\n .expanded=${this.expanded}\n .ariaLabel=${this.expanded ? this.i18n.close : this.i18n.expand}\n ></nve-icon-button>\n `,\n () => html`\n <nve-icon-button part=\"icon-button\" exportparts=\"icon:icon-button-icon\" container=\"flat\" icon-name=\"cancel\"\n @click=${() => this.#typeExpandableController.close()}\n .expanded=${this.expanded}\n .ariaLabel=${this.expanded ? this.i18n.hide : this.i18n.show}\n ></nve-icon-button>\n `\n )}\n </div>\n\n <div class=\"content\">\n <slot></slot>\n </div>\n\n <slot name=\"footer\"></slot>\n </div>\n `;\n }\n\n connectedCallback() {\n super.connectedCallback();\n attachInternals(this);\n this._internals.role = 'region';\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAoBA,IAAM,IAAe;CACnB,OAAO;CACP,QAAQ;CACR,MAAM;CACN,MAAM;AACR,GAiBa,IAAb,cAAiC,EAAW;;EAC1B,KAAA,SAAA,EAAU,CAAC,CAAqB,CAAC;;;EAEtB,KAAA,WAAA;GACzB,KAAK;GACL,SAAS;EACX;;CAEA,SAAS;EACP,OAAO,CAAI;CAWb;CAEA,oBAAoB;EAElB,AADA,MAAM,kBAAkB,GACxB,K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AAK,qBAGnE,EAAE;CAUV;CAEA,oBAAoB;EAGlB,AAFA,MAAM,kBAAkB,GACxB,EAAgB,IAAI,GACpB,KAAK,WAAW,OAAO;CACzB;AACF;AAvFG,EAAA,CAAA,EAAS;CAAE,MAAM;CAAS,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,YAAA,KAAA,CAAA,GAKzC,EAAA,CAAA,EAAS,EAAE,MAAM,QAAQ,CAAC,CAAA,GAAA,EAAA,WAAA,YAAA,KAAA,CAAA,GAK1B,EAAA,CAAA,EAAS;CAAE,MAAM;CAAS,WAAW;AAAkB,CAAC,CAAA,GAAA,EAAA,WAAA,kBAAA,KAAA,CAAA,GAKxD,EAAA,CAAA,EAAS,EAAE,MAAM,OAAO,CAAC,CAAA,GAAA,EAAA,WAAA,QAAA,KAAA,CAAA,GAsBzB,EAAA,CAAA,EAAS,EAAE,MAAM,OAAO,CAAC,CAAA,GAAA,EAAA,WAAA,QAAA,KAAA,CAAA,GA3C3B,IAAA,EAAA,CAAA,EAAe,GACf,EAAqB,CAAA,GAAA,CAAA"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ContainerElement } from '@nvidia-elements/core/internal';
|
|
2
2
|
import { Control } from '@nvidia-elements/core/forms';
|
|
3
3
|
import { IconButton } from '@nvidia-elements/core/icon-button';
|
|
4
|
+
import type { I18nDefaults } from '@nvidia-elements/foundations/internal/i18n';
|
|
4
5
|
/**
|
|
5
6
|
* @element nve-password
|
|
6
7
|
* @description A password is a control that enables users to enter password text.
|
|
@@ -19,6 +20,7 @@ import { IconButton } from '@nvidia-elements/core/icon-button';
|
|
|
19
20
|
*/
|
|
20
21
|
export declare class Password extends Control implements ContainerElement {
|
|
21
22
|
#private;
|
|
23
|
+
protected get i18nDefaults(): I18nDefaults;
|
|
22
24
|
/**
|
|
23
25
|
* Reduces the visual container for a minimal borderless appearance while preserving whitespace bounds.
|
|
24
26
|
* Use when embedding within another container such as a toolbar.
|
|
@@ -9,10 +9,16 @@ import { html as s } from "lit";
|
|
|
9
9
|
import { property as c } from "lit/decorators/property.js";
|
|
10
10
|
import { state as l } from "lit/decorators/state.js";
|
|
11
11
|
//#region src/password/password.ts
|
|
12
|
-
var u =
|
|
12
|
+
var u = {
|
|
13
|
+
hide: "hide",
|
|
14
|
+
show: "show"
|
|
15
|
+
}, d = class extends r {
|
|
13
16
|
constructor(...e) {
|
|
14
17
|
super(...e), this.pressed = !1;
|
|
15
18
|
}
|
|
19
|
+
get i18nDefaults() {
|
|
20
|
+
return u;
|
|
21
|
+
}
|
|
16
22
|
static {
|
|
17
23
|
this.styles = t([
|
|
18
24
|
...r.styles,
|
|
@@ -23,7 +29,7 @@ var u = class extends r {
|
|
|
23
29
|
static {
|
|
24
30
|
this.metadata = {
|
|
25
31
|
tag: "nve-password",
|
|
26
|
-
version: "2.
|
|
32
|
+
version: "2.20.0"
|
|
27
33
|
};
|
|
28
34
|
}
|
|
29
35
|
static {
|
|
@@ -39,8 +45,8 @@ var u = class extends r {
|
|
|
39
45
|
n([c({
|
|
40
46
|
type: String,
|
|
41
47
|
reflect: !0
|
|
42
|
-
})],
|
|
48
|
+
})], d.prototype, "container", void 0), n([l()], d.prototype, "pressed", void 0), d = n([e()], d);
|
|
43
49
|
//#endregion
|
|
44
|
-
export {
|
|
50
|
+
export { d as Password };
|
|
45
51
|
|
|
46
52
|
//# sourceMappingURL=password2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"password2.js","names":[],"sources":["../../src/password/password.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { html } from 'lit';\nimport { state } from 'lit/decorators/state.js';\nimport { property } from 'lit/decorators/property.js';\nimport type { ContainerElement } from '@nvidia-elements/core/internal';\nimport { scopedRegistry, useStyles } from '@nvidia-elements/core/internal';\nimport { Control } from '@nvidia-elements/core/forms';\nimport { inputStyles } from '@nvidia-elements/core/input';\nimport { IconButton } from '@nvidia-elements/core/icon-button';\nimport styles from './password.css?inline';\n\n/**\n * @element nve-password\n * @description A password is a control that enables users to enter password text.\n * @documentation https://nvidia.github.io/elements/docs/elements/password/\n * @since 0.3.0\n * @entrypoint \\@nvidia-elements/core/password\n * @cssprop --padding\n * @cssprop --font-size\n * @cssprop --height\n * @cssprop --background\n * @cssprop --border-radius\n * @cssprop --border\n * @cssprop --cursor\n * @csspart icon-button - The visibility toggle icon button element\n * @aria https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/password\n */\n@scopedRegistry()\nexport class Password extends Control implements ContainerElement {\n /**\n * Reduces the visual container for a minimal borderless appearance while preserving whitespace bounds.\n * Use when embedding within another container such as a toolbar.\n */\n @property({ type: String, reflect: true }) container?: 'flat';\n\n @state() private pressed = false;\n\n static styles = useStyles([...Control.styles, inputStyles, styles]);\n\n static readonly metadata = {\n tag: 'nve-password',\n version: '0.0.0'\n };\n\n static elementDefinitions = {\n [IconButton.metadata.tag]: IconButton\n };\n\n protected get suffixContent() {\n return html`<nve-icon-button part=\"icon-button\" @click=${() => this.#toggleVisibility()} .pressed=${this.pressed} .iconName=${this.pressed ? 'eye-hidden' : 'eye'} container=\"inline\" .ariaLabel=${this.pressed ? this.i18n.hide : this.i18n.show}></nve-icon-button>`;\n }\n\n #toggleVisibility() {\n this.pressed = !this.pressed;\n this.input.type = this.pressed ? 'text' : 'password';\n }\n}\n"],"mappings":";;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"password2.js","names":[],"sources":["../../src/password/password.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { html } from 'lit';\nimport { state } from 'lit/decorators/state.js';\nimport { property } from 'lit/decorators/property.js';\nimport type { ContainerElement } from '@nvidia-elements/core/internal';\nimport { scopedRegistry, useStyles } from '@nvidia-elements/core/internal';\nimport { Control } from '@nvidia-elements/core/forms';\nimport { inputStyles } from '@nvidia-elements/core/input';\nimport { IconButton } from '@nvidia-elements/core/icon-button';\nimport type { I18nDefaults } from '@nvidia-elements/foundations/internal/i18n';\nimport styles from './password.css?inline';\n\nconst i18nDefaults = {\n hide: 'hide',\n show: 'show'\n} satisfies I18nDefaults;\n\n/**\n * @element nve-password\n * @description A password is a control that enables users to enter password text.\n * @documentation https://nvidia.github.io/elements/docs/elements/password/\n * @since 0.3.0\n * @entrypoint \\@nvidia-elements/core/password\n * @cssprop --padding\n * @cssprop --font-size\n * @cssprop --height\n * @cssprop --background\n * @cssprop --border-radius\n * @cssprop --border\n * @cssprop --cursor\n * @csspart icon-button - The visibility toggle icon button element\n * @aria https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/password\n */\n@scopedRegistry()\nexport class Password extends Control implements ContainerElement {\n protected override get i18nDefaults(): I18nDefaults {\n return i18nDefaults;\n }\n\n /**\n * Reduces the visual container for a minimal borderless appearance while preserving whitespace bounds.\n * Use when embedding within another container such as a toolbar.\n */\n @property({ type: String, reflect: true }) container?: 'flat';\n\n @state() private pressed = false;\n\n static styles = useStyles([...Control.styles, inputStyles, styles]);\n\n static readonly metadata = {\n tag: 'nve-password',\n version: '0.0.0'\n };\n\n static elementDefinitions = {\n [IconButton.metadata.tag]: IconButton\n };\n\n protected get suffixContent() {\n return html`<nve-icon-button part=\"icon-button\" @click=${() => this.#toggleVisibility()} .pressed=${this.pressed} .iconName=${this.pressed ? 'eye-hidden' : 'eye'} container=\"inline\" .ariaLabel=${this.pressed ? this.i18n.hide : this.i18n.show}></nve-icon-button>`;\n }\n\n #toggleVisibility() {\n this.pressed = !this.pressed;\n this.input.type = this.pressed ? 'text' : 'password';\n }\n}\n"],"mappings":";;;;;;;;;;;AAcA,IAAM,IAAe;CACnB,MAAM;CACN,MAAM;AACR,GAmBa,IAAN,cAAuB,EAAoC;;EAWrC,aAAA,KAAA,UAAA;;CAV3B,IAAuB,eAA6B;EAClD,OAAO;CACT;;EAUgB,KAAA,SAAA,EAAU;GAAC,GAAG,EAAQ;GAAQ;GAAa;EAAM,CAAC;;;EAEvC,KAAA,WAAA;GACzB,KAAK;GACL,SAAS;EACX;;;EAE4B,KAAA,qBAAA,GACzB,EAAW,SAAS,MAAM,EAC7B;;CAEA,IAAc,gBAAgB;EAC5B,OAAO,CAAI,qDAAoD,KAAK,GAAkB,EAAE,cAAY,KAAK,QAAQ,eAAa,KAAK,UAAU,eAAe,MAAM,mCAAiC,KAAK,UAAU,KAAK,KAAK,OAAO,KAAK,KAAK,KAAK;CACpP;CAEA,KAAoB;EAElB,AADA,KAAK,UAAU,CAAC,KAAK,SACrB,KAAK,MAAM,OAAO,KAAK,UAAU,SAAS;CAC5C;AACF;AAvBG,EAAA,CAAA,EAAS;CAAE,MAAM;CAAQ,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,aAAA,KAAA,CAAA,GAExC,EAAA,CAAA,EAAM,CAAA,GAAA,EAAA,WAAA,WAAA,KAAA,CAAA,GAZR,IAAA,EAAA,CAAA,EAAe,CAAA,GAAA,CAAA"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import r from "../
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import u from "
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
1
|
+
import { scopedRegistry as e } from "../internal/decorators/scoped-registry.js";
|
|
2
|
+
import { useStyles as t } from "../internal/styles/index.js";
|
|
3
|
+
import n from "../_virtual/_@oxc-project_runtime@0.147.0/helpers/esm/decorate.js";
|
|
4
|
+
import { Icon as r } from "../icon/icon2.js";
|
|
5
|
+
import { Control as i } from "../forms/control/control2.js";
|
|
6
|
+
import { Switch as a } from "../switch/switch2.js";
|
|
7
|
+
import { Menu as o } from "../menu/menu2.js";
|
|
8
|
+
import { MenuItem as s } from "../menu/menu-item2.js";
|
|
9
|
+
import { Divider as c } from "../divider/divider2.js";
|
|
10
|
+
import l from "./preferences-input.js";
|
|
11
|
+
import { LitElement as u, html as d, isServer as f } from "lit";
|
|
12
|
+
import { property as p } from "lit/decorators/property.js";
|
|
13
|
+
import { I18nController as m } from "@nvidia-elements/foundations/internal/i18n";
|
|
14
14
|
import { state as h } from "lit/decorators/state.js";
|
|
15
15
|
import { FormControlMixin as g } from "@nvidia-elements/forms/mixins";
|
|
16
16
|
//#region src/preferences-input/preferences-input.ts
|
|
@@ -20,12 +20,17 @@ var _ = [
|
|
|
20
20
|
"dark",
|
|
21
21
|
"high-contrast"
|
|
22
22
|
], v = ["default", "compact"], y = {
|
|
23
|
+
theme: "theme",
|
|
24
|
+
scale: "scale",
|
|
25
|
+
reducedMotion: "reduced motion",
|
|
26
|
+
colorScheme: "color scheme"
|
|
27
|
+
}, b = {
|
|
23
28
|
auto: "computer",
|
|
24
29
|
light: "sun",
|
|
25
30
|
dark: "moon",
|
|
26
31
|
"high-contrast": "circle-half"
|
|
27
32
|
};
|
|
28
|
-
function
|
|
33
|
+
function x(e = globalThis.document.documentElement) {
|
|
29
34
|
let t = getComputedStyle(e);
|
|
30
35
|
return {
|
|
31
36
|
light: t.getPropertyValue("--nve-config-color-scheme-light") === "true",
|
|
@@ -35,15 +40,15 @@ function b(e = globalThis.document.documentElement) {
|
|
|
35
40
|
"reduced-motion": t.getPropertyValue("--nve-config-reduced-motion") === "true"
|
|
36
41
|
};
|
|
37
42
|
}
|
|
38
|
-
var
|
|
43
|
+
var S = class extends g(u) {
|
|
39
44
|
#e;
|
|
40
45
|
static {
|
|
41
|
-
this.styles =
|
|
46
|
+
this.styles = t([l]);
|
|
42
47
|
}
|
|
43
48
|
static {
|
|
44
49
|
this.metadata = {
|
|
45
50
|
tag: "nve-preferences-input",
|
|
46
|
-
version: "2.
|
|
51
|
+
version: "2.20.0",
|
|
47
52
|
valueSchema: {
|
|
48
53
|
type: "object",
|
|
49
54
|
properties: {
|
|
@@ -56,19 +61,19 @@ var x = class extends g(d) {
|
|
|
56
61
|
}
|
|
57
62
|
static {
|
|
58
63
|
this.elementDefinitions = {
|
|
59
|
-
[a.metadata.tag]: a,
|
|
60
|
-
[l.metadata.tag]: l,
|
|
61
64
|
[i.metadata.tag]: i,
|
|
62
|
-
[s.metadata.tag]: s,
|
|
63
65
|
[c.metadata.tag]: c,
|
|
64
|
-
[
|
|
66
|
+
[r.metadata.tag]: r,
|
|
67
|
+
[o.metadata.tag]: o,
|
|
68
|
+
[s.metadata.tag]: s,
|
|
69
|
+
[a.metadata.tag]: a
|
|
65
70
|
};
|
|
66
71
|
}
|
|
67
72
|
render() {
|
|
68
|
-
return
|
|
73
|
+
return d`<div internal-host><nve-control part="control"><label>${this.i18n.colorScheme}</label><nve-menu part="menu" nve-control>${_.map((e) => d`<nve-menu-item part="menu-item" .selected="${this.value?.["color-scheme"] === e}" .value="${e}" @click="${() => this.#n(e)}"><nve-icon part="icon" name="${b[e]}"></nve-icon>${e}</nve-menu-item>`)}</nve-menu></nve-control>${this.activePreferences.compact ? d`<nve-divider part="divider"></nve-divider><nve-control part="control"><label>${this.i18n.scale}</label><nve-menu part="menu" nve-control>${v.map((e) => d`<nve-menu-item part="menu-item" .selected="${this.value?.scale === e}" .value="${e}" @click="${() => this.#r(e)}">${e}</nve-menu-item>`)}</nve-menu></nve-control>` : ""} ${this.activePreferences["reduced-motion"] ? d`<nve-divider part="divider"></nve-divider><nve-switch part="switch"><label>${this.i18n.reducedMotion}</label> <input type="checkbox" value="reduced-motion" .checked="${this.value?.["reduced-motion"]}" @change="${(e) => this.#i(e.target.checked)}"></nve-switch>` : ""}</div>`;
|
|
69
74
|
}
|
|
70
75
|
constructor() {
|
|
71
|
-
super(), this.#e = new
|
|
76
|
+
super(), this.#e = new m(this, y), this.i18n = this.#e.i18n, this.activePreferences = {
|
|
72
77
|
light: !1,
|
|
73
78
|
dark: !1,
|
|
74
79
|
"high-contrast": !1,
|
|
@@ -91,8 +96,8 @@ var x = class extends g(d) {
|
|
|
91
96
|
}
|
|
92
97
|
#t() {
|
|
93
98
|
/* istanbul ignore else -- Lit SSR mode is not reachable in browser unit tests. */
|
|
94
|
-
if (!
|
|
95
|
-
let e =
|
|
99
|
+
if (!f) {
|
|
100
|
+
let e = x();
|
|
96
101
|
JSON.stringify(this.activePreferences) !== JSON.stringify(e) && (this.activePreferences = e);
|
|
97
102
|
}
|
|
98
103
|
}
|
|
@@ -118,8 +123,8 @@ var x = class extends g(d) {
|
|
|
118
123
|
this.dispatchInputEvent(), this.dispatchChangeEvent();
|
|
119
124
|
}
|
|
120
125
|
};
|
|
121
|
-
|
|
126
|
+
n([p({ type: Object })], S.prototype, "i18n", void 0), n([h()], S.prototype, "activePreferences", void 0), S = n([e()], S);
|
|
122
127
|
//#endregion
|
|
123
|
-
export {
|
|
128
|
+
export { S as PreferencesInput };
|
|
124
129
|
|
|
125
130
|
//# sourceMappingURL=preferences-input2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preferences-input2.js","names":[],"sources":["../../src/preferences-input/preferences-input.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { html, isServer, LitElement } from 'lit';\nimport { property } from 'lit/decorators/property.js';\nimport { I18nController, scopedRegistry, useStyles } from '@nvidia-elements/core/internal';\nimport { state } from 'lit/decorators/state.js';\nimport { FormControlMixin } from '@nvidia-elements/forms/mixins';\nimport { type IconName, Icon } from '@nvidia-elements/core/icon';\nimport { Control } from '@nvidia-elements/core/forms';\nimport { Divider } from '@nvidia-elements/core/divider';\nimport { Menu, MenuItem } from '@nvidia-elements/core/menu';\nimport { Switch } from '@nvidia-elements/core/switch';\nimport styles from './preferences-input.css?inline';\n\n/* eslint-disable jsdoc/no-types */\n// Explicit JSDoc types because the CEM analyzer loses the inherited generic specialization.\n\nexport type ColorScheme = 'auto' | 'light' | 'dark' | 'high-contrast';\nexport type Scale = 'default' | 'compact' | 'relaxed';\nexport type Variant = 'reduced-motion';\n\nconst colorSchemes: ColorScheme[] = ['auto', 'light', 'dark', 'high-contrast'];\nconst scales: Scale[] = ['default', 'compact'];\nconst colorSchemesIcons = {\n auto: 'computer',\n light: 'sun',\n dark: 'moon',\n 'high-contrast': 'circle-half'\n} satisfies Record<ColorScheme, IconName>;\n\nfunction getActivePreferences(element = globalThis.document.documentElement) {\n const computedStyle = getComputedStyle(element);\n\n return {\n light: computedStyle.getPropertyValue('--nve-config-color-scheme-light') === 'true',\n dark: computedStyle.getPropertyValue('--nve-config-color-scheme-dark') === 'true',\n 'high-contrast': computedStyle.getPropertyValue('--nve-config-color-scheme-high-contrast') === 'true',\n compact: computedStyle.getPropertyValue('--nve-config-scale-compact') === 'true',\n 'reduced-motion': computedStyle.getPropertyValue('--nve-config-reduced-motion') === 'true'\n } satisfies Partial<Record<ColorScheme | Scale | Variant, boolean>>;\n}\n\nexport interface PreferencesInputValue {\n 'color-scheme'?: ColorScheme | string;\n scale?: Scale | string;\n 'reduced-motion'?: boolean;\n}\n\n/**\n * @element nve-preferences-input\n * @description A preferences input is a widget for controlling apperance. Stylesheets register to the preferences input by including a css-property, see Standard for an example.\n * @documentation https://nvidia.github.io/elements/docs/elements/preferences-input/\n * @since 1.23.7\n * @entrypoint \\@nvidia-elements/core/preferences-input\n * @property {PreferencesInputValue} value - Contains the current color scheme, scale, and reduced motion preferences. Assign an object through JavaScript or provide its JSON serialization in the HTML `value` attribute.\n * @attribute {string} value - JSON object parsed as `PreferencesInputValue`.\n * @event input - Dispatched when the value has changed\n * @event change - Dispatched when the value has changed\n * @cssprop --color\n * @cssprop --width\n * @csspart control - The control wrapper elements that contain the labels and menus\n * @csspart menu - The menu elements that display color scheme and scale options\n * @csspart menu-item - The individual menu item elements for each selectable option\n * @csspart icon - The icon element displayed next to color scheme options\n * @csspart divider - The divider elements that separate preference sections\n * @csspart switch - The switch element for the reduced motion toggle\n *\n * @aria https://www.w3.org/WAI/ARIA/apg/patterns/listbox/\n *\n */\n@scopedRegistry()\nexport class PreferencesInput extends FormControlMixin<typeof LitElement, PreferencesInputValue>(LitElement) {\n #i18nController: I18nController<this> = new I18nController<this>(this);\n\n /**\n * Enables updating internal string values for internationalization.\n */\n @property({ type: Object }) i18n = this.#i18nController.i18n;\n\n static styles = useStyles([styles]);\n\n static readonly metadata = {\n tag: 'nve-preferences-input',\n version: '0.0.0',\n valueSchema: {\n type: 'object' as const,\n properties: {\n 'color-scheme': { type: 'string' as const },\n scale: { type: 'string' as const },\n 'reduced-motion': { type: 'boolean' as const }\n }\n }\n };\n\n static elementDefinitions = {\n [Control.metadata.tag]: Control,\n [Divider.metadata.tag]: Divider,\n [Icon.metadata.tag]: Icon,\n [Menu.metadata.tag]: Menu,\n [MenuItem.metadata.tag]: MenuItem,\n [Switch.metadata.tag]: Switch\n };\n\n @state() private activePreferences: ReturnType<typeof getActivePreferences> = {\n light: false,\n dark: false,\n 'high-contrast': false,\n compact: false,\n 'reduced-motion': false\n };\n\n // eslint-disable-next-line max-lines-per-function\n render() {\n return html`\n <div internal-host>\n <nve-control part=\"control\">\n <label>${this.i18n.colorScheme}</label>\n <nve-menu part=\"menu\" nve-control>\n ${colorSchemes.map(\n value => html`\n <nve-menu-item part=\"menu-item\"\n .selected=${this.value?.['color-scheme'] === value}\n .value=${value}\n @click=${() => this.#setColorScheme(value)}\n >\n <nve-icon part=\"icon\" name=${colorSchemesIcons[value]}></nve-icon> ${value}\n </nve-menu-item>\n `\n )}\n </nve-menu>\n </nve-control>\n ${\n this.activePreferences['compact']\n ? html`\n <nve-divider part=\"divider\"></nve-divider>\n <nve-control part=\"control\">\n <label>${this.i18n.scale}</label>\n <nve-menu part=\"menu\" nve-control>\n ${scales.map(\n value => html`\n <nve-menu-item part=\"menu-item\"\n .selected=${this.value?.['scale'] === value}\n .value=${value}\n @click=${() => this.#setScale(value)}\n >\n ${value}\n </nve-menu-item>\n `\n )}\n </nve-menu>\n </nve-control>\n `\n : ''\n }\n ${\n this.activePreferences['reduced-motion']\n ? html`\n <nve-divider part=\"divider\"></nve-divider>\n <nve-switch part=\"switch\">\n <label>${this.i18n.reducedMotion}</label>\n <input\n type=\"checkbox\"\n value=\"reduced-motion\"\n .checked=${this.value?.['reduced-motion']}\n @change=${(e: { target: HTMLInputElement }) => this.#setReducedMotion(e.target.checked)}\n />\n </nve-switch>`\n : ''\n }\n </div>\n `;\n }\n\n constructor() {\n super();\n this.value = {\n 'color-scheme': 'auto',\n 'reduced-motion': false,\n scale: 'default'\n };\n }\n\n connectedCallback() {\n super.connectedCallback();\n this.setAttribute('nve-control', '');\n this.#updatePreferences();\n }\n\n /** @private */\n updateValue(value: PreferencesInputValue) {\n super.updateValue({ ...this.value, ...value });\n this.#updatePreferences();\n }\n\n #updatePreferences() {\n /* istanbul ignore else -- Lit SSR mode is not reachable in browser unit tests. */\n if (!isServer) {\n const preferences = getActivePreferences();\n if (JSON.stringify(this.activePreferences) !== JSON.stringify(preferences)) {\n this.activePreferences = preferences;\n }\n }\n }\n\n #setColorScheme(value: ColorScheme) {\n this.value = { ...this.value, 'color-scheme': value };\n this.#update();\n }\n\n #setScale(value: Scale) {\n this.value = { ...this.value, scale: value };\n this.#update();\n }\n\n #setReducedMotion(value: boolean) {\n this.value = { ...this.value, 'reduced-motion': value };\n this.#update();\n }\n\n #update() {\n this.dispatchInputEvent();\n this.dispatchChangeEvent();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAsBA,IAAM,IAA8B;CAAC;CAAQ;CAAS;CAAQ;AAAe,GACvE,IAAkB,CAAC,WAAW,SAAS,GACvC,IAAoB;CACxB,MAAM;CACN,OAAO;CACP,MAAM;CACN,iBAAiB;AACnB;AAEA,SAAS,EAAqB,IAAU,WAAW,SAAS,iBAAiB;CAC3E,IAAM,IAAgB,iBAAiB,CAAO;CAE9C,OAAO;EACL,OAAO,EAAc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AAe,CAAA,GAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"preferences-input2.js","names":[],"sources":["../../src/preferences-input/preferences-input.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { html, isServer, LitElement } from 'lit';\nimport { property } from 'lit/decorators/property.js';\nimport { scopedRegistry, useStyles } from '@nvidia-elements/core/internal';\nimport { I18nController, type I18nDefaults } from '@nvidia-elements/foundations/internal/i18n';\nimport { state } from 'lit/decorators/state.js';\nimport { FormControlMixin } from '@nvidia-elements/forms/mixins';\nimport { type IconName, Icon } from '@nvidia-elements/core/icon';\nimport { Control } from '@nvidia-elements/core/forms';\nimport { Divider } from '@nvidia-elements/core/divider';\nimport { Menu, MenuItem } from '@nvidia-elements/core/menu';\nimport { Switch } from '@nvidia-elements/core/switch';\nimport styles from './preferences-input.css?inline';\n\n/* eslint-disable jsdoc/no-types */\n// Explicit JSDoc types because the CEM analyzer loses the inherited generic specialization.\n\nexport type ColorScheme = 'auto' | 'light' | 'dark' | 'high-contrast';\nexport type Scale = 'default' | 'compact' | 'relaxed';\nexport type Variant = 'reduced-motion';\n\nconst colorSchemes: ColorScheme[] = ['auto', 'light', 'dark', 'high-contrast'];\nconst scales: Scale[] = ['default', 'compact'];\nconst i18nDefaults = {\n theme: 'theme',\n scale: 'scale',\n reducedMotion: 'reduced motion',\n colorScheme: 'color scheme'\n} satisfies I18nDefaults;\nconst colorSchemesIcons = {\n auto: 'computer',\n light: 'sun',\n dark: 'moon',\n 'high-contrast': 'circle-half'\n} satisfies Record<ColorScheme, IconName>;\n\nfunction getActivePreferences(element = globalThis.document.documentElement) {\n const computedStyle = getComputedStyle(element);\n\n return {\n light: computedStyle.getPropertyValue('--nve-config-color-scheme-light') === 'true',\n dark: computedStyle.getPropertyValue('--nve-config-color-scheme-dark') === 'true',\n 'high-contrast': computedStyle.getPropertyValue('--nve-config-color-scheme-high-contrast') === 'true',\n compact: computedStyle.getPropertyValue('--nve-config-scale-compact') === 'true',\n 'reduced-motion': computedStyle.getPropertyValue('--nve-config-reduced-motion') === 'true'\n } satisfies Partial<Record<ColorScheme | Scale | Variant, boolean>>;\n}\n\nexport interface PreferencesInputValue {\n 'color-scheme'?: ColorScheme | string;\n scale?: Scale | string;\n 'reduced-motion'?: boolean;\n}\n\n/**\n * @element nve-preferences-input\n * @description A preferences input is a widget for controlling apperance. Stylesheets register to the preferences input by including a css-property, see Standard for an example.\n * @documentation https://nvidia.github.io/elements/docs/elements/preferences-input/\n * @since 1.23.7\n * @entrypoint \\@nvidia-elements/core/preferences-input\n * @property {PreferencesInputValue} value - Contains the current color scheme, scale, and reduced motion preferences. Assign an object through JavaScript or provide its JSON serialization in the HTML `value` attribute.\n * @attribute {string} value - JSON object parsed as `PreferencesInputValue`.\n * @event input - Dispatched when the value has changed\n * @event change - Dispatched when the value has changed\n * @cssprop --color\n * @cssprop --width\n * @csspart control - The control wrapper elements that contain the labels and menus\n * @csspart menu - The menu elements that display color scheme and scale options\n * @csspart menu-item - The individual menu item elements for each selectable option\n * @csspart icon - The icon element displayed next to color scheme options\n * @csspart divider - The divider elements that separate preference sections\n * @csspart switch - The switch element for the reduced motion toggle\n *\n * @aria https://www.w3.org/WAI/ARIA/apg/patterns/listbox/\n *\n */\n@scopedRegistry()\nexport class PreferencesInput extends FormControlMixin<typeof LitElement, PreferencesInputValue>(LitElement) {\n #i18nController: I18nController<this> = new I18nController<this>(this, i18nDefaults);\n\n /**\n * Enables updating internal string values for internationalization.\n */\n @property({ type: Object }) i18n = this.#i18nController.i18n;\n\n static styles = useStyles([styles]);\n\n static readonly metadata = {\n tag: 'nve-preferences-input',\n version: '0.0.0',\n valueSchema: {\n type: 'object' as const,\n properties: {\n 'color-scheme': { type: 'string' as const },\n scale: { type: 'string' as const },\n 'reduced-motion': { type: 'boolean' as const }\n }\n }\n };\n\n static elementDefinitions = {\n [Control.metadata.tag]: Control,\n [Divider.metadata.tag]: Divider,\n [Icon.metadata.tag]: Icon,\n [Menu.metadata.tag]: Menu,\n [MenuItem.metadata.tag]: MenuItem,\n [Switch.metadata.tag]: Switch\n };\n\n @state() private activePreferences: ReturnType<typeof getActivePreferences> = {\n light: false,\n dark: false,\n 'high-contrast': false,\n compact: false,\n 'reduced-motion': false\n };\n\n // eslint-disable-next-line max-lines-per-function\n render() {\n return html`\n <div internal-host>\n <nve-control part=\"control\">\n <label>${this.i18n.colorScheme}</label>\n <nve-menu part=\"menu\" nve-control>\n ${colorSchemes.map(\n value => html`\n <nve-menu-item part=\"menu-item\"\n .selected=${this.value?.['color-scheme'] === value}\n .value=${value}\n @click=${() => this.#setColorScheme(value)}\n >\n <nve-icon part=\"icon\" name=${colorSchemesIcons[value]}></nve-icon> ${value}\n </nve-menu-item>\n `\n )}\n </nve-menu>\n </nve-control>\n ${\n this.activePreferences['compact']\n ? html`\n <nve-divider part=\"divider\"></nve-divider>\n <nve-control part=\"control\">\n <label>${this.i18n.scale}</label>\n <nve-menu part=\"menu\" nve-control>\n ${scales.map(\n value => html`\n <nve-menu-item part=\"menu-item\"\n .selected=${this.value?.['scale'] === value}\n .value=${value}\n @click=${() => this.#setScale(value)}\n >\n ${value}\n </nve-menu-item>\n `\n )}\n </nve-menu>\n </nve-control>\n `\n : ''\n }\n ${\n this.activePreferences['reduced-motion']\n ? html`\n <nve-divider part=\"divider\"></nve-divider>\n <nve-switch part=\"switch\">\n <label>${this.i18n.reducedMotion}</label>\n <input\n type=\"checkbox\"\n value=\"reduced-motion\"\n .checked=${this.value?.['reduced-motion']}\n @change=${(e: { target: HTMLInputElement }) => this.#setReducedMotion(e.target.checked)}\n />\n </nve-switch>`\n : ''\n }\n </div>\n `;\n }\n\n constructor() {\n super();\n this.value = {\n 'color-scheme': 'auto',\n 'reduced-motion': false,\n scale: 'default'\n };\n }\n\n connectedCallback() {\n super.connectedCallback();\n this.setAttribute('nve-control', '');\n this.#updatePreferences();\n }\n\n /** @private */\n updateValue(value: PreferencesInputValue) {\n super.updateValue({ ...this.value, ...value });\n this.#updatePreferences();\n }\n\n #updatePreferences() {\n /* istanbul ignore else -- Lit SSR mode is not reachable in browser unit tests. */\n if (!isServer) {\n const preferences = getActivePreferences();\n if (JSON.stringify(this.activePreferences) !== JSON.stringify(preferences)) {\n this.activePreferences = preferences;\n }\n }\n }\n\n #setColorScheme(value: ColorScheme) {\n this.value = { ...this.value, 'color-scheme': value };\n this.#update();\n }\n\n #setScale(value: Scale) {\n this.value = { ...this.value, scale: value };\n this.#update();\n }\n\n #setReducedMotion(value: boolean) {\n this.value = { ...this.value, 'reduced-motion': value };\n this.#update();\n }\n\n #update() {\n this.dispatchInputEvent();\n this.dispatchChangeEvent();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAuBA,IAAM,IAA8B;CAAC;CAAQ;CAAS;CAAQ;AAAe,GACvE,IAAkB,CAAC,WAAW,SAAS,GACvC,IAAe;CACnB,OAAO;CACP,OAAO;CACP,eAAe;CACf,aAAa;AACf,GACM,IAAoB;CACxB,MAAM;CACN,OAAO;CACP,MAAM;CACN,iBAAiB;AACnB;AAEA,SAAS,EAAqB,IAAU,WAAW,SAAS,iBAAiB;CAC3E,IAAM,IAAgB,iBAAiB,CAAO;CAE9C,OAAO;EACL,OAAO,EAAc,iBAAiB,iCAAiC,MAAM;EAC7E,MAAM,EAAc,iBAAiB,gCAAgC,MAAM;EAC3E,iBAAiB,EAAc,iBAAiB,yCAAyC,MAAM;EAC/F,SAAS,EAAc,iBAAiB,4BAA4B,MAAM;EAC1E,kBAAkB,EAAc,iBAAiB,6BAA6B,MAAM;CACtF;AACF;AA+BO,IAAM,IAAN,cAA+B,EAA2D,CAAU,CAAC,CAAC;CAC3G;;EAOgB,KAAA,SAAA,EAAU,CAAC,CAAM,CAAC;;;EAEP,KAAA,WAAA;GACzB,KAAK;GACL,SAAS;GACT,aAAa;IACX,MAAM;IACN,YAAY;KACV,gBAAgB,EAAE,MAAM,SA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,AADA,MAAM,YAAY;GAAE,GAAG,KAAK;GAAO,GAAG;EAAM,CAAC,GAC7C,KAAK,GAAmB;CAC1B;CAEA,KAAqB;;EAEnB,IAAI,CAAC,GAAU;GACb,IAAM,IAAc,EAAqB;GACzC,AAAI,KAAK,UAAU,KAAK,iBAAiB,MAAM,KAAK,UAAU,CAAW,MACvE,KAAK,oBAAoB;EAE7B;CACF;CAEA,GAAgB,GAAoB;EAElC,AADA,KAAK,QAAQ;GAAE,GAAG,KAAK;GAAO,gBAAgB;EAAM,GACpD,KAAK,GAAQ;CACf;CAEA,GAAU,GAAc;EAEtB,AADA,KAAK,QAAQ;GAAE,GAAG,KAAK;GAAO,OAAO;EAAM,GAC3C,KAAK,GAAQ;CACf;CAEA,GAAkB,GAAgB;EAEhC,AADA,KAAK,QAAQ;GAAE,GAAG,KAAK;GAAO,kBAAkB;EAAM,GACtD,KAAK,GAAQ;CACf;CAEA,KAAU;EAER,AADA,KAAK,mBAAmB,GACxB,KAAK,oBAAoB;CAC3B;AACF;AAlJG,EAAA,CAAA,EAAS,EAAE,MAAM,OAAO,CAAC,CAAA,GAAA,EAAA,WAAA,QAAA,KAAA,CAAA,GA0BzB,EAAA,CAAA,EAAM,CAAA,GAAA,EAAA,WAAA,qBAAA,KAAA,CAAA,GAjCR,IAAA,EAAA,CAAA,EAAe,CAAA,GAAA,CAAA"}
|
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import r from "
|
|
5
|
-
import i from "
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
1
|
+
import { attachInternals as e } from "../internal/utils/a11y.js";
|
|
2
|
+
import { useStyles as t } from "../internal/styles/index.js";
|
|
3
|
+
import n from "../_virtual/_@oxc-project_runtime@0.147.0/helpers/esm/decorate.js";
|
|
4
|
+
import r from "./progress-dot.js";
|
|
5
|
+
import { LitElement as i, html as a } from "lit";
|
|
6
|
+
import { property as o } from "lit/decorators/property.js";
|
|
7
|
+
import { I18nController as s } from "@nvidia-elements/foundations/internal/i18n";
|
|
8
8
|
//#region src/progress-dot/progress-dot.ts
|
|
9
|
-
var c = class extends
|
|
10
|
-
constructor(...
|
|
11
|
-
super(...
|
|
9
|
+
var c = { loading: "loading" }, l = class extends i {
|
|
10
|
+
constructor(...e) {
|
|
11
|
+
super(...e), this.size = "md", this.#e = new s(this, c), this.i18n = this.#e.i18n;
|
|
12
12
|
}
|
|
13
13
|
static {
|
|
14
|
-
this.styles =
|
|
14
|
+
this.styles = t([r]);
|
|
15
15
|
}
|
|
16
16
|
static {
|
|
17
17
|
this.metadata = {
|
|
18
18
|
tag: "nve-progress-dot",
|
|
19
|
-
version: "2.
|
|
19
|
+
version: "2.20.0"
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
22
|
#e;
|
|
23
23
|
render() {
|
|
24
|
-
return
|
|
24
|
+
return a`<div internal-host><svg viewBox="0 0 36 36" aria-hidden="true"><circle cx="5" cy="18" r="3"></circle><circle cx="18" cy="18" r="3"></circle><circle cx="31" cy="18" r="3"></circle></svg></div>`;
|
|
25
25
|
}
|
|
26
26
|
connectedCallback() {
|
|
27
|
-
super.connectedCallback(),
|
|
27
|
+
super.connectedCallback(), e(this), this._internals.role = "progressbar";
|
|
28
28
|
}
|
|
29
29
|
updated(e) {
|
|
30
30
|
super.updated(e), this._internals.ariaLabel = this.i18n.loading ?? null;
|
|
31
31
|
}
|
|
32
32
|
};
|
|
33
|
-
|
|
33
|
+
n([o({
|
|
34
34
|
type: String,
|
|
35
35
|
reflect: !0
|
|
36
|
-
})],
|
|
36
|
+
})], l.prototype, "size", void 0), n([o({ type: Object })], l.prototype, "i18n", void 0);
|
|
37
37
|
//#endregion
|
|
38
|
-
export {
|
|
38
|
+
export { l as ProgressDot };
|
|
39
39
|
|
|
40
40
|
//# sourceMappingURL=progress-dot2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progress-dot2.js","names":[],"sources":["../../src/progress-dot/progress-dot.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { html, LitElement, type PropertyValues } from 'lit';\nimport { property } from 'lit/decorators/property.js';\nimport type { Size } from '@nvidia-elements/core/internal';\nimport { attachInternals, I18nController,
|
|
1
|
+
{"version":3,"file":"progress-dot2.js","names":[],"sources":["../../src/progress-dot/progress-dot.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { html, LitElement, type PropertyValues } from 'lit';\nimport { property } from 'lit/decorators/property.js';\nimport type { Size } from '@nvidia-elements/core/internal';\nimport { attachInternals, useStyles } from '@nvidia-elements/core/internal';\nimport { I18nController, type I18nDefaults } from '@nvidia-elements/foundations/internal/i18n';\nimport styles from './progress-dot.css?inline';\n\nconst i18nDefaults = {\n loading: 'loading'\n} satisfies I18nDefaults;\n\n/**\n * @element nve-progress-dot\n * @description An inline visual indicator that shows the progress of an ongoing task with an unknown completion percentage.\n * @documentation https://nvidia.github.io/elements/docs/elements/progress-dot/\n * @since 0.0.0\n * @entrypoint \\@nvidia-elements/core/progress-dot\n * @cssprop --color - Dot color. Defaults to the inherited text color.\n * @cssprop --width - Indicator width.\n * @cssprop --height - Indicator height.\n * @cssprop --animation-duration - Duration of one animation cycle. Set to 0s for static dots.\n * @aria https://www.w3.org/TR/wai-aria-1.2/#progressbar\n */\nexport class ProgressDot extends LitElement {\n static styles = useStyles([styles]);\n\n static readonly metadata = {\n tag: 'nve-progress-dot',\n version: '0.0.0'\n };\n\n /** @private */\n declare _internals: ElementInternals;\n\n /** Controls the indicator size. */\n @property({ type: String, reflect: true }) size: Size = 'md';\n\n #i18nController: I18nController<this> = new I18nController<this>(this, i18nDefaults);\n\n /** Enables updating the default loading label for internationalization. */\n @property({ type: Object }) i18n = this.#i18nController.i18n;\n\n render() {\n return html`\n <div internal-host>\n <svg viewBox=\"0 0 36 36\" aria-hidden=\"true\">\n <circle cx=\"5\" cy=\"18\" r=\"3\"></circle>\n <circle cx=\"18\" cy=\"18\" r=\"3\"></circle>\n <circle cx=\"31\" cy=\"18\" r=\"3\"></circle>\n </svg>\n </div>\n `;\n }\n\n connectedCallback() {\n super.connectedCallback();\n attachInternals(this);\n this._internals.role = 'progressbar';\n }\n\n updated(props: PropertyValues<this>) {\n super.updated(props);\n this._internals.ariaLabel = this.i18n.loading ?? null;\n }\n}\n"],"mappings":";;;;;;;;AAUA,IAAM,IAAe,EACnB,SAAS,UACX,GAca,IAAb,cAAiC,EAAW;;EAiBP,aALqB,KAAA,OAAA,MAEhB,KAAA,KAAA,IAAI,EAAqB,MAAM,CAAY,GAGhD,KAAA,OAAA,KAAK,GAAgB;;;EAhBxC,KAAA,SAAA,EAAU,CAAC,CAAM,CAAC;;;EAEP,KAAA,WAAA;GACzB,KAAK;GACL,SAAS;EACX;;CAQA;CAKA,SAAS;EACP,OAAO,CAAI;CASb;CAEA,oBAAoB;EAGlB,AAFA,MAAM,kBAAkB,GACxB,EAAgB,IAAI,GACpB,KAAK,WAAW,OAAO;CACzB;CAEA,QAAQ,GAA6B;EAEnC,AADA,MAAM,QAAQ,CAAK,GACnB,KAAK,WAAW,YAAY,KAAK,KAAK,WAAW;CACnD;AACF;AA7BG,EAAA,CAAA,EAAS;CAAE,MAAM;CAAQ,SAAS;AAAK,CAAC,CAAA,GAAA,EAAA,WAAA,QAAA,KAAA,CAAA,GAKxC,EAAA,CAAA,EAAS,EAAE,MAAM,OAAO,CAAC,CAAA,GAAA,EAAA,WAAA,QAAA,KAAA,CAAA"}
|