@design.estate/dees-catalog 21.36.1 → 21.36.2
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 +817 -756
- package/dist_bundle/bundle.js.map +1 -1
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-5UGXWLMH.js → chunk-5SHHYXWB.js} +2 -2
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-ZCZ72OW4.js → chunk-UTEXL6ME.js} +38 -9
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-ZCZ72OW4.js.map → chunk-UTEXL6ME.js.map} +1 -1
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-modal-4QORKLGX.js → dees-modal-AH4CADKZ.js} +2 -2
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-workspace-terminal-7SYZG2AB.js → dees-workspace-terminal-PIUCRANN.js} +3 -3
- package/dist_ts_web/00_commitinfo_data.js +1 -1
- package/dist_ts_web/elements/00formgate.d.ts +13 -2
- package/dist_ts_web/elements/00formgate.js +26 -6
- package/dist_ts_web/elements/00group-form/dees-form/dees-form.js +3 -3
- package/dist_ts_web/elements/00group-layout/dees-stepper/dees-stepper.d.ts +25 -10
- package/dist_ts_web/elements/00group-layout/dees-stepper/dees-stepper.demo.js +44 -11
- package/dist_ts_web/elements/00group-layout/dees-stepper/dees-stepper.js +54 -27
- package/dist_ts_web/elements/00group-layout/dees-stepper/styles.js +23 -2
- package/dist_ts_web/elements/00group-overlay/dees-popover/dees-popover.d.ts +9 -2
- package/dist_ts_web/elements/00group-overlay/dees-popover/dees-popover.js +18 -4
- package/dist_ts_web/elements/00group-overlay/dees-speechbubble/dees-speechbubble.demo.js +4 -3
- package/package.json +1 -1
- package/readme.md +25 -14
- package/ts_web/00_commitinfo_data.ts +1 -1
- package/ts_web/elements/00formgate.ts +24 -5
- package/ts_web/elements/00group-form/dees-form/dees-form.ts +2 -2
- package/ts_web/elements/00group-layout/dees-stepper/dees-stepper.demo.ts +27 -8
- package/ts_web/elements/00group-layout/dees-stepper/dees-stepper.ts +55 -28
- package/ts_web/elements/00group-layout/dees-stepper/styles.ts +22 -1
- package/ts_web/elements/00group-overlay/dees-popover/dees-popover.ts +17 -3
- package/ts_web/elements/00group-overlay/dees-speechbubble/dees-speechbubble.demo.ts +3 -2
- /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-5UGXWLMH.js.map → chunk-5SHHYXWB.js.map} +0 -0
- /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-modal-4QORKLGX.js.map → dees-modal-AH4CADKZ.js.map} +0 -0
- /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-workspace-terminal-7SYZG2AB.js.map → dees-workspace-terminal-PIUCRANN.js.map} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@design.estate/dees-catalog",
|
|
3
|
-
"version": "21.36.
|
|
3
|
+
"version": "21.36.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A comprehensive library that provides dynamic web components for building sophisticated and modern web applications using JavaScript and TypeScript.",
|
|
6
6
|
"main": "dist_ts_web/index.js",
|
package/readme.md
CHANGED
|
@@ -1385,7 +1385,7 @@ html`<dees-actionfooter .context=${card} .actions=${[
|
|
|
1385
1385
|
filters" while nothing is filtered; `disabled` on the footer makes every action unavailable.
|
|
1386
1386
|
- **Context.** Each action receives `context`, the dialog, bubble or card the footer belongs to,
|
|
1387
1387
|
or the footer itself when it is unset. `runPrimary()` runs the primary as a press would; a
|
|
1388
|
-
dialog
|
|
1388
|
+
dialog and a bubble run it on Enter in their form's last field.
|
|
1389
1389
|
- **Asked first.** `beforePrimary`, a function returning a boolean, is asked before the primary
|
|
1390
1390
|
runs, from a press as from `runPrimary()`; `false` holds it and the action does not run. The
|
|
1391
1391
|
other actions are never held. A dialog and a bubble ask their forms here, so a field that
|
|
@@ -1537,20 +1537,25 @@ so a form that is moved in the DOM or re-attached — a cached view, a re-opened
|
|
|
1537
1537
|
keeps reporting changes and submitting, with no duplicate events after any number of
|
|
1538
1538
|
re-attachments, and reports nothing while it is detached.
|
|
1539
1539
|
|
|
1540
|
-
As it connects, a form makes itself known to the nearest dialog (`dees-modal`)
|
|
1541
|
-
(`dees-popover`) around it, also through the shadow roots
|
|
1542
|
-
and that host's primary action asks it first
|
|
1543
|
-
the form of a dialog's body
|
|
1544
|
-
|
|
1540
|
+
As it connects, a form makes itself known to the nearest dialog (`dees-modal`), bubble
|
|
1541
|
+
(`dees-popover`) or stepper step (`dees-stepper`) around it, also through the shadow roots
|
|
1542
|
+
of the components between them, and that host's primary action asks it first
|
|
1543
|
+
(`reportValidity()`). A component may draw the form of a dialog's body, a bubble's content
|
|
1544
|
+
or a step in its own shadow root. A bubble whose element is defined after a form in its
|
|
1545
|
+
own markup (static HTML that upgrades once the element loads) finds that form as it is
|
|
1546
|
+
created, and takes it from a host farther out that held it until then. A stepper
|
|
1547
|
+
keeps its steps' forms to itself, so a dialog around it does not ask them, and a bubble
|
|
1548
|
+
keeps its form from the dialog or step around it.
|
|
1545
1549
|
|
|
1546
1550
|
Enter in a field moves to the next enabled field; in the last one it submits. With a
|
|
1547
1551
|
`dees-form-submit`, that is the button's `submit()`. Without one, the form dispatches
|
|
1548
1552
|
`form-submit-request` (bubbling, composed, cancelable; the name is exported as
|
|
1549
1553
|
`formSubmitRequestEvent`) and the field keeps the focus: `dees-stepper` answers it with
|
|
1550
|
-
the step's primary action
|
|
1551
|
-
as a click on that button, gated the same way: a
|
|
1552
|
-
action, by click as by Enter.
|
|
1553
|
-
|
|
1554
|
+
the step's primary action, `dees-popover` with its primary action and `dees-modal` with
|
|
1555
|
+
its last (accent) action, each exactly as a click on that button, gated the same way: a
|
|
1556
|
+
field the form refuses holds that action, by click as by Enter. The request never leaves
|
|
1557
|
+
a bubble, so the dialog or step around it does not answer it. A form nobody answers for
|
|
1558
|
+
submits itself: it gathers and dispatches `formData`. A held Enter submits once; its repeats are
|
|
1554
1559
|
ignored. Multiline editors, composition, buttons and pickers keep Enter for themselves.
|
|
1555
1560
|
|
|
1556
1561
|
```typescript
|
|
@@ -4633,7 +4638,7 @@ The catalog's one speech bubble: nonmodal content anchored in the browser's top
|
|
|
4633
4638
|
- **Placement.** `.placement` (`TDeesPopoverPlacement`) is `'auto'` by default: the bubble measures the room around the part of its anchor the reader sees — its box cut by the viewport and the scroll containers around it — and opens below or above it, wherever it fits with more room (below a header, above a footer), beside it only when neither fits, and on the side with the most room for its size when nothing fits. `'top'`, `'bottom'`, `'start'` and `'end'` (the inline sides in the anchor's writing direction; `'end'` is the right in a left-to-right page) name the side, which then holds. Either way the bubble keeps 8px from the viewport's edges, sliding along its side, and its tail keeps pointing at the anchor's middle. The side it took is the `actual-placement` attribute (`top`, `bottom`, `left`, `right`). While open it places itself again as the page scrolls or resizes and as its anchor or its content resizes, keeping its side while it still fits there. It eases in from its anchor on that side, at once under `prefers-reduced-motion: reduce`.
|
|
4634
4639
|
- **Scrolling.** Content taller than `.maxHeight` scrolls inside the bubble's frame and fades out toward the edges past which more lies ([Scroll edges](#scroll-edges), the fade look); content that fits fades nowhere.
|
|
4635
4640
|
- **Controls inside.** A dropdown's list, a date picker or a context menu opened from a control inside the bubble shows above it: they mount in the bubble's own top layer (its `overlayLayer`, which `getOverlayContainer` finds as it finds an open dialog), and the bubble leaves the keys to them while one is open, so Escape closes the list first and the bubble with the next press. A press in the list does not close the bubble. A toast raised inside the bubble is no part of it: it shows above the bubble and stays when it closes.
|
|
4636
|
-
- **Actions.** `.actions` (`IActionFooterAction<DeesPopover>[]`) are the bubble's actions about what it shows, such as a filter bubble's "Clear filters". They stand in its [action footer](#deesactionfooter) at the bottom edge, which stays in place while the content scrolls: the primary rightmost (the last action unless one carries `primary`; `primary: false` on all of them draws plain buttons), one action at a time, each called with the bubble, a failure announced with the source `popover-action`. The primary waits for the forms of the content, also a form inside the shadow root of a component in it: while a field refuses its value, a press on the primary leaves it unrun, and the first refused field says why and takes the focus. A press on one keeps the bubble open. When the tail leaves the bubble from the footer — the bubble above its anchor, or beside it level with the footer — it takes the footer's tint. Without actions the bubble has no footer; a tooltip has none.
|
|
4641
|
+
- **Actions.** `.actions` (`IActionFooterAction<DeesPopover>[]`) are the bubble's actions about what it shows, such as a filter bubble's "Clear filters". They stand in its [action footer](#deesactionfooter) at the bottom edge, which stays in place while the content scrolls: the primary rightmost (the last action unless one carries `primary`; `primary: false` on all of them draws plain buttons), one action at a time, each called with the bubble, a failure announced with the source `popover-action`. The primary waits for the forms of the content, also a form inside the shadow root of a component in it: while a field refuses its value, a press on the primary, or Enter in the form's last field, leaves it unrun, and the first refused field says why and takes the focus. Enter in a form's last field runs the primary as a press does; the form's request to submit never leaves the bubble, so a dialog or step around it never runs its own primary for it, and a bubble without actions lets its form submit itself. A press on one keeps the bubble open. When the tail leaves the bubble from the footer — the bubble above its anchor, or beside it level with the footer — it takes the footer's tint. Without actions the bubble has no footer; a tooltip has none.
|
|
4637
4642
|
- **Tooltip.** A host that opens the bubble on hover gives it `role="tooltip"`: it is then named by its content, not by `.label`, and leaves its anchor's state alone (no `aria-expanded`, `aria-haspopup` or `aria-controls`); the host describes the anchor by it. `dees-speechbubble` does this for its rich bubbles.
|
|
4638
4643
|
|
|
4639
4644
|
```typescript
|
|
@@ -4729,8 +4734,10 @@ modal with `DeesStepper.createAndShow({ steps, cancelable: true })`.
|
|
|
4729
4734
|
(`IStepMenuItem`): then only the first action marked `primary: true` is, and a
|
|
4730
4735
|
step whose actions are all `primary: false` has none, so a lookup's own Cancel is
|
|
4731
4736
|
an ordinary button that stays usable while the lookup runs and after it failed.
|
|
4732
|
-
A nested `dees-form
|
|
4733
|
-
|
|
4737
|
+
A nested `dees-form`, also one inside the shadow root of a component the step is
|
|
4738
|
+
made of, gates the primary on its required fields and dispatches
|
|
4739
|
+
collected `formData` before the action runs; Enter in its last field runs the
|
|
4740
|
+
primary as a click does. A field the form refuses (its
|
|
4734
4741
|
`checkValidity()` fails) holds the action: the field says why and takes the focus,
|
|
4735
4742
|
and the step stays. A running or failed progress step holds the primary too. While required fields are empty, "Complete required fields" shows
|
|
4736
4743
|
in the footer right before the primary; it fades without changing the footer's size.
|
|
@@ -4751,6 +4758,9 @@ modal with `DeesStepper.createAndShow({ steps, cancelable: true })`.
|
|
|
4751
4758
|
ArrowDown go to the step before and after; ArrowLeft and ArrowRight follow the
|
|
4752
4759
|
writing direction in both layouts (in a right-to-left page ArrowLeft goes to the
|
|
4753
4760
|
later step). The counter under it reads "2 of 4" (`stepCounter: 'total'`, default).
|
|
4761
|
+
The room the ribbon and its counter take beside the steps stays free on their other
|
|
4762
|
+
side too, so the card stands in the exact middle of the stepper's width however long
|
|
4763
|
+
the counter reads and however little room the card leaves.
|
|
4754
4764
|
- **Going back from the ribbon.** A completed marker is a button back to its step
|
|
4755
4765
|
(a click, a tap, Enter or Space), when every step from the one after it up to the
|
|
4756
4766
|
current one allows going back (`allowBack`) and no action is running. The current
|
|
@@ -4836,7 +4846,8 @@ modal with `DeesStepper.createAndShow({ steps, cancelable: true })`.
|
|
|
4836
4846
|
|
|
4837
4847
|
The catalog demo combines setup fields, preferences, a review, background work,
|
|
4838
4848
|
and completion. **Retry example** fails the first background attempt and preserves
|
|
4839
|
-
the choices for recovery, **
|
|
4849
|
+
the choices for recovery, **Component step** a first step drawn by a component with
|
|
4850
|
+
its form in its own shadow root, **Lookup** a flow of unknown length (`'position'`),
|
|
4840
4851
|
**Choice first** a flow whose later steps follow the first step's answer (three
|
|
4841
4852
|
described choices in a `dees-input-radiogroup` named by the step's question; a text
|
|
4842
4853
|
that names no way to reach the contact stays on its step; its `beforeClose` asks first only once
|
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export const commitinfo = {
|
|
5
5
|
name: '@design.estate/dees-catalog',
|
|
6
|
-
version: '21.36.
|
|
6
|
+
version: '21.36.2',
|
|
7
7
|
description: 'A comprehensive library that provides dynamic web components for building sophisticated and modern web applications using JavaScript and TypeScript.'
|
|
8
8
|
}
|
|
@@ -19,6 +19,11 @@ export interface IFormConnectDetail {
|
|
|
19
19
|
/** The gate holding each form: a form that connects under another gate leaves the one it was under. */
|
|
20
20
|
const holders = new WeakMap<IGatedForm, FormGate>();
|
|
21
21
|
|
|
22
|
+
/** Makes a form known to the nearest host around it (`formConnectEvent`); a `dees-form` does so as it connects. */
|
|
23
|
+
export const announceForm = (form: IGatedForm): void => {
|
|
24
|
+
form.dispatchEvent(new CustomEvent<IFormConnectDetail>(formConnectEvent, { bubbles: true, composed: true, detail: { form } }));
|
|
25
|
+
};
|
|
26
|
+
|
|
22
27
|
/** A node's parent as drawn: a slotted node's slot, a shadow root's host. */
|
|
23
28
|
const drawnParent = (node: Node): Node | null =>
|
|
24
29
|
(node instanceof Element ? node.assignedSlot : null) ?? (node instanceof ShadowRoot ? node.host : node.parentNode);
|
|
@@ -43,13 +48,18 @@ const byDrawnOrder = (a: Node, b: Node): number => {
|
|
|
43
48
|
/**
|
|
44
49
|
* The forms a host's primary action waits for: every `dees-form` inside the host, also inside the
|
|
45
50
|
* shadow roots of the components its content is made of, that no nearer host claims. Created with
|
|
46
|
-
* the host, before its content renders, it hears each form connect (`formConnectEvent`).
|
|
51
|
+
* the host, before its content renders, it hears each form connect (`formConnectEvent`). A host
|
|
52
|
+
* that is upgraded around markup already on the page (static HTML whose `dees-form` was defined
|
|
53
|
+
* first) finds the forms that connected before it: they announce themselves again, so the nearest
|
|
54
|
+
* host around each claims it, this one or one inside it.
|
|
47
55
|
*/
|
|
48
56
|
export class FormGate {
|
|
49
57
|
private readonly forms = new Set<IGatedForm>();
|
|
50
58
|
|
|
51
|
-
|
|
59
|
+
/** `onClaim` is told of each form the gate claims, once the form is its own. */
|
|
60
|
+
constructor(private readonly host: HTMLElement, private readonly onClaim?: (form: IGatedForm) => void) {
|
|
52
61
|
host.addEventListener(formConnectEvent, this.claim);
|
|
62
|
+
for (const form of host.querySelectorAll<IGatedForm>('dees-form:defined')) if (form.isConnected) announceForm(form);
|
|
53
63
|
}
|
|
54
64
|
|
|
55
65
|
/**
|
|
@@ -57,10 +67,18 @@ export class FormGate {
|
|
|
57
67
|
* field that refuses reports why and takes the focus, and the answer is `false`. For a footer's
|
|
58
68
|
* `beforePrimary`.
|
|
59
69
|
*/
|
|
60
|
-
public readonly accept = (): boolean =>
|
|
70
|
+
public readonly accept = (): boolean => this.held().every((form) => form.reportValidity());
|
|
71
|
+
|
|
72
|
+
/** The forms the gate holds, in the order they are drawn. */
|
|
73
|
+
public held(): IGatedForm[] {
|
|
61
74
|
this.release();
|
|
62
|
-
return [...this.forms].sort(byDrawnOrder)
|
|
63
|
-
}
|
|
75
|
+
return [...this.forms].sort(byDrawnOrder);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** Whether this form is one the gate holds: Enter in it is the host's to answer (`form-submit-request`). */
|
|
79
|
+
public holds(target: EventTarget | undefined): boolean {
|
|
80
|
+
return this.held().includes(target as IGatedForm);
|
|
81
|
+
}
|
|
64
82
|
|
|
65
83
|
private readonly claim = (eventArg: Event): void => {
|
|
66
84
|
const { form } = (eventArg as CustomEvent<IFormConnectDetail>).detail;
|
|
@@ -69,6 +87,7 @@ export class FormGate {
|
|
|
69
87
|
holders.set(form, this);
|
|
70
88
|
this.forms.add(form);
|
|
71
89
|
this.release();
|
|
90
|
+
this.onClaim?.(form);
|
|
72
91
|
};
|
|
73
92
|
|
|
74
93
|
/** Lets go of the forms no longer inside the host. */
|
|
@@ -33,7 +33,7 @@ import './dees-form-section.js';
|
|
|
33
33
|
import { DeesTable } from '../../00group-dataview/dees-table/index.js';
|
|
34
34
|
import { demoFunc } from './dees-form.demo.js';
|
|
35
35
|
import { themeDefaultStyles } from '../../00theme.js';
|
|
36
|
-
import {
|
|
36
|
+
import { announceForm } from '../../00formgate.js';
|
|
37
37
|
|
|
38
38
|
// Unified set for form input types
|
|
39
39
|
const FORM_INPUT_TYPES = [
|
|
@@ -290,7 +290,7 @@ export class DeesForm extends DeesElement {
|
|
|
290
290
|
*/
|
|
291
291
|
public async connectedCallback(): Promise<void> {
|
|
292
292
|
const connecting = super.connectedCallback();
|
|
293
|
-
|
|
293
|
+
announceForm(this);
|
|
294
294
|
await connecting;
|
|
295
295
|
}
|
|
296
296
|
|
|
@@ -25,7 +25,23 @@ const contentStyles = html`<style>
|
|
|
25
25
|
.setup-success { display: flex; align-items: center; gap: 10px; margin: 0 0 20px; color: var(--dees-color-text-success); }
|
|
26
26
|
</style>`;
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
/**
|
|
29
|
+
* A step made of a component that draws its form in its own shadow root, as an
|
|
30
|
+
* app's step often is: the stepper asks that form before the step's primary all
|
|
31
|
+
* the same. The form's values leave the shadow root as the component's own
|
|
32
|
+
* `formData`.
|
|
33
|
+
*/
|
|
34
|
+
@customElement('dees-demo-stepper-workspace')
|
|
35
|
+
class DeesDemoStepperWorkspace extends DeesElement {
|
|
36
|
+
public render() {
|
|
37
|
+
return html`<dees-form @formData=${(event: CustomEvent) => this.dispatchEvent(new CustomEvent('formData', { detail: event.detail }))}>
|
|
38
|
+
<dees-input-text key="name" label="Workspace name" placeholder="Studio Notes" required></dees-input-text>
|
|
39
|
+
<dees-input-text key="email" label="Work email" placeholder="alex@example.com" type="email" required></dees-input-text>
|
|
40
|
+
</dees-form>`;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const createDemoSteps = (failFirst: boolean, finish: (name: string) => void, composed = false): IStep[] => {
|
|
29
45
|
const draft = { name: '', email: '', purpose: 'Product', updates: true };
|
|
30
46
|
let attempts = 0;
|
|
31
47
|
const summary = () => html`${contentStyles}<dl class="setup-summary">
|
|
@@ -42,10 +58,12 @@ const createDemoSteps = (failFirst: boolean, finish: (name: string) => void): IS
|
|
|
42
58
|
{
|
|
43
59
|
title: 'Create a workspace.',
|
|
44
60
|
description: 'Give your workspace a name and choose who will own it.',
|
|
45
|
-
content:
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
61
|
+
content: composed
|
|
62
|
+
? html`<dees-demo-stepper-workspace @formData=${collect}></dees-demo-stepper-workspace>`
|
|
63
|
+
: html`<dees-form @formData=${collect}>
|
|
64
|
+
<dees-input-text key="name" label="Workspace name" placeholder="Studio Notes" required></dees-input-text>
|
|
65
|
+
<dees-input-text key="email" label="Work email" placeholder="alex@example.com" type="email" required></dees-input-text>
|
|
66
|
+
</dees-form>`,
|
|
49
67
|
menuOptions: next,
|
|
50
68
|
},
|
|
51
69
|
{
|
|
@@ -282,7 +300,7 @@ class DeesDemoStepper extends DeesElement {
|
|
|
282
300
|
? choice.steps
|
|
283
301
|
: this.scenario === 'Long flow'
|
|
284
302
|
? createLongSteps(name => { this.result = `${name} is complete.`; })
|
|
285
|
-
: createDemoSteps(this.scenario === 'Retry example', name => { this.result = `${name} is ready.`; });
|
|
303
|
+
: createDemoSteps(this.scenario === 'Retry example', name => { this.result = `${name} is ready.`; }, this.scenario === 'Component step');
|
|
286
304
|
this.requestUpdate();
|
|
287
305
|
}
|
|
288
306
|
|
|
@@ -292,7 +310,7 @@ class DeesDemoStepper extends DeesElement {
|
|
|
292
310
|
cancelable,
|
|
293
311
|
layout: this.stepperLayout(),
|
|
294
312
|
cardAlign: this.stepperAlign(),
|
|
295
|
-
steps: createDemoSteps(this.scenario === 'Retry example', name => { this.result = `${name} is ready.`; }),
|
|
313
|
+
steps: createDemoSteps(this.scenario === 'Retry example', name => { this.result = `${name} is ready.`; }, this.scenario === 'Component step'),
|
|
296
314
|
});
|
|
297
315
|
}
|
|
298
316
|
|
|
@@ -307,7 +325,7 @@ class DeesDemoStepper extends DeesElement {
|
|
|
307
325
|
public render() {
|
|
308
326
|
return html`<div class="toolbar">
|
|
309
327
|
<dees-input-multitoggle size="sm" label="Demo scenario" labelPosition="none"
|
|
310
|
-
.options=${['Standard setup', 'Retry example', 'Lookup', 'Choice first', 'Long flow']} .selectedOption=${this.scenario}
|
|
328
|
+
.options=${['Standard setup', 'Retry example', 'Component step', 'Lookup', 'Choice first', 'Long flow']} .selectedOption=${this.scenario}
|
|
311
329
|
@change=${(event: CustomEvent<{ value: string }>) => { this.scenario = event.detail.value; this.reset(); }}></dees-input-multitoggle>
|
|
312
330
|
<dees-input-multitoggle size="sm" label="Demo width" labelPosition="none"
|
|
313
331
|
.options=${['Wide', 'Narrow']} .selectedOption=${this.width}
|
|
@@ -329,6 +347,7 @@ class DeesDemoStepper extends DeesElement {
|
|
|
329
347
|
<p class="caption">${this.scenario === 'Retry example' ? 'The first setup attempt pauses with an error. Try again to continue with your saved choices.'
|
|
330
348
|
: 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.'
|
|
331
349
|
: 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.'
|
|
350
|
+
: this.scenario === 'Component step' ? 'The first step is a component that draws its form in its own shadow root, as an app\'s step often is. Its required fields still hold Continue, a field that refuses its value says why and takes the focus, and Enter in the last field goes on.'
|
|
332
351
|
: 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.'
|
|
333
352
|
: '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>
|
|
334
353
|
<details><summary class="caption">Completion required</summary>
|
|
@@ -19,6 +19,7 @@ import { prefersReducedMotion } from '../../00motion.js';
|
|
|
19
19
|
import { DeesModal } from '../../00group-overlay/dees-modal/dees-modal.js';
|
|
20
20
|
import { provideOverlayI18n, type IOverlayI18nOptions } from '../../00overlay.js';
|
|
21
21
|
import { runAction } from '../../00actionerror.js';
|
|
22
|
+
import { FormGate } from '../../00formgate.js';
|
|
22
23
|
import type { DeesForm } from '../../00group-form/dees-form/dees-form.js';
|
|
23
24
|
import '../../00group-feedback/dees-progressbar/dees-progressbar.js';
|
|
24
25
|
import '../dees-tile/dees-tile.js';
|
|
@@ -300,10 +301,9 @@ export class DeesStepper extends DeesElement {
|
|
|
300
301
|
? html`<dialog class="stepperContainer overlay" aria-label=${label} aria-modal="true"
|
|
301
302
|
style=${`z-index: ${this.stepperZIndex};`} @cancel=${this.handleDialogCancel}
|
|
302
303
|
@keydown=${this.handleDialogKeydown} @close=${this.handleDialogClose}
|
|
303
|
-
@click=${this.handleOutsideClick} @form-submit-request=${this.handleFormSubmitRequest}
|
|
304
|
-
@form-connect=${this.claimStepForm}>${this.renderSurface()}</dialog>`
|
|
304
|
+
@click=${this.handleOutsideClick} @form-submit-request=${this.handleFormSubmitRequest}>${this.renderSurface()}</dialog>`
|
|
305
305
|
: html`<div class="stepperContainer" role="region" aria-label=${label}
|
|
306
|
-
@form-submit-request=${this.handleFormSubmitRequest}
|
|
306
|
+
@form-submit-request=${this.handleFormSubmitRequest}>${this.renderSurface()}</div>`;
|
|
307
307
|
}
|
|
308
308
|
|
|
309
309
|
private renderSurface() {
|
|
@@ -311,7 +311,8 @@ export class DeesStepper extends DeesElement {
|
|
|
311
311
|
const selectedIndex = this.getIndexOfStep(this.selectedStep);
|
|
312
312
|
// Back points the way the steps run back: to the inline start, which is the right in a right-to-left page.
|
|
313
313
|
const backIcon = this.matches(':dir(rtl)') ? 'lucide:ChevronRight' : 'lucide:ChevronLeft';
|
|
314
|
-
return html`<div class="stepperSurface" data-layout=${this.getLayout()} data-align=${this.cardAlign === 'center' ? 'center' : 'start'}
|
|
314
|
+
return html`<div class="stepperSurface" data-layout=${this.getLayout()} data-align=${this.cardAlign === 'center' ? 'center' : 'start'}
|
|
315
|
+
data-counter=${this.getCounterText()}>
|
|
315
316
|
${this.renderRibbon()}
|
|
316
317
|
<div class="stage">
|
|
317
318
|
${directives.repeat(this.steps.filter((step) => step === this.selectedStep || this.leavingSteps.has(step)), (step) => step, (stepArg) => {
|
|
@@ -409,12 +410,25 @@ export class DeesStepper extends DeesElement {
|
|
|
409
410
|
</li>`;
|
|
410
411
|
})}</ol>
|
|
411
412
|
</div>
|
|
412
|
-
${current < 0 ? '' : html`<span class="step-counter">${
|
|
413
|
-
? this.t('stepper.counterPosition', { current: current + 1 })
|
|
414
|
-
: this.t('stepper.counter', { current: current + 1, total: counted.length })}</span>`}
|
|
413
|
+
${current < 0 ? '' : html`<span class="step-counter">${this.getCounterText()}</span>`}
|
|
415
414
|
</div>`;
|
|
416
415
|
}
|
|
417
416
|
|
|
417
|
+
/**
|
|
418
|
+
* What the counter under the ribbon reads, empty without a counted step.
|
|
419
|
+
* The surface holds it as `data-counter` too: the styles keep the room it
|
|
420
|
+
* takes beside the steps free on their other side as well.
|
|
421
|
+
*/
|
|
422
|
+
private getCounterText(): string {
|
|
423
|
+
const counted = this.steps.filter((step) => step.countsAsStep !== false);
|
|
424
|
+
const owner = this.getCountedOwner(this.getIndexOfStep(this.selectedStep));
|
|
425
|
+
const current = owner ? counted.indexOf(owner) : -1;
|
|
426
|
+
if (current < 0) return '';
|
|
427
|
+
return this.stepCounter === 'position'
|
|
428
|
+
? this.t('stepper.counterPosition', { current: current + 1 })
|
|
429
|
+
: this.t('stepper.counter', { current: current + 1, total: counted.length });
|
|
430
|
+
}
|
|
431
|
+
|
|
418
432
|
/**
|
|
419
433
|
* Arrow keys, Home and End move the focus along the ribbon's markers.
|
|
420
434
|
* ArrowUp and ArrowDown go to the step before and after; ArrowLeft and
|
|
@@ -514,8 +528,11 @@ export class DeesStepper extends DeesElement {
|
|
|
514
528
|
* asynchronous directives in a step's content (a subscription) end when the
|
|
515
529
|
* stepper leaves the page or the step leaves the flow, and start again when
|
|
516
530
|
* the stepper returns. The host's listeners keep this stepper as their `this`.
|
|
531
|
+
* Each element claims the forms of its step (`FormGate`), also those inside the shadow roots of
|
|
532
|
+
* the components the step is made of, so a dialog or a bubble around the stepper does not ask
|
|
533
|
+
* them; the stepper asks the step's form before the step's primary.
|
|
517
534
|
*/
|
|
518
|
-
private readonly stepContents = new Map<IStep, { host: HTMLElement; content: TemplateResult; part: ReturnType<typeof render> }>();
|
|
535
|
+
private readonly stepContents = new Map<IStep, { host: HTMLElement; forms: FormGate; content: TemplateResult; part: ReturnType<typeof render> }>();
|
|
519
536
|
|
|
520
537
|
private renderStageContents(): void {
|
|
521
538
|
for (const step of this.steps) {
|
|
@@ -523,7 +540,8 @@ export class DeesStepper extends DeesElement {
|
|
|
523
540
|
let entry = this.stepContents.get(step);
|
|
524
541
|
if (!entry) {
|
|
525
542
|
const host = document.createElement('div');
|
|
526
|
-
|
|
543
|
+
const forms = new FormGate(host, (form) => void this.takeStepForm(step, form as DeesForm));
|
|
544
|
+
entry = { host, forms, content: step.content, part: render(step.content, host, { host: this, isConnected: this.isConnected }) };
|
|
527
545
|
this.stepContents.set(step, entry);
|
|
528
546
|
} else if (entry.content !== step.content) {
|
|
529
547
|
entry.part = render(step.content, entry.host, { host: this, isConnected: this.isConnected });
|
|
@@ -629,10 +647,9 @@ export class DeesStepper extends DeesElement {
|
|
|
629
647
|
const step = this.selectedStep;
|
|
630
648
|
const selectedStepElement = this.shadowRoot?.querySelector<HTMLElement>('.step.selected');
|
|
631
649
|
if (!selectedStepElement || !this.isConnected) return;
|
|
632
|
-
|
|
633
|
-
await form?.updateComplete;
|
|
650
|
+
await this.getStepForm(step)?.updateComplete;
|
|
634
651
|
if (!this.isConnected || step !== this.selectedStep) return;
|
|
635
|
-
this.scanActiveForm(
|
|
652
|
+
this.scanActiveForm();
|
|
636
653
|
if (!step.validationFuncCalled && step.validationFunc) {
|
|
637
654
|
step.abortController = new AbortController();
|
|
638
655
|
step.validationFuncCalled = true;
|
|
@@ -735,15 +752,33 @@ export class DeesStepper extends DeesElement {
|
|
|
735
752
|
}
|
|
736
753
|
|
|
737
754
|
/**
|
|
738
|
-
*
|
|
739
|
-
*
|
|
740
|
-
|
|
755
|
+
* The step's form: the first `dees-form` of its content as drawn, also one
|
|
756
|
+
* inside the shadow root of a component the step is made of.
|
|
757
|
+
*/
|
|
758
|
+
private getStepForm(stepArg: IStep): DeesForm | null {
|
|
759
|
+
return (this.stepContents.get(stepArg)?.forms.held()[0] as DeesForm | undefined) ?? null;
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
/**
|
|
763
|
+
* A form connected in a step's content. A component draws its form after
|
|
764
|
+
* the step came on the stage: once the form has rendered, the selected
|
|
765
|
+
* step reads it for its primary.
|
|
766
|
+
*/
|
|
767
|
+
private async takeStepForm(stepArg: IStep, formArg: DeesForm) {
|
|
768
|
+
await formArg.updateComplete;
|
|
769
|
+
if (this.isConnected && stepArg === this.selectedStep) this.scanActiveForm();
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
/**
|
|
773
|
+
* Reads the selected step's form (`getStepForm`). When it has one, subscribes
|
|
774
|
+
* to the form's RxJS changeSubject so the primary menuOption button can
|
|
775
|
+
* auto-enable/disable as required fields are filled.
|
|
741
776
|
*
|
|
742
777
|
* If the form reference is the same as the previous activation (e.g. on a
|
|
743
778
|
* same-step re-render), we just recompute validity without re-subscribing.
|
|
744
779
|
*/
|
|
745
|
-
private scanActiveForm(
|
|
746
|
-
const form =
|
|
780
|
+
private scanActiveForm() {
|
|
781
|
+
const form = this.getStepForm(this.selectedStep);
|
|
747
782
|
if (form === this.activeForm) {
|
|
748
783
|
this.recomputeFormValid();
|
|
749
784
|
return;
|
|
@@ -816,7 +851,8 @@ export class DeesStepper extends DeesElement {
|
|
|
816
851
|
}
|
|
817
852
|
|
|
818
853
|
/**
|
|
819
|
-
* Enter in the last field of the current step's form
|
|
854
|
+
* Enter in the last field of the current step's form, also a form inside the
|
|
855
|
+
* shadow root of a component the step is made of, runs the step's primary,
|
|
820
856
|
* exactly as a click on it: held by empty required fields, running work or a
|
|
821
857
|
* failed progress step, and never twice. A step without a primary leaves the
|
|
822
858
|
* request to the form.
|
|
@@ -824,7 +860,7 @@ export class DeesStepper extends DeesElement {
|
|
|
824
860
|
private handleFormSubmitRequest(eventArg: Event): void {
|
|
825
861
|
const step = this.selectedStep;
|
|
826
862
|
const primary = step ? this.getPrimaryAction(step) : undefined;
|
|
827
|
-
if (!primary || eventArg.
|
|
863
|
+
if (!primary || eventArg.composedPath()[0] !== this.activeForm) return;
|
|
828
864
|
eventArg.preventDefault();
|
|
829
865
|
eventArg.stopPropagation();
|
|
830
866
|
this.recomputeFormValid();
|
|
@@ -832,15 +868,6 @@ export class DeesStepper extends DeesElement {
|
|
|
832
868
|
void this.handleMenuOptionClick(primary, true);
|
|
833
869
|
}
|
|
834
870
|
|
|
835
|
-
/**
|
|
836
|
-
* The steps' forms are the stepper's own: it asks the selected step's form
|
|
837
|
-
* before the step's primary, so a dialog or a bubble around the stepper does
|
|
838
|
-
* not (see `formConnectEvent`).
|
|
839
|
-
*/
|
|
840
|
-
private claimStepForm(eventArg: Event): void {
|
|
841
|
-
eventArg.stopPropagation();
|
|
842
|
-
}
|
|
843
|
-
|
|
844
871
|
private getProgressStepState(stepArg: IStep): IStepProgressState {
|
|
845
872
|
if (!stepArg.progressStep) {
|
|
846
873
|
return {};
|
|
@@ -86,6 +86,7 @@ const verticalLayout = css`
|
|
|
86
86
|
}
|
|
87
87
|
& .step-rail li { width: var(--stepper-pitch); height: 100%; }
|
|
88
88
|
& .stage { grid-column: 1; grid-row: 2; justify-self: center; width: 100%; max-width: var(--dees-stepper-width, 520px); }
|
|
89
|
+
&::after { content: none; }
|
|
89
90
|
`;
|
|
90
91
|
|
|
91
92
|
/*
|
|
@@ -329,7 +330,7 @@ export const stepperStyles = css`
|
|
|
329
330
|
.step-marker[aria-disabled='false']:hover .dot { --dot-size: 12px; }
|
|
330
331
|
/* Keyboard focus rings the dot's box, apart from anything that marks the current step. */
|
|
331
332
|
.step-marker:focus-visible .dot { outline: var(--dees-line-width-focus-ring) solid var(--dees-color-focus-ring); outline-offset: 4px; }
|
|
332
|
-
.step-counter {
|
|
333
|
+
.step-counter, .stepperSurface::after {
|
|
333
334
|
flex: none;
|
|
334
335
|
padding: 0 var(--dees-spacing-sm);
|
|
335
336
|
border: var(--dees-line-width-hairline) solid var(--dees-color-border-subtle);
|
|
@@ -343,6 +344,26 @@ export const stepperStyles = css`
|
|
|
343
344
|
white-space: nowrap;
|
|
344
345
|
}
|
|
345
346
|
|
|
347
|
+
/*
|
|
348
|
+
* The ribbon's room beside the steps, kept free on their other side as well: an
|
|
349
|
+
* invisible copy of the counter (\`data-counter\`), at least as wide as the
|
|
350
|
+
* markers, holds the inline-end column as wide as the ribbon holds the start
|
|
351
|
+
* one, so the card stands in the exact middle however long the counter reads
|
|
352
|
+
* and however little room the card leaves.
|
|
353
|
+
*/
|
|
354
|
+
.stepperSurface::after {
|
|
355
|
+
content: attr(data-counter);
|
|
356
|
+
grid-column: 3;
|
|
357
|
+
grid-row: 1 / -1;
|
|
358
|
+
justify-self: start;
|
|
359
|
+
align-self: center;
|
|
360
|
+
box-sizing: border-box;
|
|
361
|
+
/* a set width, so the column's least size is the copy's width, not its min-width alone */
|
|
362
|
+
width: max-content;
|
|
363
|
+
min-width: var(--stepper-rail);
|
|
364
|
+
visibility: hidden;
|
|
365
|
+
}
|
|
366
|
+
|
|
346
367
|
/* --- The steps --- */
|
|
347
368
|
.stage {
|
|
348
369
|
grid-column: 2;
|
|
@@ -97,8 +97,8 @@ export class DeesPopover extends DeesElement implements IOverlayLayerHost {
|
|
|
97
97
|
* The bubble's actions, drawn by `dees-actionfooter` at its bottom edge: the primary rightmost,
|
|
98
98
|
* one action at a time, each called with the bubble; the footer stays in place while the content
|
|
99
99
|
* scrolls. The primary waits for the forms of the content: the first field that refuses says why
|
|
100
|
-
* and takes the focus.
|
|
101
|
-
* has no footer; a tooltip has no actions.
|
|
100
|
+
* and takes the focus. Enter in the last field of a form runs the primary. A failure is announced
|
|
101
|
+
* with the source `popover-action`. Empty, the bubble has no footer; a tooltip has no actions.
|
|
102
102
|
*/
|
|
103
103
|
@property({ attribute: false })
|
|
104
104
|
accessor actions: IActionFooterAction<DeesPopover>[] = [];
|
|
@@ -279,7 +279,7 @@ export class DeesPopover extends DeesElement implements IOverlayLayerHost {
|
|
|
279
279
|
|
|
280
280
|
public render(): TemplateResult {
|
|
281
281
|
return html`
|
|
282
|
-
<div class="surface"><div class="content ${this.scrollEdges.fadeClasses()}"><slot></slot></div>${this.actions.length
|
|
282
|
+
<div class="surface" @form-submit-request=${this.handleFormSubmitRequest}><div class="content ${this.scrollEdges.fadeClasses()}"><slot></slot></div>${this.actions.length
|
|
283
283
|
? html`<dees-actionfooter class="actions" .actions=${this.actions} .context=${this}
|
|
284
284
|
.beforePrimary=${this.formGate.accept} source="popover-action"></dees-actionfooter>`
|
|
285
285
|
: ''}</div>
|
|
@@ -306,6 +306,20 @@ export class DeesPopover extends DeesElement implements IOverlayLayerHost {
|
|
|
306
306
|
this.requestClose('explicit', true);
|
|
307
307
|
}
|
|
308
308
|
|
|
309
|
+
/**
|
|
310
|
+
* Enter in the last field of a form in the bubble. A form the bubble holds runs the bubble's
|
|
311
|
+
* primary, as a click on it would, and waits for the bubble's forms as the click does. The request
|
|
312
|
+
* never leaves the bubble, so a dialog around it does not take it for its own; a form without a
|
|
313
|
+
* primary to run (a bubble without actions, a form a host inside the bubble holds) submits itself.
|
|
314
|
+
*/
|
|
315
|
+
private handleFormSubmitRequest(eventArg: Event): void {
|
|
316
|
+
eventArg.stopPropagation();
|
|
317
|
+
const footer = this.shadowRoot?.querySelector('dees-actionfooter');
|
|
318
|
+
if (!footer?.primaryAction || !this.formGate.holds(eventArg.composedPath()[0])) return;
|
|
319
|
+
eventArg.preventDefault();
|
|
320
|
+
void footer.runPrimary();
|
|
321
|
+
}
|
|
322
|
+
|
|
309
323
|
/** Focus an explicitly autofocused or first interactive slotted element. */
|
|
310
324
|
public async focusFirst(): Promise<void> {
|
|
311
325
|
await this.updateComplete;
|
|
@@ -49,7 +49,7 @@ popover.open = true; // placement 'auto': below or above, wherever it fits`)}
|
|
|
49
49
|
${placed('End', 'end')}
|
|
50
50
|
</div>
|
|
51
51
|
`)}
|
|
52
|
-
${demoSection('A form in the bubble', 'The primary action waits for the bubble\'s form, as a dialog\'s does: a field that refuses its value says why and takes the focus. Clear never waits.', html`
|
|
52
|
+
${demoSection('A form in the bubble', 'The primary action waits for the bubble\'s form, as a dialog\'s does: a field that refuses its value says why and takes the focus. Enter in the last field runs the primary, as a click on it does. Clear never waits.', html`
|
|
53
53
|
<div class="dees-demo-row">
|
|
54
54
|
<span>
|
|
55
55
|
<dees-button type="outline" text="Note on booking" @clicked=${toggle}></dees-button>
|
|
@@ -57,10 +57,11 @@ popover.open = true; // placement 'auto': below or above, wherever it fits`)}
|
|
|
57
57
|
<dees-form style="padding: var(--dees-spacing-lg)">
|
|
58
58
|
<dees-input-textarea key="note" label="Note" .rows=${3} .maxLength=${80}
|
|
59
59
|
.value=${'Paid by the customer in two parts: the deposit in March and the rest after delivery in April.'}></dees-input-textarea>
|
|
60
|
+
<dees-input-text key="reference" label="Reference" placeholder="INV-2026-0142"></dees-input-text>
|
|
60
61
|
</dees-form>
|
|
61
62
|
</dees-popover>
|
|
62
63
|
</span>
|
|
63
|
-
</div>${demoOutput('Save the note: the bubble holds it until it fits in 80 characters.')}
|
|
64
|
+
</div>${demoOutput('Save the note, or press Enter in Reference: the bubble holds it until it fits in 80 characters.')}
|
|
64
65
|
${demoCode(`popover.actions = [clear, { name: 'Save note', action: save }];
|
|
65
66
|
// the primary waits until the form's fields accept their values
|
|
66
67
|
popover.innerHTML = '<dees-form><dees-input-textarea key="note" maxlength="80"></dees-input-textarea></dees-form>';`)}
|
/package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-5UGXWLMH.js.map → chunk-5SHHYXWB.js.map}
RENAMED
|
File without changes
|
|
File without changes
|