@carbon/ibmdotcom-web-components 2.15.0 → 2.16.0-rc.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.
Files changed (91) hide show
  1. package/custom-elements.json +291 -9
  2. package/dist/dotcom-shell.js +2 -2
  3. package/dist/dotcom-shell.min.js +2 -2
  4. package/dist/ibmdotcom-web-components-dotcom-shell.js +2 -2
  5. package/dist/ibmdotcom-web-components-dotcom-shell.min.js +2 -2
  6. package/dist/{index-fd263a6c.js → index-6ab416ae.js} +6 -6
  7. package/dist/{index-8ac13d28.js → index-6f798488.js} +21 -10
  8. package/dist/{left-nav-menu-76323b8e.js → left-nav-menu-40ebffa9.js} +2 -2
  9. package/dist/{left-nav-menu-02760d33.js → left-nav-menu-629e7752.js} +2 -2
  10. package/dist/{left-nav-menu-category-heading-dca365b2.js → left-nav-menu-category-heading-1886967e.js} +2 -2
  11. package/dist/{left-nav-menu-category-heading-93c6f364.js → left-nav-menu-category-heading-1d965e0a.js} +2 -2
  12. package/dist/{left-nav-menu-item-e27ed87c.js → left-nav-menu-item-03cf8244.js} +2 -2
  13. package/dist/{left-nav-menu-item-218ef600.js → left-nav-menu-item-a9c7113f.js} +2 -2
  14. package/dist/{left-nav-menu-section-c5e510a9.js → left-nav-menu-section-c39512a8.js} +2 -2
  15. package/dist/{left-nav-menu-section-5abc2e23.js → left-nav-menu-section-e9526c5a.js} +2 -2
  16. package/dist/{left-nav-overlay-75300893.js → left-nav-overlay-59e8851e.js} +2 -2
  17. package/dist/{left-nav-overlay-5b0bfef2.js → left-nav-overlay-60a5eead.js} +2 -2
  18. package/dist/{megamenu-category-group-1943cfb9.js → megamenu-category-group-60d3805b.js} +2 -2
  19. package/dist/{megamenu-category-group-copy-cc3cf7e0.js → megamenu-category-group-copy-46df540c.js} +2 -2
  20. package/dist/{megamenu-category-group-copy-9e779f84.js → megamenu-category-group-copy-6ae3dfe8.js} +2 -2
  21. package/dist/{megamenu-category-group-aa873786.js → megamenu-category-group-e191e806.js} +2 -2
  22. package/dist/{megamenu-category-heading-f1723f28.js → megamenu-category-heading-420838f8.js} +2 -2
  23. package/dist/{megamenu-category-heading-0363175e.js → megamenu-category-heading-4b2d5ba1.js} +2 -2
  24. package/dist/{megamenu-category-link-653a7d76.js → megamenu-category-link-e5f8c975.js} +6 -6
  25. package/dist/{megamenu-category-link-5b370505.js → megamenu-category-link-ef739901.js} +2 -2
  26. package/dist/{megamenu-category-link-group-cc2f0cf0.js → megamenu-category-link-group-90b667c2.js} +2 -2
  27. package/dist/{megamenu-category-link-group-8a159720.js → megamenu-category-link-group-a85ef70e.js} +2 -2
  28. package/dist/{megamenu-left-navigation-c14cb952.js → megamenu-left-navigation-0a188f17.js} +2 -2
  29. package/dist/{megamenu-left-navigation-02c861d4.js → megamenu-left-navigation-d3619fc8.js} +2 -2
  30. package/dist/{megamenu-overlay-dacdd21f.js → megamenu-overlay-73bf0741.js} +2 -2
  31. package/dist/{megamenu-overlay-160fa18a.js → megamenu-overlay-98b82923.js} +2 -2
  32. package/dist/{megamenu-tab-ba249255.js → megamenu-tab-320d3677.js} +7 -7
  33. package/dist/{megamenu-tab-131eedb9.js → megamenu-tab-63b4d4a8.js} +15 -20
  34. package/es/components/back-to-top/__stories__/back-to-top.stories.css.js +1 -1
  35. package/es/components/countdown/countdown.d.ts +406 -0
  36. package/es/components/countdown/countdown.js +269 -0
  37. package/es/components/countdown/countdown.js.map +1 -0
  38. package/es/components/countdown/index.d.ts +11 -0
  39. package/es/components/countdown/index.js +18 -0
  40. package/es/components/countdown/index.js.map +1 -0
  41. package/es/components/leadspace/leadspace.css.js +1 -1
  42. package/es/components/masthead/masthead-cart.js +1 -1
  43. package/es/components/masthead/masthead-cart.js.map +1 -1
  44. package/es/components/masthead/masthead-l1.js +11 -1
  45. package/es/components/masthead/masthead-l1.js.map +1 -1
  46. package/es/components/masthead/megamenu-tab.d.ts +1 -5
  47. package/es/components/masthead/megamenu-tab.js +10 -16
  48. package/es/components/masthead/megamenu-tab.js.map +1 -1
  49. package/es/components/pricing-table/pricing-table.css.js +1 -1
  50. package/es/components/promo-banner/index.d.ts +11 -0
  51. package/es/components/promo-banner/index.js +18 -0
  52. package/es/components/promo-banner/index.js.map +1 -0
  53. package/es/components/promo-banner/promo-banner.css.js +12 -0
  54. package/es/components/promo-banner/promo-banner.d.ts +385 -0
  55. package/es/components/promo-banner/promo-banner.js +216 -0
  56. package/es/components/promo-banner/promo-banner.js.map +1 -0
  57. package/es/components/star-rating/index.d.ts +11 -0
  58. package/es/components/star-rating/index.js +18 -0
  59. package/es/components/star-rating/index.js.map +1 -0
  60. package/es/components/star-rating/star-rating.css.js +12 -0
  61. package/es/components/star-rating/star-rating.d.ts +427 -0
  62. package/es/components/star-rating/star-rating.js +320 -0
  63. package/es/components/star-rating/star-rating.js.map +1 -0
  64. package/es/components/structured-list/structured-list-cell.d.ts +2 -0
  65. package/es/components/structured-list/structured-list-cell.js +13 -4
  66. package/es/components/structured-list/structured-list-cell.js.map +1 -1
  67. package/es/components/structured-list/structured-list.css.js +1 -1
  68. package/es/components/table-of-contents/table-of-contents-cdn.css.js +1 -1
  69. package/es/components/table-of-contents/table-of-contents.css.js +1 -1
  70. package/es/components/tile/index.d.ts +12 -0
  71. package/es/components/tile/index.js +19 -0
  72. package/es/components/tile/index.js.map +1 -0
  73. package/es/components/tile/tile-group.d.ts +21 -0
  74. package/es/components/tile/tile-group.js +56 -0
  75. package/es/components/tile/tile-group.js.map +1 -0
  76. package/es/components/tile/tile.css.js +12 -0
  77. package/es/components/tile/tile.d.ts +737 -0
  78. package/es/components/tile/tile.js +225 -0
  79. package/es/components/tile/tile.js.map +1 -0
  80. package/es/components-react/structured-list/structured-list-cell.d.ts +2 -0
  81. package/es/globals/internal/storybook-decorators.d.ts +31 -0
  82. package/es/globals/internal/storybook-decorators.js +43 -0
  83. package/es/globals/internal/storybook-decorators.js.map +1 -0
  84. package/es/globals/mixins/throttled-input.js +5 -4
  85. package/es/globals/mixins/throttled-input.js.map +1 -1
  86. package/es/internal/vendor/@carbon/ibmdotcom-utilities/utilities/settings/settings.js +2 -2
  87. package/lib/internal/vendor/@carbon/ibmdotcom-utilities/utilities/settings/settings.js +2 -2
  88. package/package.json +8 -7
  89. package/scss/components/promo-banner/promo-banner.scss +163 -0
  90. package/scss/components/star-rating/star-rating.scss +76 -0
  91. package/scss/components/tile/tile.scss +290 -0
