@design.estate/dees-catalog 21.30.0 → 21.31.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/dist_bundle/bundle.js +250 -214
- package/dist_bundle/bundle.js.map +1 -1
- package/dist_ts_web/00_commitinfo_data.js +1 -1
- package/dist_ts_web/demos/charts.js +5 -3
- package/dist_ts_web/elements/00group-chart/dees-chart-area/component.d.ts +14 -3
- package/dist_ts_web/elements/00group-chart/dees-chart-area/component.js +23 -5
- package/dist_ts_web/elements/00group-chart/dees-chart-area/styles.js +7 -2
- package/dist_ts_web/elements/00group-chart/dees-chart-area/template.js +28 -32
- package/dist_ts_web/elements/00group-chart/dees-chart-echarts-base.d.ts +2 -8
- package/dist_ts_web/elements/00group-chart/dees-chart-echarts-base.js +21 -33
- package/dist_ts_web/elements/00group-chart/dees-chart-echarts-styles.d.ts +0 -7
- package/dist_ts_web/elements/00group-chart/dees-chart-echarts-styles.js +3 -42
- package/dist_ts_web/elements/00group-chart/dees-chart-frame.d.ts +41 -0
- package/dist_ts_web/elements/00group-chart/dees-chart-frame.js +78 -0
- package/dist_ts_web/elements/00group-chart/dees-chart-log/dees-chart-log.d.ts +10 -2
- package/dist_ts_web/elements/00group-chart/dees-chart-log/dees-chart-log.demo.d.ts +1 -0
- package/dist_ts_web/elements/00group-chart/dees-chart-log/dees-chart-log.demo.js +7 -2
- package/dist_ts_web/elements/00group-chart/dees-chart-log/dees-chart-log.js +88 -96
- package/dist_ts_web/elements/00group-form/dees-form/dees-form.d.ts +8 -1
- package/dist_ts_web/elements/00group-form/dees-form/dees-form.js +10 -2
- package/dist_ts_web/elements/00group-input/dees-input-radiogroup/dees-input-radiogroup.d.ts +17 -0
- package/dist_ts_web/elements/00group-input/dees-input-radiogroup/dees-input-radiogroup.demo.js +8 -1
- package/dist_ts_web/elements/00group-input/dees-input-radiogroup/dees-input-radiogroup.js +36 -6
- package/dist_ts_web/elements/00group-layout/dees-stepper/dees-stepper.d.ts +4 -3
- package/dist_ts_web/elements/00group-layout/dees-stepper/dees-stepper.demo.js +8 -4
- package/dist_ts_web/elements/00group-layout/dees-stepper/dees-stepper.js +7 -6
- package/package.json +1 -1
- package/readme.md +35 -14
- package/scripts/reflect-allowlist.json +2 -1
- package/ts_web/00_commitinfo_data.ts +1 -1
- package/ts_web/demos/charts.ts +4 -2
- package/ts_web/elements/00group-chart/dees-chart-area/component.ts +16 -3
- package/ts_web/elements/00group-chart/dees-chart-area/styles.ts +6 -1
- package/ts_web/elements/00group-chart/dees-chart-area/template.ts +27 -31
- package/ts_web/elements/00group-chart/dees-chart-echarts-base.ts +13 -26
- package/ts_web/elements/00group-chart/dees-chart-echarts-styles.ts +2 -42
- package/ts_web/elements/00group-chart/dees-chart-frame.ts +100 -0
- package/ts_web/elements/00group-chart/dees-chart-log/dees-chart-log.demo.ts +6 -1
- package/ts_web/elements/00group-chart/dees-chart-log/dees-chart-log.ts +81 -94
- package/ts_web/elements/00group-form/dees-form/dees-form.ts +10 -2
- package/ts_web/elements/00group-input/dees-input-radiogroup/dees-input-radiogroup.demo.ts +10 -0
- package/ts_web/elements/00group-input/dees-input-radiogroup/dees-input-radiogroup.ts +31 -1
- package/ts_web/elements/00group-layout/dees-stepper/dees-stepper.demo.ts +7 -3
- package/ts_web/elements/00group-layout/dees-stepper/dees-stepper.ts +5 -4
|
@@ -12,13 +12,12 @@ import {
|
|
|
12
12
|
import type { SearchAddon } from '@xterm/addon-search';
|
|
13
13
|
|
|
14
14
|
import { demoFunc } from './dees-chart-log.demo.js';
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
15
|
+
import { themeDefaultStyles } from '../../00theme.js';
|
|
16
|
+
import { chartFrame, chartFrameStyles, chartInsetStyles } from '../dees-chart-frame.js';
|
|
17
17
|
import {
|
|
18
18
|
DeesServiceLibLoader,
|
|
19
19
|
type IXtermSearchAddonBundle,
|
|
20
20
|
} from '../../../services/index.js';
|
|
21
|
-
import '../../00group-layout/dees-tile/dees-tile.js';
|
|
22
21
|
import '../../00group-terminal/dees-terminal-view/dees-terminal-view.js';
|
|
23
22
|
import '../dees-legend/dees-legend.js';
|
|
24
23
|
import type {
|
|
@@ -108,6 +107,10 @@ const sameEntry = (oneArg: ILogEntry, otherArg: ILogEntry | undefined): boolean
|
|
|
108
107
|
* one scroll, never one per line. Raw output (`writeRaw`, `writelnRaw`) is
|
|
109
108
|
* forwarded to the surface as it arrives and is not part of that model, so it
|
|
110
109
|
* is not repainted after a move.
|
|
110
|
+
*
|
|
111
|
+
* The log draws in the frame every chart shares (`chartFrame`): `label` and `meta` head the tile's
|
|
112
|
+
* header bar, with the search and the controls after them; the host's rows go into the slots
|
|
113
|
+
* `above` and `below` the terminal; the level counts and the rate are the footer bar.
|
|
111
114
|
*/
|
|
112
115
|
@customElement('dees-chart-log')
|
|
113
116
|
export class DeesChartLog extends DeesElement {
|
|
@@ -120,6 +123,13 @@ export class DeesChartLog extends DeesElement {
|
|
|
120
123
|
@property({ reflect: true })
|
|
121
124
|
accessor label: string = '';
|
|
122
125
|
|
|
126
|
+
/**
|
|
127
|
+
* A short text beside `label`, before the search: what the log streams or from where
|
|
128
|
+
* ("api-7f9c · eu-central"). Muted; where the header is too narrow it wraps under the label.
|
|
129
|
+
*/
|
|
130
|
+
@property({ reflect: true })
|
|
131
|
+
accessor meta: string = '';
|
|
132
|
+
|
|
123
133
|
@property({ type: Array })
|
|
124
134
|
accessor logEntries: ILogEntry[] = [];
|
|
125
135
|
|
|
@@ -138,7 +148,7 @@ export class DeesChartLog extends DeesElement {
|
|
|
138
148
|
|
|
139
149
|
/**
|
|
140
150
|
* Drop the outer frame and surface: the host already owns the surface. The log itself keeps the
|
|
141
|
-
* terminal's background; the header and the metrics bar take the region inset
|
|
151
|
+
* terminal's background; the header, the rows and the metrics bar take the region inset
|
|
142
152
|
* `--dees-inset-inline`.
|
|
143
153
|
*/
|
|
144
154
|
@property({ type: Boolean, reflect: true })
|
|
@@ -203,32 +213,18 @@ export class DeesChartLog extends DeesElement {
|
|
|
203
213
|
public static styles = [
|
|
204
214
|
themeDefaultStyles,
|
|
205
215
|
cssManager.defaultStyles,
|
|
206
|
-
|
|
216
|
+
chartInsetStyles,
|
|
217
|
+
chartFrameStyles,
|
|
207
218
|
css`
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
font-family: var(--dees-font-family);
|
|
212
|
-
color: var(--dees-color-text-primary);
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
dees-tile {
|
|
216
|
-
height: 100%;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
.header {
|
|
220
|
-
padding: 8px var(--chartlog-inset-inline, 12px);
|
|
221
|
-
display: flex;
|
|
222
|
-
align-items: center;
|
|
223
|
-
gap: 12px;
|
|
219
|
+
/* The heading keeps its width and the search follows it; where the bar is too narrow, the
|
|
220
|
+
search and the controls wrap onto further lines. */
|
|
221
|
+
.chartHeader {
|
|
224
222
|
flex-wrap: wrap;
|
|
223
|
+
column-gap: 12px;
|
|
225
224
|
}
|
|
226
225
|
|
|
227
|
-
.
|
|
228
|
-
|
|
229
|
-
font-size: 14px;
|
|
230
|
-
color: var(--dees-color-text-primary);
|
|
231
|
-
white-space: nowrap;
|
|
226
|
+
.chartHeading {
|
|
227
|
+
flex: 0 1 auto;
|
|
232
228
|
}
|
|
233
229
|
|
|
234
230
|
.search-box {
|
|
@@ -346,20 +342,13 @@ export class DeesChartLog extends DeesElement {
|
|
|
346
342
|
}
|
|
347
343
|
}
|
|
348
344
|
|
|
349
|
-
/* The
|
|
345
|
+
/* The frame's plot is the surface: the view fills it and fits to it. */
|
|
350
346
|
dees-terminal-view {
|
|
351
347
|
position: absolute;
|
|
352
348
|
inset: 0;
|
|
353
349
|
}
|
|
354
350
|
|
|
355
|
-
/* The
|
|
356
|
-
legend of the level counts, then the rate at the end. */
|
|
357
|
-
.metrics-bar {
|
|
358
|
-
${tileFooterBar}
|
|
359
|
-
padding-inline: var(--chartlog-inset-inline, 12px);
|
|
360
|
-
width: 100%;
|
|
361
|
-
}
|
|
362
|
-
|
|
351
|
+
/* The footer bar: the legend of the level counts, then the rate at the end. */
|
|
363
352
|
.rate {
|
|
364
353
|
margin-inline-start: auto;
|
|
365
354
|
color: var(--dees-color-text-secondary);
|
|
@@ -372,52 +361,53 @@ export class DeesChartLog extends DeesElement {
|
|
|
372
361
|
const jumpTitle = (labelArg: string): string =>
|
|
373
362
|
this.canJumpToMatch ? labelArg : this.t('chartlog.jumpUnavailable');
|
|
374
363
|
const label = this.label || this.t('chartlog.defaultLabel');
|
|
375
|
-
return
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
?disabled=${!this.canJumpToMatch}
|
|
391
|
-
@click=${() => this.searchPrevious()}
|
|
392
|
-
title=${jumpTitle(this.t('chartlog.previousMatch'))}
|
|
393
|
-
>↑</button>
|
|
394
|
-
<button
|
|
395
|
-
?disabled=${!this.canJumpToMatch}
|
|
396
|
-
@click=${() => this.searchNext()}
|
|
397
|
-
title=${jumpTitle(this.t('chartlog.nextMatch'))}
|
|
398
|
-
>↓</button>
|
|
399
|
-
</div>
|
|
364
|
+
return chartFrame(this, {
|
|
365
|
+
label,
|
|
366
|
+
meta: this.meta,
|
|
367
|
+
frameless: this.frameless,
|
|
368
|
+
headerTools: html`
|
|
369
|
+
<div class="search-box">
|
|
370
|
+
<input
|
|
371
|
+
type="text"
|
|
372
|
+
placeholder=${this.t('chartlog.search')}
|
|
373
|
+
aria-label=${this.t('chartlog.search')}
|
|
374
|
+
.value=${this.searchQuery}
|
|
375
|
+
@input=${(eventArg: InputEvent) => this.handleSearchInput(eventArg)}
|
|
376
|
+
@keydown=${(eventArg: KeyboardEvent) => this.handleSearchKeydown(eventArg)}
|
|
377
|
+
/>
|
|
378
|
+
<div class="search-nav">
|
|
400
379
|
<button
|
|
401
|
-
|
|
402
|
-
@click=${() => this.
|
|
403
|
-
title=${this.t(
|
|
404
|
-
>
|
|
405
|
-
${this.t(this.filterMode ? 'chartlog.filter' : 'chartlog.highlight')}
|
|
406
|
-
</button>
|
|
407
|
-
</div>
|
|
408
|
-
<div class="controls">
|
|
380
|
+
?disabled=${!this.canJumpToMatch}
|
|
381
|
+
@click=${() => this.searchPrevious()}
|
|
382
|
+
title=${jumpTitle(this.t('chartlog.previousMatch'))}
|
|
383
|
+
>↑</button>
|
|
409
384
|
<button
|
|
410
|
-
|
|
411
|
-
@click=${() => this.
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
</button>
|
|
415
|
-
<button class="control-button" @click=${() => this.clearLogs()}>
|
|
416
|
-
${this.t('chartlog.clear')}
|
|
417
|
-
</button>
|
|
385
|
+
?disabled=${!this.canJumpToMatch}
|
|
386
|
+
@click=${() => this.searchNext()}
|
|
387
|
+
title=${jumpTitle(this.t('chartlog.nextMatch'))}
|
|
388
|
+
>↓</button>
|
|
418
389
|
</div>
|
|
390
|
+
<button
|
|
391
|
+
class="filter-toggle ${this.filterMode ? 'active' : ''}"
|
|
392
|
+
@click=${() => this.toggleFilterMode()}
|
|
393
|
+
title=${this.t(this.filterMode ? 'chartlog.toHighlight' : 'chartlog.toFilter')}
|
|
394
|
+
>
|
|
395
|
+
${this.t(this.filterMode ? 'chartlog.filter' : 'chartlog.highlight')}
|
|
396
|
+
</button>
|
|
419
397
|
</div>
|
|
420
|
-
|
|
398
|
+
<div class="controls">
|
|
399
|
+
<button
|
|
400
|
+
class="control-button ${this.autoScroll ? 'active' : ''}"
|
|
401
|
+
@click=${() => this.toggleAutoScroll()}
|
|
402
|
+
>
|
|
403
|
+
${this.t('chartlog.autoScroll')}
|
|
404
|
+
</button>
|
|
405
|
+
<button class="control-button" @click=${() => this.clearLogs()}>
|
|
406
|
+
${this.t('chartlog.clear')}
|
|
407
|
+
</button>
|
|
408
|
+
</div>
|
|
409
|
+
`,
|
|
410
|
+
plot: html`
|
|
421
411
|
<dees-terminal-view
|
|
422
412
|
.readOnly=${true}
|
|
423
413
|
.convertEol=${true}
|
|
@@ -425,23 +415,20 @@ export class DeesChartLog extends DeesElement {
|
|
|
425
415
|
.scrollback=${this.maxEntries}
|
|
426
416
|
.label=${label}
|
|
427
417
|
></dees-terminal-view>
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
: ''}
|
|
443
|
-
</dees-tile>
|
|
444
|
-
`;
|
|
418
|
+
`,
|
|
419
|
+
footer: this.showMetrics
|
|
420
|
+
? html`
|
|
421
|
+
<dees-legend label=${this.t('chartlog.levels')} .items=${[
|
|
422
|
+
{ label: this.t('chartlog.errors', { count: this.metrics.error }), color: 'var(--dees-color-accent-error)' },
|
|
423
|
+
{ label: this.t('chartlog.warnings', { count: this.metrics.warn }), color: 'var(--dees-color-accent-warning)' },
|
|
424
|
+
{ label: this.t('chartlog.info', { count: this.metrics.info }), color: 'var(--dees-color-accent-primary)' },
|
|
425
|
+
{ label: this.t('chartlog.success', { count: this.metrics.success }), color: 'var(--dees-color-accent-success)' },
|
|
426
|
+
{ label: this.t('chartlog.debug', { count: this.metrics.debug }), color: 'var(--dees-color-text-muted)' },
|
|
427
|
+
]}></dees-legend>
|
|
428
|
+
<span class="rate">${this.t('chartlog.rate', { rate: this.t.format.intlNumberFormat({ minimumFractionDigits: 1, maximumFractionDigits: 1 }).format(this.metrics.rate) })}</span>
|
|
429
|
+
`
|
|
430
|
+
: undefined,
|
|
431
|
+
});
|
|
445
432
|
}
|
|
446
433
|
|
|
447
434
|
public updated(changedPropertiesArg: Map<string | number | symbol, unknown>): void {
|
|
@@ -346,14 +346,21 @@ export class DeesForm extends DeesElement {
|
|
|
346
346
|
return valueObject;
|
|
347
347
|
}
|
|
348
348
|
|
|
349
|
-
|
|
349
|
+
/**
|
|
350
|
+
* Dispatches the collected data as `formData`, unless a field refuses: the
|
|
351
|
+
* first enabled field whose `checkValidity()` fails reports its validity and
|
|
352
|
+
* takes the focus, and nothing is dispatched. Resolves to `true` once
|
|
353
|
+
* `formData` went out and to `false` after a refusal, so a host that submits
|
|
354
|
+
* through the form (a stepper's primary) can stop where the field did.
|
|
355
|
+
*/
|
|
356
|
+
public async gatherAndDispatch(): Promise<boolean> {
|
|
350
357
|
for (const child of this.getFormElements()) {
|
|
351
358
|
if (child.disabled) continue;
|
|
352
359
|
const input = child as IFormCompatibleElement;
|
|
353
360
|
if (input.checkValidity?.() === false) {
|
|
354
361
|
input.reportValidity?.();
|
|
355
362
|
child.focus();
|
|
356
|
-
return;
|
|
363
|
+
return false;
|
|
357
364
|
}
|
|
358
365
|
}
|
|
359
366
|
const valueObject = await this.collectFormData();
|
|
@@ -364,6 +371,7 @@ export class DeesForm extends DeesElement {
|
|
|
364
371
|
bubbles: true,
|
|
365
372
|
});
|
|
366
373
|
this.dispatchEvent(formDataEvent);
|
|
374
|
+
return true;
|
|
367
375
|
}
|
|
368
376
|
|
|
369
377
|
/**
|
|
@@ -19,6 +19,16 @@ const sections = html`
|
|
|
19
19
|
${demoOutput('Chosen: manual')}
|
|
20
20
|
${demoCode("<dees-input-radiogroup .options=${[\n { key: 'manual', option: 'Enter the details yourself', description: 'Type the name and whatever else you know.' },\n ...\n]}></dees-input-radiogroup>")}
|
|
21
21
|
`)}
|
|
22
|
+
${demoSection('Named by the question above it',
|
|
23
|
+
'Where a heading or a step title already asks the question, the group shows no label of its own. An aria-label names it instead, so assistive technology still announces the question when the focus enters the group.',
|
|
24
|
+
html`
|
|
25
|
+
<p class="dees-demo-label">How do you want to add the contact?</p>
|
|
26
|
+
<dees-input-radiogroup key="source" aria-label="How do you want to add the contact?" .options=${imports} selectedOption="text"
|
|
27
|
+
@change=${(event: Event) => showDemoResult(event.currentTarget as Element,
|
|
28
|
+
`Chosen: ${(event.currentTarget as DeesInputRadiogroup).selectedOption}`)}></dees-input-radiogroup>
|
|
29
|
+
${demoOutput('Chosen: text')}
|
|
30
|
+
${demoCode('<p>How do you want to add the contact?</p>\n<dees-input-radiogroup aria-label="How do you want to add the contact?" .options=${options}></dees-input-radiogroup>')}
|
|
31
|
+
`)}
|
|
22
32
|
`;
|
|
23
33
|
|
|
24
34
|
export const demoFunc = () => focusedInputDemo('radiogroup', sections);
|
|
@@ -43,6 +43,19 @@ export class DeesInputRadiogroup extends DeesInputBase<string | object> {
|
|
|
43
43
|
@property({ type: String, reflect: true })
|
|
44
44
|
accessor validationState: 'valid' | 'invalid' | 'warn' | 'pending' | null = null;
|
|
45
45
|
|
|
46
|
+
/**
|
|
47
|
+
* The group's accessible name where no label says it: a group under a
|
|
48
|
+
* heading or a step title that asks the question. The `radiogroup` role
|
|
49
|
+
* lives inside, so the name is forwarded to it; an `aria-label` attribute in
|
|
50
|
+
* markup sets it and moves from the host, which has no role, to the group.
|
|
51
|
+
* `null` (the default) names the group by its `label`.
|
|
52
|
+
*/
|
|
53
|
+
@property({ type: String, attribute: 'aria-label' })
|
|
54
|
+
override accessor ariaLabel: string | null = null;
|
|
55
|
+
|
|
56
|
+
/** Whether the host's `aria-label` was just removed by the group itself, after moving it. */
|
|
57
|
+
private movedAriaLabel = false;
|
|
58
|
+
|
|
46
59
|
// Form compatibility
|
|
47
60
|
public get value() {
|
|
48
61
|
const option = this.getOptionByKey(this.selectedOption);
|
|
@@ -258,7 +271,7 @@ export class DeesInputRadiogroup extends DeesInputBase<string | object> {
|
|
|
258
271
|
<div class="input-wrapper">
|
|
259
272
|
${this.label ? this.renderLabel() : ''}
|
|
260
273
|
<div class="maincontainer ${this.direction} ${described ? 'described' : ''}" role="radiogroup"
|
|
261
|
-
|
|
274
|
+
.ariaLabel=${this.ariaLabel || this.label || null} aria-required=${this.required ? 'true' : 'false'}
|
|
262
275
|
aria-disabled=${this.disabled ? 'true' : 'false'}
|
|
263
276
|
aria-invalid=${this.validationState === 'invalid' ? 'true' : 'false'}>
|
|
264
277
|
${this.options.map((option) => {
|
|
@@ -294,6 +307,23 @@ export class DeesInputRadiogroup extends DeesInputBase<string | object> {
|
|
|
294
307
|
`;
|
|
295
308
|
}
|
|
296
309
|
|
|
310
|
+
/**
|
|
311
|
+
* An `aria-label` written on the host sets `ariaLabel`, which the group
|
|
312
|
+
* carries, and leaves the host: kept there, Chromium would expose a generic
|
|
313
|
+
* node with the name beside the group. The removal the group makes itself
|
|
314
|
+
* changes nothing; to clear the name, set `ariaLabel` to `null`.
|
|
315
|
+
*/
|
|
316
|
+
public attributeChangedCallback(name: string, oldValue: string | null, value: string | null): void {
|
|
317
|
+
if (name === 'aria-label' && value === null && this.movedAriaLabel) {
|
|
318
|
+
this.movedAriaLabel = false;
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
super.attributeChangedCallback(name, oldValue, value);
|
|
322
|
+
if (name !== 'aria-label' || value === null) return;
|
|
323
|
+
this.movedAriaLabel = true;
|
|
324
|
+
this.removeAttribute(name);
|
|
325
|
+
}
|
|
326
|
+
|
|
297
327
|
private getOptionKey(option: TRadiogroupOption): string {
|
|
298
328
|
if (typeof option === 'string') {
|
|
299
329
|
return option;
|
|
@@ -189,6 +189,10 @@ const createChoiceSteps = (finish: (name: string) => void): { steps: IStep[]; be
|
|
|
189
189
|
review.content = reviewForm();
|
|
190
190
|
},
|
|
191
191
|
});
|
|
192
|
+
// A filled field can still break its own rule; the step's primary then holds where the field refused.
|
|
193
|
+
const reachable = (value: string) => /\S+@\S+\.\S+|\+?\d[\d\s/-]{5,}/.test(value)
|
|
194
|
+
? { valid: true }
|
|
195
|
+
: { valid: false, message: 'Include an email address or a phone number, so the contact can be reached.' };
|
|
192
196
|
const flows: Record<string, IStep[]> = {
|
|
193
197
|
manual: [{
|
|
194
198
|
title: 'Enter the details.',
|
|
@@ -203,7 +207,7 @@ const createChoiceSteps = (finish: (name: string) => void): { steps: IStep[]; be
|
|
|
203
207
|
title: 'Paste the text.',
|
|
204
208
|
description: 'A signature, a letterhead or an email: whatever names the contact.',
|
|
205
209
|
content: html`<dees-form>
|
|
206
|
-
<dees-input-textarea key="text" label="Text" .rows=${5} required
|
|
210
|
+
<dees-input-textarea key="text" label="Text" .rows=${5} .validationFunction=${reachable} required
|
|
207
211
|
.value=${'Northwind Traders GmbH\nHafenstraße 12, 20457 Hamburg\nhello@northwind.example'}></dees-input-textarea>
|
|
208
212
|
</dees-form>`,
|
|
209
213
|
menuOptions: [{ name: 'Read the details', action: async (stepper) => stepper?.goNext() }],
|
|
@@ -221,7 +225,7 @@ const createChoiceSteps = (finish: (name: string) => void): { steps: IStep[]; be
|
|
|
221
225
|
title: 'Add a contact.',
|
|
222
226
|
description: 'How do you want to bring in the details?',
|
|
223
227
|
content: html`<dees-form @formData=${(event: CustomEvent<{ data: { source?: string } }>) => { source = event.detail.data.source || source; }}>
|
|
224
|
-
<dees-input-radiogroup key="source" label="
|
|
228
|
+
<dees-input-radiogroup key="source" aria-label="How do you want to bring in the details?" selectedOption="manual" .options=${[
|
|
225
229
|
{ key: 'manual', option: 'Enter the details yourself', description: 'Type the name and whatever else you know.' },
|
|
226
230
|
{ key: 'text', option: 'Read them from a text', description: 'Paste a signature or a letterhead; a language model picks out the details.' },
|
|
227
231
|
{ key: 'website', option: 'Read them from a website', description: 'Give the address of an imprint page; a language model reads it.' },
|
|
@@ -324,7 +328,7 @@ class DeesDemoStepper extends DeesElement {
|
|
|
324
328
|
</div>` : html`<dees-stepper .steps=${this.steps} .layout=${this.stepperLayout()} .cardAlign=${this.stepperAlign()} .stepCounter=${this.scenario === 'Lookup' ? 'position' : 'total'} .beforeClose=${this.beforeClose} @stepper-close=${() => { this.closed = true; }}></dees-stepper>`}</div>
|
|
325
329
|
<p class="caption">${this.scenario === 'Retry example' ? 'The first setup attempt pauses with an error. Try again to continue with your saved choices.'
|
|
326
330
|
: this.scenario === 'Lookup' ? 'The counter says only where you are and the ribbon fades out after it; the lookup is not a step of its own and can be stopped while it runs. Discard asks first, and only Discard waits for the answer.'
|
|
327
|
-
: this.scenario === 'Choice first' ? 'The first step asks how; the steps after it follow the answer. Entering the details takes one more step; reading them from a text or a website reads first and then shows what was read for checking. Cancelling closes at once until something was read, and asks first after that. Centred stands the card in the middle of the stage, as a flow with a tab of its own would.'
|
|
331
|
+
: this.scenario === 'Choice first' ? 'The first step asks how; the steps after it follow the answer. Entering the details takes one more step; reading them from a text or a website reads first and then shows what was read for checking. A text that names no email address or phone number stays on its step: the field says why and takes the focus. Cancelling closes at once until something was read, and asks first after that. Centred stands the card in the middle of the stage, as a flow with a tab of its own would.'
|
|
328
332
|
: this.scenario === 'Long flow' ? 'More steps than the ribbon has room for: it scrolls and keeps the current marker in view. Use a completed marker to go back.'
|
|
329
333
|
: 'Move forward, go back with Back or a completed marker in the ribbon, and review your choices. Vertical, and Auto on a narrow surface, show the ribbon as a strip above the steps, and the steps slide sideways. Centred stands the card in the middle of the stage.'}</p>
|
|
330
334
|
<details><summary class="caption">Completion required</summary>
|
|
@@ -772,9 +772,10 @@ export class DeesStepper extends DeesElement {
|
|
|
772
772
|
/**
|
|
773
773
|
* Click handler for menuOption buttons in the footer. For the primary (last)
|
|
774
774
|
* button, if an active form is present, gates on required-field validity and
|
|
775
|
-
* triggers the form's gatherAndDispatch() before running the action
|
|
776
|
-
*
|
|
777
|
-
*
|
|
775
|
+
* triggers the form's gatherAndDispatch() before running the action; when a
|
|
776
|
+
* field refuses there, the field reports why and takes the focus, and the
|
|
777
|
+
* action does not run. The action is awaited so any async work it starts (a
|
|
778
|
+
* save, a question) completes before the click handler returns.
|
|
778
779
|
*/
|
|
779
780
|
private async handleMenuOptionClick(
|
|
780
781
|
optionArg: IStepMenuItem,
|
|
@@ -790,7 +791,7 @@ export class DeesStepper extends DeesElement {
|
|
|
790
791
|
this.actionStep = step;
|
|
791
792
|
this.stepError = '';
|
|
792
793
|
try {
|
|
793
|
-
if (isPrimary && form
|
|
794
|
+
if (isPrimary && form && !await form.gatherAndDispatch()) return;
|
|
794
795
|
if (!this.isConnected || step !== this.selectedStep) return;
|
|
795
796
|
await optionArg.action(this);
|
|
796
797
|
} catch (error) {
|