@aurodesignsystem-dev/auro-formkit 0.0.0-pr1536.6 → 0.0.0-pr1537.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/components/checkbox/demo/customize.min.js +1 -1
- package/components/checkbox/demo/getting-started.min.js +1 -1
- package/components/checkbox/demo/index.min.js +1 -1
- package/components/checkbox/dist/index.js +1 -1
- package/components/checkbox/dist/registered.js +1 -1
- package/components/combobox/demo/customize.min.js +3 -8
- package/components/combobox/demo/getting-started.min.js +3 -8
- package/components/combobox/demo/index.min.js +3 -8
- package/components/combobox/dist/index.js +3 -3
- package/components/combobox/dist/registered.js +3 -3
- package/components/counter/demo/customize.min.js +2 -2
- package/components/counter/demo/index.min.js +2 -2
- package/components/counter/dist/index.js +2 -2
- package/components/counter/dist/registered.js +2 -2
- package/components/datepicker/demo/customize.min.js +3 -3
- package/components/datepicker/demo/index.min.js +3 -3
- package/components/datepicker/dist/index.js +3 -3
- package/components/datepicker/dist/registered.js +3 -3
- package/components/dropdown/demo/customize.min.js +1 -1
- package/components/dropdown/demo/getting-started.min.js +1 -1
- package/components/dropdown/demo/index.min.js +1 -1
- package/components/dropdown/dist/index.js +1 -1
- package/components/dropdown/dist/registered.js +1 -1
- package/components/form/demo/api.md +3 -3
- package/components/form/demo/customize.md +368 -97
- package/components/form/demo/customize.min.js +71 -22
- package/components/form/demo/getting-started.md +312 -96
- package/components/form/demo/getting-started.min.js +91 -22
- package/components/form/demo/index.min.js +17 -22
- package/components/form/demo/registerDemoDeps.min.js +13 -18
- package/components/form/dist/auro-form.d.ts +7 -7
- package/components/form/dist/index.js +4 -4
- package/components/form/dist/registered.js +4 -4
- package/components/input/demo/customize.min.js +1 -1
- package/components/input/demo/getting-started.min.js +1 -1
- package/components/input/demo/index.min.js +1 -1
- package/components/input/dist/index.js +1 -1
- package/components/input/dist/registered.js +1 -1
- package/components/menu/demo/css-only.md +5 -5
- package/components/menu/demo/index.min.js +0 -5
- package/components/menu/demo/keyboard-behavior.md +4 -77
- package/components/menu/demo/why-menu.md +4 -4
- package/components/menu/dist/index.js +0 -5
- package/components/menu/dist/registered.js +0 -5
- package/components/radio/demo/customize.min.js +1 -1
- package/components/radio/demo/getting-started.min.js +1 -1
- package/components/radio/demo/index.min.js +1 -1
- package/components/radio/dist/index.js +1 -1
- package/components/radio/dist/registered.js +1 -1
- package/components/select/demo/customize.md +3 -3
- package/components/select/demo/customize.min.js +2 -7
- package/components/select/demo/getting-started.min.js +2 -7
- package/components/select/demo/index.md +1 -1
- package/components/select/demo/index.min.js +2 -7
- package/components/select/demo/keyboard-behavior.md +30 -61
- package/components/select/dist/index.js +2 -2
- package/components/select/dist/registered.js +2 -2
- package/custom-elements.json +553 -553
- package/package.json +1 -1
|
@@ -113,124 +113,395 @@
|
|
|
113
113
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
114
114
|
</auro-accordion>
|
|
115
115
|
<auro-header level="3" id="complexForm">Complex Form</auro-header>
|
|
116
|
-
<p>A
|
|
116
|
+
<p>A realistic booking form that exercises every form element <code>auro-form</code> manages — <code>auro-input</code>, <code>auro-select</code>, <code>auro-combobox</code>, a range <code>auro-datepicker</code>, <code>auro-counter-group</code>, <code>auro-radio-group</code>, and <code>auro-checkbox-group</code> — arranged with nested containers and a reset/submit button group.</p>
|
|
117
117
|
<div class="exampleWrapper">
|
|
118
118
|
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../apiExamples/complex.html) -->
|
|
119
119
|
<!-- The below content is automatically added from ./../apiExamples/complex.html -->
|
|
120
|
-
<
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
<auro-
|
|
120
|
+
<auro-form id="tripForm" class="trip-form">
|
|
121
|
+
<!-- Trip type — auro-radio-group -->
|
|
122
|
+
<div class="form-section">
|
|
123
|
+
<auro-radio-group required name="tripType">
|
|
124
|
+
<span slot="legend">Trip type</span>
|
|
125
|
+
<auro-radio id="trip-roundtrip" name="tripTypeChoice" label="Round trip" value="roundtrip" checked></auro-radio>
|
|
126
|
+
<auro-radio id="trip-oneway" name="tripTypeChoice" label="One way" value="oneway"></auro-radio>
|
|
127
|
+
</auro-radio-group>
|
|
128
|
+
</div>
|
|
129
|
+
<!-- Route — auro-select (from) + auro-combobox (to) -->
|
|
130
|
+
<div class="form-section">
|
|
131
|
+
<h4 class="section-heading">Where are you going?</h4>
|
|
132
|
+
<div class="field-row">
|
|
133
|
+
<auro-select required name="departureAirport">
|
|
134
|
+
<span slot="label">From</span>
|
|
135
|
+
<span slot="bib.fullscreen.headline">Choose a departure city</span>
|
|
136
|
+
<auro-menu>
|
|
137
|
+
<auro-menuoption value="SEA">Seattle (SEA)</auro-menuoption>
|
|
138
|
+
<auro-menuoption value="PDX">Portland (PDX)</auro-menuoption>
|
|
139
|
+
<auro-menuoption value="SFO">San Francisco (SFO)</auro-menuoption>
|
|
140
|
+
<auro-menuoption value="LAX">Los Angeles (LAX)</auro-menuoption>
|
|
141
|
+
<auro-menuoption value="ANC">Anchorage (ANC)</auro-menuoption>
|
|
142
|
+
</auro-menu>
|
|
143
|
+
</auro-select>
|
|
144
|
+
<auro-combobox required name="destination">
|
|
145
|
+
<span slot="label">To</span>
|
|
146
|
+
<span slot="bib.fullscreen.headline">Search destinations</span>
|
|
147
|
+
<auro-menu>
|
|
148
|
+
<auro-menuoption value="HNL">Honolulu (HNL)</auro-menuoption>
|
|
149
|
+
<auro-menuoption value="OGG">Maui (OGG)</auro-menuoption>
|
|
150
|
+
<auro-menuoption value="JFK">New York (JFK)</auro-menuoption>
|
|
151
|
+
<auro-menuoption value="ORD">Chicago (ORD)</auro-menuoption>
|
|
152
|
+
<auro-menuoption value="DFW">Dallas–Fort Worth (DFW)</auro-menuoption>
|
|
153
|
+
<auro-menuoption static nomatch>No matching destinations</auro-menuoption>
|
|
154
|
+
</auro-menu>
|
|
155
|
+
</auro-combobox>
|
|
156
|
+
</div>
|
|
157
|
+
</div>
|
|
158
|
+
<!-- When & who — auro-datepicker (range) + auro-counter-group -->
|
|
159
|
+
<div class="form-section">
|
|
160
|
+
<h4 class="section-heading">When and who?</h4>
|
|
161
|
+
<div class="field-row">
|
|
162
|
+
<auro-datepicker required range name="travelDates">
|
|
163
|
+
<span slot="fromLabel">Departure</span>
|
|
164
|
+
<span slot="toLabel">Return</span>
|
|
165
|
+
<span slot="bib.fullscreen.fromLabel">Departure</span>
|
|
166
|
+
<span slot="bib.fullscreen.toLabel">Return</span>
|
|
167
|
+
</auro-datepicker>
|
|
168
|
+
<auro-counter-group isDropdown max="9" name="travelers">
|
|
169
|
+
<div slot="label">Travelers</div>
|
|
170
|
+
<span slot="bib.fullscreen.headline">Travelers</span>
|
|
171
|
+
<span slot="ariaLabel.bib.close">Close</span>
|
|
172
|
+
<auro-counter name="adults" min="1" max="9" value="1">
|
|
173
|
+
Adults
|
|
174
|
+
<span slot="description">Age 18+</span>
|
|
175
|
+
</auro-counter>
|
|
176
|
+
<auro-counter name="children" min="0" max="8" value="0">
|
|
177
|
+
Children
|
|
178
|
+
<span slot="description">Age 2–17</span>
|
|
179
|
+
</auro-counter>
|
|
180
|
+
<auro-counter name="infants" min="0" max="4" value="0">
|
|
181
|
+
Lap infants
|
|
182
|
+
<span slot="description">Under 2</span>
|
|
183
|
+
</auro-counter>
|
|
184
|
+
</auro-counter-group>
|
|
185
|
+
</div>
|
|
186
|
+
</div>
|
|
187
|
+
<!-- Lead traveler — auro-input -->
|
|
188
|
+
<div class="form-section">
|
|
189
|
+
<h4 class="section-heading">Lead traveler</h4>
|
|
190
|
+
<div class="field-row">
|
|
138
191
|
<auro-input id="first-name" name="firstName" required>
|
|
139
|
-
<span slot="label">First
|
|
192
|
+
<span slot="label">First name</span>
|
|
140
193
|
</auro-input>
|
|
141
|
-
<br />
|
|
142
194
|
<auro-input id="last-name" name="lastName" required>
|
|
143
|
-
<span slot="label">Last
|
|
144
|
-
</auro-input>
|
|
145
|
-
<br />
|
|
146
|
-
<auro-input id="occupation" name="occupation" required>
|
|
147
|
-
<span slot="label">Occupation</span>
|
|
195
|
+
<span slot="label">Last name</span>
|
|
148
196
|
</auro-input>
|
|
149
|
-
<
|
|
150
|
-
<
|
|
151
|
-
<span slot="
|
|
152
|
-
</auro-input
|
|
153
|
-
|
|
154
|
-
<h4>Pick a cool date</h4>
|
|
155
|
-
<auro-datepicker id="date-example" name="dateExample" required>
|
|
156
|
-
<span slot="fromLabel">Choose a date</span>
|
|
157
|
-
<span slot="bib.fullscreen.fromLabel">Choose a date</span>
|
|
158
|
-
</auro-datepicker>
|
|
197
|
+
<auro-input id="email" name="email" type="email" class="span-2" required>
|
|
198
|
+
<span slot="label">Email</span>
|
|
199
|
+
<span slot="helpText">We'll send your confirmation here.</span>
|
|
200
|
+
</auro-input>
|
|
201
|
+
</div>
|
|
159
202
|
</div>
|
|
160
|
-
|
|
161
|
-
<
|
|
162
|
-
<auro-
|
|
163
|
-
<span slot="
|
|
164
|
-
<
|
|
165
|
-
<
|
|
166
|
-
<
|
|
167
|
-
</auro-
|
|
203
|
+
<!-- Extras — auro-checkbox-group -->
|
|
204
|
+
<div class="form-section">
|
|
205
|
+
<auro-checkbox-group name="extras">
|
|
206
|
+
<span slot="legend">Add to your trip (optional)</span>
|
|
207
|
+
<auro-checkbox id="extra-bags" value="bags">First checked bag</auro-checkbox>
|
|
208
|
+
<auro-checkbox id="extra-insurance" value="insurance">Travel insurance</auro-checkbox>
|
|
209
|
+
<auro-checkbox id="extra-lounge" value="lounge">Alaska Lounge+ day pass</auro-checkbox>
|
|
210
|
+
</auro-checkbox-group>
|
|
168
211
|
</div>
|
|
169
|
-
<div class="
|
|
170
|
-
<auro-button type="reset">Reset</auro-button>
|
|
171
|
-
<auro-button type="submit">
|
|
212
|
+
<div class="form-actions">
|
|
213
|
+
<auro-button type="reset" variant="secondary">Reset</auro-button>
|
|
214
|
+
<auro-button type="submit">Search flights</auro-button>
|
|
172
215
|
</div>
|
|
173
|
-
</auro-form>
|
|
216
|
+
</auro-form>
|
|
217
|
+
<output id="tripFormOutput" aria-live="polite">Fill in the required fields and submit to see the collected form value. Notice how <code>travelDates</code> is a two-item array for a round trip and a single string for one way, and how the optional <code>extras</code> come through as an array.</output>
|
|
218
|
+
<style>
|
|
219
|
+
#tripFormOutput {
|
|
220
|
+
display: block;
|
|
221
|
+
margin-top: 2rem;
|
|
222
|
+
padding: 1rem 1.25rem;
|
|
223
|
+
border-left: 4px solid #2a2a2a;
|
|
224
|
+
border-radius: 0.25rem;
|
|
225
|
+
background: #f5f5f5;
|
|
226
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
|
|
227
|
+
font-size: 0.875rem;
|
|
228
|
+
white-space: pre-wrap;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.trip-form {
|
|
232
|
+
display: block;
|
|
233
|
+
padding: 1.5rem;
|
|
234
|
+
border: 1px solid #2a2a2a;
|
|
235
|
+
border-radius: 1rem;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
.trip-form .form-section {
|
|
239
|
+
margin-top: 1.5rem;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.trip-form .form-section:first-of-type {
|
|
243
|
+
margin-top: 0;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
.trip-form .section-heading {
|
|
247
|
+
margin: 0 0 0.75rem;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.trip-form .field-row {
|
|
251
|
+
display: grid;
|
|
252
|
+
grid-template-columns: 1fr 1fr;
|
|
253
|
+
gap: 1rem;
|
|
254
|
+
align-items: start;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
.trip-form .field-row + .field-row {
|
|
258
|
+
margin-top: 1rem;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
.trip-form .span-2 {
|
|
262
|
+
grid-column: span 2;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
@media (max-width: 660px) {
|
|
266
|
+
.trip-form .field-row {
|
|
267
|
+
grid-template-columns: 1fr;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
.trip-form .span-2 {
|
|
271
|
+
grid-column: span 1;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
.trip-form .form-actions {
|
|
276
|
+
display: flex;
|
|
277
|
+
justify-content: flex-end;
|
|
278
|
+
gap: 1rem;
|
|
279
|
+
margin-top: 2rem;
|
|
280
|
+
}
|
|
281
|
+
</style>
|
|
282
|
+
<!-- AURO-GENERATED-CONTENT:END -->
|
|
283
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../apiExamples/complex.js) -->
|
|
284
|
+
<!-- The below content is automatically added from ./../apiExamples/complex.js -->
|
|
285
|
+
/* eslint-disable jsdoc/require-jsdoc */
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* Wires the trip-type radio group in the complex booking example to the
|
|
289
|
+
* travel-dates datepicker. Choosing "One way" removes the datepicker's `range`
|
|
290
|
+
* attribute (a single departure date, no return); "Round trip" restores it.
|
|
291
|
+
*
|
|
292
|
+
* This also demonstrates a form-level behavior: because `auro-form` tracks its
|
|
293
|
+
* fields and reads a `range` datepicker via `.values` (and a single-date picker
|
|
294
|
+
* via `.value`), the collected `travelDates` entry changes shape to match the
|
|
295
|
+
* selected trip type — a `[departure, return]` array for round trip, a single
|
|
296
|
+
* date string for one way.
|
|
297
|
+
*/
|
|
298
|
+
export async function complexExample() {
|
|
299
|
+
await customElements.whenDefined('auro-form');
|
|
300
|
+
|
|
301
|
+
const form = document.querySelector('#tripForm');
|
|
302
|
+
if (!form) {
|
|
303
|
+
throw new Error('complexExample: #tripForm not yet rendered');
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
const output = document.querySelector('#tripFormOutput');
|
|
307
|
+
if (!output) {
|
|
308
|
+
throw new Error('complexExample: #tripFormOutput not yet rendered');
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
await form.updateComplete;
|
|
312
|
+
|
|
313
|
+
const tripType = form.querySelector('auro-radio-group[name="tripType"]');
|
|
314
|
+
const datepicker = form.querySelector('auro-datepicker[name="travelDates"]');
|
|
315
|
+
|
|
316
|
+
if (!tripType || !datepicker) {
|
|
317
|
+
throw new Error('complexExample: trip-type radio group or datepicker not found');
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
const syncDatepickerToTripType = () => {
|
|
321
|
+
if (tripType.value === 'oneway') {
|
|
322
|
+
datepicker.removeAttribute('range');
|
|
323
|
+
} else {
|
|
324
|
+
datepicker.setAttribute('range', '');
|
|
325
|
+
}
|
|
326
|
+
};
|
|
327
|
+
|
|
328
|
+
// Reflect the initial selection (Round trip) on load, then keep in sync.
|
|
329
|
+
syncDatepickerToTripType();
|
|
330
|
+
tripType.addEventListener('input', syncDatepickerToTripType);
|
|
331
|
+
|
|
332
|
+
// Display the collected form value on submit, mirroring the Disabled Fields example.
|
|
333
|
+
form.addEventListener('submit', (event) => {
|
|
334
|
+
output.textContent = JSON.stringify(event.detail.value, null, 2);
|
|
335
|
+
});
|
|
336
|
+
}
|
|
174
337
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
175
338
|
</div>
|
|
176
339
|
<auro-accordion alignRight>
|
|
177
340
|
<span slot="trigger">See code</span>
|
|
178
341
|
<!-- AURO-GENERATED-CONTENT:START (CODE:src=./../apiExamples/complex.html) -->
|
|
179
342
|
<!-- The below code snippet is automatically added from ./../apiExamples/complex.html -->
|
|
180
|
-
<pre class="language-html"><code class="language-html"><
|
|
181
|
-
|
|
343
|
+
<pre class="language-html"><code class="language-html"><auro-form id="tripForm" class="trip-form">
|
|
344
|
+
<!-- Trip type — auro-radio-group -->
|
|
345
|
+
<div class="form-section">
|
|
346
|
+
<auro-radio-group required name="tripType">
|
|
347
|
+
<span slot="legend">Trip type</span>
|
|
348
|
+
<auro-radio id="trip-roundtrip" name="tripTypeChoice" label="Round trip" value="roundtrip" checked></auro-radio>
|
|
349
|
+
<auro-radio id="trip-oneway" name="tripTypeChoice" label="One way" value="oneway"></auro-radio>
|
|
350
|
+
</auro-radio-group>
|
|
351
|
+
</div>
|
|
352
|
+
<!-- Route — auro-select (from) + auro-combobox (to) -->
|
|
353
|
+
<div class="form-section">
|
|
354
|
+
<h4 class="section-heading">Where are you going?</h4>
|
|
355
|
+
<div class="field-row">
|
|
356
|
+
<auro-select required name="departureAirport">
|
|
357
|
+
<span slot="label">From</span>
|
|
358
|
+
<span slot="bib.fullscreen.headline">Choose a departure city</span>
|
|
359
|
+
<auro-menu>
|
|
360
|
+
<auro-menuoption value="SEA">Seattle (SEA)</auro-menuoption>
|
|
361
|
+
<auro-menuoption value="PDX">Portland (PDX)</auro-menuoption>
|
|
362
|
+
<auro-menuoption value="SFO">San Francisco (SFO)</auro-menuoption>
|
|
363
|
+
<auro-menuoption value="LAX">Los Angeles (LAX)</auro-menuoption>
|
|
364
|
+
<auro-menuoption value="ANC">Anchorage (ANC)</auro-menuoption>
|
|
365
|
+
</auro-menu>
|
|
366
|
+
</auro-select>
|
|
367
|
+
<auro-combobox required name="destination">
|
|
368
|
+
<span slot="label">To</span>
|
|
369
|
+
<span slot="bib.fullscreen.headline">Search destinations</span>
|
|
370
|
+
<auro-menu>
|
|
371
|
+
<auro-menuoption value="HNL">Honolulu (HNL)</auro-menuoption>
|
|
372
|
+
<auro-menuoption value="OGG">Maui (OGG)</auro-menuoption>
|
|
373
|
+
<auro-menuoption value="JFK">New York (JFK)</auro-menuoption>
|
|
374
|
+
<auro-menuoption value="ORD">Chicago (ORD)</auro-menuoption>
|
|
375
|
+
<auro-menuoption value="DFW">Dallas–Fort Worth (DFW)</auro-menuoption>
|
|
376
|
+
<auro-menuoption static nomatch>No matching destinations</auro-menuoption>
|
|
377
|
+
</auro-menu>
|
|
378
|
+
</auro-combobox>
|
|
379
|
+
</div>
|
|
380
|
+
</div>
|
|
381
|
+
<!-- When & who — auro-datepicker (range) + auro-counter-group -->
|
|
382
|
+
<div class="form-section">
|
|
383
|
+
<h4 class="section-heading">When and who?</h4>
|
|
384
|
+
<div class="field-row">
|
|
385
|
+
<auro-datepicker required range name="travelDates">
|
|
386
|
+
<span slot="fromLabel">Departure</span>
|
|
387
|
+
<span slot="toLabel">Return</span>
|
|
388
|
+
<span slot="bib.fullscreen.fromLabel">Departure</span>
|
|
389
|
+
<span slot="bib.fullscreen.toLabel">Return</span>
|
|
390
|
+
</auro-datepicker>
|
|
391
|
+
<auro-counter-group isDropdown max="9" name="travelers">
|
|
392
|
+
<div slot="label">Travelers</div>
|
|
393
|
+
<span slot="bib.fullscreen.headline">Travelers</span>
|
|
394
|
+
<span slot="ariaLabel.bib.close">Close</span>
|
|
395
|
+
<auro-counter name="adults" min="1" max="9" value="1">
|
|
396
|
+
Adults
|
|
397
|
+
<span slot="description">Age 18+</span>
|
|
398
|
+
</auro-counter>
|
|
399
|
+
<auro-counter name="children" min="0" max="8" value="0">
|
|
400
|
+
Children
|
|
401
|
+
<span slot="description">Age 2–17</span>
|
|
402
|
+
</auro-counter>
|
|
403
|
+
<auro-counter name="infants" min="0" max="4" value="0">
|
|
404
|
+
Lap infants
|
|
405
|
+
<span slot="description">Under 2</span>
|
|
406
|
+
</auro-counter>
|
|
407
|
+
</auro-counter-group>
|
|
408
|
+
</div>
|
|
409
|
+
</div>
|
|
410
|
+
<!-- Lead traveler — auro-input -->
|
|
411
|
+
<div class="form-section">
|
|
412
|
+
<h4 class="section-heading">Lead traveler</h4>
|
|
413
|
+
<div class="field-row">
|
|
414
|
+
<auro-input id="first-name" name="firstName" required>
|
|
415
|
+
<span slot="label">First name</span>
|
|
416
|
+
</auro-input>
|
|
417
|
+
<auro-input id="last-name" name="lastName" required>
|
|
418
|
+
<span slot="label">Last name</span>
|
|
419
|
+
</auro-input>
|
|
420
|
+
<auro-input id="email" name="email" type="email" class="span-2" required>
|
|
421
|
+
<span slot="label">Email</span>
|
|
422
|
+
<span slot="helpText">We'll send your confirmation here.</span>
|
|
423
|
+
</auro-input>
|
|
424
|
+
</div>
|
|
425
|
+
</div>
|
|
426
|
+
<!-- Extras — auro-checkbox-group -->
|
|
427
|
+
<div class="form-section">
|
|
428
|
+
<auro-checkbox-group name="extras">
|
|
429
|
+
<span slot="legend">Add to your trip (optional)</span>
|
|
430
|
+
<auro-checkbox id="extra-bags" value="bags">First checked bag</auro-checkbox>
|
|
431
|
+
<auro-checkbox id="extra-insurance" value="insurance">Travel insurance</auro-checkbox>
|
|
432
|
+
<auro-checkbox id="extra-lounge" value="lounge">Alaska Lounge+ day pass</auro-checkbox>
|
|
433
|
+
</auro-checkbox-group>
|
|
434
|
+
</div>
|
|
435
|
+
<div class="form-actions">
|
|
436
|
+
<auro-button type="reset" variant="secondary">Reset</auro-button>
|
|
437
|
+
<auro-button type="submit">Search flights</auro-button>
|
|
438
|
+
</div>
|
|
439
|
+
</auro-form>
|
|
440
|
+
<output id="tripFormOutput" aria-live="polite">Fill in the required fields and submit to see the collected form value. Notice how <code>travelDates</code> is a two-item array for a round trip and a single string for one way, and how the optional <code>extras</code> come through as an array.</output>
|
|
441
|
+
<style>
|
|
442
|
+
#tripFormOutput {
|
|
443
|
+
display: block;
|
|
444
|
+
margin-top: 2rem;
|
|
445
|
+
padding: 1rem 1.25rem;
|
|
446
|
+
border-left: 4px solid #2a2a2a;
|
|
447
|
+
border-radius: 0.25rem;
|
|
448
|
+
background: #f5f5f5;
|
|
449
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
|
|
450
|
+
font-size: 0.875rem;
|
|
451
|
+
white-space: pre-wrap;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
.trip-form {
|
|
455
|
+
display: block;
|
|
456
|
+
padding: 1.5rem;
|
|
457
|
+
border: 1px solid #2a2a2a;
|
|
458
|
+
border-radius: 1rem;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
.trip-form .form-section {
|
|
462
|
+
margin-top: 1.5rem;
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
.trip-form .form-section:first-of-type {
|
|
466
|
+
margin-top: 0;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
.trip-form .section-heading {
|
|
470
|
+
margin: 0 0 0.75rem;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
.trip-form .field-row {
|
|
474
|
+
display: grid;
|
|
475
|
+
grid-template-columns: 1fr 1fr;
|
|
476
|
+
gap: 1rem;
|
|
477
|
+
align-items: start;
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
.trip-form .field-row + .field-row {
|
|
182
481
|
margin-top: 1rem;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
.trip-form .span-2 {
|
|
485
|
+
grid-column: span 2;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
@media (max-width: 660px) {
|
|
489
|
+
.trip-form .field-row {
|
|
490
|
+
grid-template-columns: 1fr;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
.trip-form .span-2 {
|
|
494
|
+
grid-column: span 1;
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
.trip-form .form-actions {
|
|
183
499
|
display: flex;
|
|
184
500
|
justify-content: flex-end;
|
|
185
501
|
gap: 1rem;
|
|
502
|
+
margin-top: 2rem;
|
|
186
503
|
}
|
|
187
|
-
|
|
188
|
-
margin-top: 1rem;
|
|
189
|
-
}
|
|
190
|
-
.complex-form {
|
|
191
|
-
display: block;
|
|
192
|
-
padding: 1rem;
|
|
193
|
-
border: 1px solid #2a2a2a;
|
|
194
|
-
border-radius: 1rem;
|
|
195
|
-
}
|
|
196
|
-
</style>
|
|
197
|
-
<auro-form class="complex-form">
|
|
198
|
-
<auro-input id="first-name" name="firstName" required>
|
|
199
|
-
<span slot="label">First Name</span>
|
|
200
|
-
</auro-input>
|
|
201
|
-
<br />
|
|
202
|
-
<auro-input id="last-name" name="lastName" required>
|
|
203
|
-
<span slot="label">Last Name</span>
|
|
204
|
-
</auro-input>
|
|
205
|
-
<br />
|
|
206
|
-
<auro-input id="occupation" name="occupation" required>
|
|
207
|
-
<span slot="label">Occupation</span>
|
|
208
|
-
</auro-input>
|
|
209
|
-
<br />
|
|
210
|
-
<auro-input-two id="cool-fact" name="coolFact" required>
|
|
211
|
-
<span slot="label">Cool Fact</span>
|
|
212
|
-
</auro-input-two>
|
|
213
|
-
<div class="datepickerBlock">
|
|
214
|
-
<h4>Pick a cool date</h4>
|
|
215
|
-
<auro-datepicker id="date-example" name="dateExample" required>
|
|
216
|
-
<span slot="fromLabel">Choose a date</span>
|
|
217
|
-
<span slot="bib.fullscreen.fromLabel">Choose a date</span>
|
|
218
|
-
</auro-datepicker>
|
|
219
|
-
</div>
|
|
220
|
-
<div class="datepickerBlock">
|
|
221
|
-
<h4>Pick a date range</h4>
|
|
222
|
-
<auro-datepicker id="date-range" name="dateRange" required range>
|
|
223
|
-
<span slot="fromLabel">Start</span>
|
|
224
|
-
<span slot="toLabel">End</span>
|
|
225
|
-
<span slot="bib.fullscreen.fromLabel">Start</span>
|
|
226
|
-
<span slot="bib.fullscreen.toLabel">End</span>
|
|
227
|
-
</auro-datepicker>
|
|
228
|
-
</div>
|
|
229
|
-
<div class="submitBlock">
|
|
230
|
-
<auro-button type="reset">Reset</auro-button>
|
|
231
|
-
<auro-button type="submit">Submit</auro-button>
|
|
232
|
-
</div>
|
|
233
|
-
</auro-form></code></pre>
|
|
504
|
+
</style></code></pre>
|
|
234
505
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
235
506
|
</auro-accordion>
|
|
236
507
|
</section>
|