@nvidia-elements/core 0.0.11 → 0.1.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 +40 -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/bundle.d.ts +1 -0
- package/dist/bundles/index.d.ts +86 -0
- 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 +51 -1
- package/dist/custom-elements-vue.d.ts +51 -1
- package/dist/custom-elements.json +790 -4
- package/dist/data.html.json +121 -3
- package/dist/data.snippets.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-number/define.d.ts +6 -0
- package/dist/format-number/define.js +7 -0
- package/dist/format-number/define.js.map +1 -0
- package/dist/format-number/format-number.d.ts +87 -0
- package/dist/format-number/format-number.examples.js +6 -0
- package/dist/format-number/format-number.examples.js.map +1 -0
- package/dist/format-number/format-number.examples.json +87 -0
- package/dist/format-number/format-number.js +6 -0
- package/dist/format-number/format-number.js.map +1 -0
- package/dist/format-number/format-number2.js +111 -0
- package/dist/format-number/format-number2.js.map +1 -0
- package/dist/format-number/index.d.ts +1 -0
- package/dist/format-number/index.js +2 -0
- 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/logo.examples.js.map +1 -1
- package/dist/logo/logo.examples.json +4 -4
- package/dist/logo/logo2.js +1 -1
- package/dist/menu/menu-item2.js +1 -1
- package/dist/menu/menu.examples.js.map +1 -1
- package/dist/menu/menu.examples.json +3 -3
- 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-input.examples.js.map +1 -1
- package/dist/preferences-input/preferences-input.examples.json +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 +16 -4
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
|
},
|
|
@@ -1775,6 +1775,124 @@
|
|
|
1775
1775
|
],
|
|
1776
1776
|
"references": []
|
|
1777
1777
|
},
|
|
1778
|
+
{
|
|
1779
|
+
"name": "nve-format-number",
|
|
1780
|
+
"description": "A localized number formatter for currencies, percentages, units, and compact notation, backed by Intl.NumberFormat.\nProvide a `currency` attribute when `formatStyle` is `currency`, and a `unit` attribute when `formatStyle` is `unit`.\n---\n\n\n### **Slots:**\n - _default_ - Numeric string to format (such as 1234567 or 1234.56). Serves as fallback before hydration.",
|
|
1781
|
+
"attributes": [
|
|
1782
|
+
{
|
|
1783
|
+
"name": "number",
|
|
1784
|
+
"description": "Optional numeric string for values supplied by JavaScript or bound data.\nBy default, the component formats the element's text content, which also serves as the SSR fallback.\nWhen both are present, this property takes precedence.",
|
|
1785
|
+
"values": [{ "name": "default" }]
|
|
1786
|
+
},
|
|
1787
|
+
{
|
|
1788
|
+
"name": "locale",
|
|
1789
|
+
"description": "Language tag (such as en-US, de-DE). Defaults to document.documentElement.lang or browser default.",
|
|
1790
|
+
"values": [{ "name": "default" }]
|
|
1791
|
+
},
|
|
1792
|
+
{
|
|
1793
|
+
"name": "format-style",
|
|
1794
|
+
"description": "Formatting style: 'decimal' | 'currency' | 'percent' | 'unit'.",
|
|
1795
|
+
"values": [
|
|
1796
|
+
{ "name": "decimal" },
|
|
1797
|
+
{ "name": "currency" },
|
|
1798
|
+
{ "name": "percent" },
|
|
1799
|
+
{ "name": "unit" }
|
|
1800
|
+
]
|
|
1801
|
+
},
|
|
1802
|
+
{
|
|
1803
|
+
"name": "currency",
|
|
1804
|
+
"description": "ISO 4217 currency code (such as USD or EUR). Required when formatStyle is currency.",
|
|
1805
|
+
"values": [{ "name": "default" }]
|
|
1806
|
+
},
|
|
1807
|
+
{
|
|
1808
|
+
"name": "currency-sign",
|
|
1809
|
+
"description": "Currency sign style: 'standard' | 'accounting'.",
|
|
1810
|
+
"values": [
|
|
1811
|
+
{ "name": "standard" },
|
|
1812
|
+
{ "name": "accounting" },
|
|
1813
|
+
{ "name": "default" }
|
|
1814
|
+
]
|
|
1815
|
+
},
|
|
1816
|
+
{
|
|
1817
|
+
"name": "currency-display",
|
|
1818
|
+
"description": "Currency display style: 'symbol' | 'code' | 'name' | 'narrowSymbol'.",
|
|
1819
|
+
"values": [
|
|
1820
|
+
{ "name": "symbol" },
|
|
1821
|
+
{ "name": "code" },
|
|
1822
|
+
{ "name": "name" },
|
|
1823
|
+
{ "name": "narrowSymbol" },
|
|
1824
|
+
{ "name": "default" }
|
|
1825
|
+
]
|
|
1826
|
+
},
|
|
1827
|
+
{
|
|
1828
|
+
"name": "unit",
|
|
1829
|
+
"description": "Unit identifier (such as kilometer or byte). Required when formatStyle is unit.",
|
|
1830
|
+
"values": [{ "name": "default" }]
|
|
1831
|
+
},
|
|
1832
|
+
{
|
|
1833
|
+
"name": "unit-display",
|
|
1834
|
+
"description": "Unit display style: 'short' | 'long' | 'narrow'.",
|
|
1835
|
+
"values": [
|
|
1836
|
+
{ "name": "short" },
|
|
1837
|
+
{ "name": "long" },
|
|
1838
|
+
{ "name": "narrow" },
|
|
1839
|
+
{ "name": "default" }
|
|
1840
|
+
]
|
|
1841
|
+
},
|
|
1842
|
+
{
|
|
1843
|
+
"name": "notation",
|
|
1844
|
+
"description": "Number notation: 'standard' | 'scientific' | 'engineering' | 'compact'.",
|
|
1845
|
+
"values": [
|
|
1846
|
+
{ "name": "standard" },
|
|
1847
|
+
{ "name": "scientific" },
|
|
1848
|
+
{ "name": "engineering" },
|
|
1849
|
+
{ "name": "compact" },
|
|
1850
|
+
{ "name": "default" }
|
|
1851
|
+
]
|
|
1852
|
+
},
|
|
1853
|
+
{
|
|
1854
|
+
"name": "compact-display",
|
|
1855
|
+
"description": "Compact notation display: 'short' | 'long'. Only applies when notation is compact.",
|
|
1856
|
+
"values": [
|
|
1857
|
+
{ "name": "short" },
|
|
1858
|
+
{ "name": "long" },
|
|
1859
|
+
{ "name": "default" }
|
|
1860
|
+
]
|
|
1861
|
+
},
|
|
1862
|
+
{
|
|
1863
|
+
"name": "sign-display",
|
|
1864
|
+
"description": "Sign display: 'auto' | 'never' | 'always' | 'exceptZero'.",
|
|
1865
|
+
"values": [
|
|
1866
|
+
{ "name": "auto" },
|
|
1867
|
+
{ "name": "never" },
|
|
1868
|
+
{ "name": "always" },
|
|
1869
|
+
{ "name": "exceptZero" },
|
|
1870
|
+
{ "name": "default" }
|
|
1871
|
+
]
|
|
1872
|
+
},
|
|
1873
|
+
{
|
|
1874
|
+
"name": "use-grouping",
|
|
1875
|
+
"description": "Grouping separators: 'auto' | 'always' | 'min2' | 'true' | 'false'.",
|
|
1876
|
+
"values": [{ "name": "default" }]
|
|
1877
|
+
},
|
|
1878
|
+
{
|
|
1879
|
+
"name": "minimum-fraction-digits",
|
|
1880
|
+
"description": "Pad fraction output to at least this many digits (0-20).",
|
|
1881
|
+
"values": [{ "name": "default" }]
|
|
1882
|
+
},
|
|
1883
|
+
{
|
|
1884
|
+
"name": "maximum-fraction-digits",
|
|
1885
|
+
"description": "Round fraction output to at most this many digits (0-20).",
|
|
1886
|
+
"values": [{ "name": "default" }]
|
|
1887
|
+
},
|
|
1888
|
+
{
|
|
1889
|
+
"name": "minimum-integer-digits",
|
|
1890
|
+
"description": "Pad integer output to at least this many digits (1-21).",
|
|
1891
|
+
"values": [{ "name": "default" }]
|
|
1892
|
+
}
|
|
1893
|
+
],
|
|
1894
|
+
"references": []
|
|
1895
|
+
},
|
|
1778
1896
|
{
|
|
1779
1897
|
"name": "nve-format-relative-time",
|
|
1780
1898
|
"description": "Formats a date/time value as localized relative text using the Intl.RelativeTimeFormat API. Renders inside a semantic time element.\nOptions mirror the Intl.RelativeTimeFormat API. When unit is 'auto', the component selects the best unit based on the time difference.\n---\n\n\n### **Slots:**\n - _default_ - Date string to format (such as 2023-07-28T04:20:17.434Z). Serves as fallback before hydration.",
|
|
@@ -3023,7 +3141,7 @@
|
|
|
3023
3141
|
},
|
|
3024
3142
|
{
|
|
3025
3143
|
"name": "markdown",
|
|
3026
|
-
"url": "## nve-logo\n\nA visual indicator for a brand or application.\n\n### Example\n\n```html\n<nve-logo aria-label=\"NVIDIA\"
|
|
3144
|
+
"url": "## nve-logo\n\nA visual indicator for a brand or application.\n\n### Example\n\n```html\n<nve-logo aria-label=\"NVIDIA\">NV</nve-logo>\n```\n\n### Import\n\n```javascript\nimport '@nvidia-elements/core/logo/define.js';\n```\n\n### Slots\n\n| name | value | description |\n| ---- | ----- | ----------- |\n| (default) | `string` | default slot for content |\n\n### Properties / Attributes\n\n| property (attribute) | value | description |\n| -------------------- | ----- | ----------- |\n| color | `'red-cardinal' \\| 'gray-slate' \\| 'gray-denim' \\| 'blue-indigo' \\| 'blue-cobalt' \\| 'blue-sky' \\| 'teal-cyan' \\| 'green-mint' \\| 'teal-seafoam' \\| 'green-grass' \\| 'yellow-amber' \\| 'orange-pumpkin' \\| 'red-tomato' \\| 'pink-magenta' \\| 'purple-plum' \\| 'purple-violet' \\| 'purple-lavender' \\| 'pink-rose' \\| 'green-jade' \\| 'lime-pear' \\| 'yellow-nova' \\| 'brand-green'` | Defines a base color from the theme color palette |\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| --gap | `string` | [MDN](https://mdn.dev/CSS/gap) |\n| --color | `string` | [MDN](https://mdn.dev/CSS/color) |\n| --height | `string` | [MDN](https://mdn.dev/CSS/height) |\n| --width | `string` | [MDN](https://mdn.dev/CSS/width) |\n| --font-size | `string` | [MDN](https://mdn.dev/CSS/font-size) |\n| --border-radius | `string` | [MDN](https://mdn.dev/CSS/border-radius) |\n| --font-weight | `string` | [MDN](https://mdn.dev/CSS/font-weight) |"
|
|
3027
3145
|
}
|
|
3028
3146
|
]
|
|
3029
3147
|
},
|
package/dist/data.snippets.json
CHANGED
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
],
|
|
79
79
|
"type": "pattern",
|
|
80
80
|
"description": "Basic page-header layout.",
|
|
81
|
-
"body": "<nve-page-header slot=\"header\">\n <nve-logo slot=\"prefix\" size=\"sm\"
|
|
81
|
+
"body": "<nve-page-header slot=\"header\">\n <nve-logo slot=\"prefix\" size=\"sm\">NV</nve-logo>\n <h2 slot=\"prefix\">${1:NVIDIA}</h2>\n</nve-page-header>\n"
|
|
82
82
|
},
|
|
83
83
|
"Page Header with Links": {
|
|
84
84
|
"srcFile": "page-header.snippets.html",
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
],
|
|
88
88
|
"type": "pattern",
|
|
89
89
|
"description": "Basic page-header layout with links.",
|
|
90
|
-
"body": "<nve-page-header slot=\"header\">\n <nve-logo slot=\"prefix\" size=\"sm\"
|
|
90
|
+
"body": "<nve-page-header slot=\"header\">\n <nve-logo slot=\"prefix\" size=\"sm\">NV</nve-logo>\n <h2 slot=\"prefix\">${1:NVIDIA}</h2>\n <nve-button selected container=\"flat\"><a href=\"#\">${2:Link 1}</a></nve-button>\n <nve-button container=\"flat\"><a href=\"#\">${3:Link 2}</a></nve-button>\n</nve-page-header>\n"
|
|
91
91
|
},
|
|
92
92
|
"Page": {
|
|
93
93
|
"srcFile": "page.snippets.html",
|
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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define.js","names":[],"sources":["../../src/format-number/define.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { define } from '@nvidia-elements/core/internal';\nimport { FormatNumber } from '@nvidia-elements/core/format-number';\n\ndefine(FormatNumber);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nve-format-number': FormatNumber;\n }\n}\n"],"mappings":";;;AAMA,EAAO,EAAa"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
export type FormatNumberStyle = 'decimal' | 'currency' | 'percent' | 'unit';
|
|
3
|
+
export type CurrencyDisplayOption = 'symbol' | 'code' | 'name' | 'narrowSymbol';
|
|
4
|
+
export type CurrencySignOption = 'standard' | 'accounting';
|
|
5
|
+
export type NotationOption = 'standard' | 'scientific' | 'engineering' | 'compact';
|
|
6
|
+
export type CompactDisplayOption = 'short' | 'long';
|
|
7
|
+
export type UnitDisplayOption = 'short' | 'long' | 'narrow';
|
|
8
|
+
export type SignDisplayOption = 'auto' | 'never' | 'always' | 'exceptZero';
|
|
9
|
+
/**
|
|
10
|
+
* @element nve-format-number
|
|
11
|
+
* @description A localized number formatter for currencies, percentages, units, and compact notation, backed by Intl.NumberFormat.
|
|
12
|
+
* Provide a `currency` attribute when `formatStyle` is `currency`, and a `unit` attribute when `formatStyle` is `unit`.
|
|
13
|
+
* @since 0.0.0
|
|
14
|
+
* @entrypoint \@nvidia-elements/core/format-number
|
|
15
|
+
* @slot - Numeric string to format (such as 1234567 or 1234.56). Serves as fallback before hydration.
|
|
16
|
+
*/
|
|
17
|
+
export declare class FormatNumber extends LitElement {
|
|
18
|
+
#private;
|
|
19
|
+
static styles: import('lit').CSSResult[];
|
|
20
|
+
static readonly metadata: {
|
|
21
|
+
tag: string;
|
|
22
|
+
version: string;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Optional numeric string for values supplied by JavaScript or bound data.
|
|
26
|
+
* By default, the component formats the element's text content, which also serves as the SSR fallback.
|
|
27
|
+
* When both are present, this property takes precedence.
|
|
28
|
+
*/
|
|
29
|
+
number?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Language tag (such as en-US, de-DE). Defaults to document.documentElement.lang or browser default.
|
|
32
|
+
*/
|
|
33
|
+
locale?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Formatting style: 'decimal' | 'currency' | 'percent' | 'unit'.
|
|
36
|
+
*/
|
|
37
|
+
formatStyle: FormatNumberStyle;
|
|
38
|
+
/**
|
|
39
|
+
* ISO 4217 currency code (such as USD or EUR). Required when formatStyle is currency.
|
|
40
|
+
*/
|
|
41
|
+
currency?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Currency sign style: 'standard' | 'accounting'.
|
|
44
|
+
*/
|
|
45
|
+
currencySign?: CurrencySignOption;
|
|
46
|
+
/**
|
|
47
|
+
* Currency display style: 'symbol' | 'code' | 'name' | 'narrowSymbol'.
|
|
48
|
+
*/
|
|
49
|
+
currencyDisplay?: CurrencyDisplayOption;
|
|
50
|
+
/**
|
|
51
|
+
* Unit identifier (such as kilometer or byte). Required when formatStyle is unit.
|
|
52
|
+
*/
|
|
53
|
+
unit?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Unit display style: 'short' | 'long' | 'narrow'.
|
|
56
|
+
*/
|
|
57
|
+
unitDisplay?: UnitDisplayOption;
|
|
58
|
+
/**
|
|
59
|
+
* Number notation: 'standard' | 'scientific' | 'engineering' | 'compact'.
|
|
60
|
+
*/
|
|
61
|
+
notation?: NotationOption;
|
|
62
|
+
/**
|
|
63
|
+
* Compact notation display: 'short' | 'long'. Only applies when notation is compact.
|
|
64
|
+
*/
|
|
65
|
+
compactDisplay?: CompactDisplayOption;
|
|
66
|
+
/**
|
|
67
|
+
* Sign display: 'auto' | 'never' | 'always' | 'exceptZero'.
|
|
68
|
+
*/
|
|
69
|
+
signDisplay?: SignDisplayOption;
|
|
70
|
+
/**
|
|
71
|
+
* Grouping separators: 'auto' | 'always' | 'min2' | 'true' | 'false'.
|
|
72
|
+
*/
|
|
73
|
+
useGrouping?: string;
|
|
74
|
+
/**
|
|
75
|
+
* Pad fraction output to at least this many digits (0-20).
|
|
76
|
+
*/
|
|
77
|
+
minimumFractionDigits?: number;
|
|
78
|
+
/**
|
|
79
|
+
* Round fraction output to at most this many digits (0-20).
|
|
80
|
+
*/
|
|
81
|
+
maximumFractionDigits?: number;
|
|
82
|
+
/**
|
|
83
|
+
* Pad integer output to at least this many digits (1-21).
|
|
84
|
+
*/
|
|
85
|
+
minimumIntegerDigits?: number;
|
|
86
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
87
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-number.examples.js","names":[],"sources":["../../src/format-number/format-number.examples.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 '@nvidia-elements/core/format-number/define.js';\n\nexport default {\n title: 'Elements/FormatNumber',\n component: 'nve-format-number'\n};\n\n/**\n * @summary Basic decimal formatting with localized grouping separators. Use for inline counts and metrics.\n */\nexport const Default = {\n render: () => html`\n <nve-format-number>1234567.89</nve-format-number>\n `\n};\n\n/**\n * @summary Currency formatting for monetary values with locale-aware symbols and separators. Use for prices, budgets, and financial totals.\n */\nexport const Currency = {\n render: () => html`\n<div nve-layout=\"column gap:sm\">\n <nve-format-number format-style=\"currency\" currency=\"USD\">1234.56</nve-format-number>\n <nve-format-number format-style=\"currency\" currency=\"EUR\" currency-display=\"code\">1234.56</nve-format-number>\n <nve-format-number format-style=\"currency\" currency=\"JPY\" currency-display=\"name\">1234</nve-format-number>\n</div>\n `\n};\n\n/**\n * @summary Percent formatting for ratios and completion values. Source values should already represent a fraction (such as 0.85 for 85 percent).\n */\nexport const Percent = {\n render: () => html`\n<div nve-layout=\"column gap:sm\">\n <nve-format-number format-style=\"percent\">0.85</nve-format-number>\n <nve-format-number format-style=\"percent\">0.126</nve-format-number>\n</div>\n `\n};\n\n/**\n * @summary Unit formatting for measurements and quantities. Use for distances, storage sizes, or other numeric labels that need a localized unit suffix.\n */\nexport const Unit = {\n render: () => html`\n<div nve-layout=\"column gap:sm\">\n <nve-format-number format-style=\"unit\" unit=\"kilometer\">1234.56</nve-format-number>\n <nve-format-number format-style=\"unit\" unit=\"byte\" unit-display=\"long\">2048</nve-format-number>\n <nve-format-number format-style=\"unit\" unit=\"celsius\" unit-display=\"narrow\">22</nve-format-number>\n</div>\n `\n};\n\n/**\n * @summary Notation presets for scientific, engineering, and compact display. Use compact notation in dashboards or cards where space matters.\n */\nexport const Notation = {\n render: () => html`\n<div nve-layout=\"column gap:sm\">\n <nve-format-number notation=\"compact\" compact-display=\"short\">1234567</nve-format-number>\n <nve-format-number notation=\"compact\" compact-display=\"long\">1234567</nve-format-number>\n <nve-format-number notation=\"scientific\">1234567</nve-format-number>\n <nve-format-number notation=\"engineering\">1234567</nve-format-number>\n</div>\n `\n};\n\n/**\n * @summary Sign display options for controlling positive and negative indicators. Use 'always' for delta values or 'exceptZero' for change indicators.\n */\nexport const SignDisplay = {\n render: () => html`\n<div nve-layout=\"column gap:sm\">\n <nve-format-number sign-display=\"always\">42</nve-format-number>\n <nve-format-number sign-display=\"always\">-42</nve-format-number>\n <nve-format-number sign-display=\"exceptZero\">0</nve-format-number>\n <nve-format-number sign-display=\"never\">-42</nve-format-number>\n</div>\n `\n};\n\n/**\n * @summary Fraction digit control for tuning decimal precision. Use to enforce fixed decimal places in financial or scientific contexts.\n */\nexport const FractionDigits = {\n render: () => html`\n<div nve-layout=\"column gap:sm\">\n <nve-format-number minimum-fraction-digits=\"4\">1.5</nve-format-number>\n <nve-format-number maximum-fraction-digits=\"0\">1.567</nve-format-number>\n <nve-format-number minimum-fraction-digits=\"2\" maximum-fraction-digits=\"2\">3</nve-format-number>\n</div>\n `\n};\n\n/**\n * @summary Explicit locale settings for internationalized number output. Use when the target audience locale differs from the document language or browser default.\n */\nexport const Locale = {\n render: () => html`\n<div nve-layout=\"column gap:sm\">\n <nve-format-number locale=\"de-DE\" format-style=\"currency\" currency=\"EUR\">1234.56</nve-format-number>\n <nve-format-number locale=\"ja-JP\" format-style=\"currency\" currency=\"JPY\">1234</nve-format-number>\n <nve-format-number locale=\"fr-FR\">1234567.89</nve-format-number>\n</div>\n `\n};\n\n/**\n * @summary Number attribute input for values supplied by JavaScript or bound data. By default, the component formats text content, which also serves as the SSR fallback, and `number` wins when both are present.\n */\nexport const NumberAttribute = {\n render: () => html`\n <nve-format-number number=\"1234.56\" format-style=\"currency\" currency=\"USD\"></nve-format-number>\n `\n};"],"mappings":";AAGA,IAAA,IAAS"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
{
|
|
2
|
+
"element": "nve-format-number",
|
|
3
|
+
"entrypoint": "@nvidia-elements/core/format-number/format-number.examples.json",
|
|
4
|
+
"items": [
|
|
5
|
+
{
|
|
6
|
+
"id": "format-number",
|
|
7
|
+
"name": "Default",
|
|
8
|
+
"template": "<nve-format-number>1234567.89</nve-format-number>\n",
|
|
9
|
+
"summary": "Basic decimal formatting with localized grouping separators. Use for inline counts and metrics.",
|
|
10
|
+
"description": "",
|
|
11
|
+
"composition": false,
|
|
12
|
+
"tags": []
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"id": "format-number-currency",
|
|
16
|
+
"name": "Currency",
|
|
17
|
+
"template": "<div nve-layout=\"column gap:sm\">\n <nve-format-number format-style=\"currency\" currency=\"USD\">1234.56</nve-format-number>\n <nve-format-number format-style=\"currency\" currency=\"EUR\" currency-display=\"code\">1234.56</nve-format-number>\n <nve-format-number format-style=\"currency\" currency=\"JPY\" currency-display=\"name\">1234</nve-format-number>\n</div>\n",
|
|
18
|
+
"summary": "Currency formatting for monetary values with locale-aware symbols and separators. Use for prices, budgets, and financial totals.",
|
|
19
|
+
"description": "",
|
|
20
|
+
"composition": false,
|
|
21
|
+
"tags": []
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"id": "format-number-percent",
|
|
25
|
+
"name": "Percent",
|
|
26
|
+
"template": "<div nve-layout=\"column gap:sm\">\n <nve-format-number format-style=\"percent\">0.85</nve-format-number>\n <nve-format-number format-style=\"percent\">0.126</nve-format-number>\n</div>\n",
|
|
27
|
+
"summary": "Percent formatting for ratios and completion values. Source values should already represent a fraction (such as 0.85 for 85 percent).",
|
|
28
|
+
"description": "",
|
|
29
|
+
"composition": false,
|
|
30
|
+
"tags": []
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"id": "format-number-unit",
|
|
34
|
+
"name": "Unit",
|
|
35
|
+
"template": "<div nve-layout=\"column gap:sm\">\n <nve-format-number format-style=\"unit\" unit=\"kilometer\">1234.56</nve-format-number>\n <nve-format-number format-style=\"unit\" unit=\"byte\" unit-display=\"long\">2048</nve-format-number>\n <nve-format-number format-style=\"unit\" unit=\"celsius\" unit-display=\"narrow\">22</nve-format-number>\n</div>\n",
|
|
36
|
+
"summary": "Unit formatting for measurements and quantities. Use for distances, storage sizes, or other numeric labels that need a localized unit suffix.",
|
|
37
|
+
"description": "",
|
|
38
|
+
"composition": false,
|
|
39
|
+
"tags": []
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"id": "format-number-notation",
|
|
43
|
+
"name": "Notation",
|
|
44
|
+
"template": "<div nve-layout=\"column gap:sm\">\n <nve-format-number notation=\"compact\" compact-display=\"short\">1234567</nve-format-number>\n <nve-format-number notation=\"compact\" compact-display=\"long\">1234567</nve-format-number>\n <nve-format-number notation=\"scientific\">1234567</nve-format-number>\n <nve-format-number notation=\"engineering\">1234567</nve-format-number>\n</div>\n",
|
|
45
|
+
"summary": "Notation presets for scientific, engineering, and compact display. Use compact notation in dashboards or cards where space matters.",
|
|
46
|
+
"description": "",
|
|
47
|
+
"composition": false,
|
|
48
|
+
"tags": []
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"id": "format-number-sign-display",
|
|
52
|
+
"name": "SignDisplay",
|
|
53
|
+
"template": "<div nve-layout=\"column gap:sm\">\n <nve-format-number sign-display=\"always\">42</nve-format-number>\n <nve-format-number sign-display=\"always\">-42</nve-format-number>\n <nve-format-number sign-display=\"exceptZero\">0</nve-format-number>\n <nve-format-number sign-display=\"never\">-42</nve-format-number>\n</div>\n",
|
|
54
|
+
"summary": "Sign display options for controlling positive and negative indicators. Use 'always' for delta values or 'exceptZero' for change indicators.",
|
|
55
|
+
"description": "",
|
|
56
|
+
"composition": false,
|
|
57
|
+
"tags": []
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"id": "format-number-fraction-digits",
|
|
61
|
+
"name": "FractionDigits",
|
|
62
|
+
"template": "<div nve-layout=\"column gap:sm\">\n <nve-format-number minimum-fraction-digits=\"4\">1.5</nve-format-number>\n <nve-format-number maximum-fraction-digits=\"0\">1.567</nve-format-number>\n <nve-format-number minimum-fraction-digits=\"2\" maximum-fraction-digits=\"2\">3</nve-format-number>\n</div>\n",
|
|
63
|
+
"summary": "Fraction digit control for tuning decimal precision. Use to enforce fixed decimal places in financial or scientific contexts.",
|
|
64
|
+
"description": "",
|
|
65
|
+
"composition": false,
|
|
66
|
+
"tags": []
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"id": "format-number-locale",
|
|
70
|
+
"name": "Locale",
|
|
71
|
+
"template": "<div nve-layout=\"column gap:sm\">\n <nve-format-number locale=\"de-DE\" format-style=\"currency\" currency=\"EUR\">1234.56</nve-format-number>\n <nve-format-number locale=\"ja-JP\" format-style=\"currency\" currency=\"JPY\">1234</nve-format-number>\n <nve-format-number locale=\"fr-FR\">1234567.89</nve-format-number>\n</div>\n",
|
|
72
|
+
"summary": "Explicit locale settings for internationalized number output. Use when the target audience locale differs from the document language or browser default.",
|
|
73
|
+
"description": "",
|
|
74
|
+
"composition": false,
|
|
75
|
+
"tags": []
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"id": "format-number-number-attribute",
|
|
79
|
+
"name": "NumberAttribute",
|
|
80
|
+
"template": "<nve-format-number number=\"1234.56\" format-style=\"currency\" currency=\"USD\"></nve-format-number>\n",
|
|
81
|
+
"summary": "Number attribute input for values supplied by JavaScript or bound data. By default, the component formats text content, which also serves as the SSR fallback, and `number` wins when both are present.",
|
|
82
|
+
"description": "",
|
|
83
|
+
"composition": false,
|
|
84
|
+
"tags": []
|
|
85
|
+
}
|
|
86
|
+
]
|
|
87
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-number.js","names":[],"sources":["../../src/format-number/format-number.css?inline"],"sourcesContent":["/* SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. */\n/* SPDX-License-Identifier: Apache-2.0 */\n\n:host {\n display: inline;\n}\n\n[internal-host] {\n color: var(--nve-sys-text-color, inherit);\n}\n\nslot {\n display: none;\n}\n"],"mappings":""}
|