@aurodesignsystem/auro-formkit 2.0.0-beta.3 → 2.0.0-beta.4
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/.turbo/cache/013a48308b893dac-meta.json +1 -1
- package/.turbo/cache/02244170c798a2bd-meta.json +1 -1
- package/.turbo/cache/02244170c798a2bd.tar.zst +0 -0
- package/.turbo/cache/051ff97a20add0e2-meta.json +1 -0
- package/.turbo/cache/051ff97a20add0e2.tar.zst +0 -0
- package/.turbo/cache/07ca42419b9f050c-meta.json +1 -1
- package/.turbo/cache/0ea853339c064fa1-meta.json +1 -0
- package/.turbo/cache/0ea853339c064fa1.tar.zst +0 -0
- package/.turbo/cache/16658beec9f4a809-meta.json +1 -0
- package/.turbo/cache/16658beec9f4a809.tar.zst +0 -0
- package/.turbo/cache/17259cf94d8f8925-meta.json +1 -1
- package/.turbo/cache/1b9818717e4bdf9f-meta.json +1 -1
- package/.turbo/cache/1c0f580d37370ba2-meta.json +1 -1
- package/.turbo/cache/1c0f580d37370ba2.tar.zst +0 -0
- package/.turbo/cache/1c99a949ec63ab35-meta.json +1 -1
- package/.turbo/cache/1df4710eef8ed00d-meta.json +1 -0
- package/.turbo/cache/1df4710eef8ed00d.tar.zst +0 -0
- package/.turbo/cache/204b66d1b253e9cc-meta.json +1 -0
- package/.turbo/cache/204b66d1b253e9cc.tar.zst +0 -0
- package/.turbo/cache/257a7a26ea72dbc5-meta.json +1 -1
- package/.turbo/cache/2a5d0939d6fc1052-meta.json +1 -0
- package/.turbo/cache/2a5d0939d6fc1052.tar.zst +0 -0
- package/.turbo/cache/2e3b829fcf75c836-meta.json +1 -0
- package/.turbo/cache/2e3b829fcf75c836.tar.zst +0 -0
- package/.turbo/cache/3bf45120d0cc9bd8-meta.json +1 -1
- package/.turbo/cache/3d380d0d40404cac-meta.json +1 -0
- package/.turbo/cache/3d380d0d40404cac.tar.zst +0 -0
- package/.turbo/cache/3e12285c614db539-meta.json +1 -1
- package/.turbo/cache/45035bf5c4147ccd-meta.json +1 -1
- package/.turbo/cache/5bf2d3f7ba5891e0-meta.json +1 -1
- package/.turbo/cache/5f304c0f37ef25f3-meta.json +1 -1
- package/.turbo/cache/64de7a53e02db647-meta.json +1 -1
- package/.turbo/cache/691a74627ec57993-meta.json +1 -1
- package/.turbo/cache/69aae513b7ec6c7d-meta.json +1 -1
- package/.turbo/cache/6dd67d179191bda8-meta.json +1 -1
- package/.turbo/cache/6dd7058e6703cb35-meta.json +1 -1
- package/.turbo/cache/73e9073a5274616d-meta.json +1 -1
- package/.turbo/cache/773edc0f83c8c5a5-meta.json +1 -1
- package/.turbo/cache/786a822763403879-meta.json +1 -1
- package/.turbo/cache/7e1043cffa69f327-meta.json +1 -1
- package/.turbo/cache/7e1043cffa69f327.tar.zst +0 -0
- package/.turbo/cache/7ffd501e81790676-meta.json +1 -0
- package/.turbo/cache/7ffd501e81790676.tar.zst +0 -0
- package/.turbo/cache/80a13352066a9801-meta.json +1 -1
- package/.turbo/cache/80b5d974184a01df-meta.json +1 -1
- package/.turbo/cache/8954c6073396fadd-meta.json +1 -1
- package/.turbo/cache/8e79bd5c3a16a72e-meta.json +1 -1
- package/.turbo/cache/8e9ebc3df0e18de0-meta.json +1 -0
- package/.turbo/cache/8e9ebc3df0e18de0.tar.zst +0 -0
- package/.turbo/cache/92daa6d7c389d548-meta.json +1 -1
- package/.turbo/cache/973d0eea26083f4b-meta.json +1 -0
- package/.turbo/cache/973d0eea26083f4b.tar.zst +0 -0
- package/.turbo/cache/9c6ad42729c7b2d8-meta.json +1 -0
- package/.turbo/cache/9c6ad42729c7b2d8.tar.zst +0 -0
- package/.turbo/cache/a77bc920ea508bb8-meta.json +1 -1
- package/.turbo/cache/a77bc920ea508bb8.tar.zst +0 -0
- package/.turbo/cache/a9a9d012c83882d8-meta.json +1 -0
- package/.turbo/cache/a9a9d012c83882d8.tar.zst +0 -0
- package/.turbo/cache/b54fc4f664a7a5a0-meta.json +1 -1
- package/.turbo/cache/ba4418918621fbcd-meta.json +1 -1
- package/.turbo/cache/be7c23c37b8ec74b-meta.json +1 -1
- package/.turbo/cache/be7c23c37b8ec74b.tar.zst +0 -0
- package/.turbo/cache/bffc7582905c2a5e-meta.json +1 -1
- package/.turbo/cache/caa0b4ac8d2a04dd-meta.json +1 -1
- package/.turbo/cache/caa0b4ac8d2a04dd.tar.zst +0 -0
- package/.turbo/cache/cc81de9c0b452a7c-meta.json +1 -1
- package/.turbo/cache/d572ebb3c833e8f4-meta.json +1 -1
- package/.turbo/cache/d572ebb3c833e8f4.tar.zst +0 -0
- package/.turbo/cache/d61543843c932504-meta.json +1 -1
- package/.turbo/cache/d61543843c932504.tar.zst +0 -0
- package/.turbo/cache/dad1301ac69bcb85-meta.json +1 -1
- package/.turbo/cache/db361cb6578dca84-meta.json +1 -0
- package/.turbo/cache/db361cb6578dca84.tar.zst +0 -0
- package/.turbo/cache/dea5945f55c6aba5-meta.json +1 -1
- package/.turbo/cache/dea5945f55c6aba5.tar.zst +0 -0
- package/.turbo/cache/e992dab20aeefbaf-meta.json +1 -1
- package/.turbo/cache/e992dab20aeefbaf.tar.zst +0 -0
- package/.turbo/cache/f3ff9040a2196834-meta.json +1 -0
- package/.turbo/cache/f3ff9040a2196834.tar.zst +0 -0
- package/.turbo/cache/f817d89688cefca8-meta.json +1 -0
- package/.turbo/cache/fa132b5b5f0e75f8-meta.json +1 -1
- package/.turbo/cache/fc57c17867dcac3d-meta.json +1 -0
- package/.turbo/cache/fc57c17867dcac3d.tar.zst +0 -0
- package/CHANGELOG.md +18 -0
- package/components/checkbox/.turbo/turbo-build.log +3 -3
- package/components/checkbox/.turbo/turbo-bundler.log +3 -3
- package/components/combobox/.turbo/turbo-build.log +3 -3
- package/components/combobox/demo/api.min.js +407 -113
- package/components/combobox/demo/index.min.js +407 -113
- package/components/combobox/dist/index.js +407 -113
- package/components/counter/.turbo/turbo-build.log +3 -3
- package/components/counter/.turbo/turbo-bundler.log +3 -3
- package/components/datepicker/demo/api.min.js +407 -113
- package/components/datepicker/demo/index.min.js +407 -113
- package/components/datepicker/dist/index.js +407 -113
- package/components/dropdown/.turbo/turbo-build.log +3 -3
- package/components/dropdown/.turbo/turbo-bundler.log +2 -2
- package/components/dropdown/demo/api.md +4 -4
- package/components/dropdown/demo/api.min.js +166 -42
- package/components/dropdown/demo/index.min.js +166 -42
- package/components/dropdown/dist/auro-dropdown.d.ts +93 -34
- package/components/dropdown/dist/auro-dropdown.d.ts.map +1 -1
- package/components/dropdown/dist/auro-dropdownBib.d.ts +9 -3
- package/components/dropdown/dist/auro-dropdownBib.d.ts.map +1 -1
- package/components/dropdown/dist/index.js +166 -42
- package/components/dropdown/src/auro-dropdown.js +154 -39
- package/components/dropdown/src/auro-dropdownBib.js +12 -3
- package/components/dropdown/src/styles/style-css.js +1 -1
- package/components/dropdown/src/styles/style.css +4 -0
- package/components/dropdown/src/styles/style.scss +5 -0
- package/components/form/.turbo/turbo-build.log +3 -3
- package/components/form/.turbo/turbo-bundler.log +3 -3
- package/components/input/.turbo/turbo-build.log +3 -3
- package/components/input/.turbo/turbo-bundler.log +3 -3
- package/components/input/demo/api.md +37 -35
- package/components/input/demo/api.min.js +241 -71
- package/components/input/demo/index.min.js +241 -71
- package/components/input/dist/base-input.d.ts +157 -79
- package/components/input/dist/base-input.d.ts.map +1 -1
- package/components/input/dist/index.js +241 -71
- package/components/input/src/base-input.js +241 -71
- package/components/menu/.turbo/turbo-build.log +3 -3
- package/components/menu/.turbo/turbo-bundler.log +3 -3
- package/components/radio/.turbo/turbo-build.log +3 -3
- package/components/radio/.turbo/turbo-bundler.log +3 -3
- package/components/select/.turbo/turbo-build.log +7 -9
- package/components/select/demo/api.md +39 -100
- package/components/select/demo/api.min.js +292 -169
- package/components/select/demo/index.md +100 -43
- package/components/select/demo/index.min.js +292 -169
- package/components/select/dist/auro-select.d.ts +63 -50
- package/components/select/dist/auro-select.d.ts.map +1 -1
- package/components/select/dist/index.js +287 -151
- package/components/select/src/auro-select.js +102 -102
- package/components/select/src/styles/style-css.js +1 -1
- package/components/select/src/styles/style.css +7 -0
- package/components/select/src/styles/style.scss +11 -1
- package/package.json +1 -1
- package/.turbo/cache/1ab37ce15d9be440-meta.json +0 -1
- package/.turbo/cache/1ab37ce15d9be440.tar.zst +0 -0
- package/.turbo/cache/1de15d89eed2d760-meta.json +0 -1
- package/.turbo/cache/1de15d89eed2d760.tar.zst +0 -0
- package/.turbo/cache/2110a4d14e0d11b2-meta.json +0 -1
- package/.turbo/cache/2110a4d14e0d11b2.tar.zst +0 -0
- package/.turbo/cache/2990aaa7ebc5b967-meta.json +0 -1
- package/.turbo/cache/2990aaa7ebc5b967.tar.zst +0 -0
- package/.turbo/cache/2fd056afdf4eb39d-meta.json +0 -1
- package/.turbo/cache/2fd056afdf4eb39d.tar.zst +0 -0
- package/.turbo/cache/4f92cea2d8c63de2-meta.json +0 -1
- package/.turbo/cache/4f92cea2d8c63de2.tar.zst +0 -0
- package/.turbo/cache/5c16ce3cff5c9dff-meta.json +0 -1
- package/.turbo/cache/5c16ce3cff5c9dff.tar.zst +0 -0
- package/.turbo/cache/784c03fe9fd5ac05-meta.json +0 -1
- package/.turbo/cache/784c03fe9fd5ac05.tar.zst +0 -0
- package/.turbo/cache/87219c41a4ace9cd-meta.json +0 -1
- package/.turbo/cache/87219c41a4ace9cd.tar.zst +0 -0
- package/.turbo/cache/993dff2edb7b6766-meta.json +0 -1
- package/.turbo/cache/993dff2edb7b6766.tar.zst +0 -0
- package/.turbo/cache/9a097d6576dadd64-meta.json +0 -1
- package/.turbo/cache/9a097d6576dadd64.tar.zst +0 -0
- package/.turbo/cache/a63cbfecf0f78586-meta.json +0 -1
- package/.turbo/cache/a63cbfecf0f78586.tar.zst +0 -0
- package/.turbo/cache/a6a56bb802e1c20f-meta.json +0 -1
- package/.turbo/cache/a6a56bb802e1c20f.tar.zst +0 -0
- package/.turbo/cache/b2c66328fdd78093-meta.json +0 -1
- package/.turbo/cache/b2c66328fdd78093.tar.zst +0 -0
- package/.turbo/cache/d39e6ef95ebc4cc0-meta.json +0 -1
- package/.turbo/cache/f411e2deb0676959-meta.json +0 -1
- package/.turbo/cache/f411e2deb0676959.tar.zst +0 -0
- package/.turbo/cache/fbbe2704bf9cb90b-meta.json +0 -1
- package/.turbo/cache/fbbe2704bf9cb90b.tar.zst +0 -0
- /package/.turbo/cache/{d39e6ef95ebc4cc0.tar.zst → f817d89688cefca8.tar.zst} +0 -0
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
// If using litElement base class
|
|
9
9
|
import { LitElement } from "lit";
|
|
10
|
+
import { classMap } from 'lit/directives/class-map.js';
|
|
10
11
|
import { html } from 'lit/static-html.js';
|
|
11
12
|
|
|
12
13
|
import AuroFormValidation from '@auro-formkit/form-validation';
|
|
@@ -25,22 +26,10 @@ import tokensCss from "./styles/tokens-css.js";
|
|
|
25
26
|
/**
|
|
26
27
|
* The auro-select element is a wrapper for auro-dropdown and auro-menu to create a dropdown menu control.
|
|
27
28
|
*
|
|
28
|
-
* @attr {String} validity - Specifies the `validityState` this element is in.
|
|
29
|
-
* @attr {String} setCustomValidity - Sets a custom help text message to display for all validityStates.
|
|
30
|
-
* @attr {String} setCustomValidityCustomError - Custom help text message to display when validity = `customError`.
|
|
31
|
-
* @attr {String} setCustomValidityValueMissing - Custom help text message to display when validity = `valueMissing`.
|
|
32
|
-
* @attr {String} error - When defined, sets persistent validity to `customError` and sets the validation message to the attribute value.
|
|
33
|
-
* @attr {Boolean} noValidate - If set, disables auto-validation on blur.
|
|
34
|
-
* @attr {Boolean} required - Populates the `required` attribute on the element. Used for client-side validation.
|
|
35
|
-
* @attr {Boolean} flexMenuWidth - If set, makes dropdown bib width match the size of the content, rather than the width of the trigger.
|
|
36
|
-
* @prop {String} placeholder - Define placeholder text to display before a value is manually selected.
|
|
37
|
-
* @prop {String} value - Value selected for the component.
|
|
38
|
-
* @prop {Boolean} disabled - When attribute is present element shows disabled state.
|
|
39
|
-
* @prop {Boolean} noCheckmark - When true, checkmark on selected option will no longer be present.
|
|
40
|
-
* @attr {Object} optionSelected - Specifies the current selected menuOption.
|
|
41
29
|
* @slot - Default slot for the menu content.
|
|
42
30
|
* @slot label - Defines the content of the label.
|
|
43
31
|
* @slot helpText - Defines the content of the helpText.
|
|
32
|
+
* @slot placeholder - Defines the content of the placeholder to be shown when there is no value
|
|
44
33
|
* @event auroSelect-valueSet - Notifies that the component has a new value set.
|
|
45
34
|
* @event auroFormElement-validated - Notifies that the `validity` and `errorMessage` values have changed.
|
|
46
35
|
* @csspart helpText - Apply CSS to the help text.
|
|
@@ -51,7 +40,6 @@ export class AuroSelect extends LitElement {
|
|
|
51
40
|
constructor() {
|
|
52
41
|
super();
|
|
53
42
|
|
|
54
|
-
this.placeholder = 'Please select option';
|
|
55
43
|
this.optionSelected = undefined;
|
|
56
44
|
this.validity = undefined;
|
|
57
45
|
|
|
@@ -106,68 +94,118 @@ export class AuroSelect extends LitElement {
|
|
|
106
94
|
// to understand how to use reflected attributes with your property settings.
|
|
107
95
|
static get properties() {
|
|
108
96
|
return {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* When attribute is present, element shows disabled state.
|
|
100
|
+
*/
|
|
101
|
+
disabled: {
|
|
102
|
+
type: Boolean,
|
|
103
|
+
reflect: true
|
|
112
104
|
},
|
|
113
|
-
|
|
114
|
-
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* If set, makes dropdown width match the size of the content, rather than the width of the trigger.
|
|
108
|
+
*/
|
|
109
|
+
flexMenuWidth: {
|
|
110
|
+
type: Boolean,
|
|
111
|
+
reflect: true
|
|
112
|
+
},
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* When true, checkmark on selected option will no longer be present.
|
|
116
|
+
*/
|
|
117
|
+
noCheckmark: {
|
|
118
|
+
type: Boolean,
|
|
119
|
+
reflect: true
|
|
115
120
|
},
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* If set, disables auto-validation on blur.
|
|
124
|
+
*/
|
|
116
125
|
noValidate: {
|
|
117
126
|
type: Boolean,
|
|
118
127
|
reflect: true
|
|
119
128
|
},
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* @private
|
|
132
|
+
*/
|
|
133
|
+
optionActive: {
|
|
134
|
+
type: Object
|
|
135
|
+
},
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Specifies the current selected menuOption.
|
|
139
|
+
*/
|
|
140
|
+
optionSelected: {
|
|
141
|
+
type: Object
|
|
142
|
+
},
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* @private
|
|
146
|
+
*/
|
|
147
|
+
options: {
|
|
148
|
+
type: Array
|
|
149
|
+
},
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Populates the `required` attribute on the element. Used for client-side validation.
|
|
153
|
+
*/
|
|
120
154
|
required: {
|
|
121
155
|
type: Boolean,
|
|
122
156
|
reflect: true
|
|
123
157
|
},
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* When defined, sets persistent validity to `customError` and sets `setCustomValidity` = attribute value.
|
|
161
|
+
*/
|
|
124
162
|
error: {
|
|
125
163
|
type: String,
|
|
126
164
|
reflect: true
|
|
127
165
|
},
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Sets a custom help text message to display for all validityStates.
|
|
169
|
+
*/
|
|
128
170
|
setCustomValidity: {
|
|
129
171
|
type: String
|
|
130
172
|
},
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Custom help text message to display when validity = `customError`.
|
|
176
|
+
*/
|
|
131
177
|
setCustomValidityCustomError: {
|
|
132
178
|
type: String
|
|
133
179
|
},
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Custom help text message to display when validity = `valueMissing`.
|
|
183
|
+
*/
|
|
134
184
|
setCustomValidityValueMissing: {
|
|
135
185
|
type: String
|
|
136
186
|
},
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Specifies the `validityState` this element is in.
|
|
190
|
+
*/
|
|
137
191
|
validity: {
|
|
138
192
|
type: String,
|
|
139
193
|
reflect: true
|
|
140
194
|
},
|
|
141
|
-
disabled: {
|
|
142
|
-
type: Boolean,
|
|
143
|
-
reflect: true
|
|
144
|
-
},
|
|
145
|
-
noCheckmark: {
|
|
146
|
-
type: Boolean,
|
|
147
|
-
reflect: true
|
|
148
|
-
},
|
|
149
|
-
flexMenuWidth: {
|
|
150
|
-
type: Boolean,
|
|
151
|
-
reflect: true
|
|
152
|
-
},
|
|
153
|
-
placeholder: { type: String },
|
|
154
195
|
|
|
155
196
|
/**
|
|
156
|
-
*
|
|
197
|
+
* Value selected for the component.
|
|
157
198
|
*/
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
* @private
|
|
162
|
-
*/
|
|
163
|
-
optionActive: { type: Object },
|
|
199
|
+
value: {
|
|
200
|
+
type: String
|
|
201
|
+
}
|
|
164
202
|
};
|
|
165
203
|
}
|
|
166
204
|
|
|
167
205
|
static get styles() {
|
|
168
206
|
return [
|
|
169
|
-
styleCss,
|
|
170
207
|
colorCss,
|
|
208
|
+
styleCss,
|
|
171
209
|
tokensCss
|
|
172
210
|
];
|
|
173
211
|
}
|
|
@@ -202,36 +240,30 @@ export class AuroSelect extends LitElement {
|
|
|
202
240
|
}
|
|
203
241
|
|
|
204
242
|
/**
|
|
205
|
-
* Updates the displayed value in an Auro dropdown component based on
|
|
206
|
-
* @param {string|HTMLElement} option - The option to display. If a string, a new span element with the value string is created. If an HTMLElement, the selected option is cloned and non-styling attributes are removed.
|
|
243
|
+
* Updates the displayed value in an Auro dropdown component based on optionSelected
|
|
207
244
|
* @private
|
|
208
245
|
* @returns {void}
|
|
209
246
|
*/
|
|
210
|
-
updateDisplayedValue(
|
|
247
|
+
updateDisplayedValue() {
|
|
211
248
|
const triggerContentEl = this.dropdown.querySelector('#triggerFocus');
|
|
212
249
|
|
|
213
250
|
// remove all existing rendered value(s)
|
|
214
|
-
triggerContentEl.querySelectorAll('auro-menuoption, [
|
|
251
|
+
triggerContentEl.querySelectorAll('auro-menuoption, [auro-menuoption]').forEach((elm) => {
|
|
215
252
|
elm.remove();
|
|
216
253
|
});
|
|
217
254
|
|
|
218
|
-
if (
|
|
219
|
-
// create a new span element with the value string
|
|
220
|
-
const valueElem = document.createElement('span');
|
|
221
|
-
valueElem.setAttribute('valuestr', true);
|
|
222
|
-
valueElem.textContent = option;
|
|
223
|
-
|
|
224
|
-
// append the new element into the trigger content
|
|
225
|
-
triggerContentEl.appendChild(valueElem);
|
|
226
|
-
} else if (typeof option === 'object') {
|
|
255
|
+
if (this.optionSelected) {
|
|
227
256
|
// clone the selected option and remove attributes that style it
|
|
228
|
-
const clone =
|
|
257
|
+
const clone = this.optionSelected.cloneNode(true);
|
|
229
258
|
clone.removeAttribute('selected');
|
|
230
259
|
clone.removeAttribute('class');
|
|
231
260
|
|
|
232
261
|
// insert the non-styled clone into the trigger
|
|
233
262
|
triggerContentEl.appendChild(clone);
|
|
234
263
|
}
|
|
264
|
+
|
|
265
|
+
// notify dropdown as trigger content is changed
|
|
266
|
+
this.dropdown.requestUpdate();
|
|
235
267
|
}
|
|
236
268
|
|
|
237
269
|
/**
|
|
@@ -241,7 +273,7 @@ export class AuroSelect extends LitElement {
|
|
|
241
273
|
*/
|
|
242
274
|
configureMenu() {
|
|
243
275
|
this.menu = this.querySelector('auro-menu, [auro-menu]');
|
|
244
|
-
|
|
276
|
+
|
|
245
277
|
// racing condition on custom-select with custom-menu
|
|
246
278
|
if (!this.menu) {
|
|
247
279
|
setTimeout(() => {
|
|
@@ -250,6 +282,7 @@ export class AuroSelect extends LitElement {
|
|
|
250
282
|
return;
|
|
251
283
|
}
|
|
252
284
|
|
|
285
|
+
this.menu.addEventListener("auroMenu-loadingChange", (event) => this.handleMenuLoadingChange(event));
|
|
253
286
|
this.menu.setAttribute('aria-hidden', 'true');
|
|
254
287
|
|
|
255
288
|
this.generateOptionsArray();
|
|
@@ -262,8 +295,6 @@ export class AuroSelect extends LitElement {
|
|
|
262
295
|
this.optionSelected = this.menu.optionSelected;
|
|
263
296
|
this.value = this.optionSelected.value;
|
|
264
297
|
|
|
265
|
-
this.updateDisplayedValue(this.optionSelected);
|
|
266
|
-
|
|
267
298
|
if (this.dropdown.isPopoverVisible) {
|
|
268
299
|
this.dropdown.hide();
|
|
269
300
|
}
|
|
@@ -278,7 +309,11 @@ export class AuroSelect extends LitElement {
|
|
|
278
309
|
*/
|
|
279
310
|
this.menu.addEventListener('auroMenu-selectValueFailure', () => {
|
|
280
311
|
this.reset();
|
|
281
|
-
|
|
312
|
+
});
|
|
313
|
+
|
|
314
|
+
this.menu.addEventListener('auroMenu-selectValueReset', () => {
|
|
315
|
+
this.optionSelected = this.menu.optionSelected;
|
|
316
|
+
this.validation.validate(this);
|
|
282
317
|
});
|
|
283
318
|
}
|
|
284
319
|
|
|
@@ -329,8 +364,6 @@ export class AuroSelect extends LitElement {
|
|
|
329
364
|
this.addEventListener('blur', () => {
|
|
330
365
|
this.validation.validate(this);
|
|
331
366
|
});
|
|
332
|
-
|
|
333
|
-
this.labelForSr();
|
|
334
367
|
}
|
|
335
368
|
|
|
336
369
|
/**
|
|
@@ -449,6 +482,10 @@ export class AuroSelect extends LitElement {
|
|
|
449
482
|
}));
|
|
450
483
|
}
|
|
451
484
|
|
|
485
|
+
if (changedProperties.has('optionSelected')) {
|
|
486
|
+
this.updateDisplayedValue();
|
|
487
|
+
}
|
|
488
|
+
|
|
452
489
|
if (changedProperties.has('error')) {
|
|
453
490
|
this.validation.validate(this, true);
|
|
454
491
|
}
|
|
@@ -462,52 +499,15 @@ export class AuroSelect extends LitElement {
|
|
|
462
499
|
this.validation.reset(this);
|
|
463
500
|
}
|
|
464
501
|
|
|
465
|
-
/**
|
|
466
|
-
* Handles reading of auro-select by screen readers.
|
|
467
|
-
* @private
|
|
468
|
-
* @returns {void}
|
|
469
|
-
*/
|
|
470
|
-
labelForSr() {
|
|
471
|
-
const placeholderLabel = document.createElement("div");
|
|
472
|
-
const textId = "label";
|
|
473
|
-
|
|
474
|
-
placeholderLabel.setAttribute("id", textId);
|
|
475
|
-
placeholderLabel.setAttribute("aria-live", "polite");
|
|
476
|
-
|
|
477
|
-
const styles = {
|
|
478
|
-
position: 'absolute',
|
|
479
|
-
overflow: 'hidden',
|
|
480
|
-
clipPath: 'inset(1px, 1px, 1px, 1px)',
|
|
481
|
-
width: '1px',
|
|
482
|
-
height: '1px',
|
|
483
|
-
padding: '0',
|
|
484
|
-
border: '0'
|
|
485
|
-
};
|
|
486
|
-
|
|
487
|
-
Object.assign(placeholderLabel.style, styles);
|
|
488
|
-
|
|
489
|
-
this.addEventListener('focus', () => {
|
|
490
|
-
document.body.appendChild(placeholderLabel);
|
|
491
|
-
|
|
492
|
-
if (!this.optionSelected) {
|
|
493
|
-
document.getElementById(textId).innerHTML = this.placeholder;
|
|
494
|
-
} else {
|
|
495
|
-
document.getElementById(textId).innerHTML = `${this.optionSelected.innerText}, ${this.placeholder}`;
|
|
496
|
-
}
|
|
497
|
-
});
|
|
498
|
-
|
|
499
|
-
this.addEventListener('blur', () => {
|
|
500
|
-
if (document.contains(placeholderLabel)) {
|
|
501
|
-
document.body.removeChild(placeholderLabel);
|
|
502
|
-
}
|
|
503
|
-
});
|
|
504
|
-
}
|
|
505
|
-
|
|
506
502
|
// When using auroElement, use the following attribute and function when hiding content from screen readers.
|
|
507
503
|
// aria-hidden="${this.hideAudible(this.hiddenAudible)}"
|
|
508
504
|
|
|
509
505
|
// function that renders the HTML and CSS into the scope of the component
|
|
510
506
|
render() {
|
|
507
|
+
const placeholderClass = {
|
|
508
|
+
hidden: this.value,
|
|
509
|
+
};
|
|
510
|
+
|
|
511
511
|
return html`
|
|
512
512
|
<div class="outerWrapper">
|
|
513
513
|
<div aria-live="polite" class="util_displayHiddenVisually">
|
|
@@ -534,7 +534,7 @@ export class AuroSelect extends LitElement {
|
|
|
534
534
|
chevron
|
|
535
535
|
part="dropdown">
|
|
536
536
|
<span slot="trigger" aria-haspopup="true" id="triggerFocus">
|
|
537
|
-
|
|
537
|
+
<span id="placeholder" class="${classMap(placeholderClass)}"><slot name="placeholder"></slot></span>
|
|
538
538
|
</span>
|
|
539
539
|
<div class="menuWrapper">
|
|
540
540
|
</div>
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
export default css`*,*:before,*:after{box-sizing:border-box}@media(prefers-reduced-motion: reduce){*,*:before,*:after{animation-duration:.01ms !important;animation-iteration-count:1 !important;transition-duration:.01ms !important}}*:focus-visible{outline:0}*:focus-visible{outline:0}:focus:not(:focus-visible){outline:3px solid transparent}.util_displayInline{display:inline}.util_displayInlineBlock{display:inline-block}.util_displayBlock{display:block}.util_displayFlex{display:flex}.util_displayHidden{display:none}.util_displayHiddenVisually{position:absolute;overflow:hidden;clip:rect(1px, 1px, 1px, 1px);width:1px;height:1px;padding:0;border:0}[slot=trigger]{width:100%;padding:0;border:0;cursor:pointer;font-family:inherit;font-size:inherit;text-align:left}[slot=trigger] .nestingSpacer{display:none}:host [auro-dropdown]{position:relative}:host [auro-dropdown]::part(trigger){max-height:var(--ds-size-300, 1.5rem)}:host [auro-dropdown]::part(popover){max-width:-webkit-fill-available;overflow-y:scroll}:host([disabled]) *{user-select:none}.outerWrapper{position:relative}auro-menuoption{pointer-events:none}.menuWrapper{padding:var(--ds-size-50, 0.25rem) 0}.selectElement-helpText{margin:var(--ds-size-50, 0.25rem) 0;font-size:var(--ds-text-body-size-xs, 0.75rem);line-height:1rem}`;
|
|
2
|
+
export default css`*,*:before,*:after{box-sizing:border-box}@media(prefers-reduced-motion: reduce){*,*:before,*:after{animation-duration:.01ms !important;animation-iteration-count:1 !important;transition-duration:.01ms !important}}*:focus-visible{outline:0}*:focus-visible{outline:0}:focus:not(:focus-visible){outline:3px solid transparent}.util_displayInline{display:inline}.util_displayInlineBlock{display:inline-block}.util_displayBlock{display:block}.util_displayFlex{display:flex}.util_displayHidden{display:none}.util_displayHiddenVisually{position:absolute;overflow:hidden;clip:rect(1px, 1px, 1px, 1px);width:1px;height:1px;padding:0;border:0}[slot=trigger]{width:100%;padding:0;border:0;cursor:pointer;font-family:inherit;font-size:inherit;text-align:left}[slot=trigger] .nestingSpacer{display:none}[slot=trigger] #placeholder.hidden{position:absolute;z-index:-1;opacity:0;pointer-events:none}:host [auro-dropdown]{position:relative}:host [auro-dropdown]::part(trigger){max-height:var(--ds-size-300, 1.5rem)}:host [auro-dropdown]::part(popover){max-width:-webkit-fill-available;overflow-y:scroll}:host([disabled]) *{user-select:none}.outerWrapper{position:relative}auro-menuoption{padding:0;pointer-events:none}.menuWrapper{padding:var(--ds-size-50, 0.25rem) 0}.selectElement-helpText{margin:var(--ds-size-50, 0.25rem) 0;font-size:var(--ds-text-body-size-xs, 0.75rem);line-height:1rem}`;
|
|
@@ -62,6 +62,12 @@
|
|
|
62
62
|
[slot=trigger] .nestingSpacer {
|
|
63
63
|
display: none;
|
|
64
64
|
}
|
|
65
|
+
[slot=trigger] #placeholder.hidden {
|
|
66
|
+
position: absolute;
|
|
67
|
+
z-index: -1;
|
|
68
|
+
opacity: 0;
|
|
69
|
+
pointer-events: none;
|
|
70
|
+
}
|
|
65
71
|
|
|
66
72
|
:host [auro-dropdown] {
|
|
67
73
|
position: relative;
|
|
@@ -83,6 +89,7 @@
|
|
|
83
89
|
}
|
|
84
90
|
|
|
85
91
|
auro-menuoption {
|
|
92
|
+
padding: 0;
|
|
86
93
|
pointer-events: none;
|
|
87
94
|
}
|
|
88
95
|
|
|
@@ -24,7 +24,16 @@
|
|
|
24
24
|
.nestingSpacer {
|
|
25
25
|
display: none;
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
|
|
28
|
+
#placeholder {
|
|
29
|
+
&.hidden {
|
|
30
|
+
position: absolute;
|
|
31
|
+
z-index: -1;
|
|
32
|
+
opacity: 0;
|
|
33
|
+
pointer-events: none;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
28
37
|
|
|
29
38
|
:host {
|
|
30
39
|
[auro-dropdown] {
|
|
@@ -52,6 +61,7 @@
|
|
|
52
61
|
}
|
|
53
62
|
|
|
54
63
|
auro-menuoption {
|
|
64
|
+
padding: 0;
|
|
55
65
|
pointer-events: none;
|
|
56
66
|
}
|
|
57
67
|
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"hash":"1ab37ce15d9be440","duration":6432}
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"hash":"1de15d89eed2d760","duration":2801}
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"hash":"2110a4d14e0d11b2","duration":19210}
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"hash":"2990aaa7ebc5b967","duration":3836}
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"hash":"2fd056afdf4eb39d","duration":9944}
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"hash":"4f92cea2d8c63de2","duration":2517}
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"hash":"5c16ce3cff5c9dff","duration":2968}
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"hash":"784c03fe9fd5ac05","duration":5298}
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"hash":"87219c41a4ace9cd","duration":19092}
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"hash":"993dff2edb7b6766","duration":1110}
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"hash":"9a097d6576dadd64","duration":1582}
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"hash":"a63cbfecf0f78586","duration":10100}
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"hash":"a6a56bb802e1c20f","duration":1720}
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"hash":"b2c66328fdd78093","duration":930}
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"hash":"d39e6ef95ebc4cc0","duration":21191}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"hash":"f411e2deb0676959","duration":4048}
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"hash":"fbbe2704bf9cb90b","duration":2359}
|
|
Binary file
|
|
File without changes
|