@design.estate/dees-catalog 21.32.1 → 21.32.3

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.
Files changed (38) hide show
  1. package/dist_bundle/bundle.js +52 -18
  2. package/dist_bundle/bundle.js.map +1 -1
  3. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-VSNSBXUT.js → chunk-EL3KNDIB.js} +300 -182
  4. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-VSNSBXUT.js.map → chunk-EL3KNDIB.js.map} +1 -1
  5. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-PMJELHWH.js → chunk-ZRD47DC6.js} +2 -2
  6. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-modal-JVYREEMV.js → dees-modal-7LJGK5SK.js} +2 -2
  7. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-workspace-terminal-RIABBONK.js → dees-workspace-terminal-O3NEQ4DO.js} +3 -3
  8. package/dist_ts_web/00_commitinfo_data.js +1 -1
  9. package/dist_ts_web/elements/00formgate.d.ts +35 -0
  10. package/dist_ts_web/elements/00formgate.js +80 -0
  11. package/dist_ts_web/elements/00group-form/dees-form/dees-form.d.ts +6 -0
  12. package/dist_ts_web/elements/00group-form/dees-form/dees-form.js +12 -1
  13. package/dist_ts_web/elements/00group-kanban/dees-kanban-card/dees-kanban-card.js +23 -11
  14. package/dist_ts_web/elements/00group-kanban/dees-kanban-column/dees-kanban-column.js +3 -1
  15. package/dist_ts_web/elements/00group-layout/dees-stepper/dees-stepper.d.ts +6 -0
  16. package/dist_ts_web/elements/00group-layout/dees-stepper/dees-stepper.js +12 -3
  17. package/dist_ts_web/elements/00group-overlay/dees-modal/dees-modal.d.ts +5 -4
  18. package/dist_ts_web/elements/00group-overlay/dees-modal/dees-modal.demo.d.ts +2 -1
  19. package/dist_ts_web/elements/00group-overlay/dees-modal/dees-modal.demo.js +86 -25
  20. package/dist_ts_web/elements/00group-overlay/dees-modal/dees-modal.js +8 -6
  21. package/dist_ts_web/elements/00group-overlay/dees-popover/dees-popover.d.ts +8 -2
  22. package/dist_ts_web/elements/00group-overlay/dees-popover/dees-popover.js +12 -4
  23. package/dist_ts_web/elements/00group-overlay/dees-speechbubble/dees-speechbubble.demo.js +27 -2
  24. package/package.json +1 -1
  25. package/readme.md +12 -5
  26. package/ts_web/00_commitinfo_data.ts +1 -1
  27. package/ts_web/elements/00formgate.ts +90 -0
  28. package/ts_web/elements/00group-form/dees-form/dees-form.ts +12 -0
  29. package/ts_web/elements/00group-kanban/dees-kanban-card/dees-kanban-card.ts +22 -10
  30. package/ts_web/elements/00group-kanban/dees-kanban-column/dees-kanban-column.ts +2 -0
  31. package/ts_web/elements/00group-layout/dees-stepper/dees-stepper.ts +12 -2
  32. package/ts_web/elements/00group-overlay/dees-modal/dees-modal.demo.ts +42 -24
  33. package/ts_web/elements/00group-overlay/dees-modal/dees-modal.ts +7 -7
  34. package/ts_web/elements/00group-overlay/dees-popover/dees-popover.ts +11 -3
  35. package/ts_web/elements/00group-overlay/dees-speechbubble/dees-speechbubble.demo.ts +30 -1
  36. /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-PMJELHWH.js.map → chunk-ZRD47DC6.js.map} +0 -0
  37. /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-modal-JVYREEMV.js.map → dees-modal-7LJGK5SK.js.map} +0 -0
  38. /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-workspace-terminal-RIABBONK.js.map → dees-workspace-terminal-O3NEQ4DO.js.map} +0 -0
@@ -27,7 +27,7 @@ import '../../00group-button/dees-button-exit/dees-button-exit.js';
27
27
  import '../../00group-utility/dees-icon/dees-icon.js';
28
28
  import { themeDefaultStyles } from '../../00theme.js';
29
29
  import { DeesInputText } from '../../00group-input/dees-input-text/dees-input-text.js';
30
- import type { DeesForm } from '../../00group-form/dees-form/dees-form.js';
30
+ import { FormGate } from '../../00formgate.js';
31
31
 
