@design.estate/dees-catalog 21.28.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 +281 -99
- 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/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-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 +1 -1
- package/readme.md +109 -16
- package/ts_web/00_commitinfo_data.ts +1 -1
- 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-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
|
@@ -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
|
}
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
customElement,
|
|
6
6
|
html,
|
|
7
7
|
property,
|
|
8
|
+
state,
|
|
8
9
|
type TemplateResult,
|
|
9
10
|
} from '@design.estate/dees-element';
|
|
10
11
|
import { themeDefaultStyles } from '../../00theme.js';
|
|
@@ -13,6 +14,8 @@ import { deepActiveElement, type IOverlayLayerHost } from '../../00overlay.js';
|
|
|
13
14
|
import { listenForScrollAround, placeAnchored, visibleRect, type TAnchoredPlacement, type TAnchoredSide } from '../../00anchorplacement.js';
|
|
14
15
|
import { ScrollEdgeShadowController, scrollEdgeFadeStyles } from '../../00scrolledges.js';
|
|
15
16
|
import type { DeesWindowLayer } from '../dees-windowlayer/dees-windowlayer.js';
|
|
17
|
+
import type { IActionFooterAction } from '../../00group-button/dees-actionfooter/dees-actionfooter.js';
|
|
18
|
+
import '../../00group-button/dees-actionfooter/dees-actionfooter.js';
|
|
16
19
|
|
|
17
20
|
/**
|
|
18
21
|
* Where the bubble opens: `'auto'`, the default, wherever it fits — below or above its anchor, with
|
|
@@ -54,6 +57,9 @@ let nextPopoverId = 0;
|
|
|
54
57
|
* side with its tail still on the anchor, and places itself again as the page scrolls or resizes.
|
|
55
58
|
* It is a dialog by default; a host that opens it on hover gives it `role="tooltip"`, and the
|
|
56
59
|
* anchor then keeps its own state, described by the bubble instead of controlling it.
|
|
60
|
+
*
|
|
61
|
+
* A dialog bubble's `actions` stand in the catalog's action footer at its bottom edge
|
|
62
|
+
* (`dees-actionfooter`), as a dialog's do.
|
|
57
63
|
*/
|
|
58
64
|
@customElement('dees-popover')
|
|
59
65
|
export class DeesPopover extends DeesElement implements IOverlayLayerHost {
|
|
@@ -86,12 +92,24 @@ export class DeesPopover extends DeesElement implements IOverlayLayerHost {
|
|
|
86
92
|
@property({ reflect: true })
|
|
87
93
|
accessor maxHeight: string = 'min(60vh, 360px)';
|
|
88
94
|
|
|
95
|
+
/**
|
|
96
|
+
* The bubble's actions, drawn by `dees-actionfooter` at its bottom edge: the primary rightmost,
|
|
97
|
+
* 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.
|
|
100
|
+
*/
|
|
101
|
+
@property({ attribute: false })
|
|
102
|
+
accessor actions: IActionFooterAction<DeesPopover>[] = [];
|
|
103
|
+
|
|
89
104
|
private openListeners: AbortController | undefined;
|
|
90
105
|
private resizeObserver: ResizeObserver | undefined;
|
|
91
106
|
private positionFrame: number | undefined;
|
|
92
107
|
private anchorAriaSnapshot: IAnchorAriaSnapshot | undefined;
|
|
93
108
|
/** The side the bubble opened on, kept while it stays open and still fits there. */
|
|
94
109
|
private placedSide: TAnchoredSide | undefined;
|
|
110
|
+
/** Whether the tail leaves the bubble from its action footer, so it takes the footer's tint. */
|
|
111
|
+
@state()
|
|
112
|
+
private accessor tailOnActions = false;
|
|
95
113
|
/** Content taller than the bubble scrolls, fading out toward an edge past which more lies. */
|
|
96
114
|
private readonly scrollEdges = new ScrollEdgeShadowController(this, () => this.shadowRoot?.querySelector<HTMLElement>('.content'));
|
|
97
115
|
|
|
@@ -149,6 +167,12 @@ export class DeesPopover extends DeesElement implements IOverlayLayerHost {
|
|
|
149
167
|
overscroll-behavior: contain;
|
|
150
168
|
}
|
|
151
169
|
|
|
170
|
+
/* The actions line up with a panel's 16px padding. */
|
|
171
|
+
.actions {
|
|
172
|
+
flex: none;
|
|
173
|
+
--dees-actionfooter-inset: var(--dees-spacing-lg);
|
|
174
|
+
}
|
|
175
|
+
|
|
152
176
|
.tail {
|
|
153
177
|
position: absolute;
|
|
154
178
|
left: var(--dees-popover-tail-left, 50%);
|
|
@@ -160,6 +184,10 @@ export class DeesPopover extends DeesElement implements IOverlayLayerHost {
|
|
|
160
184
|
pointer-events: none;
|
|
161
185
|
}
|
|
162
186
|
|
|
187
|
+
.tail.onActions {
|
|
188
|
+
background: var(--dees-color-modal-sidebar);
|
|
189
|
+
}
|
|
190
|
+
|
|
163
191
|
:host([actual-placement='top']) .tail {
|
|
164
192
|
bottom: -5px;
|
|
165
193
|
border-width: 0 var(--dees-line-width-hairline) var(--dees-line-width-hairline) 0;
|
|
@@ -244,8 +272,10 @@ export class DeesPopover extends DeesElement implements IOverlayLayerHost {
|
|
|
244
272
|
|
|
245
273
|
public render(): TemplateResult {
|
|
246
274
|
return html`
|
|
247
|
-
<div class="surface"><div class="content ${this.scrollEdges.fadeClasses()}"><slot></slot></div
|
|
248
|
-
|
|
275
|
+
<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>`
|
|
277
|
+
: ''}</div>
|
|
278
|
+
${this.showTail ? html`<span class="tail ${this.tailOnActions ? 'onActions' : ''}" aria-hidden="true"></span>` : ''}
|
|
249
279
|
<div class="overlayLayer"></div>
|
|
250
280
|
`;
|
|
251
281
|
}
|
|
@@ -415,6 +445,7 @@ export class DeesPopover extends DeesElement implements IOverlayLayerHost {
|
|
|
415
445
|
return;
|
|
416
446
|
}
|
|
417
447
|
const popoverRect = this.getBoundingClientRect();
|
|
448
|
+
const actionsTop = this.shadowRoot?.querySelector<HTMLElement>('.actions')?.getBoundingClientRect().top;
|
|
418
449
|
const placed = placeAnchored({
|
|
419
450
|
anchor: anchorRect,
|
|
420
451
|
width: popoverRect.width,
|
|
@@ -429,6 +460,9 @@ export class DeesPopover extends DeesElement implements IOverlayLayerHost {
|
|
|
429
460
|
this.style.top = `${placed.top}px`;
|
|
430
461
|
const block = placed.side === 'top' || placed.side === 'bottom';
|
|
431
462
|
this.style.setProperty(block ? '--dees-popover-tail-left' : '--dees-popover-tail-top', `${placed.arrow}px`);
|
|
463
|
+
// Above its anchor, or beside it level with the actions, the tail leaves from the action footer.
|
|
464
|
+
this.tailOnActions = actionsTop !== undefined
|
|
465
|
+
&& (placed.side === 'top' || (!block && placed.arrow >= actionsTop - popoverRect.top));
|
|
432
466
|
this.setAttribute('actual-placement', placed.side);
|
|
433
467
|
this.style.visibility = '';
|
|
434
468
|
}
|
/package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-C63GPX4U.js.map → chunk-QFJ7LA5L.js.map}
RENAMED
|
File without changes
|
|
File without changes
|