@justeattakeaway/pie-select 0.2.0 → 0.3.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 +119 -81
- package/dist/index.d.ts +147 -33
- package/dist/index.js +143 -76
- package/dist/react.d.ts +156 -7
- package/dist/react.js +6 -3
- package/package.json +2 -1
- package/src/defs.ts +57 -2
- package/src/index.ts +113 -17
- package/src/react.ts +9 -3
- package/dist/defs.d.ts +0 -29
- package/dist/defs.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/pie-option/defs.d.ts +0 -3
- package/dist/pie-option/defs.d.ts.map +0 -1
- package/dist/pie-option/index.d.ts +0 -15
- package/dist/pie-option/index.d.ts.map +0 -1
- package/dist/pie-option/index.js +0 -9
- package/dist/pie-option/react.d.ts +0 -7
- package/dist/pie-option/react.d.ts.map +0 -1
- package/dist/pie-option/react.js +0 -13
- package/dist/pie-option-group/defs.d.ts +0 -3
- package/dist/pie-option-group/defs.d.ts.map +0 -1
- package/dist/pie-option-group/index.d.ts +0 -15
- package/dist/pie-option-group/index.d.ts.map +0 -1
- package/dist/pie-option-group/index.js +0 -9
- package/dist/pie-option-group/react.d.ts +0 -7
- package/dist/pie-option-group/react.d.ts.map +0 -1
- package/dist/pie-option-group/react.js +0 -13
- package/dist/react.d.ts.map +0 -1
- package/src/pie-option/defs-react.ts +0 -3
- package/src/pie-option/defs.ts +0 -3
- package/src/pie-option/index.ts +0 -20
- package/src/pie-option-group/defs-react.ts +0 -3
- package/src/pie-option-group/defs.ts +0 -3
- package/src/pie-option-group/index.ts +0 -20
package/custom-elements.json
CHANGED
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"type": {
|
|
35
35
|
"text": "DefaultProps"
|
|
36
36
|
},
|
|
37
|
-
"default": "{\n size: 'medium',\n status: 'default',\n disabled: false,\n}"
|
|
37
|
+
"default": "{\n size: 'medium',\n status: 'default',\n disabled: false,\n options: [],\n}"
|
|
38
38
|
}
|
|
39
39
|
],
|
|
40
40
|
"exports": [
|
|
@@ -118,14 +118,31 @@
|
|
|
118
118
|
"privacy": "public",
|
|
119
119
|
"attribute": "name"
|
|
120
120
|
},
|
|
121
|
+
{
|
|
122
|
+
"kind": "field",
|
|
123
|
+
"name": "options",
|
|
124
|
+
"type": {
|
|
125
|
+
"text": "SelectProps['options']"
|
|
126
|
+
},
|
|
127
|
+
"privacy": "public",
|
|
128
|
+
"attribute": "options"
|
|
129
|
+
},
|
|
121
130
|
{
|
|
122
131
|
"kind": "field",
|
|
123
132
|
"name": "focusTarget",
|
|
124
133
|
"type": {
|
|
125
|
-
"text": "
|
|
134
|
+
"text": "HTMLSelectElement"
|
|
126
135
|
},
|
|
127
136
|
"privacy": "public"
|
|
128
137
|
},
|
|
138
|
+
{
|
|
139
|
+
"kind": "field",
|
|
140
|
+
"name": "_select",
|
|
141
|
+
"type": {
|
|
142
|
+
"text": "HTMLSelectElement"
|
|
143
|
+
},
|
|
144
|
+
"privacy": "private"
|
|
145
|
+
},
|
|
129
146
|
{
|
|
130
147
|
"kind": "field",
|
|
131
148
|
"name": "_leadingIconSlot",
|
|
@@ -143,15 +160,103 @@
|
|
|
143
160
|
"privacy": "private",
|
|
144
161
|
"default": "false"
|
|
145
162
|
},
|
|
163
|
+
{
|
|
164
|
+
"kind": "field",
|
|
165
|
+
"name": "validity",
|
|
166
|
+
"type": {
|
|
167
|
+
"text": "ValidityState"
|
|
168
|
+
},
|
|
169
|
+
"privacy": "public",
|
|
170
|
+
"description": "(Read-only) returns a ValidityState with the validity states that this element is in.\nhttps://developer.mozilla.org/en-US/docs/Web/API/HTMLObjectElement/validity",
|
|
171
|
+
"readonly": true
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
"kind": "method",
|
|
175
|
+
"name": "formDisabledCallback",
|
|
176
|
+
"privacy": "public",
|
|
177
|
+
"return": {
|
|
178
|
+
"type": {
|
|
179
|
+
"text": "void"
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
"parameters": [
|
|
183
|
+
{
|
|
184
|
+
"name": "disabled",
|
|
185
|
+
"type": {
|
|
186
|
+
"text": "boolean"
|
|
187
|
+
},
|
|
188
|
+
"description": "The latest disabled state of the select."
|
|
189
|
+
}
|
|
190
|
+
],
|
|
191
|
+
"description": "Called after the disabled state of the element changes,\neither because the disabled attribute of this element was added or removed;\nor because the disabled state changed on a <fieldset> that's an ancestor of this element."
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
"kind": "method",
|
|
195
|
+
"name": "formResetCallback",
|
|
196
|
+
"privacy": "public",
|
|
197
|
+
"return": {
|
|
198
|
+
"type": {
|
|
199
|
+
"text": "void"
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
"description": "Called when the form that owns this component is reset.\nResets the value to the default select value."
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
"kind": "field",
|
|
206
|
+
"name": "_handleChange",
|
|
207
|
+
"privacy": "private",
|
|
208
|
+
"description": "Captures the native change event and wraps it in a custom event.",
|
|
209
|
+
"parameters": [
|
|
210
|
+
{
|
|
211
|
+
"description": "The change event.",
|
|
212
|
+
"name": "event"
|
|
213
|
+
}
|
|
214
|
+
]
|
|
215
|
+
},
|
|
146
216
|
{
|
|
147
217
|
"kind": "method",
|
|
148
218
|
"name": "_handleLeadingIconSlotchange",
|
|
149
219
|
"privacy": "private"
|
|
150
220
|
},
|
|
221
|
+
{
|
|
222
|
+
"kind": "method",
|
|
223
|
+
"name": "renderChildren",
|
|
224
|
+
"privacy": "private",
|
|
225
|
+
"return": {
|
|
226
|
+
"type": {
|
|
227
|
+
"text": ""
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
"parameters": [
|
|
231
|
+
{
|
|
232
|
+
"name": "options",
|
|
233
|
+
"type": {
|
|
234
|
+
"text": "SelectProps['options']"
|
|
235
|
+
},
|
|
236
|
+
"description": "The options to render"
|
|
237
|
+
}
|
|
238
|
+
],
|
|
239
|
+
"description": "Renders the options from the options property"
|
|
240
|
+
},
|
|
151
241
|
{
|
|
152
242
|
"kind": "method",
|
|
153
243
|
"name": "renderAssistiveText",
|
|
154
|
-
"privacy": "private"
|
|
244
|
+
"privacy": "private",
|
|
245
|
+
"return": {
|
|
246
|
+
"type": {
|
|
247
|
+
"text": ""
|
|
248
|
+
}
|
|
249
|
+
},
|
|
250
|
+
"description": "Renders the assistive text if available."
|
|
251
|
+
}
|
|
252
|
+
],
|
|
253
|
+
"events": [
|
|
254
|
+
{
|
|
255
|
+
"type": {
|
|
256
|
+
"text": "CustomEvent"
|
|
257
|
+
},
|
|
258
|
+
"description": "when the selected option is changed.",
|
|
259
|
+
"name": "change"
|
|
155
260
|
}
|
|
156
261
|
],
|
|
157
262
|
"attributes": [
|
|
@@ -180,9 +285,20 @@
|
|
|
180
285
|
"text": "SelectProps['name']"
|
|
181
286
|
},
|
|
182
287
|
"fieldName": "name"
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
"name": "options",
|
|
291
|
+
"type": {
|
|
292
|
+
"text": "SelectProps['options']"
|
|
293
|
+
},
|
|
294
|
+
"fieldName": "options"
|
|
183
295
|
}
|
|
184
296
|
],
|
|
185
297
|
"mixins": [
|
|
298
|
+
{
|
|
299
|
+
"name": "FormControlMixin",
|
|
300
|
+
"package": "@justeattakeaway/pie-webc-core"
|
|
301
|
+
},
|
|
186
302
|
{
|
|
187
303
|
"name": "RtlMixin",
|
|
188
304
|
"package": "@justeattakeaway/pie-webc-core"
|
|
@@ -214,84 +330,6 @@
|
|
|
214
330
|
}
|
|
215
331
|
}
|
|
216
332
|
]
|
|
217
|
-
},
|
|
218
|
-
{
|
|
219
|
-
"kind": "javascript-module",
|
|
220
|
-
"path": "src/pie-option/defs-react.js",
|
|
221
|
-
"declarations": [],
|
|
222
|
-
"exports": []
|
|
223
|
-
},
|
|
224
|
-
{
|
|
225
|
-
"kind": "javascript-module",
|
|
226
|
-
"path": "src/pie-option/defs.js",
|
|
227
|
-
"declarations": [],
|
|
228
|
-
"exports": []
|
|
229
|
-
},
|
|
230
|
-
{
|
|
231
|
-
"kind": "javascript-module",
|
|
232
|
-
"path": "src/pie-option/index.js",
|
|
233
|
-
"declarations": [
|
|
234
|
-
{
|
|
235
|
-
"kind": "class",
|
|
236
|
-
"description": "",
|
|
237
|
-
"name": "PieOption",
|
|
238
|
-
"superclass": {
|
|
239
|
-
"name": "LitElement",
|
|
240
|
-
"package": "lit"
|
|
241
|
-
},
|
|
242
|
-
"tagName": "pie-option",
|
|
243
|
-
"customElement": true
|
|
244
|
-
}
|
|
245
|
-
],
|
|
246
|
-
"exports": [
|
|
247
|
-
{
|
|
248
|
-
"kind": "js",
|
|
249
|
-
"name": "PieOption",
|
|
250
|
-
"declaration": {
|
|
251
|
-
"name": "PieOption",
|
|
252
|
-
"module": "src/pie-option/index.js"
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
]
|
|
256
|
-
},
|
|
257
|
-
{
|
|
258
|
-
"kind": "javascript-module",
|
|
259
|
-
"path": "src/pie-option-group/defs-react.js",
|
|
260
|
-
"declarations": [],
|
|
261
|
-
"exports": []
|
|
262
|
-
},
|
|
263
|
-
{
|
|
264
|
-
"kind": "javascript-module",
|
|
265
|
-
"path": "src/pie-option-group/defs.js",
|
|
266
|
-
"declarations": [],
|
|
267
|
-
"exports": []
|
|
268
|
-
},
|
|
269
|
-
{
|
|
270
|
-
"kind": "javascript-module",
|
|
271
|
-
"path": "src/pie-option-group/index.js",
|
|
272
|
-
"declarations": [
|
|
273
|
-
{
|
|
274
|
-
"kind": "class",
|
|
275
|
-
"description": "",
|
|
276
|
-
"name": "PieOptionGroup",
|
|
277
|
-
"superclass": {
|
|
278
|
-
"name": "LitElement",
|
|
279
|
-
"package": "lit"
|
|
280
|
-
},
|
|
281
|
-
"tagName": "pie-option-group",
|
|
282
|
-
"customElement": true
|
|
283
|
-
}
|
|
284
|
-
],
|
|
285
|
-
"exports": [
|
|
286
|
-
{
|
|
287
|
-
"kind": "js",
|
|
288
|
-
"name": "PieOptionGroup",
|
|
289
|
-
"declaration": {
|
|
290
|
-
"name": "PieOptionGroup",
|
|
291
|
-
"module": "src/pie-option-group/index.js"
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
]
|
|
295
333
|
}
|
|
296
334
|
]
|
|
297
335
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,33 +1,147 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
1
|
+
import { ComponentDefaultProps } from '@justeattakeaway/pie-webc-core';
|
|
2
|
+
import type { CSSResult } from 'lit';
|
|
3
|
+
import type { FormControlInterface } from '@justeattakeaway/pie-webc-core';
|
|
4
|
+
import type { GenericConstructor } from '@justeattakeaway/pie-webc-core';
|
|
5
|
+
import type { LitElement } from 'lit';
|
|
6
|
+
import type { RTLInterface } from '@justeattakeaway/pie-webc-core';
|
|
7
|
+
import type { TemplateResult } from 'lit';
|
|
8
|
+
|
|
9
|
+
declare type DefaultProps = ComponentDefaultProps<SelectProps, keyof Omit<SelectProps, 'name' | 'assistiveText'>>;
|
|
10
|
+
|
|
11
|
+
export declare const defaultProps: DefaultProps;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @tagname pie-select
|
|
15
|
+
* @event {CustomEvent} change - when the selected option is changed.
|
|
16
|
+
*/
|
|
17
|
+
export declare class PieSelect extends PieSelect_base implements SelectProps {
|
|
18
|
+
static shadowRootOptions: {
|
|
19
|
+
delegatesFocus: boolean;
|
|
20
|
+
mode: ShadowRootMode;
|
|
21
|
+
slotAssignment?: SlotAssignmentMode | undefined;
|
|
22
|
+
};
|
|
23
|
+
size: "small" | "medium" | "large";
|
|
24
|
+
disabled: boolean;
|
|
25
|
+
status: "default" | "error";
|
|
26
|
+
assistiveText: SelectProps['assistiveText'];
|
|
27
|
+
name: SelectProps['name'];
|
|
28
|
+
options: SelectProps['options'];
|
|
29
|
+
focusTarget: HTMLSelectElement;
|
|
30
|
+
private _select;
|
|
31
|
+
private _leadingIconSlot;
|
|
32
|
+
private _hasLeadingIcon;
|
|
33
|
+
protected firstUpdated(): void;
|
|
34
|
+
/**
|
|
35
|
+
* (Read-only) returns a ValidityState with the validity states that this element is in.
|
|
36
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/HTMLObjectElement/validity
|
|
37
|
+
*/
|
|
38
|
+
get validity(): ValidityState;
|
|
39
|
+
/**
|
|
40
|
+
* Called after the disabled state of the element changes,
|
|
41
|
+
* either because the disabled attribute of this element was added or removed;
|
|
42
|
+
* or because the disabled state changed on a <fieldset> that's an ancestor of this element.
|
|
43
|
+
* @param disabled - The latest disabled state of the select.
|
|
44
|
+
*/
|
|
45
|
+
formDisabledCallback(disabled: boolean): void;
|
|
46
|
+
/**
|
|
47
|
+
* Called when the form that owns this component is reset.
|
|
48
|
+
* Resets the value to the default select value.
|
|
49
|
+
*/
|
|
50
|
+
formResetCallback(): void;
|
|
51
|
+
/**
|
|
52
|
+
* Captures the native change event and wraps it in a custom event.
|
|
53
|
+
* @param event - The change event.
|
|
54
|
+
*/
|
|
55
|
+
private _handleChange;
|
|
56
|
+
private _handleLeadingIconSlotchange;
|
|
57
|
+
/**
|
|
58
|
+
* Renders the options from the options property
|
|
59
|
+
* @param options - The options to render
|
|
60
|
+
* @returns A template result with the rendered options
|
|
61
|
+
*/
|
|
62
|
+
private renderChildren;
|
|
63
|
+
/**
|
|
64
|
+
* Renders the assistive text if available.
|
|
65
|
+
* @returns A template result with the assistive text
|
|
66
|
+
*/
|
|
67
|
+
private renderAssistiveText;
|
|
68
|
+
render(): TemplateResult<1>;
|
|
69
|
+
static styles: CSSResult;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
declare const PieSelect_base: GenericConstructor<FormControlInterface> & GenericConstructor<RTLInterface> & typeof LitElement;
|
|
73
|
+
|
|
74
|
+
declare interface SelectOptionGroupProps {
|
|
75
|
+
/**
|
|
76
|
+
* What HTML element the option should be such option or optgroup.
|
|
77
|
+
*/
|
|
78
|
+
tag: 'optgroup';
|
|
79
|
+
/**
|
|
80
|
+
* The label for the select option group.
|
|
81
|
+
*/
|
|
82
|
+
label?: string;
|
|
83
|
+
/**
|
|
84
|
+
* The options within the select option group.
|
|
85
|
+
*/
|
|
86
|
+
options: SelectOptionProps[];
|
|
87
|
+
/**
|
|
88
|
+
* Same as the HTML disabled attribute - indicates whether the select option group is disabled.
|
|
89
|
+
*/
|
|
90
|
+
disabled?: boolean;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
declare interface SelectOptionProps {
|
|
94
|
+
/**
|
|
95
|
+
* What HTML element the option should be such option or optgroup.
|
|
96
|
+
*/
|
|
97
|
+
tag: 'option';
|
|
98
|
+
/**
|
|
99
|
+
* The text content to display for the select option.
|
|
100
|
+
*/
|
|
101
|
+
text: string;
|
|
102
|
+
/**
|
|
103
|
+
* The value of the select option (used as a key/value pair in HTML forms with `name`).
|
|
104
|
+
*/
|
|
105
|
+
value?: string;
|
|
106
|
+
/**
|
|
107
|
+
* Same as the HTML disabled attribute - indicates whether the select option is disabled.
|
|
108
|
+
*/
|
|
109
|
+
disabled?: boolean;
|
|
110
|
+
/**
|
|
111
|
+
* Same as the HTML selected attribute - indicates whether the select option is selected by default when the page first loads.
|
|
112
|
+
*/
|
|
113
|
+
selected?: boolean;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export declare interface SelectProps {
|
|
117
|
+
/**
|
|
118
|
+
* The size of the select component. Can be `small`, `medium` or `large`. Defaults to `medium`.
|
|
119
|
+
*/
|
|
120
|
+
size?: typeof sizes[number];
|
|
121
|
+
/**
|
|
122
|
+
* Same as the HTML disabled attribute - indicates whether the select is disabled.
|
|
123
|
+
*/
|
|
124
|
+
disabled?: boolean;
|
|
125
|
+
/**
|
|
126
|
+
* An optional assistive text to display below the select element. Must be provided when the status is error.
|
|
127
|
+
*/
|
|
128
|
+
assistiveText?: string;
|
|
129
|
+
/**
|
|
130
|
+
* The status of the select component / assistive text. Can be default or error.
|
|
131
|
+
*/
|
|
132
|
+
status?: typeof statusTypes[number];
|
|
133
|
+
/**
|
|
134
|
+
* The name of the select (used as a key/value pair with `value`). This is required in order to work properly with forms.
|
|
135
|
+
*/
|
|
136
|
+
name?: string;
|
|
137
|
+
/**
|
|
138
|
+
* The options to display in the select. Can be an array of option objects or option group objects.
|
|
139
|
+
*/
|
|
140
|
+
options: (SelectOptionProps | SelectOptionGroupProps)[];
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export declare const sizes: readonly ["small", "medium", "large"];
|
|
144
|
+
|
|
145
|
+
export declare const statusTypes: readonly ["default", "error"];
|
|
146
|
+
|
|
147
|
+
export { }
|