@design.estate/dees-catalog 21.36.0 → 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.
Files changed (33) hide show
  1. package/dist_bundle/bundle.js +820 -758
  2. package/dist_bundle/bundle.js.map +1 -1
  3. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-5UGXWLMH.js → chunk-5SHHYXWB.js} +2 -2
  4. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-ZCZ72OW4.js → chunk-UTEXL6ME.js} +38 -9
  5. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-ZCZ72OW4.js.map → chunk-UTEXL6ME.js.map} +1 -1
  6. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-modal-4QORKLGX.js → dees-modal-AH4CADKZ.js} +2 -2
  7. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-workspace-terminal-7SYZG2AB.js → dees-workspace-terminal-PIUCRANN.js} +3 -3
  8. package/dist_ts_web/00_commitinfo_data.js +1 -1
  9. package/dist_ts_web/elements/00formgate.d.ts +13 -2
  10. package/dist_ts_web/elements/00formgate.js +26 -6
  11. package/dist_ts_web/elements/00group-form/dees-form/dees-form.js +3 -3
  12. package/dist_ts_web/elements/00group-harness/dees-harness-question-card/dees-harness-question-card.js +5 -3
  13. package/dist_ts_web/elements/00group-layout/dees-stepper/dees-stepper.d.ts +25 -10
  14. package/dist_ts_web/elements/00group-layout/dees-stepper/dees-stepper.demo.js +44 -11
  15. package/dist_ts_web/elements/00group-layout/dees-stepper/dees-stepper.js +54 -27
  16. package/dist_ts_web/elements/00group-layout/dees-stepper/styles.js +23 -2
  17. package/dist_ts_web/elements/00group-overlay/dees-popover/dees-popover.d.ts +9 -2
  18. package/dist_ts_web/elements/00group-overlay/dees-popover/dees-popover.js +18 -4
  19. package/dist_ts_web/elements/00group-overlay/dees-speechbubble/dees-speechbubble.demo.js +4 -3
  20. package/package.json +1 -1
  21. package/readme.md +26 -15
  22. package/ts_web/00_commitinfo_data.ts +1 -1
  23. package/ts_web/elements/00formgate.ts +24 -5
  24. package/ts_web/elements/00group-form/dees-form/dees-form.ts +2 -2
  25. package/ts_web/elements/00group-harness/dees-harness-question-card/dees-harness-question-card.ts +4 -2
  26. package/ts_web/elements/00group-layout/dees-stepper/dees-stepper.demo.ts +27 -8
  27. package/ts_web/elements/00group-layout/dees-stepper/dees-stepper.ts +55 -28
  28. package/ts_web/elements/00group-layout/dees-stepper/styles.ts +22 -1
  29. package/ts_web/elements/00group-overlay/dees-popover/dees-popover.ts +17 -3
  30. package/ts_web/elements/00group-overlay/dees-speechbubble/dees-speechbubble.demo.ts +3 -2
  31. /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-5UGXWLMH.js.map → chunk-5SHHYXWB.js.map} +0 -0
  32. /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-modal-4QORKLGX.js.map → dees-modal-AH4CADKZ.js.map} +0 -0
  33. /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-workspace-terminal-7SYZG2AB.js.map → dees-workspace-terminal-PIUCRANN.js.map} +0 -0
@@ -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} @form-connect=${this.claimStepForm}>${this.renderSurface()}</div>`;
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">${open
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
- entry = { host, content: step.content, part: render(step.content, host, { host: this, isConnected: this.isConnected }) };
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
- const form = selectedStepElement.querySelector('dees-form');
633
- await form?.updateComplete;
650
+ await this.getStepForm(step)?.updateComplete;
634
651
  if (!this.isConnected || step !== this.selectedStep) return;
635
- this.scanActiveForm(selectedStepElement);
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
- * Scans the currently selected step for a <dees-form> in its content. When
739
- * found, subscribes to the form's RxJS changeSubject so the primary
740
- * menuOption button can auto-enable/disable as required fields are filled.
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(selectedStepElement: HTMLElement) {
746
- const form = selectedStepElement.querySelector('dees-form') as DeesForm | null;
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 runs the step's primary,
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.target !== this.activeForm) return;
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. A failure is announced with the source `popover-action`. Empty, the bubble
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>';`)}