@sebgroup/green-core 3.19.0 → 3.20.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/components/dialog/dialog.component.js +1 -0
- package/custom-elements.json +3242 -3225
- 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 +1 -1
- package/generated/react/index.js +1 -1
- package/package.json +1 -1
- package/utils/decorators/aria-forwarding.js +44 -1
- package/utils/decorators/aria-forwarding.types.d.ts +10 -1
- package/utils/decorators/aria-forwarding.types.js +3 -1
- package/utils/helpers/custom-element-scoping.js +1 -1
package/gds-element.js
CHANGED
|
@@ -16,7 +16,7 @@ class GdsElement extends LitElement {
|
|
|
16
16
|
/**
|
|
17
17
|
* The semantic version of this element. Can be used for troubleshooting to verify the version being used.
|
|
18
18
|
*/
|
|
19
|
-
this.semanticVersion = "3.
|
|
19
|
+
this.semanticVersion = "3.20.0";
|
|
20
20
|
this.syncFirstRender = false;
|
|
21
21
|
this._isUsingTransitionalStyles = false;
|
|
22
22
|
this._dynamicStylesController = new DynamicStylesController(this);
|
package/generated/mcp/icons.json
CHANGED
package/generated/mcp/index.json
CHANGED
|
@@ -59,8 +59,8 @@ export * from './radio-group/index.js';
|
|
|
59
59
|
export * from './segment/index.js';
|
|
60
60
|
export * from './sensitive-account/index.js';
|
|
61
61
|
export * from './sensitive-date/index.js';
|
|
62
|
-
export * from './sensitive-number/index.js';
|
|
63
62
|
export * from './tab/index.js';
|
|
63
|
+
export * from './sensitive-number/index.js';
|
|
64
64
|
export * from './tab-panel/index.js';
|
|
65
65
|
export * from './icons/icon-ai/index.js';
|
|
66
66
|
export * from './icons/icon-airplane-up/index.js';
|
package/generated/react/index.js
CHANGED
|
@@ -59,8 +59,8 @@ export * from "./radio-group/index.js";
|
|
|
59
59
|
export * from "./segment/index.js";
|
|
60
60
|
export * from "./sensitive-account/index.js";
|
|
61
61
|
export * from "./sensitive-date/index.js";
|
|
62
|
-
export * from "./sensitive-number/index.js";
|
|
63
62
|
export * from "./tab/index.js";
|
|
63
|
+
export * from "./sensitive-number/index.js";
|
|
64
64
|
export * from "./tab-panel/index.js";
|
|
65
65
|
export * from "./icons/icon-ai/index.js";
|
|
66
66
|
export * from "./icons/icon-airplane-up/index.js";
|
package/package.json
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import "../../chunks/chunk.CAV4X6PU.js";
|
|
2
|
+
import {
|
|
3
|
+
ARIA_STRING_KEYS
|
|
4
|
+
} from "./aria-forwarding.types.js";
|
|
2
5
|
import { observeAttributes } from "./observe-attributes.js";
|
|
3
6
|
function getAriaRefMeta(key) {
|
|
4
7
|
const isSingle = key === "activeDescendant";
|
|
@@ -32,10 +35,15 @@ function setElementProperty(el, prop, value, type = "list") {
|
|
|
32
35
|
}
|
|
33
36
|
function ariaForwarding(config) {
|
|
34
37
|
const configuredEntries = [];
|
|
38
|
+
const configuredStringEntries = [];
|
|
35
39
|
for (const [key, selector] of Object.entries(config)) {
|
|
36
40
|
if (!selector)
|
|
37
41
|
continue;
|
|
38
|
-
|
|
42
|
+
if (ARIA_STRING_KEYS.includes(key)) {
|
|
43
|
+
configuredStringEntries.push({ key, selector });
|
|
44
|
+
} else {
|
|
45
|
+
configuredEntries.push({ key, selector });
|
|
46
|
+
}
|
|
39
47
|
}
|
|
40
48
|
return function(constructor) {
|
|
41
49
|
const origConnected = constructor.prototype.connectedCallback;
|
|
@@ -54,6 +62,15 @@ function ariaForwarding(config) {
|
|
|
54
62
|
attrHandlers[meta.ariaAttr] = handler;
|
|
55
63
|
attrHandlers[meta.gdsAriaAttr] = handler;
|
|
56
64
|
}
|
|
65
|
+
for (const { key } of configuredStringEntries) {
|
|
66
|
+
const ariaAttr = `aria-${key}`;
|
|
67
|
+
const gdsAriaAttr = `gds-aria-${key}`;
|
|
68
|
+
const handler = (host, _oldValue, newValue) => {
|
|
69
|
+
forwardAriaStringAttribute(host, key, newValue);
|
|
70
|
+
};
|
|
71
|
+
attrHandlers[ariaAttr] = handler;
|
|
72
|
+
attrHandlers[gdsAriaAttr] = handler;
|
|
73
|
+
}
|
|
57
74
|
observeAttributes(AriaForwardingElement, attrHandlers);
|
|
58
75
|
function initAriaForwarding(host) {
|
|
59
76
|
if (host[ARIA_INIT])
|
|
@@ -92,6 +109,14 @@ function ariaForwarding(config) {
|
|
|
92
109
|
forwardAriaRefFromAttribute(host, key, value);
|
|
93
110
|
}
|
|
94
111
|
}
|
|
112
|
+
for (const { key } of configuredStringEntries) {
|
|
113
|
+
const gdsValue = host.getAttribute(`gds-aria-${key}`);
|
|
114
|
+
const ariaValue = host.getAttribute(`aria-${key}`);
|
|
115
|
+
const value = gdsValue ?? ariaValue;
|
|
116
|
+
if (value) {
|
|
117
|
+
forwardAriaStringAttribute(host, key, value);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
95
120
|
});
|
|
96
121
|
}
|
|
97
122
|
function forwardAriaRefFromAttribute(host, refKey, value) {
|
|
@@ -125,6 +150,24 @@ function ariaForwarding(config) {
|
|
|
125
150
|
targets.forEach((t) => setElementProperty(t, meta.property, value, meta.type));
|
|
126
151
|
});
|
|
127
152
|
}
|
|
153
|
+
function forwardAriaStringAttribute(host, key, value) {
|
|
154
|
+
const selector = config[key];
|
|
155
|
+
if (!selector)
|
|
156
|
+
return;
|
|
157
|
+
const ariaAttr = `aria-${key}`;
|
|
158
|
+
host.updateComplete.then(() => {
|
|
159
|
+
const targets = host.shadowRoot?.querySelectorAll(selector);
|
|
160
|
+
if (!targets || targets.length === 0)
|
|
161
|
+
return;
|
|
162
|
+
targets.forEach((t) => {
|
|
163
|
+
if (value) {
|
|
164
|
+
t.setAttribute(ariaAttr, value);
|
|
165
|
+
} else {
|
|
166
|
+
t.removeAttribute(ariaAttr);
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
});
|
|
170
|
+
}
|
|
128
171
|
return AriaForwardingElement;
|
|
129
172
|
};
|
|
130
173
|
}
|
|
@@ -39,6 +39,15 @@ export interface AriaRefMeta {
|
|
|
39
39
|
*/
|
|
40
40
|
export declare const ARIA_REF_KEYS: readonly ["activeDescendant", "controls", "describedBy", "details", "errorMessage", "flowTo", "labelledBy", "owns"];
|
|
41
41
|
export type AriaRefKey = (typeof ARIA_REF_KEYS)[number];
|
|
42
|
+
/**
|
|
43
|
+
* ARIA string attribute keys.
|
|
44
|
+
* These forward a plain string value (not an element reference) to the target.
|
|
45
|
+
* The config key (e.g., `label`) maps by convention to:
|
|
46
|
+
* - Attribute: `aria-label` / `gds-aria-label`
|
|
47
|
+
* - Type: `string`
|
|
48
|
+
*/
|
|
49
|
+
export declare const ARIA_STRING_KEYS: readonly ["label"];
|
|
50
|
+
export type AriaStringKey = (typeof ARIA_STRING_KEYS)[number];
|
|
42
51
|
/**
|
|
43
52
|
* Configuration for the `@ariaForwarding` decorator.
|
|
44
53
|
*
|
|
@@ -55,5 +64,5 @@ export type AriaRefKey = (typeof ARIA_REF_KEYS)[number];
|
|
|
55
64
|
* ```
|
|
56
65
|
*/
|
|
57
66
|
export type AriaForwardingConfig = {
|
|
58
|
-
[K in AriaRefKey]?: string;
|
|
67
|
+
[K in AriaRefKey | AriaStringKey]?: string;
|
|
59
68
|
};
|