@sebgroup/green-core 1.15.0 → 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 -4278
- package/localization.js +40 -44
- 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
|
@@ -0,0 +1,420 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GdsFormControlElement
|
|
3
|
+
} from "./chunk.YIQIH4RW.js";
|
|
4
|
+
import {
|
|
5
|
+
TransitionalStyles
|
|
6
|
+
} from "./chunk.QONSFT2N.js";
|
|
7
|
+
import {
|
|
8
|
+
observeLightDOM
|
|
9
|
+
} from "./chunk.WM7HBMMV.js";
|
|
10
|
+
import {
|
|
11
|
+
constrainSlots
|
|
12
|
+
} from "./chunk.6NM7ENKA.js";
|
|
13
|
+
import {
|
|
14
|
+
watch
|
|
15
|
+
} from "./chunk.2WO4NHJ2.js";
|
|
16
|
+
import {
|
|
17
|
+
gdsCustomElement,
|
|
18
|
+
getScopedTagName,
|
|
19
|
+
html
|
|
20
|
+
} from "./chunk.VOYMQ322.js";
|
|
21
|
+
import {
|
|
22
|
+
__decorateClass,
|
|
23
|
+
__privateAdd,
|
|
24
|
+
__privateGet,
|
|
25
|
+
__privateMethod,
|
|
26
|
+
__privateSet
|
|
27
|
+
} from "./chunk.5VURDMKE.js";
|
|
28
|
+
|
|
29
|
+
// libs/core/src/components/dropdown/dropdown.ts
|
|
30
|
+
import { property, query, queryAsync, state } from "lit/decorators.js";
|
|
31
|
+
import { unsafeHTML } from "lit/directives/unsafe-html.js";
|
|
32
|
+
import { when } from "lit/directives/when.js";
|
|
33
|
+
import { ifDefined } from "lit/directives/if-defined.js";
|
|
34
|
+
import { classMap } from "lit/directives/class-map.js";
|
|
35
|
+
import { msg, str, updateWhenLocaleChanges } from "@lit/localize";
|
|
36
|
+
import "reflect-metadata";
|
|
37
|
+
|
|
38
|
+
// libs/core/src/components/dropdown/dropdown.styles.ts
|
|
39
|
+
import { css } from "lit";
|
|
40
|
+
var style = css`
|
|
41
|
+
@layer base, reset, transitional-styles;
|
|
42
|
+
|
|
43
|
+
@layer base {
|
|
44
|
+
button {
|
|
45
|
+
appearance: none;
|
|
46
|
+
display: block;
|
|
47
|
+
background-color: black;
|
|
48
|
+
border-radius: 2rem;
|
|
49
|
+
border: none;
|
|
50
|
+
color: white;
|
|
51
|
+
padding: 0.7rem 2rem;
|
|
52
|
+
margin: 0.5rem 0;
|
|
53
|
+
box-sizing: border-box;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
`;
|
|
57
|
+
var dropdown_styles_default = style;
|
|
58
|
+
|
|
59
|
+
// libs/core/src/components/dropdown/dropdown.ts
|
|
60
|
+
var _optionElements, _handleSearchFieldKeyUp, _handleSearchFieldKeyDown, _handleListboxKeyDown, _handleOptionFocusChange, _handleSelectionChange, handleSelectionChange_fn, _registerAutoCloseListener, registerAutoCloseListener_fn, _unregisterAutoCloseListener, unregisterAutoCloseListener_fn, _blurCloseListener, _tabCloseListener;
|
|
61
|
+
var GdsDropdown = class extends GdsFormControlElement {
|
|
62
|
+
constructor() {
|
|
63
|
+
super();
|
|
64
|
+
/**
|
|
65
|
+
* Selects an option in the dropdown.
|
|
66
|
+
*
|
|
67
|
+
* @fires change
|
|
68
|
+
*/
|
|
69
|
+
__privateAdd(this, _handleSelectionChange);
|
|
70
|
+
__privateAdd(this, _registerAutoCloseListener);
|
|
71
|
+
__privateAdd(this, _unregisterAutoCloseListener);
|
|
72
|
+
this.label = "";
|
|
73
|
+
this.open = false;
|
|
74
|
+
this.searchable = false;
|
|
75
|
+
this.multiple = false;
|
|
76
|
+
this.compareWith = (a, b) => a === b;
|
|
77
|
+
this.searchFilter = (q, o) => o.innerHTML.toLowerCase().includes(q.toLowerCase());
|
|
78
|
+
this.syncPopoverWidth = false;
|
|
79
|
+
this.maxHeight = 500;
|
|
80
|
+
this.size = "medium";
|
|
81
|
+
this.hideLabel = false;
|
|
82
|
+
__privateAdd(this, _optionElements, void 0);
|
|
83
|
+
/**
|
|
84
|
+
* Event handler for filtering the options in the dropdown.
|
|
85
|
+
*
|
|
86
|
+
* @param e The keyboard event.
|
|
87
|
+
*/
|
|
88
|
+
__privateAdd(this, _handleSearchFieldKeyUp, (e) => {
|
|
89
|
+
const input = this._elSearchInput;
|
|
90
|
+
const options = Array.from(__privateGet(this, _optionElements));
|
|
91
|
+
options.forEach((o) => o.hidden = false);
|
|
92
|
+
if (!input.value)
|
|
93
|
+
return;
|
|
94
|
+
const filteredOptions = options.filter(
|
|
95
|
+
(o) => !this.searchFilter(input.value, o)
|
|
96
|
+
);
|
|
97
|
+
filteredOptions.forEach((o) => o.hidden = true);
|
|
98
|
+
});
|
|
99
|
+
/**
|
|
100
|
+
* Check for ArrowDown or Tab in the search field.
|
|
101
|
+
* If found, focus should be moved to the listbox.
|
|
102
|
+
*/
|
|
103
|
+
__privateAdd(this, _handleSearchFieldKeyDown, (e) => {
|
|
104
|
+
var _a;
|
|
105
|
+
(_a = this._elListbox) == null ? void 0 : _a.then((listbox) => {
|
|
106
|
+
if (e.key === "ArrowDown" || e.key === "Tab") {
|
|
107
|
+
e.preventDefault();
|
|
108
|
+
listbox.focus();
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
/**
|
|
114
|
+
* Check for Tab in the listbox.
|
|
115
|
+
* If found, focus should be moved to the search field.
|
|
116
|
+
*/
|
|
117
|
+
__privateAdd(this, _handleListboxKeyDown, (e) => {
|
|
118
|
+
var _a;
|
|
119
|
+
if (e.key === "Tab" && this.searchable) {
|
|
120
|
+
e.preventDefault();
|
|
121
|
+
(_a = this._elSearchInput) == null ? void 0 : _a.focus();
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
__privateAdd(this, _handleOptionFocusChange, (e) => {
|
|
126
|
+
const triggerButton = this._elTriggerBtn;
|
|
127
|
+
if (triggerButton)
|
|
128
|
+
triggerButton.ariaActiveDescendantElement = e.target;
|
|
129
|
+
});
|
|
130
|
+
/**
|
|
131
|
+
* A listener to close the dropdown when any other element is focused.
|
|
132
|
+
*/
|
|
133
|
+
__privateAdd(this, _blurCloseListener, (e) => {
|
|
134
|
+
const isFocusOutside = e instanceof FocusEvent && e.relatedTarget && !this.contains(e.relatedTarget);
|
|
135
|
+
if (isFocusOutside)
|
|
136
|
+
this.open = false;
|
|
137
|
+
});
|
|
138
|
+
__privateAdd(this, _tabCloseListener, (e) => {
|
|
139
|
+
var _a;
|
|
140
|
+
if (e.key === "Tab" && !this.searchable) {
|
|
141
|
+
e.preventDefault();
|
|
142
|
+
this.open = false;
|
|
143
|
+
(_a = this._elTriggerBtn) == null ? void 0 : _a.focus();
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
constrainSlots(this);
|
|
147
|
+
updateWhenLocaleChanges(this);
|
|
148
|
+
__privateSet(this, _optionElements, this.getElementsByTagName(
|
|
149
|
+
getScopedTagName("gds-option")
|
|
150
|
+
));
|
|
151
|
+
}
|
|
152
|
+
get type() {
|
|
153
|
+
return "gds-dropdown";
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Get the options of the dropdown.
|
|
157
|
+
*/
|
|
158
|
+
get options() {
|
|
159
|
+
return Array.from(__privateGet(this, _optionElements)).filter(
|
|
160
|
+
(o) => !o.hasAttribute("isplaceholder")
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Return the first option with a isPlaceholder attribute.
|
|
165
|
+
* If no placeholder is found, this will be undefined.
|
|
166
|
+
*/
|
|
167
|
+
get placeholder() {
|
|
168
|
+
return Array.from(__privateGet(this, _optionElements)).find(
|
|
169
|
+
(o) => o.hasAttribute("isplaceholder")
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Returns the display value as a string.
|
|
174
|
+
* If the dropdown is in multiple mode, this will be a comma separated list of the selected values.
|
|
175
|
+
*/
|
|
176
|
+
get displayValue() {
|
|
177
|
+
var _a, _b;
|
|
178
|
+
let displayValue;
|
|
179
|
+
if (Array.isArray(this.value)) {
|
|
180
|
+
this.value.length > 2 ? displayValue = msg(str`${this.value.length} selected`) : displayValue = this.value.reduce(
|
|
181
|
+
(acc, cur) => {
|
|
182
|
+
var _a2;
|
|
183
|
+
return acc + ((_a2 = this.options.find((v) => v.value === cur)) == null ? void 0 : _a2.innerHTML) + ", ";
|
|
184
|
+
},
|
|
185
|
+
""
|
|
186
|
+
).slice(0, -2);
|
|
187
|
+
} else {
|
|
188
|
+
displayValue = (_a = this.options.find((v) => v.selected)) == null ? void 0 : _a.innerHTML;
|
|
189
|
+
}
|
|
190
|
+
return displayValue || ((_b = this.placeholder) == null ? void 0 : _b.innerHTML) || "";
|
|
191
|
+
}
|
|
192
|
+
connectedCallback() {
|
|
193
|
+
super.connectedCallback();
|
|
194
|
+
TransitionalStyles.instance.apply(this, "gds-dropdown");
|
|
195
|
+
this.updateComplete.then(() => {
|
|
196
|
+
this._handleLightDOMChange();
|
|
197
|
+
this._handleValueChange();
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
render() {
|
|
201
|
+
return html`
|
|
202
|
+
${this._tStyles}
|
|
203
|
+
${when(
|
|
204
|
+
this.label && !this.hideLabel,
|
|
205
|
+
() => html`<label for="trigger">${this.label}</label>`
|
|
206
|
+
)}
|
|
207
|
+
|
|
208
|
+
<span class="form-info"><slot name="sub-label"></slot></span>
|
|
209
|
+
|
|
210
|
+
<button
|
|
211
|
+
id="trigger"
|
|
212
|
+
@click="${() => this.open = !this.open}"
|
|
213
|
+
aria-haspopup="listbox"
|
|
214
|
+
role="combobox"
|
|
215
|
+
aria-owns="listbox"
|
|
216
|
+
aria-controls="listbox"
|
|
217
|
+
aria-expanded="${this.open}"
|
|
218
|
+
aria-label="${this.label}"
|
|
219
|
+
class=${classMap({ small: this.size === "small" })}
|
|
220
|
+
>
|
|
221
|
+
<slot name="trigger">
|
|
222
|
+
<span>${unsafeHTML(this.displayValue)}</span>
|
|
223
|
+
</slot>
|
|
224
|
+
</button>
|
|
225
|
+
|
|
226
|
+
<span class="form-info"><slot name="message"></slot></span>
|
|
227
|
+
|
|
228
|
+
<gds-popover
|
|
229
|
+
.label=${this.label}
|
|
230
|
+
.open=${this.open}
|
|
231
|
+
.triggerRef=${this._elTriggerBtnAsync}
|
|
232
|
+
.calcMaxWidth=${(trigger) => this.syncPopoverWidth ? `${trigger.offsetWidth}px` : `auto`}
|
|
233
|
+
.calcMaxHeight=${(_trigger) => `${this.maxHeight}px`}
|
|
234
|
+
@gds-ui-state=${(e) => this.open = e.detail.open}
|
|
235
|
+
>
|
|
236
|
+
${when(
|
|
237
|
+
this.searchable,
|
|
238
|
+
() => html`<input
|
|
239
|
+
id="searchinput"
|
|
240
|
+
type="text"
|
|
241
|
+
aria-label="${msg("Filter available options")}"
|
|
242
|
+
placeholder="${msg("Search")}"
|
|
243
|
+
@keydown=${__privateGet(this, _handleSearchFieldKeyDown)}
|
|
244
|
+
@keyup=${__privateGet(this, _handleSearchFieldKeyUp)}
|
|
245
|
+
/>`
|
|
246
|
+
)}
|
|
247
|
+
|
|
248
|
+
<gds-listbox
|
|
249
|
+
id="listbox"
|
|
250
|
+
.multiple="${ifDefined(this.multiple)}"
|
|
251
|
+
.compareWith="${this.compareWith}"
|
|
252
|
+
@change="${__privateMethod(this, _handleSelectionChange, handleSelectionChange_fn)}"
|
|
253
|
+
@gds-focus="${__privateGet(this, _handleOptionFocusChange)}"
|
|
254
|
+
@keydown=${__privateGet(this, _handleListboxKeyDown)}
|
|
255
|
+
>
|
|
256
|
+
<slot gds-allow="gds-option gds-menu-heading"></slot>
|
|
257
|
+
</gds-listbox>
|
|
258
|
+
</gds-popover>
|
|
259
|
+
`;
|
|
260
|
+
}
|
|
261
|
+
_handleLightDOMChange() {
|
|
262
|
+
var _a, _b;
|
|
263
|
+
this.requestUpdate();
|
|
264
|
+
if (this.multiple) {
|
|
265
|
+
this._handleValueChange();
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
if (this.value === void 0) {
|
|
269
|
+
if (this.placeholder)
|
|
270
|
+
this.value = this.placeholder.value;
|
|
271
|
+
else
|
|
272
|
+
this.value = (_a = this.options[0]) == null ? void 0 : _a.value;
|
|
273
|
+
} else if (!this.placeholder && this.options.find(
|
|
274
|
+
(o) => this.compareWith(o.value, this.value)
|
|
275
|
+
) === void 0) {
|
|
276
|
+
this.options[0] && (this.options[0].selected = true);
|
|
277
|
+
this.value = (_b = this.options[0]) == null ? void 0 : _b.value;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
_handleValueChange() {
|
|
281
|
+
this._elListbox.then((listbox) => {
|
|
282
|
+
if (listbox) {
|
|
283
|
+
if (Array.isArray(this.value))
|
|
284
|
+
listbox.selection = this.value;
|
|
285
|
+
else
|
|
286
|
+
listbox.selection = [this.value];
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
_onOpenChange() {
|
|
291
|
+
const open = this.open;
|
|
292
|
+
Array.from(__privateGet(this, _optionElements)).forEach((o) => o.hidden = !open);
|
|
293
|
+
if (open)
|
|
294
|
+
__privateMethod(this, _registerAutoCloseListener, registerAutoCloseListener_fn).call(this);
|
|
295
|
+
else {
|
|
296
|
+
__privateMethod(this, _unregisterAutoCloseListener, unregisterAutoCloseListener_fn).call(this);
|
|
297
|
+
this._elSearchInput && (this._elSearchInput.value = "");
|
|
298
|
+
}
|
|
299
|
+
this.dispatchEvent(
|
|
300
|
+
new CustomEvent("gds-ui-state", {
|
|
301
|
+
detail: { open },
|
|
302
|
+
bubbles: true,
|
|
303
|
+
composed: true
|
|
304
|
+
})
|
|
305
|
+
);
|
|
306
|
+
}
|
|
307
|
+
};
|
|
308
|
+
_optionElements = new WeakMap();
|
|
309
|
+
_handleSearchFieldKeyUp = new WeakMap();
|
|
310
|
+
_handleSearchFieldKeyDown = new WeakMap();
|
|
311
|
+
_handleListboxKeyDown = new WeakMap();
|
|
312
|
+
_handleOptionFocusChange = new WeakMap();
|
|
313
|
+
_handleSelectionChange = new WeakSet();
|
|
314
|
+
handleSelectionChange_fn = function() {
|
|
315
|
+
this._elListbox.then((listbox) => {
|
|
316
|
+
var _a;
|
|
317
|
+
if (this.multiple)
|
|
318
|
+
this.value = listbox.selection.map((s) => s.value);
|
|
319
|
+
else {
|
|
320
|
+
this.value = (_a = listbox.selection[0]) == null ? void 0 : _a.value;
|
|
321
|
+
this.open = false;
|
|
322
|
+
setTimeout(() => {
|
|
323
|
+
var _a2;
|
|
324
|
+
return (_a2 = this._elTriggerBtn) == null ? void 0 : _a2.focus();
|
|
325
|
+
}, 0);
|
|
326
|
+
}
|
|
327
|
+
this.dispatchEvent(
|
|
328
|
+
new CustomEvent("change", {
|
|
329
|
+
detail: { value: this.value },
|
|
330
|
+
bubbles: true,
|
|
331
|
+
composed: true
|
|
332
|
+
})
|
|
333
|
+
);
|
|
334
|
+
});
|
|
335
|
+
};
|
|
336
|
+
_registerAutoCloseListener = new WeakSet();
|
|
337
|
+
registerAutoCloseListener_fn = function() {
|
|
338
|
+
this.addEventListener("blur", __privateGet(this, _blurCloseListener));
|
|
339
|
+
this.addEventListener("gds-blur", __privateGet(this, _blurCloseListener));
|
|
340
|
+
this.addEventListener("keydown", __privateGet(this, _tabCloseListener));
|
|
341
|
+
};
|
|
342
|
+
_unregisterAutoCloseListener = new WeakSet();
|
|
343
|
+
unregisterAutoCloseListener_fn = function() {
|
|
344
|
+
this.removeEventListener("blur", __privateGet(this, _blurCloseListener));
|
|
345
|
+
this.removeEventListener("gds-blur", __privateGet(this, _blurCloseListener));
|
|
346
|
+
this.removeEventListener("keydown", __privateGet(this, _tabCloseListener));
|
|
347
|
+
};
|
|
348
|
+
_blurCloseListener = new WeakMap();
|
|
349
|
+
_tabCloseListener = new WeakMap();
|
|
350
|
+
GdsDropdown.styles = dropdown_styles_default;
|
|
351
|
+
GdsDropdown.shadowRootOptions = {
|
|
352
|
+
mode: "open",
|
|
353
|
+
delegatesFocus: true
|
|
354
|
+
};
|
|
355
|
+
__decorateClass([
|
|
356
|
+
property()
|
|
357
|
+
], GdsDropdown.prototype, "label", 2);
|
|
358
|
+
__decorateClass([
|
|
359
|
+
property({ type: Boolean, reflect: true })
|
|
360
|
+
], GdsDropdown.prototype, "open", 2);
|
|
361
|
+
__decorateClass([
|
|
362
|
+
property({ type: Boolean, reflect: true })
|
|
363
|
+
], GdsDropdown.prototype, "searchable", 2);
|
|
364
|
+
__decorateClass([
|
|
365
|
+
property({ type: Boolean, reflect: true })
|
|
366
|
+
], GdsDropdown.prototype, "multiple", 2);
|
|
367
|
+
__decorateClass([
|
|
368
|
+
property()
|
|
369
|
+
], GdsDropdown.prototype, "compareWith", 2);
|
|
370
|
+
__decorateClass([
|
|
371
|
+
property()
|
|
372
|
+
], GdsDropdown.prototype, "searchFilter", 2);
|
|
373
|
+
__decorateClass([
|
|
374
|
+
property({ type: Boolean, attribute: "sync-popover-width" })
|
|
375
|
+
], GdsDropdown.prototype, "syncPopoverWidth", 2);
|
|
376
|
+
__decorateClass([
|
|
377
|
+
property({ type: Number, attribute: "max-height" })
|
|
378
|
+
], GdsDropdown.prototype, "maxHeight", 2);
|
|
379
|
+
__decorateClass([
|
|
380
|
+
property()
|
|
381
|
+
], GdsDropdown.prototype, "size", 2);
|
|
382
|
+
__decorateClass([
|
|
383
|
+
property({ type: Boolean, attribute: "hide-label" })
|
|
384
|
+
], GdsDropdown.prototype, "hideLabel", 2);
|
|
385
|
+
__decorateClass([
|
|
386
|
+
state()
|
|
387
|
+
], GdsDropdown.prototype, "_tStyles", 2);
|
|
388
|
+
__decorateClass([
|
|
389
|
+
query("#trigger")
|
|
390
|
+
], GdsDropdown.prototype, "_elTriggerBtn", 2);
|
|
391
|
+
__decorateClass([
|
|
392
|
+
queryAsync("#trigger")
|
|
393
|
+
], GdsDropdown.prototype, "_elTriggerBtnAsync", 2);
|
|
394
|
+
__decorateClass([
|
|
395
|
+
queryAsync("#listbox")
|
|
396
|
+
], GdsDropdown.prototype, "_elListbox", 2);
|
|
397
|
+
__decorateClass([
|
|
398
|
+
query("#searchinput")
|
|
399
|
+
], GdsDropdown.prototype, "_elSearchInput", 2);
|
|
400
|
+
__decorateClass([
|
|
401
|
+
observeLightDOM({
|
|
402
|
+
attributes: true,
|
|
403
|
+
childList: true,
|
|
404
|
+
subtree: true,
|
|
405
|
+
characterData: true
|
|
406
|
+
})
|
|
407
|
+
], GdsDropdown.prototype, "_handleLightDOMChange", 1);
|
|
408
|
+
__decorateClass([
|
|
409
|
+
watch("value")
|
|
410
|
+
], GdsDropdown.prototype, "_handleValueChange", 1);
|
|
411
|
+
__decorateClass([
|
|
412
|
+
watch("open")
|
|
413
|
+
], GdsDropdown.prototype, "_onOpenChange", 1);
|
|
414
|
+
GdsDropdown = __decorateClass([
|
|
415
|
+
gdsCustomElement("gds-dropdown")
|
|
416
|
+
], GdsDropdown);
|
|
417
|
+
|
|
418
|
+
export {
|
|
419
|
+
GdsDropdown
|
|
420
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__spreadValues
|
|
3
|
+
} from "./chunk.5VURDMKE.js";
|
|
4
|
+
|
|
5
|
+
// libs/core/src/utils/decorators/watch.ts
|
|
6
|
+
function watch(propertyName, options) {
|
|
7
|
+
const resolvedOptions = __spreadValues({
|
|
8
|
+
waitUntilFirstUpdate: false
|
|
9
|
+
}, options);
|
|
10
|
+
return (proto, propertyKey, descriptor) => {
|
|
11
|
+
const { update } = proto;
|
|
12
|
+
const watchedProperties = Array.isArray(propertyName) ? propertyName : [propertyName];
|
|
13
|
+
proto.update = function(changedProps) {
|
|
14
|
+
watchedProperties.forEach((property) => {
|
|
15
|
+
var _a;
|
|
16
|
+
const key = property;
|
|
17
|
+
if (changedProps.has(key)) {
|
|
18
|
+
const oldValue = changedProps.get(key);
|
|
19
|
+
const newValue = this[key];
|
|
20
|
+
if (oldValue !== newValue) {
|
|
21
|
+
if (!resolvedOptions.waitUntilFirstUpdate || this.hasUpdated) {
|
|
22
|
+
(_a = descriptor.value) == null ? void 0 : _a.call(this, oldValue, newValue);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
update.call(this, changedProps);
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export {
|
|
33
|
+
watch
|
|
34
|
+
};
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GdsElement
|
|
3
|
+
} from "./chunk.2LQSDOD4.js";
|
|
4
|
+
import {
|
|
5
|
+
gdsCustomElement,
|
|
6
|
+
html
|
|
7
|
+
} from "./chunk.VOYMQ322.js";
|
|
8
|
+
import {
|
|
9
|
+
__decorateClass
|
|
10
|
+
} from "./chunk.5VURDMKE.js";
|
|
11
|
+
|
|
12
|
+
// libs/core/src/components/icon/icon.ts
|
|
13
|
+
import { unsafeCSS } from "lit";
|
|
14
|
+
|
|
15
|
+
// libs/core/src/components/icon/stem.styles.scss
|
|
16
|
+
var stem_styles_default = `svg:not([display=none]) {
|
|
17
|
+
contain: layout style;
|
|
18
|
+
display: flex;
|
|
19
|
+
height: 1lh;
|
|
20
|
+
isolation: isolate;
|
|
21
|
+
overflow: hidden;
|
|
22
|
+
width: auto;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
symbol {
|
|
26
|
+
fill: none;
|
|
27
|
+
height: 24px;
|
|
28
|
+
stroke: currentColor;
|
|
29
|
+
stroke-linecap: round;
|
|
30
|
+
stroke-linejoin: round;
|
|
31
|
+
stroke-width: 2px;
|
|
32
|
+
width: 24px;
|
|
33
|
+
}`;
|
|
34
|
+
|
|
35
|
+
// libs/core/src/components/icon/icon.ts
|
|
36
|
+
var GdsIcon = class extends GdsElement {
|
|
37
|
+
constructor() {
|
|
38
|
+
super(...arguments);
|
|
39
|
+
this.open = false;
|
|
40
|
+
this.name = "";
|
|
41
|
+
}
|
|
42
|
+
static get styles() {
|
|
43
|
+
return unsafeCSS(stem_styles_default);
|
|
44
|
+
}
|
|
45
|
+
render() {
|
|
46
|
+
const { name } = this;
|
|
47
|
+
return html`
|
|
48
|
+
<svg display="none">
|
|
49
|
+
<symbol id="plus">
|
|
50
|
+
<line x1="12" y1="5" x2="12" y2="19" />
|
|
51
|
+
<line x1="5" y1="12" x2="19" y2="12" />
|
|
52
|
+
</symbol>
|
|
53
|
+
<symbol id="x">
|
|
54
|
+
<line x1="18" y1="6" x2="6" y2="18" />
|
|
55
|
+
<line x1="6" y1="6" x2="18" y2="18" />
|
|
56
|
+
</symbol>
|
|
57
|
+
<symbol id="chevron-right">
|
|
58
|
+
<polyline points="9 18 15 12 9 6" />
|
|
59
|
+
</symbol>
|
|
60
|
+
<symbol id="chevron-left">
|
|
61
|
+
<polyline points="15 18 9 12 15 6" />
|
|
62
|
+
</symbol>
|
|
63
|
+
<symbol id="chevron-down">
|
|
64
|
+
<polyline points="6 9 12 15 18 9" />
|
|
65
|
+
</symbol>
|
|
66
|
+
<symbol id="arrow">
|
|
67
|
+
<line x1="5" y1="12" x2="19" y2="12" />
|
|
68
|
+
<polyline points="12 5 19 12 12 19" />
|
|
69
|
+
</symbol>
|
|
70
|
+
<symbol id="bell">
|
|
71
|
+
<path d="M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9" />
|
|
72
|
+
<path d="M13.73 21a2 2 0 0 1-3.46 0" />
|
|
73
|
+
</symbol>
|
|
74
|
+
<symbol id="calendar">
|
|
75
|
+
<rect x="3" y="4" width="18" height="18" rx="2" ry="2" />
|
|
76
|
+
<line x1="16" y1="2" x2="16" y2="6" />
|
|
77
|
+
<line x1="8" y1="2" x2="8" y2="6" />
|
|
78
|
+
<line x1="3" y1="10" x2="21" y2="10" />
|
|
79
|
+
</symbol>
|
|
80
|
+
<symbol id="lock">
|
|
81
|
+
<rect x="3" y="11" width="18" height="11" rx="2" ry="2" />
|
|
82
|
+
<path d="M7 11V7a5 5 0 0 1 10 0v4" />
|
|
83
|
+
</symbol>
|
|
84
|
+
<symbol id="eye">
|
|
85
|
+
<path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" />
|
|
86
|
+
<circle cx="12" cy="12" r="3" />
|
|
87
|
+
</symbol>
|
|
88
|
+
<symbol id="hash">
|
|
89
|
+
<line x1="4" y1="9" x2="20" y2="9" />
|
|
90
|
+
<line x1="4" y1="15" x2="20" y2="15" />
|
|
91
|
+
<line x1="10" y1="3" x2="8" y2="21" />
|
|
92
|
+
<line x1="16" y1="3" x2="14" y2="21" />
|
|
93
|
+
</symbol>
|
|
94
|
+
<symbol id="mail">
|
|
95
|
+
<path
|
|
96
|
+
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"
|
|
97
|
+
/>
|
|
98
|
+
<polyline points="22,6 12,13 2,6" />
|
|
99
|
+
</symbol>
|
|
100
|
+
<symbol id="send">
|
|
101
|
+
<line x1="22" y1="2" x2="11" y2="13" />
|
|
102
|
+
<polygon points="22 2 15 22 11 13 2 9 22 2" />
|
|
103
|
+
</symbol>
|
|
104
|
+
<symbol id="info">
|
|
105
|
+
<circle cx="12" cy="12" r="10" />
|
|
106
|
+
<line x1="12" y1="16" x2="12" y2="12" />
|
|
107
|
+
<line x1="12" y1="8" x2="12.01" y2="8" />
|
|
108
|
+
</symbol>
|
|
109
|
+
<symbol id="tel">
|
|
110
|
+
<path
|
|
111
|
+
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"
|
|
112
|
+
/>
|
|
113
|
+
</symbol>
|
|
114
|
+
<symbol id="search">
|
|
115
|
+
<circle cx="11" cy="11" r="8" />
|
|
116
|
+
<line x1="21" y1="21" x2="16.65" y2="16.65" />
|
|
117
|
+
</symbol>
|
|
118
|
+
<symbol id="user">
|
|
119
|
+
<path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2" />
|
|
120
|
+
<circle cx="12" cy="7" r="4" />
|
|
121
|
+
</symbol>
|
|
122
|
+
<symbol id="arrow-up">
|
|
123
|
+
<line x1="12" y1="19" x2="12" y2="5" />
|
|
124
|
+
<polyline points="5 12 12 5 19 12" />
|
|
125
|
+
</symbol>
|
|
126
|
+
<symbol id="arrow-down">
|
|
127
|
+
<line x1="12" y1="5" x2="12" y2="19" />
|
|
128
|
+
<polyline points="19 12 12 19 5 12" />
|
|
129
|
+
</symbol>
|
|
130
|
+
<symbol id="warning">
|
|
131
|
+
<path
|
|
132
|
+
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"
|
|
133
|
+
/>
|
|
134
|
+
<line x1="12" y1="9" x2="12" y2="13" />
|
|
135
|
+
<path x1="12" y1="17" x2="12.01" y2="17" />
|
|
136
|
+
</symbol>
|
|
137
|
+
</svg>
|
|
138
|
+
<svg viewBox="0 0 24 24">
|
|
139
|
+
<use href="#${name}"></use>
|
|
140
|
+
</svg>
|
|
141
|
+
`;
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
GdsIcon.properties = {
|
|
145
|
+
open: { type: String, reflect: true },
|
|
146
|
+
name: { type: String }
|
|
147
|
+
};
|
|
148
|
+
GdsIcon = __decorateClass([
|
|
149
|
+
gdsCustomElement("gds-icon")
|
|
150
|
+
], GdsIcon);
|
|
151
|
+
|
|
152
|
+
export {
|
|
153
|
+
GdsIcon
|
|
154
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// libs/core/src/primitives/calendar/functions.ts
|
|
2
|
+
import {
|
|
3
|
+
startOfMonth,
|
|
4
|
+
endOfMonth,
|
|
5
|
+
addDays,
|
|
6
|
+
eachWeekOfInterval,
|
|
7
|
+
eachDayOfInterval
|
|
8
|
+
} from "date-fns";
|
|
9
|
+
import { html } from "lit-html";
|
|
10
|
+
function renderMonthGridView(date, template) {
|
|
11
|
+
const monthStart = startOfMonth(date);
|
|
12
|
+
const monthEnd = endOfMonth(date);
|
|
13
|
+
const weeks = eachWeekOfInterval(
|
|
14
|
+
{ start: monthStart, end: monthEnd },
|
|
15
|
+
{ weekStartsOn: 1 }
|
|
16
|
+
);
|
|
17
|
+
return html`${template(
|
|
18
|
+
weeks.map((weekStartDay) => ({
|
|
19
|
+
days: eachDayOfInterval({
|
|
20
|
+
start: weekStartDay,
|
|
21
|
+
end: addDays(weekStartDay, 6)
|
|
22
|
+
})
|
|
23
|
+
}))
|
|
24
|
+
)}`;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export {
|
|
28
|
+
renderMonthGridView
|
|
29
|
+
};
|