@sebgroup/green-core 2.13.2 → 2.14.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/button/button.component.d.ts +1 -0
- package/components/button/button.component.js +17 -3
- package/gds-element.js +1 -1
- package/generated/react/index.d.ts +5 -5
- package/generated/react/index.js +5 -5
- package/package.json +1 -1
- package/primitives/ripple/ripple.component.d.ts +1 -0
- package/primitives/ripple/ripple.component.js +15 -11
- package/utils/helpers/custom-element-scoping.js +1 -1
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
__privateGet,
|
|
5
5
|
__privateSet
|
|
6
6
|
} from "../../chunks/chunk.QU3DSPNU.js";
|
|
7
|
-
var _isIconButton, _Button_instances, isLink_get, defaultRel_get, _mainSlotChange, _handleClick;
|
|
7
|
+
var _isIconButton, _Button_instances, isLink_get, defaultRel_get, _mainSlotChange, _handleClick, _handleKeyDown;
|
|
8
8
|
import { nothing } from "lit";
|
|
9
9
|
import { property, query } from "lit/decorators.js";
|
|
10
10
|
import { classMap } from "lit/directives/class-map.js";
|
|
@@ -59,6 +59,15 @@ class Button extends GdsFormControlElement {
|
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
});
|
|
62
|
+
__privateAdd(this, _handleKeyDown, (e) => {
|
|
63
|
+
if (this.disabled) return;
|
|
64
|
+
if ((e.code === "Space" || e.key === "Enter") && !e.repeat) {
|
|
65
|
+
const ripple = this._ripple;
|
|
66
|
+
if (ripple) {
|
|
67
|
+
ripple.triggerRipple();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
});
|
|
62
71
|
}
|
|
63
72
|
focus(options) {
|
|
64
73
|
this._getValidityAnchor()?.focus(options);
|
|
@@ -101,6 +110,7 @@ class Button extends GdsFormControlElement {
|
|
|
101
110
|
download=${ifDefined(__privateGet(this, _Button_instances, isLink_get) ? this.download : void 0)}
|
|
102
111
|
part="_button"
|
|
103
112
|
@click="${__privateGet(this, _handleClick)}"
|
|
113
|
+
@keydown="${__privateGet(this, _handleKeyDown)}"
|
|
104
114
|
${forwardAttributes(
|
|
105
115
|
(attr) => attr.name.startsWith("gds-aria") || attr.name === "gds-role" || ariaForwards.includes(attr.name)
|
|
106
116
|
)}
|
|
@@ -112,8 +122,8 @@ class Button extends GdsFormControlElement {
|
|
|
112
122
|
!this._isUsingTransitionalStyles,
|
|
113
123
|
() => html`<gds-ripple part="_ripple"></gds-ripple>`
|
|
114
124
|
)}
|
|
115
|
-
|
|
116
|
-
|
|
125
|
+
</${tag}>
|
|
126
|
+
`;
|
|
117
127
|
}
|
|
118
128
|
_getValidityAnchor() {
|
|
119
129
|
return this._button;
|
|
@@ -132,6 +142,7 @@ defaultRel_get = function() {
|
|
|
132
142
|
};
|
|
133
143
|
_mainSlotChange = new WeakMap();
|
|
134
144
|
_handleClick = new WeakMap();
|
|
145
|
+
_handleKeyDown = new WeakMap();
|
|
135
146
|
Button.styles = [tokens, ButtonStyles];
|
|
136
147
|
/**
|
|
137
148
|
* @internal
|
|
@@ -181,6 +192,9 @@ __decorateClass([
|
|
|
181
192
|
__decorateClass([
|
|
182
193
|
query(".button")
|
|
183
194
|
], Button.prototype, "_button", 2);
|
|
195
|
+
__decorateClass([
|
|
196
|
+
query("gds-ripple")
|
|
197
|
+
], Button.prototype, "_ripple", 2);
|
|
184
198
|
__decorateClass([
|
|
185
199
|
observeLightDOM({
|
|
186
200
|
attributes: true,
|
package/gds-element.js
CHANGED
|
@@ -14,7 +14,7 @@ class GdsElement extends LitElement {
|
|
|
14
14
|
/**
|
|
15
15
|
* The semantic version of this element. Can be used for troubleshooting to verify the version being used.
|
|
16
16
|
*/
|
|
17
|
-
this.semanticVersion = "2.
|
|
17
|
+
this.semanticVersion = "2.14.0";
|
|
18
18
|
this._isUsingTransitionalStyles = false;
|
|
19
19
|
this._dynamicStylesController = new DynamicStylesController(this);
|
|
20
20
|
}
|
|
@@ -53,11 +53,6 @@ export * from './filter-chip/index.js';
|
|
|
53
53
|
export * from './formatted-account/index.js';
|
|
54
54
|
export * from './formatted-date/index.js';
|
|
55
55
|
export * from './formatted-number/index.js';
|
|
56
|
-
export * from './radio-group/index.js';
|
|
57
|
-
export * from './segment/index.js';
|
|
58
|
-
export * from './sensitive-account/index.js';
|
|
59
|
-
export * from './sensitive-date/index.js';
|
|
60
|
-
export * from './sensitive-number/index.js';
|
|
61
56
|
export * from './icons/icon-ai/index.js';
|
|
62
57
|
export * from './icons/icon-airplane-up/index.js';
|
|
63
58
|
export * from './icons/icon-archive/index.js';
|
|
@@ -391,3 +386,8 @@ export * from './icons/icon-youtube/index.js';
|
|
|
391
386
|
export * from './icons/icon-zap/index.js';
|
|
392
387
|
export * from './icons/icon-zoom-in/index.js';
|
|
393
388
|
export * from './icons/icon-zoom-out/index.js';
|
|
389
|
+
export * from './radio-group/index.js';
|
|
390
|
+
export * from './segment/index.js';
|
|
391
|
+
export * from './sensitive-account/index.js';
|
|
392
|
+
export * from './sensitive-date/index.js';
|
|
393
|
+
export * from './sensitive-number/index.js';
|
package/generated/react/index.js
CHANGED
|
@@ -53,11 +53,6 @@ export * from "./filter-chip/index.js";
|
|
|
53
53
|
export * from "./formatted-account/index.js";
|
|
54
54
|
export * from "./formatted-date/index.js";
|
|
55
55
|
export * from "./formatted-number/index.js";
|
|
56
|
-
export * from "./radio-group/index.js";
|
|
57
|
-
export * from "./segment/index.js";
|
|
58
|
-
export * from "./sensitive-account/index.js";
|
|
59
|
-
export * from "./sensitive-date/index.js";
|
|
60
|
-
export * from "./sensitive-number/index.js";
|
|
61
56
|
export * from "./icons/icon-ai/index.js";
|
|
62
57
|
export * from "./icons/icon-airplane-up/index.js";
|
|
63
58
|
export * from "./icons/icon-archive/index.js";
|
|
@@ -391,3 +386,8 @@ export * from "./icons/icon-youtube/index.js";
|
|
|
391
386
|
export * from "./icons/icon-zap/index.js";
|
|
392
387
|
export * from "./icons/icon-zoom-in/index.js";
|
|
393
388
|
export * from "./icons/icon-zoom-out/index.js";
|
|
389
|
+
export * from "./radio-group/index.js";
|
|
390
|
+
export * from "./segment/index.js";
|
|
391
|
+
export * from "./sensitive-account/index.js";
|
|
392
|
+
export * from "./sensitive-date/index.js";
|
|
393
|
+
export * from "./sensitive-number/index.js";
|
package/package.json
CHANGED
|
@@ -11,22 +11,26 @@ let GdsRipple = class extends GdsElement {
|
|
|
11
11
|
constructor() {
|
|
12
12
|
super(...arguments);
|
|
13
13
|
this.onmousedown = (e) => {
|
|
14
|
-
|
|
15
|
-
const rect = target.getBoundingClientRect();
|
|
16
|
-
const rippleEl = this._rippleEl;
|
|
17
|
-
if (rippleEl) {
|
|
18
|
-
rippleEl.classList.remove("gds-ripple-effect");
|
|
19
|
-
this.style.setProperty("--gds-ripple-top", `${e.clientY - rect.top}px`);
|
|
20
|
-
this.style.setProperty("--gds-ripple-left", `${e.clientX - rect.left}px`);
|
|
21
|
-
setTimeout(() => {
|
|
22
|
-
rippleEl.classList.add("gds-ripple-effect");
|
|
23
|
-
}, 20);
|
|
24
|
-
}
|
|
14
|
+
this.triggerRipple(e.clientX, e.clientY);
|
|
25
15
|
};
|
|
26
16
|
}
|
|
27
17
|
render() {
|
|
28
18
|
return html`<div></div>`;
|
|
29
19
|
}
|
|
20
|
+
triggerRipple(x, y) {
|
|
21
|
+
const rippleEl = this._rippleEl;
|
|
22
|
+
const rect = this.getBoundingClientRect();
|
|
23
|
+
const rippleX = x !== void 0 ? x - rect.left : rect.width / 2;
|
|
24
|
+
const rippleY = y !== void 0 ? y - rect.top : rect.height / 2;
|
|
25
|
+
if (rippleEl) {
|
|
26
|
+
rippleEl.classList.remove("gds-ripple-effect");
|
|
27
|
+
this.style.setProperty("--gds-ripple-top", `${rippleY}px`);
|
|
28
|
+
this.style.setProperty("--gds-ripple-left", `${rippleX}px`);
|
|
29
|
+
setTimeout(() => {
|
|
30
|
+
rippleEl.classList.add("gds-ripple-effect");
|
|
31
|
+
}, 20);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
30
34
|
};
|
|
31
35
|
GdsRipple.styles = [tokens, RippleStyles];
|
|
32
36
|
__decorateClass([
|