@justeattakeaway/pie-button 0.37.1 → 0.38.1-next.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/README.md +3 -1
- package/dist/index.d.ts +12 -0
- package/dist/index.js +278 -266
- package/dist/react.d.ts +13 -1
- package/dist/react.js +39 -60
- package/package.json +4 -4
- package/src/button.scss +74 -33
- package/src/defs.ts +11 -0
- package/src/index.ts +11 -0
package/README.md
CHANGED
|
@@ -86,6 +86,7 @@ import { PieButton } from '@justeattakeaway/pie-button/dist/react';
|
|
|
86
86
|
| disabled | `Boolean` | `false` | If `true`, disables the button. |
|
|
87
87
|
| isFullWidth | `Boolean` | `false` | If `true`, sets the button width to 100% of its container. |
|
|
88
88
|
| isLoading | `Boolean` | `false` | If `true`, displays a loading indicator inside the button. |
|
|
89
|
+
| isResponsive | `Boolean` | `false` | If `true`, uses the next larger size on wide viewports. |
|
|
89
90
|
| iconPlacement | `String` | `leading` | Icon placements of the icon slot, if provided, one of `iconPlacements` - `leading`, `trailing` |
|
|
90
91
|
| name | `String` | `undefined`| The name of the button, to be submitted with form data. [Read further on MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-name) |
|
|
91
92
|
| value | `String` | `undefined`| The value of the button, to be submitted with form data. [Read further on MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-value) |
|
|
@@ -94,6 +95,7 @@ import { PieButton } from '@justeattakeaway/pie-button/dist/react';
|
|
|
94
95
|
| formmethod | `String` | `undefined`| Sets the HTTP method for form data. [Read further on MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-formmethod) |
|
|
95
96
|
| formnovalidate | `Boolean` | `undefined` | Ensures the form is submitted without native HTML validation. [Read further on MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-formnovalidate) |
|
|
96
97
|
| formtarget | `String` | `undefined`| Dictates where to display the response after form submission. [Read further on MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-formtarget) |
|
|
98
|
+
| responsiveSize | `String` | `productive`| Sets a specific size for xsmall button when rendered as responsive. It can be `productive` or `expressive`. |
|
|
97
99
|
|
|
98
100
|
|
|
99
101
|
In your markup or JSX, you can then use these to set the properties for the `pie-button` component:
|
|
@@ -202,4 +204,4 @@ In this example:
|
|
|
202
204
|
|
|
203
205
|
## Contributing
|
|
204
206
|
|
|
205
|
-
Check out our [contributing guide](https://github.com/justeattakeaway/pie/wiki/Contributing-Guide) for more information on [local development](https://github.com/justeattakeaway/pie/wiki/Contributing-Guide#local-development) and how to run specific [component tests](https://github.com/justeattakeaway/pie/wiki/Contributing-Guide#testing).
|
|
207
|
+
Check out our [contributing guide](https://github.com/justeattakeaway/pie/wiki/Contributing-Guide) for more information on [local development](https://github.com/justeattakeaway/pie/wiki/Contributing-Guide#local-development) and how to run specific [component tests](https://github.com/justeattakeaway/pie/wiki/Contributing-Guide#testing).
|
package/dist/index.d.ts
CHANGED
|
@@ -32,6 +32,10 @@ export declare interface ButtonProps {
|
|
|
32
32
|
* When true, displays a loading indicator inside the button.
|
|
33
33
|
*/
|
|
34
34
|
isLoading: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* When true, enables the responsive size feature.
|
|
37
|
+
*/
|
|
38
|
+
isResponsive: boolean;
|
|
35
39
|
/**
|
|
36
40
|
* 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.
|
|
37
41
|
* [MDN reference](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attributes)
|
|
@@ -70,6 +74,10 @@ export declare interface ButtonProps {
|
|
|
70
74
|
* [MDN reference](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attributes)
|
|
71
75
|
*/
|
|
72
76
|
formtarget?: typeof formTargetTypes[number];
|
|
77
|
+
/**
|
|
78
|
+
* What size should be attributed to the button when isResponsive is true and the screen is wide.
|
|
79
|
+
*/
|
|
80
|
+
responsiveSize?: typeof responsiveSizes[number];
|
|
73
81
|
}
|
|
74
82
|
|
|
75
83
|
export declare const formEncodingtypes: readonly ["application/x-www-form-urlencoded", "multipart/form-data", "text/plain"];
|
|
@@ -100,6 +108,7 @@ export declare class PieButton extends LitElement implements ButtonProps {
|
|
|
100
108
|
disabled: boolean;
|
|
101
109
|
isLoading: boolean;
|
|
102
110
|
isFullWidth: boolean;
|
|
111
|
+
isResponsive: boolean;
|
|
103
112
|
name?: string;
|
|
104
113
|
value?: string;
|
|
105
114
|
formaction: ButtonProps['formaction'];
|
|
@@ -107,6 +116,7 @@ export declare class PieButton extends LitElement implements ButtonProps {
|
|
|
107
116
|
formmethod: ButtonProps['formmethod'];
|
|
108
117
|
formnovalidate: ButtonProps['formnovalidate'];
|
|
109
118
|
formtarget: ButtonProps['formtarget'];
|
|
119
|
+
responsiveSize?: ButtonProps['responsiveSize'];
|
|
110
120
|
/**
|
|
111
121
|
* This method creates an invisible button of the same type as pie-button. It is then clicked, and immediately removed from the DOM.
|
|
112
122
|
* This is done so that we trigger native form actions, such as submit and reset in the browser. The performance impact of adding and removing a single button to the DOM
|
|
@@ -129,6 +139,8 @@ export declare class PieButton extends LitElement implements ButtonProps {
|
|
|
129
139
|
static styles: CSSResult;
|
|
130
140
|
}
|
|
131
141
|
|
|
142
|
+
export declare const responsiveSizes: readonly ["productive", "expressive"];
|
|
143
|
+
|
|
132
144
|
export declare const sizes: readonly ["xsmall", "small-productive", "small-expressive", "medium", "large"];
|
|
133
145
|
|
|
134
146
|
export declare const types: readonly ["submit", "button", "reset"];
|