@sebgroup/green-core 3.32.0 → 3.32.2
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/components/checkbox/checkbox.component.d.ts +1 -0
- package/components/checkbox/checkbox.component.js +6 -0
- package/components/dropdown/dropdown.component.d.ts +1 -0
- package/components/dropdown/dropdown.component.js +23 -4
- package/components/switch/switch.component.d.ts +1 -0
- package/components/switch/switch.component.js +7 -0
- package/custom-elements.json +42985 -42985
- package/gds-element.js +1 -1
- package/generated/mcp/components.json +1 -1
- package/generated/mcp/icons.json +1 -1
- package/generated/mcp/index.json +1 -1
- package/generated/mcp/tokens.json +1 -1
- package/generated/react/index.d.ts +5 -5
- package/generated/react/index.js +5 -5
- package/package.json +1 -1
- package/utils/helpers/custom-element-scoping.js +1 -1
|
@@ -35,6 +35,7 @@ export declare class GdsCheckbox extends GdsFormControlElement {
|
|
|
35
35
|
set value(value: string);
|
|
36
36
|
private _elCheckbox;
|
|
37
37
|
private _handleIndeterminateChange;
|
|
38
|
+
private _handleCheckedChange;
|
|
38
39
|
focus(options?: FocusOptions): void;
|
|
39
40
|
render(): any;
|
|
40
41
|
protected _getValidityAnchor(): HTMLElement;
|
|
@@ -55,6 +55,9 @@ let GdsCheckbox = class extends GdsFormControlElement {
|
|
|
55
55
|
this.checked = false;
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
+
_handleCheckedChange() {
|
|
59
|
+
__privateMethod(this, _GdsCheckbox_instances, syncFormValue_fn).call(this);
|
|
60
|
+
}
|
|
58
61
|
focus(options) {
|
|
59
62
|
this._elCheckbox.focus(options);
|
|
60
63
|
}
|
|
@@ -158,6 +161,9 @@ __decorateClass([
|
|
|
158
161
|
__decorateClass([
|
|
159
162
|
watch("indeterminate")
|
|
160
163
|
], GdsCheckbox.prototype, "_handleIndeterminateChange", 1);
|
|
164
|
+
__decorateClass([
|
|
165
|
+
watch("checked")
|
|
166
|
+
], GdsCheckbox.prototype, "_handleCheckedChange", 1);
|
|
161
167
|
GdsCheckbox = __decorateClass([
|
|
162
168
|
gdsCustomElement("gds-checkbox", {
|
|
163
169
|
dependsOn: [GdsToggleControlBase, IconCheckmark, IconMinusSmall]
|
|
@@ -132,6 +132,7 @@ declare class Dropdown extends GdsFormControlElement implements OptionsContainer
|
|
|
132
132
|
get navigableItems(): GdsOption[];
|
|
133
133
|
private _elTriggerBtn;
|
|
134
134
|
private _elSearchInput;
|
|
135
|
+
private _elListbox;
|
|
135
136
|
connectedCallback(): void;
|
|
136
137
|
disconnectedCallback(): void;
|
|
137
138
|
render(): any;
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
__privateMethod,
|
|
6
6
|
__privateSet
|
|
7
7
|
} from "../../chunks/chunk.H2T4A5YY.js";
|
|
8
|
-
var _optionElements, _Dropdown_instances, shouldShowFooter_fn, _renderCombobox, _renderTriggerButton, _handleBlur, _calcMaxHeight, _dispatchUISateEvent, _handlePopoverStateChange, _handleClearButton, _handleSearchFieldInput, _handleSearchFieldKeyDown, _handleListboxKeyDown, _handleOptionFocusChange, _handleOptionSelect, toggleOptionValue_fn, syncOptionSelection_fn, _focusListbox, _isPointerPressedInListbox, _handleListboxPointerDown, _handleListboxFocus, _isCommitting, commitSelection_fn, registerAutoCloseListener_fn, unregisterAutoCloseListener_fn, _blurCloseListener, _tabCloseListener;
|
|
8
|
+
var _optionElements, _Dropdown_instances, shouldShowFooter_fn, _renderCombobox, _renderTriggerButton, _handleBlur, _calcMaxHeight, _dispatchUISateEvent, _handlePopoverStateChange, _handleClearButton, _handleSearchFieldInput, _handleSearchFieldKeyDown, _handleListboxKeyDown, _handleOptionFocusChange, _handleOptionSelect, toggleOptionValue_fn, syncOptionSelection_fn, _focusListbox, _isPointerPressedInListbox, _handleListboxPointerDown, _handleListboxFocus, _isCommitting, commitSelection_fn, scrollOptionIntoView_fn, registerAutoCloseListener_fn, unregisterAutoCloseListener_fn, _blurCloseListener, _tabCloseListener;
|
|
9
9
|
import { localized, msg, str } from "@lit/localize";
|
|
10
10
|
import { nothing } from "lit";
|
|
11
11
|
import { property, query } from "lit/decorators.js";
|
|
@@ -162,6 +162,8 @@ let Dropdown = class extends GdsFormControlElement {
|
|
|
162
162
|
}
|
|
163
163
|
if (__privateGet(this, _dispatchUISateEvent).call(this, e.detail.open, e.detail.reason)) {
|
|
164
164
|
this.open = e.detail.open;
|
|
165
|
+
} else {
|
|
166
|
+
e.preventDefault();
|
|
165
167
|
}
|
|
166
168
|
});
|
|
167
169
|
__privateAdd(this, _handleClearButton, (e) => {
|
|
@@ -535,9 +537,7 @@ let Dropdown = class extends GdsFormControlElement {
|
|
|
535
537
|
const selectedOption = this.options.find((option) => option.selected);
|
|
536
538
|
requestAnimationFrame(async () => {
|
|
537
539
|
await this.updateComplete;
|
|
538
|
-
selectedOption
|
|
539
|
-
block: "center"
|
|
540
|
-
});
|
|
540
|
+
__privateMethod(this, _Dropdown_instances, scrollOptionIntoView_fn).call(this, selectedOption);
|
|
541
541
|
});
|
|
542
542
|
}
|
|
543
543
|
};
|
|
@@ -605,6 +605,22 @@ commitSelection_fn = function(value, options = {}) {
|
|
|
605
605
|
__privateSet(this, _isCommitting, false);
|
|
606
606
|
}
|
|
607
607
|
};
|
|
608
|
+
/**
|
|
609
|
+
* Centers an option inside the listbox container by adjusting the container's own
|
|
610
|
+
* `scrollTop`. `Element.scrollIntoView` was used here previously, but it also scrolls
|
|
611
|
+
* ancestor scrollports, including the window when the popover is non-modal (combobox
|
|
612
|
+
* mode). That self-inflicted page scroll closes the popover through its own
|
|
613
|
+
* scroll-to-close behavior. See #3290.
|
|
614
|
+
*/
|
|
615
|
+
scrollOptionIntoView_fn = function(option) {
|
|
616
|
+
const container = this._elListbox;
|
|
617
|
+
if (!container || !option) return;
|
|
618
|
+
const containerRect = container.getBoundingClientRect();
|
|
619
|
+
const optionRect = option.getBoundingClientRect();
|
|
620
|
+
const offsetFromContainerTop = optionRect.top - containerRect.top;
|
|
621
|
+
const centeredOffset = (containerRect.height - optionRect.height) / 2;
|
|
622
|
+
container.scrollTop += offsetFromContainerTop - centeredOffset;
|
|
623
|
+
};
|
|
608
624
|
registerAutoCloseListener_fn = function() {
|
|
609
625
|
this.addEventListener("blur", __privateGet(this, _blurCloseListener));
|
|
610
626
|
this.addEventListener("gds-blur", __privateGet(this, _blurCloseListener));
|
|
@@ -678,6 +694,9 @@ __decorateClass([
|
|
|
678
694
|
__decorateClass([
|
|
679
695
|
query("#searchinput")
|
|
680
696
|
], Dropdown.prototype, "_elSearchInput", 2);
|
|
697
|
+
__decorateClass([
|
|
698
|
+
query("#listbox")
|
|
699
|
+
], Dropdown.prototype, "_elListbox", 2);
|
|
681
700
|
__decorateClass([
|
|
682
701
|
observeLightDOM({
|
|
683
702
|
attributes: true,
|
|
@@ -26,6 +26,7 @@ declare class Switch extends GdsFormControlElement<string> {
|
|
|
26
26
|
*/
|
|
27
27
|
get value(): string;
|
|
28
28
|
set value(val: string);
|
|
29
|
+
private _handleCheckedChange;
|
|
29
30
|
protected _getValidityAnchor(): HTMLElement;
|
|
30
31
|
protected formResetCallback(): void;
|
|
31
32
|
focus(options?: FocusOptions): void;
|
|
@@ -11,6 +11,7 @@ import { ifDefined } from "lit/directives/if-defined.js";
|
|
|
11
11
|
import { gdsCustomElement, html } from "../../scoping.js";
|
|
12
12
|
import { ariaForwarding } from "../../utils/decorators/aria-forwarding.js";
|
|
13
13
|
import { styleExpressionProperty } from "../../utils/decorators/style-expression-property.js";
|
|
14
|
+
import { watch } from "../../utils/decorators/watch.js";
|
|
14
15
|
import {
|
|
15
16
|
withLayoutChildProps,
|
|
16
17
|
withMarginProps,
|
|
@@ -55,6 +56,9 @@ let Switch = class extends GdsFormControlElement {
|
|
|
55
56
|
set value(val) {
|
|
56
57
|
this._internalValue = val;
|
|
57
58
|
}
|
|
59
|
+
_handleCheckedChange() {
|
|
60
|
+
__privateMethod(this, _Switch_instances, syncFormValue_fn).call(this);
|
|
61
|
+
}
|
|
58
62
|
_getValidityAnchor() {
|
|
59
63
|
return this._input;
|
|
60
64
|
}
|
|
@@ -176,6 +180,9 @@ __decorateClass([
|
|
|
176
180
|
__decorateClass([
|
|
177
181
|
query(".perimeter")
|
|
178
182
|
], Switch.prototype, "_perimeter", 2);
|
|
183
|
+
__decorateClass([
|
|
184
|
+
watch("checked")
|
|
185
|
+
], Switch.prototype, "_handleCheckedChange", 1);
|
|
179
186
|
Switch = __decorateClass([
|
|
180
187
|
ariaForwarding({
|
|
181
188
|
labelledBy: "#switch-input",
|