@justeattakeaway/pie-button 0.44.0 → 0.45.1
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 +6 -0
- package/dist/index.d.ts +7 -7
- package/dist/index.js +551 -548
- package/dist/react.d.ts +11 -9
- package/dist/react.js +10 -10
- package/package.json +6 -6
- package/src/defs-react.ts +3 -0
- package/src/defs.ts +7 -7
- package/src/index.ts +4 -4
- package/src/react.ts +9 -4
package/dist/react.d.ts
CHANGED
|
@@ -3,22 +3,22 @@ import type { FormControlInterface } from '@justeattakeaway/pie-webc-core';
|
|
|
3
3
|
import type { GenericConstructor } from '@justeattakeaway/pie-webc-core';
|
|
4
4
|
import type { LitElement } from 'lit';
|
|
5
5
|
import type { PropertyValues } from 'lit';
|
|
6
|
-
import
|
|
6
|
+
import * as React_2 from 'react';
|
|
7
7
|
import type { TemplateResult } from 'lit';
|
|
8
8
|
|
|
9
9
|
export declare interface ButtonProps {
|
|
10
10
|
/**
|
|
11
11
|
* What size the button should be.
|
|
12
12
|
*/
|
|
13
|
-
size
|
|
13
|
+
size?: typeof sizes[number];
|
|
14
14
|
/**
|
|
15
15
|
* What type attribute should be applied to the button. For example submit, button.
|
|
16
16
|
*/
|
|
17
|
-
type
|
|
17
|
+
type?: typeof types[number];
|
|
18
18
|
/**
|
|
19
19
|
* What style variant the button should be such as primary, outline or ghost.
|
|
20
20
|
*/
|
|
21
|
-
variant
|
|
21
|
+
variant?: Variant;
|
|
22
22
|
/**
|
|
23
23
|
* The placement of the icon slot, if provided, such as leading or trailing
|
|
24
24
|
*/
|
|
@@ -26,19 +26,19 @@ export declare interface ButtonProps {
|
|
|
26
26
|
/**
|
|
27
27
|
* When true, the button element is disabled.
|
|
28
28
|
*/
|
|
29
|
-
disabled
|
|
29
|
+
disabled?: boolean;
|
|
30
30
|
/**
|
|
31
31
|
* When true, the button element will occupy the full width of its container.
|
|
32
32
|
*/
|
|
33
|
-
isFullWidth
|
|
33
|
+
isFullWidth?: boolean;
|
|
34
34
|
/**
|
|
35
35
|
* When true, displays a loading indicator inside the button.
|
|
36
36
|
*/
|
|
37
|
-
isLoading
|
|
37
|
+
isLoading?: boolean;
|
|
38
38
|
/**
|
|
39
39
|
* When true, enables the responsive size feature.
|
|
40
40
|
*/
|
|
41
|
-
isResponsive
|
|
41
|
+
isResponsive?: boolean;
|
|
42
42
|
/**
|
|
43
43
|
* The name of the button, submitted as a pair with the button's value as part of the form data, when that button is used to submit the form.
|
|
44
44
|
* [MDN reference](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attributes)
|
|
@@ -91,7 +91,7 @@ export declare const formTargetTypes: readonly ["_self", "_blank", "_parent", "_
|
|
|
91
91
|
|
|
92
92
|
export declare const iconPlacements: readonly ["leading", "trailing"];
|
|
93
93
|
|
|
94
|
-
export declare const PieButton:
|
|
94
|
+
export declare const PieButton: React_2.ForwardRefExoticComponent<ButtonProps & React_2.RefAttributes<PieButton_2> & ReactBaseType>;
|
|
95
95
|
|
|
96
96
|
/**
|
|
97
97
|
* @tagname pie-button
|
|
@@ -142,6 +142,8 @@ declare class PieButton_2 extends PieButton_base implements ButtonProps {
|
|
|
142
142
|
|
|
143
143
|
declare const PieButton_base: GenericConstructor<FormControlInterface> & typeof LitElement;
|
|
144
144
|
|
|
145
|
+
declare type ReactBaseType = React_2.ButtonHTMLAttributes<HTMLButtonElement>;
|
|
146
|
+
|
|
145
147
|
export declare const responsiveSizes: readonly ["productive", "expressive"];
|
|
146
148
|
|
|
147
149
|
export declare const sizes: readonly ["xsmall", "small-productive", "small-expressive", "medium", "large"];
|
package/dist/react.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import * as t from "react";
|
|
2
2
|
import { createComponent as e } from "@lit/react";
|
|
3
3
|
import { PieButton as o } from "./index.js";
|
|
4
|
-
import { formEncodingtypes as y, formMethodTypes as
|
|
4
|
+
import { formEncodingtypes as y, formMethodTypes as B, formTargetTypes as l, iconPlacements as d, responsiveSizes as g, sizes as v, types as T, variants as x } from "./index.js";
|
|
5
5
|
import "lit";
|
|
6
6
|
import "lit/decorators.js";
|
|
7
7
|
import "lit/directives/if-defined.js";
|
|
8
8
|
import "@justeattakeaway/pie-webc-core";
|
|
9
9
|
import "@justeattakeaway/pie-spinner";
|
|
10
|
-
const
|
|
10
|
+
const r = e({
|
|
11
11
|
displayName: "PieButton",
|
|
12
12
|
elementClass: o,
|
|
13
13
|
react: t,
|
|
14
14
|
tagName: "pie-button",
|
|
15
15
|
events: {}
|
|
16
|
-
});
|
|
16
|
+
}), f = r;
|
|
17
17
|
export {
|
|
18
|
-
|
|
18
|
+
f as PieButton,
|
|
19
19
|
y as formEncodingtypes,
|
|
20
|
-
|
|
20
|
+
B as formMethodTypes,
|
|
21
21
|
l as formTargetTypes,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
d as iconPlacements,
|
|
23
|
+
g as responsiveSizes,
|
|
24
|
+
v as sizes,
|
|
25
|
+
T as types,
|
|
26
|
+
x as variants
|
|
27
27
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@justeattakeaway/pie-button",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.45.1",
|
|
4
4
|
"description": "PIE design system button built using web components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"license": "Apache-2.0",
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@custom-elements-manifest/analyzer": "0.9.0",
|
|
35
|
-
"@justeattakeaway/pie-components-config": "0.
|
|
36
|
-
"@justeattakeaway/pie-wrapper-react": "0.
|
|
35
|
+
"@justeattakeaway/pie-components-config": "0.9.0",
|
|
36
|
+
"@justeattakeaway/pie-wrapper-react": "0.14.0",
|
|
37
37
|
"cem-plugin-module-file-extensions": "0.0.5"
|
|
38
38
|
},
|
|
39
39
|
"volta": {
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"dist/*.js"
|
|
45
45
|
],
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@justeattakeaway/pie-spinner": "0.
|
|
48
|
-
"@justeattakeaway/pie-webc-core": "0.
|
|
49
|
-
"element-internals-polyfill": "1.3.
|
|
47
|
+
"@justeattakeaway/pie-spinner": "0.5.1",
|
|
48
|
+
"@justeattakeaway/pie-webc-core": "0.17.1",
|
|
49
|
+
"element-internals-polyfill": "1.3.10"
|
|
50
50
|
}
|
|
51
51
|
}
|
package/src/defs.ts
CHANGED
|
@@ -17,15 +17,15 @@ export interface ButtonProps {
|
|
|
17
17
|
/**
|
|
18
18
|
* What size the button should be.
|
|
19
19
|
*/
|
|
20
|
-
size
|
|
20
|
+
size?: typeof sizes[number];
|
|
21
21
|
/**
|
|
22
22
|
* What type attribute should be applied to the button. For example submit, button.
|
|
23
23
|
*/
|
|
24
|
-
type
|
|
24
|
+
type?: typeof types[number];
|
|
25
25
|
/**
|
|
26
26
|
* What style variant the button should be such as primary, outline or ghost.
|
|
27
27
|
*/
|
|
28
|
-
variant
|
|
28
|
+
variant?: Variant;
|
|
29
29
|
/**
|
|
30
30
|
* The placement of the icon slot, if provided, such as leading or trailing
|
|
31
31
|
*/
|
|
@@ -33,20 +33,20 @@ export interface ButtonProps {
|
|
|
33
33
|
/**
|
|
34
34
|
* When true, the button element is disabled.
|
|
35
35
|
*/
|
|
36
|
-
disabled
|
|
36
|
+
disabled?: boolean;
|
|
37
37
|
/**
|
|
38
38
|
* When true, the button element will occupy the full width of its container.
|
|
39
39
|
*/
|
|
40
|
-
isFullWidth
|
|
40
|
+
isFullWidth?: boolean;
|
|
41
41
|
/**
|
|
42
42
|
* When true, displays a loading indicator inside the button.
|
|
43
43
|
*/
|
|
44
|
-
isLoading
|
|
44
|
+
isLoading?: boolean;
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
47
|
* When true, enables the responsive size feature.
|
|
48
48
|
*/
|
|
49
|
-
isResponsive
|
|
49
|
+
isResponsive?: boolean;
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
52
|
* The name of the button, submitted as a pair with the button's value as part of the form data, when that button is used to submit the form.
|
package/src/index.ts
CHANGED
|
@@ -197,7 +197,7 @@ export class PieButton extends FormControlMixin(LitElement) implements ButtonPro
|
|
|
197
197
|
*/
|
|
198
198
|
private renderSpinner (): TemplateResult {
|
|
199
199
|
const { size, variant, disabled } = this;
|
|
200
|
-
const spinnerSize = size.includes('small') ? 'small' : 'medium'; // includes("small") matches for any small size value and xsmall
|
|
200
|
+
const spinnerSize = size && size.includes('small') ? 'small' : 'medium'; // includes("small") matches for any small size value and xsmall
|
|
201
201
|
let spinnerVariant;
|
|
202
202
|
if (disabled) {
|
|
203
203
|
spinnerVariant = variant === 'ghost-inverse' ? 'inverse' : 'secondary';
|
|
@@ -230,9 +230,9 @@ export class PieButton extends FormControlMixin(LitElement) implements ButtonPro
|
|
|
230
230
|
<button
|
|
231
231
|
@click=${this._handleClick}
|
|
232
232
|
class="o-btn"
|
|
233
|
-
type=${type}
|
|
234
|
-
variant=${variant}
|
|
235
|
-
size=${size}
|
|
233
|
+
type=${type || 'submit'}
|
|
234
|
+
variant=${variant || 'primary'}
|
|
235
|
+
size=${size || 'medium'}
|
|
236
236
|
responsiveSize=${ifDefined(responsiveSize)}
|
|
237
237
|
?disabled=${disabled}
|
|
238
238
|
?isFullWidth=${isFullWidth}
|
package/src/react.ts
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
|
-
|
|
2
1
|
import * as React from 'react';
|
|
3
2
|
import { createComponent } from '@lit/react';
|
|
4
|
-
import { PieButton as
|
|
3
|
+
import { PieButton as PieButtonLit } from './index';
|
|
4
|
+
import { ButtonProps } from './defs';
|
|
5
5
|
|
|
6
6
|
export * from './defs';
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
const PieButtonReact = createComponent({
|
|
9
9
|
displayName: 'PieButton',
|
|
10
|
-
elementClass:
|
|
10
|
+
elementClass: PieButtonLit,
|
|
11
11
|
react: React,
|
|
12
12
|
tagName: 'pie-button',
|
|
13
13
|
events: {},
|
|
14
14
|
});
|
|
15
|
+
|
|
16
|
+
type ReactBaseType = React.ButtonHTMLAttributes<HTMLButtonElement>
|
|
17
|
+
|
|
18
|
+
export const PieButton = PieButtonReact as React.ForwardRefExoticComponent<React.PropsWithoutRef<ButtonProps>
|
|
19
|
+
& React.RefAttributes<PieButtonLit> & ReactBaseType>;
|