@@ -0,0 +1,406 @@
1
+ /**
2
+ * @license
3
+ *
4
+ * Copyright IBM Corp. 2024
5
+ *
6
+ * This source code is licensed under the Apache-2.0 license found in the
7
+ * LICENSE file in the root directory of this source tree.
8
+ */
9
+ import { LitElement } from 'lit';
10
+ import { MQDirs } from '../../component-mixins/media-query/media-query';
11
+ type TimeDiff = {
12
+ days: number;
13
+ hours: number;
14
+ minutes: number;
15
+ seconds: number;
16
+ };
17
+ type FormattersList = {
18
+ to_days: Intl.NumberFormat;
19
+ to_hours: Intl.NumberFormat;
20
+ to_minutes: Intl.NumberFormat;
21
+ to_seconds: Intl.NumberFormat;
22
+ };
23
+ type Locale = {
24
+ lc: string;
25
+ cc: string;
26
+ };
27
+ type UnitDisplay = 'short' | 'narrow' | 'long' | 'none' | undefined;
28
+ declare const C4DCountdown_base: (abstract new (...args: any[]) => {
29
+ _mqConfig: {
30
+ sm?: MQDirs | undefined;
31
+ md?: MQDirs | undefined;
32
+ lg?: MQDirs | undefined;
33
+ xlg?: MQDirs | undefined;
34
+ max?: MQDirs | undefined;
35
+ };
36
+ _generateMediaQueriesByBreakpoint(): {
37
+ [index: string]: MediaQueryList;
38
+ };
39
+ carbonBreakpoints: {
40
+ [index: string]: MediaQueryList;
41
+ };
42
+ _attachMediaQueryEventListeners(): void;
43
+ firstUpdated(): void;
44
+ accessKey: string;
45
+ readonly accessKeyLabel: string;
46
+ autocapitalize: string;
47
+ dir: string;
48
+ draggable: boolean;
49
+ hidden: boolean;
50
+ inert: boolean;
51
+ innerText: string;
52
+ lang: string;
53
+ readonly offsetHeight: number;
54
+ readonly offsetLeft: number;
55
+ readonly offsetParent: Element | null;
56
+ readonly offsetTop: number;
57
+ readonly offsetWidth: number;
58
+ outerText: string;
59
+ popover: string | null;
60
+ spellcheck: boolean;
61
+ title: string;
62
+ translate: boolean;
63
+ attachInternals(): ElementInternals;
64
+ click(): void;
65
+ hidePopover(): void;
66
+ showPopover(): void;
67
+ togglePopover(force?: boolean): boolean;
68
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
69
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
70
+ removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
71
+ removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
72
+ readonly attributes: NamedNodeMap;
73
+ readonly classList: DOMTokenList;
74
+ className: string;
75
+ readonly clientHeight: number;
76
+ readonly clientLeft: number;
77
+ readonly clientTop: number;
78
+ readonly clientWidth: number;
79
+ id: string;
80
+ readonly localName: string;
81
+ readonly namespaceURI: string | null;
82
+ onfullscreenchange: ((this: Element, ev: Event) => any) | null;
83
+ onfullscreenerror: ((this: Element, ev: Event) => any) | null;
84
+ outerHTML: string;
85
+ readonly ownerDocument: Document;
86
+ readonly part: DOMTokenList;
87
+ readonly prefix: string | null;
88
+ readonly scrollHeight: number;
89
+ scrollLeft: number;
90
+ scrollTop: number;
91
+ readonly scrollWidth: number;
92
+ readonly shadowRoot: ShadowRoot | null;
93
+ slot: string;
94
+ readonly tagName: string;
95
+ attachShadow(init: ShadowRootInit): ShadowRoot;
96
+ checkVisibility(options?: CheckVisibilityOptions): boolean;
97
+ closest<K extends keyof HTMLElementTagNameMap>(selector: K): HTMLElementTagNameMap[K] | null;
98
+ closest<K extends keyof SVGElementTagNameMap>(selector: K): SVGElementTagNameMap[K] | null;
99
+ closest<K extends keyof MathMLElementTagNameMap>(selector: K): MathMLElementTagNameMap[K] | null;
100
+ closest<E extends Element = Element>(selectors: string): E | null;
101
+ computedStyleMap(): StylePropertyMapReadOnly;
102
+ getAttribute(qualifiedName: string): string | null;
103
+ getAttributeNS(namespace: string | null, localName: string): string | null;
104
+ getAttributeNames(): string[];
105
+ getAttributeNode(qualifiedName: string): Attr | null;
106
+ getAttributeNodeNS(namespace: string | null, localName: string): Attr | null;
107
+ getBoundingClientRect(): DOMRect;
108
+ getClientRects(): DOMRectList;
109
+ getElementsByClassName(classNames: string): HTMLCollectionOf<Element>;
110
+ getElementsByTagName<K extends keyof HTMLElementTagNameMap>(qualifiedName: K): HTMLCollectionOf<HTMLElementTagNameMap[K]>;
111
+ getElementsByTagName<K extends keyof SVGElementTagNameMap>(qualifiedName: K): HTMLCollectionOf<SVGElementTagNameMap[K]>;
112
+ getElementsByTagName<K extends keyof MathMLElementTagNameMap>(qualifiedName: K): HTMLCollectionOf<MathMLElementTagNameMap[K]>;
113
+ getElementsByTagName<K extends keyof HTMLElementDeprecatedTagNameMap>(qualifiedName: K): HTMLCollectionOf<HTMLElementDeprecatedTagNameMap[K]>;
114
+ getElementsByTagName(qualifiedName: string): HTMLCollectionOf<Element>;
115
+ getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf<HTMLElement>;
116
+ getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf<SVGElement>;
117
+ getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1998/Math/MathML", localName: string): HTMLCollectionOf<MathMLElement>;
118
+ getElementsByTagNameNS(namespace: string | null, localName: string): HTMLCollectionOf<Element>;
119
+ hasAttribute(qualifiedName: string): boolean;
120
+ hasAttributeNS(namespace: string | null, localName: string): boolean;
121
+ hasAttributes(): boolean;
122
+ hasPointerCapture(pointerId: number): boolean;
123
+ insertAdjacentElement(where: InsertPosition, element: Element): Element | null;
124
+ insertAdjacentHTML(position: InsertPosition, text: string): void;
125
+ insertAdjacentText(where: InsertPosition, data: string): void;
126
+ matches(selectors: string): boolean;
127
+ releasePointerCapture(pointerId: number): void;
128
+ removeAttribute(qualifiedName: string): void;
129
+ removeAttributeNS(namespace: string | null, localName: string): void;
130
+ removeAttributeNode(attr: Attr): Attr;
131
+ requestFullscreen(options?: FullscreenOptions): Promise<void>;
132
+ requestPointerLock(): void;
133
+ scroll(options?: ScrollToOptions): void;
134
+ scroll(x: number, y: number): void;
135
+ scrollBy(options?: ScrollToOptions): void;
136
+ scrollBy(x: number, y: number): void;
137
+ scrollIntoView(arg?: boolean | ScrollIntoViewOptions): void;
138
+ scrollTo(options?: ScrollToOptions): void;
139
+ scrollTo(x: number, y: number): void;
140
+ setAttribute(qualifiedName: string, value: string): void;
141
+ setAttributeNS(namespace: string | null, qualifiedName: string, value: string): void;
142
+ setAttributeNode(attr: Attr): Attr | null;
143
+ setAttributeNodeNS(attr: Attr): Attr | null;
144
+ setHTMLUnsafe(html: string): void;
145
+ setPointerCapture(pointerId: number): void;
146
+ toggleAttribute(qualifiedName: string, force?: boolean): boolean;
147
+ webkitMatchesSelector(selectors: string): boolean;
148
+ readonly baseURI: string;
149
+ readonly childNodes: NodeListOf<ChildNode>;
150
+ readonly firstChild: ChildNode | null;
151
+ readonly isConnected: boolean;
152
+ readonly lastChild: ChildNode | null;
153
+ readonly nextSibling: ChildNode | null;
154
+ readonly nodeName: string;
155
+ readonly nodeType: number;
156
+ nodeValue: string | null;
157
+ readonly parentElement: HTMLElement | null;
158
+ readonly parentNode: ParentNode | null;
159
+ readonly previousSibling: ChildNode | null;
160
+ textContent: string | null;
161
+ appendChild<T extends Node>(node: T): T;
162
+ cloneNode(deep?: boolean): Node;
163
+ compareDocumentPosition(other: Node): number;
164
+ contains(other: Node | null): boolean;
165
+ getRootNode(options?: GetRootNodeOptions): Node;
166
+ hasChildNodes(): boolean;
167
+ insertBefore<T extends Node>(node: T, child: Node | null): T;
168
+ isDefaultNamespace(namespace: string | null): boolean;
169
+ isEqualNode(otherNode: Node | null): boolean;
170
+ isSameNode(otherNode: Node | null): boolean;
171
+ lookupNamespaceURI(prefix: string | null): string | null;
172
+ lookupPrefix(namespace: string | null): string | null;
173
+ normalize(): void;
174
+ removeChild<T extends Node>(child: T): T;
175
+ replaceChild<T extends Node>(node: Node, child: T): T;
176
+ readonly ELEMENT_NODE: 1;
177
+ readonly ATTRIBUTE_NODE: 2;
178
+ readonly TEXT_NODE: 3;
179
+ readonly CDATA_SECTION_NODE: 4;
180
+ readonly ENTITY_REFERENCE_NODE: 5;
181
+ readonly ENTITY_NODE: 6;
182
+ readonly PROCESSING_INSTRUCTION_NODE: 7;
183
+ readonly COMMENT_NODE: 8;
184
+ readonly DOCUMENT_NODE: 9;
185
+ readonly DOCUMENT_TYPE_NODE: 10;
186
+ readonly DOCUMENT_FRAGMENT_NODE: 11;
187
+ readonly NOTATION_NODE: 12;
188
+ readonly DOCUMENT_POSITION_DISCONNECTED: 1;
189
+ readonly DOCUMENT_POSITION_PRECEDING: 2;
190
+ readonly DOCUMENT_POSITION_FOLLOWING: 4;
191
+ readonly DOCUMENT_POSITION_CONTAINS: 8;
192
+ readonly DOCUMENT_POSITION_CONTAINED_BY: 16;
193
+ readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: 32;
194
+ dispatchEvent(event: Event): boolean;
195
+ ariaAtomic: string | null;
196
+ ariaAutoComplete: string | null;
197
+ ariaBrailleLabel: string | null;
198
+ ariaBrailleRoleDescription: string | null;
199
+ ariaBusy: string | null;
200
+ ariaChecked: string | null;
201
+ ariaColCount: string | null;
202
+ ariaColIndex: string | null;
203
+ ariaColSpan: string | null;
204
+ ariaCurrent: string | null;
205
+ ariaDescription: string | null;
206
+ ariaDisabled: string | null;
207
+ ariaExpanded: string | null;
208
+ ariaHasPopup: string | null;
209
+ ariaHidden: string | null;
210
+ ariaInvalid: string | null;
211
+ ariaKeyShortcuts: string | null;
212
+ ariaLabel: string | null;
213
+ ariaLevel: string | null;
214
+ ariaLive: string | null;
215
+ ariaModal: string | null;
216
+ ariaMultiLine: string | null;
217
+ ariaMultiSelectable: string | null;
218
+ ariaOrientation: string | null;
219
+ ariaPlaceholder: string | null;
220
+ ariaPosInSet: string | null;
221
+ ariaPressed: string | null;
222
+ ariaReadOnly: string | null;
223
+ ariaRequired: string | null;
224
+ ariaRoleDescription: string | null;
225
+ ariaRowCount: string | null;
226
+ ariaRowIndex: string | null;
227
+ ariaRowSpan: string | null;
228
+ ariaSelected: string | null;
229
+ ariaSetSize: string | null;
230
+ ariaSort: string | null;
231
+ ariaValueMax: string | null;
232
+ ariaValueMin: string | null;
233
+ ariaValueNow: string | null;
234
+ ariaValueText: string | null;
235
+ role: string | null;
236
+ animate(keyframes: Keyframe[] | PropertyIndexedKeyframes | null, options?: number | KeyframeAnimationOptions): Animation;
237
+ getAnimations(options?: GetAnimationsOptions): Animation[];
238
+ after(...nodes: (Node | string)[]): void;
239
+ before(...nodes: (Node | string)[]): void;
240
+ remove(): void;
241
+ replaceWith(...nodes: (Node | string)[]): void;
242
+ innerHTML: string;
243
+ readonly nextElementSibling: Element | null;
244
+ readonly previousElementSibling: Element | null;
245
+ readonly childElementCount: number;
246
+ readonly children: HTMLCollection;
247
+ readonly firstElementChild: Element | null;
248
+ readonly lastElementChild: Element | null;
249
+ append(...nodes: (Node | string)[]): void;
250
+ prepend(...nodes: (Node | string)[]): void;
251
+ querySelector<K extends keyof HTMLElementTagNameMap>(selectors: K): HTMLElementTagNameMap[K] | null;
252
+ querySelector<K extends keyof SVGElementTagNameMap>(selectors: K): SVGElementTagNameMap[K] | null;
253
+ querySelector<K extends keyof MathMLElementTagNameMap>(selectors: K): MathMLElementTagNameMap[K] | null;
254
+ querySelector<K extends keyof HTMLElementDeprecatedTagNameMap>(selectors: K): HTMLElementDeprecatedTagNameMap[K] | null;
255
+ querySelector<E extends Element = Element>(selectors: string): E | null;
256
+ querySelectorAll<K extends keyof HTMLElementTagNameMap>(selectors: K): NodeListOf<HTMLElementTagNameMap[K]>;
257
+ querySelectorAll<K extends keyof SVGElementTagNameMap>(selectors: K): NodeListOf<SVGElementTagNameMap[K]>;
258
+ querySelectorAll<K extends keyof MathMLElementTagNameMap>(selectors: K): NodeListOf<MathMLElementTagNameMap[K]>;
259
+ querySelectorAll<K extends keyof HTMLElementDeprecatedTagNameMap>(selectors: K): NodeListOf<HTMLElementDeprecatedTagNameMap[K]>;
260
+ querySelectorAll<E extends Element = Element>(selectors: string): NodeListOf<E>;
261
+ replaceChildren(...nodes: (Node | string)[]): void;
262
+ readonly assignedSlot: HTMLSlotElement | null;
263
+ readonly attributeStyleMap: StylePropertyMap;
264
+ readonly style: CSSStyleDeclaration;
265
+ contentEditable: string;
266
+ enterKeyHint: string;
267
+ inputMode: string;
268
+ readonly isContentEditable: boolean;
269
+ onabort: ((this: GlobalEventHandlers, ev: UIEvent) => any) | null;
270
+ onanimationcancel: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null;
271
+ onanimationend: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null;
272
+ onanimationiteration: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null;
273
+ onanimationstart: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null;
274
+ onauxclick: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
275
+ onbeforeinput: ((this: GlobalEventHandlers, ev: InputEvent) => any) | null;
276
+ onbeforetoggle: ((this: GlobalEventHandlers, ev: Event) => any) | null;
277
+ onblur: ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null;
278
+ oncancel: ((this: GlobalEventHandlers, ev: Event) => any) | null;
279
+ oncanplay: ((this: GlobalEventHandlers, ev: Event) => any) | null;
280
+ oncanplaythrough: ((this: GlobalEventHandlers, ev: Event) => any) | null;
281
+ onchange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
282
+ onclick: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
283
+ onclose: ((this: GlobalEventHandlers, ev: Event) => any) | null;
284
+ oncontextmenu: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
285
+ oncopy: ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null;
286
+ oncuechange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
287
+ oncut: ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null;
288
+ ondblclick: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
289
+ ondrag: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
290
+ ondragend: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
291
+ ondragenter: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
292
+ ondragleave: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
293
+ ondragover: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
294
+ ondragstart: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
295
+ ondrop: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
296
+ ondurationchange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
297
+ onemptied: ((this: GlobalEventHandlers, ev: Event) => any) | null;
298
+ onended: ((this: GlobalEventHandlers, ev: Event) => any) | null;
299
+ onerror: OnErrorEventHandler;
300
+ onfocus: ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null;
301
+ onformdata: ((this: GlobalEventHandlers, ev: FormDataEvent) => any) | null;
302
+ ongotpointercapture: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
303
+ oninput: ((this: GlobalEventHandlers, ev: Event) => any) | null;
304
+ oninvalid: ((this: GlobalEventHandlers, ev: Event) => any) | null;
305
+ onkeydown: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null;
306
+ onkeypress: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null;
307
+ onkeyup: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null;
308
+ onload: ((this: GlobalEventHandlers, ev: Event) => any) | null;
309
+ onloadeddata: ((this: GlobalEventHandlers, ev: Event) => any) | null;
310
+ onloadedmetadata: ((this: GlobalEventHandlers, ev: Event) => any) | null;
311
+ onloadstart: ((this: GlobalEventHandlers, ev: Event) => any) | null;
312
+ onlostpointercapture: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
313
+ onmousedown: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
314
+ onmouseenter: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
315
+ onmouseleave: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
316
+ onmousemove: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
317
+ onmouseout: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
318
+ onmouseover: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
319
+ onmouseup: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
320
+ onpaste: ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null;
321
+ onpause: ((this: GlobalEventHandlers, ev: Event) => any) | null;
322
+ onplay: ((this: GlobalEventHandlers, ev: Event) => any) | null;
323
+ onplaying: ((this: GlobalEventHandlers, ev: Event) => any) | null;
324
+ onpointercancel: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
325
+ onpointerdown: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
326
+ onpointerenter: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
327
+ onpointerleave: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
328
+ onpointermove: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
329
+ onpointerout: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
330
+ onpointerover: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
331
+ onpointerup: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
332
+ onprogress: ((this: GlobalEventHandlers, ev: ProgressEvent) => any) | null;
333
+ onratechange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
334
+ onreset: ((this: GlobalEventHandlers, ev: Event) => any) | null;
335
+ onresize: ((this: GlobalEventHandlers, ev: UIEvent) => any) | null;
336
+ onscroll: ((this: GlobalEventHandlers, ev: Event) => any) | null;
337
+ onscrollend: ((this: GlobalEventHandlers, ev: Event) => any) | null;
338
+ onsecuritypolicyviolation: ((this: GlobalEventHandlers, ev: SecurityPolicyViolationEvent) => any) | null;
339
+ onseeked: ((this: GlobalEventHandlers, ev: Event) => any) | null;
340
+ onseeking: ((this: GlobalEventHandlers, ev: Event) => any) | null;
341
+ onselect: ((this: GlobalEventHandlers, ev: Event) => any) | null;
342
+ onselectionchange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
343
+ onselectstart: ((this: GlobalEventHandlers, ev: Event) => any) | null;
344
+ onslotchange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
345
+ onstalled: ((this: GlobalEventHandlers, ev: Event) => any) | null;
346
+ onsubmit: ((this: GlobalEventHandlers, ev: SubmitEvent) => any) | null;
347
+ onsuspend: ((this: GlobalEventHandlers, ev: Event) => any) | null;
348
+ ontimeupdate: ((this: GlobalEventHandlers, ev: Event) => any) | null;
349
+ ontoggle: ((this: GlobalEventHandlers, ev: Event) => any) | null;
350
+ ontouchcancel?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
351
+ ontouchend?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
352
+ ontouchmove?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
353
+ ontouchstart?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
354
+ ontransitioncancel: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
355
+ ontransitionend: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
356
+ ontransitionrun: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
357
+ ontransitionstart: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
358
+ onvolumechange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
359
+ onwaiting: ((this: GlobalEventHandlers, ev: Event) => any) | null;
360
+ onwebkitanimationend: ((this: GlobalEventHandlers, ev: Event) => any) | null;
361
+ onwebkitanimationiteration: ((this: GlobalEventHandlers, ev: Event) => any) | null;
362
+ onwebkitanimationstart: ((this: GlobalEventHandlers, ev: Event) => any) | null;
363
+ onwebkittransitionend: ((this: GlobalEventHandlers, ev: Event) => any) | null;
364
+ onwheel: ((this: GlobalEventHandlers, ev: WheelEvent) => any) | null;
365
+ autofocus: boolean;
366
+ readonly dataset: DOMStringMap;
367
+ nonce?: string;
368
+ tabIndex: number;
369
+ blur(): void;
370
+ focus(options?: FocusOptions): void;
371
+ }) & typeof LitElement;
372
+ /**
373
+ * The Countdown component.
374
+ * @element c4d-countdown
375
+ */
376
+ declare class C4DCountdown extends C4DCountdown_base {
377
+ isMdOrLarger: boolean;
378
+ timeDiff?: TimeDiff;
379
+ targetDateTime?: number;
380
+ locale: Locale;
381
+ /**
382
+ * The target date, either in date time string format (ISO 8601), or UNIX timestamp.
383
+ */
384
+ targetInput?: string;
385
+ /**
386
+ * Optional date parts separator.
387
+ */
388
+ separator?: string;
389
+ /**
390
+ * Optional date parts label type. One of 'short', 'narrow', 'long', or 'none'.
391
+ */
392
+ labelType: UnitDisplay;
393
+ _clock?: any;
394
+ _formatters: FormattersList;
395
+ calculateDiff(): void;
396
+ _padInt(int: number, padLength: number): string;
397
+ formatOutput(): string;
398
+ protected mediaQueryCallbackMD(): void;
399
+ firstUpdated(): Promise<void>;
400
+ updated(changedProperties: any): void;
401
+ createRenderRoot(): this;
402
+ render(): import("lit-html").TemplateResult<1>;
403
+ }
404
+ export default C4DCountdown;
405
+
406
+ //# sourceMappingURL=countdown.d.ts.map
@@ -0,0 +1,269 @@
1
+ import _decorate from "@babel/runtime/helpers/esm/decorate";
2
+ import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
3
+ import _get from "@babel/runtime/helpers/esm/get";
4
+ let _ = t => t,
5
+ _t;
6
+ function _superPropGet(t, e, r, o) { var p = _get(_getPrototypeOf(1 & o ? t.prototype : t), e, r); return 2 & o ? function (t) { return p.apply(r, t); } : p; }
7
+ /**
8
+ * @license
9
+ *
10
+ * Copyright IBM Corp. 2024
11
+ *
12
+ * This source code is licensed under the Apache-2.0 license found in the
13
+ * LICENSE file in the root directory of this source tree.
14
+ */
15
+
16
+ import { LitElement, html } from 'lit';
17
+ import { property, state } from 'lit/decorators.js';
18
+ import { carbonElement as customElement } from '@carbon/web-components/es/globals/decorators/carbon-element.js';
19
+ import settings from '@carbon/ibmdotcom-utilities/es/utilities/settings/settings.js';
20
+ import LocaleAPI from '@carbon/ibmdotcom-services/es/services/Locale/Locale.js';
21
+ import MediaQueryMixin, { MQBreakpoints, MQDirs } from "../../component-mixins/media-query/media-query.js";
22
+ const {
23
+ stablePrefix: c4dPrefix
24
+ } = settings;
25
+ const ms_per = {
26
+ second: 1000,
27
+ minute: 1000 * 60,
28
+ hour: 1000 * 60 * 60,
29
+ day: 1000 * 60 * 60 * 24
30
+ };
31
+ const units = Object.keys(ms_per);
32
+ const getFormatters = (locale, labelType) => {
33
+ const lc_cc = `${locale.lc}-${locale.cc}`;
34
+
35
+ // The Typescript compiler sees unitDisplay as type
36
+ // "short" | "long" | "narrow" | undefined. Convert 'none' to undefined to
37
+ // avoid passing an unknown value to the unitDisplay option.
38
+ if (labelType === 'none') {
39
+ labelType = undefined;
40
+ }
41
+ return Object.fromEntries(units.map(unit => [`to_${unit}s`, new Intl.NumberFormat(lc_cc, {
42
+ style: 'unit',
43
+ unit,
44
+ unitDisplay: labelType,
45
+ minimumIntegerDigits: unit === 'day' ? 1 : 2,
46
+ // Force latin numerals. This fits for all current locales
47
+ // supported on ibm.com with the added benefit of forcing preferred
48
+ // latin numerals on sa-ar. In the future, if necessary, we could
49
+ // expose this options object as a property which we would merge with
50
+ // our defaults here, allowing clients to override our options.
51
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
52
+ // @ts-ignore
53
+ numberingSystem: 'latn'
54
+ })]));
55
+ };
56
+ /**
57
+ * The Countdown component.
58
+ * @element c4d-countdown
59
+ */
60
+ let C4DCountdown = _decorate([customElement(`${c4dPrefix}-countdown`)], function (_initialize, _MediaQueryMixin) {
61
+ class C4DCountdown extends _MediaQueryMixin {
62
+ constructor(...args) {
63
+ super(...args);
64
+ _initialize(this);
65
+ }
66
+ }
67
+ return {
68
+ F: C4DCountdown,
69
+ d: [{
70
+ kind: "field",
71
+ decorators: [state()],
72
+ key: "isMdOrLarger",
73
+ value() {
74
+ return this.carbonBreakpoints.md.matches;
75
+ }
76
+ }, {
77
+ kind: "field",
78
+ decorators: [state()],
79
+ key: "timeDiff",
80
+ value: void 0
81
+ }, {
82
+ kind: "field",
83
+ decorators: [state()],
84
+ key: "targetDateTime",
85
+ value: void 0
86
+ }, {
87
+ kind: "field",
88
+ decorators: [state()],
89
+ key: "locale",
90
+ value() {
91
+ return {
92
+ lc: 'en',
93
+ cc: 'us'
94
+ };
95
+ }
96
+ }, {
97
+ kind: "field",
98
+ decorators: [property({
99
+ attribute: 'target'
100
+ })],
101
+ key: "targetInput",
102
+ value: void 0
103
+ }, {
104
+ kind: "field",
105
+ decorators: [property({
106
+ attribute: 'separator'
107
+ })],
108
+ key: "separator",
109
+ value: void 0
110
+ }, {
111
+ kind: "field",
112
+ decorators: [property({
113
+ attribute: 'label-type'
114
+ })],
115
+ key: "labelType",
116
+ value() {
117
+ return 'long';
118
+ }
119
+ }, {
120
+ kind: "field",
121
+ key: "_formatters",
122
+ value() {
123
+ return getFormatters(this.locale, this.labelType);
124
+ }
125
+ }, {
126
+ kind: "method",
127
+ key: "calculateDiff",
128
+ value:
129
+ /**
130
+ * The target date, either in date time string format (ISO 8601), or UNIX timestamp.
131
+ */
132
+
133
+ /**
134
+ * Optional date parts separator.
135
+ */
136
+
137
+ /**
138
+ * Optional date parts label type. One of 'short', 'narrow', 'long', or 'none'.
139
+ */
140
+
141
+ function calculateDiff() {
142
+ const {
143
+ targetDateTime
144
+ } = this;
145
+ const now = Date.now();
146
+ let diff = (targetDateTime !== null && targetDateTime !== void 0 ? targetDateTime : 0) - now;
147
+ if (diff < 0) {
148
+ clearInterval(this._clock);
149
+ this.timeDiff = {
150
+ days: 0,
151
+ hours: 0,
152
+ minutes: 0,
153
+ seconds: 0
154
+ };
155
+ return;
156
+ }
157
+ const days = Math.floor(diff / ms_per.day);
158
+ diff = diff - days * ms_per.day;
159
+ const hours = Math.floor(diff / ms_per.hour);
160
+ diff = diff - hours * ms_per.hour;
161
+ const minutes = Math.floor(diff / ms_per.minute);
162
+ diff = diff - minutes * ms_per.minute;
163
+ const seconds = Math.floor(diff / ms_per.second);
164
+ this.timeDiff = {
165
+ days,
166
+ hours,
167
+ minutes,
168
+ seconds
169
+ };
170
+ }
171
+ }, {
172
+ kind: "method",
173
+ key: "_padInt",
174
+ value: function _padInt(int, padLength) {
175
+ return int.toString().padStart(padLength, '0');
176
+ }
177
+ }, {
178
+ kind: "method",
179
+ key: "formatOutput",
180
+ value: function formatOutput() {
181
+ const {
182
+ _formatters: formatters,
183
+ timeDiff,
184
+ separator,
185
+ labelType,
186
+ isMdOrLarger,
187
+ _padInt: padInt
188
+ } = this;
189
+ if (timeDiff === undefined) {
190
+ return '';
191
+ }
192
+ const {
193
+ days,
194
+ hours,
195
+ minutes,
196
+ seconds
197
+ } = timeDiff;
198
+ let values;
199
+ if (labelType === 'none') {
200
+ values = [days, hours, minutes, seconds].join(separator !== null && separator !== void 0 ? separator : '');
201
+ } else {
202
+ const {
203
+ to_days,
204
+ to_hours,
205
+ to_minutes,
206
+ to_seconds
207
+ } = formatters;
208
+ values = isMdOrLarger ? [to_days.format(days), to_hours.format(hours), to_minutes.format(minutes), to_seconds.format(seconds)].join(separator !== null && separator !== void 0 ? separator : '') : `${to_days.format(days)} ${padInt(hours, 2)}:${padInt(minutes, 2)}:${padInt(seconds, 2)}`;
209
+ }
210
+ return values;
211
+ }
212
+ }, {
213
+ kind: "method",
214
+ key: "mediaQueryCallbackMD",
215
+ value: function mediaQueryCallbackMD() {
216
+ this.isMdOrLarger = this.carbonBreakpoints.md.matches;
217
+ }
218
+ }, {
219
+ kind: "method",
220
+ key: "firstUpdated",
221
+ value: async function firstUpdated() {
222
+ _superPropGet(C4DCountdown, "firstUpdated", this, 3)([]);
223
+ this.style.display = 'contents';
224
+ this.locale = await LocaleAPI.getLocale();
225
+ }
226
+ }, {
227
+ kind: "method",
228
+ key: "updated",
229
+ value: function updated(changedProperties) {
230
+ if (changedProperties.has('targetInput')) {
231
+ let target = new Date(this.targetInput);
232
+ const epochTime = parseInt(this.targetInput);
233
+
234
+ // If date is invalid and epochTime is a valid number, assume a valid
235
+ // epochTime and create a new Date from it.
236
+ if (isNaN(target.valueOf()) && !isNaN(epochTime)) {
237
+ target = new Date(epochTime);
238
+ }
239
+ if (!isNaN(target.valueOf())) {
240
+ this.targetDateTime = target.getTime();
241
+ }
242
+ }
243
+ if (changedProperties.has('targetDateTime')) {
244
+ clearInterval(this._clock);
245
+ this._clock = setInterval(this.calculateDiff.bind(this), 1000);
246
+ }
247
+ if (changedProperties.has('locale') || changedProperties.has('labelType')) {
248
+ this._formatters = getFormatters(this.locale, this.labelType);
249
+ }
250
+ }
251
+ }, {
252
+ kind: "method",
253
+ key: "createRenderRoot",
254
+ value: function createRenderRoot() {
255
+ return this;
256
+ }
257
+ }, {
258
+ kind: "method",
259
+ key: "render",
260
+ value: function render() {
261
+ return html(_t || (_t = _` ${0} `), this.formatOutput());
262
+ }
263
+ }]
264
+ };
265
+ }, MediaQueryMixin(LitElement, {
266
+ [MQBreakpoints.MD]: MQDirs.MIN
267
+ }));
268
+ export default C4DCountdown;
269
+ //# sourceMappingURL=countdown.js.map