@design.estate/dees-catalog 3.71.1 → 3.72.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.
@@ -192573,7 +192573,7 @@ var stepperDemo = /* @__PURE__ */ __name(() => b2`
192573
192573
  init_dist_ts30();
192574
192574
  init_dist_ts29();
192575
192575
  init_theme();
192576
- var _activeFormValid_dec, _activeForm_dec, _stepperZIndex_dec, _overlay_dec, _selectedStep_dec, _steps_dec, _a81, _DeesStepper_decorators, _init82, _steps, _selectedStep, _overlay, _stepperZIndex, _activeForm, _activeFormValid;
192576
+ var _activeFormValid_dec, _activeForm_dec, _stepperZIndex_dec, _cancelable_dec, _overlay_dec, _selectedStep_dec, _steps_dec, _a81, _DeesStepper_decorators, _init82, _steps, _selectedStep, _overlay, _cancelable, _stepperZIndex, _activeForm, _activeFormValid;
192577
192577
  _DeesStepper_decorators = [customElement("dees-stepper")];
192578
192578
  var _DeesStepper = class _DeesStepper extends (_a81 = DeesElement, _steps_dec = [n5({
192579
192579
  type: Array
@@ -192582,31 +192582,43 @@ var _DeesStepper = class _DeesStepper extends (_a81 = DeesElement, _steps_dec =
192582
192582
  })], _overlay_dec = [n5({
192583
192583
  type: Boolean,
192584
192584
  reflect: true
192585
+ })], _cancelable_dec = [n5({
192586
+ type: Boolean,
192587
+ reflect: true
192585
192588
  })], _stepperZIndex_dec = [n5({ type: Number, attribute: false })], _activeForm_dec = [n5({ type: Object, attribute: false })], _activeFormValid_dec = [n5({ type: Boolean, attribute: false })], _a81) {
192586
192589
  constructor() {
192587
192590
  super();
192588
192591
  __privateAdd(this, _steps, __runInitializers(_init82, 8, this, [])), __runInitializers(_init82, 11, this);
192589
192592
  __privateAdd(this, _selectedStep, __runInitializers(_init82, 12, this)), __runInitializers(_init82, 15, this);
192590
192593
  __privateAdd(this, _overlay, __runInitializers(_init82, 16, this, false)), __runInitializers(_init82, 19, this);
192591
- __privateAdd(this, _stepperZIndex, __runInitializers(_init82, 20, this, 1e3)), __runInitializers(_init82, 23, this);
192592
- __privateAdd(this, _activeForm, __runInitializers(_init82, 24, this, null)), __runInitializers(_init82, 27, this);
192593
- __privateAdd(this, _activeFormValid, __runInitializers(_init82, 28, this, true)), __runInitializers(_init82, 31, this);
192594
+ __privateAdd(this, _cancelable, __runInitializers(_init82, 20, this, true)), __runInitializers(_init82, 23, this);
192595
+ __privateAdd(this, _stepperZIndex, __runInitializers(_init82, 24, this, 1e3)), __runInitializers(_init82, 27, this);
192596
+ __privateAdd(this, _activeForm, __runInitializers(_init82, 28, this, null)), __runInitializers(_init82, 31, this);
192597
+ __privateAdd(this, _activeFormValid, __runInitializers(_init82, 32, this, true)), __runInitializers(_init82, 35, this);
192594
192598
  __publicField(this, "activeFormSubscription");
192595
192599
  __publicField(this, "windowLayer");
192596
192600
  __publicField(this, "getIndexOfStep", /* @__PURE__ */ __name((stepArg) => {
192597
192601
  return this.steps.findIndex((stepArg2) => stepArg === stepArg2);
192598
192602
  }, "getIndexOfStep"));
192599
192603
  __publicField(this, "scroller");
192604
+ /**
192605
+ * Currently-open confirmation modal (if any). Prevents double-stacking when
192606
+ * the user clicks the backdrop or the Cancel button while a confirm modal
192607
+ * is already visible. The reference may become stale (point to a destroyed
192608
+ * modal) if the user dismisses the confirm modal by clicking its own
192609
+ * backdrop — so handleCancelRequest() uses isConnected to detect that.
192610
+ */
192611
+ __publicField(this, "cancelConfirmModal");
192600
192612
  }
192601
192613
  static async createAndShow(optionsArg) {
192602
192614
  const body3 = document.body;
192603
192615
  const stepper = new _DeesStepper();
192604
192616
  stepper.steps = optionsArg.steps;
192605
192617
  stepper.overlay = true;
192618
+ if (optionsArg.cancelable !== void 0) {
192619
+ stepper.cancelable = optionsArg.cancelable;
192620
+ }
192606
192621
  stepper.windowLayer = await DeesWindowLayer.createAndShow({ blur: true });
192607
- stepper.windowLayer.addEventListener("click", async () => {
192608
- await stepper.destroy();
192609
- });
192610
192622
  body3.append(stepper.windowLayer);
192611
192623
  body3.append(stepper);
192612
192624
  stepper.stepperZIndex = zIndexRegistry.getNextZIndex();
@@ -192618,6 +192630,7 @@ var _DeesStepper = class _DeesStepper extends (_a81 = DeesElement, _steps_dec =
192618
192630
  <div
192619
192631
  class="stepperContainer ${this.overlay ? "overlay" : ""}"
192620
192632
  style=${this.overlay ? `z-index: ${this.stepperZIndex};` : ""}
192633
+ @click=${this.handleOutsideClick}
192621
192634
  >
192622
192635
  ${this.steps.map((stepArg, stepIndex) => {
192623
192636
  const isSelected = stepArg === this.selectedStep;
@@ -192638,19 +192651,23 @@ var _DeesStepper = class _DeesStepper extends (_a81 = DeesElement, _steps_dec =
192638
192651
  <div class="title">${stepArg.title}</div>
192639
192652
  <div class="content">${stepArg.content}</div>
192640
192653
  </div>
192641
- ${stepArg.menuOptions && stepArg.menuOptions.length > 0 ? b2`<div slot="footer" class="bottomButtons">
192642
- ${isSelected && this.activeForm !== null && !this.activeFormValid ? b2`<div class="stepHint">Complete form to continue</div>` : ""}
192643
- ${stepArg.menuOptions.map((actionArg, actionIndex) => {
192654
+ <div slot="footer" class="bottomButtons">
192655
+ ${isSelected && this.activeForm !== null && !this.activeFormValid ? b2`<div class="stepHint">Complete form to continue</div>` : ""}
192656
+ ${this.cancelable ? b2`<div
192657
+ class="bottomButton"
192658
+ @click=${() => this.handleCancelRequest()}
192659
+ >Cancel</div>` : ""}
192660
+ ${stepArg.menuOptions?.map((actionArg, actionIndex) => {
192644
192661
  const isPrimary = actionIndex === stepArg.menuOptions.length - 1;
192645
192662
  const isDisabled = isPrimary && this.activeForm !== null && !this.activeFormValid;
192646
192663
  return b2`
192647
- <div
192648
- class="bottomButton ${isPrimary ? "primary" : ""} ${isDisabled ? "disabled" : ""}"
192649
- @click=${() => this.handleMenuOptionClick(actionArg, isPrimary)}
192650
- >${actionArg.name}</div>
192651
- `;
192652
- })}
192653
- </div>` : ""}
192664
+ <div
192665
+ class="bottomButton ${isPrimary ? "primary" : ""} ${isDisabled ? "disabled" : ""}"
192666
+ @click=${() => this.handleMenuOptionClick(actionArg, isPrimary)}
192667
+ >${actionArg.name}</div>
192668
+ `;
192669
+ }) ?? ""}
192670
+ </div>
192654
192671
  </dees-tile>`;
192655
192672
  })}
192656
192673
  </div>
@@ -192792,6 +192809,65 @@ var _DeesStepper = class _DeesStepper extends (_a81 = DeesElement, _steps_dec =
192792
192809
  }
192793
192810
  await optionArg.action(this);
192794
192811
  }
192812
+ /**
192813
+ * Click handler on .stepperContainer. Mirrors dees-modal.handleOutsideClick:
192814
+ * when the user clicks the empty backdrop area (target === stepperContainer,
192815
+ * not any descendant tile), trigger the cancel confirmation flow. Clicks
192816
+ * that originate inside a step tile have a different event.target and are
192817
+ * ignored here.
192818
+ */
192819
+ handleOutsideClick(eventArg) {
192820
+ if (!this.overlay) return;
192821
+ if (!this.cancelable) return;
192822
+ eventArg.stopPropagation();
192823
+ const stepperContainer = this.shadowRoot.querySelector(".stepperContainer");
192824
+ if (eventArg.target === stepperContainer) {
192825
+ this.handleCancelRequest();
192826
+ }
192827
+ }
192828
+ /**
192829
+ * Shown by both the backdrop click and the Cancel button in the footer.
192830
+ * Presents a dees-modal asking the user to confirm cancellation. If they
192831
+ * confirm, the stepper and window layer are destroyed; otherwise the
192832
+ * confirm modal is dismissed and the stepper stays open.
192833
+ *
192834
+ * The isConnected check on the cached reference handles the case where the
192835
+ * user dismissed the previous confirm modal by clicking ITS OWN backdrop —
192836
+ * dees-modal.handleOutsideClick calls destroy() directly, bypassing our
192837
+ * action callbacks, so our cached reference would be stale without this
192838
+ * fallback check.
192839
+ */
192840
+ async handleCancelRequest() {
192841
+ if (!this.cancelable) return;
192842
+ if (this.cancelConfirmModal && this.cancelConfirmModal.isConnected) return;
192843
+ this.cancelConfirmModal = void 0;
192844
+ this.cancelConfirmModal = await DeesModal.createAndShow({
192845
+ heading: "Cancel setup?",
192846
+ width: "small",
192847
+ content: b2`
192848
+ <p style="margin: 0;">
192849
+ Are you sure you want to cancel? Any progress on the current step will be lost.
192850
+ </p>
192851
+ `,
192852
+ menuOptions: [
192853
+ {
192854
+ name: "Continue setup",
192855
+ action: /* @__PURE__ */ __name(async (modal) => {
192856
+ this.cancelConfirmModal = void 0;
192857
+ await modal.destroy();
192858
+ }, "action")
192859
+ },
192860
+ {
192861
+ name: "Yes, cancel",
192862
+ action: /* @__PURE__ */ __name(async (modal) => {
192863
+ this.cancelConfirmModal = void 0;
192864
+ await modal.destroy();
192865
+ await this.destroy();
192866
+ }, "action")
192867
+ }
192868
+ ]
192869
+ });
192870
+ }
192795
192871
  async destroy() {
192796
192872
  const domtools19 = await this.domtoolsPromise;
192797
192873
  const container = this.shadowRoot.querySelector(".stepperContainer");
@@ -192813,12 +192889,14 @@ _init82 = __decoratorStart(_a81);
192813
192889
  _steps = new WeakMap();
192814
192890
  _selectedStep = new WeakMap();
192815
192891
  _overlay = new WeakMap();
192892
+ _cancelable = new WeakMap();
192816
192893
  _stepperZIndex = new WeakMap();
192817
192894
  _activeForm = new WeakMap();
192818
192895
  _activeFormValid = new WeakMap();
192819
192896
  __decorateElement(_init82, 4, "steps", _steps_dec, _DeesStepper, _steps);
192820
192897
  __decorateElement(_init82, 4, "selectedStep", _selectedStep_dec, _DeesStepper, _selectedStep);
192821
192898
  __decorateElement(_init82, 4, "overlay", _overlay_dec, _DeesStepper, _overlay);
192899
+ __decorateElement(_init82, 4, "cancelable", _cancelable_dec, _DeesStepper, _cancelable);
192822
192900
  __decorateElement(_init82, 4, "stepperZIndex", _stepperZIndex_dec, _DeesStepper, _stepperZIndex);
192823
192901
  __decorateElement(_init82, 4, "activeForm", _activeForm_dec, _DeesStepper, _activeForm);
192824
192902
  __decorateElement(_init82, 4, "activeFormValid", _activeFormValid_dec, _DeesStepper, _activeFormValid);
@@ -193009,15 +193087,17 @@ __publicField(_DeesStepper, "styles", [
193009
193087
  transition: all 0.15s ease;
193010
193088
  background: transparent;
193011
193089
  border: none;
193012
- border-left: 1px solid var(--dees-color-border-subtle);
193013
193090
  color: var(--dees-color-text-muted);
193014
193091
  white-space: nowrap;
193015
193092
  display: flex;
193016
193093
  align-items: center;
193017
193094
  }
193018
193095
 
193019
- .bottomButtons .bottomButton:first-child {
193020
- border-left: none;
193096
+ /* Border-left separator on every button EXCEPT the first one.
193097
+ Uses general sibling so the stepHint (if rendered on the left) does
193098
+ not shift which button counts as "first" and create a phantom border. */
193099
+ .bottomButtons .bottomButton ~ .bottomButton {
193100
+ border-left: 1px solid var(--dees-color-border-subtle);
193021
193101
  }
193022
193102
 
193023
193103
  .bottomButtons .bottomButton:hover {