@redvars/peacock 3.2.7 → 3.2.8
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/dist/PeacockComponent-DMrFEGDh.js +80 -0
- package/dist/PeacockComponent-DMrFEGDh.js.map +1 -0
- package/dist/breadcrumb-item-DkhwoMAH.js +6879 -0
- package/dist/breadcrumb-item-DkhwoMAH.js.map +1 -0
- package/dist/button-BtpAXuLN.js +1180 -0
- package/dist/button-BtpAXuLN.js.map +1 -0
- package/dist/button-group.js +7 -6
- package/dist/button-group.js.map +1 -1
- package/dist/button.js +5 -0
- package/dist/button.js.map +1 -0
- package/dist/{class-map-BmCohX9p.js → class-map-CbncA34D.js} +2 -3
- package/dist/class-map-CbncA34D.js.map +1 -0
- package/dist/code-highlighter.js +9 -8
- package/dist/code-highlighter.js.map +1 -1
- package/dist/custom-elements.json +28 -0
- package/dist/index.js +87 -35
- package/dist/index.js.map +1 -1
- package/dist/number-counter.js +7 -6
- package/dist/number-counter.js.map +1 -1
- package/dist/peacock-loader.js +963 -38
- package/dist/peacock-loader.js.map +1 -1
- package/dist/src/PeacockComponent.d.ts +1 -0
- package/dist/{state-CV1fRmOT.js → state-CEVpI7Vv.js} +2 -2
- package/dist/{state-CV1fRmOT.js.map → state-CEVpI7Vv.js.map} +1 -1
- package/dist/{style-map-CdmclYgz.js → style-map-mOmZwsJT.js} +2 -3
- package/dist/style-map-mOmZwsJT.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/{unsafe-html-BS8X6Gto.js → unsafe-html-Ca00SXpn.js} +2 -3
- package/dist/unsafe-html-Ca00SXpn.js.map +1 -0
- package/package.json +1 -1
- package/readme.md +2 -2
- package/src/PeacockComponent.ts +3 -0
- package/src/button/button/button.ts +3 -1
- package/src/button/button-group/button-group.ts +2 -0
- package/src/code-highlighter/code-highlighter.ts +2 -0
- package/src/number-counter/number-counter.ts +2 -0
- package/dist/BaseButton.js +0 -209
- package/dist/BaseButton.js.map +0 -1
- package/dist/BaseInput.js +0 -27
- package/dist/BaseInput.js.map +0 -1
- package/dist/accordion-item.js +0 -191
- package/dist/accordion-item.js.map +0 -1
- package/dist/accordion.js +0 -142
- package/dist/accordion.js.map +0 -1
- package/dist/avatar.js +0 -106
- package/dist/avatar.js.map +0 -1
- package/dist/badge.js +0 -84
- package/dist/badge.js.map +0 -1
- package/dist/base-progress.js +0 -33
- package/dist/base-progress.js.map +0 -1
- package/dist/breadcrumb-item.js +0 -160
- package/dist/breadcrumb-item.js.map +0 -1
- package/dist/breadcrumb.js +0 -84
- package/dist/breadcrumb.js.map +0 -1
- package/dist/checkbox.js +0 -530
- package/dist/checkbox.js.map +0 -1
- package/dist/chip.js +0 -303
- package/dist/chip.js.map +0 -1
- package/dist/class-map-BmCohX9p.js.map +0 -1
- package/dist/clock.js +0 -83
- package/dist/clock.js.map +0 -1
- package/dist/container.js +0 -135
- package/dist/container.js.map +0 -1
- package/dist/directive-Cuw6h7YA.js +0 -9
- package/dist/directive-Cuw6h7YA.js.map +0 -1
- package/dist/divider.js +0 -126
- package/dist/divider.js.map +0 -1
- package/dist/elevation.js +0 -79
- package/dist/elevation.js.map +0 -1
- package/dist/empty-state.js +0 -171
- package/dist/empty-state.js.map +0 -1
- package/dist/field.js +0 -416
- package/dist/field.js.map +0 -1
- package/dist/focus-ring.js +0 -107
- package/dist/focus-ring.js.map +0 -1
- package/dist/icon.js +0 -183
- package/dist/icon.js.map +0 -1
- package/dist/link.js +0 -91
- package/dist/link.js.map +0 -1
- package/dist/lit-element-CA46RFZ_.js +0 -28
- package/dist/lit-element-CA46RFZ_.js.map +0 -1
- package/dist/menu-item.js +0 -232
- package/dist/menu-item.js.map +0 -1
- package/dist/menu-list.js +0 -108
- package/dist/menu-list.js.map +0 -1
- package/dist/menu.js +0 -117
- package/dist/menu.js.map +0 -1
- package/dist/property-DNVWDdPC.js +0 -45
- package/dist/property-DNVWDdPC.js.map +0 -1
- package/dist/query-QBcUV-L_.js +0 -15
- package/dist/query-QBcUV-L_.js.map +0 -1
- package/dist/ripple.js +0 -128
- package/dist/ripple.js.map +0 -1
- package/dist/skeleton.js +0 -113
- package/dist/skeleton.js.map +0 -1
- package/dist/spinner.js +0 -93
- package/dist/spinner.js.map +0 -1
- package/dist/spread-axRTFMoH.js +0 -32
- package/dist/spread-axRTFMoH.js.map +0 -1
- package/dist/style-map-CdmclYgz.js.map +0 -1
- package/dist/switch-DqxIiVsB.js +0 -2738
- package/dist/switch-DqxIiVsB.js.map +0 -1
- package/dist/tag.js +0 -323
- package/dist/tag.js.map +0 -1
- package/dist/tooltip.js +0 -1857
- package/dist/tooltip.js.map +0 -1
- package/dist/unsafe-html-BS8X6Gto.js.map +0 -1
- package/dist/utils-DGMeCC48.js +0 -273
- package/dist/utils-DGMeCC48.js.map +0 -1
|
@@ -257,6 +257,34 @@
|
|
|
257
257
|
}
|
|
258
258
|
]
|
|
259
259
|
},
|
|
260
|
+
{
|
|
261
|
+
"kind": "javascript-module",
|
|
262
|
+
"path": "src/PeacockComponent.ts",
|
|
263
|
+
"declarations": [
|
|
264
|
+
{
|
|
265
|
+
"kind": "function",
|
|
266
|
+
"name": "PeacockComponent",
|
|
267
|
+
"parameters": [
|
|
268
|
+
{
|
|
269
|
+
"name": "constructor",
|
|
270
|
+
"type": {
|
|
271
|
+
"text": "Function"
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
]
|
|
275
|
+
}
|
|
276
|
+
],
|
|
277
|
+
"exports": [
|
|
278
|
+
{
|
|
279
|
+
"kind": "js",
|
|
280
|
+
"name": "default",
|
|
281
|
+
"declaration": {
|
|
282
|
+
"name": "PeacockComponent",
|
|
283
|
+
"module": "src/PeacockComponent.ts"
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
]
|
|
287
|
+
},
|
|
260
288
|
{
|
|
261
289
|
"kind": "javascript-module",
|
|
262
290
|
"path": "src/constants.ts",
|
package/dist/index.js
CHANGED
|
@@ -1,39 +1,91 @@
|
|
|
1
|
-
export { Icon } from './
|
|
2
|
-
|
|
3
|
-
export {
|
|
4
|
-
export { Divider } from './divider.js';
|
|
5
|
-
export { Clock } from './clock.js';
|
|
6
|
-
export { Elevation } from './elevation.js';
|
|
7
|
-
export { B as Button, C as CircularProgress, D as DatePicker, I as IconButton, a as Input, L as LinearProgress, N as NumberField, S as Switch, T as Textarea, b as TimePicker } from './switch-DqxIiVsB.js';
|
|
1
|
+
export { A as Accordion, a as Avatar, B as Badge, b as Breadcrumb, c as BreadcrumbItem, C as Chip, d as CircularProgress, e as Container, D as DatePicker, f as Divider, E as Elevation, g as EmptyState, F as Field, h as FocusRing, I as Icon, i as IconButton, j as Input, L as LinearProgress, k as Link, N as NumberField, R as Ripple, S as Skeleton, l as Spinner, m as Switch, T as Tag, n as Textarea, o as TimePicker, p as Tooltip } from './breadcrumb-item-DkhwoMAH.js';
|
|
2
|
+
import { i, _ as __decorate, n, a as i$1, b } from './PeacockComponent-DMrFEGDh.js';
|
|
3
|
+
export { B as Button } from './button-BtpAXuLN.js';
|
|
8
4
|
export { ButtonGroup } from './button-group.js';
|
|
9
|
-
export { FocusRing } from './focus-ring.js';
|
|
10
|
-
export { Ripple } from './ripple.js';
|
|
11
|
-
export { Accordion } from './accordion.js';
|
|
12
|
-
export { Link } from './link.js';
|
|
13
|
-
export { Tag } from './tag.js';
|
|
14
|
-
export { Chip } from './chip.js';
|
|
15
|
-
export { Skeleton } from './skeleton.js';
|
|
16
|
-
export { Field } from './field.js';
|
|
17
|
-
export { Spinner } from './spinner.js';
|
|
18
|
-
export { Container } from './container.js';
|
|
19
5
|
export { NumberCounter } from './number-counter.js';
|
|
20
|
-
export { EmptyState } from './empty-state.js';
|
|
21
|
-
export { Tooltip } from './tooltip.js';
|
|
22
|
-
export { Breadcrumb } from './breadcrumb.js';
|
|
23
|
-
export { BreadcrumbItem } from './breadcrumb-item.js';
|
|
24
6
|
export { CodeHighlighter } from './code-highlighter.js';
|
|
25
|
-
import './
|
|
26
|
-
import './
|
|
27
|
-
import './
|
|
28
|
-
import './
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
7
|
+
import './state-CEVpI7Vv.js';
|
|
8
|
+
import './unsafe-html-Ca00SXpn.js';
|
|
9
|
+
import './class-map-CbncA34D.js';
|
|
10
|
+
import './style-map-mOmZwsJT.js';
|
|
11
|
+
|
|
12
|
+
var css_248z = i`* {
|
|
13
|
+
box-sizing: border-box;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.screen-reader-only {
|
|
17
|
+
display: none !important;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
:host {
|
|
21
|
+
display: inline-block;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.current-time {
|
|
25
|
+
font-family: var(--typography-body-medium-font-family) !important;
|
|
26
|
+
font-size: var(--typography-body-medium-font-size) !important;
|
|
27
|
+
font-weight: var(--typography-body-medium-font-weight) !important;
|
|
28
|
+
line-height: var(--typography-body-medium-line-height) !important;
|
|
29
|
+
letter-spacing: var(--typography-body-medium-letter-spacing) !important;
|
|
30
|
+
}`;
|
|
31
|
+
|
|
32
|
+
class ClockController {
|
|
33
|
+
constructor(host, timeout = 1000) {
|
|
34
|
+
this.value = new Date();
|
|
35
|
+
this.host = host;
|
|
36
|
+
this.host.addController(this);
|
|
37
|
+
this.timeout = timeout;
|
|
38
|
+
}
|
|
39
|
+
hostConnected() {
|
|
40
|
+
// Start a timer when the host is connected
|
|
41
|
+
this._timerID = setInterval(() => {
|
|
42
|
+
this.value = new Date();
|
|
43
|
+
// Update the host with new value
|
|
44
|
+
this.host.requestUpdate();
|
|
45
|
+
}, this.timeout);
|
|
46
|
+
}
|
|
47
|
+
hostDisconnected() {
|
|
48
|
+
// Clear the timer when the host is disconnected
|
|
49
|
+
clearInterval(this._timerID);
|
|
50
|
+
this._timerID = undefined;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* @label Clock
|
|
56
|
+
* @tag base-clock
|
|
57
|
+
* @rawTag clock
|
|
58
|
+
*
|
|
59
|
+
* @summary Displays the current time in a given timezone.
|
|
60
|
+
* @overview
|
|
61
|
+
* - Clocks are used to display the current time in a specified timezone.
|
|
62
|
+
* - They can be displayed in various formats, including 12-hour and 24-hour time.
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```html
|
|
66
|
+
* <base-clock></base-clock>
|
|
67
|
+
* ```
|
|
68
|
+
* @tags display
|
|
69
|
+
*/
|
|
70
|
+
class Clock extends i$1 {
|
|
71
|
+
constructor() {
|
|
72
|
+
super(...arguments);
|
|
73
|
+
this.clockController = new ClockController(this, 100);
|
|
74
|
+
}
|
|
75
|
+
__formatDate(date) {
|
|
76
|
+
return date.toLocaleTimeString('en-US', {
|
|
77
|
+
timeZone: this.timezone,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
render() {
|
|
81
|
+
const currentDate = this.__formatDate(this.clockController.value);
|
|
82
|
+
return b `<div class="current-time">${currentDate}</div>`;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
Clock.styles = [css_248z];
|
|
86
|
+
__decorate([
|
|
87
|
+
n()
|
|
88
|
+
], Clock.prototype, "timezone", void 0);
|
|
89
|
+
|
|
90
|
+
export { Clock };
|
|
39
91
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/clock/ClockController.ts","../../src/clock/clock.ts"],"sourcesContent":["import { ReactiveController, ReactiveControllerHost } from 'lit';\n\nexport class ClockController implements ReactiveController {\n host: ReactiveControllerHost;\n\n value = new Date();\n\n timeout: number;\n\n private _timerID?: any;\n\n constructor(host: ReactiveControllerHost, timeout = 1000) {\n this.host = host;\n this.host.addController(this);\n this.timeout = timeout;\n }\n\n hostConnected() {\n // Start a timer when the host is connected\n this._timerID = setInterval(() => {\n this.value = new Date();\n // Update the host with new value\n this.host.requestUpdate();\n }, this.timeout);\n }\n\n hostDisconnected() {\n // Clear the timer when the host is disconnected\n clearInterval(this._timerID);\n this._timerID = undefined;\n }\n}\n","import { html, LitElement } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport styles from './clock.scss';\nimport { ClockController } from './ClockController.js';\n\n/**\n * @label Clock\n * @tag base-clock\n * @rawTag clock\n *\n * @summary Displays the current time in a given timezone.\n * @overview\n * - Clocks are used to display the current time in a specified timezone.\n * - They can be displayed in various formats, including 12-hour and 24-hour time.\n *\n * @example\n * ```html\n * <base-clock></base-clock>\n * ```\n * @tags display\n */\nexport class Clock extends LitElement {\n static styles = [styles];\n\n clockController = new ClockController(this, 100);\n\n @property() timezone?: string;\n\n __formatDate(date: Date) {\n return date.toLocaleTimeString('en-US', {\n timeZone: this.timezone,\n });\n }\n\n render() {\n const currentDate = this.__formatDate(this.clockController.value);\n return html`<div class=\"current-time\">${currentDate}</div>`;\n }\n}\n"],"names":["LitElement","html","styles","property"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAEa,eAAe,CAAA;AAS1B,IAAA,WAAA,CAAY,IAA4B,EAAE,OAAO,GAAG,IAAI,EAAA;AANxD,QAAA,IAAA,CAAA,KAAK,GAAG,IAAI,IAAI,EAAE;AAOhB,QAAA,IAAI,CAAC,IAAI,GAAG,IAAI;AAChB,QAAA,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC;AAC7B,QAAA,IAAI,CAAC,OAAO,GAAG,OAAO;IACxB;IAEA,aAAa,GAAA;;AAEX,QAAA,IAAI,CAAC,QAAQ,GAAG,WAAW,CAAC,MAAK;AAC/B,YAAA,IAAI,CAAC,KAAK,GAAG,IAAI,IAAI,EAAE;;AAEvB,YAAA,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE;AAC3B,QAAA,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC;IAClB;IAEA,gBAAgB,GAAA;;AAEd,QAAA,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC;AAC5B,QAAA,IAAI,CAAC,QAAQ,GAAG,SAAS;IAC3B;AACD;;AC1BD;;;;;;;;;;;;;;;AAeG;AACG,MAAO,KAAM,SAAQA,GAAU,CAAA;AAArC,IAAA,WAAA,GAAA;;QAGE,IAAA,CAAA,eAAe,GAAG,IAAI,eAAe,CAAC,IAAI,EAAE,GAAG,CAAC;IAclD;AAVE,IAAA,YAAY,CAAC,IAAU,EAAA;AACrB,QAAA,OAAO,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE;YACtC,QAAQ,EAAE,IAAI,CAAC,QAAQ;AACxB,SAAA,CAAC;IACJ;IAEA,MAAM,GAAA;AACJ,QAAA,MAAM,WAAW,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC;AACjE,QAAA,OAAOC,CAAI,CAAA,CAAA,0BAAA,EAA6B,WAAW,QAAQ;IAC7D;;AAfO,KAAA,CAAA,MAAM,GAAG,CAACC,QAAM,CAAC;AAIZ,UAAA,CAAA;AAAX,IAAAC,CAAQ;AAAqB,CAAA,EAAA,KAAA,CAAA,SAAA,EAAA,UAAA,EAAA,MAAA,CAAA;;;;"}
|
package/dist/number-counter.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { _ as __decorate, n } from './
|
|
2
|
-
import {
|
|
3
|
-
import { o } from './style-map-CdmclYgz.js';
|
|
4
|
-
import './directive-Cuw6h7YA.js';
|
|
1
|
+
import { i, _ as __decorate, n, P as PeacockComponent, a as i$1, b, A } from './PeacockComponent-DMrFEGDh.js';
|
|
2
|
+
import { o } from './style-map-mOmZwsJT.js';
|
|
5
3
|
|
|
6
4
|
var css_248z = i`* {
|
|
7
5
|
box-sizing: border-box;
|
|
@@ -58,7 +56,7 @@ var css_248z = i`* {
|
|
|
58
56
|
* ```
|
|
59
57
|
* @tags display
|
|
60
58
|
*/
|
|
61
|
-
class NumberCounter extends i$1 {
|
|
59
|
+
let NumberCounter = class NumberCounter extends i$1 {
|
|
62
60
|
constructor() {
|
|
63
61
|
super(...arguments);
|
|
64
62
|
this.value = 0;
|
|
@@ -100,7 +98,7 @@ class NumberCounter extends i$1 {
|
|
|
100
98
|
</div>
|
|
101
99
|
</div>`;
|
|
102
100
|
}
|
|
103
|
-
}
|
|
101
|
+
};
|
|
104
102
|
NumberCounter.styles = [css_248z];
|
|
105
103
|
__decorate([
|
|
106
104
|
n({ type: Number })
|
|
@@ -108,6 +106,9 @@ __decorate([
|
|
|
108
106
|
__decorate([
|
|
109
107
|
n()
|
|
110
108
|
], NumberCounter.prototype, "locale", void 0);
|
|
109
|
+
NumberCounter = __decorate([
|
|
110
|
+
PeacockComponent
|
|
111
|
+
], NumberCounter);
|
|
111
112
|
|
|
112
113
|
export { NumberCounter };
|
|
113
114
|
//# sourceMappingURL=number-counter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"number-counter.js","sources":["../../src/number-counter/number-counter.ts"],"sourcesContent":["import { html, LitElement, nothing } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { styleMap } from 'lit/directives/style-map.js';\nimport styles from './number-counter.scss';\n\n/**\n * @label Number Counter\n * @tag number-counter\n * @rawTag number-counter\n * @summary Displays a number with commas for thousands.\n *\n * @example\n * ```html\n * <number-counter value=\"123456789\"></number-counter>\n * <script>\n * const $counter = document.querySelector('number-counter');\n *\n * setInterval(() => {\n * $counter.value = $counter.value + parseInt(Math.floor(Math.random() * 1000));\n * }, 1000);\n * </script>\n * ```\n * @tags display\n */\nexport class NumberCounter extends LitElement {\n static styles = [styles];\n\n @property({ type: Number }) value = 0;\n\n /**\n * Optional: Allow users to pass a locale, defaulting to 'en-US' for commas.\n */\n @property() locale = 'en-US';\n\n render() {\n return html`<div class=\"number-counter\">${this.renderDigits()}</div>`;\n }\n\n renderDigits() {\n if (this.value === undefined || this.value === null) return nothing;\n\n // 1. Format the number with commas (e.g., 1234 -> \"1,234\")\n const formattedValue = new Intl.NumberFormat(this.locale).format(\n this.value,\n );\n\n // 2. Split the string into individual characters\n const chars = formattedValue.split('');\n\n return html`${chars.map(char => {\n // 3. Check if the character is a digit or a separator (comma/dot)\n const digit = parseInt(char, 10);\n\n // eslint-disable-next-line no-restricted-globals\n if (isNaN(digit)) {\n return html`<div class=\"digit-separator\">${char}</div>`;\n }\n\n return this.renderDigit(digit);\n })}`;\n }\n\n // eslint-disable-next-line class-methods-use-this\n renderDigit(digit: number) {\n // Each 'each-digit' is 10% of the 'digit-content' height (since there are 10 numbers)\n const offset = digit * 10;\n const style = {\n transform: `translateY(-${offset}%)`,\n };\n\n return html` <div class=\"digit\">\n <div class=\"digit-content\" style=${styleMap(style)}>\n ${[0, 1, 2, 3, 4, 5, 6, 7, 8, 9].map(\n n => html`<div class=\"each-digit\">${n}</div>`,\n )}\n </div>\n </div>`;\n }\n}\n"],"names":["LitElement","html","nothing","styleMap","styles","property"],"mappings":"
|
|
1
|
+
{"version":3,"file":"number-counter.js","sources":["../../src/number-counter/number-counter.ts"],"sourcesContent":["import { html, LitElement, nothing } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { styleMap } from 'lit/directives/style-map.js';\nimport PeacockComponent from 'src/PeacockComponent.js';\nimport styles from './number-counter.scss';\n\n/**\n * @label Number Counter\n * @tag number-counter\n * @rawTag number-counter\n * @summary Displays a number with commas for thousands.\n *\n * @example\n * ```html\n * <number-counter value=\"123456789\"></number-counter>\n * <script>\n * const $counter = document.querySelector('number-counter');\n *\n * setInterval(() => {\n * $counter.value = $counter.value + parseInt(Math.floor(Math.random() * 1000));\n * }, 1000);\n * </script>\n * ```\n * @tags display\n */\n@PeacockComponent\nexport class NumberCounter extends LitElement {\n static styles = [styles];\n\n @property({ type: Number }) value = 0;\n\n /**\n * Optional: Allow users to pass a locale, defaulting to 'en-US' for commas.\n */\n @property() locale = 'en-US';\n\n render() {\n return html`<div class=\"number-counter\">${this.renderDigits()}</div>`;\n }\n\n renderDigits() {\n if (this.value === undefined || this.value === null) return nothing;\n\n // 1. Format the number with commas (e.g., 1234 -> \"1,234\")\n const formattedValue = new Intl.NumberFormat(this.locale).format(\n this.value,\n );\n\n // 2. Split the string into individual characters\n const chars = formattedValue.split('');\n\n return html`${chars.map(char => {\n // 3. Check if the character is a digit or a separator (comma/dot)\n const digit = parseInt(char, 10);\n\n // eslint-disable-next-line no-restricted-globals\n if (isNaN(digit)) {\n return html`<div class=\"digit-separator\">${char}</div>`;\n }\n\n return this.renderDigit(digit);\n })}`;\n }\n\n // eslint-disable-next-line class-methods-use-this\n renderDigit(digit: number) {\n // Each 'each-digit' is 10% of the 'digit-content' height (since there are 10 numbers)\n const offset = digit * 10;\n const style = {\n transform: `translateY(-${offset}%)`,\n };\n\n return html` <div class=\"digit\">\n <div class=\"digit-content\" style=${styleMap(style)}>\n ${[0, 1, 2, 3, 4, 5, 6, 7, 8, 9].map(\n n => html`<div class=\"each-digit\">${n}</div>`,\n )}\n </div>\n </div>`;\n }\n}\n"],"names":["LitElement","html","nothing","styleMap","styles","property"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA;;;;;;;;;;;;;;;;;;AAkBG;AAEI,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQA,GAAU,CAAA;AAAtC,IAAA,WAAA,GAAA;;QAGuB,IAAA,CAAA,KAAK,GAAG,CAAC;AAErC;;AAEG;QACS,IAAA,CAAA,MAAM,GAAG,OAAO;IA8C9B;IA5CE,MAAM,GAAA;QACJ,OAAOC,CAAI,CAAA,CAAA,4BAAA,EAA+B,IAAI,CAAC,YAAY,EAAE,QAAQ;IACvE;IAEA,YAAY,GAAA;QACV,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS,IAAI,IAAI,CAAC,KAAK,KAAK,IAAI;AAAE,YAAA,OAAOC,CAAO;;AAGnE,QAAA,MAAM,cAAc,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,CAC9D,IAAI,CAAC,KAAK,CACX;;QAGD,MAAM,KAAK,GAAG,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC;QAEtC,OAAOD,CAAI,CAAA,CAAA,EAAG,KAAK,CAAC,GAAG,CAAC,IAAI,IAAG;;YAE7B,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC;;AAGhC,YAAA,IAAI,KAAK,CAAC,KAAK,CAAC,EAAE;AAChB,gBAAA,OAAOA,CAAI,CAAA,CAAA,6BAAA,EAAgC,IAAI,QAAQ;YACzD;AAEA,YAAA,OAAO,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC;QAChC,CAAC,CAAC,EAAE;IACN;;AAGA,IAAA,WAAW,CAAC,KAAa,EAAA;;AAEvB,QAAA,MAAM,MAAM,GAAG,KAAK,GAAG,EAAE;AACzB,QAAA,MAAM,KAAK,GAAG;YACZ,SAAS,EAAE,CAAA,YAAA,EAAe,MAAM,CAAA,EAAA,CAAI;SACrC;AAED,QAAA,OAAOA,CAAI,CAAA,CAAA;yCAC0BE,CAAQ,CAAC,KAAK,CAAC,CAAA;AAC9C,QAAA,EAAA,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAClC,CAAC,IAAIF,CAAI,CAAA,CAAA,wBAAA,EAA2B,CAAC,QAAQ,CAC9C;;WAEE;IACT;;AApDO,aAAA,CAAA,MAAM,GAAG,CAACG,QAAM,CAAC;AAEI,UAAA,CAAA;AAA3B,IAAAC,CAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE;AAAY,CAAA,EAAA,aAAA,CAAA,SAAA,EAAA,OAAA,EAAA,MAAA,CAAA;AAK1B,UAAA,CAAA;AAAX,IAAAA,CAAQ;AAAoB,CAAA,EAAA,aAAA,CAAA,SAAA,EAAA,QAAA,EAAA,MAAA,CAAA;AARlB,aAAa,GAAA,UAAA,CAAA;IADzB;AACY,CAAA,EAAA,aAAa,CAsDzB;;;;"}
|