@justeattakeaway/pie-button 1.13.3 → 1.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/custom-elements.json +8 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +538 -527
- package/dist/react.d.ts +9 -0
- package/package.json +8 -10
- package/src/defs.ts +9 -0
- package/src/index.ts +8 -3
package/dist/react.d.ts
CHANGED
|
@@ -8,7 +8,15 @@ import { PropertyValues } from 'lit';
|
|
|
8
8
|
import * as React_2 from 'react';
|
|
9
9
|
import { TemplateResult } from 'lit';
|
|
10
10
|
|
|
11
|
+
declare type AriaProps = {
|
|
12
|
+
label?: string;
|
|
13
|
+
};
|
|
14
|
+
|
|
11
15
|
export declare interface ButtonProps {
|
|
16
|
+
/**
|
|
17
|
+
* The ARIA attributes for the button element.
|
|
18
|
+
*/
|
|
19
|
+
aria?: AriaProps;
|
|
12
20
|
/**
|
|
13
21
|
* Which HTML element to use when rendering the button.
|
|
14
22
|
*/
|
|
@@ -134,6 +142,7 @@ declare class PieButton_2 extends PieButton_base implements ButtonProps {
|
|
|
134
142
|
connectedCallback(): void;
|
|
135
143
|
disconnectedCallback(): void;
|
|
136
144
|
updated(changedProperties: PropertyValues<this>): void;
|
|
145
|
+
aria: ButtonProps['aria'];
|
|
137
146
|
tag: "button" | "a";
|
|
138
147
|
size: "xsmall" | "small-productive" | "small-expressive" | "medium" | "large";
|
|
139
148
|
type: "button" | "submit" | "reset";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@justeattakeaway/pie-button",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.14.0",
|
|
4
4
|
"description": "PIE design system button built using web components",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"scripts": {
|
|
31
31
|
"build": "run -T vite build",
|
|
32
32
|
"build:react-wrapper": "npx build-react-wrapper",
|
|
33
|
-
"create:manifest": "
|
|
33
|
+
"create:manifest": "run -T cem analyze --litelement",
|
|
34
34
|
"lint:scripts": "run -T eslint .",
|
|
35
35
|
"lint:scripts:fix": "run -T eslint . --fix",
|
|
36
36
|
"lint:style": "run -T stylelint ./src/**/*.{css,scss}",
|
|
@@ -44,12 +44,10 @@
|
|
|
44
44
|
"author": "Just Eat Takeaway.com - Design System Team",
|
|
45
45
|
"license": "Apache-2.0",
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@
|
|
48
|
-
"@justeattakeaway/pie-
|
|
49
|
-
"@justeattakeaway/pie-
|
|
50
|
-
"@justeattakeaway/pie-
|
|
51
|
-
"@justeattakeaway/pie-wrapper-react": "0.14.4",
|
|
52
|
-
"cem-plugin-module-file-extensions": "0.0.5"
|
|
47
|
+
"@justeattakeaway/pie-components-config": "0.21.1",
|
|
48
|
+
"@justeattakeaway/pie-css": "1.1.1",
|
|
49
|
+
"@justeattakeaway/pie-monorepo-utils": "0.9.0",
|
|
50
|
+
"@justeattakeaway/pie-wrapper-react": "0.14.4"
|
|
53
51
|
},
|
|
54
52
|
"volta": {
|
|
55
53
|
"extends": "../../../package.json"
|
|
@@ -59,8 +57,8 @@
|
|
|
59
57
|
"dist/*.js"
|
|
60
58
|
],
|
|
61
59
|
"dependencies": {
|
|
62
|
-
"@justeattakeaway/pie-spinner": "1.4.
|
|
63
|
-
"@justeattakeaway/pie-webc-core": "14.0.
|
|
60
|
+
"@justeattakeaway/pie-spinner": "1.4.14",
|
|
61
|
+
"@justeattakeaway/pie-webc-core": "14.0.1",
|
|
64
62
|
"element-internals-polyfill": "1.3.11"
|
|
65
63
|
}
|
|
66
64
|
}
|
package/src/defs.ts
CHANGED
|
@@ -12,11 +12,20 @@ export const iconPlacements = ['leading', 'trailing'] as const;
|
|
|
12
12
|
|
|
13
13
|
export type Variant = typeof variants[number];
|
|
14
14
|
|
|
15
|
+
type AriaProps = {
|
|
16
|
+
label?: string;
|
|
17
|
+
};
|
|
18
|
+
|
|
15
19
|
export const formEncodingtypes = ['application/x-www-form-urlencoded', 'multipart/form-data', 'text/plain'] as const;
|
|
16
20
|
export const formMethodTypes = ['post', 'get', 'dialog'] as const;
|
|
17
21
|
export const formTargetTypes = ['_self', '_blank', '_parent', '_top'] as const;
|
|
18
22
|
|
|
19
23
|
export interface ButtonProps {
|
|
24
|
+
/**
|
|
25
|
+
* The ARIA attributes for the button element.
|
|
26
|
+
*/
|
|
27
|
+
aria?: AriaProps;
|
|
28
|
+
|
|
20
29
|
/**
|
|
21
30
|
* Which HTML element to use when rendering the button.
|
|
22
31
|
*/
|
package/src/index.ts
CHANGED
|
@@ -58,6 +58,9 @@ export class PieButton extends DelegatesFocusMixin(FormControlMixin(PieElement))
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
+
@property({ type: Object })
|
|
62
|
+
public aria: ButtonProps['aria'];
|
|
63
|
+
|
|
61
64
|
@property({ type: String })
|
|
62
65
|
@validPropertyValues(componentSelector, tags, defaultProps.tag)
|
|
63
66
|
public tag = defaultProps.tag;
|
|
@@ -239,7 +242,7 @@ export class PieButton extends DelegatesFocusMixin(FormControlMixin(PieElement))
|
|
|
239
242
|
|
|
240
243
|
renderAnchor (classes: ClassInfo) {
|
|
241
244
|
const {
|
|
242
|
-
href, iconPlacement, rel, target, download,
|
|
245
|
+
href, iconPlacement, rel, target, download, aria,
|
|
243
246
|
} = this;
|
|
244
247
|
|
|
245
248
|
return html`
|
|
@@ -248,6 +251,7 @@ export class PieButton extends DelegatesFocusMixin(FormControlMixin(PieElement))
|
|
|
248
251
|
rel="${ifDefined(rel)}"
|
|
249
252
|
target="${ifDefined(target)}"
|
|
250
253
|
download="${ifDefined(download)}"
|
|
254
|
+
aria-label="${ifDefined(aria?.label)}"
|
|
251
255
|
class="${classMap(classes)}">
|
|
252
256
|
${iconPlacement === 'leading' ? html`<slot name="icon"></slot>` : nothing}
|
|
253
257
|
<slot></slot>
|
|
@@ -257,7 +261,7 @@ export class PieButton extends DelegatesFocusMixin(FormControlMixin(PieElement))
|
|
|
257
261
|
|
|
258
262
|
renderButton (classes: ClassInfo) {
|
|
259
263
|
const {
|
|
260
|
-
disabled, iconPlacement, isLoading, type,
|
|
264
|
+
disabled, iconPlacement, isLoading, type, aria,
|
|
261
265
|
} = this;
|
|
262
266
|
|
|
263
267
|
const buttonClasses = {
|
|
@@ -270,7 +274,8 @@ export class PieButton extends DelegatesFocusMixin(FormControlMixin(PieElement))
|
|
|
270
274
|
@click=${this._handleClick}
|
|
271
275
|
class=${classMap(buttonClasses)}
|
|
272
276
|
type=${type}
|
|
273
|
-
?disabled=${disabled}
|
|
277
|
+
?disabled=${disabled}
|
|
278
|
+
aria-label="${ifDefined(aria?.label)}">
|
|
274
279
|
${isLoading ? this.renderSpinner() : nothing}
|
|
275
280
|
${iconPlacement === 'leading' ? html`<slot name="icon"></slot>` : nothing}
|
|
276
281
|
<span class="o-btn-text"><slot></slot></span>
|