32
32
  declare global {
33
33
  interface HTMLElementTagNameMap {
@@ -455,7 +455,7 @@ export class DeesModal extends DeesElement {
455
455
  ${this.menuOptions.length ? html`
456
456
  <dees-actionfooter class="bottomButtons" .actions=${this.menuOptions} .context=${this}
457
457
  .primaryActionType=${this.primaryActionType} .disabled=${this.promptPending}
458
- .beforePrimary=${this.formsAccept} source="modal-menu"></dees-actionfooter>
458
+ .beforePrimary=${this.formGate.accept} source="modal-menu"></dees-actionfooter>
459
459
  ` : ''}
460
460
  </section>
461
461
  </dialog>
@@ -566,12 +566,12 @@ export class DeesModal extends DeesElement {
566
566
  }
567
567
 
568
568
  /**
569
- * Whether the forms in the dialog's content accept their values. The first
570
- * field that refuses reports why and takes the focus, and the primary action
571
- * waits for it, from a press as from Enter.
569
+ * The forms of the dialog's content, also those inside the shadow roots of
570
+ * the components it is made of. The first field that refuses reports why and
571
+ * takes the focus, and the primary action waits for it, from a press as from
572
+ * Enter.
572
573
  */
573
- private readonly formsAccept = (): boolean =>
574
- [...this.shadowRoot?.querySelectorAll<DeesForm>('.content dees-form') ?? []].every((form) => form.reportValidity());
574
+ private readonly formGate = new FormGate(this);
575
575
 
576
576
  /**
577
577
  * Enter in the last field of a form in this dialog runs the dialog's primary
@@ -13,6 +13,7 @@ import { dcLocalize } from '../../../i18n/localize.js';
13
13
  import { deepActiveElement, type IOverlayLayerHost } from '../../00overlay.js';
14
14
  import { listenForScrollAround, placeAnchored, visibleRect, type TAnchoredPlacement, type TAnchoredSide } from '../../00anchorplacement.js';
15
15
  import { ScrollEdgeShadowController, scrollEdgeFadeStyles } from '../../00scrolledges.js';
16
+ import { FormGate } from '../../00formgate.js';
16
17
  import type { DeesWindowLayer } from '../dees-windowlayer/dees-windowlayer.js';
17
18
  import type { IActionFooterAction } from '../../00group-button/dees-actionfooter/dees-actionfooter.js';
18
19
  import '../../00group-button/dees-actionfooter/dees-actionfooter.js';
@@ -95,8 +96,9 @@ export class DeesPopover extends DeesElement implements IOverlayLayerHost {
95
96
  /**
96
97
  * The bubble's actions, drawn by `dees-actionfooter` at its bottom edge: the primary rightmost,
97
98
  * one action at a time, each called with the bubble; the footer stays in place while the content
98
- * scrolls. A failure is announced with the source `popover-action`. Empty, the bubble has no
99
- * footer; a tooltip has no actions.
99
+ * scrolls. The primary waits for the forms of the content: the first field that refuses says why
100
+ * and takes the focus. A failure is announced with the source `popover-action`. Empty, the bubble
101
+ * has no footer; a tooltip has no actions.
100
102
  */
101
103
  @property({ attribute: false })
102
104
  accessor actions: IActionFooterAction<DeesPopover>[] = [];
@@ -112,6 +114,11 @@ export class DeesPopover extends DeesElement implements IOverlayLayerHost {
112
114
  private accessor tailOnActions = false;
113
115
  /** Content taller than the bubble scrolls, fading out toward an edge past which more lies. */
114
116
  private readonly scrollEdges = new ScrollEdgeShadowController(this, () => this.shadowRoot?.querySelector<HTMLElement>('.content'));
117
+ /**
118
+ * The forms of the bubble's content, also those inside the shadow roots of the components it is
119
+ * made of: the primary action waits for them as a dialog's does.
120
+ */
121
+ private readonly formGate = new FormGate(this);
115
122
 
116
123
  public static styles = [
117
124
  themeDefaultStyles,
@@ -273,7 +280,8 @@ export class DeesPopover extends DeesElement implements IOverlayLayerHost {
273
280
  public render(): TemplateResult {
274
281
  return html`
275
282
  <div class="surface"><div class="content ${this.scrollEdges.fadeClasses()}"><slot></slot></div>${this.actions.length
276
- ? html`<dees-actionfooter class="actions" .actions=${this.actions} .context=${this} source="popover-action"></dees-actionfooter>`
283
+ ? html`<dees-actionfooter class="actions" .actions=${this.actions} .context=${this}
284
+ .beforePrimary=${this.formGate.accept} source="popover-action"></dees-actionfooter>`
277
285
  : ''}</div>
278
286
  ${this.showTail ? html`<span class="tail ${this.tailOnActions ? 'onActions' : ''}" aria-hidden="true"></span>` : ''}
279
287
  <div class="overlayLayer"></div>
@@ -1,6 +1,9 @@
1
1
  import { html } from '@design.estate/dees-element';
2
- import { demoCode, demoPage, demoSection } from '../../../demos/templates.js';
2
+ import { demoCode, demoOutput, demoPage, demoSection, showDemoResult } from '../../../demos/templates.js';
3
3
  import type { DeesPopover } from '../dees-popover/dees-popover.js';
4
+ import type { IActionFooterAction } from '../../00group-button/dees-actionfooter/dees-actionfooter.js';
5
+ import type { DeesForm } from '../../00group-form/dees-form/dees-form.js';
6
+ import type { DeesInputTextarea } from '../../00group-input/dees-input-textarea/dees-input-textarea.js';
4
7
  import '../dees-popover/dees-popover.js';
5
8
  import '../../00group-layout/dees-label/dees-label.js';
6
9
 
@@ -22,6 +25,16 @@ const placed = (label: string, placement: DeesPopover['placement']) => html`
22
25
  <dees-popover .placement=${placement} label=${label} width="min(260px, calc(100vw - 16px))">${bubbleText}</dees-popover>
23
26
  </span>`;
24
27
 
28
+ /** A booking's note fits in 80 characters; the one given is longer, so Save waits until it is shortened. */
29
+ const noteActions: IActionFooterAction<DeesPopover>[] = [
30
+ { name: 'Clear', action: async (bubble) => { bubble!.querySelector<DeesInputTextarea>('dees-input-textarea')!.setValue(''); } },
31
+ { name: 'Save note', action: async (bubble) => {
32
+ const { note } = await bubble!.querySelector<DeesForm>('dees-form')!.collectFormData();
33
+ showDemoResult(bubble!.anchor!, `Saved: ${String(note) || 'no note'}`);
34
+ bubble!.close();
35
+ } },
36
+ ];
37
+
25
38
  export const demoFunc = () => demoPage('Speech bubble', 'The catalog\'s one speech bubble: a status button\'s panel, a table\'s or tile\'s footer info and a label\'s information are all a dees-popover, with its tail on what it belongs to. It opens where it fits unless a side is named, stays inside the window, and places itself again as the page scrolls.', html`
26
39
  ${demoSection('Opens where it fits', 'Without a named side the bubble opens below or above its anchor, wherever it fits with more room — below a page header, above a footer — and beside it only when neither fits. Scroll the page so a button sits near the bottom of the window, then press it.', html`
27
40
  <div class="dees-demo-row">${placed('Where it fits', 'auto')}</div>
@@ -36,6 +49,22 @@ popover.open = true; // placement 'auto': below or above, wherever it fits`)}
36
49
  ${placed('End', 'end')}
37
50
  </div>
38
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`
53
+ <div class="dees-demo-row">
54
+ <span>
55
+ <dees-button type="outline" text="Note on booking" @clicked=${toggle}></dees-button>
56
+ <dees-popover label="Note on booking" .actions=${noteActions}>
57
+ <dees-form style="padding: var(--dees-spacing-lg)">
58
+ <dees-input-textarea key="note" label="Note" .rows=${3} .maxLength=${80}
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-form>
61
+ </dees-popover>
62
+ </span>
63
+ </div>${demoOutput('Save the note: the bubble holds it until it fits in 80 characters.')}
64
+ ${demoCode(`popover.actions = [clear, { name: 'Save note', action: save }];
65
+ // the primary waits until the form's fields accept their values
66
+ popover.innerHTML = '<dees-form><dees-input-textarea key="note" maxlength="80"></dees-input-textarea></dees-form>';`)}
67
+ `)}
39
68
  ${demoSection('Information on hover', 'A label\'s information, and any dees-speechbubble after a control, opens the same bubble as a tooltip on hover or keyboard focus and describes its control while it shows.', html`
40
69
  <dees-label label="Region" infoText="Choose the **nearest** region. Data stays in the region you choose."></dees-label>
41
70
  `)}