@design.estate/dees-catalog 21.27.0 → 21.29.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 +2829 -2606
- package/dist_bundle/bundle.js.map +1 -1
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-45QQJK4L.js → chunk-CJVVAKHG.js} +509 -358
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-45QQJK4L.js.map → chunk-CJVVAKHG.js.map} +1 -1
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-C63GPX4U.js → chunk-QFJ7LA5L.js} +2 -2
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-modal-OYJYQPHK.js → dees-modal-NVJRWZKO.js} +2 -2
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-workspace-terminal-UTDYRJTX.js → dees-workspace-terminal-BSBYG5IX.js} +3 -3
- package/dist_ts_web/00_commitinfo_data.js +1 -1
- package/dist_ts_web/demos/charts.d.ts +1 -0
- package/dist_ts_web/demos/charts.js +18 -5
- package/dist_ts_web/elements/00actionerror.d.ts +4 -2
- package/dist_ts_web/elements/00actionerror.js +1 -1
- package/dist_ts_web/elements/00group-button/dees-actionfooter/dees-actionfooter.d.ts +77 -0
- package/dist_ts_web/elements/00group-button/dees-actionfooter/dees-actionfooter.demo.d.ts +1 -0
- package/dist_ts_web/elements/00group-button/dees-actionfooter/dees-actionfooter.demo.js +60 -0
- package/dist_ts_web/elements/00group-button/dees-actionfooter/dees-actionfooter.js +240 -0
- package/dist_ts_web/elements/00group-button/dees-actionfooter/index.d.ts +1 -0
- package/dist_ts_web/elements/00group-button/dees-actionfooter/index.js +2 -0
- package/dist_ts_web/elements/00group-button/index.d.ts +1 -0
- package/dist_ts_web/elements/00group-button/index.js +2 -1
- package/dist_ts_web/elements/00group-chart/dees-chart-donut/styles.js +5 -1
- package/dist_ts_web/elements/00group-chart/dees-chart-echarts-base.d.ts +25 -4
- package/dist_ts_web/elements/00group-chart/dees-chart-echarts-base.js +46 -9
- package/dist_ts_web/elements/00group-chart/dees-chart-echarts-styles.js +17 -4
- package/dist_ts_web/elements/00group-dataview/dees-table/filters.d.ts +8 -3
- package/dist_ts_web/elements/00group-dataview/dees-table/filters.js +13 -15
- package/dist_ts_web/elements/00group-dataview/dees-table/search.js +3 -2
- package/dist_ts_web/elements/00group-input/dees-input-radiogroup/dees-input-radiogroup.d.ts +7 -1
- package/dist_ts_web/elements/00group-input/dees-input-radiogroup/dees-input-radiogroup.demo.js +17 -2
- package/dist_ts_web/elements/00group-input/dees-input-radiogroup/dees-input-radiogroup.js +25 -4
- package/dist_ts_web/elements/00group-input/profilepicture/profilepicture.modal.d.ts +1 -1
- package/dist_ts_web/elements/00group-input/profilepicture/profilepicture.modal.js +8 -20
- package/dist_ts_web/elements/00group-layout/dees-stepper/dees-stepper.d.ts +44 -3
- package/dist_ts_web/elements/00group-layout/dees-stepper/dees-stepper.demo.d.ts +2 -0
- package/dist_ts_web/elements/00group-layout/dees-stepper/dees-stepper.demo.js +118 -9
- package/dist_ts_web/elements/00group-layout/dees-stepper/dees-stepper.js +70 -13
- package/dist_ts_web/elements/00group-layout/dees-stepper/styles.js +54 -6
- package/dist_ts_web/elements/00group-overlay/dees-modal/dees-modal.d.ts +18 -26
- package/dist_ts_web/elements/00group-overlay/dees-modal/dees-modal.js +33 -100
- package/dist_ts_web/elements/00group-overlay/dees-popover/dees-popover.d.ts +14 -0
- package/dist_ts_web/elements/00group-overlay/dees-popover/dees-popover.js +49 -6
- package/package.json +2 -1
- package/readme.md +132 -16
- package/ts_web/00_commitinfo_data.ts +1 -1
- package/ts_web/demos/charts.ts +17 -4
- package/ts_web/elements/00actionerror.ts +4 -2
- package/ts_web/elements/00group-button/dees-actionfooter/dees-actionfooter.demo.ts +64 -0
- package/ts_web/elements/00group-button/dees-actionfooter/dees-actionfooter.ts +196 -0
- package/ts_web/elements/00group-button/dees-actionfooter/index.ts +1 -0
- package/ts_web/elements/00group-button/index.ts +1 -0
- package/ts_web/elements/00group-chart/dees-chart-donut/styles.ts +4 -0
- package/ts_web/elements/00group-chart/dees-chart-echarts-base.ts +40 -7
- package/ts_web/elements/00group-chart/dees-chart-echarts-styles.ts +16 -3
- package/ts_web/elements/00group-dataview/dees-table/filters.ts +14 -14
- package/ts_web/elements/00group-dataview/dees-table/search.ts +2 -1
- package/ts_web/elements/00group-input/dees-input-radiogroup/dees-input-radiogroup.demo.ts +22 -1
- package/ts_web/elements/00group-input/dees-input-radiogroup/dees-input-radiogroup.ts +31 -5
- package/ts_web/elements/00group-input/profilepicture/profilepicture.modal.ts +7 -19
- package/ts_web/elements/00group-layout/dees-stepper/dees-stepper.demo.ts +106 -4
- package/ts_web/elements/00group-layout/dees-stepper/dees-stepper.ts +95 -33
- package/ts_web/elements/00group-layout/dees-stepper/styles.ts +55 -5
- package/ts_web/elements/00group-overlay/dees-modal/dees-modal.ts +43 -101
- package/ts_web/elements/00group-overlay/dees-popover/dees-popover.ts +36 -2
- /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-C63GPX4U.js.map → chunk-QFJ7LA5L.js.map} +0 -0
- /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-modal-OYJYQPHK.js.map → dees-modal-NVJRWZKO.js.map} +0 -0
- /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-workspace-terminal-UTDYRJTX.js.map → dees-workspace-terminal-BSBYG5IX.js.map} +0 -0
|
@@ -18,6 +18,7 @@ import { zIndexRegistry } from '../../00zindex.js';
|
|
|
18
18
|
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
|
+
import { runAction } from '../../00actionerror.js';
|
|
21
22
|
import type { DeesForm } from '../../00group-form/dees-form/dees-form.js';
|
|
22
23
|
import '../../00group-feedback/dees-progressbar/dees-progressbar.js';
|
|
23
24
|
import '../dees-tile/dees-tile.js';
|
|
@@ -68,6 +69,13 @@ export type TStepCounter = 'total' | 'position';
|
|
|
68
69
|
*/
|
|
69
70
|
export type TStepperLayout = 'auto' | 'horizontal' | 'vertical';
|
|
70
71
|
|
|
72
|
+
/**
|
|
73
|
+
* Where the card stands in the stepper's height: `'start'` at an optical
|
|
74
|
+
* offset from the top, `'center'` in the middle, with as much room above it as
|
|
75
|
+
* below.
|
|
76
|
+
*/
|
|
77
|
+
export type TStepperCardAlign = 'start' | 'center';
|
|
78
|
+
|
|
71
79
|
export interface IStep {
|
|
72
80
|
title: string;
|
|
73
81
|
description?: string;
|
|
@@ -114,6 +122,10 @@ export class DeesStepper extends DeesElement {
|
|
|
114
122
|
stepCounter?: TStepCounter;
|
|
115
123
|
/** How the ribbon and the steps are arranged; see `layout`. */
|
|
116
124
|
layout?: TStepperLayout;
|
|
125
|
+
/** Where the card stands in the stepper's height; see `cardAlign`. */
|
|
126
|
+
cardAlign?: TStepperCardAlign;
|
|
127
|
+
/** Asked before a cancellation in place of the stepper's own confirmation; see `beforeClose`. */
|
|
128
|
+
beforeClose?: () => boolean | Promise<boolean>;
|
|
117
129
|
} & IOverlayI18nOptions): Promise<DeesStepper> {
|
|
118
130
|
const body = document.body;
|
|
119
131
|
const stepper = new DeesStepper();
|
|
@@ -125,6 +137,8 @@ export class DeesStepper extends DeesElement {
|
|
|
125
137
|
}
|
|
126
138
|
if (optionsArg.stepCounter !== undefined) stepper.stepCounter = optionsArg.stepCounter;
|
|
127
139
|
if (optionsArg.layout !== undefined) stepper.layout = optionsArg.layout;
|
|
140
|
+
if (optionsArg.cardAlign !== undefined) stepper.cardAlign = optionsArg.cardAlign;
|
|
141
|
+
if (optionsArg.beforeClose) stepper.beforeClose = optionsArg.beforeClose;
|
|
128
142
|
body.append(stepper);
|
|
129
143
|
|
|
130
144
|
// Share overlay ordering with catalog controls opened from this dialog.
|
|
@@ -169,6 +183,20 @@ export class DeesStepper extends DeesElement {
|
|
|
169
183
|
})
|
|
170
184
|
accessor cancelable: boolean = true;
|
|
171
185
|
|
|
186
|
+
/**
|
|
187
|
+
* Asked before a cancellation the reader triggers — the close control, and
|
|
188
|
+
* in overlay mode Escape and a click on the backdrop — in place of the
|
|
189
|
+
* stepper's own confirmation, synchronously or as a promise. Only `false`
|
|
190
|
+
* keeps the flow open, so a flow that knows what would be lost asks its own
|
|
191
|
+
* question, and one with nothing to lose yet closes at once. A hook that
|
|
192
|
+
* throws or rejects keeps the flow open too, and that failure is announced as
|
|
193
|
+
* a failed action (source `stepper-cancel`) rather than swallowed. While the
|
|
194
|
+
* hook runs, further cancellations are ignored rather than stacked.
|
|
195
|
+
* `destroy()` is not a cancellation and never asks.
|
|
196
|
+
*/
|
|
197
|
+
@property({ attribute: false })
|
|
198
|
+
accessor beforeClose: (() => boolean | Promise<boolean>) | undefined;
|
|
199
|
+
|
|
172
200
|
@property({ type: Number, attribute: false })
|
|
173
201
|
accessor stepperZIndex: number = 1000;
|
|
174
202
|
|
|
@@ -193,6 +221,19 @@ export class DeesStepper extends DeesElement {
|
|
|
193
221
|
@property({ type: String, reflect: true })
|
|
194
222
|
accessor layout: TStepperLayout = 'auto';
|
|
195
223
|
|
|
224
|
+
/**
|
|
225
|
+
* Where the card stands in the stepper's height, in either layout. `'start'`
|
|
226
|
+
* (default) sets it at an optical offset from the top: a step grows downward,
|
|
227
|
+
* so new content never moves its title. `'center'` centres it, with as much
|
|
228
|
+
* room above it as below and the ribbon at its top edge, as a dialog sits on
|
|
229
|
+
* a page but inside the page's own area: for a flow that has a page or a tab
|
|
230
|
+
* to itself. Each step is centred at its own height, and a step that is
|
|
231
|
+
* leaving fades out where it stood. (Not `align`: on an element, that
|
|
232
|
+
* attribute is the browser's legacy text alignment and would centre the text.)
|
|
233
|
+
*/
|
|
234
|
+
@property({ type: String, reflect: true })
|
|
235
|
+
accessor cardAlign: TStepperCardAlign = 'start';
|
|
236
|
+
|
|
196
237
|
@property({ type: Object, attribute: false })
|
|
197
238
|
accessor activeForm: DeesForm | null = null;
|
|
198
239
|
|
|
@@ -268,7 +309,7 @@ export class DeesStepper extends DeesElement {
|
|
|
268
309
|
const selectedIndex = this.getIndexOfStep(this.selectedStep);
|
|
269
310
|
// Back points the way the steps run back: to the inline start, which is the right in a right-to-left page.
|
|
270
311
|
const backIcon = this.matches(':dir(rtl)') ? 'lucide:ChevronRight' : 'lucide:ChevronLeft';
|
|
271
|
-
return html`<div class="stepperSurface" data-layout=${this.getLayout()}>
|
|
312
|
+
return html`<div class="stepperSurface" data-layout=${this.getLayout()} data-align=${this.cardAlign === 'center' ? 'center' : 'start'}>
|
|
272
313
|
${this.renderRibbon()}
|
|
273
314
|
<div class="stage">
|
|
274
315
|
${directives.repeat(this.steps.filter((step) => step === this.selectedStep || this.leavingSteps.has(step)), (step) => step, (stepArg) => {
|
|
@@ -528,7 +569,8 @@ export class DeesStepper extends DeesElement {
|
|
|
528
569
|
if (!changedProperties.has('selectedStep') && !changedProperties.has('steps') && !changedProperties.has('overlay')) return;
|
|
529
570
|
this.revealCurrentMarker();
|
|
530
571
|
await this.activateSelectedStep();
|
|
531
|
-
|
|
572
|
+
// Only a change of step moves the focus: new steps around the same one leave it where the reader is.
|
|
573
|
+
if (!this.isConnected || (!changedProperties.has('selectedStep') && !changedProperties.has('overlay'))) return;
|
|
532
574
|
if (this.overlay || this.shadowRoot?.activeElement) {
|
|
533
575
|
this.shadowRoot?.querySelector<HTMLElement>('.selected .title')?.focus({ preventScroll: true });
|
|
534
576
|
}
|
|
@@ -752,7 +794,8 @@ export class DeesStepper extends DeesElement {
|
|
|
752
794
|
if (!this.isConnected || step !== this.selectedStep) return;
|
|
753
795
|
await optionArg.action(this);
|
|
754
796
|
} catch (error) {
|
|
755
|
-
|
|
797
|
+
// shown on the step, also when it is off the page meanwhile and comes back
|
|
798
|
+
if (step === this.selectedStep) this.stepError = error instanceof Error ? error.message : this.t('stepper.actionFailed');
|
|
756
799
|
} finally {
|
|
757
800
|
if (this.actionStep === step) { this.actionPending = false; this.pendingAction = null; this.actionStep = undefined; }
|
|
758
801
|
}
|
|
@@ -910,9 +953,10 @@ export class DeesStepper extends DeesElement {
|
|
|
910
953
|
|
|
911
954
|
/**
|
|
912
955
|
* Shown by the backdrop click, Escape and the step header's close control.
|
|
913
|
-
*
|
|
914
|
-
*
|
|
915
|
-
*
|
|
956
|
+
* Asks `beforeClose` when it is set and closes the flow unless it answers
|
|
957
|
+
* `false`. Otherwise presents a dees-modal asking the user to confirm
|
|
958
|
+
* cancellation. If they confirm, the stepper and window layer are destroyed;
|
|
959
|
+
* otherwise the confirm modal is dismissed and the stepper stays open.
|
|
916
960
|
*
|
|
917
961
|
* The isConnected check on the cached reference handles the case where the
|
|
918
962
|
* user dismissed the previous confirm modal by clicking ITS OWN backdrop —
|
|
@@ -925,33 +969,48 @@ export class DeesStepper extends DeesElement {
|
|
|
925
969
|
if (this.cancelConfirmModal && this.cancelConfirmModal.isConnected) return;
|
|
926
970
|
this.cancelConfirmModal = undefined;
|
|
927
971
|
this.cancelRequestPending = true;
|
|
928
|
-
try {
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
972
|
+
try {
|
|
973
|
+
if (this.beforeClose) {
|
|
974
|
+
const beforeClose = this.beforeClose;
|
|
975
|
+
let close = false;
|
|
976
|
+
await runAction(
|
|
977
|
+
this,
|
|
978
|
+
{ action: beforeClose, source: 'stepper-cancel', ownerElement: this.shadowRoot?.querySelector('dialog') },
|
|
979
|
+
async () => { close = await beforeClose() !== false; },
|
|
980
|
+
);
|
|
981
|
+
if (close) await this.destroy();
|
|
982
|
+
return;
|
|
983
|
+
}
|
|
984
|
+
this.cancelConfirmModal = await DeesModal.createAndShow({
|
|
985
|
+
heading: this.t('stepper.cancelHeading'),
|
|
986
|
+
width: 'small',
|
|
987
|
+
i18n: this.t.i18n,
|
|
988
|
+
content: html`<p style="margin: 0;">${this.t('stepper.cancelQuestion')}</p>`,
|
|
989
|
+
menuOptions: [
|
|
990
|
+
{
|
|
991
|
+
name: this.t('stepper.cancelStay'),
|
|
992
|
+
action: async (modal) => {
|
|
993
|
+
this.cancelConfirmModal = undefined;
|
|
994
|
+
await modal!.destroy();
|
|
995
|
+
},
|
|
939
996
|
},
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
997
|
+
{
|
|
998
|
+
name: this.t('stepper.cancelConfirm'),
|
|
999
|
+
action: async (modal) => {
|
|
1000
|
+
this.cancelConfirmModal = undefined;
|
|
1001
|
+
await modal!.destroy();
|
|
1002
|
+
await this.destroy();
|
|
1003
|
+
},
|
|
947
1004
|
},
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
1005
|
+
],
|
|
1006
|
+
});
|
|
1007
|
+
if (!this.isConnected) await this.cancelConfirmModal.destroy();
|
|
1008
|
+
} finally {
|
|
1009
|
+
this.cancelRequestPending = false;
|
|
1010
|
+
}
|
|
953
1011
|
}
|
|
954
1012
|
|
|
1013
|
+
/** Closes the flow: the stepper removes itself and fires `stepper-close`. */
|
|
955
1014
|
public destroy(): Promise<void> {
|
|
956
1015
|
return this.destroyPromise ??= this.closeAndRemove();
|
|
957
1016
|
}
|
|
@@ -965,8 +1024,15 @@ export class DeesStepper extends DeesElement {
|
|
|
965
1024
|
await Promise.allSettled(leaving.flatMap(element => element.getAnimations()).map(animation => animation.finished));
|
|
966
1025
|
this.shadowRoot?.querySelector('dialog')?.close();
|
|
967
1026
|
this.remove();
|
|
1027
|
+
this.dispatchEvent(new CustomEvent('stepper-close', { bubbles: true, composed: true }));
|
|
968
1028
|
}
|
|
969
1029
|
|
|
1030
|
+
/**
|
|
1031
|
+
* Leaving the page is not closing the flow: an inline stepper the page takes
|
|
1032
|
+
* out and puts back (a tab switched away and back) keeps its steps, what was
|
|
1033
|
+
* entered and a running action, and fires no `stepper-close`. Its step's work
|
|
1034
|
+
* is aborted here and starts again when it returns.
|
|
1035
|
+
*/
|
|
970
1036
|
public async disconnectedCallback() {
|
|
971
1037
|
this.selectedStep?.abortController?.abort();
|
|
972
1038
|
if (this.selectedStep) this.selectedStep.validationFuncCalled = false;
|
|
@@ -978,12 +1044,8 @@ export class DeesStepper extends DeesElement {
|
|
|
978
1044
|
this.activeFormSubscription?.unsubscribe();
|
|
979
1045
|
this.activeFormSubscription = undefined;
|
|
980
1046
|
this.activeForm = null;
|
|
981
|
-
this.actionPending = false;
|
|
982
|
-
this.pendingAction = null;
|
|
983
|
-
this.actionStep = undefined;
|
|
984
1047
|
this.progressRunning = false;
|
|
985
1048
|
zIndexRegistry.unregister(this);
|
|
986
|
-
this.dispatchEvent(new CustomEvent('stepper-close', { bubbles: true, composed: true }));
|
|
987
1049
|
await super.disconnectedCallback();
|
|
988
1050
|
}
|
|
989
1051
|
}
|
|
@@ -6,9 +6,9 @@ import { css } from '@design.estate/dees-element';
|
|
|
6
6
|
* ribbon: the leaving step moves toward the side it now lies on (up for an
|
|
7
7
|
* earlier step, down for a later one; in the vertical layout, toward the
|
|
8
8
|
* strip's start or end) and the entering one comes in from the other side. Nothing scrolls and nothing is
|
|
9
|
-
* measured: a step grows downward from a fixed top
|
|
10
|
-
*
|
|
11
|
-
* it is. `--stepper-motion-duration` times every move; reduced motion sets it
|
|
9
|
+
* measured: a step grows downward from a fixed top (a centred card grows from
|
|
10
|
+
* its middle, as a dialog does), overlays opened from a step cannot move it,
|
|
11
|
+
* and a transition that is interrupted turns from where it is. `--stepper-motion-duration` times every move; reduced motion sets it
|
|
12
12
|
* to zero.
|
|
13
13
|
*
|
|
14
14
|
* The ribbon beside the steps is sized in steps of `--stepper-pitch`, the
|
|
@@ -88,6 +88,51 @@ const verticalLayout = css`
|
|
|
88
88
|
& .stage { grid-column: 1; grid-row: 2; justify-self: center; width: 100%; max-width: var(--dees-stepper-width, 520px); }
|
|
89
89
|
`;
|
|
90
90
|
|
|
91
|
+
/*
|
|
92
|
+
* The centred card (`cardAlign: 'center'`): the ribbon and the current step stand
|
|
93
|
+
* in a middle row as tall as the step (never less than a step's least height),
|
|
94
|
+
* between two rows that share the rest, so there is as much room above the card
|
|
95
|
+
* as below it and the ribbon stands at its top edge. The stage spans all rows
|
|
96
|
+
* as a subgrid: the current step stands in the middle row and sizes it, and a
|
|
97
|
+
* leaving step spans every row, centred, so it fades out where it stood while
|
|
98
|
+
* the next step is centred at its own height. A ribbon taller than the card
|
|
99
|
+
* makes the middle row as tall as itself, with the card centred in it.
|
|
100
|
+
* `--stepper-card-max` is the room the card has when the outer rows are empty:
|
|
101
|
+
* the middle row sizes to its content, so the card is capped by that, not by
|
|
102
|
+
* its row.
|
|
103
|
+
*/
|
|
104
|
+
const centredCard = css`
|
|
105
|
+
--stepper-offset: var(--dees-spacing-xl);
|
|
106
|
+
--stepper-card-max: calc(100cqh - var(--stepper-offset) - var(--dees-spacing-xl));
|
|
107
|
+
grid-template-rows:
|
|
108
|
+
minmax(0, 1fr)
|
|
109
|
+
minmax(min(var(--stepper-step-min-height), var(--stepper-card-max)), auto)
|
|
110
|
+
minmax(0, 1fr);
|
|
111
|
+
& .progress { grid-row: 2; max-height: var(--stepper-card-max); }
|
|
112
|
+
& .stage { grid-row: 1 / -1; grid-template-rows: subgrid; }
|
|
113
|
+
& dees-tile.step { grid-row: 1 / -1; align-self: center; max-height: var(--stepper-card-max); }
|
|
114
|
+
& dees-tile.step.selected { grid-row: 2; }
|
|
115
|
+
`;
|
|
116
|
+
|
|
117
|
+
/*
|
|
118
|
+
* The centred card in the vertical layout: the strip and the current step
|
|
119
|
+
* stand in the middle rows, centred together. A leaving step keeps the place it
|
|
120
|
+
* had under the strip: it spans every row with the strip's height and gap as
|
|
121
|
+
* its top margin, which centres it that much lower.
|
|
122
|
+
*/
|
|
123
|
+
const centredStrip = css`
|
|
124
|
+
--stepper-card-max: calc(100cqh - var(--stepper-rail) - var(--dees-spacing-md) * 5);
|
|
125
|
+
grid-template-rows:
|
|
126
|
+
minmax(0, 1fr)
|
|
127
|
+
auto
|
|
128
|
+
minmax(min(var(--stepper-step-min-height), var(--stepper-card-max)), auto)
|
|
129
|
+
minmax(0, 1fr);
|
|
130
|
+
& .progress { grid-row: 2; max-height: none; }
|
|
131
|
+
& .stage { grid-row: 1 / -1; }
|
|
132
|
+
& dees-tile.step.selected { grid-row: 3; }
|
|
133
|
+
& dees-tile.step:not(.selected) { margin-block-start: calc(var(--stepper-rail) + var(--dees-spacing-md)); }
|
|
134
|
+
`;
|
|
135
|
+
|
|
91
136
|
export const stepperStyles = css`
|
|
92
137
|
:host {
|
|
93
138
|
--stepper-motion-duration: var(--dees-transition-slow);
|
|
@@ -104,6 +149,8 @@ export const stepperStyles = css`
|
|
|
104
149
|
--stepper-done: var(--dees-color-text-muted);
|
|
105
150
|
--stepper-fill: var(--dees-color-fill-tertiary);
|
|
106
151
|
--stepper-surface: var(--dees-tile-surface, var(--dees-color-bg-primary));
|
|
152
|
+
/* the least height of a step's card, where the stepper has room for it */
|
|
153
|
+
--stepper-step-min-height: 280px;
|
|
107
154
|
display: block;
|
|
108
155
|
position: relative;
|
|
109
156
|
width: 100%;
|
|
@@ -309,7 +356,7 @@ export const stepperStyles = css`
|
|
|
309
356
|
align-self: start;
|
|
310
357
|
width: 100%;
|
|
311
358
|
max-height: 100%;
|
|
312
|
-
min-height: min(
|
|
359
|
+
min-height: min(var(--stepper-step-min-height), 100%);
|
|
313
360
|
opacity: 0;
|
|
314
361
|
visibility: hidden;
|
|
315
362
|
pointer-events: none;
|
|
@@ -422,10 +469,13 @@ export const stepperStyles = css`
|
|
|
422
469
|
.predestroy .step.selected, .predestroy .progress { animation: none; }
|
|
423
470
|
}
|
|
424
471
|
|
|
425
|
-
/* --- The vertical layout, chosen or on a narrow surface in the automatic one --- */
|
|
472
|
+
/* --- The centred card; the vertical layout, chosen or on a narrow surface in the automatic one --- */
|
|
473
|
+
.stepperSurface:where([data-align='center']) { ${centredCard} }
|
|
426
474
|
.stepperSurface:where([data-layout='vertical']) { ${verticalLayout} }
|
|
475
|
+
.stepperSurface:where([data-layout='vertical'][data-align='center']) { ${centredStrip} }
|
|
427
476
|
@container stepper-surface (max-width: 640px) {
|
|
428
477
|
.stepperSurface:where([data-layout='auto']) { ${verticalLayout} }
|
|
478
|
+
.stepperSurface:where([data-layout='auto'][data-align='center']) { ${centredStrip} }
|
|
429
479
|
/* a narrow surface, in any layout: a closer card, the hint on a row of its own */
|
|
430
480
|
.step-header { padding: var(--dees-spacing-md) var(--dees-spacing-lg); }
|
|
431
481
|
.step-body { padding: var(--dees-spacing-lg); }
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import * as plugins from '../../00plugins.js';
|
|
2
1
|
import { zIndexRegistry } from '../../00zindex.js';
|
|
3
2
|
import { runAction } from '../../00actionerror.js';
|
|
4
3
|
import { provideOverlayI18n, type IOverlayI18nOptions } from '../../00overlay.js';
|
|
5
|
-
import { dcMessages } from '../../../i18n/messages.js';
|
|
6
4
|
import { dcLocalize } from '../../../i18n/localize.js';
|
|
5
|
+
import {
|
|
6
|
+
catalogAction,
|
|
7
|
+
type DeesActionFooter,
|
|
8
|
+
type IActionFooterAction,
|
|
9
|
+
type TActionFooterPrimaryType,
|
|
10
|
+
} from '../../00group-button/dees-actionfooter/dees-actionfooter.js';
|
|
7
11
|
|
|
8
12
|
import { demoFunc } from './dees-modal.demo.js';
|
|
9
13
|
import {
|
|
@@ -18,7 +22,7 @@ import {
|
|
|
18
22
|
render,
|
|
19
23
|
} from '@design.estate/dees-element';
|
|
20
24
|
|
|
21
|
-
import '../../00group-button/dees-
|
|
25
|
+
import '../../00group-button/dees-actionfooter/dees-actionfooter.js';
|
|
22
26
|
import '../../00group-button/dees-button-exit/dees-button-exit.js';
|
|
23
27
|
import '../../00group-utility/dees-icon/dees-icon.js';
|
|
24
28
|
import { themeDefaultStyles } from '../../00theme.js';
|
|
@@ -30,25 +34,8 @@ declare global {
|
|
|
30
34
|
}
|
|
31
35
|
}
|
|
32
36
|
|
|
33
|
-
type TModalWord = 'common.cancel' | 'common.create' | 'modal.continue';
|
|
34
|
-
|
|
35
37
|
/** The dees-button types a dialog's primary action may take. */
|
|
36
|
-
export type TModalPrimaryActionType =
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* The actions `prompt()` and `confirm()` add without a name from the caller:
|
|
40
|
-
* the dialog reads their names from the catalog while it renders, so they
|
|
41
|
-
* follow a change of language while the dialog is open.
|
|
42
|
-
*/
|
|
43
|
-
const builtInWords = new WeakMap<plugins.tsclass.website.IMenuItem<DeesModal>, TModalWord>();
|
|
44
|
-
const builtInAction = (
|
|
45
|
-
wordArg: TModalWord,
|
|
46
|
-
action: plugins.tsclass.website.IMenuItem<DeesModal>['action'],
|
|
47
|
-
): plugins.tsclass.website.IMenuItem<DeesModal> => {
|
|
48
|
-
const item: plugins.tsclass.website.IMenuItem<DeesModal> = { name: dcMessages.entries[wordArg].message, action };
|
|
49
|
-
builtInWords.set(item, wordArg);
|
|
50
|
-
return item;
|
|
51
|
-
};
|
|
38
|
+
export type TModalPrimaryActionType = TActionFooterPrimaryType;
|
|
52
39
|
|
|
53
40
|
@customElement('dees-modal')
|
|
54
41
|
export class DeesModal extends DeesElement {
|
|
@@ -120,8 +107,8 @@ export class DeesModal extends DeesElement {
|
|
|
120
107
|
heading: options.heading, subheading: options.subheading, width: options.width ?? 'small',
|
|
121
108
|
description: options.description, content: html`${input}`, i18n: options.i18n,
|
|
122
109
|
menuOptions: [
|
|
123
|
-
|
|
124
|
-
options.confirmLabel ? { name: options.confirmLabel, action: confirm } :
|
|
110
|
+
catalogAction<DeesModal>('common.cancel', async () => { await modal.destroy(); }),
|
|
111
|
+
options.confirmLabel ? { name: options.confirmLabel, action: confirm } : catalogAction<DeesModal>('common.create', confirm),
|
|
125
112
|
],
|
|
126
113
|
});
|
|
127
114
|
modal.addEventListener('modal-close', () => resolve(confirmed), { once: true });
|
|
@@ -159,10 +146,10 @@ export class DeesModal extends DeesElement {
|
|
|
159
146
|
menuOptions: [
|
|
160
147
|
options.cancelLabel
|
|
161
148
|
? { name: options.cancelLabel, action: cancel }
|
|
162
|
-
:
|
|
149
|
+
: catalogAction<DeesModal>('common.cancel', cancel),
|
|
163
150
|
options.confirmLabel
|
|
164
151
|
? { name: options.confirmLabel, action: proceed }
|
|
165
|
-
:
|
|
152
|
+
: catalogAction<DeesModal>('modal.continue', proceed),
|
|
166
153
|
],
|
|
167
154
|
});
|
|
168
155
|
modal.addEventListener('modal-close', () => resolve(confirmed), { once: true });
|
|
@@ -178,7 +165,8 @@ export class DeesModal extends DeesElement {
|
|
|
178
165
|
description?: string | TemplateResult;
|
|
179
166
|
sidebar?: TemplateResult;
|
|
180
167
|
content: TemplateResult;
|
|
181
|
-
|
|
168
|
+
/** The footer's actions; the last is the primary unless one is marked `primary` (see `IActionFooterAction`). */
|
|
169
|
+
menuOptions: IActionFooterAction<DeesModal>[];
|
|
182
170
|
width?: 'small' | 'medium' | 'large' | 'fullscreen' | number;
|
|
183
171
|
/** Fixed height in both layouts, clamped to the viewport. Sidebar defaults: 400px desktop, 520px at <=600px. */
|
|
184
172
|
height?: number;
|
|
@@ -191,7 +179,7 @@ export class DeesModal extends DeesElement {
|
|
|
191
179
|
beforeClose?: () => boolean | Promise<boolean>;
|
|
192
180
|
mobileFullscreen?: boolean;
|
|
193
181
|
contentPadding?: number;
|
|
194
|
-
/** How the primary
|
|
182
|
+
/** How the primary action is drawn: `accent` by default, `destructive` for a deletion. */
|
|
195
183
|
primaryActionType?: TModalPrimaryActionType;
|
|
196
184
|
} & IOverlayI18nOptions) {
|
|
197
185
|
const body = document.body;
|
|
@@ -248,7 +236,7 @@ export class DeesModal extends DeesElement {
|
|
|
248
236
|
accessor content!: TemplateResult;
|
|
249
237
|
|
|
250
238
|
@state({})
|
|
251
|
-
accessor menuOptions:
|
|
239
|
+
accessor menuOptions: IActionFooterAction<DeesModal>[] = [];
|
|
252
240
|
|
|
253
241
|
@property({ type: String, reflect: true })
|
|
254
242
|
accessor width: 'small' | 'medium' | 'large' | 'fullscreen' | number = 'medium';
|
|
@@ -303,7 +291,7 @@ export class DeesModal extends DeesElement {
|
|
|
303
291
|
accessor contentPadding: number = 24;
|
|
304
292
|
|
|
305
293
|
/**
|
|
306
|
-
* How the primary action — the last of `menuOptions` — is drawn, as a dees-button `type`:
|
|
294
|
+
* How the primary action — the last of `menuOptions`, unless one is marked `primary` — is drawn, as a dees-button `type`:
|
|
307
295
|
* `accent` for a step forward, `destructive` for one that deletes or cannot be taken back.
|
|
308
296
|
* The other actions are always `secondary`.
|
|
309
297
|
*/
|
|
@@ -315,9 +303,6 @@ export class DeesModal extends DeesElement {
|
|
|
315
303
|
|
|
316
304
|
@state() private accessor promptPending = false;
|
|
317
305
|
|
|
318
|
-
/** The menu action whose promise is still pending, if any. */
|
|
319
|
-
@state() private accessor pendingAction: plugins.tsclass.website.IMenuItem<DeesModal> | null = null;
|
|
320
|
-
|
|
321
306
|
constructor() {
|
|
322
307
|
super();
|
|
323
308
|
}
|
|
@@ -376,7 +361,8 @@ export class DeesModal extends DeesElement {
|
|
|
376
361
|
heading's, so frameless content in it lines up with the heading. */
|
|
377
362
|
.content { --dees-inset-inline: initial; }
|
|
378
363
|
.content.flush { --dees-inset-inline: var(--modal-inset-inline); }
|
|
379
|
-
|
|
364
|
+
/* The actions line up with the heading. */
|
|
365
|
+
.bottomButtons { grid-row: 3; --dees-actionfooter-inset: var(--modal-inset-inline); }
|
|
380
366
|
.heading-copy { flex: 1; min-width: 0; }
|
|
381
367
|
.subheading { margin: 6px 0 0; font-size: 13px; line-height: 1.5; color: var(--dees-color-text-secondary); }
|
|
382
368
|
.description { margin: 0 0 var(--dees-spacing-lg); font-size: 13px; line-height: 1.5; color: var(--dees-color-text-secondary); }
|
|
@@ -419,31 +405,6 @@ export class DeesModal extends DeesElement {
|
|
|
419
405
|
.help-button:hover { background: var(--dees-color-hover); }
|
|
420
406
|
.help-button:focus-visible { outline: var(--dees-line-width-focus-ring) solid var(--dees-color-focus-ring); outline-offset: 2px; }
|
|
421
407
|
.content { min-width: 0; overflow-wrap: anywhere; }
|
|
422
|
-
.bottomButtons {
|
|
423
|
-
display: flex;
|
|
424
|
-
flex-wrap: wrap;
|
|
425
|
-
justify-content: flex-end;
|
|
426
|
-
align-items: center;
|
|
427
|
-
gap: var(--dees-spacing-sm);
|
|
428
|
-
padding: var(--dees-spacing-md) var(--modal-inset-inline);
|
|
429
|
-
}
|
|
430
|
-
/* An action keeps the one-line 28px face while its label fits. A label wider than the
|
|
431
|
-
sheet (a long confirmation on a phone) wraps onto more lines inside it instead of being
|
|
432
|
-
cut off: the face grows in height, never past the sheet's width. */
|
|
433
|
-
.modal-action { max-width: 100%; min-width: 0; }
|
|
434
|
-
.modal-action::part(button) {
|
|
435
|
-
height: auto;
|
|
436
|
-
min-height: 28px;
|
|
437
|
-
max-width: 100%;
|
|
438
|
-
padding-block: 4px;
|
|
439
|
-
white-space: normal;
|
|
440
|
-
/* anywhere, not break-word: only anywhere counts toward min-content, so an unbreakable
|
|
441
|
-
token (an e-mail address, an identifier) breaks inside the face instead of spilling */
|
|
442
|
-
overflow-wrap: anywhere;
|
|
443
|
-
text-align: center;
|
|
444
|
-
font-size: 13px;
|
|
445
|
-
border-radius: 8px;
|
|
446
|
-
}
|
|
447
408
|
.predestroy { animation: leave var(--dees-transition-fast) var(--dees-ease-in) forwards; }
|
|
448
409
|
@keyframes enter { from { opacity: 0; transform: translateY(8px) scale(.98); } }
|
|
449
410
|
@keyframes leave { to { opacity: 0; transform: translateY(4px) scale(.99); } }
|
|
@@ -491,15 +452,9 @@ export class DeesModal extends DeesElement {
|
|
|
491
452
|
style="padding:${this.contentPadding}px">${this.description
|
|
492
453
|
? html`<p id="modal-description" class="description">${this.description}</p>` : ''}<span class="contentEnd" hidden></span></div>
|
|
493
454
|
${this.menuOptions.length ? html`
|
|
494
|
-
<
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
.disabled=${this.promptPending || (this.pendingAction !== null && this.pendingAction !== action)}
|
|
498
|
-
.status=${this.pendingAction === action ? 'pending' : 'normal'}
|
|
499
|
-
.type=${index === this.menuOptions.length - 1 ? this.primaryActionType : 'secondary'}
|
|
500
|
-
@clicked=${() => this.runMenuAction(action)}></dees-button>
|
|
501
|
-
`)}
|
|
502
|
-
</div>
|
|
455
|
+
<dees-actionfooter class="bottomButtons" .actions=${this.menuOptions} .context=${this}
|
|
456
|
+
.primaryActionType=${this.primaryActionType} .disabled=${this.promptPending}
|
|
457
|
+
source="modal-menu"></dees-actionfooter>
|
|
503
458
|
` : ''}
|
|
504
459
|
</section>
|
|
505
460
|
</dialog>
|
|
@@ -564,6 +519,23 @@ export class DeesModal extends DeesElement {
|
|
|
564
519
|
return this.shadowRoot?.querySelector('dialog') ?? null;
|
|
565
520
|
}
|
|
566
521
|
|
|
522
|
+
/**
|
|
523
|
+
* The dialog's actions, run by its `dees-actionfooter`: one at a time, a failure announced
|
|
524
|
+
* through `dees-action-error` with the source `modal-menu` and, unless a listener cancels it,
|
|
525
|
+
* a notification inside this dialog. Dismissal is deliberately not blocked while an action
|
|
526
|
+
* runs; an action that closes the dialog itself does so through `destroy()`.
|
|
527
|
+
*/
|
|
528
|
+
private get actionFooter(): DeesActionFooter | null {
|
|
529
|
+
return this.shadowRoot?.querySelector('dees-actionfooter') ?? null;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
/** The dialog is ready once its actions are drawn as well. */
|
|
533
|
+
protected async getUpdateComplete(): Promise<boolean> {
|
|
534
|
+
const result = await super.getUpdateComplete();
|
|
535
|
+
await this.actionFooter?.updateComplete;
|
|
536
|
+
return result;
|
|
537
|
+
}
|
|
538
|
+
|
|
567
539
|
private handleCancel(eventArg: Event): void {
|
|
568
540
|
eventArg.preventDefault();
|
|
569
541
|
void this.dismiss();
|
|
@@ -594,17 +566,16 @@ export class DeesModal extends DeesElement {
|
|
|
594
566
|
|
|
595
567
|
/**
|
|
596
568
|
* Enter in the last field of a form in this dialog runs the dialog's primary
|
|
597
|
-
* action (
|
|
569
|
+
* action (drawn as the primary button), as a click on it would.
|
|
598
570
|
* While an action runs, or a prompt confirms, the request is answered and
|
|
599
571
|
* nothing else starts.
|
|
600
572
|
*/
|
|
601
573
|
private handleFormSubmitRequest(eventArg: Event): void {
|
|
602
|
-
const
|
|
603
|
-
if (!
|
|
574
|
+
const footer = this.actionFooter;
|
|
575
|
+
if (!footer?.primaryAction) return;
|
|
604
576
|
eventArg.preventDefault();
|
|
605
577
|
eventArg.stopPropagation();
|
|
606
|
-
|
|
607
|
-
void this.runMenuAction(primary);
|
|
578
|
+
void footer.runPrimary();
|
|
608
579
|
}
|
|
609
580
|
|
|
610
581
|
public async handleOutsideClick(eventArg: MouseEvent) {
|
|
@@ -689,33 +660,4 @@ export class DeesModal extends DeesElement {
|
|
|
689
660
|
private async handleHelp() {
|
|
690
661
|
if (this.onHelp) await this.onHelp();
|
|
691
662
|
}
|
|
692
|
-
|
|
693
|
-
/**
|
|
694
|
-
* A menu action is awaited so a rejected callback surfaces as a visible
|
|
695
|
-
* failure instead of an unhandled rejection. The error is announced on the
|
|
696
|
-
* modal through the cancelable `dees-action-error` event and, unless a
|
|
697
|
-
* listener cancels it, shown as a notification inside this dialog.
|
|
698
|
-
*
|
|
699
|
-
* One action runs at a time: while its promise is pending, its own button
|
|
700
|
-
* shows the busy face and the other actions are disabled, so a second press
|
|
701
|
-
* cannot run an irreversible operation twice. Both a resolution and a
|
|
702
|
-
* rejection release the dialog — a failed action keeps it open and usable.
|
|
703
|
-
* Dismissal is deliberately not blocked; an action that closes the dialog
|
|
704
|
-
* itself does so through `destroy()` while it is still the pending action.
|
|
705
|
-
*/
|
|
706
|
-
/** An action's name: the caller's, or the catalog's for an action `prompt()` or `confirm()` added. */
|
|
707
|
-
private actionName(actionArg: plugins.tsclass.website.IMenuItem<DeesModal>): string {
|
|
708
|
-
const word = builtInWords.get(actionArg);
|
|
709
|
-
return word ? this.t(word) : actionArg.name;
|
|
710
|
-
}
|
|
711
|
-
|
|
712
|
-
private async runMenuAction(actionArg: plugins.tsclass.website.IMenuItem<DeesModal>) {
|
|
713
|
-
if (this.pendingAction) return;
|
|
714
|
-
this.pendingAction = actionArg;
|
|
715
|
-
try {
|
|
716
|
-
await runAction(this, { action: actionArg, source: 'modal-menu', ownerElement: this.dialog }, () => actionArg.action(this));
|
|
717
|
-
} finally {
|
|
718
|
-
this.pendingAction = null;
|
|
719
|
-
}
|
|
720
|
-
}
|
|
721
663
|
}
|