@nvidia-elements/core 0.0.11 → 0.0.12
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 +21 -0
- package/dist/accordion/accordion2.js +4 -4
- package/dist/alert/alert-group2.js +1 -1
- package/dist/alert/alert2.js +1 -1
- package/dist/avatar/avatar-group2.js +1 -1
- package/dist/avatar/avatar2.js +1 -1
- package/dist/badge/badge2.js +1 -1
- package/dist/breadcrumb/breadcrumb2.js +1 -1
- package/dist/bundles/index.js +4 -4
- package/dist/button/button2.js +1 -1
- package/dist/button-group/button-group.d.ts +1 -1
- package/dist/button-group/button-group2.js +1 -1
- package/dist/button-group/button-group2.js.map +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/color2.js +1 -1
- package/dist/combobox/combobox2.js +1 -1
- package/dist/copy-button/copy-button2.js +1 -1
- package/dist/custom-elements-jsx.d.ts +1 -1
- package/dist/custom-elements-vue.d.ts +1 -1
- package/dist/custom-elements.json +2 -2
- package/dist/data.html.json +2 -2
- package/dist/date/date2.js +1 -1
- package/dist/datetime/datetime2.js +1 -1
- package/dist/dialog/dialog-footer2.js +1 -1
- package/dist/dialog/dialog-header2.js +1 -1
- package/dist/dialog/dialog2.js +1 -1
- package/dist/divider/divider2.js +1 -1
- package/dist/dot/dot2.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 +1 -1
- package/dist/dropdown/dropdown-footer2.js +1 -1
- package/dist/dropdown/dropdown-header2.js +1 -1
- package/dist/dropdown/dropdown2.js +1 -1
- package/dist/dropdown-group/dropdown-group.js +1 -1
- package/dist/dropzone/dropzone2.js +1 -1
- package/dist/file/file2.js +1 -1
- package/dist/format-datetime/format-datetime2.js +1 -1
- package/dist/format-relative-time/format-relative-time2.js +73 -53
- package/dist/format-relative-time/format-relative-time2.js.map +1 -1
- package/dist/forms/control/control2.js +1 -1
- package/dist/forms/control-group/control-group2.js +1 -1
- package/dist/forms/control-message/control-message2.js +1 -1
- package/dist/forms/validation.examples.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/index.js +1 -1
- package/dist/input/input-group2.js +1 -1
- package/dist/input/input2.js +1 -1
- package/dist/internal/services/global.service.js +1 -1
- package/dist/internal/utils/objects.js +17 -9
- package/dist/internal/utils/objects.js.map +1 -1
- package/dist/logo/logo2.js +1 -1
- package/dist/menu/menu-item2.js +1 -1
- package/dist/menu/menu2.js +1 -1
- package/dist/month/month2.js +1 -1
- package/dist/notification/notification-group2.js +1 -1
- package/dist/notification/notification2.js +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-panel2.js +1 -1
- package/dist/page/page.examples.js.map +1 -1
- package/dist/page/page.examples.json +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 +1 -1
- package/dist/panel/panel2.js +4 -4
- package/dist/password/password2.js +1 -1
- package/dist/preferences-input/preferences-input2.js +1 -1
- package/dist/progress-bar/progress-bar2.js +1 -1
- package/dist/progress-ring/progress-ring2.js +1 -1
- package/dist/progressive-filter-chip/progressive-filter-chip2.js +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 +1 -1
- package/dist/search/search2.js +1 -1
- package/dist/select/select2.js +1 -1
- package/dist/skeleton/skeleton2.js +1 -1
- package/dist/sort-button/sort-button2.js +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/tabs2.js +2 -2
- package/dist/tag/tag2.js +1 -1
- package/dist/textarea/textarea2.js +1 -1
- package/dist/time/time2.js +1 -1
- package/dist/toast/toast2.js +1 -1
- package/dist/toggletip/toggletip-footer2.js +1 -1
- package/dist/toggletip/toggletip-header2.js +1 -1
- package/dist/toggletip/toggletip2.js +1 -1
- package/dist/toolbar/toolbar2.js +1 -1
- package/dist/tooltip/tooltip2.js +1 -1
- package/dist/tree/tree-node2.js +1 -1
- package/dist/tree/tree2.js +1 -1
- package/dist/week/week2.js +1 -1
- package/package.json +5 -5
package/dist/button/button2.js
CHANGED
|
@@ -2,7 +2,7 @@ import { PropertyValues, LitElement } from 'lit';
|
|
|
2
2
|
import { KeynavListConfig, Interaction, Size } from '../internal';
|
|
3
3
|
/**
|
|
4
4
|
* @element nve-button-group
|
|
5
|
-
* @description A button group
|
|
5
|
+
* @description A button group organizes related buttons and can support either mutually exclusive single or multi selection. Prefer usage within toolbars.
|
|
6
6
|
* @since 0.16.0
|
|
7
7
|
* @entrypoint \@nvidia-elements/core/button-group
|
|
8
8
|
* @slot - default slot for `nve-button` or `nve-icon-button`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button-group2.js","names":["#buttons","#syncStyleStates","#onClick","#selectButton"],"sources":["../../src/button-group/button-group.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { PropertyValues } from 'lit';\nimport { html, LitElement } from 'lit';\nimport { property } from 'lit/decorators/property.js';\nimport { queryAssignedElements } from 'lit/decorators/query-assigned-elements.js';\nimport type { KeynavListConfig, Interaction, Size } from '@nvidia-elements/core/internal';\nimport {\n attachInternals,\n keyNavigationList,\n useStyles,\n audit,\n appendRootNodeStyle\n} from '@nvidia-elements/core/internal';\nimport type { IconButton } from '@nvidia-elements/core/icon-button';\nimport type { Button } from '@nvidia-elements/core/button';\nimport type { Divider } from '@nvidia-elements/core/divider';\nimport styles from './button-group.css?inline';\nimport globalStyles from './button-group.global.css?inline';\n\n/**\n * @element nve-button-group\n * @description A button group
|
|
1
|
+
{"version":3,"file":"button-group2.js","names":["#buttons","#syncStyleStates","#onClick","#selectButton"],"sources":["../../src/button-group/button-group.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { PropertyValues } from 'lit';\nimport { html, LitElement } from 'lit';\nimport { property } from 'lit/decorators/property.js';\nimport { queryAssignedElements } from 'lit/decorators/query-assigned-elements.js';\nimport type { KeynavListConfig, Interaction, Size } from '@nvidia-elements/core/internal';\nimport {\n attachInternals,\n keyNavigationList,\n useStyles,\n audit,\n appendRootNodeStyle\n} from '@nvidia-elements/core/internal';\nimport type { IconButton } from '@nvidia-elements/core/icon-button';\nimport type { Button } from '@nvidia-elements/core/button';\nimport type { Divider } from '@nvidia-elements/core/divider';\nimport styles from './button-group.css?inline';\nimport globalStyles from './button-group.global.css?inline';\n\n/**\n * @element nve-button-group\n * @description A button group organizes related buttons and can support either mutually exclusive single or multi selection. Prefer usage within toolbars.\n * @since 0.16.0\n * @entrypoint \\@nvidia-elements/core/button-group\n * @slot - default slot for `nve-button` or `nve-icon-button`\n * @cssprop --background\n * @cssprop --border-radius\n * @cssprop --padding\n * @cssprop --gap\n * @cssprop --width\n * @cssprop --height\n * @cssprop --color\n * @aria https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/group_role\n */\n@audit()\n@keyNavigationList<ButtonGroup>()\nexport class ButtonGroup extends LitElement {\n /** @private */\n get keynavListConfig(): KeynavListConfig {\n return {\n items: this.#buttons,\n layout: this.orientation\n };\n }\n\n /** By default the button group is stateless. Add the `behavior-select` attribute and set to `single` or `multi` to enable stateful selction handling. */\n @property({ type: String, attribute: 'behavior-select' }) behaviorSelect: 'single' | 'multi';\n\n /** Set the style of the button group using the `container` property. Options are the default display when omitting the attribute, `flat` or `rounded`. */\n @property({ type: String, reflect: true }) container?: 'flat' | 'rounded';\n\n /** Determines the orientation direction of the group. Vertical groups support icon buttons only. */\n @property({ type: String, reflect: true }) orientation?: 'horizontal' | 'vertical' = 'horizontal';\n\n /** Use the `interaction` property on `button-group` in combination with `divider` for color-coded split buttons */\n @property({ type: String, reflect: true }) interaction: Interaction;\n\n /** Determines size of button */\n @property({ type: String, reflect: true }) size?: Size;\n\n static styles = useStyles([styles]);\n\n static readonly metadata = {\n tag: 'nve-button-group',\n version: '0.0.0',\n children: ['nve-button', 'nve-icon-button', 'nve-divider']\n };\n\n /** @private */\n declare _internals: ElementInternals;\n\n @queryAssignedElements({ selector: 'nve-divider' }) private dividers!: Divider[];\n\n @queryAssignedElements({ selector: 'nve-icon-button' }) private iconButtons!: IconButton[];\n\n @queryAssignedElements({ selector: 'nve-button' }) private buttons!: Button[];\n\n get #buttons() {\n return [...this.iconButtons, ...this.buttons];\n }\n\n render() {\n return html`\n <div internal-host>\n <slot @slotchange=${this.#syncStyleStates}></slot>\n </div>\n `;\n }\n\n connectedCallback() {\n super.connectedCallback();\n attachInternals(this);\n appendRootNodeStyle(this, globalStyles);\n this._internals.role = 'group';\n this.addEventListener('click', this.#onClick);\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.removeEventListener('click', this.#onClick);\n }\n\n #onClick = (e: Event) => this.#selectButton(e.target as HTMLElement & { pressed?: boolean });\n\n updated(props: PropertyValues<this>) {\n super.updated(props);\n this.#syncStyleStates();\n }\n\n #syncStyleStates() {\n if (this.container === 'flat') {\n this.#buttons.forEach(btn => (btn.container = 'flat'));\n }\n\n if (this.interaction) {\n this.#buttons.forEach(btn => (btn.interaction = this.interaction));\n }\n\n this.dividers.length ? this._internals.states.add('split') : this._internals.states.delete('split');\n }\n\n #selectButton(button: HTMLElement & { pressed?: boolean }) {\n if (!button.matches?.('nve-button, nve-icon-button')) {\n return;\n }\n\n if (this.behaviorSelect === 'single') {\n this.#buttons.forEach(i => (i.pressed = false));\n button.pressed = true;\n } else if (this.behaviorSelect === 'multi') {\n button.pressed = !button.pressed;\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;AAsCO,IAAA,IAAA,cAA0B,EAAW;;kCAgB2C;;CAdrF,IAAI,mBAAqC;AACvC,SAAO;GACL,OAAO,MAAA;GACP,QAAQ,KAAK;GACd;;;gBAkBa,EAAU,CAAC,EAAO,CAAC;;;kBAER;GACzB,KAAK;GACL,SAAS;GACT,UAAU;IAAC;IAAc;IAAmB;;GAC7C;;CAWD,KAAA,IAAe;AACb,SAAO,CAAC,GAAG,KAAK,aAAa,GAAG,KAAK,QAAQ;;CAG/C,SAAS;AACP,SAAO,CAAI,yCAEa,MAAA,EAAsB;;CAKhD,oBAAoB;AAKlB,EAJA,MAAM,mBAAmB,EACzB,EAAgB,KAAK,EACrB,EAAoB,MAAM,EAAa,EACvC,KAAK,WAAW,OAAO,SACvB,KAAK,iBAAiB,SAAS,MAAA,EAAc;;CAG/C,uBAAuB;AAErB,EADA,MAAM,sBAAsB,EAC5B,KAAK,oBAAoB,SAAS,MAAA,EAAc;;CAGlD,MAAY,MAAa,MAAA,EAAmB,EAAE,OAA8C;CAE5F,QAAQ,GAA6B;AAEnC,EADA,MAAM,QAAQ,EAAM,EACpB,MAAA,GAAuB;;CAGzB,KAAmB;AASjB,EARI,KAAK,cAAc,UACrB,MAAA,EAAc,SAAQ,MAAQ,EAAI,YAAY,OAAQ,EAGpD,KAAK,eACP,MAAA,EAAc,SAAQ,MAAQ,EAAI,cAAc,KAAK,YAAa,EAGpE,KAAK,SAAS,SAAS,KAAK,WAAW,OAAO,IAAI,QAAQ,GAAG,KAAK,WAAW,OAAO,OAAO,QAAQ;;CAGrG,GAAc,GAA6C;AACpD,IAAO,UAAU,8BAA8B,KAIhD,KAAK,mBAAmB,YAC1B,MAAA,EAAc,SAAQ,MAAM,EAAE,UAAU,GAAO,EAC/C,EAAO,UAAU,MACR,KAAK,mBAAmB,YACjC,EAAO,UAAU,CAAC,EAAO;;;GApF5B,EAAS;CAAE,MAAM;CAAQ,WAAW;CAAmB,CAAC,CAAA,EAAA,EAAA,WAAA,kBAAA,KAAA,EAAA,KAGxD,EAAS;CAAE,MAAM;CAAQ,SAAS;CAAM,CAAC,CAAA,EAAA,EAAA,WAAA,aAAA,KAAA,EAAA,KAGzC,EAAS;CAAE,MAAM;CAAQ,SAAS;CAAM,CAAC,CAAA,EAAA,EAAA,WAAA,eAAA,KAAA,EAAA,KAGzC,EAAS;CAAE,MAAM;CAAQ,SAAS;CAAM,CAAC,CAAA,EAAA,EAAA,WAAA,eAAA,KAAA,EAAA,KAGzC,EAAS;CAAE,MAAM;CAAQ,SAAS;CAAM,CAAC,CAAA,EAAA,EAAA,WAAA,QAAA,KAAA,EAAA,KAazC,EAAsB,EAAE,UAAU,eAAe,CAAC,CAAA,EAAA,EAAA,WAAA,YAAA,KAAA,EAAA,KAElD,EAAsB,EAAE,UAAU,mBAAmB,CAAC,CAAA,EAAA,EAAA,WAAA,eAAA,KAAA,EAAA,KAEtD,EAAsB,EAAE,UAAU,cAAc,CAAC,CAAA,EAAA,EAAA,WAAA,WAAA,KAAA,EAAA,SAzCnD,GAAO,EACP,GAAgC,CAAA,EAAA,EAAA"}
|
package/dist/card/card2.js
CHANGED
|
@@ -16,7 +16,7 @@ var d = class extends c {
|
|
|
16
16
|
static {
|
|
17
17
|
this.metadata = {
|
|
18
18
|
tag: "nve-card",
|
|
19
|
-
version: "0.0.
|
|
19
|
+
version: "0.0.12"
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
22
|
render() {
|
|
@@ -37,7 +37,7 @@ var f = class extends c {
|
|
|
37
37
|
static {
|
|
38
38
|
this.metadata = {
|
|
39
39
|
tag: "nve-card-header",
|
|
40
|
-
version: "0.0.
|
|
40
|
+
version: "0.0.12",
|
|
41
41
|
parents: ["nve-card"]
|
|
42
42
|
};
|
|
43
43
|
}
|
|
@@ -53,7 +53,7 @@ var p = class extends c {
|
|
|
53
53
|
static {
|
|
54
54
|
this.metadata = {
|
|
55
55
|
tag: "nve-card-content",
|
|
56
|
-
version: "0.0.
|
|
56
|
+
version: "0.0.12",
|
|
57
57
|
parents: ["nve-card"]
|
|
58
58
|
};
|
|
59
59
|
}
|
|
@@ -72,7 +72,7 @@ var m = class extends c {
|
|
|
72
72
|
static {
|
|
73
73
|
this.metadata = {
|
|
74
74
|
tag: "nve-card-footer",
|
|
75
|
-
version: "0.0.
|
|
75
|
+
version: "0.0.12",
|
|
76
76
|
parents: ["nve-card"]
|
|
77
77
|
};
|
|
78
78
|
}
|
package/dist/color/color2.js
CHANGED
|
@@ -4053,7 +4053,7 @@ export type CustomElements = {
|
|
|
4053
4053
|
"nve-breadcrumb": Partial<BreadcrumbProps & BaseProps & BaseEvents>;
|
|
4054
4054
|
|
|
4055
4055
|
/**
|
|
4056
|
-
* A button group
|
|
4056
|
+
* A button group organizes related buttons and can support either mutually exclusive single or multi selection. Prefer usage within toolbars.
|
|
4057
4057
|
* ---
|
|
4058
4058
|
*
|
|
4059
4059
|
*
|
|
@@ -3980,7 +3980,7 @@ export type CustomElements = {
|
|
|
3980
3980
|
"nve-breadcrumb": DefineComponent<BreadcrumbProps>;
|
|
3981
3981
|
|
|
3982
3982
|
/**
|
|
3983
|
-
* A button group
|
|
3983
|
+
* A button group organizes related buttons and can support either mutually exclusive single or multi selection. Prefer usage within toolbars.
|
|
3984
3984
|
* ---
|
|
3985
3985
|
*
|
|
3986
3986
|
*
|
|
@@ -3790,7 +3790,7 @@
|
|
|
3790
3790
|
"declarations": [
|
|
3791
3791
|
{
|
|
3792
3792
|
"kind": "class",
|
|
3793
|
-
"description": "A button group
|
|
3793
|
+
"description": "A button group organizes related buttons and can support either mutually exclusive single or multi selection. Prefer usage within toolbars.",
|
|
3794
3794
|
"name": "ButtonGroup",
|
|
3795
3795
|
"cssProperties": [
|
|
3796
3796
|
{
|
|
@@ -4158,7 +4158,7 @@
|
|
|
4158
4158
|
"since": "0.16.0",
|
|
4159
4159
|
"status": "stable",
|
|
4160
4160
|
"behavior": "container",
|
|
4161
|
-
"markdown": "## nve-button-group\n\nA button group
|
|
4161
|
+
"markdown": "## nve-button-group\n\nA button group organizes related buttons and can support either mutually exclusive single or multi selection. Prefer usage within toolbars.\n\n### Example\n\n```html\n<nve-button-group>\n <nve-icon-button selected icon-name=\"copy\"></nve-icon-button>\n <nve-icon-button icon-name=\"add-comment\"></nve-icon-button>\n <nve-icon-button icon-name=\"download\"></nve-icon-button>\n</nve-button-group>\n```\n\n### Import\n\n```javascript\nimport '@nvidia-elements/core/button-group/define.js';\n```\n\n### Slots\n\n| name | value | description |\n| ---- | ----- | ----------- |\n| (default) | `string` | default slot for `nve-button` or `nve-icon-button` |\n\n### Properties / Attributes\n\n| property (attribute) | value | description |\n| -------------------- | ----- | ----------- |\n| behaviorSelect (behavior-select) | `'single' \\| 'multi'` | By default the button group is stateless. Add the `behavior-select` attribute and set to `single` or `multi` to enable stateful selction handling. |\n| container | `'flat' \\| 'rounded' \\| \"default\"` | Demonstrates different container styles to accommodate visual weight and context. - `flat` Element has white space bounds but reduced visual container. |\n| orientation | `'horizontal' \\| 'vertical' \\| \"default\"` | Controls the directional flow of the element's layout and interaction pattern. - `horizontal` Element orients horizontally with left-to-right flow. - `vertical` Element orients vertically with top-to-bottom flow. |\n| interaction | `'emphasis' \\| 'destructive'` | The Interaction type provides a way to show the intent of an interactive element. This can help users quickly understand what each interaction does and reduce the potential for confusion or errors. - `emphasis` Shows the interaction targets emphasis or highlighting primary actions. - `destructive` Shows the interaction targets destructive actions such as deleting or removing. |\n| size | `'sm' \\| 'md' \\| 'lg' \\| \"default\"` | Controls the visual scale of an element to match its importance and available space. - `sm` Compact size for dense layouts or secondary elements with less visual prominence. - `md` Standard size that works well in most contexts and provides balanced visibility. - `lg` Larger size for emphasizing important elements or improving touch targets in spacious layouts. |\n\n### CSS Properties\n\n| name | value | description |\n| ---- | ----- | ----------- |\n| --background | `string` | [MDN](https://mdn.dev/CSS/background) |\n| --border-radius | `string` | [MDN](https://mdn.dev/CSS/border-radius) |\n| --padding | `string` | [MDN](https://mdn.dev/CSS/padding) |\n| --gap | `string` | [MDN](https://mdn.dev/CSS/gap) |\n| --width | `string` | [MDN](https://mdn.dev/CSS/width) |\n| --height | `string` | [MDN](https://mdn.dev/CSS/height) |\n| --color | `string` | [MDN](https://mdn.dev/CSS/color) |"
|
|
4162
4162
|
}
|
|
4163
4163
|
}
|
|
4164
4164
|
],
|
package/dist/data.html.json
CHANGED
|
@@ -389,7 +389,7 @@
|
|
|
389
389
|
},
|
|
390
390
|
{
|
|
391
391
|
"name": "nve-button-group",
|
|
392
|
-
"description": "A button group
|
|
392
|
+
"description": "A button group organizes related buttons and can support either mutually exclusive single or multi selection. Prefer usage within toolbars.\n---\n\n\n### **Slots:**\n - _default_ - default slot for `nve-button` or `nve-icon-button`\n\n### **CSS Properties:**\n - **--background** - [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/background) _(default: undefined)_\n- **--border-radius** - [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/border-radius) _(default: undefined)_\n- **--padding** - [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/padding) _(default: undefined)_\n- **--gap** - [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/gap) _(default: undefined)_\n- **--width** - [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/width) _(default: undefined)_\n- **--height** - [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/height) _(default: undefined)_\n- **--color** - [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/color) _(default: undefined)_",
|
|
393
393
|
"attributes": [
|
|
394
394
|
{
|
|
395
395
|
"name": "behavior-select",
|
|
@@ -437,7 +437,7 @@
|
|
|
437
437
|
},
|
|
438
438
|
{
|
|
439
439
|
"name": "markdown",
|
|
440
|
-
"url": "## nve-button-group\n\nA button group
|
|
440
|
+
"url": "## nve-button-group\n\nA button group organizes related buttons and can support either mutually exclusive single or multi selection. Prefer usage within toolbars.\n\n### Example\n\n```html\n<nve-button-group>\n <nve-icon-button selected icon-name=\"copy\"></nve-icon-button>\n <nve-icon-button icon-name=\"add-comment\"></nve-icon-button>\n <nve-icon-button icon-name=\"download\"></nve-icon-button>\n</nve-button-group>\n```\n\n### Import\n\n```javascript\nimport '@nvidia-elements/core/button-group/define.js';\n```\n\n### Slots\n\n| name | value | description |\n| ---- | ----- | ----------- |\n| (default) | `string` | default slot for `nve-button` or `nve-icon-button` |\n\n### Properties / Attributes\n\n| property (attribute) | value | description |\n| -------------------- | ----- | ----------- |\n| behaviorSelect (behavior-select) | `'single' \\| 'multi'` | By default the button group is stateless. Add the `behavior-select` attribute and set to `single` or `multi` to enable stateful selction handling. |\n| container | `'flat' \\| 'rounded' \\| \"default\"` | Demonstrates different container styles to accommodate visual weight and context. - `flat` Element has white space bounds but reduced visual container. |\n| orientation | `'horizontal' \\| 'vertical' \\| \"default\"` | Controls the directional flow of the element's layout and interaction pattern. - `horizontal` Element orients horizontally with left-to-right flow. - `vertical` Element orients vertically with top-to-bottom flow. |\n| interaction | `'emphasis' \\| 'destructive'` | The Interaction type provides a way to show the intent of an interactive element. This can help users quickly understand what each interaction does and reduce the potential for confusion or errors. - `emphasis` Shows the interaction targets emphasis or highlighting primary actions. - `destructive` Shows the interaction targets destructive actions such as deleting or removing. |\n| size | `'sm' \\| 'md' \\| 'lg' \\| \"default\"` | Controls the visual scale of an element to match its importance and available space. - `sm` Compact size for dense layouts or secondary elements with less visual prominence. - `md` Standard size that works well in most contexts and provides balanced visibility. - `lg` Larger size for emphasizing important elements or improving touch targets in spacious layouts. |\n\n### CSS Properties\n\n| name | value | description |\n| ---- | ----- | ----------- |\n| --background | `string` | [MDN](https://mdn.dev/CSS/background) |\n| --border-radius | `string` | [MDN](https://mdn.dev/CSS/border-radius) |\n| --padding | `string` | [MDN](https://mdn.dev/CSS/padding) |\n| --gap | `string` | [MDN](https://mdn.dev/CSS/gap) |\n| --width | `string` | [MDN](https://mdn.dev/CSS/width) |\n| --height | `string` | [MDN](https://mdn.dev/CSS/height) |\n| --color | `string` | [MDN](https://mdn.dev/CSS/color) |"
|
|
441
441
|
}
|
|
442
442
|
]
|
|
443
443
|
},
|
package/dist/date/date2.js
CHANGED
package/dist/dialog/dialog2.js
CHANGED
package/dist/divider/divider2.js
CHANGED
package/dist/dot/dot2.js
CHANGED
package/dist/drawer/drawer2.js
CHANGED
package/dist/file/file2.js
CHANGED
|
@@ -6,7 +6,44 @@ import i from "./format-relative-time.js";
|
|
|
6
6
|
import { LitElement as a, html as o } from "lit";
|
|
7
7
|
import { property as s } from "lit/decorators/property.js";
|
|
8
8
|
//#region src/format-relative-time/format-relative-time.ts
|
|
9
|
-
var c =
|
|
9
|
+
var c = {
|
|
10
|
+
second: 1e3,
|
|
11
|
+
minute: 6e4,
|
|
12
|
+
hour: 36e5,
|
|
13
|
+
day: 864e5,
|
|
14
|
+
week: 6048e5,
|
|
15
|
+
month: 2592e6,
|
|
16
|
+
year: 31536e6
|
|
17
|
+
}, l = [
|
|
18
|
+
{
|
|
19
|
+
unit: "second",
|
|
20
|
+
max: 60
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
unit: "minute",
|
|
24
|
+
max: 60
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
unit: "hour",
|
|
28
|
+
max: 24
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
unit: "day",
|
|
32
|
+
max: 7
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
unit: "week",
|
|
36
|
+
max: 4
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
unit: "month",
|
|
40
|
+
max: 12
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
unit: "year",
|
|
44
|
+
max: Infinity
|
|
45
|
+
}
|
|
46
|
+
], u = class extends a {
|
|
10
47
|
constructor(...e) {
|
|
11
48
|
super(...e), this.numeric = "always", this.formatStyle = "long", this.unit = "auto", this.sync = !1;
|
|
12
49
|
}
|
|
@@ -16,7 +53,7 @@ var c = class extends a {
|
|
|
16
53
|
static {
|
|
17
54
|
this.metadata = {
|
|
18
55
|
tag: "nve-format-relative-time",
|
|
19
|
-
version: "0.0.
|
|
56
|
+
version: "0.0.12"
|
|
20
57
|
};
|
|
21
58
|
}
|
|
22
59
|
#e;
|
|
@@ -27,92 +64,75 @@ var c = class extends a {
|
|
|
27
64
|
return this.locale ?? (globalThis.document?.documentElement?.lang || void 0);
|
|
28
65
|
}
|
|
29
66
|
#r(e) {
|
|
30
|
-
let t = Math.abs(e), n = e < 0 ? -1 : 1
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
unit: "hour"
|
|
40
|
-
} : o < 7 ? {
|
|
41
|
-
value: n * o,
|
|
42
|
-
unit: "day"
|
|
43
|
-
} : s < 4 ? {
|
|
44
|
-
value: n * s,
|
|
45
|
-
unit: "week"
|
|
46
|
-
} : c < 12 ? {
|
|
47
|
-
value: n * c,
|
|
48
|
-
unit: "month"
|
|
49
|
-
} : {
|
|
50
|
-
value: n * l,
|
|
51
|
-
unit: "year"
|
|
52
|
-
};
|
|
67
|
+
let t = Math.abs(e), n = e < 0 ? -1 : 1;
|
|
68
|
+
for (let { unit: e, max: r } of l) {
|
|
69
|
+
let i = Math.round(t / c[e]);
|
|
70
|
+
if (i < r) return {
|
|
71
|
+
value: n * i,
|
|
72
|
+
unit: e
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
throw Error("format-relative-time: no relative time threshold matched");
|
|
53
76
|
}
|
|
54
77
|
#i(e, t) {
|
|
55
|
-
return Math.round(e /
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
get #a() {
|
|
78
|
+
return Math.round(e / c[t]);
|
|
79
|
+
}
|
|
80
|
+
#a(e) {
|
|
81
|
+
return this.unit === "auto" ? this.#r(e) : {
|
|
82
|
+
unit: this.unit,
|
|
83
|
+
value: this.#i(e, this.unit)
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
get #o() {
|
|
66
87
|
let t = this.#t;
|
|
67
88
|
if (!t) return "";
|
|
68
89
|
let n = new Date(t);
|
|
69
90
|
if (isNaN(n.getTime())) return e.warn(`format-relative-time: invalid date value "${t}"`), t;
|
|
70
|
-
let r = n.getTime() - Date.now()
|
|
71
|
-
this.unit === "auto" ? {value: i, unit: a} = this.#r(r) : (a = this.unit, i = this.#i(r, a));
|
|
91
|
+
let { value: r, unit: i } = this.#a(n.getTime() - Date.now());
|
|
72
92
|
try {
|
|
73
93
|
return new Intl.RelativeTimeFormat(this.#n, {
|
|
74
94
|
numeric: this.numeric,
|
|
75
95
|
style: this.formatStyle
|
|
76
|
-
}).format(
|
|
96
|
+
}).format(r, i);
|
|
77
97
|
} catch (n) {
|
|
78
98
|
return e.warn(`format-relative-time: ${n.message}`), t;
|
|
79
99
|
}
|
|
80
100
|
}
|
|
81
|
-
#
|
|
101
|
+
#s() {
|
|
82
102
|
let e = this.#t;
|
|
83
103
|
if (!e) return 6e4;
|
|
84
104
|
let t = Math.abs(new Date(e).getTime() - Date.now());
|
|
85
105
|
return t < 6e4 ? 1e4 : t < 36e5 ? 3e4 : t < 864e5 ? 3e5 : 36e5;
|
|
86
106
|
}
|
|
87
|
-
#s() {
|
|
88
|
-
this.#c(), this.sync && (this.#e = setTimeout(() => {
|
|
89
|
-
this.requestUpdate(), this.#s();
|
|
90
|
-
}, this.#o()));
|
|
91
|
-
}
|
|
92
107
|
#c() {
|
|
108
|
+
this.#l(), this.sync && (this.#e = setTimeout(() => {
|
|
109
|
+
this.requestUpdate(), this.#c();
|
|
110
|
+
}, this.#s()));
|
|
111
|
+
}
|
|
112
|
+
#l() {
|
|
93
113
|
this.#e !== void 0 && (clearTimeout(this.#e), this.#e = void 0);
|
|
94
114
|
}
|
|
95
115
|
connectedCallback() {
|
|
96
|
-
super.connectedCallback(), this.sync && this.#
|
|
116
|
+
super.connectedCallback(), this.sync && this.#c();
|
|
97
117
|
}
|
|
98
118
|
disconnectedCallback() {
|
|
99
|
-
this.#
|
|
119
|
+
this.#l(), super.disconnectedCallback();
|
|
100
120
|
}
|
|
101
121
|
updated(e) {
|
|
102
|
-
e.has("sync") && (this.sync ? this.#
|
|
122
|
+
e.has("sync") && (this.sync ? this.#c() : this.#l());
|
|
103
123
|
}
|
|
104
124
|
render() {
|
|
105
|
-
return o`<time internal-host datetime="${this.#t}">${this.#
|
|
125
|
+
return o`<time internal-host datetime="${this.#t}">${this.#o}<slot @slotchange="${this.#u}" hidden></slot></time>`;
|
|
106
126
|
}
|
|
107
|
-
#
|
|
127
|
+
#u() {
|
|
108
128
|
this.requestUpdate();
|
|
109
129
|
}
|
|
110
130
|
};
|
|
111
|
-
t([s({ type: String })],
|
|
131
|
+
t([s({ type: String })], u.prototype, "date", void 0), t([s({ type: String })], u.prototype, "locale", void 0), t([s({ type: String })], u.prototype, "numeric", void 0), t([s({
|
|
112
132
|
type: String,
|
|
113
133
|
attribute: "format-style"
|
|
114
|
-
})],
|
|
134
|
+
})], u.prototype, "formatStyle", void 0), t([s({ type: String })], u.prototype, "unit", void 0), t([s({ type: Boolean })], u.prototype, "sync", void 0), u = t([n()], u);
|
|
115
135
|
//#endregion
|
|
116
|
-
export {
|
|
136
|
+
export { u as FormatRelativeTime };
|
|
117
137
|
|
|
118
138
|
//# sourceMappingURL=format-relative-time2.js.map
|