@sebgroup/green-core 1.15.1 → 1.16.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/README.md +101 -7
- package/chunks/chunk.274BU2AI.js +244 -0
- package/chunks/chunk.2LQSDOD4.js +29 -0
- package/chunks/chunk.2ND5EWHE.js +65 -0
- package/chunks/chunk.2OOTOCUG.js +420 -0
- package/chunks/chunk.2WO4NHJ2.js +34 -0
- package/chunks/chunk.2Y3BHFKO.js +154 -0
- package/chunks/chunk.375BWME4.js +29 -0
- package/chunks/chunk.3SEVAGLE.js +96 -0
- package/chunks/chunk.522C22QY.js +460 -0
- package/chunks/chunk.5VURDMKE.js +75 -0
- package/chunks/chunk.6NM7ENKA.js +31 -0
- package/chunks/chunk.6UA66KQU.js +153 -0
- package/chunks/chunk.7P5N6NZL.js +560 -0
- package/chunks/chunk.7TCXY7BP.js +0 -0
- package/chunks/chunk.D7H7CUS4.js +55 -0
- package/chunks/chunk.DFYMYEGD.js +78 -0
- package/chunks/chunk.HS7ICQNA.js +0 -0
- package/chunks/chunk.IYCENQZG.js +28 -0
- package/chunks/chunk.J2A6J77W.js +81 -0
- package/chunks/chunk.KC32OWZE.js +274 -0
- package/chunks/chunk.KV4SDMFS.js +101 -0
- package/chunks/chunk.LUHCF4BJ.js +64 -0
- package/chunks/chunk.MAD5DQMN.js +161 -0
- package/chunks/chunk.MI4A2C2A.js +0 -0
- package/chunks/chunk.NOYHINYP.js +467 -0
- package/chunks/chunk.Q2T57HE7.js +0 -0
- package/chunks/chunk.QONSFT2N.js +4653 -0
- package/chunks/chunk.TMBQL2RO.js +0 -0
- package/chunks/chunk.TN6ZYAH3.js +74 -0
- package/chunks/chunk.TSDZQZBY.js +0 -0
- package/chunks/chunk.TX64TTBN.js +0 -0
- package/chunks/chunk.UF6IEONX.js +0 -0
- package/chunks/chunk.VOYMQ322.js +61 -0
- package/chunks/chunk.VYK7D6QO.js +64 -0
- package/chunks/chunk.WDZ2JTCP.js +360 -0
- package/chunks/chunk.WJDR7FTS.js +193 -0
- package/chunks/chunk.WM7HBMMV.js +54 -0
- package/chunks/chunk.XHTJVQUJ.js +140 -0
- package/chunks/chunk.XI4H54TV.js +39 -0
- package/chunks/chunk.XU4HZLJL.js +0 -0
- package/chunks/chunk.YIQIH4RW.js +139 -0
- package/chunks/chunk.YJHAKLGR.js +54 -0
- package/chunks/chunk.YO24ZYAD.js +0 -0
- package/chunks/chunk.ZTE73BY2.js +655 -0
- package/components/badge/badge.js +245 -0
- package/components/button/button.d.ts +5 -5
- package/components/button/button.js +18 -0
- package/components/button/button.trans.styles.d.ts +2 -0
- package/components/button/index.d.ts +1 -0
- package/components/button/index.js +18 -0
- package/components/checkbox/checkbox.js +219 -0
- package/components/context-menu/context-menu.d.ts +2 -1
- package/components/context-menu/context-menu.js +22 -0
- package/components/context-menu/index.d.ts +3 -0
- package/components/context-menu/index.js +29 -0
- package/components/datepicker/date-part-spinner.js +10 -0
- package/components/datepicker/datepicker.d.ts +3 -2
- package/components/datepicker/datepicker.js +29 -0
- package/components/datepicker/index.d.ts +1 -0
- package/components/datepicker/index.js +29 -0
- package/components/dropdown/dropdown.d.ts +2 -2
- package/components/dropdown/dropdown.js +22 -0
- package/components/dropdown/index.d.ts +3 -0
- package/components/dropdown/index.js +30 -0
- package/components/form-control.js +12 -0
- package/components/grid/grid.d.ts +2 -2
- package/components/grid/grid.js +11 -0
- package/components/grid/grid.style.css.js +7 -0
- package/components/grid/index.d.ts +1 -0
- package/components/grid/index.js +11 -0
- package/components/grouped-list/grouped-list.js +14 -0
- package/components/grouped-list/index.d.ts +2 -0
- package/components/grouped-list/index.js +17 -0
- package/components/grouped-list/list-item.js +10 -0
- package/components/icon/icon.d.ts +2 -2
- package/components/icon/icon.js +10 -0
- package/components/icon/index.d.ts +1 -0
- package/components/icon/index.js +10 -0
- package/components/index.d.ts +4 -3
- package/components/index.js +81 -0
- package/components/input/input.js +682 -0
- package/components/radio/radio-group.js +9 -0
- package/components/radio/radio.js +240 -0
- package/components/segmented-control/index.d.ts +1 -0
- package/components/segmented-control/index.js +15 -0
- package/components/segmented-control/segment/index.d.ts +1 -0
- package/components/segmented-control/segment/index.js +13 -0
- package/components/segmented-control/segment/segment.js +12 -0
- package/components/segmented-control/segmented-control.d.ts +1 -1
- package/components/segmented-control/segmented-control.js +15 -0
- package/components/switch/switch.js +164 -0
- package/components/theme/index.d.ts +1 -0
- package/components/theme/index.js +11 -0
- package/components/theme/theme.js +11 -0
- package/components/tooltip/tooltip.js +252 -0
- package/index.js +72 -4291
- package/localization.js +3 -5
- package/package.json +7 -16
- package/primitives/calendar/calendar.js +13 -0
- package/primitives/calendar/functions.js +7 -0
- package/primitives/calendar/index.d.ts +1 -0
- package/primitives/calendar/index.js +14 -0
- package/primitives/listbox/index.d.ts +0 -1
- package/primitives/listbox/index.js +17 -0
- package/primitives/listbox/listbox.d.ts +2 -1
- package/primitives/listbox/listbox.js +16 -0
- package/primitives/listbox/option.js +14 -0
- package/primitives/menu/index.d.ts +1 -0
- package/primitives/menu/index.js +15 -0
- package/primitives/menu/menu-heading.js +11 -0
- package/primitives/menu/menu-item.d.ts +1 -2
- package/primitives/menu/menu-item.js +12 -0
- package/primitives/menu/menu.d.ts +2 -1
- package/primitives/menu/menu.js +14 -0
- package/primitives/popover/index.js +14 -0
- package/primitives/popover/popover.js +13 -0
- package/primitives/ripple/index.d.ts +1 -0
- package/primitives/ripple/index.js +11 -0
- package/primitives/ripple/ripple.d.ts +1 -1
- package/primitives/ripple/ripple.js +10 -0
- package/scoping.d.ts +1 -0
- package/scoping.js +18 -0
- package/transitional-styles.js +6 -4275
package/index.js
CHANGED
|
@@ -1,4298 +1,79 @@
|
|
|
1
|
-
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __decorateClass = (decorators, target, key, kind) => {
|
|
4
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
5
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6
|
-
if (decorator = decorators[i])
|
|
7
|
-
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8
|
-
if (kind && result)
|
|
9
|
-
__defProp(target, key, result);
|
|
10
|
-
return result;
|
|
11
|
-
};
|
|
12
|
-
var __accessCheck = (obj, member, msg7) => {
|
|
13
|
-
if (!member.has(obj))
|
|
14
|
-
throw TypeError("Cannot " + msg7);
|
|
15
|
-
};
|
|
16
|
-
var __privateGet = (obj, member, getter) => {
|
|
17
|
-
__accessCheck(obj, member, "read from private field");
|
|
18
|
-
return getter ? getter.call(obj) : member.get(obj);
|
|
19
|
-
};
|
|
20
|
-
var __privateAdd = (obj, member, value) => {
|
|
21
|
-
if (member.has(obj))
|
|
22
|
-
throw TypeError("Cannot add the same private member more than once");
|
|
23
|
-
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
24
|
-
};
|
|
25
|
-
var __privateSet = (obj, member, value, setter) => {
|
|
26
|
-
__accessCheck(obj, member, "write to private field");
|
|
27
|
-
setter ? setter.call(obj, value) : member.set(obj, value);
|
|
28
|
-
return value;
|
|
29
|
-
};
|
|
30
|
-
var __privateWrapper = (obj, member, setter, getter) => ({
|
|
31
|
-
set _(value) {
|
|
32
|
-
__privateSet(obj, member, value, setter);
|
|
33
|
-
},
|
|
34
|
-
get _() {
|
|
35
|
-
return __privateGet(obj, member, getter);
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
var __privateMethod = (obj, member, method) => {
|
|
39
|
-
__accessCheck(obj, member, "access private method");
|
|
40
|
-
return method;
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
// libs/core/src/components/dropdown/dropdown.ts
|
|
44
|
-
import { property as property5, query, queryAsync, state as state4 } from "lit/decorators.js";
|
|
45
|
-
import { unsafeHTML as unsafeHTML2 } from "lit/directives/unsafe-html.js";
|
|
46
|
-
import { when as when2 } from "lit/directives/when.js";
|
|
47
|
-
import { ifDefined } from "lit/directives/if-defined.js";
|
|
48
|
-
import { classMap as classMap3 } from "lit/directives/class-map.js";
|
|
49
|
-
import { msg as msg2, str, updateWhenLocaleChanges } from "@lit/localize";
|
|
50
|
-
import "reflect-metadata";
|
|
51
|
-
|
|
52
|
-
// libs/core/src/utils/helpers/constrain-slots.ts
|
|
53
|
-
function constrainSlots(self) {
|
|
54
|
-
self.updateComplete.then(() => {
|
|
55
|
-
const slots = self.shadowRoot?.querySelectorAll("slot[gds-allow]");
|
|
56
|
-
if (!slots)
|
|
57
|
-
return;
|
|
58
|
-
for (const node of Array.from(self.childNodes)) {
|
|
59
|
-
if (node.nodeType === Node.TEXT_NODE && node.textContent?.trim() === "") {
|
|
60
|
-
node.parentNode?.removeChild(node);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
const constrain = (slot) => {
|
|
64
|
-
const allowed = slot.getAttribute("gds-allow")?.split(" ") || [];
|
|
65
|
-
for (const node of Array.from(slot.assignedNodes())) {
|
|
66
|
-
if (!allowed.includes(node.nodeName.toLowerCase())) {
|
|
67
|
-
node.parentNode?.removeChild(node);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
slots.forEach((slot) => {
|
|
72
|
-
constrain(slot);
|
|
73
|
-
slot.addEventListener("slotchange", () => constrain(slot));
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
// libs/core/src/utils/decorators/watch.ts
|
|
79
|
-
function watch(propertyName, options) {
|
|
80
|
-
const resolvedOptions = {
|
|
81
|
-
waitUntilFirstUpdate: false,
|
|
82
|
-
...options
|
|
83
|
-
};
|
|
84
|
-
return (proto, propertyKey, descriptor) => {
|
|
85
|
-
const { update } = proto;
|
|
86
|
-
const watchedProperties = Array.isArray(propertyName) ? propertyName : [propertyName];
|
|
87
|
-
proto.update = function(changedProps) {
|
|
88
|
-
watchedProperties.forEach((property15) => {
|
|
89
|
-
const key = property15;
|
|
90
|
-
if (changedProps.has(key)) {
|
|
91
|
-
const oldValue = changedProps.get(key);
|
|
92
|
-
const newValue = this[key];
|
|
93
|
-
if (oldValue !== newValue) {
|
|
94
|
-
if (!resolvedOptions.waitUntilFirstUpdate || this.hasUpdated) {
|
|
95
|
-
descriptor.value?.call(this, oldValue, newValue);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
update.call(this, changedProps);
|
|
101
|
-
};
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
// libs/core/src/utils/decorators/observe-light-dom.ts
|
|
106
|
-
function observeLightDOM(observerConfig = {
|
|
107
|
-
attributes: true,
|
|
108
|
-
childList: true,
|
|
109
|
-
subtree: false,
|
|
110
|
-
characterData: true
|
|
111
|
-
}) {
|
|
112
|
-
return (proto, _propertyKey, descriptor) => {
|
|
113
|
-
let observer;
|
|
114
|
-
const connectedCallback = proto.connectedCallback;
|
|
115
|
-
const disconnectedCallback = proto.disconnectedCallback;
|
|
116
|
-
proto.connectedCallback = function() {
|
|
117
|
-
connectedCallback?.call(this);
|
|
118
|
-
const callback = (_mutationList, _observer) => {
|
|
119
|
-
descriptor.value?.call(this);
|
|
120
|
-
};
|
|
121
|
-
observer = new MutationObserver(callback);
|
|
122
|
-
observer.observe(this, observerConfig);
|
|
123
|
-
};
|
|
124
|
-
proto.disconnectedCallback = function() {
|
|
125
|
-
disconnectedCallback?.call(this);
|
|
126
|
-
observer.disconnect();
|
|
127
|
-
};
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
// libs/core/src/utils/decorators/watch-media-query.ts
|
|
132
|
-
function watchMediaQuery(q) {
|
|
133
|
-
return (proto, _propertyKey, descriptor) => {
|
|
134
|
-
const mediaQuery = window.matchMedia(q);
|
|
135
|
-
const connectedCallback = proto.connectedCallback;
|
|
136
|
-
const disconnectedCallback = proto.disconnectedCallback;
|
|
137
|
-
proto.connectedCallback = function() {
|
|
138
|
-
connectedCallback?.call(this);
|
|
139
|
-
const listener = (e) => {
|
|
140
|
-
descriptor.value?.call(this, e.matches);
|
|
141
|
-
};
|
|
142
|
-
mediaQuery.addEventListener("change", listener);
|
|
143
|
-
this.disconnectedCallback = function() {
|
|
144
|
-
disconnectedCallback?.call(this);
|
|
145
|
-
mediaQuery.removeEventListener("change", listener);
|
|
146
|
-
};
|
|
147
|
-
descriptor.value?.call(this, mediaQuery.matches);
|
|
148
|
-
};
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
// libs/core/src/utils/helpers/custom-element-scoping.ts
|
|
153
|
-
import { html as litHtml } from "lit";
|
|
154
|
-
import { customElement } from "lit/decorators.js";
|
|
155
|
-
var VER_SUFFIX = "-cbb91a";
|
|
156
|
-
var elementLookupTable = /* @__PURE__ */ new Map();
|
|
157
|
-
var gdsCustomElement = (tagName) => {
|
|
158
|
-
if (globalThis.GDS_DISABLE_VERSIONED_ELEMENTS) {
|
|
159
|
-
elementLookupTable.set(tagName, tagName);
|
|
160
|
-
return customElement(tagName);
|
|
161
|
-
}
|
|
162
|
-
const versionedTagName = tagName + VER_SUFFIX;
|
|
163
|
-
elementLookupTable.set(tagName, versionedTagName);
|
|
164
|
-
if (customElements.get(versionedTagName))
|
|
165
|
-
return (_classOrDescriptor) => false;
|
|
166
|
-
return customElement(versionedTagName);
|
|
167
|
-
};
|
|
168
|
-
var templateCache = /* @__PURE__ */ new WeakMap();
|
|
169
|
-
function applyElementScoping(strings, ...values) {
|
|
170
|
-
let modstrings = templateCache.get(strings);
|
|
171
|
-
if (!modstrings) {
|
|
172
|
-
modstrings = replaceTags(strings);
|
|
173
|
-
modstrings.raw = replaceTags(strings.raw);
|
|
174
|
-
templateCache.set(strings, modstrings);
|
|
175
|
-
}
|
|
176
|
-
return [modstrings, ...values];
|
|
177
|
-
}
|
|
178
|
-
var replaceTags = (inStr) => inStr.map((s) => {
|
|
179
|
-
for (const [key, value] of elementLookupTable.entries()) {
|
|
180
|
-
s = s.replace(new RegExp(`${key}(?![-a-z])`, "mg"), value);
|
|
181
|
-
}
|
|
182
|
-
return s;
|
|
183
|
-
});
|
|
184
|
-
function htmlTemplateTagFactory(extendedTag) {
|
|
185
|
-
return (strings, ...values) => {
|
|
186
|
-
if (globalThis.GDS_DISABLE_VERSIONED_ELEMENTS) {
|
|
187
|
-
return extendedTag(strings, ...values);
|
|
188
|
-
}
|
|
189
|
-
const [modstrings, ...modvalues] = applyElementScoping(strings, ...values);
|
|
190
|
-
return extendedTag(modstrings, ...modvalues);
|
|
191
|
-
};
|
|
192
|
-
}
|
|
193
|
-
var html = htmlTemplateTagFactory(litHtml);
|
|
194
|
-
function getScopedTagName(tagName) {
|
|
195
|
-
return elementLookupTable.get(tagName) ?? tagName;
|
|
196
|
-
}
|
|
197
|
-
function getUnscopedTagName(tagName) {
|
|
198
|
-
return [...elementLookupTable.entries()].find(
|
|
199
|
-
([, value]) => value === tagName
|
|
200
|
-
)?.[0];
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
// libs/core/src/primitives/listbox/listbox.ts
|
|
204
|
-
import { property, state } from "lit/decorators.js";
|
|
205
|
-
import { createRef, ref } from "lit/directives/ref.js";
|
|
206
|
-
|
|
207
|
-
// libs/core/src/utils/transitional-styles/transitional-styles.ts
|
|
208
|
-
import { html as html2 } from "lit";
|
|
209
|
-
import { unsafeHTML } from "lit/directives/unsafe-html.js";
|
|
210
|
-
function supportsConstructedStylesheets() {
|
|
211
|
-
try {
|
|
212
|
-
new CSSStyleSheet();
|
|
213
|
-
return true;
|
|
214
|
-
} catch {
|
|
215
|
-
return false;
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
var TransitionalStyles = class _TransitionalStyles {
|
|
219
|
-
constructor() {
|
|
220
|
-
this.sheets = /* @__PURE__ */ new Map();
|
|
221
|
-
this.elements = /* @__PURE__ */ new Map();
|
|
222
|
-
this.sheetsLegacy = /* @__PURE__ */ new Map();
|
|
223
|
-
this.useLegacyStylesheets = !supportsConstructedStylesheets();
|
|
224
|
-
this.chlorophyllTokens = new CSSStyleSheet();
|
|
225
|
-
}
|
|
226
|
-
static get instance() {
|
|
227
|
-
if (!globalThis.__gdsTransitionalStyles?.[VER_SUFFIX])
|
|
228
|
-
globalThis.__gdsTransitionalStyles = {
|
|
229
|
-
...globalThis.__gdsTransitionalStyles,
|
|
230
|
-
[VER_SUFFIX]: new _TransitionalStyles()
|
|
231
|
-
};
|
|
232
|
-
return globalThis.__gdsTransitionalStyles[VER_SUFFIX];
|
|
233
|
-
}
|
|
234
|
-
apply(element, styleKey) {
|
|
235
|
-
if (!element.shadowRoot)
|
|
236
|
-
return;
|
|
237
|
-
if (this.useLegacyStylesheets) {
|
|
238
|
-
this.elements.set(styleKey, element);
|
|
239
|
-
this.applyToElementLegacy(styleKey);
|
|
240
|
-
return;
|
|
241
|
-
}
|
|
242
|
-
const sheet = this.sheets.get(styleKey);
|
|
243
|
-
if (!sheet)
|
|
244
|
-
return;
|
|
245
|
-
this.elements.set(styleKey, element);
|
|
246
|
-
this.applyToElement(styleKey, sheet);
|
|
247
|
-
}
|
|
248
|
-
applyToElement(styleKey, sheet) {
|
|
249
|
-
const element = this.elements.get(styleKey);
|
|
250
|
-
if (!element || !element.shadowRoot)
|
|
251
|
-
return;
|
|
252
|
-
element.shadowRoot.adoptedStyleSheets = [this.chlorophyllTokens, sheet];
|
|
253
|
-
element._isUsingTransitionalStyles = true;
|
|
254
|
-
}
|
|
255
|
-
// This is a fallback for browsers that dosen't support constructed stylesheets.
|
|
256
|
-
// Primarily, this is here to support Safari/iOS 15.x
|
|
257
|
-
//
|
|
258
|
-
// To work around the lack of Constructed Stylesheets, we use a regular <style>
|
|
259
|
-
// element instead. The _tStyles property needs to be added to the render template
|
|
260
|
-
// of each component.
|
|
261
|
-
//
|
|
262
|
-
// Lit itself will also add a <style> element to the shadow root in these browsers,
|
|
263
|
-
// meaning that we have to override the base styles added from the static style
|
|
264
|
-
// property in this case. This is what the `all: revert` rule is for.
|
|
265
|
-
// We can use cascade layers to ensure that the revert rule overides the base styles
|
|
266
|
-
// but not the transitional styles.
|
|
267
|
-
// `@layer base, reset, transitional-styles;`
|
|
268
|
-
applyToElementLegacy(styleKey) {
|
|
269
|
-
const sheet = this.sheetsLegacy.get(styleKey);
|
|
270
|
-
const element = this.elements.get(styleKey);
|
|
271
|
-
if (!element)
|
|
272
|
-
return;
|
|
273
|
-
element._tStyles = html2`<style>
|
|
274
|
-
@layer reset {
|
|
275
|
-
*:not(style, [gds-element]) {
|
|
276
|
-
all: revert;
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
${unsafeHTML(sheet)}
|
|
280
|
-
</style>`;
|
|
281
|
-
element._isUsingTransitionalStyles = true;
|
|
282
|
-
}
|
|
283
|
-
register(name, styles2) {
|
|
284
|
-
if (this.useLegacyStylesheets) {
|
|
285
|
-
this.sheetsLegacy.set(name, styles2);
|
|
286
|
-
this.applyToElementLegacy(name);
|
|
287
|
-
return;
|
|
288
|
-
}
|
|
289
|
-
const sheet = new CSSStyleSheet();
|
|
290
|
-
sheet.replaceSync(styles2);
|
|
291
|
-
this.sheets.set(name, sheet);
|
|
292
|
-
this.applyToElement(name, sheet);
|
|
293
|
-
}
|
|
294
|
-
};
|
|
295
|
-
|
|
296
|
-
// libs/core/src/primitives/listbox/listbox.ts
|
|
297
|
-
import "reflect-metadata";
|
|
298
|
-
|
|
299
|
-
// libs/core/src/gds-element.ts
|
|
300
|
-
import { LitElement } from "lit";
|
|
301
|
-
var GdsElement = class extends LitElement {
|
|
302
|
-
constructor() {
|
|
303
|
-
super(...arguments);
|
|
304
|
-
/**
|
|
305
|
-
* The unscoped name of this element.
|
|
306
|
-
*/
|
|
307
|
-
this.gdsElementName = "";
|
|
308
|
-
/**
|
|
309
|
-
* Whether the element is using transitional styles.
|
|
310
|
-
* @internal
|
|
311
|
-
*/
|
|
312
|
-
this._isUsingTransitionalStyles = false;
|
|
313
|
-
}
|
|
314
|
-
connectedCallback() {
|
|
315
|
-
super.connectedCallback();
|
|
316
|
-
this.gdsElementName = getUnscopedTagName(this.tagName.toLowerCase()) || this.gdsElementName;
|
|
317
|
-
this.setAttribute("gds-element", this.gdsElementName);
|
|
318
|
-
}
|
|
319
|
-
};
|
|
320
|
-
|
|
321
|
-
// libs/core/src/primitives/listbox/listbox.styles.ts
|
|
322
|
-
import { css } from "lit";
|
|
323
|
-
var style = css`
|
|
324
|
-
@layer base, reset, transitional-styles;
|
|
325
|
-
@layer base {
|
|
326
|
-
:host {
|
|
327
|
-
display: flex;
|
|
328
|
-
flex-direction: column;
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
`;
|
|
332
|
-
var listbox_styles_default = style;
|
|
333
|
-
|
|
334
|
-
// libs/core/src/controllers/listbox-kb-nav-controller.ts
|
|
335
|
-
var ListboxKbNavController = class {
|
|
336
|
-
constructor(host) {
|
|
337
|
-
this.#keyboardNavigationHandler = (e) => {
|
|
338
|
-
const targetItem = e.target;
|
|
339
|
-
if (!this.host.navigableItems.includes(targetItem))
|
|
340
|
-
return;
|
|
341
|
-
let handled = false;
|
|
342
|
-
if (e.key === "ArrowDown") {
|
|
343
|
-
const nextItemIndex = this.host.navigableItems.indexOf(targetItem) + 1;
|
|
344
|
-
const nextItem = this.host.navigableItems[nextItemIndex];
|
|
345
|
-
nextItem?.focus();
|
|
346
|
-
handled = true;
|
|
347
|
-
} else if (e.key === "ArrowUp") {
|
|
348
|
-
const prevOptionIndex = this.host.navigableItems.indexOf(targetItem) - 1;
|
|
349
|
-
const prevItem = this.host.navigableItems[prevOptionIndex];
|
|
350
|
-
prevItem?.focus();
|
|
351
|
-
handled = true;
|
|
352
|
-
} else if (e.key === "Home") {
|
|
353
|
-
this.host.navigableItems[0]?.focus();
|
|
354
|
-
handled = true;
|
|
355
|
-
} else if (e.key === "End") {
|
|
356
|
-
this.host.navigableItems[this.host.navigableItems.length - 1]?.focus();
|
|
357
|
-
handled = true;
|
|
358
|
-
} else {
|
|
359
|
-
const key = e.key.toLowerCase();
|
|
360
|
-
if (key.length !== 1) {
|
|
361
|
-
return;
|
|
362
|
-
}
|
|
363
|
-
const isLetter = key >= "a" && key <= "z";
|
|
364
|
-
const isNumber = key >= "0" && key <= "9";
|
|
365
|
-
if (isLetter || isNumber) {
|
|
366
|
-
const firstMatch = this.host.navigableItems.find((el) => {
|
|
367
|
-
const text = el.textContent?.trim().toLowerCase();
|
|
368
|
-
return text?.startsWith(key);
|
|
369
|
-
});
|
|
370
|
-
firstMatch?.focus();
|
|
371
|
-
handled = true;
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
if (handled) {
|
|
375
|
-
e.preventDefault();
|
|
376
|
-
e.stopPropagation();
|
|
377
|
-
}
|
|
378
|
-
};
|
|
379
|
-
;
|
|
380
|
-
(this.host = host).addController(this);
|
|
381
|
-
}
|
|
382
|
-
hostConnected() {
|
|
383
|
-
this.host.addEventListener("keydown", this.#keyboardNavigationHandler);
|
|
384
|
-
}
|
|
385
|
-
hostDisconnected() {
|
|
386
|
-
this.host.removeEventListener("keydown", this.#keyboardNavigationHandler);
|
|
387
|
-
}
|
|
388
|
-
#keyboardNavigationHandler;
|
|
389
|
-
};
|
|
390
|
-
|
|
391
|
-
// libs/core/src/utils/helpers/unwrap-slots.ts
|
|
392
|
-
function unwrap(slotRef) {
|
|
393
|
-
let slot = slotRef;
|
|
394
|
-
while (slot.assignedElements().length > 0 && slot.assignedElements()[0].nodeName === "SLOT") {
|
|
395
|
-
slot = slot.assignedElements()[0];
|
|
396
|
-
}
|
|
397
|
-
return slot;
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
// libs/core/src/primitives/listbox/listbox.ts
|
|
401
|
-
var _slotRef, _handleSelect;
|
|
402
|
-
var GdsListbox = class extends GdsElement {
|
|
403
|
-
constructor() {
|
|
404
|
-
super();
|
|
405
|
-
this.multiple = false;
|
|
406
|
-
this.compareWith = (a, b) => a === b;
|
|
407
|
-
__privateAdd(this, _slotRef, createRef());
|
|
408
|
-
__privateAdd(this, _handleSelect, (e) => {
|
|
409
|
-
const option = e.target;
|
|
410
|
-
if (this.multiple)
|
|
411
|
-
option.selected = !option.selected;
|
|
412
|
-
else {
|
|
413
|
-
option.selected = true;
|
|
414
|
-
Array.from(this.options).forEach((el) => {
|
|
415
|
-
if (el !== option)
|
|
416
|
-
el.selected = false;
|
|
417
|
-
});
|
|
418
|
-
}
|
|
419
|
-
;
|
|
420
|
-
this.ariaActiveDescendantElement = option;
|
|
421
|
-
this.dispatchEvent(
|
|
422
|
-
new CustomEvent("change", {
|
|
423
|
-
bubbles: false,
|
|
424
|
-
composed: false
|
|
425
|
-
})
|
|
426
|
-
);
|
|
427
|
-
});
|
|
428
|
-
new ListboxKbNavController(this);
|
|
429
|
-
}
|
|
430
|
-
get navigableItems() {
|
|
431
|
-
return this.visibleOptionElements;
|
|
432
|
-
}
|
|
433
|
-
/**
|
|
434
|
-
* Returns a list of all `gds-option` elements in the listbox.
|
|
435
|
-
*/
|
|
436
|
-
get options() {
|
|
437
|
-
if (!__privateGet(this, _slotRef).value)
|
|
438
|
-
return [];
|
|
439
|
-
return unwrap(__privateGet(this, _slotRef).value).assignedElements().filter(
|
|
440
|
-
(o) => !o.hasAttribute("isplaceholder") && o.gdsElementName === "gds-option"
|
|
441
|
-
) || [];
|
|
442
|
-
}
|
|
443
|
-
/**
|
|
444
|
-
* Returns a list of all visible `gds-option` elements in the listbox.
|
|
445
|
-
*/
|
|
446
|
-
get visibleOptionElements() {
|
|
447
|
-
return this.options.filter((el) => !el.hidden);
|
|
448
|
-
}
|
|
449
|
-
/**
|
|
450
|
-
* Returns a list of all visible `gds-option` elements in the listbox.
|
|
451
|
-
*/
|
|
452
|
-
get visibleSelectedOptionElements() {
|
|
453
|
-
return this.options.filter((el) => el.selected && !el.hidden);
|
|
454
|
-
}
|
|
455
|
-
/**
|
|
456
|
-
* Returns a list of all selected `gds-option` elements in the listbox.
|
|
457
|
-
*/
|
|
458
|
-
get selection() {
|
|
459
|
-
return this.options.filter((el) => el.selected);
|
|
460
|
-
}
|
|
461
|
-
set selection(values) {
|
|
462
|
-
this.options.forEach((el) => {
|
|
463
|
-
el.selected = values.some((v) => this.compareWith(v, el.value));
|
|
464
|
-
});
|
|
465
|
-
}
|
|
466
|
-
connectedCallback() {
|
|
467
|
-
super.connectedCallback();
|
|
468
|
-
this.setAttribute("role", "listbox");
|
|
469
|
-
TransitionalStyles.instance.apply(this, "gds-listbox");
|
|
470
|
-
this.addEventListener("gds-select", __privateGet(this, _handleSelect));
|
|
471
|
-
}
|
|
472
|
-
/**
|
|
473
|
-
* Focuses the first selected option in the listbox.
|
|
474
|
-
* If no option is selected, the first visible option is focused.
|
|
475
|
-
*/
|
|
476
|
-
focus() {
|
|
477
|
-
;
|
|
478
|
-
(this.visibleSelectedOptionElements[0] || this.visibleOptionElements[0])?.focus();
|
|
479
|
-
}
|
|
480
|
-
render() {
|
|
481
|
-
return html`${this._tStyles}<slot ${ref(__privateGet(this, _slotRef))}></slot>`;
|
|
482
|
-
}
|
|
483
|
-
_rerenderOptions() {
|
|
484
|
-
this.options.forEach((el) => {
|
|
485
|
-
el.requestUpdate();
|
|
486
|
-
});
|
|
487
|
-
}
|
|
488
|
-
};
|
|
489
|
-
_slotRef = new WeakMap();
|
|
490
|
-
_handleSelect = new WeakMap();
|
|
491
|
-
GdsListbox.styles = listbox_styles_default;
|
|
492
|
-
__decorateClass([
|
|
493
|
-
property({
|
|
494
|
-
type: Boolean,
|
|
495
|
-
reflect: true,
|
|
496
|
-
attribute: "aria-multiselectable",
|
|
497
|
-
converter: {
|
|
498
|
-
fromAttribute: Boolean,
|
|
499
|
-
toAttribute: (value) => value.toString()
|
|
500
|
-
}
|
|
501
|
-
})
|
|
502
|
-
], GdsListbox.prototype, "multiple", 2);
|
|
503
|
-
__decorateClass([
|
|
504
|
-
property()
|
|
505
|
-
], GdsListbox.prototype, "compareWith", 2);
|
|
506
|
-
__decorateClass([
|
|
507
|
-
state()
|
|
508
|
-
], GdsListbox.prototype, "_tStyles", 2);
|
|
509
|
-
__decorateClass([
|
|
510
|
-
watch("multiple")
|
|
511
|
-
], GdsListbox.prototype, "_rerenderOptions", 1);
|
|
512
|
-
GdsListbox = __decorateClass([
|
|
513
|
-
gdsCustomElement("gds-listbox")
|
|
514
|
-
], GdsListbox);
|
|
515
|
-
|
|
516
|
-
// libs/core/src/primitives/listbox/option.ts
|
|
517
|
-
import { html as html3 } from "lit";
|
|
518
|
-
import { property as property2, state as state2 } from "lit/decorators.js";
|
|
519
|
-
import { when } from "lit/directives/when.js";
|
|
520
|
-
import { classMap } from "lit/directives/class-map.js";
|
|
521
|
-
|
|
522
|
-
// libs/core/src/primitives/listbox/option.styles.ts
|
|
523
|
-
import { css as css2 } from "lit";
|
|
524
|
-
var style2 = css2`
|
|
525
|
-
@layer base, reset, transitional-styles;
|
|
526
|
-
@layer base {
|
|
527
|
-
:host {
|
|
528
|
-
display: block;
|
|
529
|
-
padding: 1rem 1.5rem;
|
|
530
|
-
cursor: pointer;
|
|
531
|
-
}
|
|
532
|
-
|
|
533
|
-
:host(:not(:last-child)) {
|
|
534
|
-
border-bottom: 1px solid #e0e0e0;
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
:host(:hover) {
|
|
538
|
-
background-color: #ededed;
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
:host(:focus-visible) {
|
|
542
|
-
outline: auto;
|
|
543
|
-
outline-offset: -6px;
|
|
544
|
-
outline-color: #666;
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
|
-
`;
|
|
548
|
-
var option_styles_default = style2;
|
|
549
|
-
|
|
550
|
-
// libs/core/src/primitives/listbox/option.ts
|
|
551
|
-
import "reflect-metadata";
|
|
552
|
-
|
|
553
|
-
// libs/core/src/mixins/focusable.ts
|
|
554
|
-
var Focusable = (superClass) => {
|
|
555
|
-
class HighlightableElement extends superClass {
|
|
556
|
-
constructor() {
|
|
557
|
-
super(...arguments);
|
|
558
|
-
this.onblur = (e) => {
|
|
559
|
-
this.setAttribute("tabindex", "-1");
|
|
560
|
-
this.dispatchEvent(
|
|
561
|
-
new FocusEvent("gds-blur", {
|
|
562
|
-
bubbles: true,
|
|
563
|
-
composed: true,
|
|
564
|
-
relatedTarget: e.relatedTarget
|
|
565
|
-
})
|
|
566
|
-
);
|
|
567
|
-
};
|
|
568
|
-
this.onfocus = (e) => {
|
|
569
|
-
this.dispatchEvent(
|
|
570
|
-
new FocusEvent("gds-focus", {
|
|
571
|
-
bubbles: true,
|
|
572
|
-
composed: true,
|
|
573
|
-
relatedTarget: e.relatedTarget
|
|
574
|
-
})
|
|
575
|
-
);
|
|
576
|
-
};
|
|
577
|
-
}
|
|
578
|
-
focus(options) {
|
|
579
|
-
this.setAttribute("tabindex", "0");
|
|
580
|
-
super.focus(options);
|
|
581
|
-
}
|
|
582
|
-
}
|
|
583
|
-
return HighlightableElement;
|
|
584
|
-
};
|
|
585
|
-
|
|
586
|
-
// libs/core/src/primitives/listbox/option.ts
|
|
587
|
-
var _hidden, _emitSelect, emitSelect_fn;
|
|
588
|
-
var GdsOption = class extends Focusable(GdsElement) {
|
|
589
|
-
constructor() {
|
|
590
|
-
super();
|
|
591
|
-
__privateAdd(this, _emitSelect);
|
|
592
|
-
__privateAdd(this, _hidden, false);
|
|
593
|
-
this.selected = false;
|
|
594
|
-
this.isPlaceholder = false;
|
|
595
|
-
this.addEventListener("click", __privateMethod(this, _emitSelect, emitSelect_fn));
|
|
596
|
-
this.addEventListener("keydown", (e) => {
|
|
597
|
-
if (e.key !== "Enter" && e.key !== " ")
|
|
598
|
-
return;
|
|
599
|
-
e.preventDefault();
|
|
600
|
-
__privateMethod(this, _emitSelect, emitSelect_fn).call(this, e);
|
|
601
|
-
});
|
|
602
|
-
}
|
|
603
|
-
get hidden() {
|
|
604
|
-
return __privateGet(this, _hidden);
|
|
605
|
-
}
|
|
606
|
-
set hidden(value) {
|
|
607
|
-
if (this.isPlaceholder)
|
|
608
|
-
return;
|
|
609
|
-
__privateSet(this, _hidden, value === "true" || value === true);
|
|
610
|
-
this.setAttribute("aria-hidden", value.toString());
|
|
611
|
-
}
|
|
612
|
-
connectedCallback() {
|
|
613
|
-
super.connectedCallback();
|
|
614
|
-
this.setAttribute("role", "option");
|
|
615
|
-
if (this.isPlaceholder) {
|
|
616
|
-
__privateSet(this, _hidden, true);
|
|
617
|
-
this.setAttribute("aria-hidden", "true");
|
|
618
|
-
}
|
|
619
|
-
this.updateComplete.then(
|
|
620
|
-
() => TransitionalStyles.instance.apply(this, "gds-option")
|
|
621
|
-
);
|
|
622
|
-
}
|
|
623
|
-
get parentElement() {
|
|
624
|
-
return super.parentElement;
|
|
625
|
-
}
|
|
626
|
-
_handlePlaceholderStatusChange() {
|
|
627
|
-
if (this.isPlaceholder) {
|
|
628
|
-
__privateSet(this, _hidden, true);
|
|
629
|
-
this.setAttribute("aria-hidden", "true");
|
|
630
|
-
} else {
|
|
631
|
-
__privateSet(this, _hidden, false);
|
|
632
|
-
this.setAttribute("aria-hidden", "false");
|
|
633
|
-
}
|
|
634
|
-
}
|
|
635
|
-
render() {
|
|
636
|
-
const isMultiple = this.parentElement?.multiple;
|
|
637
|
-
const checkbox = html3` <span
|
|
638
|
-
class="checkbox ${classMap({ checked: this.selected })}"
|
|
639
|
-
></span>`;
|
|
640
|
-
if (!isMultiple) {
|
|
641
|
-
if (this.selected)
|
|
642
|
-
this.setAttribute("highlighted", "");
|
|
643
|
-
else
|
|
644
|
-
this.removeAttribute("highlighted");
|
|
645
|
-
}
|
|
646
|
-
return html3`${this._tStyles}
|
|
647
|
-
<div>${when(isMultiple, () => checkbox)} <slot></slot></div>`;
|
|
648
|
-
}
|
|
649
|
-
};
|
|
650
|
-
_hidden = new WeakMap();
|
|
651
|
-
_emitSelect = new WeakSet();
|
|
652
|
-
emitSelect_fn = function(e) {
|
|
653
|
-
e.stopPropagation();
|
|
654
|
-
this.dispatchEvent(
|
|
655
|
-
new CustomEvent("gds-select", {
|
|
656
|
-
bubbles: true,
|
|
657
|
-
composed: true,
|
|
658
|
-
detail: {
|
|
659
|
-
value: this.value
|
|
660
|
-
}
|
|
661
|
-
})
|
|
662
|
-
);
|
|
663
|
-
};
|
|
664
|
-
GdsOption.styles = option_styles_default;
|
|
665
|
-
__decorateClass([
|
|
666
|
-
property2()
|
|
667
|
-
], GdsOption.prototype, "value", 2);
|
|
668
|
-
__decorateClass([
|
|
669
|
-
property2({
|
|
670
|
-
attribute: "aria-hidden",
|
|
671
|
-
reflect: true
|
|
672
|
-
})
|
|
673
|
-
], GdsOption.prototype, "hidden", 1);
|
|
674
|
-
__decorateClass([
|
|
675
|
-
property2({
|
|
676
|
-
attribute: "aria-selected",
|
|
677
|
-
reflect: true
|
|
678
|
-
})
|
|
679
|
-
], GdsOption.prototype, "selected", 2);
|
|
680
|
-
__decorateClass([
|
|
681
|
-
property2({ type: Boolean, reflect: true })
|
|
682
|
-
], GdsOption.prototype, "isPlaceholder", 2);
|
|
683
|
-
__decorateClass([
|
|
684
|
-
state2()
|
|
685
|
-
], GdsOption.prototype, "_tStyles", 2);
|
|
686
|
-
__decorateClass([
|
|
687
|
-
watch("isplaceholder")
|
|
688
|
-
], GdsOption.prototype, "_handlePlaceholderStatusChange", 1);
|
|
689
|
-
GdsOption = __decorateClass([
|
|
690
|
-
gdsCustomElement("gds-option")
|
|
691
|
-
], GdsOption);
|
|
692
|
-
|
|
693
|
-
// libs/core/src/primitives/popover/popover.ts
|
|
694
|
-
import { html as html4, unsafeCSS } from "lit";
|
|
695
|
-
import { property as property3, state as state3 } from "lit/decorators.js";
|
|
696
|
-
import { classMap as classMap2 } from "lit/directives/class-map.js";
|
|
697
|
-
import { msg } from "@lit/localize";
|
|
698
|
-
import { createRef as createRef2, ref as ref2 } from "lit/directives/ref.js";
|
|
1
|
+
import "./chunks/chunk.HS7ICQNA.js";
|
|
699
2
|
import {
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
} from "@floating-ui/dom";
|
|
705
|
-
|
|
706
|
-
// libs/core/src/primitives/popover/popover.styles.ts
|
|
707
|
-
import { css as css3 } from "lit";
|
|
708
|
-
var style3 = css3`
|
|
709
|
-
@layer base, reset, transitional-styles;
|
|
710
|
-
@layer base {
|
|
711
|
-
:host([open]) dialog {
|
|
712
|
-
opacity: 1;
|
|
713
|
-
box-sizing: border-box;
|
|
714
|
-
transform: translate3d(0, 0, 0);
|
|
715
|
-
visibility: visible;
|
|
716
|
-
}
|
|
717
|
-
|
|
718
|
-
dialog {
|
|
719
|
-
inset: auto;
|
|
720
|
-
position: fixed;
|
|
721
|
-
overflow: hidden;
|
|
722
|
-
padding: 0px;
|
|
723
|
-
box-sizing: border-box;
|
|
724
|
-
right: 0;
|
|
725
|
-
margin: 0;
|
|
726
|
-
box-shadow:
|
|
727
|
-
0 0 0 1px rgba(0, 0, 0, 0.2),
|
|
728
|
-
0 1rem 28px rgba(0, 0, 0, 0.15);
|
|
729
|
-
border-width: 0;
|
|
730
|
-
border-radius: 0.5rem;
|
|
731
|
-
}
|
|
732
|
-
|
|
733
|
-
header {
|
|
734
|
-
display: none;
|
|
735
|
-
}
|
|
736
|
-
|
|
737
|
-
dialog::backdrop {
|
|
738
|
-
background-color: transparent;
|
|
739
|
-
display: block;
|
|
740
|
-
position: fixed;
|
|
741
|
-
}
|
|
742
|
-
}
|
|
743
|
-
`;
|
|
744
|
-
var popover_styles_default = style3;
|
|
745
|
-
|
|
746
|
-
// libs/core/src/primitives/popover/popover.ts
|
|
747
|
-
var _dialogElementRef, _autoPositionCleanupFn, _isMobileViewport, _dispatchUiStateEvent, _handleCloseButton, _registerTriggerEvents, registerTriggerEvents_fn, _unregisterTriggerEvents, unregisterTriggerEvents_fn, _registerAutoPositioning, registerAutoPositioning_fn, _triggerKeyDownListener, _focusFirstSlottedChild, _clickOutsideListener;
|
|
748
|
-
var GdsPopover = class extends GdsElement {
|
|
749
|
-
constructor() {
|
|
750
|
-
super(...arguments);
|
|
751
|
-
__privateAdd(this, _registerTriggerEvents);
|
|
752
|
-
__privateAdd(this, _unregisterTriggerEvents);
|
|
753
|
-
__privateAdd(this, _registerAutoPositioning);
|
|
754
|
-
this.open = false;
|
|
755
|
-
this.triggerRef = Promise.resolve(void 0);
|
|
756
|
-
this.label = void 0;
|
|
757
|
-
this.placement = "bottom-start";
|
|
758
|
-
this.calcMinWidth = (referenceEl) => `${referenceEl.offsetWidth}px`;
|
|
759
|
-
this.calcMaxWidth = (_referenceEl) => `auto`;
|
|
760
|
-
this.calcMinHeight = (referenceEl) => `auto`;
|
|
761
|
-
this.calcMaxHeight = (_referenceEl) => `500px`;
|
|
762
|
-
this._trigger = void 0;
|
|
763
|
-
this._isVirtKbVisible = false;
|
|
764
|
-
// A reference to the dialog element used to make the popover modal
|
|
765
|
-
__privateAdd(this, _dialogElementRef, createRef2());
|
|
766
|
-
// A function that removes the Floating UI auto positioning. This gets called when we switch to mobile view layout.
|
|
767
|
-
__privateAdd(this, _autoPositionCleanupFn, void 0);
|
|
768
|
-
__privateAdd(this, _isMobileViewport, false);
|
|
769
|
-
__privateAdd(this, _dispatchUiStateEvent, (reason) => {
|
|
770
|
-
this.dispatchEvent(
|
|
771
|
-
new CustomEvent("gds-ui-state", {
|
|
772
|
-
detail: { open: this.open, reason },
|
|
773
|
-
bubbles: false,
|
|
774
|
-
composed: false
|
|
775
|
-
})
|
|
776
|
-
);
|
|
777
|
-
});
|
|
778
|
-
__privateAdd(this, _handleCloseButton, (e) => {
|
|
779
|
-
e.stopPropagation();
|
|
780
|
-
e.preventDefault();
|
|
781
|
-
this.open = false;
|
|
782
|
-
__privateGet(this, _dispatchUiStateEvent).call(this, "close");
|
|
783
|
-
setTimeout(() => this._trigger?.focus(), 250);
|
|
784
|
-
});
|
|
785
|
-
/**
|
|
786
|
-
* ArrowDown on the trigger element will trigger the popover by default, and escape will close it.
|
|
787
|
-
*/
|
|
788
|
-
__privateAdd(this, _triggerKeyDownListener, (e) => {
|
|
789
|
-
if (e.key === "ArrowDown") {
|
|
790
|
-
e.preventDefault();
|
|
791
|
-
this.open = true;
|
|
792
|
-
__privateGet(this, _dispatchUiStateEvent).call(this, "show");
|
|
793
|
-
}
|
|
794
|
-
if (e.key === "Escape") {
|
|
795
|
-
this.open = false;
|
|
796
|
-
__privateGet(this, _dispatchUiStateEvent).call(this, "cancel");
|
|
797
|
-
}
|
|
798
|
-
});
|
|
799
|
-
/**
|
|
800
|
-
* Move focus to the first slotted child.
|
|
801
|
-
*/
|
|
802
|
-
__privateAdd(this, _focusFirstSlottedChild, () => {
|
|
803
|
-
const firstSlottedChild = this.shadowRoot?.querySelector("slot")?.assignedElements()[0];
|
|
804
|
-
this.updateComplete.then(() => {
|
|
805
|
-
firstSlottedChild?.focus();
|
|
806
|
-
});
|
|
807
|
-
});
|
|
808
|
-
__privateAdd(this, _clickOutsideListener, (evt) => {
|
|
809
|
-
const e = evt;
|
|
810
|
-
const dialog = __privateGet(this, _dialogElementRef).value;
|
|
811
|
-
const isNotEnterKey = e.clientX > 0 || e.clientY > 0;
|
|
812
|
-
if (isNotEnterKey && dialog && this.open) {
|
|
813
|
-
const rect = dialog.getBoundingClientRect();
|
|
814
|
-
const isInDialog = rect.top <= e.clientY && e.clientY <= rect.top + rect.height && rect.left <= e.clientX && e.clientX <= rect.left + rect.width;
|
|
815
|
-
if (!isInDialog) {
|
|
816
|
-
e.stopPropagation();
|
|
817
|
-
this.open = false;
|
|
818
|
-
__privateGet(this, _dispatchUiStateEvent).call(this, "close");
|
|
819
|
-
}
|
|
820
|
-
}
|
|
821
|
-
});
|
|
822
|
-
}
|
|
823
|
-
_handleTriggerRefChanged() {
|
|
824
|
-
this.triggerRef.then((el) => {
|
|
825
|
-
if (el)
|
|
826
|
-
this._trigger = el;
|
|
827
|
-
});
|
|
828
|
-
}
|
|
829
|
-
_handleTriggerChanged() {
|
|
830
|
-
__privateMethod(this, _registerTriggerEvents, registerTriggerEvents_fn).call(this);
|
|
831
|
-
__privateMethod(this, _registerAutoPositioning, registerAutoPositioning_fn).call(this);
|
|
832
|
-
}
|
|
833
|
-
connectedCallback() {
|
|
834
|
-
super.connectedCallback();
|
|
835
|
-
TransitionalStyles.instance.apply(this, "gds-popover");
|
|
836
|
-
__privateMethod(this, _registerTriggerEvents, registerTriggerEvents_fn).call(this);
|
|
837
|
-
this._handleOpenChange();
|
|
838
|
-
this.addEventListener("keydown", (e) => {
|
|
839
|
-
if (e.key === "Escape") {
|
|
840
|
-
this.open = false;
|
|
841
|
-
__privateGet(this, _dispatchUiStateEvent).call(this, "cancel");
|
|
842
|
-
e.stopPropagation();
|
|
843
|
-
e.preventDefault();
|
|
844
|
-
}
|
|
845
|
-
});
|
|
846
|
-
this.addEventListener("focusin", (e) => {
|
|
847
|
-
const t = e.target;
|
|
848
|
-
if (t.tagName === "INPUT" || t.tagName === "TEXTAREA") {
|
|
849
|
-
this._isVirtKbVisible = true;
|
|
850
|
-
} else {
|
|
851
|
-
this._isVirtKbVisible = false;
|
|
852
|
-
}
|
|
853
|
-
});
|
|
854
|
-
this.addEventListener("blurin", (_) => {
|
|
855
|
-
this._isVirtKbVisible = false;
|
|
856
|
-
});
|
|
857
|
-
}
|
|
858
|
-
disconnectedCallback() {
|
|
859
|
-
super.disconnectedCallback();
|
|
860
|
-
__privateMethod(this, _unregisterTriggerEvents, unregisterTriggerEvents_fn).call(this);
|
|
861
|
-
}
|
|
862
|
-
render() {
|
|
863
|
-
return html4`${this._tStyles}
|
|
864
|
-
<dialog
|
|
865
|
-
class="${classMap2({ "v-kb-visible": this._isVirtKbVisible })}"
|
|
866
|
-
${ref2(__privateGet(this, _dialogElementRef))}
|
|
867
|
-
>
|
|
868
|
-
<header>
|
|
869
|
-
<h2>${this.label}</h2>
|
|
870
|
-
<button
|
|
871
|
-
class="close"
|
|
872
|
-
@click=${__privateGet(this, _handleCloseButton)}
|
|
873
|
-
aria-label="${msg("Close")}"
|
|
874
|
-
>
|
|
875
|
-
<i></i>
|
|
876
|
-
</button>
|
|
877
|
-
</header>
|
|
878
|
-
<slot></slot>
|
|
879
|
-
</dialog>`;
|
|
880
|
-
}
|
|
881
|
-
_handleOpenChange() {
|
|
882
|
-
this.setAttribute("aria-hidden", String(!this.open));
|
|
883
|
-
this.hidden = !this.open;
|
|
884
|
-
this.updateComplete.then(() => {
|
|
885
|
-
if (this.open) {
|
|
886
|
-
__privateGet(this, _dialogElementRef).value?.showModal();
|
|
887
|
-
__privateGet(this, _focusFirstSlottedChild).call(this);
|
|
888
|
-
setTimeout(
|
|
889
|
-
() => __privateGet(this, _dialogElementRef).value?.addEventListener(
|
|
890
|
-
"click",
|
|
891
|
-
__privateGet(this, _clickOutsideListener)
|
|
892
|
-
),
|
|
893
|
-
0
|
|
894
|
-
);
|
|
895
|
-
} else {
|
|
896
|
-
__privateGet(this, _dialogElementRef).value?.close();
|
|
897
|
-
__privateGet(this, _dialogElementRef).value?.removeEventListener(
|
|
898
|
-
"click",
|
|
899
|
-
__privateGet(this, _clickOutsideListener)
|
|
900
|
-
);
|
|
901
|
-
}
|
|
902
|
-
});
|
|
903
|
-
}
|
|
904
|
-
_handleMobileLayout(matches) {
|
|
905
|
-
var _a;
|
|
906
|
-
__privateSet(this, _isMobileViewport, matches);
|
|
907
|
-
if (matches) {
|
|
908
|
-
(_a = __privateGet(this, _autoPositionCleanupFn)) == null ? void 0 : _a.call(this);
|
|
909
|
-
__privateGet(this, _dialogElementRef).value?.style.removeProperty("left");
|
|
910
|
-
__privateGet(this, _dialogElementRef).value?.style.removeProperty("top");
|
|
911
|
-
__privateGet(this, _dialogElementRef).value?.style.removeProperty("minWidth");
|
|
912
|
-
this.updateComplete.then(() => {
|
|
913
|
-
if (this.open)
|
|
914
|
-
__privateGet(this, _dialogElementRef).value?.showModal();
|
|
915
|
-
});
|
|
916
|
-
} else {
|
|
917
|
-
this.updateComplete.then(() => {
|
|
918
|
-
__privateMethod(this, _registerAutoPositioning, registerAutoPositioning_fn).call(this);
|
|
919
|
-
});
|
|
920
|
-
}
|
|
921
|
-
}
|
|
922
|
-
};
|
|
923
|
-
_dialogElementRef = new WeakMap();
|
|
924
|
-
_autoPositionCleanupFn = new WeakMap();
|
|
925
|
-
_isMobileViewport = new WeakMap();
|
|
926
|
-
_dispatchUiStateEvent = new WeakMap();
|
|
927
|
-
_handleCloseButton = new WeakMap();
|
|
928
|
-
_registerTriggerEvents = new WeakSet();
|
|
929
|
-
registerTriggerEvents_fn = function() {
|
|
930
|
-
this._trigger?.addEventListener("keydown", __privateGet(this, _triggerKeyDownListener));
|
|
931
|
-
};
|
|
932
|
-
_unregisterTriggerEvents = new WeakSet();
|
|
933
|
-
unregisterTriggerEvents_fn = function() {
|
|
934
|
-
var _a;
|
|
935
|
-
this._trigger?.removeEventListener("keydown", __privateGet(this, _triggerKeyDownListener));
|
|
936
|
-
(_a = __privateGet(this, _autoPositionCleanupFn)) == null ? void 0 : _a.call(this);
|
|
937
|
-
};
|
|
938
|
-
_registerAutoPositioning = new WeakSet();
|
|
939
|
-
registerAutoPositioning_fn = function() {
|
|
940
|
-
const referenceEl = this._trigger;
|
|
941
|
-
const floatingEl = __privateGet(this, _dialogElementRef).value;
|
|
942
|
-
if (!referenceEl || !floatingEl || __privateGet(this, _isMobileViewport))
|
|
943
|
-
return;
|
|
944
|
-
if (__privateGet(this, _autoPositionCleanupFn)) {
|
|
945
|
-
__privateGet(this, _autoPositionCleanupFn).call(this);
|
|
946
|
-
}
|
|
947
|
-
__privateSet(this, _autoPositionCleanupFn, autoUpdate(referenceEl, floatingEl, () => {
|
|
948
|
-
computePosition(referenceEl, floatingEl, {
|
|
949
|
-
placement: this.placement,
|
|
950
|
-
middleware: [offset(8), flip()],
|
|
951
|
-
strategy: "fixed"
|
|
952
|
-
}).then(
|
|
953
|
-
({ x, y }) => Object.assign(floatingEl.style, {
|
|
954
|
-
left: `${x}px`,
|
|
955
|
-
top: `${y}px`,
|
|
956
|
-
minWidth: this.calcMinWidth(referenceEl),
|
|
957
|
-
maxWidth: this.calcMaxWidth(referenceEl),
|
|
958
|
-
minHeight: this.calcMinHeight(referenceEl),
|
|
959
|
-
maxHeight: this.calcMaxHeight(referenceEl)
|
|
960
|
-
})
|
|
961
|
-
);
|
|
962
|
-
}));
|
|
963
|
-
};
|
|
964
|
-
_triggerKeyDownListener = new WeakMap();
|
|
965
|
-
_focusFirstSlottedChild = new WeakMap();
|
|
966
|
-
_clickOutsideListener = new WeakMap();
|
|
967
|
-
GdsPopover.styles = unsafeCSS(popover_styles_default);
|
|
968
|
-
__decorateClass([
|
|
969
|
-
property3({ type: Boolean, reflect: true })
|
|
970
|
-
], GdsPopover.prototype, "open", 2);
|
|
971
|
-
__decorateClass([
|
|
972
|
-
property3()
|
|
973
|
-
], GdsPopover.prototype, "triggerRef", 2);
|
|
974
|
-
__decorateClass([
|
|
975
|
-
property3()
|
|
976
|
-
], GdsPopover.prototype, "label", 2);
|
|
977
|
-
__decorateClass([
|
|
978
|
-
property3()
|
|
979
|
-
], GdsPopover.prototype, "placement", 2);
|
|
980
|
-
__decorateClass([
|
|
981
|
-
property3()
|
|
982
|
-
], GdsPopover.prototype, "calcMinWidth", 2);
|
|
983
|
-
__decorateClass([
|
|
984
|
-
property3()
|
|
985
|
-
], GdsPopover.prototype, "calcMaxWidth", 2);
|
|
986
|
-
__decorateClass([
|
|
987
|
-
property3()
|
|
988
|
-
], GdsPopover.prototype, "calcMinHeight", 2);
|
|
989
|
-
__decorateClass([
|
|
990
|
-
property3()
|
|
991
|
-
], GdsPopover.prototype, "calcMaxHeight", 2);
|
|
992
|
-
__decorateClass([
|
|
993
|
-
state3()
|
|
994
|
-
], GdsPopover.prototype, "_trigger", 2);
|
|
995
|
-
__decorateClass([
|
|
996
|
-
state3()
|
|
997
|
-
], GdsPopover.prototype, "_isVirtKbVisible", 2);
|
|
998
|
-
__decorateClass([
|
|
999
|
-
watch("triggerRef")
|
|
1000
|
-
], GdsPopover.prototype, "_handleTriggerRefChanged", 1);
|
|
1001
|
-
__decorateClass([
|
|
1002
|
-
watch("_trigger")
|
|
1003
|
-
], GdsPopover.prototype, "_handleTriggerChanged", 1);
|
|
1004
|
-
__decorateClass([
|
|
1005
|
-
state3()
|
|
1006
|
-
], GdsPopover.prototype, "_tStyles", 2);
|
|
1007
|
-
__decorateClass([
|
|
1008
|
-
watch("open")
|
|
1009
|
-
], GdsPopover.prototype, "_handleOpenChange", 1);
|
|
1010
|
-
__decorateClass([
|
|
1011
|
-
watchMediaQuery("(max-width: 576px)")
|
|
1012
|
-
], GdsPopover.prototype, "_handleMobileLayout", 1);
|
|
1013
|
-
GdsPopover = __decorateClass([
|
|
1014
|
-
gdsCustomElement("gds-popover")
|
|
1015
|
-
], GdsPopover);
|
|
1016
|
-
|
|
1017
|
-
// libs/core/src/components/form-control.ts
|
|
1018
|
-
import { property as property4 } from "lit/decorators.js";
|
|
1019
|
-
var GdsFormControlElement = class extends GdsElement {
|
|
1020
|
-
constructor() {
|
|
1021
|
-
super();
|
|
1022
|
-
this.invalid = false;
|
|
1023
|
-
this.name = "";
|
|
1024
|
-
/**
|
|
1025
|
-
* Event handler for the form reset event.
|
|
1026
|
-
* Can be overridden by subclasses to rcustomize the reset value.
|
|
1027
|
-
*/
|
|
1028
|
-
this._handleFormReset = () => {
|
|
1029
|
-
this.value = void 0;
|
|
1030
|
-
};
|
|
1031
|
-
try {
|
|
1032
|
-
this.#internals = this.attachInternals();
|
|
1033
|
-
} catch (e) {
|
|
1034
|
-
this.#internals = {
|
|
1035
|
-
form: this.closest("form"),
|
|
1036
|
-
setFormValue: (value) => {
|
|
1037
|
-
this.value = value;
|
|
1038
|
-
},
|
|
1039
|
-
setValidity: (validity, validationMessage) => {
|
|
1040
|
-
this.invalid = validity.customError;
|
|
1041
|
-
},
|
|
1042
|
-
validationMessage: "",
|
|
1043
|
-
validity: {
|
|
1044
|
-
badInput: false,
|
|
1045
|
-
customError: false,
|
|
1046
|
-
patternMismatch: false,
|
|
1047
|
-
rangeOverflow: false,
|
|
1048
|
-
rangeUnderflow: false,
|
|
1049
|
-
stepMismatch: false,
|
|
1050
|
-
tooLong: false,
|
|
1051
|
-
tooShort: false,
|
|
1052
|
-
typeMismatch: false,
|
|
1053
|
-
valueMissing: false,
|
|
1054
|
-
valid: true
|
|
1055
|
-
},
|
|
1056
|
-
willValidate: true,
|
|
1057
|
-
checkValidity: () => true,
|
|
1058
|
-
reportValidity: () => true
|
|
1059
|
-
};
|
|
1060
|
-
}
|
|
1061
|
-
}
|
|
1062
|
-
#internals;
|
|
1063
|
-
static {
|
|
1064
|
-
this.formAssociated = true;
|
|
1065
|
-
}
|
|
1066
|
-
get form() {
|
|
1067
|
-
return this.#internals.form;
|
|
1068
|
-
}
|
|
1069
|
-
get validity() {
|
|
1070
|
-
return this.#internals.validity;
|
|
1071
|
-
}
|
|
1072
|
-
get validationMessage() {
|
|
1073
|
-
return this.#internals.validationMessage;
|
|
1074
|
-
}
|
|
1075
|
-
get willValidate() {
|
|
1076
|
-
return this.#internals.willValidate;
|
|
1077
|
-
}
|
|
1078
|
-
checkValidity() {
|
|
1079
|
-
return this.#internals.checkValidity();
|
|
1080
|
-
}
|
|
1081
|
-
reportValidity() {
|
|
1082
|
-
return this.#internals.reportValidity();
|
|
1083
|
-
}
|
|
1084
|
-
connectedCallback() {
|
|
1085
|
-
super.connectedCallback();
|
|
1086
|
-
this.#internals.form?.addEventListener("reset", this._handleFormReset);
|
|
1087
|
-
}
|
|
1088
|
-
disconnectedCallback() {
|
|
1089
|
-
super.disconnectedCallback();
|
|
1090
|
-
this.#internals.form?.removeEventListener("reset", this._handleFormReset);
|
|
1091
|
-
}
|
|
1092
|
-
__handleValidityChange() {
|
|
1093
|
-
this.#internals.setValidity(
|
|
1094
|
-
{
|
|
1095
|
-
badInput: false,
|
|
1096
|
-
customError: this.invalid,
|
|
1097
|
-
patternMismatch: false,
|
|
1098
|
-
rangeOverflow: false,
|
|
1099
|
-
rangeUnderflow: false,
|
|
1100
|
-
stepMismatch: false,
|
|
1101
|
-
tooLong: false,
|
|
1102
|
-
tooShort: false,
|
|
1103
|
-
typeMismatch: false,
|
|
1104
|
-
valueMissing: false,
|
|
1105
|
-
valid: !this.invalid
|
|
1106
|
-
},
|
|
1107
|
-
this.validationMessage || "Error message"
|
|
1108
|
-
);
|
|
1109
|
-
}
|
|
1110
|
-
__handleValueChange() {
|
|
1111
|
-
this.#internals.setFormValue(this.value);
|
|
1112
|
-
}
|
|
1113
|
-
};
|
|
1114
|
-
__decorateClass([
|
|
1115
|
-
property4({
|
|
1116
|
-
type: Boolean,
|
|
1117
|
-
reflect: true,
|
|
1118
|
-
attribute: "aria-invalid",
|
|
1119
|
-
converter: {
|
|
1120
|
-
fromAttribute: Boolean,
|
|
1121
|
-
toAttribute: (value) => value?.toString()
|
|
1122
|
-
}
|
|
1123
|
-
})
|
|
1124
|
-
], GdsFormControlElement.prototype, "invalid", 2);
|
|
1125
|
-
__decorateClass([
|
|
1126
|
-
property4()
|
|
1127
|
-
], GdsFormControlElement.prototype, "value", 2);
|
|
1128
|
-
__decorateClass([
|
|
1129
|
-
property4({ reflect: true })
|
|
1130
|
-
], GdsFormControlElement.prototype, "name", 2);
|
|
1131
|
-
__decorateClass([
|
|
1132
|
-
watch("invalid")
|
|
1133
|
-
], GdsFormControlElement.prototype, "__handleValidityChange", 1);
|
|
1134
|
-
__decorateClass([
|
|
1135
|
-
watch("value")
|
|
1136
|
-
], GdsFormControlElement.prototype, "__handleValueChange", 1);
|
|
1137
|
-
|
|
1138
|
-
// libs/core/src/components/dropdown/dropdown.styles.ts
|
|
1139
|
-
import { css as css4 } from "lit";
|
|
1140
|
-
var style4 = css4`
|
|
1141
|
-
@layer base, reset, transitional-styles;
|
|
1142
|
-
|
|
1143
|
-
@layer base {
|
|
1144
|
-
button {
|
|
1145
|
-
appearance: none;
|
|
1146
|
-
display: block;
|
|
1147
|
-
background-color: black;
|
|
1148
|
-
border-radius: 2rem;
|
|
1149
|
-
border: none;
|
|
1150
|
-
color: white;
|
|
1151
|
-
padding: 0.7rem 2rem;
|
|
1152
|
-
margin: 0.5rem 0;
|
|
1153
|
-
box-sizing: border-box;
|
|
1154
|
-
}
|
|
1155
|
-
}
|
|
1156
|
-
`;
|
|
1157
|
-
var dropdown_styles_default = style4;
|
|
1158
|
-
|
|
1159
|
-
// libs/core/src/components/dropdown/dropdown.ts
|
|
1160
|
-
var _optionElements, _handleSearchFieldKeyUp, _handleSearchFieldKeyDown, _handleListboxKeyDown, _handleOptionFocusChange, _handleSelectionChange, handleSelectionChange_fn, _registerAutoCloseListener, registerAutoCloseListener_fn, _unregisterAutoCloseListener, unregisterAutoCloseListener_fn, _blurCloseListener, _tabCloseListener;
|
|
1161
|
-
var GdsDropdown = class extends GdsFormControlElement {
|
|
1162
|
-
constructor() {
|
|
1163
|
-
super();
|
|
1164
|
-
/**
|
|
1165
|
-
* Selects an option in the dropdown.
|
|
1166
|
-
*
|
|
1167
|
-
* @fires change
|
|
1168
|
-
*/
|
|
1169
|
-
__privateAdd(this, _handleSelectionChange);
|
|
1170
|
-
__privateAdd(this, _registerAutoCloseListener);
|
|
1171
|
-
__privateAdd(this, _unregisterAutoCloseListener);
|
|
1172
|
-
this.label = "";
|
|
1173
|
-
this.open = false;
|
|
1174
|
-
this.searchable = false;
|
|
1175
|
-
this.multiple = false;
|
|
1176
|
-
this.compareWith = (a, b) => a === b;
|
|
1177
|
-
this.searchFilter = (q, o) => o.innerHTML.toLowerCase().includes(q.toLowerCase());
|
|
1178
|
-
this.syncPopoverWidth = false;
|
|
1179
|
-
this.maxHeight = 500;
|
|
1180
|
-
this.size = "medium";
|
|
1181
|
-
this.hideLabel = false;
|
|
1182
|
-
__privateAdd(this, _optionElements, void 0);
|
|
1183
|
-
/**
|
|
1184
|
-
* Event handler for filtering the options in the dropdown.
|
|
1185
|
-
*
|
|
1186
|
-
* @param e The keyboard event.
|
|
1187
|
-
*/
|
|
1188
|
-
__privateAdd(this, _handleSearchFieldKeyUp, (e) => {
|
|
1189
|
-
const input = this._elSearchInput;
|
|
1190
|
-
const options = Array.from(__privateGet(this, _optionElements));
|
|
1191
|
-
options.forEach((o) => o.hidden = false);
|
|
1192
|
-
if (!input.value)
|
|
1193
|
-
return;
|
|
1194
|
-
const filteredOptions = options.filter(
|
|
1195
|
-
(o) => !this.searchFilter(input.value, o)
|
|
1196
|
-
);
|
|
1197
|
-
filteredOptions.forEach((o) => o.hidden = true);
|
|
1198
|
-
});
|
|
1199
|
-
/**
|
|
1200
|
-
* Check for ArrowDown or Tab in the search field.
|
|
1201
|
-
* If found, focus should be moved to the listbox.
|
|
1202
|
-
*/
|
|
1203
|
-
__privateAdd(this, _handleSearchFieldKeyDown, (e) => {
|
|
1204
|
-
this._elListbox?.then((listbox) => {
|
|
1205
|
-
if (e.key === "ArrowDown" || e.key === "Tab") {
|
|
1206
|
-
e.preventDefault();
|
|
1207
|
-
listbox.focus();
|
|
1208
|
-
return;
|
|
1209
|
-
}
|
|
1210
|
-
});
|
|
1211
|
-
});
|
|
1212
|
-
/**
|
|
1213
|
-
* Check for Tab in the listbox.
|
|
1214
|
-
* If found, focus should be moved to the search field.
|
|
1215
|
-
*/
|
|
1216
|
-
__privateAdd(this, _handleListboxKeyDown, (e) => {
|
|
1217
|
-
if (e.key === "Tab" && this.searchable) {
|
|
1218
|
-
e.preventDefault();
|
|
1219
|
-
this._elSearchInput?.focus();
|
|
1220
|
-
return;
|
|
1221
|
-
}
|
|
1222
|
-
});
|
|
1223
|
-
__privateAdd(this, _handleOptionFocusChange, (e) => {
|
|
1224
|
-
const triggerButton = this._elTriggerBtn;
|
|
1225
|
-
if (triggerButton)
|
|
1226
|
-
triggerButton.ariaActiveDescendantElement = e.target;
|
|
1227
|
-
});
|
|
1228
|
-
/**
|
|
1229
|
-
* A listener to close the dropdown when any other element is focused.
|
|
1230
|
-
*/
|
|
1231
|
-
__privateAdd(this, _blurCloseListener, (e) => {
|
|
1232
|
-
const isFocusOutside = e instanceof FocusEvent && e.relatedTarget && !this.contains(e.relatedTarget);
|
|
1233
|
-
if (isFocusOutside)
|
|
1234
|
-
this.open = false;
|
|
1235
|
-
});
|
|
1236
|
-
__privateAdd(this, _tabCloseListener, (e) => {
|
|
1237
|
-
if (e.key === "Tab" && !this.searchable) {
|
|
1238
|
-
e.preventDefault();
|
|
1239
|
-
this.open = false;
|
|
1240
|
-
this._elTriggerBtn?.focus();
|
|
1241
|
-
}
|
|
1242
|
-
});
|
|
1243
|
-
constrainSlots(this);
|
|
1244
|
-
updateWhenLocaleChanges(this);
|
|
1245
|
-
__privateSet(this, _optionElements, this.getElementsByTagName(
|
|
1246
|
-
getScopedTagName("gds-option")
|
|
1247
|
-
));
|
|
1248
|
-
}
|
|
1249
|
-
get type() {
|
|
1250
|
-
return "gds-dropdown";
|
|
1251
|
-
}
|
|
1252
|
-
/**
|
|
1253
|
-
* Get the options of the dropdown.
|
|
1254
|
-
*/
|
|
1255
|
-
get options() {
|
|
1256
|
-
return Array.from(__privateGet(this, _optionElements)).filter(
|
|
1257
|
-
(o) => !o.hasAttribute("isplaceholder")
|
|
1258
|
-
);
|
|
1259
|
-
}
|
|
1260
|
-
/**
|
|
1261
|
-
* Return the first option with a isPlaceholder attribute.
|
|
1262
|
-
* If no placeholder is found, this will be undefined.
|
|
1263
|
-
*/
|
|
1264
|
-
get placeholder() {
|
|
1265
|
-
return Array.from(__privateGet(this, _optionElements)).find(
|
|
1266
|
-
(o) => o.hasAttribute("isplaceholder")
|
|
1267
|
-
);
|
|
1268
|
-
}
|
|
1269
|
-
/**
|
|
1270
|
-
* Returns the display value as a string.
|
|
1271
|
-
* If the dropdown is in multiple mode, this will be a comma separated list of the selected values.
|
|
1272
|
-
*/
|
|
1273
|
-
get displayValue() {
|
|
1274
|
-
let displayValue;
|
|
1275
|
-
if (Array.isArray(this.value)) {
|
|
1276
|
-
this.value.length > 2 ? displayValue = msg2(str`${this.value.length} selected`) : displayValue = this.value.reduce(
|
|
1277
|
-
(acc, cur) => acc + this.options.find((v) => v.value === cur)?.innerHTML + ", ",
|
|
1278
|
-
""
|
|
1279
|
-
).slice(0, -2);
|
|
1280
|
-
} else {
|
|
1281
|
-
displayValue = this.options.find((v) => v.selected)?.innerHTML;
|
|
1282
|
-
}
|
|
1283
|
-
return displayValue || this.placeholder?.innerHTML || "";
|
|
1284
|
-
}
|
|
1285
|
-
connectedCallback() {
|
|
1286
|
-
super.connectedCallback();
|
|
1287
|
-
TransitionalStyles.instance.apply(this, "gds-dropdown");
|
|
1288
|
-
this.updateComplete.then(() => {
|
|
1289
|
-
this._handleLightDOMChange();
|
|
1290
|
-
this._handleValueChange();
|
|
1291
|
-
});
|
|
1292
|
-
}
|
|
1293
|
-
render() {
|
|
1294
|
-
return html`
|
|
1295
|
-
${this._tStyles}
|
|
1296
|
-
${when2(
|
|
1297
|
-
this.label && !this.hideLabel,
|
|
1298
|
-
() => html`<label for="trigger">${this.label}</label>`
|
|
1299
|
-
)}
|
|
1300
|
-
|
|
1301
|
-
<span class="form-info"><slot name="sub-label"></slot></span>
|
|
1302
|
-
|
|
1303
|
-
<button
|
|
1304
|
-
id="trigger"
|
|
1305
|
-
@click="${() => this.open = !this.open}"
|
|
1306
|
-
aria-haspopup="listbox"
|
|
1307
|
-
role="combobox"
|
|
1308
|
-
aria-owns="listbox"
|
|
1309
|
-
aria-controls="listbox"
|
|
1310
|
-
aria-expanded="${this.open}"
|
|
1311
|
-
aria-label="${this.label}"
|
|
1312
|
-
class=${classMap3({ small: this.size === "small" })}
|
|
1313
|
-
>
|
|
1314
|
-
<slot name="trigger">
|
|
1315
|
-
<span>${unsafeHTML2(this.displayValue)}</span>
|
|
1316
|
-
</slot>
|
|
1317
|
-
</button>
|
|
1318
|
-
|
|
1319
|
-
<span class="form-info"><slot name="message"></slot></span>
|
|
1320
|
-
|
|
1321
|
-
<gds-popover
|
|
1322
|
-
.label=${this.label}
|
|
1323
|
-
.open=${this.open}
|
|
1324
|
-
.triggerRef=${this._elTriggerBtnAsync}
|
|
1325
|
-
.calcMaxWidth=${(trigger) => this.syncPopoverWidth ? `${trigger.offsetWidth}px` : `auto`}
|
|
1326
|
-
.calcMaxHeight=${(_trigger) => `${this.maxHeight}px`}
|
|
1327
|
-
@gds-ui-state=${(e) => this.open = e.detail.open}
|
|
1328
|
-
>
|
|
1329
|
-
${when2(
|
|
1330
|
-
this.searchable,
|
|
1331
|
-
() => html`<input
|
|
1332
|
-
id="searchinput"
|
|
1333
|
-
type="text"
|
|
1334
|
-
aria-label="${msg2("Filter available options")}"
|
|
1335
|
-
placeholder="${msg2("Search")}"
|
|
1336
|
-
@keydown=${__privateGet(this, _handleSearchFieldKeyDown)}
|
|
1337
|
-
@keyup=${__privateGet(this, _handleSearchFieldKeyUp)}
|
|
1338
|
-
/>`
|
|
1339
|
-
)}
|
|
1340
|
-
|
|
1341
|
-
<gds-listbox
|
|
1342
|
-
id="listbox"
|
|
1343
|
-
.multiple="${ifDefined(this.multiple)}"
|
|
1344
|
-
.compareWith="${this.compareWith}"
|
|
1345
|
-
@change="${__privateMethod(this, _handleSelectionChange, handleSelectionChange_fn)}"
|
|
1346
|
-
@gds-focus="${__privateGet(this, _handleOptionFocusChange)}"
|
|
1347
|
-
@keydown=${__privateGet(this, _handleListboxKeyDown)}
|
|
1348
|
-
>
|
|
1349
|
-
<slot gds-allow="gds-option gds-menu-heading"></slot>
|
|
1350
|
-
</gds-listbox>
|
|
1351
|
-
</gds-popover>
|
|
1352
|
-
`;
|
|
1353
|
-
}
|
|
1354
|
-
_handleLightDOMChange() {
|
|
1355
|
-
this.requestUpdate();
|
|
1356
|
-
if (this.multiple) {
|
|
1357
|
-
this._handleValueChange();
|
|
1358
|
-
return;
|
|
1359
|
-
}
|
|
1360
|
-
if (this.value === void 0) {
|
|
1361
|
-
if (this.placeholder)
|
|
1362
|
-
this.value = this.placeholder.value;
|
|
1363
|
-
else
|
|
1364
|
-
this.value = this.options[0]?.value;
|
|
1365
|
-
} else if (!this.placeholder && this.options.find(
|
|
1366
|
-
(o) => this.compareWith(o.value, this.value)
|
|
1367
|
-
) === void 0) {
|
|
1368
|
-
this.options[0] && (this.options[0].selected = true);
|
|
1369
|
-
this.value = this.options[0]?.value;
|
|
1370
|
-
}
|
|
1371
|
-
}
|
|
1372
|
-
_handleValueChange() {
|
|
1373
|
-
this._elListbox.then((listbox) => {
|
|
1374
|
-
if (listbox) {
|
|
1375
|
-
if (Array.isArray(this.value))
|
|
1376
|
-
listbox.selection = this.value;
|
|
1377
|
-
else
|
|
1378
|
-
listbox.selection = [this.value];
|
|
1379
|
-
}
|
|
1380
|
-
});
|
|
1381
|
-
}
|
|
1382
|
-
_onOpenChange() {
|
|
1383
|
-
const open = this.open;
|
|
1384
|
-
Array.from(__privateGet(this, _optionElements)).forEach((o) => o.hidden = !open);
|
|
1385
|
-
if (open)
|
|
1386
|
-
__privateMethod(this, _registerAutoCloseListener, registerAutoCloseListener_fn).call(this);
|
|
1387
|
-
else {
|
|
1388
|
-
__privateMethod(this, _unregisterAutoCloseListener, unregisterAutoCloseListener_fn).call(this);
|
|
1389
|
-
this._elSearchInput && (this._elSearchInput.value = "");
|
|
1390
|
-
}
|
|
1391
|
-
this.dispatchEvent(
|
|
1392
|
-
new CustomEvent("gds-ui-state", {
|
|
1393
|
-
detail: { open },
|
|
1394
|
-
bubbles: true,
|
|
1395
|
-
composed: true
|
|
1396
|
-
})
|
|
1397
|
-
);
|
|
1398
|
-
}
|
|
1399
|
-
};
|
|
1400
|
-
_optionElements = new WeakMap();
|
|
1401
|
-
_handleSearchFieldKeyUp = new WeakMap();
|
|
1402
|
-
_handleSearchFieldKeyDown = new WeakMap();
|
|
1403
|
-
_handleListboxKeyDown = new WeakMap();
|
|
1404
|
-
_handleOptionFocusChange = new WeakMap();
|
|
1405
|
-
_handleSelectionChange = new WeakSet();
|
|
1406
|
-
handleSelectionChange_fn = function() {
|
|
1407
|
-
this._elListbox.then((listbox) => {
|
|
1408
|
-
if (this.multiple)
|
|
1409
|
-
this.value = listbox.selection.map((s) => s.value);
|
|
1410
|
-
else {
|
|
1411
|
-
this.value = listbox.selection[0]?.value;
|
|
1412
|
-
this.open = false;
|
|
1413
|
-
setTimeout(() => this._elTriggerBtn?.focus(), 0);
|
|
1414
|
-
}
|
|
1415
|
-
this.dispatchEvent(
|
|
1416
|
-
new CustomEvent("change", {
|
|
1417
|
-
detail: { value: this.value },
|
|
1418
|
-
bubbles: true,
|
|
1419
|
-
composed: true
|
|
1420
|
-
})
|
|
1421
|
-
);
|
|
1422
|
-
});
|
|
1423
|
-
};
|
|
1424
|
-
_registerAutoCloseListener = new WeakSet();
|
|
1425
|
-
registerAutoCloseListener_fn = function() {
|
|
1426
|
-
this.addEventListener("blur", __privateGet(this, _blurCloseListener));
|
|
1427
|
-
this.addEventListener("gds-blur", __privateGet(this, _blurCloseListener));
|
|
1428
|
-
this.addEventListener("keydown", __privateGet(this, _tabCloseListener));
|
|
1429
|
-
};
|
|
1430
|
-
_unregisterAutoCloseListener = new WeakSet();
|
|
1431
|
-
unregisterAutoCloseListener_fn = function() {
|
|
1432
|
-
this.removeEventListener("blur", __privateGet(this, _blurCloseListener));
|
|
1433
|
-
this.removeEventListener("gds-blur", __privateGet(this, _blurCloseListener));
|
|
1434
|
-
this.removeEventListener("keydown", __privateGet(this, _tabCloseListener));
|
|
1435
|
-
};
|
|
1436
|
-
_blurCloseListener = new WeakMap();
|
|
1437
|
-
_tabCloseListener = new WeakMap();
|
|
1438
|
-
GdsDropdown.styles = dropdown_styles_default;
|
|
1439
|
-
GdsDropdown.shadowRootOptions = {
|
|
1440
|
-
mode: "open",
|
|
1441
|
-
delegatesFocus: true
|
|
1442
|
-
};
|
|
1443
|
-
__decorateClass([
|
|
1444
|
-
property5()
|
|
1445
|
-
], GdsDropdown.prototype, "label", 2);
|
|
1446
|
-
__decorateClass([
|
|
1447
|
-
property5({ type: Boolean, reflect: true })
|
|
1448
|
-
], GdsDropdown.prototype, "open", 2);
|
|
1449
|
-
__decorateClass([
|
|
1450
|
-
property5({ type: Boolean, reflect: true })
|
|
1451
|
-
], GdsDropdown.prototype, "searchable", 2);
|
|
1452
|
-
__decorateClass([
|
|
1453
|
-
property5({ type: Boolean, reflect: true })
|
|
1454
|
-
], GdsDropdown.prototype, "multiple", 2);
|
|
1455
|
-
__decorateClass([
|
|
1456
|
-
property5()
|
|
1457
|
-
], GdsDropdown.prototype, "compareWith", 2);
|
|
1458
|
-
__decorateClass([
|
|
1459
|
-
property5()
|
|
1460
|
-
], GdsDropdown.prototype, "searchFilter", 2);
|
|
1461
|
-
__decorateClass([
|
|
1462
|
-
property5({ type: Boolean, attribute: "sync-popover-width" })
|
|
1463
|
-
], GdsDropdown.prototype, "syncPopoverWidth", 2);
|
|
1464
|
-
__decorateClass([
|
|
1465
|
-
property5({ type: Number, attribute: "max-height" })
|
|
1466
|
-
], GdsDropdown.prototype, "maxHeight", 2);
|
|
1467
|
-
__decorateClass([
|
|
1468
|
-
property5()
|
|
1469
|
-
], GdsDropdown.prototype, "size", 2);
|
|
1470
|
-
__decorateClass([
|
|
1471
|
-
property5({ type: Boolean, attribute: "hide-label" })
|
|
1472
|
-
], GdsDropdown.prototype, "hideLabel", 2);
|
|
1473
|
-
__decorateClass([
|
|
1474
|
-
state4()
|
|
1475
|
-
], GdsDropdown.prototype, "_tStyles", 2);
|
|
1476
|
-
__decorateClass([
|
|
1477
|
-
query("#trigger")
|
|
1478
|
-
], GdsDropdown.prototype, "_elTriggerBtn", 2);
|
|
1479
|
-
__decorateClass([
|
|
1480
|
-
queryAsync("#trigger")
|
|
1481
|
-
], GdsDropdown.prototype, "_elTriggerBtnAsync", 2);
|
|
1482
|
-
__decorateClass([
|
|
1483
|
-
queryAsync("#listbox")
|
|
1484
|
-
], GdsDropdown.prototype, "_elListbox", 2);
|
|
1485
|
-
__decorateClass([
|
|
1486
|
-
query("#searchinput")
|
|
1487
|
-
], GdsDropdown.prototype, "_elSearchInput", 2);
|
|
1488
|
-
__decorateClass([
|
|
1489
|
-
observeLightDOM({
|
|
1490
|
-
attributes: true,
|
|
1491
|
-
childList: true,
|
|
1492
|
-
subtree: true,
|
|
1493
|
-
characterData: true
|
|
1494
|
-
})
|
|
1495
|
-
], GdsDropdown.prototype, "_handleLightDOMChange", 1);
|
|
1496
|
-
__decorateClass([
|
|
1497
|
-
watch("value")
|
|
1498
|
-
], GdsDropdown.prototype, "_handleValueChange", 1);
|
|
1499
|
-
__decorateClass([
|
|
1500
|
-
watch("open")
|
|
1501
|
-
], GdsDropdown.prototype, "_onOpenChange", 1);
|
|
1502
|
-
GdsDropdown = __decorateClass([
|
|
1503
|
-
gdsCustomElement("gds-dropdown")
|
|
1504
|
-
], GdsDropdown);
|
|
1505
|
-
|
|
1506
|
-
// libs/core/src/primitives/menu/menu-heading.ts
|
|
1507
|
-
import { html as html5 } from "lit";
|
|
1508
|
-
|
|
1509
|
-
// libs/core/src/primitives/menu/menu-heading.styles.ts
|
|
1510
|
-
import { css as css5 } from "lit";
|
|
1511
|
-
var style5 = css5`
|
|
1512
|
-
@layer base, reset, transitional-styles;
|
|
1513
|
-
@layer base {
|
|
1514
|
-
:host {
|
|
1515
|
-
padding: 0.5 1rem;
|
|
1516
|
-
cursor: pointer;
|
|
1517
|
-
}
|
|
1518
|
-
|
|
1519
|
-
:host(:hover) {
|
|
1520
|
-
background-color: grey;
|
|
1521
|
-
}
|
|
1522
|
-
}
|
|
1523
|
-
`;
|
|
1524
|
-
var menu_heading_styles_default = style5;
|
|
1525
|
-
|
|
1526
|
-
// libs/core/src/primitives/menu/menu-heading.ts
|
|
1527
|
-
var GdsMenuHeading = class extends GdsElement {
|
|
1528
|
-
connectedCallback() {
|
|
1529
|
-
super.connectedCallback();
|
|
1530
|
-
this.setAttribute("inert", "true");
|
|
1531
|
-
this.updateComplete.then(
|
|
1532
|
-
() => TransitionalStyles.instance.apply(this, "gds-menu-heading")
|
|
1533
|
-
);
|
|
1534
|
-
}
|
|
1535
|
-
render() {
|
|
1536
|
-
return html5`<slot></slot>`;
|
|
1537
|
-
}
|
|
1538
|
-
};
|
|
1539
|
-
GdsMenuHeading.styles = menu_heading_styles_default;
|
|
1540
|
-
GdsMenuHeading = __decorateClass([
|
|
1541
|
-
gdsCustomElement("gds-menu-heading")
|
|
1542
|
-
], GdsMenuHeading);
|
|
1543
|
-
|
|
1544
|
-
// libs/core/src/components/context-menu/context-menu.ts
|
|
1545
|
-
import { nothing } from "lit";
|
|
1546
|
-
import { msg as msg3 } from "@lit/localize";
|
|
1547
|
-
import { classMap as classMap4 } from "lit-html/directives/class-map.js";
|
|
1548
|
-
import { property as property6, queryAsync as queryAsync2, state as state6 } from "lit/decorators.js";
|
|
1549
|
-
|
|
1550
|
-
// libs/core/src/components/context-menu/context-menu.styles.ts
|
|
1551
|
-
import { css as css6 } from "lit";
|
|
1552
|
-
var style6 = css6`
|
|
1553
|
-
@layer base, reset, transitional-styles;
|
|
1554
|
-
@layer base {
|
|
1555
|
-
button {
|
|
1556
|
-
display: flex;
|
|
1557
|
-
border-width: 0;
|
|
1558
|
-
background-color: #ededed;
|
|
1559
|
-
border-radius: calc(1px * infinity);
|
|
1560
|
-
padding: 0.4rem 0.8rem;
|
|
1561
|
-
font-family: inherit;
|
|
1562
|
-
cursor: pointer;
|
|
1563
|
-
align-items: center;
|
|
1564
|
-
gap: 0.5rem;
|
|
1565
|
-
}
|
|
1566
|
-
|
|
1567
|
-
button:hover {
|
|
1568
|
-
background-color: #dcdcdc;
|
|
1569
|
-
}
|
|
1570
|
-
}
|
|
1571
|
-
`;
|
|
1572
|
-
var context_menu_styles_default = style6;
|
|
1573
|
-
|
|
1574
|
-
// libs/core/src/primitives/menu/menu.ts
|
|
1575
|
-
import { createRef as createRef3, ref as ref3 } from "lit/directives/ref.js";
|
|
1576
|
-
import { state as state5 } from "lit/decorators.js";
|
|
1577
|
-
var _slotRef2;
|
|
1578
|
-
var GdsMenu = class extends GdsElement {
|
|
1579
|
-
constructor() {
|
|
1580
|
-
super();
|
|
1581
|
-
__privateAdd(this, _slotRef2, createRef3());
|
|
1582
|
-
new ListboxKbNavController(this);
|
|
1583
|
-
}
|
|
1584
|
-
connectedCallback() {
|
|
1585
|
-
super.connectedCallback();
|
|
1586
|
-
this.setAttribute("role", "menu");
|
|
1587
|
-
TransitionalStyles.instance.apply(this, "gds-listbox");
|
|
1588
|
-
}
|
|
1589
|
-
get navigableItems() {
|
|
1590
|
-
if (!__privateGet(this, _slotRef2).value)
|
|
1591
|
-
return [];
|
|
1592
|
-
return unwrap(__privateGet(this, _slotRef2).value).assignedElements().filter(
|
|
1593
|
-
(o) => !o.hasAttribute("isplaceholder") && o.gdsElementName === "gds-menu-item"
|
|
1594
|
-
) || [];
|
|
1595
|
-
}
|
|
1596
|
-
/**
|
|
1597
|
-
* Focuses the first item in the menu.
|
|
1598
|
-
*/
|
|
1599
|
-
focus() {
|
|
1600
|
-
this.navigableItems[0]?.focus();
|
|
1601
|
-
}
|
|
1602
|
-
render() {
|
|
1603
|
-
return html`${this._tStyles}<slot ${ref3(__privateGet(this, _slotRef2))}></slot>`;
|
|
1604
|
-
}
|
|
1605
|
-
};
|
|
1606
|
-
_slotRef2 = new WeakMap();
|
|
1607
|
-
__decorateClass([
|
|
1608
|
-
state5()
|
|
1609
|
-
], GdsMenu.prototype, "_tStyles", 2);
|
|
1610
|
-
GdsMenu = __decorateClass([
|
|
1611
|
-
gdsCustomElement("gds-menu")
|
|
1612
|
-
], GdsMenu);
|
|
1613
|
-
|
|
1614
|
-
// libs/core/src/components/context-menu/context-menu.ts
|
|
1615
|
-
var _handleItemClick, handleItemClick_fn;
|
|
1616
|
-
var GdsContextMenu = class extends GdsElement {
|
|
1617
|
-
constructor() {
|
|
1618
|
-
super();
|
|
1619
|
-
__privateAdd(this, _handleItemClick);
|
|
1620
|
-
this.open = false;
|
|
1621
|
-
this.buttonLabel = msg3("Open context menu");
|
|
1622
|
-
this.showLabel = false;
|
|
1623
|
-
this.label = "";
|
|
1624
|
-
this.placement = "bottom-start";
|
|
1625
|
-
constrainSlots(this);
|
|
1626
|
-
}
|
|
1627
|
-
connectedCallback() {
|
|
1628
|
-
super.connectedCallback();
|
|
1629
|
-
TransitionalStyles.instance.apply(this, "gds-context-menu");
|
|
1630
|
-
this.addEventListener("keydown", (e) => {
|
|
1631
|
-
if (this.open && e.key == "Tab") {
|
|
1632
|
-
e.preventDefault();
|
|
1633
|
-
this.open = false;
|
|
1634
|
-
this.elTriggerBtn.then((el) => el.focus());
|
|
1635
|
-
}
|
|
1636
|
-
});
|
|
1637
|
-
}
|
|
1638
|
-
render() {
|
|
1639
|
-
return html`${this._tStyles}
|
|
1640
|
-
<button
|
|
1641
|
-
id="trigger"
|
|
1642
|
-
class="icon border-0 small ${classMap4({ highlighted: this.open })}"
|
|
1643
|
-
aria-label=${this.buttonLabel ?? this.label}
|
|
1644
|
-
aria-haspopup="menu"
|
|
1645
|
-
aria-controls="menu"
|
|
1646
|
-
aria-expanded=${this.open}
|
|
1647
|
-
@click=${() => this.open = !this.open}
|
|
1648
|
-
>
|
|
1649
|
-
<slot name="trigger">
|
|
1650
|
-
${this.showLabel ? this.buttonLabel ?? this.label : nothing}
|
|
1651
|
-
<svg width="24" height="24" viewBox="0 0 24 24">
|
|
1652
|
-
<path
|
|
1653
|
-
d="M14 12C14 13.1042 13.1042 14 12 14C10.8958 14 10 13.1042 10 12C10 10.8958 10.8958 10 12 10C13.1042 10 14 10.8958 14 12ZM19 10C17.8958 10 17 10.8958 17 12C17 13.1042 17.8958 14 19 14C20.1042 14 21 13.1042 21 12C21 10.8958 20.1042 10 19 10ZM5 10C3.89583 10 3 10.8958 3 12C3 13.1042 3.89583 14 5 14C6.10417 14 7 13.1042 7 12C7 10.8958 6.10417 10 5 10Z"
|
|
1654
|
-
fill="#353531"
|
|
1655
|
-
/>
|
|
1656
|
-
</svg>
|
|
1657
|
-
</slot>
|
|
1658
|
-
</button>
|
|
1659
|
-
<gds-popover
|
|
1660
|
-
id="menu"
|
|
1661
|
-
.open=${this.open}
|
|
1662
|
-
.triggerRef=${this.elTriggerBtn}
|
|
1663
|
-
.label=${this.label}
|
|
1664
|
-
.placement=${this.placement}
|
|
1665
|
-
@gds-ui-state=${(e) => this.open = e.detail.open}
|
|
1666
|
-
>
|
|
1667
|
-
<gds-menu
|
|
1668
|
-
aria-label=${this.label ?? this.buttonLabel}
|
|
1669
|
-
@gds-menu-item-click=${__privateMethod(this, _handleItemClick, handleItemClick_fn)}
|
|
1670
|
-
>
|
|
1671
|
-
<slot allow="gds-menu-item gds-menu-heading"></slot>
|
|
1672
|
-
</gds-menu>
|
|
1673
|
-
</gds-popover>`;
|
|
1674
|
-
}
|
|
1675
|
-
};
|
|
1676
|
-
_handleItemClick = new WeakSet();
|
|
1677
|
-
handleItemClick_fn = function() {
|
|
1678
|
-
this.open = false;
|
|
1679
|
-
};
|
|
1680
|
-
GdsContextMenu.styles = [context_menu_styles_default];
|
|
1681
|
-
GdsContextMenu.shadowRootOptions = {
|
|
1682
|
-
mode: "open",
|
|
1683
|
-
delegatesFocus: true
|
|
1684
|
-
};
|
|
1685
|
-
__decorateClass([
|
|
1686
|
-
property6({ type: Boolean, reflect: true })
|
|
1687
|
-
], GdsContextMenu.prototype, "open", 2);
|
|
1688
|
-
__decorateClass([
|
|
1689
|
-
property6({
|
|
1690
|
-
attribute: "button-label"
|
|
1691
|
-
})
|
|
1692
|
-
], GdsContextMenu.prototype, "buttonLabel", 2);
|
|
1693
|
-
__decorateClass([
|
|
1694
|
-
property6({
|
|
1695
|
-
attribute: "show-label"
|
|
1696
|
-
})
|
|
1697
|
-
], GdsContextMenu.prototype, "showLabel", 2);
|
|
1698
|
-
__decorateClass([
|
|
1699
|
-
property6()
|
|
1700
|
-
], GdsContextMenu.prototype, "label", 2);
|
|
1701
|
-
__decorateClass([
|
|
1702
|
-
property6()
|
|
1703
|
-
], GdsContextMenu.prototype, "placement", 2);
|
|
1704
|
-
__decorateClass([
|
|
1705
|
-
state6()
|
|
1706
|
-
], GdsContextMenu.prototype, "_tStyles", 2);
|
|
1707
|
-
__decorateClass([
|
|
1708
|
-
queryAsync2("#trigger")
|
|
1709
|
-
], GdsContextMenu.prototype, "elTriggerBtn", 2);
|
|
1710
|
-
GdsContextMenu = __decorateClass([
|
|
1711
|
-
gdsCustomElement("gds-context-menu")
|
|
1712
|
-
], GdsContextMenu);
|
|
1713
|
-
|
|
1714
|
-
// libs/core/src/primitives/menu/menu-item.ts
|
|
1715
|
-
import { state as state7 } from "lit/decorators.js";
|
|
1716
|
-
var _handleOnClick;
|
|
1717
|
-
var GdsMenuItem = class extends Focusable(GdsElement) {
|
|
1718
|
-
constructor() {
|
|
1719
|
-
super(...arguments);
|
|
1720
|
-
__privateAdd(this, _handleOnClick, () => {
|
|
1721
|
-
this.dispatchEvent(
|
|
1722
|
-
new CustomEvent("gds-menu-item-click", {
|
|
1723
|
-
bubbles: true,
|
|
1724
|
-
composed: true
|
|
1725
|
-
})
|
|
1726
|
-
);
|
|
1727
|
-
});
|
|
1728
|
-
}
|
|
1729
|
-
connectedCallback() {
|
|
1730
|
-
super.connectedCallback();
|
|
1731
|
-
this.setAttribute("role", "menuitem");
|
|
1732
|
-
this.addEventListener("keydown", (e) => {
|
|
1733
|
-
if (e.key !== "Enter" && e.key !== " ")
|
|
1734
|
-
return;
|
|
1735
|
-
e.preventDefault();
|
|
1736
|
-
this.click();
|
|
1737
|
-
});
|
|
1738
|
-
this.addEventListener("click", __privateGet(this, _handleOnClick));
|
|
1739
|
-
TransitionalStyles.instance.apply(this, "gds-option");
|
|
1740
|
-
}
|
|
1741
|
-
render() {
|
|
1742
|
-
return html`${this._tStyles}
|
|
1743
|
-
<div><slot></slot></div>`;
|
|
1744
|
-
}
|
|
1745
|
-
};
|
|
1746
|
-
_handleOnClick = new WeakMap();
|
|
1747
|
-
GdsMenuItem.styles = [option_styles_default];
|
|
1748
|
-
__decorateClass([
|
|
1749
|
-
state7()
|
|
1750
|
-
], GdsMenuItem.prototype, "_tStyles", 2);
|
|
1751
|
-
GdsMenuItem = __decorateClass([
|
|
1752
|
-
gdsCustomElement("gds-menu-item")
|
|
1753
|
-
], GdsMenuItem);
|
|
1754
|
-
|
|
1755
|
-
// libs/core/src/components/datepicker/datepicker.ts
|
|
1756
|
-
import { property as property9, query as query3, queryAll, queryAsync as queryAsync3, state as state10 } from "lit/decorators.js";
|
|
1757
|
-
import { join } from "lit/directives/join.js";
|
|
1758
|
-
import { when as when4 } from "lit/directives/when.js";
|
|
1759
|
-
import { until } from "lit/directives/until.js";
|
|
1760
|
-
import { map } from "lit/directives/map.js";
|
|
1761
|
-
import { repeat } from "lit/directives/repeat.js";
|
|
1762
|
-
import { classMap as classMap6 } from "lit/directives/class-map.js";
|
|
1763
|
-
import { nothing as nothing2 } from "lit";
|
|
1764
|
-
import { msg as msg5 } from "@lit/localize";
|
|
1765
|
-
|
|
1766
|
-
// libs/core/src/primitives/calendar/calendar.ts
|
|
1767
|
-
import { html as html7 } from "lit";
|
|
1768
|
-
import { classMap as classMap5 } from "lit/directives/class-map.js";
|
|
1769
|
-
import { when as when3 } from "lit/directives/when.js";
|
|
1770
|
-
import { property as property7, query as query2, state as state8 } from "lit/decorators.js";
|
|
1771
|
-
import { msg as msg4 } from "@lit/localize";
|
|
3
|
+
GdsSegmentedControl
|
|
4
|
+
} from "./chunks/chunk.522C22QY.js";
|
|
5
|
+
import "./chunks/chunk.TSDZQZBY.js";
|
|
6
|
+
import "./chunks/chunk.3SEVAGLE.js";
|
|
1772
7
|
import {
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
isSameMonth,
|
|
1776
|
-
getWeek,
|
|
1777
|
-
subMonths,
|
|
1778
|
-
addMonths
|
|
1779
|
-
} from "date-fns";
|
|
1780
|
-
|
|
1781
|
-
// libs/core/src/primitives/calendar/functions.ts
|
|
8
|
+
GdsTheme
|
|
9
|
+
} from "./chunks/chunk.XI4H54TV.js";
|
|
1782
10
|
import {
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
} from "
|
|
1789
|
-
import {
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
import {
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
}
|
|
1848
|
-
set focusedYear(year) {
|
|
1849
|
-
this.focusedDate = new Date(this.focusedDate.setFullYear(year));
|
|
1850
|
-
}
|
|
1851
|
-
/**
|
|
1852
|
-
* Returns the date cell element for the given day number.
|
|
1853
|
-
*/
|
|
1854
|
-
getDateCell(dayNumber) {
|
|
1855
|
-
return this.shadowRoot?.querySelector(`#dateCell-${dayNumber}`);
|
|
1856
|
-
}
|
|
1857
|
-
connectedCallback() {
|
|
1858
|
-
super.connectedCallback();
|
|
1859
|
-
TransitionalStyles.instance.apply(this, "gds-calendar");
|
|
1860
|
-
this.addEventListener("keydown", __privateMethod(this, _handleKeyDown, handleKeyDown_fn));
|
|
1861
|
-
}
|
|
1862
|
-
focus() {
|
|
1863
|
-
super.focus();
|
|
1864
|
-
this._elFocusedCell?.focus();
|
|
1865
|
-
}
|
|
1866
|
-
render() {
|
|
1867
|
-
const currentDate = /* @__PURE__ */ new Date();
|
|
1868
|
-
return html7`${this._tStyles}
|
|
1869
|
-
<table>
|
|
1870
|
-
<thead>
|
|
1871
|
-
<tr>
|
|
1872
|
-
${when3(this.showWeekNumbers, () => html7`<th></th>`)}
|
|
1873
|
-
<th>${msg4("Mon")}</th>
|
|
1874
|
-
<th>${msg4("Tue")}</th>
|
|
1875
|
-
<th>${msg4("Wed")}</th>
|
|
1876
|
-
<th>${msg4("Thu")}</th>
|
|
1877
|
-
<th>${msg4("Fri")}</th>
|
|
1878
|
-
<th>${msg4("Sat")}</th>
|
|
1879
|
-
<th>${msg4("Sun")}</th>
|
|
1880
|
-
</tr>
|
|
1881
|
-
</thead>
|
|
1882
|
-
<tbody>
|
|
1883
|
-
${renderMonthGridView(
|
|
1884
|
-
this.focusedDate,
|
|
1885
|
-
(weeks) => html7`
|
|
1886
|
-
${weeks.map(
|
|
1887
|
-
(week) => html7`
|
|
1888
|
-
<tr>
|
|
1889
|
-
${when3(
|
|
1890
|
-
this.showWeekNumbers,
|
|
1891
|
-
() => html7`<td class="week-number">
|
|
1892
|
-
${getWeek(week.days[0])}
|
|
1893
|
-
</td>`
|
|
1894
|
-
)}
|
|
1895
|
-
${week.days.map((day) => {
|
|
1896
|
-
const isOutsideCurrentMonth = !isSameMonth(this.focusedDate, day) || day < this.min || day > this.max;
|
|
1897
|
-
const isWeekend = day.getDay() === 0 || day.getDay() === 6;
|
|
1898
|
-
const isDisabled = isOutsideCurrentMonth || this.disabledWeekends && isWeekend || this.disabledDates && this.disabledDates.some((d) => isSameDay(d, day));
|
|
1899
|
-
return html7`
|
|
1900
|
-
<td
|
|
1901
|
-
class="${classMap5({
|
|
1902
|
-
disabled: Boolean(isDisabled),
|
|
1903
|
-
today: isSameDay(currentDate, day)
|
|
1904
|
-
})}"
|
|
1905
|
-
?disabled=${isDisabled}
|
|
1906
|
-
tabindex="${isSameDay(this.focusedDate, day) ? 0 : -1}"
|
|
1907
|
-
aria-selected="${this.value && isSameDay(this.value, day)}"
|
|
1908
|
-
aria-label="${day.toDateString()}"
|
|
1909
|
-
@click=${() => isDisabled ? null : __privateMethod(this, _setSelectedDate, setSelectedDate_fn).call(this, day)}
|
|
1910
|
-
id="dateCell-${day.getDate()}"
|
|
1911
|
-
>
|
|
1912
|
-
${day.getDate()}
|
|
1913
|
-
</td>
|
|
1914
|
-
`;
|
|
1915
|
-
})}
|
|
1916
|
-
</tr>
|
|
1917
|
-
`
|
|
1918
|
-
)}
|
|
1919
|
-
`
|
|
1920
|
-
)}
|
|
1921
|
-
</tbody>
|
|
1922
|
-
</table>`;
|
|
1923
|
-
}
|
|
1924
|
-
_valueChanged() {
|
|
1925
|
-
if (!this.value)
|
|
1926
|
-
return;
|
|
1927
|
-
this.focusedDate = this.value;
|
|
1928
|
-
}
|
|
1929
|
-
};
|
|
1930
|
-
_setSelectedDate = new WeakSet();
|
|
1931
|
-
setSelectedDate_fn = function(date) {
|
|
1932
|
-
this.value = date;
|
|
1933
|
-
this.dispatchEvent(
|
|
1934
|
-
new CustomEvent("change", {
|
|
1935
|
-
detail: date,
|
|
1936
|
-
bubbles: false,
|
|
1937
|
-
composed: false
|
|
1938
|
-
})
|
|
1939
|
-
);
|
|
1940
|
-
};
|
|
1941
|
-
_handleKeyDown = new WeakSet();
|
|
1942
|
-
handleKeyDown_fn = function(e) {
|
|
1943
|
-
let handled = false;
|
|
1944
|
-
let newFocusedDate = new Date(this.focusedDate);
|
|
1945
|
-
if (e.key === "ArrowLeft") {
|
|
1946
|
-
newFocusedDate = addDays2(this.focusedDate, -1);
|
|
1947
|
-
handled = true;
|
|
1948
|
-
} else if (e.key === "ArrowRight") {
|
|
1949
|
-
newFocusedDate = addDays2(this.focusedDate, 1);
|
|
1950
|
-
handled = true;
|
|
1951
|
-
} else if (e.key === "ArrowUp") {
|
|
1952
|
-
newFocusedDate = addDays2(this.focusedDate, -7);
|
|
1953
|
-
handled = true;
|
|
1954
|
-
} else if (e.key === "ArrowDown") {
|
|
1955
|
-
newFocusedDate = addDays2(this.focusedDate, 7);
|
|
1956
|
-
handled = true;
|
|
1957
|
-
} else if (e.key === "Enter" || e.key === " ") {
|
|
1958
|
-
if (!this._elFocusedCell?.hasAttribute("disabled")) {
|
|
1959
|
-
__privateMethod(this, _setSelectedDate, setSelectedDate_fn).call(this, this.focusedDate);
|
|
1960
|
-
}
|
|
1961
|
-
handled = true;
|
|
1962
|
-
} else if (e.key === "Home") {
|
|
1963
|
-
newFocusedDate = new Date(this.focusedYear, this.focusedMonth, 1);
|
|
1964
|
-
handled = true;
|
|
1965
|
-
} else if (e.key === "End") {
|
|
1966
|
-
newFocusedDate = new Date(this.focusedYear, this.focusedMonth + 1, 0);
|
|
1967
|
-
handled = true;
|
|
1968
|
-
} else if (e.key === "PageUp") {
|
|
1969
|
-
newFocusedDate = subMonths(this.focusedDate, 1);
|
|
1970
|
-
handled = true;
|
|
1971
|
-
} else if (e.key === "PageDown") {
|
|
1972
|
-
newFocusedDate = addMonths(this.focusedDate, 1);
|
|
1973
|
-
handled = true;
|
|
1974
|
-
}
|
|
1975
|
-
if (newFocusedDate.getFullYear() >= this.min.getFullYear() && newFocusedDate.getFullYear() <= this.max.getFullYear()) {
|
|
1976
|
-
this.focusedDate = newFocusedDate;
|
|
1977
|
-
}
|
|
1978
|
-
if (handled) {
|
|
1979
|
-
e.preventDefault();
|
|
1980
|
-
e.stopPropagation();
|
|
1981
|
-
this.updateComplete.then(() => {
|
|
1982
|
-
this._elFocusedCell?.focus();
|
|
1983
|
-
this.dispatchEvent(
|
|
1984
|
-
new CustomEvent("gds-date-focused", {
|
|
1985
|
-
detail: this.focusedDate,
|
|
1986
|
-
bubbles: false,
|
|
1987
|
-
composed: false
|
|
1988
|
-
})
|
|
1989
|
-
);
|
|
1990
|
-
});
|
|
1991
|
-
}
|
|
1992
|
-
};
|
|
1993
|
-
GdsCalendar.styles = [calendar_styles_default];
|
|
1994
|
-
GdsCalendar.shadowRootOptions = {
|
|
1995
|
-
mode: "open",
|
|
1996
|
-
delegatesFocus: true
|
|
1997
|
-
};
|
|
1998
|
-
__decorateClass([
|
|
1999
|
-
property7()
|
|
2000
|
-
], GdsCalendar.prototype, "value", 2);
|
|
2001
|
-
__decorateClass([
|
|
2002
|
-
property7({ type: Date })
|
|
2003
|
-
], GdsCalendar.prototype, "min", 2);
|
|
2004
|
-
__decorateClass([
|
|
2005
|
-
property7({ type: Date })
|
|
2006
|
-
], GdsCalendar.prototype, "max", 2);
|
|
2007
|
-
__decorateClass([
|
|
2008
|
-
property7()
|
|
2009
|
-
], GdsCalendar.prototype, "focusedDate", 2);
|
|
2010
|
-
__decorateClass([
|
|
2011
|
-
property7({ type: Boolean, attribute: "disabled-weekends" })
|
|
2012
|
-
], GdsCalendar.prototype, "disabledWeekends", 2);
|
|
2013
|
-
__decorateClass([
|
|
2014
|
-
property7({ type: Array, attribute: "disabled-dates" })
|
|
2015
|
-
], GdsCalendar.prototype, "disabledDates", 2);
|
|
2016
|
-
__decorateClass([
|
|
2017
|
-
property7({ type: Number })
|
|
2018
|
-
], GdsCalendar.prototype, "focusedMonth", 1);
|
|
2019
|
-
__decorateClass([
|
|
2020
|
-
property7({ type: Number })
|
|
2021
|
-
], GdsCalendar.prototype, "focusedYear", 1);
|
|
2022
|
-
__decorateClass([
|
|
2023
|
-
property7({ type: Boolean })
|
|
2024
|
-
], GdsCalendar.prototype, "showWeekNumbers", 2);
|
|
2025
|
-
__decorateClass([
|
|
2026
|
-
query2('td[tabindex="0"]')
|
|
2027
|
-
], GdsCalendar.prototype, "_elFocusedCell", 2);
|
|
2028
|
-
__decorateClass([
|
|
2029
|
-
state8()
|
|
2030
|
-
], GdsCalendar.prototype, "_tStyles", 2);
|
|
2031
|
-
__decorateClass([
|
|
2032
|
-
watch("value")
|
|
2033
|
-
], GdsCalendar.prototype, "_valueChanged", 1);
|
|
2034
|
-
GdsCalendar = __decorateClass([
|
|
2035
|
-
gdsCustomElement("gds-calendar")
|
|
2036
|
-
], GdsCalendar);
|
|
2037
|
-
|
|
2038
|
-
// libs/core/src/components/datepicker/date-part-spinner.ts
|
|
2039
|
-
import { LitElement as LitElement5 } from "lit";
|
|
2040
|
-
import { property as property8, state as state9 } from "lit/decorators.js";
|
|
2041
|
-
var _inputBuffer, _increment, _decrement, _handleClick, _handleFocus, _handleBlur, _handleWheel, _handleKeyDown2, _focusNextSpinner, focusNextSpinner_fn, _dispatchChangeEvent, dispatchChangeEvent_fn, _formatNumber, formatNumber_fn, _clamp, clamp_fn, _clearInputBuffer, clearInputBuffer_fn;
|
|
2042
|
-
var GdsDatePartSpinner = class extends LitElement5 {
|
|
2043
|
-
constructor() {
|
|
2044
|
-
super(...arguments);
|
|
2045
|
-
__privateAdd(this, _focusNextSpinner);
|
|
2046
|
-
__privateAdd(this, _dispatchChangeEvent);
|
|
2047
|
-
__privateAdd(this, _formatNumber);
|
|
2048
|
-
__privateAdd(this, _clamp);
|
|
2049
|
-
__privateAdd(this, _clearInputBuffer);
|
|
2050
|
-
this.value = 0;
|
|
2051
|
-
this.length = 2;
|
|
2052
|
-
this.min = 0;
|
|
2053
|
-
this.max = Number.MAX_SAFE_INTEGER;
|
|
2054
|
-
this.displayValue = __privateMethod(this, _formatNumber, formatNumber_fn).call(this, this.value, this.length);
|
|
2055
|
-
__privateAdd(this, _inputBuffer, "");
|
|
2056
|
-
__privateAdd(this, _increment, () => {
|
|
2057
|
-
let current = parseInt(this.value.toString());
|
|
2058
|
-
if (Number.isNaN(current))
|
|
2059
|
-
current = this.length === 2 ? this.min : (/* @__PURE__ */ new Date()).getFullYear() - 1;
|
|
2060
|
-
this.value = __privateMethod(this, _clamp, clamp_fn).call(this, current + 1);
|
|
2061
|
-
__privateMethod(this, _dispatchChangeEvent, dispatchChangeEvent_fn).call(this);
|
|
2062
|
-
});
|
|
2063
|
-
__privateAdd(this, _decrement, () => {
|
|
2064
|
-
let current = parseInt(this.value.toString());
|
|
2065
|
-
if (Number.isNaN(current))
|
|
2066
|
-
current = this.length === 2 ? this.max : (/* @__PURE__ */ new Date()).getFullYear() + 1;
|
|
2067
|
-
this.value = __privateMethod(this, _clamp, clamp_fn).call(this, current - 1);
|
|
2068
|
-
__privateMethod(this, _dispatchChangeEvent, dispatchChangeEvent_fn).call(this);
|
|
2069
|
-
});
|
|
2070
|
-
__privateAdd(this, _handleClick, (e) => {
|
|
2071
|
-
e.stopPropagation();
|
|
2072
|
-
e.preventDefault();
|
|
2073
|
-
this.focus();
|
|
2074
|
-
});
|
|
2075
|
-
__privateAdd(this, _handleFocus, () => {
|
|
2076
|
-
__privateMethod(this, _clearInputBuffer, clearInputBuffer_fn).call(this);
|
|
2077
|
-
});
|
|
2078
|
-
__privateAdd(this, _handleBlur, () => {
|
|
2079
|
-
if (__privateGet(this, _inputBuffer) === "")
|
|
2080
|
-
return;
|
|
2081
|
-
__privateMethod(this, _clearInputBuffer, clearInputBuffer_fn).call(this);
|
|
2082
|
-
this.value = __privateMethod(this, _clamp, clamp_fn).call(this, parseInt(this.value.toString()));
|
|
2083
|
-
__privateMethod(this, _dispatchChangeEvent, dispatchChangeEvent_fn).call(this);
|
|
2084
|
-
});
|
|
2085
|
-
__privateAdd(this, _handleWheel, (e) => {
|
|
2086
|
-
e.stopPropagation();
|
|
2087
|
-
e.preventDefault();
|
|
2088
|
-
if (e.deltaY > 0) {
|
|
2089
|
-
__privateGet(this, _decrement).call(this);
|
|
2090
|
-
} else {
|
|
2091
|
-
__privateGet(this, _increment).call(this);
|
|
2092
|
-
}
|
|
2093
|
-
});
|
|
2094
|
-
__privateAdd(this, _handleKeyDown2, (e) => {
|
|
2095
|
-
let handled = false;
|
|
2096
|
-
if (e.key === "ArrowUp") {
|
|
2097
|
-
__privateGet(this, _increment).call(this);
|
|
2098
|
-
handled = true;
|
|
2099
|
-
} else if (e.key === "ArrowDown") {
|
|
2100
|
-
__privateGet(this, _decrement).call(this);
|
|
2101
|
-
handled = true;
|
|
2102
|
-
} else {
|
|
2103
|
-
const key = parseInt(e.key);
|
|
2104
|
-
if (!isNaN(key)) {
|
|
2105
|
-
if (__privateGet(this, _inputBuffer).length < this.length) {
|
|
2106
|
-
__privateSet(this, _inputBuffer, __privateGet(this, _inputBuffer) + key.toString());
|
|
2107
|
-
this.value = parseInt(__privateGet(this, _inputBuffer));
|
|
2108
|
-
}
|
|
2109
|
-
if (__privateGet(this, _inputBuffer).length === this.length) {
|
|
2110
|
-
this.value = __privateMethod(this, _clamp, clamp_fn).call(this, this.value);
|
|
2111
|
-
__privateMethod(this, _clearInputBuffer, clearInputBuffer_fn).call(this);
|
|
2112
|
-
__privateMethod(this, _focusNextSpinner, focusNextSpinner_fn).call(this);
|
|
2113
|
-
__privateMethod(this, _dispatchChangeEvent, dispatchChangeEvent_fn).call(this);
|
|
2114
|
-
}
|
|
2115
|
-
handled = true;
|
|
2116
|
-
}
|
|
2117
|
-
}
|
|
2118
|
-
if (handled) {
|
|
2119
|
-
e.preventDefault();
|
|
2120
|
-
e.stopPropagation();
|
|
2121
|
-
}
|
|
2122
|
-
});
|
|
2123
|
-
}
|
|
2124
|
-
// No need for a shadow root here
|
|
2125
|
-
createRenderRoot() {
|
|
2126
|
-
return this;
|
|
2127
|
-
}
|
|
2128
|
-
connectedCallback() {
|
|
2129
|
-
super.connectedCallback();
|
|
2130
|
-
this.setAttribute("role", "spinbutton");
|
|
2131
|
-
this.setAttribute("tabindex", "0");
|
|
2132
|
-
this.addEventListener("wheel", __privateGet(this, _handleWheel));
|
|
2133
|
-
this.addEventListener("keydown", __privateGet(this, _handleKeyDown2));
|
|
2134
|
-
this.addEventListener("blur", __privateGet(this, _handleBlur));
|
|
2135
|
-
this.addEventListener("focus", __privateGet(this, _handleFocus));
|
|
2136
|
-
this.addEventListener("click", __privateGet(this, _handleClick));
|
|
2137
|
-
this.addEventListener("mousedown", __privateGet(this, _handleClick));
|
|
2138
|
-
}
|
|
2139
|
-
focus(options) {
|
|
2140
|
-
super.focus(options);
|
|
2141
|
-
__privateGet(this, _handleFocus).call(this);
|
|
2142
|
-
}
|
|
2143
|
-
render() {
|
|
2144
|
-
return html`${this.displayValue}`;
|
|
2145
|
-
}
|
|
2146
|
-
_refreshDisplayValue() {
|
|
2147
|
-
this.displayValue = __privateMethod(this, _formatNumber, formatNumber_fn).call(this, this.value, this.length);
|
|
2148
|
-
this.setAttribute("aria-valuetext", this.value.toString());
|
|
2149
|
-
}
|
|
2150
|
-
};
|
|
2151
|
-
_inputBuffer = new WeakMap();
|
|
2152
|
-
_increment = new WeakMap();
|
|
2153
|
-
_decrement = new WeakMap();
|
|
2154
|
-
_handleClick = new WeakMap();
|
|
2155
|
-
_handleFocus = new WeakMap();
|
|
2156
|
-
_handleBlur = new WeakMap();
|
|
2157
|
-
_handleWheel = new WeakMap();
|
|
2158
|
-
_handleKeyDown2 = new WeakMap();
|
|
2159
|
-
_focusNextSpinner = new WeakSet();
|
|
2160
|
-
focusNextSpinner_fn = function() {
|
|
2161
|
-
let nextSpinner = this.nextElementSibling;
|
|
2162
|
-
while (nextSpinner) {
|
|
2163
|
-
if (nextSpinner instanceof GdsDatePartSpinner) {
|
|
2164
|
-
nextSpinner.focus();
|
|
2165
|
-
break;
|
|
2166
|
-
}
|
|
2167
|
-
nextSpinner = nextSpinner.nextElementSibling;
|
|
2168
|
-
}
|
|
2169
|
-
};
|
|
2170
|
-
_dispatchChangeEvent = new WeakSet();
|
|
2171
|
-
dispatchChangeEvent_fn = function() {
|
|
2172
|
-
this.dispatchEvent(
|
|
2173
|
-
new CustomEvent("change", {
|
|
2174
|
-
detail: { value: this.value.toString() }
|
|
2175
|
-
})
|
|
2176
|
-
);
|
|
2177
|
-
};
|
|
2178
|
-
_formatNumber = new WeakSet();
|
|
2179
|
-
formatNumber_fn = function(num, padZeros) {
|
|
2180
|
-
return String(num).padStart(padZeros, "0");
|
|
2181
|
-
};
|
|
2182
|
-
_clamp = new WeakSet();
|
|
2183
|
-
clamp_fn = function(value) {
|
|
2184
|
-
return Math.max(this.min, Math.min(this.max, value));
|
|
2185
|
-
};
|
|
2186
|
-
_clearInputBuffer = new WeakSet();
|
|
2187
|
-
clearInputBuffer_fn = function() {
|
|
2188
|
-
__privateSet(this, _inputBuffer, "");
|
|
2189
|
-
};
|
|
2190
|
-
GdsDatePartSpinner.formAssociated = true;
|
|
2191
|
-
__decorateClass([
|
|
2192
|
-
property8({ type: Number })
|
|
2193
|
-
], GdsDatePartSpinner.prototype, "value", 2);
|
|
2194
|
-
__decorateClass([
|
|
2195
|
-
property8({ type: Number })
|
|
2196
|
-
], GdsDatePartSpinner.prototype, "length", 2);
|
|
2197
|
-
__decorateClass([
|
|
2198
|
-
property8({ type: Number, attribute: "aria-valuemin" })
|
|
2199
|
-
], GdsDatePartSpinner.prototype, "min", 2);
|
|
2200
|
-
__decorateClass([
|
|
2201
|
-
property8({ type: Number, attribute: "aria-valuemax" })
|
|
2202
|
-
], GdsDatePartSpinner.prototype, "max", 2);
|
|
2203
|
-
__decorateClass([
|
|
2204
|
-
state9()
|
|
2205
|
-
], GdsDatePartSpinner.prototype, "displayValue", 2);
|
|
2206
|
-
__decorateClass([
|
|
2207
|
-
watch("value")
|
|
2208
|
-
], GdsDatePartSpinner.prototype, "_refreshDisplayValue", 1);
|
|
2209
|
-
GdsDatePartSpinner = __decorateClass([
|
|
2210
|
-
gdsCustomElement("gds-date-part-spinner")
|
|
2211
|
-
], GdsDatePartSpinner);
|
|
2212
|
-
|
|
2213
|
-
// libs/core/src/components/datepicker/datepicker.styles.ts
|
|
2214
|
-
import { css as css8 } from "lit";
|
|
2215
|
-
var styles = css8`
|
|
2216
|
-
@layer base, reset, transitional-styles;
|
|
2217
|
-
@layer base {
|
|
2218
|
-
label {
|
|
2219
|
-
display: block;
|
|
2220
|
-
}
|
|
2221
|
-
}
|
|
2222
|
-
`;
|
|
2223
|
-
|
|
2224
|
-
// libs/core/src/components/datepicker/datepicker.ts
|
|
2225
|
-
var dateConverter = {
|
|
2226
|
-
fromAttribute(value) {
|
|
2227
|
-
return new Date(value);
|
|
2228
|
-
},
|
|
2229
|
-
toAttribute(value) {
|
|
2230
|
-
return value.toISOString();
|
|
2231
|
-
}
|
|
2232
|
-
};
|
|
2233
|
-
var dateArrayConverter = {
|
|
2234
|
-
fromAttribute(value) {
|
|
2235
|
-
return value.split(",").map((d) => new Date(d.trim()));
|
|
2236
|
-
},
|
|
2237
|
-
toAttribute(value) {
|
|
2238
|
-
return JSON.stringify(value.map((d) => d.toISOString()));
|
|
2239
|
-
}
|
|
2240
|
-
};
|
|
2241
|
-
var _valueOnOpen, _renderBackToValidRangeButton, renderBackToValidRangeButton_fn, _focusDate, focusDate_fn, _getSpinnerLabel, getSpinnerLabel_fn, _getMinSpinnerValue, getMinSpinnerValue_fn, _getMaxSpinnerValue, getMaxSpinnerValue_fn, _dispatchChangeEvent2, dispatchChangeEvent_fn2, _dispatchInputEvent, dispatchInputEvent_fn, _handleFieldFocusOut, _handleSpinnerFocus, _handleClipboardCopy, _handleClipboardPaste, _handleFieldClick, _handleCalendarChange, _handleMonthChange, _handleYearChange, _handleIncrementFocusedMonth, _handleDecrementFocusedMonth, _handleCalendarFocusChange, _handlePopoverStateChange, _handleSpinnerKeydown, _parseDateFormat, parseDateFormat_fn, _handleSpinnerChange, _spinnerState, _years, years_get, _isValueOutsideRange, isValueOutsideRange_get;
|
|
2242
|
-
var GdsDatepicker = class extends GdsFormControlElement {
|
|
2243
|
-
constructor() {
|
|
2244
|
-
super(...arguments);
|
|
2245
|
-
__privateAdd(this, _renderBackToValidRangeButton);
|
|
2246
|
-
__privateAdd(this, _focusDate);
|
|
2247
|
-
__privateAdd(this, _getSpinnerLabel);
|
|
2248
|
-
__privateAdd(this, _getMinSpinnerValue);
|
|
2249
|
-
__privateAdd(this, _getMaxSpinnerValue);
|
|
2250
|
-
__privateAdd(this, _dispatchChangeEvent2);
|
|
2251
|
-
__privateAdd(this, _dispatchInputEvent);
|
|
2252
|
-
/**
|
|
2253
|
-
* Takes a dateformat string from the dateformat attribute and turnes it to a DateFormatLayout object used in rendering the template.
|
|
2254
|
-
*/
|
|
2255
|
-
__privateAdd(this, _parseDateFormat);
|
|
2256
|
-
/**
|
|
2257
|
-
* Returns a year iterator between the min and max dates for use in the year dropdown.
|
|
2258
|
-
*/
|
|
2259
|
-
__privateAdd(this, _years);
|
|
2260
|
-
__privateAdd(this, _isValueOutsideRange);
|
|
2261
|
-
this.min = new Date((/* @__PURE__ */ new Date()).getFullYear() - 10, 0, 1);
|
|
2262
|
-
this.max = new Date((/* @__PURE__ */ new Date()).getFullYear() + 10, 0, 1);
|
|
2263
|
-
this.open = false;
|
|
2264
|
-
this.label = "";
|
|
2265
|
-
this.showWeekNumbers = false;
|
|
2266
|
-
this.size = "medium";
|
|
2267
|
-
this.hideLabel = false;
|
|
2268
|
-
this.disabledWeekends = false;
|
|
2269
|
-
this._focusedMonth = (/* @__PURE__ */ new Date()).getMonth();
|
|
2270
|
-
this._focusedYear = (/* @__PURE__ */ new Date()).getFullYear();
|
|
2271
|
-
this._dateFormatLayout = __privateMethod(this, _parseDateFormat, parseDateFormat_fn).call(this, "y-m-d");
|
|
2272
|
-
__privateAdd(this, _valueOnOpen, void 0);
|
|
2273
|
-
__privateAdd(this, _handleFieldFocusOut, (e) => {
|
|
2274
|
-
this._elTrigger.then((_) => {
|
|
2275
|
-
const parent = e.relatedTarget?.parentElement;
|
|
2276
|
-
if (parent === e.target)
|
|
2277
|
-
return;
|
|
2278
|
-
document.getSelection()?.removeAllRanges();
|
|
2279
|
-
});
|
|
2280
|
-
});
|
|
2281
|
-
__privateAdd(this, _handleSpinnerFocus, (e) => {
|
|
2282
|
-
this._elTrigger.then((field) => {
|
|
2283
|
-
document.getSelection()?.removeAllRanges();
|
|
2284
|
-
const range = new Range();
|
|
2285
|
-
range.setStart(field.firstChild, 0);
|
|
2286
|
-
range.setEnd(field.lastChild, 4);
|
|
2287
|
-
document.getSelection()?.addRange(range);
|
|
2288
|
-
});
|
|
2289
|
-
});
|
|
2290
|
-
__privateAdd(this, _handleClipboardCopy, (e) => {
|
|
2291
|
-
this._elTrigger.then((field) => {
|
|
2292
|
-
if (e.currentTarget !== field)
|
|
2293
|
-
return;
|
|
2294
|
-
e.preventDefault();
|
|
2295
|
-
e.clipboardData?.setData("text/plain", this.displayValue);
|
|
2296
|
-
});
|
|
2297
|
-
});
|
|
2298
|
-
__privateAdd(this, _handleClipboardPaste, (e) => {
|
|
2299
|
-
this._elTrigger.then((field) => {
|
|
2300
|
-
if (e.currentTarget !== field)
|
|
2301
|
-
return;
|
|
2302
|
-
e.preventDefault();
|
|
2303
|
-
const pasted = e.clipboardData?.getData("text/plain");
|
|
2304
|
-
if (!pasted)
|
|
2305
|
-
return;
|
|
2306
|
-
const pastedDate = new Date(pasted);
|
|
2307
|
-
if (pastedDate.toString() === "Invalid Date")
|
|
2308
|
-
return;
|
|
2309
|
-
this.value = pastedDate;
|
|
2310
|
-
__privateMethod(this, _dispatchChangeEvent2, dispatchChangeEvent_fn2).call(this);
|
|
2311
|
-
});
|
|
2312
|
-
});
|
|
2313
|
-
__privateAdd(this, _handleFieldClick, (e) => {
|
|
2314
|
-
this._elSpinners[0].focus();
|
|
2315
|
-
});
|
|
2316
|
-
__privateAdd(this, _handleCalendarChange, (e) => {
|
|
2317
|
-
e.stopPropagation();
|
|
2318
|
-
this.value = e.detail;
|
|
2319
|
-
this.open = false;
|
|
2320
|
-
__privateMethod(this, _dispatchChangeEvent2, dispatchChangeEvent_fn2).call(this);
|
|
2321
|
-
});
|
|
2322
|
-
__privateAdd(this, _handleMonthChange, (e) => {
|
|
2323
|
-
e.stopPropagation();
|
|
2324
|
-
this._focusedMonth = e.target?.value;
|
|
2325
|
-
});
|
|
2326
|
-
__privateAdd(this, _handleYearChange, (e) => {
|
|
2327
|
-
e.stopPropagation();
|
|
2328
|
-
this._focusedYear = e.target?.value;
|
|
2329
|
-
});
|
|
2330
|
-
__privateAdd(this, _handleIncrementFocusedMonth, (_e) => {
|
|
2331
|
-
this._focusedMonth++;
|
|
2332
|
-
if (this._focusedMonth > 11) {
|
|
2333
|
-
this._focusedMonth = 0;
|
|
2334
|
-
this._focusedYear++;
|
|
2335
|
-
}
|
|
2336
|
-
});
|
|
2337
|
-
__privateAdd(this, _handleDecrementFocusedMonth, (_e) => {
|
|
2338
|
-
this._focusedMonth--;
|
|
2339
|
-
if (this._focusedMonth < 0) {
|
|
2340
|
-
this._focusedMonth = 11;
|
|
2341
|
-
this._focusedYear--;
|
|
2342
|
-
}
|
|
2343
|
-
});
|
|
2344
|
-
__privateAdd(this, _handleCalendarFocusChange, async () => {
|
|
2345
|
-
this._focusedMonth = (await this._elCalendar).focusedMonth;
|
|
2346
|
-
this._focusedYear = (await this._elCalendar).focusedYear;
|
|
2347
|
-
this.value = (await this._elCalendar).focusedDate;
|
|
2348
|
-
this.requestUpdate();
|
|
2349
|
-
__privateMethod(this, _dispatchInputEvent, dispatchInputEvent_fn).call(this);
|
|
2350
|
-
});
|
|
2351
|
-
__privateAdd(this, _handlePopoverStateChange, async (e) => {
|
|
2352
|
-
if (e.target !== e.currentTarget)
|
|
2353
|
-
return;
|
|
2354
|
-
this.open = e.detail.open;
|
|
2355
|
-
if (e.detail.reason === "close") {
|
|
2356
|
-
this.value = (await this._elCalendar).value;
|
|
2357
|
-
if (this.value) {
|
|
2358
|
-
this._focusedMonth = this.value.getMonth();
|
|
2359
|
-
this._focusedYear = this.value.getFullYear();
|
|
2360
|
-
}
|
|
2361
|
-
__privateMethod(this, _dispatchChangeEvent2, dispatchChangeEvent_fn2).call(this);
|
|
2362
|
-
}
|
|
2363
|
-
if (e.detail.reason === "cancel") {
|
|
2364
|
-
this.value = __privateGet(this, _valueOnOpen);
|
|
2365
|
-
}
|
|
2366
|
-
});
|
|
2367
|
-
__privateAdd(this, _handleSpinnerKeydown, (e) => {
|
|
2368
|
-
const index = Array.from(this._elSpinners).findIndex(
|
|
2369
|
-
(spinner) => spinner === e.target
|
|
2370
|
-
);
|
|
2371
|
-
if (e.key === "ArrowRight") {
|
|
2372
|
-
const next = this._elSpinners[index + 1];
|
|
2373
|
-
if (next)
|
|
2374
|
-
next.focus();
|
|
2375
|
-
}
|
|
2376
|
-
if (e.key === "ArrowLeft") {
|
|
2377
|
-
const prev = this._elSpinners[index - 1];
|
|
2378
|
-
if (prev)
|
|
2379
|
-
prev.focus();
|
|
2380
|
-
}
|
|
2381
|
-
});
|
|
2382
|
-
__privateAdd(this, _handleSpinnerChange, (val, name) => {
|
|
2383
|
-
__privateGet(this, _spinnerState)[name] = val;
|
|
2384
|
-
const newDate = /* @__PURE__ */ new Date();
|
|
2385
|
-
newDate.setFullYear(parseInt(__privateGet(this, _spinnerState).year));
|
|
2386
|
-
newDate.setMonth(parseInt(__privateGet(this, _spinnerState).month) - 1);
|
|
2387
|
-
newDate.setDate(parseInt(__privateGet(this, _spinnerState).day));
|
|
2388
|
-
if (newDate.toString() === "Invalid Date")
|
|
2389
|
-
return;
|
|
2390
|
-
this.value = newDate;
|
|
2391
|
-
__privateMethod(this, _dispatchChangeEvent2, dispatchChangeEvent_fn2).call(this);
|
|
2392
|
-
});
|
|
2393
|
-
/**
|
|
2394
|
-
* The spinner state keeps track of the spinner values regardless of wheter a complete date has been enter yet.
|
|
2395
|
-
*/
|
|
2396
|
-
__privateAdd(this, _spinnerState, {
|
|
2397
|
-
year: "yyyy",
|
|
2398
|
-
month: "mm",
|
|
2399
|
-
day: "dd"
|
|
2400
|
-
});
|
|
2401
|
-
}
|
|
2402
|
-
get type() {
|
|
2403
|
-
return "gds-datepicker";
|
|
2404
|
-
}
|
|
2405
|
-
get dateformat() {
|
|
2406
|
-
return this._dateFormatLayout.layout.map((f) => f.token).join(this._dateFormatLayout.delimiter);
|
|
2407
|
-
}
|
|
2408
|
-
set dateformat(dateformat) {
|
|
2409
|
-
this._dateFormatLayout = __privateMethod(this, _parseDateFormat, parseDateFormat_fn).call(this, dateformat);
|
|
2410
|
-
}
|
|
2411
|
-
/**
|
|
2412
|
-
* Get the currently focused date in the calendar popover. If no date is focused, or the calendar popover
|
|
2413
|
-
* is closed, the value will be undefined.
|
|
2414
|
-
*/
|
|
2415
|
-
async getFocusedDate() {
|
|
2416
|
-
if (this.open)
|
|
2417
|
-
return this._elCalendar.then((el) => el.focusedDate);
|
|
2418
|
-
else
|
|
2419
|
-
return void 0;
|
|
2420
|
-
}
|
|
2421
|
-
/**
|
|
2422
|
-
* Get a string representation of the currently displayed value in the input field. The formatting will match the dateformat attribute.
|
|
2423
|
-
*/
|
|
2424
|
-
get displayValue() {
|
|
2425
|
-
return this._elInput.innerText.replace(/\s+/g, "");
|
|
2426
|
-
}
|
|
2427
|
-
/**
|
|
2428
|
-
* A reference to a date cell element (<td>) inside the shadow root of the calendar primitive.
|
|
2429
|
-
* Inteded for use in integration tests.
|
|
2430
|
-
*/
|
|
2431
|
-
async test_getDateCell(dayNumber) {
|
|
2432
|
-
return this._elCalendar.then((el) => el.getDateCell(dayNumber));
|
|
2433
|
-
}
|
|
2434
|
-
connectedCallback() {
|
|
2435
|
-
super.connectedCallback();
|
|
2436
|
-
TransitionalStyles.instance.apply(this, "gds-datepicker");
|
|
2437
|
-
}
|
|
2438
|
-
render() {
|
|
2439
|
-
return html`${this._tStyles}
|
|
2440
|
-
${when4(
|
|
2441
|
-
this.label && !this.hideLabel,
|
|
2442
|
-
() => html`<label for="spinner-0" id="label">${this.label}</label>`
|
|
2443
|
-
)}
|
|
2444
|
-
|
|
2445
|
-
<div class="form-info"><slot name="sub-label"></slot></div>
|
|
2446
|
-
|
|
2447
|
-
<div
|
|
2448
|
-
class=${classMap6({ field: true, small: this.size === "small" })}
|
|
2449
|
-
id="trigger"
|
|
2450
|
-
@click=${__privateGet(this, _handleFieldClick)}
|
|
2451
|
-
@copy=${__privateGet(this, _handleClipboardCopy)}
|
|
2452
|
-
@paste=${__privateGet(this, _handleClipboardPaste)}
|
|
2453
|
-
>
|
|
2454
|
-
<div
|
|
2455
|
-
class=${classMap6({ input: true, "is-placeholder": !this.value })}
|
|
2456
|
-
@focusout=${__privateGet(this, _handleFieldFocusOut)}
|
|
2457
|
-
>
|
|
2458
|
-
${join(
|
|
2459
|
-
map(
|
|
2460
|
-
this._dateFormatLayout.layout,
|
|
2461
|
-
(f, i) => html`<gds-date-part-spinner
|
|
2462
|
-
id="spinner-${i}"
|
|
2463
|
-
.length=${f.token === "y" ? 4 : 2}
|
|
2464
|
-
.value=${__privateGet(this, _spinnerState)[f.name]}
|
|
2465
|
-
aria-valuemin=${__privateMethod(this, _getMinSpinnerValue, getMinSpinnerValue_fn).call(this, f.name)}
|
|
2466
|
-
aria-valuemax=${__privateMethod(this, _getMaxSpinnerValue, getMaxSpinnerValue_fn).call(this, f.name)}
|
|
2467
|
-
aria-label=${__privateMethod(this, _getSpinnerLabel, getSpinnerLabel_fn).call(this, f.name)}
|
|
2468
|
-
aria-describedby="label"
|
|
2469
|
-
@keydown=${__privateGet(this, _handleSpinnerKeydown)}
|
|
2470
|
-
@change=${(e) => __privateGet(this, _handleSpinnerChange).call(this, e.detail.value, f.name)}
|
|
2471
|
-
@focus=${__privateGet(this, _handleSpinnerFocus)}
|
|
2472
|
-
@touchend=${(e) => {
|
|
2473
|
-
this.open = true;
|
|
2474
|
-
e.preventDefault();
|
|
2475
|
-
}}
|
|
2476
|
-
></gds-date-part-spinner>`
|
|
2477
|
-
),
|
|
2478
|
-
html`<span>${this._dateFormatLayout.delimiter}</span>`
|
|
2479
|
-
)}
|
|
2480
|
-
</div>
|
|
2481
|
-
<button
|
|
2482
|
-
id="calendar-button"
|
|
2483
|
-
aria-label="${msg5("Open calendar modal")}"
|
|
2484
|
-
aria-haspopup="menu"
|
|
2485
|
-
aria-expanded=${this.open}
|
|
2486
|
-
aria-controls="calendar-popover"
|
|
2487
|
-
aria-describedby="label"
|
|
2488
|
-
@click=${() => this.open = !this.open}
|
|
2489
|
-
>
|
|
2490
|
-
<svg viewBox="0 0 24 24" inert>
|
|
2491
|
-
<rect x="3" y="4" width="18" height="18" rx="2" ry="2" />
|
|
2492
|
-
<line x1="16" y1="2" x2="16" y2="6" />
|
|
2493
|
-
<line x1="8" y1="2" x2="8" y2="6" />
|
|
2494
|
-
<line x1="3" y1="10" x2="21" y2="10" />
|
|
2495
|
-
</svg>
|
|
2496
|
-
</button>
|
|
2497
|
-
</div>
|
|
2498
|
-
|
|
2499
|
-
<div class="form-info"><slot name="message"></slot></div>
|
|
2500
|
-
|
|
2501
|
-
<gds-popover
|
|
2502
|
-
.triggerRef=${this._elTrigger}
|
|
2503
|
-
.open=${this.open}
|
|
2504
|
-
@gds-ui-state=${__privateGet(this, _handlePopoverStateChange)}
|
|
2505
|
-
label=${this.label}
|
|
2506
|
-
id="calendar-popover"
|
|
2507
|
-
.placement=${"bottom-end"}
|
|
2508
|
-
.calcMinWidth=${() => this.showWeekNumbers ? "350px" : "305px"}
|
|
2509
|
-
@focusin=${async (e) => {
|
|
2510
|
-
const isPopover = e.target?.id === "calendar-popover";
|
|
2511
|
-
if (!isPopover)
|
|
2512
|
-
return;
|
|
2513
|
-
this._elCalendar.then((cal) => cal.focus());
|
|
2514
|
-
}}
|
|
2515
|
-
>
|
|
2516
|
-
<div class="header">
|
|
2517
|
-
<button
|
|
2518
|
-
@click=${__privateGet(this, _handleDecrementFocusedMonth)}
|
|
2519
|
-
aria-label=${msg5("Previous month")}
|
|
2520
|
-
>
|
|
2521
|
-
<i class="icon prev"></i>
|
|
2522
|
-
</button>
|
|
2523
|
-
<gds-dropdown
|
|
2524
|
-
.value=${this._focusedMonth.toString()}
|
|
2525
|
-
@change=${__privateGet(this, _handleMonthChange)}
|
|
2526
|
-
.maxHeight=${300}
|
|
2527
|
-
label="${msg5("Month")}"
|
|
2528
|
-
style="width:120px"
|
|
2529
|
-
size="small"
|
|
2530
|
-
hide-label
|
|
2531
|
-
>
|
|
2532
|
-
<gds-option value="0">${msg5("January")}</gds-option>
|
|
2533
|
-
<gds-option value="1">${msg5("February")}</gds-option>
|
|
2534
|
-
<gds-option value="2">${msg5("March")}</gds-option>
|
|
2535
|
-
<gds-option value="3">${msg5("April")}</gds-option>
|
|
2536
|
-
<gds-option value="4">${msg5("May")}</gds-option>
|
|
2537
|
-
<gds-option value="5">${msg5("June")}</gds-option>
|
|
2538
|
-
<gds-option value="6">${msg5("July")}</gds-option>
|
|
2539
|
-
<gds-option value="7">${msg5("August")}</gds-option>
|
|
2540
|
-
<gds-option value="8">${msg5("September")}</gds-option>
|
|
2541
|
-
<gds-option value="9">${msg5("October")}</gds-option>
|
|
2542
|
-
<gds-option value="10">${msg5("November")}</gds-option>
|
|
2543
|
-
<gds-option value="11">${msg5("December")}</gds-option>
|
|
2544
|
-
</gds-dropdown>
|
|
2545
|
-
<gds-dropdown
|
|
2546
|
-
.value=${this._focusedYear.toString()}
|
|
2547
|
-
@change=${__privateGet(this, _handleYearChange)}
|
|
2548
|
-
.maxHeight=${300}
|
|
2549
|
-
label="${msg5("Year")}"
|
|
2550
|
-
size="small"
|
|
2551
|
-
hide-label
|
|
2552
|
-
>
|
|
2553
|
-
${repeat(
|
|
2554
|
-
__privateGet(this, _years, years_get),
|
|
2555
|
-
(year) => year,
|
|
2556
|
-
(year) => html`<gds-option value=${year}>${year}</gds-option>`
|
|
2557
|
-
)}
|
|
2558
|
-
</gds-dropdown>
|
|
2559
|
-
<button
|
|
2560
|
-
@click=${__privateGet(this, _handleIncrementFocusedMonth)}
|
|
2561
|
-
aria-label=${msg5("Next month")}
|
|
2562
|
-
>
|
|
2563
|
-
<i class="icon next"></i>
|
|
2564
|
-
</button>
|
|
2565
|
-
</div>
|
|
2566
|
-
|
|
2567
|
-
<gds-calendar
|
|
2568
|
-
id="calendar"
|
|
2569
|
-
@change=${__privateGet(this, _handleCalendarChange)}
|
|
2570
|
-
@gds-date-focused=${__privateGet(this, _handleCalendarFocusChange)}
|
|
2571
|
-
.focusedMonth=${this._focusedMonth}
|
|
2572
|
-
.focusedYear=${this._focusedYear}
|
|
2573
|
-
.value=${this.value}
|
|
2574
|
-
.min=${this.min}
|
|
2575
|
-
.max=${this.max}
|
|
2576
|
-
.showWeekNumbers=${this.showWeekNumbers}
|
|
2577
|
-
.disabledWeekends=${this.disabledWeekends}
|
|
2578
|
-
.disabledDates=${this.disabledDates}
|
|
2579
|
-
></gds-calendar>
|
|
2580
|
-
|
|
2581
|
-
<div class="footer">
|
|
2582
|
-
<button
|
|
2583
|
-
class="tertiary clear"
|
|
2584
|
-
@click=${() => {
|
|
2585
|
-
this.value = void 0;
|
|
2586
|
-
__privateMethod(this, _dispatchChangeEvent2, dispatchChangeEvent_fn2).call(this);
|
|
2587
|
-
}}
|
|
2588
|
-
>
|
|
2589
|
-
${msg5("Clear")}
|
|
2590
|
-
</button>
|
|
2591
|
-
${until(__privateMethod(this, _renderBackToValidRangeButton, renderBackToValidRangeButton_fn).call(this), nothing2)}
|
|
2592
|
-
<button
|
|
2593
|
-
class="tertiary today"
|
|
2594
|
-
@click=${() => {
|
|
2595
|
-
this.value = /* @__PURE__ */ new Date();
|
|
2596
|
-
__privateMethod(this, _dispatchChangeEvent2, dispatchChangeEvent_fn2).call(this);
|
|
2597
|
-
}}
|
|
2598
|
-
>
|
|
2599
|
-
${msg5("Today")}
|
|
2600
|
-
</button>
|
|
2601
|
-
</div>
|
|
2602
|
-
</gds-popover> `;
|
|
2603
|
-
}
|
|
2604
|
-
_handleValueChange() {
|
|
2605
|
-
if (!this.value) {
|
|
2606
|
-
__privateSet(this, _spinnerState, {
|
|
2607
|
-
year: "yyyy",
|
|
2608
|
-
month: "mm",
|
|
2609
|
-
day: "dd"
|
|
2610
|
-
});
|
|
2611
|
-
return;
|
|
2612
|
-
}
|
|
2613
|
-
const date = this.value;
|
|
2614
|
-
this._focusedMonth = date.getMonth();
|
|
2615
|
-
this._focusedYear = date.getFullYear();
|
|
2616
|
-
const year = date.getFullYear().toString();
|
|
2617
|
-
const month = (date.getMonth() + 1).toString().padStart(2, "0");
|
|
2618
|
-
const day = date.getDate().toString().padStart(2, "0");
|
|
2619
|
-
__privateSet(this, _spinnerState, { year, month, day });
|
|
2620
|
-
}
|
|
2621
|
-
_handleOpenChange() {
|
|
2622
|
-
if (this.open) {
|
|
2623
|
-
__privateSet(this, _valueOnOpen, this.value);
|
|
2624
|
-
this._elCalendar.then((el) => el.focus());
|
|
2625
|
-
}
|
|
2626
|
-
}
|
|
2627
|
-
};
|
|
2628
|
-
_valueOnOpen = new WeakMap();
|
|
2629
|
-
_renderBackToValidRangeButton = new WeakSet();
|
|
2630
|
-
renderBackToValidRangeButton_fn = async function() {
|
|
2631
|
-
const focusedDate = await this.getFocusedDate();
|
|
2632
|
-
let buttonTxt = "";
|
|
2633
|
-
let buttonAction;
|
|
2634
|
-
if (focusedDate && focusedDate > this.max) {
|
|
2635
|
-
buttonTxt = msg5("Last available date");
|
|
2636
|
-
buttonAction = () => __privateMethod(this, _focusDate, focusDate_fn).call(this, this.max);
|
|
2637
|
-
} else if (focusedDate && focusedDate < this.min) {
|
|
2638
|
-
buttonTxt = msg5("First available date");
|
|
2639
|
-
buttonAction = () => __privateMethod(this, _focusDate, focusDate_fn).call(this, this.min);
|
|
2640
|
-
}
|
|
2641
|
-
return html`${when4(
|
|
2642
|
-
buttonTxt.length > 0,
|
|
2643
|
-
() => html`<button class="tertiary back-to-range" @click=${buttonAction}>
|
|
2644
|
-
${buttonTxt}
|
|
2645
|
-
</button>`,
|
|
2646
|
-
() => nothing2
|
|
2647
|
-
)}`;
|
|
2648
|
-
};
|
|
2649
|
-
_focusDate = new WeakSet();
|
|
2650
|
-
focusDate_fn = function(d) {
|
|
2651
|
-
const firstValidDate = new Date(d);
|
|
2652
|
-
this._elCalendar.then((el) => el.focusedDate = firstValidDate).then(__privateGet(this, _handleCalendarFocusChange));
|
|
2653
|
-
};
|
|
2654
|
-
_getSpinnerLabel = new WeakSet();
|
|
2655
|
-
getSpinnerLabel_fn = function(name) {
|
|
2656
|
-
const labels = {
|
|
2657
|
-
year: msg5("Year"),
|
|
2658
|
-
month: msg5("Month"),
|
|
2659
|
-
day: msg5("Day")
|
|
2660
|
-
};
|
|
2661
|
-
return labels[name];
|
|
2662
|
-
};
|
|
2663
|
-
_getMinSpinnerValue = new WeakSet();
|
|
2664
|
-
getMinSpinnerValue_fn = function(name) {
|
|
2665
|
-
const min = {
|
|
2666
|
-
year: 1900,
|
|
2667
|
-
month: 1,
|
|
2668
|
-
day: 1
|
|
2669
|
-
};
|
|
2670
|
-
return min[name];
|
|
2671
|
-
};
|
|
2672
|
-
_getMaxSpinnerValue = new WeakSet();
|
|
2673
|
-
getMaxSpinnerValue_fn = function(name) {
|
|
2674
|
-
const max = {
|
|
2675
|
-
year: 9999,
|
|
2676
|
-
month: 12,
|
|
2677
|
-
day: 31
|
|
2678
|
-
};
|
|
2679
|
-
return max[name];
|
|
2680
|
-
};
|
|
2681
|
-
_dispatchChangeEvent2 = new WeakSet();
|
|
2682
|
-
dispatchChangeEvent_fn2 = function() {
|
|
2683
|
-
this.dispatchEvent(
|
|
2684
|
-
new CustomEvent("change", {
|
|
2685
|
-
detail: { value: this.value }
|
|
2686
|
-
})
|
|
2687
|
-
);
|
|
2688
|
-
};
|
|
2689
|
-
_dispatchInputEvent = new WeakSet();
|
|
2690
|
-
dispatchInputEvent_fn = function() {
|
|
2691
|
-
this.dispatchEvent(
|
|
2692
|
-
new CustomEvent("input", {
|
|
2693
|
-
detail: { value: this.value }
|
|
2694
|
-
})
|
|
2695
|
-
);
|
|
2696
|
-
};
|
|
2697
|
-
_handleFieldFocusOut = new WeakMap();
|
|
2698
|
-
_handleSpinnerFocus = new WeakMap();
|
|
2699
|
-
_handleClipboardCopy = new WeakMap();
|
|
2700
|
-
_handleClipboardPaste = new WeakMap();
|
|
2701
|
-
_handleFieldClick = new WeakMap();
|
|
2702
|
-
_handleCalendarChange = new WeakMap();
|
|
2703
|
-
_handleMonthChange = new WeakMap();
|
|
2704
|
-
_handleYearChange = new WeakMap();
|
|
2705
|
-
_handleIncrementFocusedMonth = new WeakMap();
|
|
2706
|
-
_handleDecrementFocusedMonth = new WeakMap();
|
|
2707
|
-
_handleCalendarFocusChange = new WeakMap();
|
|
2708
|
-
_handlePopoverStateChange = new WeakMap();
|
|
2709
|
-
_handleSpinnerKeydown = new WeakMap();
|
|
2710
|
-
_parseDateFormat = new WeakSet();
|
|
2711
|
-
parseDateFormat_fn = function(dateformat) {
|
|
2712
|
-
const delimiter = dateformat.replace(/[a-z0-9]/gi, "")[0];
|
|
2713
|
-
const format = dateformat.split(delimiter);
|
|
2714
|
-
const year = format.findIndex((f) => f === "y");
|
|
2715
|
-
const month = format.findIndex((f) => f === "m");
|
|
2716
|
-
const day = format.findIndex((f) => f === "d");
|
|
2717
|
-
if (year === -1 || month === -1 || day === -1)
|
|
2718
|
-
throw new Error("Invalid date format for <gds-datepicker>");
|
|
2719
|
-
const ordered = [year, month, day].sort((a, b) => a - b);
|
|
2720
|
-
const orderedFormat = ordered.map((i) => format[i]).map((f) => ({
|
|
2721
|
-
token: f,
|
|
2722
|
-
name: f === "y" ? "year" : f === "m" ? "month" : "day"
|
|
2723
|
-
}));
|
|
2724
|
-
return { delimiter, layout: orderedFormat };
|
|
2725
|
-
};
|
|
2726
|
-
_handleSpinnerChange = new WeakMap();
|
|
2727
|
-
_spinnerState = new WeakMap();
|
|
2728
|
-
_years = new WeakSet();
|
|
2729
|
-
years_get = function() {
|
|
2730
|
-
const minYear = this.min.getFullYear();
|
|
2731
|
-
const maxYear = this.max.getFullYear();
|
|
2732
|
-
const isOutsideRange = __privateGet(this, _isValueOutsideRange, isValueOutsideRange_get);
|
|
2733
|
-
const valueYear = this.value?.getFullYear();
|
|
2734
|
-
return {
|
|
2735
|
-
*[Symbol.iterator]() {
|
|
2736
|
-
if (isOutsideRange)
|
|
2737
|
-
yield valueYear;
|
|
2738
|
-
for (let i = minYear; i <= maxYear; i++)
|
|
2739
|
-
yield i;
|
|
2740
|
-
}
|
|
2741
|
-
};
|
|
2742
|
-
};
|
|
2743
|
-
_isValueOutsideRange = new WeakSet();
|
|
2744
|
-
isValueOutsideRange_get = function() {
|
|
2745
|
-
if (!this.value)
|
|
2746
|
-
return false;
|
|
2747
|
-
return this.value.getFullYear() < this.min.getFullYear() || this.value.getFullYear() > this.max.getFullYear();
|
|
2748
|
-
};
|
|
2749
|
-
GdsDatepicker.styles = [styles];
|
|
2750
|
-
GdsDatepicker.shadowRootOptions = {
|
|
2751
|
-
mode: "open",
|
|
2752
|
-
delegatesFocus: true
|
|
2753
|
-
};
|
|
2754
|
-
__decorateClass([
|
|
2755
|
-
property9({ converter: dateConverter })
|
|
2756
|
-
], GdsDatepicker.prototype, "value", 2);
|
|
2757
|
-
__decorateClass([
|
|
2758
|
-
property9({ converter: dateConverter })
|
|
2759
|
-
], GdsDatepicker.prototype, "min", 2);
|
|
2760
|
-
__decorateClass([
|
|
2761
|
-
property9({ converter: dateConverter })
|
|
2762
|
-
], GdsDatepicker.prototype, "max", 2);
|
|
2763
|
-
__decorateClass([
|
|
2764
|
-
property9({ type: Boolean })
|
|
2765
|
-
], GdsDatepicker.prototype, "open", 2);
|
|
2766
|
-
__decorateClass([
|
|
2767
|
-
property9()
|
|
2768
|
-
], GdsDatepicker.prototype, "label", 2);
|
|
2769
|
-
__decorateClass([
|
|
2770
|
-
property9({ type: Boolean, attribute: "show-week-numbers" })
|
|
2771
|
-
], GdsDatepicker.prototype, "showWeekNumbers", 2);
|
|
2772
|
-
__decorateClass([
|
|
2773
|
-
property9()
|
|
2774
|
-
], GdsDatepicker.prototype, "size", 2);
|
|
2775
|
-
__decorateClass([
|
|
2776
|
-
property9({ type: Boolean, attribute: "hide-label" })
|
|
2777
|
-
], GdsDatepicker.prototype, "hideLabel", 2);
|
|
2778
|
-
__decorateClass([
|
|
2779
|
-
property9()
|
|
2780
|
-
], GdsDatepicker.prototype, "dateformat", 1);
|
|
2781
|
-
__decorateClass([
|
|
2782
|
-
property9({ type: Boolean, attribute: "disabled-weekends" })
|
|
2783
|
-
], GdsDatepicker.prototype, "disabledWeekends", 2);
|
|
2784
|
-
__decorateClass([
|
|
2785
|
-
property9({ converter: dateArrayConverter, attribute: "disabled-dates" })
|
|
2786
|
-
], GdsDatepicker.prototype, "disabledDates", 2);
|
|
2787
|
-
__decorateClass([
|
|
2788
|
-
queryAsync3("#calendar-button")
|
|
2789
|
-
], GdsDatepicker.prototype, "test_calendarButton", 2);
|
|
2790
|
-
__decorateClass([
|
|
2791
|
-
state10()
|
|
2792
|
-
], GdsDatepicker.prototype, "_focusedMonth", 2);
|
|
2793
|
-
__decorateClass([
|
|
2794
|
-
state10()
|
|
2795
|
-
], GdsDatepicker.prototype, "_focusedYear", 2);
|
|
2796
|
-
__decorateClass([
|
|
2797
|
-
state10()
|
|
2798
|
-
], GdsDatepicker.prototype, "_dateFormatLayout", 2);
|
|
2799
|
-
__decorateClass([
|
|
2800
|
-
queryAsync3("#calendar")
|
|
2801
|
-
], GdsDatepicker.prototype, "_elCalendar", 2);
|
|
2802
|
-
__decorateClass([
|
|
2803
|
-
queryAsync3("#trigger")
|
|
2804
|
-
], GdsDatepicker.prototype, "_elTrigger", 2);
|
|
2805
|
-
__decorateClass([
|
|
2806
|
-
queryAll(getScopedTagName("gds-date-part-spinner"))
|
|
2807
|
-
], GdsDatepicker.prototype, "_elSpinners", 2);
|
|
2808
|
-
__decorateClass([
|
|
2809
|
-
query3(".input")
|
|
2810
|
-
], GdsDatepicker.prototype, "_elInput", 2);
|
|
2811
|
-
__decorateClass([
|
|
2812
|
-
state10()
|
|
2813
|
-
], GdsDatepicker.prototype, "_tStyles", 2);
|
|
2814
|
-
__decorateClass([
|
|
2815
|
-
watch("value")
|
|
2816
|
-
], GdsDatepicker.prototype, "_handleValueChange", 1);
|
|
2817
|
-
__decorateClass([
|
|
2818
|
-
watch("open")
|
|
2819
|
-
], GdsDatepicker.prototype, "_handleOpenChange", 1);
|
|
2820
|
-
GdsDatepicker = __decorateClass([
|
|
2821
|
-
gdsCustomElement("gds-datepicker")
|
|
2822
|
-
], GdsDatepicker);
|
|
2823
|
-
|
|
2824
|
-
// libs/core/src/components/grid/grid.ts
|
|
2825
|
-
import { css as css10, LitElement as LitElement6, unsafeCSS as unsafeCSS3 } from "lit";
|
|
2826
|
-
import { property as property10, state as state11 } from "lit/decorators.js";
|
|
2827
|
-
|
|
2828
|
-
// libs/core/src/tokens.style.ts
|
|
2829
|
-
import { unsafeCSS as unsafeCSS2 } from "lit";
|
|
2830
|
-
|
|
2831
|
-
// dist/libs/tokens/internal/pallet.css
|
|
2832
|
-
var pallet_default = `/**
|
|
2833
|
-
* Do not edit directly
|
|
2834
|
-
* Generated on Mon, 22 Apr 2024 10:32:32 GMT
|
|
2835
|
-
*/
|
|
2836
|
-
|
|
2837
|
-
:host {
|
|
2838
|
-
--gds-ref-color-neutral000: #ffffff;
|
|
2839
|
-
--gds-ref-color-neutral050: #f8f8f8;
|
|
2840
|
-
--gds-ref-color-neutral100: #e9e9e9;
|
|
2841
|
-
--gds-ref-color-neutral150: #eeeeee;
|
|
2842
|
-
--gds-ref-color-neutral200: #dedede;
|
|
2843
|
-
--gds-ref-color-neutral250: #cecece;
|
|
2844
|
-
--gds-ref-color-neutral300: #ababab;
|
|
2845
|
-
--gds-ref-color-neutral350: #adadad;
|
|
2846
|
-
--gds-ref-color-neutral400: #868686;
|
|
2847
|
-
--gds-ref-color-neutral450: #757575;
|
|
2848
|
-
--gds-ref-color-neutral500: #494949;
|
|
2849
|
-
--gds-ref-color-neutral525: #464646;
|
|
2850
|
-
--gds-ref-color-neutral550: #333333;
|
|
2851
|
-
--gds-ref-color-neutral600: #2c2c2c;
|
|
2852
|
-
--gds-ref-color-neutral650: #272727;
|
|
2853
|
-
--gds-ref-color-neutral700: #222222;
|
|
2854
|
-
--gds-ref-color-neutral750: #1a1a1a;
|
|
2855
|
-
--gds-ref-color-neutral800: #121212;
|
|
2856
|
-
--gds-ref-color-blue100: #58b8ee;
|
|
2857
|
-
--gds-ref-color-blue200: #41b0ee;
|
|
2858
|
-
--gds-ref-color-blue300: #00adff;
|
|
2859
|
-
--gds-ref-color-blue400: #2c9cd9;
|
|
2860
|
-
--gds-ref-color-blue500: #0092e1;
|
|
2861
|
-
--gds-ref-color-blue600: #007ac7;
|
|
2862
|
-
--gds-ref-color-blue700: #0062bc;
|
|
2863
|
-
--gds-ref-color-green100: #75b44a;
|
|
2864
|
-
--gds-ref-color-green200: #60cd18;
|
|
2865
|
-
--gds-ref-color-green300: #45b400;
|
|
2866
|
-
--gds-ref-color-green400: #308800;
|
|
2867
|
-
--gds-ref-color-red100: #f7706d;
|
|
2868
|
-
--gds-ref-color-red200: #ff594f;
|
|
2869
|
-
--gds-ref-color-red300: #f03529;
|
|
2870
|
-
--gds-ref-color-red400: #d81a1a;
|
|
2871
|
-
--gds-ref-color-red500: #c82a29;
|
|
2872
|
-
--gds-ref-color-red600: #bb000c;
|
|
2873
|
-
--gds-ref-color-red700: #9f000a;
|
|
2874
|
-
--gds-ref-color-red800: #9e2120;
|
|
2875
|
-
--gds-ref-color-purple100: #ad91dc;
|
|
2876
|
-
--gds-ref-color-purple200: #7e52cc;
|
|
2877
|
-
--gds-ref-color-purple300: #673ab6;
|
|
2878
|
-
--gds-ref-color-purple400: #4f2C99;
|
|
2879
|
-
--gds-ref-color-purple500: #4a328f;
|
|
2880
|
-
--gds-ref-color-purple600: #3f2587;
|
|
2881
|
-
--gds-ref-color-yellow100: #ffe182;
|
|
2882
|
-
--gds-ref-color-yellow200: #ffc500;
|
|
2883
|
-
--gds-ref-color-yellow300: #ffb400;
|
|
2884
|
-
--gds-ref-color-yellow400: #f8a000;
|
|
2885
|
-
--gds-ref-color-yellow500: #f0be47;
|
|
2886
|
-
--gds-ref-color-yellow600: #ebab39;
|
|
2887
|
-
--gds-ref-color-blue-5: #001127;
|
|
2888
|
-
--gds-ref-color-blue-10: #001C39;
|
|
2889
|
-
--gds-ref-color-blue-15: #00264B;
|
|
2890
|
-
--gds-ref-color-blue-20: #00315D;
|
|
2891
|
-
--gds-ref-color-blue-25: #003C70;
|
|
2892
|
-
--gds-ref-color-blue-30: #004883;
|
|
2893
|
-
--gds-ref-color-blue-35: #005397;
|
|
2894
|
-
--gds-ref-color-blue-40: #005FAC;
|
|
2895
|
-
--gds-ref-color-blue-45: #006CC1;
|
|
2896
|
-
--gds-ref-color-blue-50: #0078D7;
|
|
2897
|
-
--gds-ref-color-blue-55: #0085EC;
|
|
2898
|
-
--gds-ref-color-blue-60: #1992FF;
|
|
2899
|
-
--gds-ref-color-blue-65: #4EA0FF;
|
|
2900
|
-
--gds-ref-color-blue-70: #6FAEFF;
|
|
2901
|
-
--gds-ref-color-blue-75: #8ABBFF;
|
|
2902
|
-
--gds-ref-color-blue-80: #A4C9FF;
|
|
2903
|
-
--gds-ref-color-blue-85: #BCD6FF;
|
|
2904
|
-
--gds-ref-color-blue-90: #D4E3FF;
|
|
2905
|
-
--gds-ref-color-blue-95: #EBF1FF;
|
|
2906
|
-
--gds-ref-color-blue-98: #F8F9FF;
|
|
2907
|
-
--gds-ref-color-green-5: #001505;
|
|
2908
|
-
--gds-ref-color-green-10: #00210E;
|
|
2909
|
-
--gds-ref-color-green-15: #002D10;
|
|
2910
|
-
--gds-ref-color-green-20: #003916;
|
|
2911
|
-
--gds-ref-color-green-25: #00461D;
|
|
2912
|
-
--gds-ref-color-green-30: #005323;
|
|
2913
|
-
--gds-ref-color-green-35: #00602A;
|
|
2914
|
-
--gds-ref-color-green-40: #006D31;
|
|
2915
|
-
--gds-ref-color-green-45: #007B38;
|
|
2916
|
-
--gds-ref-color-green-50: #138942;
|
|
2917
|
-
--gds-ref-color-green-55: #29964D;
|
|
2918
|
-
--gds-ref-color-green-60: #39A459;
|
|
2919
|
-
--gds-ref-color-green-65: #48B265;
|
|
2920
|
-
--gds-ref-color-green-70: #57C071;
|
|
2921
|
-
--gds-ref-color-green-75: #65CE7E;
|
|
2922
|
-
--gds-ref-color-green-80: #73DC8A;
|
|
2923
|
-
--gds-ref-color-green-85: #81EA97;
|
|
2924
|
-
--gds-ref-color-green-90: #8FF9A4;
|
|
2925
|
-
--gds-ref-color-green-95: #C5FFCA;
|
|
2926
|
-
--gds-ref-color-green-98: #EAFFE8;
|
|
2927
|
-
--gds-ref-color-black: #000000;
|
|
2928
|
-
--gds-ref-color-white: #FFFFFF;
|
|
2929
|
-
--gds-ref-color-grey-5: #0D0D0C;
|
|
2930
|
-
--gds-ref-color-grey-10: #1B1B18;
|
|
2931
|
-
--gds-ref-color-grey-15: #282825;
|
|
2932
|
-
--gds-ref-color-grey-20: #353531;
|
|
2933
|
-
--gds-ref-color-grey-25: #42423D;
|
|
2934
|
-
--gds-ref-color-grey-30: #505049;
|
|
2935
|
-
--gds-ref-color-grey-35: #5D5D56;
|
|
2936
|
-
--gds-ref-color-grey-40: #6A6A62;
|
|
2937
|
-
--gds-ref-color-grey-45: #77776E;
|
|
2938
|
-
--gds-ref-color-grey-50: #85857A;
|
|
2939
|
-
--gds-ref-color-grey-55: #919188;
|
|
2940
|
-
--gds-ref-color-grey-60: #9D9D95;
|
|
2941
|
-
--gds-ref-color-grey-65: #A9A9A2;
|
|
2942
|
-
--gds-ref-color-grey-70: #B6B6AF;
|
|
2943
|
-
--gds-ref-color-grey-75: #C2C2BD;
|
|
2944
|
-
--gds-ref-color-grey-80: #CECECA;
|
|
2945
|
-
--gds-ref-color-grey-85: #DADAD7;
|
|
2946
|
-
--gds-ref-color-grey-90: #E7E7E4;
|
|
2947
|
-
--gds-ref-color-grey-95: #F3F3F2;
|
|
2948
|
-
--gds-ref-color-grey-98: #F9F9F9;
|
|
2949
|
-
--gds-ref-color-orange-5: #1A0F00;
|
|
2950
|
-
--gds-ref-color-orange-10: #271900;
|
|
2951
|
-
--gds-ref-color-orange-15: #352200;
|
|
2952
|
-
--gds-ref-color-orange-20: #422C00;
|
|
2953
|
-
--gds-ref-color-orange-25: #503700;
|
|
2954
|
-
--gds-ref-color-orange-30: #503700;
|
|
2955
|
-
--gds-ref-color-orange-35: #6E4C00;
|
|
2956
|
-
--gds-ref-color-orange-40: #7D5700;
|
|
2957
|
-
--gds-ref-color-orange-45: #8D6300;
|
|
2958
|
-
--gds-ref-color-orange-50: #9D6E00;
|
|
2959
|
-
--gds-ref-color-orange-55: #AE7A00;
|
|
2960
|
-
--gds-ref-color-orange-60: #BE8600;
|
|
2961
|
-
--gds-ref-color-orange-65: #CF9300;
|
|
2962
|
-
--gds-ref-color-orange-70: #E19F00;
|
|
2963
|
-
--gds-ref-color-orange-75: #F2AC00;
|
|
2964
|
-
--gds-ref-color-orange-80: #FFBA30;
|
|
2965
|
-
--gds-ref-color-orange-85: #FFCC77;
|
|
2966
|
-
--gds-ref-color-orange-90: #FFDEAB;
|
|
2967
|
-
--gds-ref-color-orange-95: #FFEED9;
|
|
2968
|
-
--gds-ref-color-orange-98: #FFF8F3;
|
|
2969
|
-
--gds-ref-color-red-5: #2B0200;
|
|
2970
|
-
--gds-ref-color-red-10: #3E0400;
|
|
2971
|
-
--gds-ref-color-red-15: #510700;
|
|
2972
|
-
--gds-ref-color-red-20: #650B00;
|
|
2973
|
-
--gds-ref-color-red-25: #790F00;
|
|
2974
|
-
--gds-ref-color-red-30: #8E1400;
|
|
2975
|
-
--gds-ref-color-red-35: #A31800;
|
|
2976
|
-
--gds-ref-color-red-40: #BA1D00;
|
|
2977
|
-
--gds-ref-color-red-45: #D02200;
|
|
2978
|
-
--gds-ref-color-red-50: #E23010;
|
|
2979
|
-
--gds-ref-color-red-55: #F53E1D;
|
|
2980
|
-
--gds-ref-color-red-60: #FF5636;
|
|
2981
|
-
--gds-ref-color-red-65: #FF7257;
|
|
2982
|
-
--gds-ref-color-red-70: #FF8A73;
|
|
2983
|
-
--gds-ref-color-red-75: #FFA08D;
|
|
2984
|
-
--gds-ref-color-red-80: #FFB4A5;
|
|
2985
|
-
--gds-ref-color-red-85: #FFC8BC;
|
|
2986
|
-
--gds-ref-color-red-90: #FFDAD3;
|
|
2987
|
-
--gds-ref-color-red-95: #FFEDE9;
|
|
2988
|
-
--gds-ref-color-red-98: #FFF8F6;
|
|
2989
|
-
}
|
|
2990
|
-
`;
|
|
2991
|
-
|
|
2992
|
-
// dist/libs/tokens/internal/theme/light.css
|
|
2993
|
-
var light_default = `/**
|
|
2994
|
-
* Do not edit directly
|
|
2995
|
-
* Generated on Mon, 22 Apr 2024 10:32:32 GMT
|
|
2996
|
-
*/
|
|
2997
|
-
|
|
2998
|
-
:host {
|
|
2999
|
-
color-scheme: light;
|
|
3000
|
-
--gds-sys-color-blue: #41b0ee;
|
|
3001
|
-
--gds-sys-color-dark-blue-1: #41b0ee;
|
|
3002
|
-
--gds-sys-color-dark-blue-2: #007ac7;
|
|
3003
|
-
--gds-sys-color-green: #60cd18;
|
|
3004
|
-
--gds-sys-color-dark-green-1: #45b400;
|
|
3005
|
-
--gds-sys-color-dark-green-2: #308800;
|
|
3006
|
-
--gds-sys-color-yellow: #ffc500;
|
|
3007
|
-
--gds-sys-color-dark-yellow-1: #ffb400;
|
|
3008
|
-
--gds-sys-color-dark-yellow-2: #f8a000;
|
|
3009
|
-
--gds-sys-color-primary-text: #333333;
|
|
3010
|
-
--gds-sys-color-secondary-text: #ababab;
|
|
3011
|
-
--gds-sys-color-white-text: #ffffff;
|
|
3012
|
-
--gds-sys-color-link-text: #0062bc;
|
|
3013
|
-
--gds-sys-color-error-text: #9f000a;
|
|
3014
|
-
--gds-sys-color-disabled-text: #adadad;
|
|
3015
|
-
--gds-sys-color-red: #f03529;
|
|
3016
|
-
--gds-sys-color-dark-red-1: #d81a1a;
|
|
3017
|
-
--gds-sys-color-dark-red-2: #bb000c;
|
|
3018
|
-
--gds-sys-color-purple: #673ab6;
|
|
3019
|
-
--gds-sys-color-dark-purple-1: #4f2C99;
|
|
3020
|
-
--gds-sys-color-dark-purple-2: #3f2587;
|
|
3021
|
-
--gds-sys-color-base-white: #ffffff;
|
|
3022
|
-
--gds-sys-color-base100: #f8f8f8;
|
|
3023
|
-
--gds-sys-color-base200: #e9e9e9;
|
|
3024
|
-
--gds-sys-color-base300: #dedede;
|
|
3025
|
-
--gds-sys-color-base400: #cecece;
|
|
3026
|
-
--gds-sys-color-base500: #adadad;
|
|
3027
|
-
--gds-sys-color-base600: #868686;
|
|
3028
|
-
--gds-sys-color-base700: #494949;
|
|
3029
|
-
--gds-sys-color-base800: #333333;
|
|
3030
|
-
--gds-sys-color-base900: #1a1a1a;
|
|
3031
|
-
--gds-sys-color-accent-accent-green: #006D31;
|
|
3032
|
-
--gds-sys-color-accent-on-accent-green: #FFFFFF;
|
|
3033
|
-
--gds-sys-color-accent-accent-orange: #FFBA30;
|
|
3034
|
-
--gds-sys-color-accent-on-accent-orange: #353531;
|
|
3035
|
-
--gds-sys-color-background-background: #FFFFFF;
|
|
3036
|
-
--gds-sys-color-background-background-dim: #F3F3F2;
|
|
3037
|
-
--gds-sys-color-container-container: #F3F3F2;
|
|
3038
|
-
--gds-sys-color-container-container-dim1: #E7E7E4;
|
|
3039
|
-
--gds-sys-color-container-container-dim2: #DADAD7;
|
|
3040
|
-
--gds-sys-color-container-container-bright: #FFFFFF;
|
|
3041
|
-
--gds-sys-color-container-container-shade1: #353531;
|
|
3042
|
-
--gds-sys-color-container-container-shade2: #1B1B18;
|
|
3043
|
-
--gds-sys-color-container-container-shade3: #353531;
|
|
3044
|
-
--gds-sys-color-container-container-disabled: #F9F9F9;
|
|
3045
|
-
--gds-sys-color-container-container-positive: #006D31;
|
|
3046
|
-
--gds-sys-color-container-container-negative: #BA1D00;
|
|
3047
|
-
--gds-sys-color-container-container-negative-bright: #FFEDE9;
|
|
3048
|
-
--gds-sys-color-content-content: #353531;
|
|
3049
|
-
--gds-sys-color-content-content-inverse: #FFFFFF;
|
|
3050
|
-
--gds-sys-color-content-content-secondary: #6A6A62;
|
|
3051
|
-
--gds-sys-color-content-content-positive: #006D31;
|
|
3052
|
-
--gds-sys-color-content-content-positive-bright: #EAFFE8;
|
|
3053
|
-
--gds-sys-color-content-content-negative: #BA1D00;
|
|
3054
|
-
--gds-sys-color-content-content-negative-bright: #FFF8F6;
|
|
3055
|
-
--gds-sys-color-content-content-custom-blue-bright: #F8F9FF;
|
|
3056
|
-
--gds-sys-color-content-content-disabled: #9D9D95;
|
|
3057
|
-
--gds-sys-color-custom-custom-blue: #005FAC;
|
|
3058
|
-
--gds-sys-color-custom-on-custom-blue: #D4E3FF;
|
|
3059
|
-
--gds-sys-color-custom-custom-blue-bright: #D4E3FF;
|
|
3060
|
-
--gds-sys-color-custom-on-custom-blue-bright: #00315D;
|
|
3061
|
-
--gds-sys-color-custom-custom-green: #003916;
|
|
3062
|
-
--gds-sys-color-custom-on-custom-green: #EAFFE8;
|
|
3063
|
-
--gds-sys-color-custom-custom-green-bright: #EAFFE8;
|
|
3064
|
-
--gds-sys-color-custom-on-custom-green-bright: #003916;
|
|
3065
|
-
--gds-sys-color-custom-custom-grey: #353531;
|
|
3066
|
-
--gds-sys-color-custom-on-custom-grey: #E7E7E4;
|
|
3067
|
-
--gds-sys-color-custom-custom-grey-bright: #E7E7E4;
|
|
3068
|
-
--gds-sys-color-custom-on-custom-grey-bright: #353531;
|
|
3069
|
-
--gds-sys-color-primary-primary: #353531;
|
|
3070
|
-
--gds-sys-color-state-layers-state-black: #000000 10%;
|
|
3071
|
-
--gds-sys-color-state-layers-state-black-dim1: #000000 20%;
|
|
3072
|
-
--gds-sys-color-state-layers-state-black-dim2: #000000 40%;
|
|
3073
|
-
--gds-sys-color-state-layers-state-black-shade: #000000 60%;
|
|
3074
|
-
--gds-sys-color-state-layers-state-positive: #006d31 10%;
|
|
3075
|
-
--gds-sys-color-state-layers-state-positive-dim: #006d31 20%;
|
|
3076
|
-
--gds-sys-color-state-layers-state-negative: #ba1d00 10%;
|
|
3077
|
-
--gds-sys-color-state-layers-state-negative-dim: #ba1d00 20%;
|
|
3078
|
-
--gds-sys-color-state-layers-state-custom-blue: #005fac 20%;
|
|
3079
|
-
--gds-sys-color-status-information-information: #353531;
|
|
3080
|
-
--gds-sys-color-status-information-on-information: #FFFFFF;
|
|
3081
|
-
--gds-sys-color-status-information-information-bright: #F3F3F2;
|
|
3082
|
-
--gds-sys-color-status-information-on-information-bright: #353531;
|
|
3083
|
-
--gds-sys-color-status-negative-negative: #BA1D00;
|
|
3084
|
-
--gds-sys-color-status-negative-on-negative: #FFFFFF;
|
|
3085
|
-
--gds-sys-color-status-negative-negative-bright: #FFEDE9;
|
|
3086
|
-
--gds-sys-color-status-negative-on-negative-bright: #BA1D00;
|
|
3087
|
-
--gds-sys-color-status-warning-warning: #9D6E00;
|
|
3088
|
-
--gds-sys-color-status-warning-on-warning: #FFFFFF;
|
|
3089
|
-
--gds-sys-color-status-warning-warning-bright: #FFEED9;
|
|
3090
|
-
--gds-sys-color-status-warning-on-warning-bright: #7D5700;
|
|
3091
|
-
--gds-sys-color-status-positive-positive: #006D31;
|
|
3092
|
-
--gds-sys-color-status-positive-on-positive: #FFFFFF;
|
|
3093
|
-
--gds-sys-color-status-positive-positive-bright: #EAFFE8;
|
|
3094
|
-
--gds-sys-color-status-positive-on-positive-bright: #006D31;
|
|
3095
|
-
--gds-sys-color-status-notice-notice: #005FAC;
|
|
3096
|
-
--gds-sys-color-status-notice-on-notice: #FFFFFF;
|
|
3097
|
-
--gds-sys-color-status-notice-notice-bright: #EBF1FF;
|
|
3098
|
-
--gds-sys-color-status-notice-on-notice-bright: #005FAC;
|
|
3099
|
-
--gds-sys-color-stroke-stroke: #353531;
|
|
3100
|
-
--gds-sys-color-stroke-stroke-variant1: #85857A;
|
|
3101
|
-
--gds-sys-color-stroke-stroke-variant2: #CECECA;
|
|
3102
|
-
--gds-sys-color-stroke-stroke-disabled: #9D9D95;
|
|
3103
|
-
--gds-sys-color-stroke-stroke-notice: #005FAC;
|
|
3104
|
-
--gds-sys-color-stroke-stroke-positive: #006D31;
|
|
3105
|
-
--gds-sys-color-stroke-stroke-warning: #7D5700;
|
|
3106
|
-
--gds-sys-color-stroke-stroke-negative: #BA1D00;
|
|
3107
|
-
--gds-sys-color-stroke-stroke-custom-blue: #005FAC;
|
|
3108
|
-
--gds-sys-color-stroke-stroke-custom-blue-bright: #6FAEFF;
|
|
3109
|
-
--gds-sys-color-stroke-stroke-inversed: #FFFFFF;
|
|
3110
|
-
}
|
|
3111
|
-
`;
|
|
3112
|
-
|
|
3113
|
-
// dist/libs/tokens/internal/size.css
|
|
3114
|
-
var size_default = `/**
|
|
3115
|
-
* Do not edit directly
|
|
3116
|
-
* Generated on Mon, 22 Apr 2024 10:32:32 GMT
|
|
3117
|
-
*/
|
|
3118
|
-
|
|
3119
|
-
:host {
|
|
3120
|
-
--gds-sys-typography-weight-bold: 700;
|
|
3121
|
-
--gds-sys-typography-weight-medium: 500;
|
|
3122
|
-
--gds-sys-typography-weight-book: 450;
|
|
3123
|
-
--gds-sys-typography-weight-regular: 400;
|
|
3124
|
-
--gds-sys-typography-weight-light: 300;
|
|
3125
|
-
--gds-sys-typography-size-label-overline: 14px;
|
|
3126
|
-
--gds-sys-typography-size-label-input-medium: 14px;
|
|
3127
|
-
--gds-sys-typography-size-label-input-large: 16px;
|
|
3128
|
-
--gds-sys-typography-size-label-information-medium: 14px;
|
|
3129
|
-
--gds-sys-typography-size-label-information-large: 16px;
|
|
3130
|
-
--gds-sys-typography-size-label-small: 12px;
|
|
3131
|
-
--gds-sys-typography-size-label-medium: 14px;
|
|
3132
|
-
--gds-sys-typography-size-label-large: 16px;
|
|
3133
|
-
--gds-sys-typography-size-body-small: 12px;
|
|
3134
|
-
--gds-sys-typography-size-body-medium: 14px;
|
|
3135
|
-
--gds-sys-typography-size-body-large: 16px;
|
|
3136
|
-
--gds-sys-typography-size-title-small: 14px;
|
|
3137
|
-
--gds-sys-typography-size-title-medium: 16px;
|
|
3138
|
-
--gds-sys-typography-size-title-large: 22px;
|
|
3139
|
-
--gds-sys-typography-size-headline-small: 24px;
|
|
3140
|
-
--gds-sys-typography-size-headline-medium: 28px;
|
|
3141
|
-
--gds-sys-typography-size-headline-large: 32px;
|
|
3142
|
-
--gds-sys-typography-size-display-small: 40px;
|
|
3143
|
-
--gds-sys-typography-size-display-medium: 64px;
|
|
3144
|
-
--gds-sys-typography-size-display-large: 82px;
|
|
3145
|
-
--gds-sys-typography-line-height-label-overline: 18px;
|
|
3146
|
-
--gds-sys-typography-line-height-label-input-medium: 20px;
|
|
3147
|
-
--gds-sys-typography-line-height-label-input-large: 20px;
|
|
3148
|
-
--gds-sys-typography-line-height-label-information-medium: 20px;
|
|
3149
|
-
--gds-sys-typography-line-height-label-information-large: 20px;
|
|
3150
|
-
--gds-sys-typography-line-height-label-small: 16px;
|
|
3151
|
-
--gds-sys-typography-line-height-label-medium: 20px;
|
|
3152
|
-
--gds-sys-typography-line-height-label-large: 20px;
|
|
3153
|
-
--gds-sys-typography-line-height-body-small: 16px;
|
|
3154
|
-
--gds-sys-typography-line-height-body-medium: 20px;
|
|
3155
|
-
--gds-sys-typography-line-height-body-large: 20px;
|
|
3156
|
-
--gds-sys-typography-line-height-title-small: 20px;
|
|
3157
|
-
--gds-sys-typography-line-height-title-medium: 24px;
|
|
3158
|
-
--gds-sys-typography-line-height-title-large: 28px;
|
|
3159
|
-
--gds-sys-typography-line-height-headline-small: 30px;
|
|
3160
|
-
--gds-sys-typography-line-height-headline-medium: 36px;
|
|
3161
|
-
--gds-sys-typography-line-height-headline-large: 40px;
|
|
3162
|
-
--gds-sys-typography-line-height-display-small: 52px;
|
|
3163
|
-
--gds-sys-typography-line-height-display-medium: 80px;
|
|
3164
|
-
--gds-sys-typography-line-height-display-large: 98px;
|
|
3165
|
-
--gds-sys-state-hover-state-layer-opacity: 0.10;
|
|
3166
|
-
--gds-sys-grid-width-desktop-lg: 2560px;
|
|
3167
|
-
--gds-sys-grid-width-desktop-md: 1440px;
|
|
3168
|
-
--gds-sys-grid-width-desktop-sm: 1024px;
|
|
3169
|
-
--gds-sys-grid-width-tablet: 768px;
|
|
3170
|
-
--gds-sys-grid-width-mobile: 425px;
|
|
3171
|
-
--gds-sys-grid-columns-24: 24;
|
|
3172
|
-
--gds-sys-grid-columns-12: 12;
|
|
3173
|
-
--gds-sys-grid-columns-8: 8;
|
|
3174
|
-
--gds-sys-grid-columns-6: 6;
|
|
3175
|
-
--gds-sys-grid-columns-4: 4;
|
|
3176
|
-
--gds-sys-grid-columns-2: 2;
|
|
3177
|
-
--gds-ref-size-15: 9999px;
|
|
3178
|
-
--gds-ref-size-14: 128px;
|
|
3179
|
-
--gds-ref-size-13: 112px;
|
|
3180
|
-
--gds-ref-size-12: 96px;
|
|
3181
|
-
--gds-ref-size-11: 80px;
|
|
3182
|
-
--gds-ref-size-10: 64px;
|
|
3183
|
-
--gds-ref-size-9: 48px;
|
|
3184
|
-
--gds-ref-size-8: 40px;
|
|
3185
|
-
--gds-ref-size-7: 32px;
|
|
3186
|
-
--gds-ref-size-6: 24px;
|
|
3187
|
-
--gds-ref-size-5: 16px;
|
|
3188
|
-
--gds-ref-size-4: 12px;
|
|
3189
|
-
--gds-ref-size-3: 8px;
|
|
3190
|
-
--gds-ref-size-2: 4px;
|
|
3191
|
-
--gds-ref-size-1: 2px;
|
|
3192
|
-
--gds-ref-size-0: 0px;
|
|
3193
|
-
--gds-sys-space-spacer-120: var(--gds-ref-size-14);
|
|
3194
|
-
--gds-sys-space-spacer-112: var(--gds-ref-size-13);
|
|
3195
|
-
--gds-sys-space-spacer-96: var(--gds-ref-size-12);
|
|
3196
|
-
--gds-sys-space-spacer-80: var(--gds-ref-size-11);
|
|
3197
|
-
--gds-sys-space-spacer-64: var(--gds-ref-size-10);
|
|
3198
|
-
--gds-sys-space-spacer-48: var(--gds-ref-size-9);
|
|
3199
|
-
--gds-sys-space-spacer-40: var(--gds-ref-size-8);
|
|
3200
|
-
--gds-sys-space-spacer-32: var(--gds-ref-size-7);
|
|
3201
|
-
--gds-sys-space-spacer-24: var(--gds-ref-size-6);
|
|
3202
|
-
--gds-sys-space-spacer-16: var(--gds-ref-size-5);
|
|
3203
|
-
--gds-sys-space-spacer-12: var(--gds-ref-size-4);
|
|
3204
|
-
--gds-sys-space-spacer-8: var(--gds-ref-size-3);
|
|
3205
|
-
--gds-sys-space-spacer-4: var(--gds-ref-size-2);
|
|
3206
|
-
--gds-sys-space-spacer-2: var(--gds-ref-size-1);
|
|
3207
|
-
--gds-sys-space-spacer-0: var(--gds-ref-size-0);
|
|
3208
|
-
--gds-sys-space-padding-120: var(--gds-ref-size-14);
|
|
3209
|
-
--gds-sys-space-padding-112: var(--gds-ref-size-13);
|
|
3210
|
-
--gds-sys-space-padding-96: var(--gds-ref-size-12);
|
|
3211
|
-
--gds-sys-space-padding-80: var(--gds-ref-size-11);
|
|
3212
|
-
--gds-sys-space-padding-64: var(--gds-ref-size-10);
|
|
3213
|
-
--gds-sys-space-padding-48: var(--gds-ref-size-9);
|
|
3214
|
-
--gds-sys-space-padding-40: var(--gds-ref-size-8);
|
|
3215
|
-
--gds-sys-space-padding-32: var(--gds-ref-size-7);
|
|
3216
|
-
--gds-sys-space-padding-24: var(--gds-ref-size-6);
|
|
3217
|
-
--gds-sys-space-padding-16: var(--gds-ref-size-5);
|
|
3218
|
-
--gds-sys-space-padding-12: var(--gds-ref-size-4);
|
|
3219
|
-
--gds-sys-space-padding-8: var(--gds-ref-size-3);
|
|
3220
|
-
--gds-sys-space-padding-4: var(--gds-ref-size-2);
|
|
3221
|
-
--gds-sys-space-padding-2: var(--gds-ref-size-1);
|
|
3222
|
-
--gds-sys-space-padding-0: var(--gds-ref-size-0);
|
|
3223
|
-
--gds-sys-space-margins-120: var(--gds-ref-size-14);
|
|
3224
|
-
--gds-sys-space-margins-112: var(--gds-ref-size-13);
|
|
3225
|
-
--gds-sys-space-margins-96: var(--gds-ref-size-12);
|
|
3226
|
-
--gds-sys-space-margins-80: var(--gds-ref-size-11);
|
|
3227
|
-
--gds-sys-space-margins-64: var(--gds-ref-size-10);
|
|
3228
|
-
--gds-sys-space-margins-48: var(--gds-ref-size-9);
|
|
3229
|
-
--gds-sys-space-margins-40: var(--gds-ref-size-8);
|
|
3230
|
-
--gds-sys-space-margins-32: var(--gds-ref-size-7);
|
|
3231
|
-
--gds-sys-space-margins-24: var(--gds-ref-size-6);
|
|
3232
|
-
--gds-sys-space-margins-16: var(--gds-ref-size-5);
|
|
3233
|
-
--gds-sys-space-margins-12: var(--gds-ref-size-4);
|
|
3234
|
-
--gds-sys-space-margins-8: var(--gds-ref-size-3);
|
|
3235
|
-
--gds-sys-space-margins-4: var(--gds-ref-size-2);
|
|
3236
|
-
--gds-sys-space-margins-2: var(--gds-ref-size-1);
|
|
3237
|
-
--gds-sys-space-margins-0: var(--gds-ref-size-0);
|
|
3238
|
-
--gds-sys-radii-full: var(--gds-ref-size-15);
|
|
3239
|
-
--gds-sys-radii-4xl: var(--gds-ref-size-12);
|
|
3240
|
-
--gds-sys-radii-3xl: var(--gds-ref-size-9);
|
|
3241
|
-
--gds-sys-radii-2xl: var(--gds-ref-size-7);
|
|
3242
|
-
--gds-sys-radii-xl: var(--gds-ref-size-6);
|
|
3243
|
-
--gds-sys-radii-l: var(--gds-ref-size-5);
|
|
3244
|
-
--gds-sys-radii-m: var(--gds-ref-size-4);
|
|
3245
|
-
--gds-sys-radii-s: var(--gds-ref-size-3);
|
|
3246
|
-
--gds-sys-radii-xs: var(--gds-ref-size-2);
|
|
3247
|
-
--gds-sys-radii-none: var(--gds-ref-size-0);
|
|
3248
|
-
--gds-sys-grid-padding-3xl: var(--gds-ref-size-12);
|
|
3249
|
-
--gds-sys-grid-padding-2xl: var(--gds-ref-size-9);
|
|
3250
|
-
--gds-sys-grid-padding-xl: var(--gds-ref-size-7);
|
|
3251
|
-
--gds-sys-grid-padding-l: var(--gds-ref-size-6);
|
|
3252
|
-
--gds-sys-grid-padding-m: var(--gds-ref-size-5);
|
|
3253
|
-
--gds-sys-grid-padding-s: var(--gds-ref-size-3);
|
|
3254
|
-
--gds-sys-grid-padding-xs: var(--gds-ref-size-2);
|
|
3255
|
-
--gds-sys-grid-padding-none: var(--gds-ref-size-0);
|
|
3256
|
-
--gds-sys-grid-gap-3xl: var(--gds-ref-size-12);
|
|
3257
|
-
--gds-sys-grid-gap-2xl: var(--gds-ref-size-9);
|
|
3258
|
-
--gds-sys-grid-gap-xl: var(--gds-ref-size-7);
|
|
3259
|
-
--gds-sys-grid-gap-l: var(--gds-ref-size-6);
|
|
3260
|
-
--gds-sys-grid-gap-m: var(--gds-ref-size-5);
|
|
3261
|
-
--gds-sys-grid-gap-s: var(--gds-ref-size-3);
|
|
3262
|
-
--gds-sys-grid-gap-xs: var(--gds-ref-size-2);
|
|
3263
|
-
--gds-sys-grid-gap-none: var(--gds-ref-size-0);
|
|
3264
|
-
--gds-sys-grid-breakpoint-desktop-lg: var(--gds-sys-grid-columns-12);
|
|
3265
|
-
--gds-sys-grid-breakpoint-desktop-md: var(--gds-sys-grid-columns-12);
|
|
3266
|
-
--gds-sys-grid-breakpoint-desktop-sm: var(--gds-sys-grid-columns-12);
|
|
3267
|
-
--gds-sys-grid-breakpoint-tablet: var(--gds-sys-grid-columns-12);
|
|
3268
|
-
--gds-sys-grid-breakpoint-mobile: var(--gds-sys-grid-columns-4);
|
|
3269
|
-
}
|
|
3270
|
-
`;
|
|
3271
|
-
|
|
3272
|
-
// libs/core/src/tokens.style.ts
|
|
3273
|
-
var tokens = [
|
|
3274
|
-
unsafeCSS2(pallet_default),
|
|
3275
|
-
unsafeCSS2(light_default),
|
|
3276
|
-
unsafeCSS2(size_default)
|
|
3277
|
-
];
|
|
3278
|
-
|
|
3279
|
-
// libs/core/src/components/grid/grid.style.css.ts
|
|
3280
|
-
import { css as css9 } from "lit";
|
|
3281
|
-
var style8 = css9`
|
|
3282
|
-
@layer grid, grid.desktop, grid.tablet, grid.mobile, grid.span, grid.space, grid.align, grid.debug;
|
|
3283
|
-
|
|
3284
|
-
@layer grid {
|
|
3285
|
-
:host {
|
|
3286
|
-
--_c: var(--gds-sys-grid-columns-12);
|
|
3287
|
-
--_grid-col: repeat(var(--_c), 1fr);
|
|
3288
|
-
--_grid-col-start: 1;
|
|
3289
|
-
--_grid-col-end: -1;
|
|
3290
|
-
--_gap-column: 0;
|
|
3291
|
-
--_gap-row: 0;
|
|
3292
|
-
display: grid;
|
|
3293
|
-
width: 100%;
|
|
3294
|
-
grid-template-columns: var(--_grid-col);
|
|
3295
|
-
grid-column-gap: var(--_gap-column);
|
|
3296
|
-
grid-row-gap: var(--_gap-row);
|
|
3297
|
-
padding: var(--_grid-padding);
|
|
3298
|
-
text-wrap: balance;
|
|
3299
|
-
}
|
|
3300
|
-
|
|
3301
|
-
:host([auto-columns]) {
|
|
3302
|
-
--_col-count: var(--_c, 0);
|
|
3303
|
-
--_gap-count: calc(var(--_col-count) - 1);
|
|
3304
|
-
--_total-gap-width: calc(var(--_gap-count) * var(--_gap-column, 0px));
|
|
3305
|
-
--_col-width-max: calc(
|
|
3306
|
-
(100% - var(--_total-gap-width)) / var(--_col-count)
|
|
3307
|
-
);
|
|
3308
|
-
grid-template-columns: repeat(
|
|
3309
|
-
auto-fill,
|
|
3310
|
-
minmax(max(var(--_col-width), var(--_col-width-max)), 1fr)
|
|
3311
|
-
);
|
|
3312
|
-
}
|
|
3313
|
-
}
|
|
3314
|
-
|
|
3315
|
-
/* Responsive */
|
|
3316
|
-
|
|
3317
|
-
:host([columns]) {
|
|
3318
|
-
--_c: var(--_columns-desktop);
|
|
3319
|
-
}
|
|
3320
|
-
|
|
3321
|
-
:host {
|
|
3322
|
-
--_gap-column: var(--_gap-desktop);
|
|
3323
|
-
--_gap-row: var(--_row-gap-desktop);
|
|
3324
|
-
--_grid-padding: var(--_padding-desktop);
|
|
3325
|
-
--_col-width: var(--_col-width-desktop);
|
|
3326
|
-
}
|
|
3327
|
-
|
|
3328
|
-
@media only screen and (max-width: 768px) {
|
|
3329
|
-
:host([columns]) {
|
|
3330
|
-
--_c: var(--_columns-tablet);
|
|
3331
|
-
}
|
|
3332
|
-
|
|
3333
|
-
:host {
|
|
3334
|
-
--_gap-column: var(--_gap-tablet);
|
|
3335
|
-
--_gap-row: var(--_row-gap-tablet);
|
|
3336
|
-
--_grid-padding: var(--_padding-tablet);
|
|
3337
|
-
--_col-width: var(--_col-width-tablet);
|
|
3338
|
-
}
|
|
3339
|
-
}
|
|
3340
|
-
|
|
3341
|
-
@media only screen and (max-width: 425px) {
|
|
3342
|
-
:host([columns]) {
|
|
3343
|
-
--_c: var(--_columns-mobile);
|
|
3344
|
-
}
|
|
3345
|
-
|
|
3346
|
-
:host {
|
|
3347
|
-
--_c: var(--_columns-mobile);
|
|
3348
|
-
--_gap-column: var(--_gap-mobile);
|
|
3349
|
-
--_gap-row: var(--_row-gap-mobile);
|
|
3350
|
-
--_grid-padding: var(--_padding-mobile);
|
|
3351
|
-
--_col-width: var(--_col-width-mobile);
|
|
3352
|
-
}
|
|
3353
|
-
}
|
|
3354
|
-
`;
|
|
3355
|
-
var grid_style_css_default = style8;
|
|
3356
|
-
|
|
3357
|
-
// libs/core/src/components/grid/grid.ts
|
|
3358
|
-
var BreakpointPattern = /(?<l>l:([a-z0-9]+))?\s*(?<m>m:([a-z0-9]+))?\s*(?<s>s:([a-z0-9]+))?/;
|
|
3359
|
-
var GdsGrid = class extends LitElement6 {
|
|
3360
|
-
constructor() {
|
|
3361
|
-
super(...arguments);
|
|
3362
|
-
this._gridVariables = {
|
|
3363
|
-
varsColumn: css10``,
|
|
3364
|
-
varsGap: css10``,
|
|
3365
|
-
varsRowGap: css10``,
|
|
3366
|
-
varsPadding: css10``,
|
|
3367
|
-
varsAutoColumns: css10``
|
|
3368
|
-
};
|
|
3369
|
-
}
|
|
3370
|
-
/**
|
|
3371
|
-
* Lifecycle method called when the element is connected to the DOM.
|
|
3372
|
-
* It updates the column, gap, and padding variables.
|
|
3373
|
-
*/
|
|
3374
|
-
connectedCallback() {
|
|
3375
|
-
super.connectedCallback();
|
|
3376
|
-
this._updateColumnVariables();
|
|
3377
|
-
this._updateGapVariables();
|
|
3378
|
-
this._updateRowGapVariables();
|
|
3379
|
-
this._updatePaddingVariables();
|
|
3380
|
-
this._updateAutoColumnsVariables();
|
|
3381
|
-
}
|
|
3382
|
-
_updateColumnVariables() {
|
|
3383
|
-
const match = this.columns?.match(BreakpointPattern);
|
|
3384
|
-
let columnsDesktop, columnsTablet, columnsMobile;
|
|
3385
|
-
if (this.columns && !isNaN(Number(this.columns))) {
|
|
3386
|
-
columnsDesktop = columnsTablet = columnsMobile = Number(this.columns);
|
|
3387
|
-
} else {
|
|
3388
|
-
const { l, m, s } = match?.groups || {};
|
|
3389
|
-
columnsDesktop = l ? Number(l.split(":")[1]) : void 0;
|
|
3390
|
-
columnsTablet = m ? Number(m.split(":")[1]) : void 0;
|
|
3391
|
-
columnsMobile = s ? Number(s.split(":")[1]) : void 0;
|
|
3392
|
-
}
|
|
3393
|
-
const columnProperties = [
|
|
3394
|
-
{ name: "_columns-desktop", value: columnsDesktop },
|
|
3395
|
-
{ name: "_columns-tablet", value: columnsTablet },
|
|
3396
|
-
{ name: "_columns-mobile", value: columnsMobile }
|
|
3397
|
-
];
|
|
3398
|
-
const cssVariables = columnProperties.filter(({ value }) => value !== void 0).map(({ name, value }) => `--${name}: ${value};`).join(" ");
|
|
3399
|
-
this._gridVariables = {
|
|
3400
|
-
...this._gridVariables,
|
|
3401
|
-
varsColumn: css10`
|
|
3402
|
-
${unsafeCSS3(cssVariables)}
|
|
3403
|
-
`
|
|
3404
|
-
};
|
|
3405
|
-
this.requestUpdate("_gridVariables");
|
|
3406
|
-
}
|
|
3407
|
-
_updateGapVariables() {
|
|
3408
|
-
const match = this.gap?.match(BreakpointPattern);
|
|
3409
|
-
let gapDesktop, gapTablet, gapMobile;
|
|
3410
|
-
if (this.gap && !this.gap.includes(" ")) {
|
|
3411
|
-
gapDesktop = gapTablet = gapMobile = `var(--gds-sys-grid-gap-${this.gap})`;
|
|
3412
|
-
} else {
|
|
3413
|
-
const { l, m, s } = match?.groups || {};
|
|
3414
|
-
gapDesktop = l ? `var(--gds-sys-grid-gap-${l.split(":")[1]})` : void 0;
|
|
3415
|
-
gapTablet = m ? `var(--gds-sys-grid-gap-${m.split(":")[1]})` : void 0;
|
|
3416
|
-
gapMobile = s ? `var(--gds-sys-grid-gap-${s.split(":")[1]})` : void 0;
|
|
3417
|
-
}
|
|
3418
|
-
const gapProperties = [
|
|
3419
|
-
{ name: "_gap-desktop", value: gapDesktop },
|
|
3420
|
-
{ name: "_gap-tablet", value: gapTablet },
|
|
3421
|
-
{ name: "_gap-mobile", value: gapMobile }
|
|
3422
|
-
];
|
|
3423
|
-
const cssVariables = gapProperties.filter(({ value }) => value !== void 0).map(({ name, value }) => `--${name}: ${value};`).join(" ");
|
|
3424
|
-
this._gridVariables = {
|
|
3425
|
-
...this._gridVariables,
|
|
3426
|
-
varsGap: css10`
|
|
3427
|
-
${unsafeCSS3(cssVariables)}
|
|
3428
|
-
`
|
|
3429
|
-
};
|
|
3430
|
-
this.requestUpdate("_gridVariables");
|
|
3431
|
-
}
|
|
3432
|
-
_updateRowGapVariables() {
|
|
3433
|
-
const match = this.rowGap?.match(BreakpointPattern);
|
|
3434
|
-
let rowGapDesktop, rowGapTablet, rowGapMobile;
|
|
3435
|
-
if (this.rowGap && !this.rowGap.includes(" ")) {
|
|
3436
|
-
rowGapDesktop = rowGapTablet = rowGapMobile = `var(--gds-sys-grid-gap-${this.rowGap})`;
|
|
3437
|
-
} else {
|
|
3438
|
-
const { l, m, s } = match?.groups || {};
|
|
3439
|
-
rowGapDesktop = l ? `var(--gds-sys-grid-gap-${l.split(":")[1]})` : void 0;
|
|
3440
|
-
rowGapTablet = m ? `var(--gds-sys-grid-gap-${m.split(":")[1]})` : void 0;
|
|
3441
|
-
rowGapMobile = s ? `var(--gds-sys-grid-gap-${s.split(":")[1]})` : void 0;
|
|
3442
|
-
}
|
|
3443
|
-
const gapProperties = [
|
|
3444
|
-
{ name: "_row-gap-desktop", value: rowGapDesktop },
|
|
3445
|
-
{ name: "_row-gap-tablet", value: rowGapTablet },
|
|
3446
|
-
{ name: "_row-gap-mobile", value: rowGapMobile }
|
|
3447
|
-
];
|
|
3448
|
-
const cssVariables = gapProperties.filter(({ value }) => value !== void 0).map(({ name, value }) => `--${name}: ${value};`).join(" ");
|
|
3449
|
-
this._gridVariables = {
|
|
3450
|
-
...this._gridVariables,
|
|
3451
|
-
varsRowGap: css10`
|
|
3452
|
-
${unsafeCSS3(cssVariables)}
|
|
3453
|
-
`
|
|
3454
|
-
};
|
|
3455
|
-
this.requestUpdate("_gridVariables");
|
|
3456
|
-
}
|
|
3457
|
-
_updatePaddingVariables() {
|
|
3458
|
-
const match = this.padding?.match(BreakpointPattern);
|
|
3459
|
-
let paddingDesktop, paddingTablet, paddingMobile;
|
|
3460
|
-
if (this.padding && !this.padding.includes(" ")) {
|
|
3461
|
-
paddingDesktop = paddingTablet = paddingMobile = `var(--gds-sys-grid-gap-${this.gap})`;
|
|
3462
|
-
} else {
|
|
3463
|
-
const { l, m, s } = match?.groups || {};
|
|
3464
|
-
paddingDesktop = l ? `var(--gds-sys-grid-gap-${l.split(":")[1]})` : void 0;
|
|
3465
|
-
paddingTablet = m ? `var(--gds-sys-grid-gap-${m.split(":")[1]})` : void 0;
|
|
3466
|
-
paddingMobile = s ? `var(--gds-sys-grid-gap-${s.split(":")[1]})` : void 0;
|
|
3467
|
-
}
|
|
3468
|
-
const paddingProperties = [
|
|
3469
|
-
{ name: "_padding-desktop", value: paddingDesktop },
|
|
3470
|
-
{ name: "_padding-tablet", value: paddingTablet },
|
|
3471
|
-
{ name: "_padding-mobile", value: paddingMobile }
|
|
3472
|
-
];
|
|
3473
|
-
const cssVariables = paddingProperties.filter(({ value }) => value !== void 0).map(({ name, value }) => `--${name}: ${value};`).join(" ");
|
|
3474
|
-
this._gridVariables = {
|
|
3475
|
-
...this._gridVariables,
|
|
3476
|
-
varsPadding: css10`
|
|
3477
|
-
${unsafeCSS3(cssVariables)}
|
|
3478
|
-
`
|
|
3479
|
-
};
|
|
3480
|
-
this.requestUpdate("_gridVariables");
|
|
3481
|
-
}
|
|
3482
|
-
_updateAutoColumnsVariables() {
|
|
3483
|
-
const match = this.autoColumns?.match(BreakpointPattern);
|
|
3484
|
-
let widthDesktop, widthTablet, widthMobile;
|
|
3485
|
-
if (this.autoColumns && !this.autoColumns.includes(" ")) {
|
|
3486
|
-
widthDesktop = widthTablet = widthMobile = `${this.autoColumns}px`;
|
|
3487
|
-
} else {
|
|
3488
|
-
const { l, m, s } = match?.groups || {};
|
|
3489
|
-
widthDesktop = l ? `${l.split(":")[1]}px` : void 0;
|
|
3490
|
-
widthTablet = m ? `${m.split(":")[1]}px` : void 0;
|
|
3491
|
-
widthMobile = s ? `${s.split(":")[1]}px` : void 0;
|
|
3492
|
-
}
|
|
3493
|
-
const widthProperties = [
|
|
3494
|
-
{ name: "_col-width-mobile", value: widthMobile },
|
|
3495
|
-
{ name: "_col-width-tablet", value: widthTablet },
|
|
3496
|
-
{ name: "_col-width-desktop", value: widthDesktop }
|
|
3497
|
-
];
|
|
3498
|
-
const cssVariables = widthProperties.filter(({ value }) => value !== void 0).map(({ name, value }) => `--${name}: ${value};`).join(" ");
|
|
3499
|
-
this._gridVariables = {
|
|
3500
|
-
...this._gridVariables,
|
|
3501
|
-
varsAutoColumns: css10`
|
|
3502
|
-
${unsafeCSS3(cssVariables)}
|
|
3503
|
-
`
|
|
3504
|
-
};
|
|
3505
|
-
this.requestUpdate("_gridVariables");
|
|
3506
|
-
}
|
|
3507
|
-
_updateGridCss() {
|
|
3508
|
-
const sheet = new CSSStyleSheet();
|
|
3509
|
-
sheet.replaceSync(`:host {${Object.values(this._gridVariables).join("")}} `);
|
|
3510
|
-
if (this.shadowRoot) {
|
|
3511
|
-
const styles2 = Array.isArray(GdsGrid.styles) ? GdsGrid.styles : [GdsGrid.styles];
|
|
3512
|
-
const styleSheets = styles2.flatMap((style9) => {
|
|
3513
|
-
if (Array.isArray(style9)) {
|
|
3514
|
-
return style9.map((s) => {
|
|
3515
|
-
const newSheet = new CSSStyleSheet();
|
|
3516
|
-
newSheet.replaceSync(s.cssText);
|
|
3517
|
-
return newSheet;
|
|
3518
|
-
});
|
|
3519
|
-
} else {
|
|
3520
|
-
const newSheet = new CSSStyleSheet();
|
|
3521
|
-
newSheet.replaceSync(style9.cssText);
|
|
3522
|
-
return [newSheet];
|
|
3523
|
-
}
|
|
3524
|
-
});
|
|
3525
|
-
this.shadowRoot.adoptedStyleSheets = [sheet, ...styleSheets];
|
|
3526
|
-
}
|
|
3527
|
-
}
|
|
3528
|
-
render() {
|
|
3529
|
-
return html` <slot></slot> `;
|
|
3530
|
-
}
|
|
3531
|
-
};
|
|
3532
|
-
GdsGrid.styles = [tokens, grid_style_css_default];
|
|
3533
|
-
GdsGrid.shadowRootOptions = {
|
|
3534
|
-
mode: "open",
|
|
3535
|
-
delegatesFocus: true
|
|
3536
|
-
};
|
|
3537
|
-
__decorateClass([
|
|
3538
|
-
property10({ attribute: "columns", type: String })
|
|
3539
|
-
], GdsGrid.prototype, "columns", 2);
|
|
3540
|
-
__decorateClass([
|
|
3541
|
-
property10({ attribute: "gap", type: String })
|
|
3542
|
-
], GdsGrid.prototype, "gap", 2);
|
|
3543
|
-
__decorateClass([
|
|
3544
|
-
property10({ attribute: "row-gap", type: String })
|
|
3545
|
-
], GdsGrid.prototype, "rowGap", 2);
|
|
3546
|
-
__decorateClass([
|
|
3547
|
-
property10({ attribute: "padding", type: String })
|
|
3548
|
-
], GdsGrid.prototype, "padding", 2);
|
|
3549
|
-
__decorateClass([
|
|
3550
|
-
property10({ attribute: "auto-columns", type: String })
|
|
3551
|
-
], GdsGrid.prototype, "autoColumns", 2);
|
|
3552
|
-
__decorateClass([
|
|
3553
|
-
state11()
|
|
3554
|
-
], GdsGrid.prototype, "_gridVariables", 2);
|
|
3555
|
-
__decorateClass([
|
|
3556
|
-
watch("columns")
|
|
3557
|
-
], GdsGrid.prototype, "_updateColumnVariables", 1);
|
|
3558
|
-
__decorateClass([
|
|
3559
|
-
watch("gap")
|
|
3560
|
-
], GdsGrid.prototype, "_updateGapVariables", 1);
|
|
3561
|
-
__decorateClass([
|
|
3562
|
-
watch("row-gap")
|
|
3563
|
-
], GdsGrid.prototype, "_updateRowGapVariables", 1);
|
|
3564
|
-
__decorateClass([
|
|
3565
|
-
watch("padding")
|
|
3566
|
-
], GdsGrid.prototype, "_updatePaddingVariables", 1);
|
|
3567
|
-
__decorateClass([
|
|
3568
|
-
watch("autoColumns")
|
|
3569
|
-
], GdsGrid.prototype, "_updateAutoColumnsVariables", 1);
|
|
3570
|
-
__decorateClass([
|
|
3571
|
-
watch("_gridVariables")
|
|
3572
|
-
], GdsGrid.prototype, "_updateGridCss", 1);
|
|
3573
|
-
GdsGrid = __decorateClass([
|
|
3574
|
-
gdsCustomElement("gds-grid")
|
|
3575
|
-
], GdsGrid);
|
|
3576
|
-
|
|
3577
|
-
// libs/core/src/components/grouped-list/grouped-list.ts
|
|
3578
|
-
import { state as state12, property as property11 } from "lit/decorators.js";
|
|
3579
|
-
import { when as when5 } from "lit/directives/when.js";
|
|
3580
|
-
|
|
3581
|
-
// libs/core/src/components/grouped-list/list-item.ts
|
|
3582
|
-
var GdsListItem = class extends GdsElement {
|
|
3583
|
-
connectedCallback() {
|
|
3584
|
-
super.connectedCallback();
|
|
3585
|
-
this.setAttribute("role", "listitem");
|
|
3586
|
-
}
|
|
3587
|
-
render() {
|
|
3588
|
-
return html`<slot></slot>`;
|
|
3589
|
-
}
|
|
3590
|
-
};
|
|
3591
|
-
GdsListItem = __decorateClass([
|
|
3592
|
-
gdsCustomElement("gds-list-item")
|
|
3593
|
-
], GdsListItem);
|
|
3594
|
-
|
|
3595
|
-
// libs/core/src/components/grouped-list/grouped-list.ts
|
|
3596
|
-
var GdsGroupedList = class extends GdsElement {
|
|
3597
|
-
constructor() {
|
|
3598
|
-
super(...arguments);
|
|
3599
|
-
this.label = "";
|
|
3600
|
-
}
|
|
3601
|
-
connectedCallback() {
|
|
3602
|
-
super.connectedCallback();
|
|
3603
|
-
constrainSlots(this);
|
|
3604
|
-
TransitionalStyles.instance.apply(this, "gds-grouped-list");
|
|
3605
|
-
}
|
|
3606
|
-
render() {
|
|
3607
|
-
return html`${this._tStyles}${when5(
|
|
3608
|
-
this.label,
|
|
3609
|
-
() => html`<div class="gds-list-heading" aria-hidden="true" id="label">
|
|
3610
|
-
${this.label}
|
|
3611
|
-
</div>`
|
|
3612
|
-
)}
|
|
3613
|
-
<div role="list" aria-labelledby="label">
|
|
3614
|
-
<slot gds-allow="gds-list-item"></slot>
|
|
3615
|
-
</div>`;
|
|
3616
|
-
}
|
|
3617
|
-
};
|
|
3618
|
-
__decorateClass([
|
|
3619
|
-
state12()
|
|
3620
|
-
], GdsGroupedList.prototype, "_tStyles", 2);
|
|
3621
|
-
__decorateClass([
|
|
3622
|
-
property11()
|
|
3623
|
-
], GdsGroupedList.prototype, "label", 2);
|
|
3624
|
-
GdsGroupedList = __decorateClass([
|
|
3625
|
-
gdsCustomElement("gds-grouped-list")
|
|
3626
|
-
], GdsGroupedList);
|
|
3627
|
-
|
|
3628
|
-
// libs/core/src/components/segmented-control/segmented-control.ts
|
|
3629
|
-
import { unsafeCSS as unsafeCSS5 } from "lit";
|
|
3630
|
-
import { query as query4, state as state13, property as property13 } from "lit/decorators.js";
|
|
3631
|
-
import { when as when6 } from "lit/directives/when.js";
|
|
3632
|
-
import { msg as msg6 } from "@lit/localize";
|
|
3633
|
-
|
|
3634
|
-
// libs/core/src/components/segmented-control/segment/segment.ts
|
|
3635
|
-
import { property as property12 } from "lit/decorators.js";
|
|
3636
|
-
import { unsafeCSS as unsafeCSS4 } from "lit";
|
|
3637
|
-
|
|
3638
|
-
// libs/core/src/components/segmented-control/segment/segment.style.css
|
|
3639
|
-
var segment_style_default = `:host {
|
|
3640
|
-
display: flex;
|
|
3641
|
-
transition: 0.2s;
|
|
3642
|
-
z-index: 1;
|
|
3643
|
-
}
|
|
3644
|
-
|
|
3645
|
-
button {
|
|
3646
|
-
-webkit-appearance: none;
|
|
3647
|
-
-moz-appearance: none;
|
|
3648
|
-
appearance: none;
|
|
3649
|
-
background: transparent;
|
|
3650
|
-
border-radius: calc(infinity * 1px);
|
|
3651
|
-
border-width: 0;
|
|
3652
|
-
color: var(--gds-sys-color-content-content);
|
|
3653
|
-
cursor: pointer;
|
|
3654
|
-
flex-grow: 1;
|
|
3655
|
-
flex-shrink: 0;
|
|
3656
|
-
font-family: inherit;
|
|
3657
|
-
font-size: inherit;
|
|
3658
|
-
overflow: hidden;
|
|
3659
|
-
padding: 0 1rem;
|
|
3660
|
-
text-align: center;
|
|
3661
|
-
text-overflow: ellipsis;
|
|
3662
|
-
white-space: nowrap;
|
|
3663
|
-
width: 100%;
|
|
3664
|
-
}
|
|
3665
|
-
|
|
3666
|
-
@media (pointer: fine) {
|
|
3667
|
-
button:hover {
|
|
3668
|
-
background-color: color-mix(
|
|
3669
|
-
in srgb,
|
|
3670
|
-
var(--gds-sys-color-state-layers-state-black-dim1),
|
|
3671
|
-
transparent
|
|
3672
|
-
);
|
|
3673
|
-
}
|
|
3674
|
-
}
|
|
3675
|
-
|
|
3676
|
-
button:focus-visible {
|
|
3677
|
-
outline: 2px solid #000;
|
|
3678
|
-
outline-offset: -2px;
|
|
3679
|
-
}
|
|
3680
|
-
`;
|
|
3681
|
-
|
|
3682
|
-
// libs/core/src/components/segmented-control/segment/segment.ts
|
|
3683
|
-
var GdsSegment = class extends GdsElement {
|
|
3684
|
-
constructor() {
|
|
3685
|
-
super(...arguments);
|
|
3686
|
-
this.selected = false;
|
|
3687
|
-
}
|
|
3688
|
-
connectedCallback() {
|
|
3689
|
-
super.connectedCallback();
|
|
3690
|
-
TransitionalStyles.instance.apply(this, "gds-segmented");
|
|
3691
|
-
this.setAttribute("role", "listitem");
|
|
3692
|
-
}
|
|
3693
|
-
render() {
|
|
3694
|
-
return html`<button aria-current=${String(this.selected)}>
|
|
3695
|
-
<slot></slot>
|
|
3696
|
-
</button>`;
|
|
3697
|
-
}
|
|
3698
|
-
};
|
|
3699
|
-
GdsSegment.styles = [...tokens, unsafeCSS4(segment_style_default)];
|
|
3700
|
-
__decorateClass([
|
|
3701
|
-
property12({ type: Boolean, reflect: true })
|
|
3702
|
-
], GdsSegment.prototype, "selected", 2);
|
|
3703
|
-
__decorateClass([
|
|
3704
|
-
property12()
|
|
3705
|
-
], GdsSegment.prototype, "value", 2);
|
|
3706
|
-
GdsSegment = __decorateClass([
|
|
3707
|
-
gdsCustomElement("gds-segment")
|
|
3708
|
-
], GdsSegment);
|
|
3709
|
-
|
|
3710
|
-
// libs/core/src/components/segmented-control/segmented-control.style.css
|
|
3711
|
-
var segmented_control_style_default = `:host {
|
|
3712
|
-
background-color: var(--gds-sys-color-container-container-dim1);
|
|
3713
|
-
border: 0.25rem solid var(--gds-sys-color-container-container-dim1);
|
|
3714
|
-
border-radius: calc(infinity * 1px);
|
|
3715
|
-
box-sizing: border-box;
|
|
3716
|
-
contain: layout;
|
|
3717
|
-
display: inline-flex;
|
|
3718
|
-
gap: 0.25rem;
|
|
3719
|
-
height: 3rem;
|
|
3720
|
-
max-width: 100%;
|
|
3721
|
-
overflow: hidden;
|
|
3722
|
-
}
|
|
3723
|
-
|
|
3724
|
-
:host([size='small']) {
|
|
3725
|
-
height: 2.5rem;
|
|
3726
|
-
}
|
|
3727
|
-
|
|
3728
|
-
#track {
|
|
3729
|
-
box-sizing: border-box;
|
|
3730
|
-
display: flex;
|
|
3731
|
-
flex-grow: 0;
|
|
3732
|
-
flex-shrink: 1;
|
|
3733
|
-
overflow: hidden;
|
|
3734
|
-
position: relative;
|
|
3735
|
-
width: 100%;
|
|
3736
|
-
}
|
|
3737
|
-
|
|
3738
|
-
#segments {
|
|
3739
|
-
box-sizing: border-box;
|
|
3740
|
-
display: inline-flex;
|
|
3741
|
-
gap: 0.25rem;
|
|
3742
|
-
position: relative;
|
|
3743
|
-
transition: 0.2s;
|
|
3744
|
-
z-index: 1;
|
|
3745
|
-
}
|
|
3746
|
-
|
|
3747
|
-
#btn-prev,
|
|
3748
|
-
#btn-next {
|
|
3749
|
-
align-items: center;
|
|
3750
|
-
-webkit-appearance: none;
|
|
3751
|
-
-moz-appearance: none;
|
|
3752
|
-
appearance: none;
|
|
3753
|
-
aspect-ratio: 1;
|
|
3754
|
-
background-color: var(--gds-sys-color-container-container-dim1);
|
|
3755
|
-
border-radius: calc(infinity * 1px);
|
|
3756
|
-
border-width: 0;
|
|
3757
|
-
color: var(--gds-sys-color-content-content);
|
|
3758
|
-
cursor: pointer;
|
|
3759
|
-
display: flex;
|
|
3760
|
-
font-size: 1rem;
|
|
3761
|
-
height: 100%;
|
|
3762
|
-
justify-content: center;
|
|
3763
|
-
width: 2.5rem;
|
|
3764
|
-
|
|
3765
|
-
@media (pointer: fine) {
|
|
3766
|
-
&:hover {
|
|
3767
|
-
background-color: color-mix(
|
|
3768
|
-
in srgb,
|
|
3769
|
-
var(--gds-sys-color-state-layers-state-black-dim1),
|
|
3770
|
-
var(--gds-sys-color-container-container-dim1)
|
|
3771
|
-
);
|
|
3772
|
-
}
|
|
3773
|
-
}
|
|
3774
|
-
}
|
|
3775
|
-
|
|
3776
|
-
:host([size='small']) #btn-prev,
|
|
3777
|
-
:host([size='small']) #btn-next {
|
|
3778
|
-
width: 2rem;
|
|
3779
|
-
}
|
|
3780
|
-
|
|
3781
|
-
::slotted(*) {
|
|
3782
|
-
flex-grow: 1;
|
|
3783
|
-
flex-shrink: 0;
|
|
3784
|
-
z-index: 1;
|
|
3785
|
-
}
|
|
3786
|
-
|
|
3787
|
-
#indicator {
|
|
3788
|
-
background-color: var(--gds-sys-color-container-container-bright);
|
|
3789
|
-
border-radius: calc(infinity * 1px);
|
|
3790
|
-
height: 100%;
|
|
3791
|
-
left: 0;
|
|
3792
|
-
position: absolute;
|
|
3793
|
-
transition:
|
|
3794
|
-
transform 0.2s,
|
|
3795
|
-
width 0.2s;
|
|
3796
|
-
z-index: 0;
|
|
3797
|
-
}
|
|
3798
|
-
`;
|
|
3799
|
-
|
|
3800
|
-
// libs/core/src/components/segmented-control/segmented-control.ts
|
|
3801
|
-
var BTN_SIZE = {
|
|
3802
|
-
small: 36,
|
|
3803
|
-
medium: 44
|
|
3804
|
-
};
|
|
3805
|
-
var getSegmentGap = (transitionalStyles) => transitionalStyles ? 0 : 4;
|
|
3806
|
-
var _value, _tid, _resizeObserver, _firstVisibleIndex, _calculatedSegmentWidth, _segmentWidth, _segmentsContainerLeft, _focusedIndex, _dragStartX, _dragStartLeft, _isDragging, _startDrag, _drag, _endDrag, _calcVisibleAfterDrag, _calcLayout, _applySegmentsTransform, _handleSlotChange, handleSlotChange_fn, _scrollLeft, _scrollRight, _updateScrollBtnState, _updateIndicator, _handleSegmentClick, _updateSelectedFromValue;
|
|
3807
|
-
var GdsSegmentedControl = class extends GdsElement {
|
|
3808
|
-
constructor() {
|
|
3809
|
-
super(...arguments);
|
|
3810
|
-
__privateAdd(this, _handleSlotChange);
|
|
3811
|
-
this.segMinWidth = 100;
|
|
3812
|
-
this.size = "medium";
|
|
3813
|
-
__privateAdd(this, _value, void 0);
|
|
3814
|
-
this._showPrevButton = false;
|
|
3815
|
-
this._showNextButton = false;
|
|
3816
|
-
__privateAdd(this, _tid, void 0);
|
|
3817
|
-
__privateAdd(this, _resizeObserver, new ResizeObserver(() => {
|
|
3818
|
-
__privateGet(this, _tid) && clearTimeout(__privateGet(this, _tid));
|
|
3819
|
-
__privateSet(this, _tid, setTimeout(() => {
|
|
3820
|
-
__privateGet(this, _calcLayout).call(this);
|
|
3821
|
-
}, 20));
|
|
3822
|
-
}));
|
|
3823
|
-
__privateAdd(this, _firstVisibleIndex, 0);
|
|
3824
|
-
__privateAdd(this, _calculatedSegmentWidth, 0);
|
|
3825
|
-
__privateAdd(this, _segmentWidth, 0);
|
|
3826
|
-
__privateAdd(this, _segmentsContainerLeft, 0);
|
|
3827
|
-
__privateAdd(this, _focusedIndex, 0);
|
|
3828
|
-
__privateAdd(this, _dragStartX, 0);
|
|
3829
|
-
__privateAdd(this, _dragStartLeft, 0);
|
|
3830
|
-
__privateAdd(this, _isDragging, false);
|
|
3831
|
-
__privateAdd(this, _startDrag, (event) => {
|
|
3832
|
-
__privateSet(this, _dragStartX, event.clientX);
|
|
3833
|
-
__privateSet(this, _dragStartLeft, __privateGet(this, _segmentsContainerLeft));
|
|
3834
|
-
__privateSet(this, _isDragging, true);
|
|
3835
|
-
});
|
|
3836
|
-
__privateAdd(this, _drag, (event) => {
|
|
3837
|
-
if (!__privateGet(this, _isDragging))
|
|
3838
|
-
return;
|
|
3839
|
-
event.preventDefault();
|
|
3840
|
-
const delta = event.clientX - __privateGet(this, _dragStartX);
|
|
3841
|
-
if (Math.abs(delta) < 5)
|
|
3842
|
-
return;
|
|
3843
|
-
try {
|
|
3844
|
-
if (!this._elSegments.hasPointerCapture(event.pointerId))
|
|
3845
|
-
this._elSegments.setPointerCapture(event.pointerId);
|
|
3846
|
-
__privateSet(this, _segmentsContainerLeft, __privateGet(this, _dragStartLeft) + delta);
|
|
3847
|
-
__privateGet(this, _applySegmentsTransform).call(this);
|
|
3848
|
-
} catch {
|
|
3849
|
-
}
|
|
3850
|
-
});
|
|
3851
|
-
__privateAdd(this, _endDrag, (event) => {
|
|
3852
|
-
if (!__privateGet(this, _isDragging))
|
|
3853
|
-
return;
|
|
3854
|
-
__privateSet(this, _isDragging, false);
|
|
3855
|
-
try {
|
|
3856
|
-
this._elSegments.releasePointerCapture(event.pointerId);
|
|
3857
|
-
__privateGet(this, _calcVisibleAfterDrag).call(this);
|
|
3858
|
-
} catch {
|
|
3859
|
-
}
|
|
3860
|
-
});
|
|
3861
|
-
__privateAdd(this, _calcVisibleAfterDrag, () => {
|
|
3862
|
-
__privateSet(this, _firstVisibleIndex, Math.round(
|
|
3863
|
-
-__privateGet(this, _segmentsContainerLeft) / __privateGet(this, _calculatedSegmentWidth)
|
|
3864
|
-
));
|
|
3865
|
-
__privateGet(this, _calcLayout).call(this);
|
|
3866
|
-
});
|
|
3867
|
-
// Calculates the layout based on the configured min width
|
|
3868
|
-
// and the available space in the track
|
|
3869
|
-
__privateAdd(this, _calcLayout, (followFocus = false) => {
|
|
3870
|
-
const calcNumVisibleSegments = () => {
|
|
3871
|
-
const numSegments = this.segments.length;
|
|
3872
|
-
const availableWidth = this._elTrack.offsetWidth;
|
|
3873
|
-
if (availableWidth / numSegments > this.segMinWidth) {
|
|
3874
|
-
return {
|
|
3875
|
-
count: numSegments,
|
|
3876
|
-
segmentWidth: (availableWidth - getSegmentGap(this._isUsingTransitionalStyles) * (numSegments - 1)) / numSegments
|
|
3877
|
-
};
|
|
3878
|
-
}
|
|
3879
|
-
const availableWidthIncBtns = this.offsetWidth - BTN_SIZE[this.size] * 2;
|
|
3880
|
-
const maxVisibleSegments = Math.floor(
|
|
3881
|
-
availableWidthIncBtns / this.segMinWidth
|
|
3882
|
-
);
|
|
3883
|
-
const segmentWidth = (availableWidth - getSegmentGap(this._isUsingTransitionalStyles) * (maxVisibleSegments - 1)) / maxVisibleSegments;
|
|
3884
|
-
return {
|
|
3885
|
-
count: maxVisibleSegments,
|
|
3886
|
-
segmentWidth
|
|
3887
|
-
};
|
|
3888
|
-
};
|
|
3889
|
-
const { count } = calcNumVisibleSegments();
|
|
3890
|
-
if (followFocus) {
|
|
3891
|
-
if (__privateGet(this, _focusedIndex) >= __privateGet(this, _firstVisibleIndex) + count) {
|
|
3892
|
-
__privateSet(this, _firstVisibleIndex, __privateGet(this, _focusedIndex) - count + 1);
|
|
3893
|
-
}
|
|
3894
|
-
if (__privateGet(this, _focusedIndex) < __privateGet(this, _firstVisibleIndex)) {
|
|
3895
|
-
__privateSet(this, _firstVisibleIndex, __privateGet(this, _focusedIndex));
|
|
3896
|
-
}
|
|
3897
|
-
}
|
|
3898
|
-
const endFirstIndex = this.segments.length - count;
|
|
3899
|
-
const hasReachedEnd = __privateGet(this, _firstVisibleIndex) >= endFirstIndex;
|
|
3900
|
-
const isAtStart = __privateGet(this, _firstVisibleIndex) <= 0;
|
|
3901
|
-
if (hasReachedEnd) {
|
|
3902
|
-
__privateSet(this, _firstVisibleIndex, endFirstIndex);
|
|
3903
|
-
}
|
|
3904
|
-
if (isAtStart) {
|
|
3905
|
-
__privateSet(this, _firstVisibleIndex, 0);
|
|
3906
|
-
}
|
|
3907
|
-
__privateGet(this, _updateScrollBtnState).call(this, count);
|
|
3908
|
-
this.updateComplete.then(() => {
|
|
3909
|
-
const { segmentWidth, count: count2 } = calcNumVisibleSegments();
|
|
3910
|
-
this.segments.forEach((segment) => {
|
|
3911
|
-
segment.style.width = segmentWidth + "px";
|
|
3912
|
-
});
|
|
3913
|
-
__privateSet(this, _segmentsContainerLeft, -__privateGet(this, _firstVisibleIndex) * segmentWidth - getSegmentGap(this._isUsingTransitionalStyles) * __privateGet(this, _firstVisibleIndex));
|
|
3914
|
-
__privateGet(this, _applySegmentsTransform).call(this);
|
|
3915
|
-
__privateSet(this, _calculatedSegmentWidth, segmentWidth);
|
|
3916
|
-
__privateSet(this, _segmentWidth, segmentWidth);
|
|
3917
|
-
__privateGet(this, _updateIndicator).call(this);
|
|
3918
|
-
});
|
|
3919
|
-
});
|
|
3920
|
-
__privateAdd(this, _applySegmentsTransform, () => {
|
|
3921
|
-
window.requestAnimationFrame(() => {
|
|
3922
|
-
this._elSegments.style.transform = `translateX(${__privateGet(this, _segmentsContainerLeft)}px)`;
|
|
3923
|
-
});
|
|
3924
|
-
});
|
|
3925
|
-
__privateAdd(this, _scrollLeft, () => {
|
|
3926
|
-
__privateWrapper(this, _firstVisibleIndex)._--;
|
|
3927
|
-
__privateGet(this, _calcLayout).call(this);
|
|
3928
|
-
});
|
|
3929
|
-
__privateAdd(this, _scrollRight, () => {
|
|
3930
|
-
__privateWrapper(this, _firstVisibleIndex)._++;
|
|
3931
|
-
__privateGet(this, _calcLayout).call(this);
|
|
3932
|
-
});
|
|
3933
|
-
// Updates the visibility of the scroll buttons
|
|
3934
|
-
__privateAdd(this, _updateScrollBtnState, (numVisibleSegments) => {
|
|
3935
|
-
this._showPrevButton = __privateGet(this, _firstVisibleIndex) > 0;
|
|
3936
|
-
this._showNextButton = __privateGet(this, _firstVisibleIndex) < this.segments.length - numVisibleSegments;
|
|
3937
|
-
});
|
|
3938
|
-
// Updates the selection indicator position
|
|
3939
|
-
__privateAdd(this, _updateIndicator, () => {
|
|
3940
|
-
const segment = this.segments.find((s) => s.selected);
|
|
3941
|
-
if (segment) {
|
|
3942
|
-
const selectedSegmentIndex = this.segments.indexOf(segment);
|
|
3943
|
-
const offset2 = selectedSegmentIndex * __privateGet(this, _segmentWidth) + getSegmentGap(this._isUsingTransitionalStyles) * selectedSegmentIndex;
|
|
3944
|
-
this._elIndicator.style.transform = `translateX(${offset2}px)`;
|
|
3945
|
-
this._elIndicator.style.width = `${__privateGet(this, _segmentWidth)}px`;
|
|
3946
|
-
} else {
|
|
3947
|
-
this._elIndicator.style.transform = `translateX(-100%)`;
|
|
3948
|
-
this._elIndicator.style.width = `0px`;
|
|
3949
|
-
}
|
|
3950
|
-
});
|
|
3951
|
-
__privateAdd(this, _handleSegmentClick, (event) => {
|
|
3952
|
-
const selectedSegment = this.segments.find(
|
|
3953
|
-
(s) => s === event.target || s.contains(event.target)
|
|
3954
|
-
);
|
|
3955
|
-
if (selectedSegment) {
|
|
3956
|
-
this.segments.forEach((s) => s.selected = false);
|
|
3957
|
-
selectedSegment.selected = true;
|
|
3958
|
-
__privateSet(this, _value, selectedSegment.value);
|
|
3959
|
-
__privateGet(this, _updateIndicator).call(this);
|
|
3960
|
-
this.dispatchEvent(
|
|
3961
|
-
new CustomEvent("change", {
|
|
3962
|
-
detail: { segment: selectedSegment },
|
|
3963
|
-
bubbles: true,
|
|
3964
|
-
composed: true
|
|
3965
|
-
})
|
|
3966
|
-
);
|
|
3967
|
-
}
|
|
3968
|
-
});
|
|
3969
|
-
__privateAdd(this, _updateSelectedFromValue, () => {
|
|
3970
|
-
if (!__privateGet(this, _value))
|
|
3971
|
-
return;
|
|
3972
|
-
this.updateComplete.then(() => {
|
|
3973
|
-
const selectedSegment = this.segments.find((s) => s.value === __privateGet(this, _value));
|
|
3974
|
-
if (selectedSegment) {
|
|
3975
|
-
this.segments.forEach((s) => s.selected = false);
|
|
3976
|
-
selectedSegment.selected = true;
|
|
3977
|
-
__privateSet(this, _focusedIndex, this.segments.indexOf(selectedSegment));
|
|
3978
|
-
__privateGet(this, _calcLayout).call(this, true);
|
|
3979
|
-
}
|
|
3980
|
-
});
|
|
3981
|
-
});
|
|
3982
|
-
}
|
|
3983
|
-
get value() {
|
|
3984
|
-
return __privateGet(this, _value);
|
|
3985
|
-
}
|
|
3986
|
-
set value(val) {
|
|
3987
|
-
__privateSet(this, _value, val);
|
|
3988
|
-
__privateGet(this, _updateSelectedFromValue).call(this);
|
|
3989
|
-
}
|
|
3990
|
-
/**
|
|
3991
|
-
* Returns the segments in the control
|
|
3992
|
-
* @readonly
|
|
3993
|
-
*/
|
|
3994
|
-
get segments() {
|
|
3995
|
-
return this._elSlot ? this._elSlot.assignedElements() : [];
|
|
3996
|
-
}
|
|
3997
|
-
connectedCallback() {
|
|
3998
|
-
super.connectedCallback();
|
|
3999
|
-
TransitionalStyles.instance.apply(this, "gds-segmented-control");
|
|
4000
|
-
__privateGet(this, _resizeObserver).observe(this);
|
|
4001
|
-
this.addEventListener("focusin", (e) => {
|
|
4002
|
-
if (e.target instanceof GdsSegment) {
|
|
4003
|
-
__privateSet(this, _focusedIndex, this.segments.indexOf(e.target));
|
|
4004
|
-
__privateGet(this, _calcLayout).call(this, true);
|
|
4005
|
-
}
|
|
4006
|
-
});
|
|
4007
|
-
}
|
|
4008
|
-
disconnectedCallback() {
|
|
4009
|
-
super.disconnectedCallback();
|
|
4010
|
-
__privateGet(this, _resizeObserver).unobserve(this);
|
|
4011
|
-
}
|
|
4012
|
-
render() {
|
|
4013
|
-
return html`${this._tStyles}
|
|
4014
|
-
${when6(
|
|
4015
|
-
this._showPrevButton,
|
|
4016
|
-
() => html`<button
|
|
4017
|
-
id="btn-prev"
|
|
4018
|
-
@click=${__privateGet(this, _scrollLeft)}
|
|
4019
|
-
aria-label=${msg6("Scroll right")}
|
|
4020
|
-
>
|
|
4021
|
-
<gds-icon name="chevron-left"></gds-icon>
|
|
4022
|
-
</button>`
|
|
4023
|
-
)}
|
|
4024
|
-
<div
|
|
4025
|
-
id="track"
|
|
4026
|
-
@scroll=${() => {
|
|
4027
|
-
this._elTrack.scrollLeft = 0;
|
|
4028
|
-
}}
|
|
4029
|
-
>
|
|
4030
|
-
<div
|
|
4031
|
-
id="segments"
|
|
4032
|
-
@pointerdown=${__privateGet(this, _startDrag)}
|
|
4033
|
-
@pointermove=${__privateGet(this, _drag)}
|
|
4034
|
-
@touchmove=${__privateGet(this, _drag)}
|
|
4035
|
-
@pointerup=${__privateGet(this, _endDrag)}
|
|
4036
|
-
@pointercancel=${__privateGet(this, _endDrag)}
|
|
4037
|
-
role="list"
|
|
4038
|
-
>
|
|
4039
|
-
<slot
|
|
4040
|
-
gds-allow="gds-segment"
|
|
4041
|
-
@click=${__privateGet(this, _handleSegmentClick)}
|
|
4042
|
-
@slotchange=${__privateMethod(this, _handleSlotChange, handleSlotChange_fn)}
|
|
4043
|
-
role="none"
|
|
4044
|
-
></slot>
|
|
4045
|
-
<div id="indicator" role="none"></div>
|
|
4046
|
-
</div>
|
|
4047
|
-
</div>
|
|
4048
|
-
${when6(
|
|
4049
|
-
this._showNextButton,
|
|
4050
|
-
() => html`<button
|
|
4051
|
-
id="btn-next"
|
|
4052
|
-
@click=${__privateGet(this, _scrollRight)}
|
|
4053
|
-
aria-label=${msg6("Scroll right")}
|
|
4054
|
-
>
|
|
4055
|
-
<gds-icon name="chevron-right"></gds-icon>
|
|
4056
|
-
</button>`
|
|
4057
|
-
)}`;
|
|
4058
|
-
}
|
|
4059
|
-
_recalculateMinWidth() {
|
|
4060
|
-
this.updateComplete.then(() => __privateGet(this, _calcLayout).call(this));
|
|
4061
|
-
}
|
|
4062
|
-
};
|
|
4063
|
-
_value = new WeakMap();
|
|
4064
|
-
_tid = new WeakMap();
|
|
4065
|
-
_resizeObserver = new WeakMap();
|
|
4066
|
-
_firstVisibleIndex = new WeakMap();
|
|
4067
|
-
_calculatedSegmentWidth = new WeakMap();
|
|
4068
|
-
_segmentWidth = new WeakMap();
|
|
4069
|
-
_segmentsContainerLeft = new WeakMap();
|
|
4070
|
-
_focusedIndex = new WeakMap();
|
|
4071
|
-
_dragStartX = new WeakMap();
|
|
4072
|
-
_dragStartLeft = new WeakMap();
|
|
4073
|
-
_isDragging = new WeakMap();
|
|
4074
|
-
_startDrag = new WeakMap();
|
|
4075
|
-
_drag = new WeakMap();
|
|
4076
|
-
_endDrag = new WeakMap();
|
|
4077
|
-
_calcVisibleAfterDrag = new WeakMap();
|
|
4078
|
-
_calcLayout = new WeakMap();
|
|
4079
|
-
_applySegmentsTransform = new WeakMap();
|
|
4080
|
-
_handleSlotChange = new WeakSet();
|
|
4081
|
-
handleSlotChange_fn = function() {
|
|
4082
|
-
const selSegmentValue = this.segments.find((s) => s.selected)?.value;
|
|
4083
|
-
if (selSegmentValue) {
|
|
4084
|
-
__privateSet(this, _value, selSegmentValue);
|
|
4085
|
-
}
|
|
4086
|
-
__privateGet(this, _calcLayout).call(this);
|
|
4087
|
-
};
|
|
4088
|
-
_scrollLeft = new WeakMap();
|
|
4089
|
-
_scrollRight = new WeakMap();
|
|
4090
|
-
_updateScrollBtnState = new WeakMap();
|
|
4091
|
-
_updateIndicator = new WeakMap();
|
|
4092
|
-
_handleSegmentClick = new WeakMap();
|
|
4093
|
-
_updateSelectedFromValue = new WeakMap();
|
|
4094
|
-
GdsSegmentedControl.styles = [tokens, unsafeCSS5(segmented_control_style_default)];
|
|
4095
|
-
__decorateClass([
|
|
4096
|
-
property13({ type: Number, attribute: "seg-min-width" })
|
|
4097
|
-
], GdsSegmentedControl.prototype, "segMinWidth", 2);
|
|
4098
|
-
__decorateClass([
|
|
4099
|
-
property13()
|
|
4100
|
-
], GdsSegmentedControl.prototype, "size", 2);
|
|
4101
|
-
__decorateClass([
|
|
4102
|
-
property13()
|
|
4103
|
-
], GdsSegmentedControl.prototype, "value", 1);
|
|
4104
|
-
__decorateClass([
|
|
4105
|
-
state13()
|
|
4106
|
-
], GdsSegmentedControl.prototype, "_tStyles", 2);
|
|
4107
|
-
__decorateClass([
|
|
4108
|
-
query4("slot")
|
|
4109
|
-
], GdsSegmentedControl.prototype, "_elSlot", 2);
|
|
4110
|
-
__decorateClass([
|
|
4111
|
-
query4("#indicator")
|
|
4112
|
-
], GdsSegmentedControl.prototype, "_elIndicator", 2);
|
|
4113
|
-
__decorateClass([
|
|
4114
|
-
query4("#track")
|
|
4115
|
-
], GdsSegmentedControl.prototype, "_elTrack", 2);
|
|
4116
|
-
__decorateClass([
|
|
4117
|
-
query4("#segments")
|
|
4118
|
-
], GdsSegmentedControl.prototype, "_elSegments", 2);
|
|
4119
|
-
__decorateClass([
|
|
4120
|
-
state13()
|
|
4121
|
-
], GdsSegmentedControl.prototype, "_showPrevButton", 2);
|
|
4122
|
-
__decorateClass([
|
|
4123
|
-
state13()
|
|
4124
|
-
], GdsSegmentedControl.prototype, "_showNextButton", 2);
|
|
4125
|
-
__decorateClass([
|
|
4126
|
-
watch("segMinWidth")
|
|
4127
|
-
], GdsSegmentedControl.prototype, "_recalculateMinWidth", 1);
|
|
4128
|
-
GdsSegmentedControl = __decorateClass([
|
|
4129
|
-
gdsCustomElement("gds-segmented-control")
|
|
4130
|
-
], GdsSegmentedControl);
|
|
4131
|
-
|
|
4132
|
-
// libs/core/src/components/icon/icon.ts
|
|
4133
|
-
import { LitElement as LitElement7, unsafeCSS as unsafeCSS6 } from "lit";
|
|
4134
|
-
|
|
4135
|
-
// libs/core/src/components/icon/stem.styles.scss
|
|
4136
|
-
var stem_styles_default = `svg:not([display=none]) {
|
|
4137
|
-
contain: layout style;
|
|
4138
|
-
display: flex;
|
|
4139
|
-
height: 1lh;
|
|
4140
|
-
isolation: isolate;
|
|
4141
|
-
overflow: hidden;
|
|
4142
|
-
width: auto;
|
|
4143
|
-
}
|
|
4144
|
-
|
|
4145
|
-
symbol {
|
|
4146
|
-
fill: none;
|
|
4147
|
-
height: 24px;
|
|
4148
|
-
stroke: currentColor;
|
|
4149
|
-
stroke-linecap: round;
|
|
4150
|
-
stroke-linejoin: round;
|
|
4151
|
-
stroke-width: 2px;
|
|
4152
|
-
width: 24px;
|
|
4153
|
-
}`;
|
|
4154
|
-
|
|
4155
|
-
// libs/core/src/components/icon/icon.ts
|
|
4156
|
-
var GdsIcon = class extends LitElement7 {
|
|
4157
|
-
constructor() {
|
|
4158
|
-
super(...arguments);
|
|
4159
|
-
this.open = false;
|
|
4160
|
-
this.name = "";
|
|
4161
|
-
}
|
|
4162
|
-
static get styles() {
|
|
4163
|
-
return unsafeCSS6(stem_styles_default);
|
|
4164
|
-
}
|
|
4165
|
-
render() {
|
|
4166
|
-
const { name } = this;
|
|
4167
|
-
return html`
|
|
4168
|
-
<svg display="none">
|
|
4169
|
-
<symbol id="plus">
|
|
4170
|
-
<line x1="12" y1="5" x2="12" y2="19" />
|
|
4171
|
-
<line x1="5" y1="12" x2="19" y2="12" />
|
|
4172
|
-
</symbol>
|
|
4173
|
-
<symbol id="x">
|
|
4174
|
-
<line x1="18" y1="6" x2="6" y2="18" />
|
|
4175
|
-
<line x1="6" y1="6" x2="18" y2="18" />
|
|
4176
|
-
</symbol>
|
|
4177
|
-
<symbol id="chevron-right">
|
|
4178
|
-
<polyline points="9 18 15 12 9 6" />
|
|
4179
|
-
</symbol>
|
|
4180
|
-
<symbol id="chevron-left">
|
|
4181
|
-
<polyline points="15 18 9 12 15 6" />
|
|
4182
|
-
</symbol>
|
|
4183
|
-
<symbol id="chevron-down">
|
|
4184
|
-
<polyline points="6 9 12 15 18 9" />
|
|
4185
|
-
</symbol>
|
|
4186
|
-
<symbol id="arrow">
|
|
4187
|
-
<line x1="5" y1="12" x2="19" y2="12" />
|
|
4188
|
-
<polyline points="12 5 19 12 12 19" />
|
|
4189
|
-
</symbol>
|
|
4190
|
-
<symbol id="bell">
|
|
4191
|
-
<path d="M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9" />
|
|
4192
|
-
<path d="M13.73 21a2 2 0 0 1-3.46 0" />
|
|
4193
|
-
</symbol>
|
|
4194
|
-
<symbol id="calendar">
|
|
4195
|
-
<rect x="3" y="4" width="18" height="18" rx="2" ry="2" />
|
|
4196
|
-
<line x1="16" y1="2" x2="16" y2="6" />
|
|
4197
|
-
<line x1="8" y1="2" x2="8" y2="6" />
|
|
4198
|
-
<line x1="3" y1="10" x2="21" y2="10" />
|
|
4199
|
-
</symbol>
|
|
4200
|
-
<symbol id="lock">
|
|
4201
|
-
<rect x="3" y="11" width="18" height="11" rx="2" ry="2" />
|
|
4202
|
-
<path d="M7 11V7a5 5 0 0 1 10 0v4" />
|
|
4203
|
-
</symbol>
|
|
4204
|
-
<symbol id="eye">
|
|
4205
|
-
<path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" />
|
|
4206
|
-
<circle cx="12" cy="12" r="3" />
|
|
4207
|
-
</symbol>
|
|
4208
|
-
<symbol id="hash">
|
|
4209
|
-
<line x1="4" y1="9" x2="20" y2="9" />
|
|
4210
|
-
<line x1="4" y1="15" x2="20" y2="15" />
|
|
4211
|
-
<line x1="10" y1="3" x2="8" y2="21" />
|
|
4212
|
-
<line x1="16" y1="3" x2="14" y2="21" />
|
|
4213
|
-
</symbol>
|
|
4214
|
-
<symbol id="mail">
|
|
4215
|
-
<path
|
|
4216
|
-
d="M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"
|
|
4217
|
-
/>
|
|
4218
|
-
<polyline points="22,6 12,13 2,6" />
|
|
4219
|
-
</symbol>
|
|
4220
|
-
<symbol id="send">
|
|
4221
|
-
<line x1="22" y1="2" x2="11" y2="13" />
|
|
4222
|
-
<polygon points="22 2 15 22 11 13 2 9 22 2" />
|
|
4223
|
-
</symbol>
|
|
4224
|
-
<symbol id="info">
|
|
4225
|
-
<circle cx="12" cy="12" r="10" />
|
|
4226
|
-
<line x1="12" y1="16" x2="12" y2="12" />
|
|
4227
|
-
<line x1="12" y1="8" x2="12.01" y2="8" />
|
|
4228
|
-
</symbol>
|
|
4229
|
-
<symbol id="tel">
|
|
4230
|
-
<path
|
|
4231
|
-
d="M15.05 5A5 5 0 0 1 19 8.95M15.05 1A9 9 0 0 1 23 8.94m-1 7.98v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"
|
|
4232
|
-
/>
|
|
4233
|
-
</symbol>
|
|
4234
|
-
<symbol id="search">
|
|
4235
|
-
<circle cx="11" cy="11" r="8" />
|
|
4236
|
-
<line x1="21" y1="21" x2="16.65" y2="16.65" />
|
|
4237
|
-
</symbol>
|
|
4238
|
-
<symbol id="user">
|
|
4239
|
-
<path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2" />
|
|
4240
|
-
<circle cx="12" cy="7" r="4" />
|
|
4241
|
-
</symbol>
|
|
4242
|
-
<symbol id="arrow-up">
|
|
4243
|
-
<line x1="12" y1="19" x2="12" y2="5" />
|
|
4244
|
-
<polyline points="5 12 12 5 19 12" />
|
|
4245
|
-
</symbol>
|
|
4246
|
-
<symbol id="arrow-down">
|
|
4247
|
-
<line x1="12" y1="5" x2="12" y2="19" />
|
|
4248
|
-
<polyline points="19 12 12 19 5 12" />
|
|
4249
|
-
</symbol>
|
|
4250
|
-
<symbol id="warning">
|
|
4251
|
-
<path
|
|
4252
|
-
d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"
|
|
4253
|
-
/>
|
|
4254
|
-
<line x1="12" y1="9" x2="12" y2="13" />
|
|
4255
|
-
<path x1="12" y1="17" x2="12.01" y2="17" />
|
|
4256
|
-
</symbol>
|
|
4257
|
-
</svg>
|
|
4258
|
-
<svg viewBox="0 0 24 24">
|
|
4259
|
-
<use href="#${name}"></use>
|
|
4260
|
-
</svg>
|
|
4261
|
-
`;
|
|
4262
|
-
}
|
|
4263
|
-
};
|
|
4264
|
-
GdsIcon.properties = {
|
|
4265
|
-
open: { type: String, reflect: true },
|
|
4266
|
-
name: { type: String }
|
|
4267
|
-
};
|
|
4268
|
-
GdsIcon = __decorateClass([
|
|
4269
|
-
gdsCustomElement("gds-icon")
|
|
4270
|
-
], GdsIcon);
|
|
4271
|
-
|
|
4272
|
-
// libs/core/src/components/theme/theme.ts
|
|
4273
|
-
import { property as property14 } from "lit/decorators.js";
|
|
4274
|
-
var GdsTheme = class extends GdsElement {
|
|
4275
|
-
constructor() {
|
|
4276
|
-
super(...arguments);
|
|
4277
|
-
this.colorScheme = "light";
|
|
4278
|
-
}
|
|
4279
|
-
connectedCallback() {
|
|
4280
|
-
super.connectedCallback();
|
|
4281
|
-
TransitionalStyles.instance.apply(this, "gds-theme");
|
|
4282
|
-
}
|
|
4283
|
-
render() {
|
|
4284
|
-
return html`
|
|
4285
|
-
<slot></slot>
|
|
4286
|
-
`;
|
|
4287
|
-
}
|
|
4288
|
-
};
|
|
4289
|
-
__decorateClass([
|
|
4290
|
-
property14({ reflect: true, attribute: "color-scheme" })
|
|
4291
|
-
], GdsTheme.prototype, "colorScheme", 2);
|
|
4292
|
-
GdsTheme = __decorateClass([
|
|
4293
|
-
gdsCustomElement("gds-theme")
|
|
4294
|
-
], GdsTheme);
|
|
11
|
+
GdsGroupedList
|
|
12
|
+
} from "./chunks/chunk.D7H7CUS4.js";
|
|
13
|
+
import "./chunks/chunk.IYCENQZG.js";
|
|
14
|
+
import {
|
|
15
|
+
GdsIcon
|
|
16
|
+
} from "./chunks/chunk.2Y3BHFKO.js";
|
|
17
|
+
import {
|
|
18
|
+
GdsDatepicker
|
|
19
|
+
} from "./chunks/chunk.ZTE73BY2.js";
|
|
20
|
+
import "./chunks/chunk.TMBQL2RO.js";
|
|
21
|
+
import "./chunks/chunk.KC32OWZE.js";
|
|
22
|
+
import "./chunks/chunk.375BWME4.js";
|
|
23
|
+
import "./chunks/chunk.Q2T57HE7.js";
|
|
24
|
+
import {
|
|
25
|
+
GdsDropdown
|
|
26
|
+
} from "./chunks/chunk.2OOTOCUG.js";
|
|
27
|
+
import "./chunks/chunk.MI4A2C2A.js";
|
|
28
|
+
import "./chunks/chunk.MAD5DQMN.js";
|
|
29
|
+
import {
|
|
30
|
+
GdsOption
|
|
31
|
+
} from "./chunks/chunk.XHTJVQUJ.js";
|
|
32
|
+
import {
|
|
33
|
+
GdsGrid
|
|
34
|
+
} from "./chunks/chunk.274BU2AI.js";
|
|
35
|
+
import "./chunks/chunk.J2A6J77W.js";
|
|
36
|
+
import {
|
|
37
|
+
GdsButton
|
|
38
|
+
} from "./chunks/chunk.NOYHINYP.js";
|
|
39
|
+
import "./chunks/chunk.TX64TTBN.js";
|
|
40
|
+
import "./chunks/chunk.KV4SDMFS.js";
|
|
41
|
+
import "./chunks/chunk.YIQIH4RW.js";
|
|
42
|
+
import "./chunks/chunk.7P5N6NZL.js";
|
|
43
|
+
import {
|
|
44
|
+
GdsMenuHeading
|
|
45
|
+
} from "./chunks/chunk.YJHAKLGR.js";
|
|
46
|
+
import {
|
|
47
|
+
GdsContextMenu
|
|
48
|
+
} from "./chunks/chunk.6UA66KQU.js";
|
|
49
|
+
import "./chunks/chunk.UF6IEONX.js";
|
|
50
|
+
import "./chunks/chunk.LUHCF4BJ.js";
|
|
51
|
+
import {
|
|
52
|
+
GdsMenuItem
|
|
53
|
+
} from "./chunks/chunk.VYK7D6QO.js";
|
|
54
|
+
import "./chunks/chunk.XU4HZLJL.js";
|
|
55
|
+
import "./chunks/chunk.WDZ2JTCP.js";
|
|
56
|
+
import "./chunks/chunk.DFYMYEGD.js";
|
|
57
|
+
import "./chunks/chunk.2ND5EWHE.js";
|
|
58
|
+
import "./chunks/chunk.QONSFT2N.js";
|
|
59
|
+
import "./chunks/chunk.WM7HBMMV.js";
|
|
60
|
+
import "./chunks/chunk.2LQSDOD4.js";
|
|
61
|
+
import "./chunks/chunk.7TCXY7BP.js";
|
|
62
|
+
import "./chunks/chunk.6NM7ENKA.js";
|
|
63
|
+
import "./chunks/chunk.WJDR7FTS.js";
|
|
64
|
+
import "./chunks/chunk.YO24ZYAD.js";
|
|
65
|
+
import "./chunks/chunk.2WO4NHJ2.js";
|
|
66
|
+
import {
|
|
67
|
+
VER_SUFFIX,
|
|
68
|
+
gdsCustomElement,
|
|
69
|
+
getScopedTagName,
|
|
70
|
+
getUnscopedTagName,
|
|
71
|
+
html,
|
|
72
|
+
htmlTemplateTagFactory
|
|
73
|
+
} from "./chunks/chunk.VOYMQ322.js";
|
|
74
|
+
import "./chunks/chunk.5VURDMKE.js";
|
|
4295
75
|
export {
|
|
76
|
+
GdsButton,
|
|
4296
77
|
GdsContextMenu,
|
|
4297
78
|
GdsDatepicker,
|
|
4298
79
|
GdsDropdown,
|