@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
package/readme.md
CHANGED
|
@@ -50,6 +50,7 @@ switcher**, **view-toggle**, and **single-selection toggle** all lead to
|
|
|
50
50
|
| Edit project files with terminals | [`dees-workspace`](#deesworkspace) | Monaco, file tree, terminal and diff workspace. |
|
|
51
51
|
| Run an agent conversation with tools and decisions | [`dees-harness-chat`](#deesharnesschat) | Compose the harness family; use its session list for conversation management. |
|
|
52
52
|
| Ask for a focused decision or show contextual commands | [`dees-modal`](#deesmodal), [`dees-contextmenu`](#deescontextmenu) | Modal task flow versus contextual action menu. Use existing overlay ownership. |
|
|
53
|
+
| Put the actions of a dialog, a speech bubble or a card of your own at its bottom edge | [`dees-actionfooter`](#deesactionfooter) | Divider, tinted strip, the primary rightmost, one action at a time. A dialog's `menuOptions` and a bubble's `actions` are drawn by it already; never a row of buttons built by hand. Not the countdown question bar, which is [`dees-actionbar`](#deesactionbar). |
|
|
53
54
|
| Show completion, progress or transient feedback | [`dees-stepper`](#deesstepper), [`dees-progressbar`](#deesprogressbar), [`dees-toast`](#deestoast) | Workflow stages, measurable progress, or a brief notification. |
|
|
54
55
|
|
|
55
56
|
### Before adding a control
|
|
@@ -342,6 +343,7 @@ task guide and examples deliberately; the generated table does not replace them.
|
|
|
342
343
|
| Element | Family | API | Source |
|
|
343
344
|
| --- | --- | --- | --- |
|
|
344
345
|
| `dees-actionbar` | feedback | [DeesActionbar](#deesactionbar) | [Source](ts_web/elements/00group-feedback/dees-actionbar/dees-actionbar.ts) |
|
|
346
|
+
| `dees-actionfooter` | button | [DeesActionFooter](#deesactionfooter) | [Source](ts_web/elements/00group-button/dees-actionfooter/dees-actionfooter.ts) |
|
|
345
347
|
| `dees-appui` | appui | [DeesAppui](#deesappui) | [Source](ts_web/elements/00group-appui/dees-appui/dees-appui.ts) |
|
|
346
348
|
| `dees-appui-activitylog` | appui | [DeesAppuiActivitylog](#deesappuiactivitylog) | [Source](ts_web/elements/00group-appui/dees-appui-activitylog/dees-appui-activitylog.ts) |
|
|
347
349
|
| `dees-appui-appbar` | appui | — | [Source](ts_web/elements/00group-appui/dees-appui-appbar/component.ts) |
|
|
@@ -510,7 +512,8 @@ new public primitive property that neither reflects nor is listed there.
|
|
|
510
512
|
|
|
511
513
|
Components that run an application callback — `dees-modal`'s `menuOptions[].action`,
|
|
512
514
|
`dees-table`'s `dataActions[].actionFunc` and `onRetry`, `dees-tile`'s `actions[].actionFunc`,
|
|
513
|
-
`dees-appui-page`'s `actions[].action
|
|
515
|
+
`dees-appui-page`'s `actions[].action`, `dees-state`'s `actions[].action` and `onRetry`,
|
|
516
|
+
`dees-popover`'s `actions[].action` and `dees-actionfooter`'s `actions[].action` —
|
|
514
517
|
await it. A rejected callback is
|
|
515
518
|
never dropped: the component dispatches the cancelable `dees-action-error` event
|
|
516
519
|
(bubbling and composed) and, unless a listener cancels it, shows the error through
|
|
@@ -519,10 +522,11 @@ never dropped: the component dispatches the cancelable `dees-action-error` event
|
|
|
519
522
|
```typescript
|
|
520
523
|
element.addEventListener('dees-action-error', (event: CustomEvent<IActionErrorDetail>) => {
|
|
521
524
|
const { error, action, source } = event.detail;
|
|
522
|
-
// source: 'modal-menu' | 'modal-dismiss' | 'table-header' | 'table-footer' | 'table-empty'
|
|
525
|
+
// source: 'modal-menu' | 'modal-dismiss' | 'stepper-cancel' | 'table-header' | 'table-footer' | 'table-empty'
|
|
523
526
|
// | 'table-row' | 'table-rowmenu' | 'table-contextmenu' | 'table-doubleclick' | 'table-rowclick'
|
|
524
527
|
// | 'table-keycombination'
|
|
525
528
|
// | 'tile-header' | 'tile-footer' | 'page-action' | 'state-action' | 'state-retry'
|
|
529
|
+
// | 'popover-action' | 'actionfooter' (a footer's own `source` when it sets one)
|
|
526
530
|
event.preventDefault(); // render your own error surface instead of the toast
|
|
527
531
|
reportToCrashService(error);
|
|
528
532
|
});
|
|
@@ -544,6 +548,7 @@ implementation offers its actions the same way. Choose the place by what the act
|
|
|
544
548
|
| What a tile shows: a summary, a status, a chart, a list that is not a table | the tile's [`actions`](#deestile), `type: ['footer']` for the way on from the content, `['header']` for one that adds to or refreshes it | "Open the audit trail", "Export CSV", "New invoice" |
|
|
545
549
|
| A whole page or view | [`dees-appui-page`](#deesappuipage) `actions` | "New service" |
|
|
546
550
|
| A decision a dialog asks for | [`dees-modal`](#deesmodal) `menuOptions` | "Cancel", "Delete" |
|
|
551
|
+
| What a speech bubble shows, such as its filters | the bubble's [`actions`](#deespopover) | "Clear filters" |
|
|
547
552
|
| A place that loads, is empty or failed | [`dees-state`](#deesstate) `actions` | "Retry", "New service" |
|
|
548
553
|
| Not an action: a standing explanation of a view — how a feature works, what a list holds | the table's or the tile's `info`: an info button (ⓘ) at the end of the footer bar, after the footer actions, that opens it in the [speech bubble](#deespopover) | "A GoBD year archive holds one fiscal year: …" |
|
|
549
554
|
| Not an action: the view's filters | the table's [`filters`](#deestable), behind the filter button at the end of its search field; what is active shows as chips in the active-filter bar above the column headers | "Account", "Month", "Include private" |
|
|
@@ -551,6 +556,10 @@ implementation offers its actions the same way. Choose the place by what the act
|
|
|
551
556
|
- Never build a bar of buttons into a tile's footer or header slot. Tile actions and a table's
|
|
552
557
|
header and footer actions are one standard, drawn by one renderer: they share their size, type,
|
|
553
558
|
spacing, wrapping, glyph, busy face, keyboard behaviour and accessible name.
|
|
559
|
+
- A dialog's and a speech bubble's actions stand in their action footer,
|
|
560
|
+
[`dees-actionfooter`](#deesactionfooter), at the bottom edge: a divider, a tinted strip, the
|
|
561
|
+
primary rightmost. Never build a row of buttons into a dialog's or a bubble's content; a surface
|
|
562
|
+
of your own that asks like a dialog, a card centred in a view, places the same footer.
|
|
554
563
|
- A tile whose content is a table offers the actions about the table's rows as the table's own
|
|
555
564
|
header or footer actions, never in a second footer under the table's: the table's footer already
|
|
556
565
|
carries its count and its actions.
|
|
@@ -569,8 +578,8 @@ implementation offers its actions the same way. Choose the place by what the act
|
|
|
569
578
|
button is the sliders button at the end of the table's search field, in the table's header or
|
|
570
579
|
in [`dees-table-search`](#deestablesearch) on the page header: one entry point, never a second
|
|
571
580
|
filter control beside the field. It counts the active filters and opens them in the speech
|
|
572
|
-
bubble, with "Filter by column"
|
|
573
|
-
as it is made. Each filter declares its `default`, the value that means "not filtered" (every
|
|
581
|
+
bubble, with "Filter by column" and where the search looks, and "Clear filters" in the bubble's
|
|
582
|
+
action footer; a choice applies as it is made. Each filter declares its `default`, the value that means "not filtered" (every
|
|
574
583
|
account, any month, private movements included): only a filter at another value is active,
|
|
575
584
|
counts on the button, shows as a chip ("Account: Sparkasse", "Without private") in the
|
|
576
585
|
active-filter bar between the header and the column headers, and "Clear all" puts it back to
|
|
@@ -1337,6 +1346,53 @@ Container for grouping related buttons together.
|
|
|
1337
1346
|
</dees-button-group>
|
|
1338
1347
|
```
|
|
1339
1348
|
|
|
1349
|
+
#### `DeesActionFooter`
|
|
1350
|
+
|
|
1351
|
+
The action row at the bottom edge of a surface: a hairline divider, a tinted strip
|
|
1352
|
+
(`--dees-color-modal-sidebar`), the actions on the inline end with the primary rightmost.
|
|
1353
|
+
[`dees-modal`](#deesmodal) draws its `menuOptions` with it and [`dees-popover`](#deespopover) its
|
|
1354
|
+
`actions`; place it yourself only on a surface of your own that asks like a dialog, such as a card
|
|
1355
|
+
centred in a view. It is not [`dees-actionbar`](#deesactionbar), the bar that asks one question
|
|
1356
|
+
at a time with a countdown.
|
|
1357
|
+
|
|
1358
|
+
```typescript
|
|
1359
|
+
import { catalogAction } from '@design.estate/dees-catalog';
|
|
1360
|
+
|
|
1361
|
+
html`<dees-actionfooter .context=${card} .actions=${[
|
|
1362
|
+
catalogAction('common.cancel', async () => card.close()),
|
|
1363
|
+
{ name: 'Save changes', action: async (cardArg) => save(cardArg) },
|
|
1364
|
+
]}></dees-actionfooter>`
|
|
1365
|
+
```
|
|
1366
|
+
|
|
1367
|
+
- **Primary.** Without `primary` on any action, the last one is the primary, drawn as `accent`, or as
|
|
1368
|
+
`destructive` with `primaryActionType="destructive"` for an action that deletes or cannot be
|
|
1369
|
+
taken back. Once an action carries `primary`, only the first marked `primary: true` is the
|
|
1370
|
+
primary; actions all marked `primary: false` have none, as a filter bubble's lone "Clear
|
|
1371
|
+
filters". The primary stands rightmost wherever it sits in `actions`; the others are
|
|
1372
|
+
`secondary` and keep their order.
|
|
1373
|
+
- **One at a time.** Every action is awaited: while its promise is pending its button shows the
|
|
1374
|
+
busy face, the others are unavailable, and a second press is ignored. A rejection is announced
|
|
1375
|
+
through `dees-action-error` with the footer's `source` (`actionfooter` unless the surface names
|
|
1376
|
+
itself, as `modal-menu` and `popover-action` do; see [Failed actions](#failed-actions)), and
|
|
1377
|
+
the row is usable again. A running action is known by its object, so keep the action objects
|
|
1378
|
+
while one runs.
|
|
1379
|
+
- **Unavailable.** `disabled: true` on an action keeps it visible but unavailable, as "Clear
|
|
1380
|
+
filters" while nothing is filtered; `disabled` on the footer makes every action unavailable.
|
|
1381
|
+
- **Context.** Each action receives `context`, the dialog, bubble or card the footer belongs to,
|
|
1382
|
+
or the footer itself when it is unset. `runPrimary()` runs the primary as a press would; a
|
|
1383
|
+
dialog runs it on Enter in its form's last field.
|
|
1384
|
+
- **Words.** `catalogAction('common.cancel' | 'common.create' | 'modal.continue', action)` makes
|
|
1385
|
+
an action named by a catalog word: the footer reads it in the reader's language while it
|
|
1386
|
+
renders, so it follows a change of language while it shows.
|
|
1387
|
+
- **Inset and wrapping.** `--dees-actionfooter-inset` sets the inline padding (24px by default)
|
|
1388
|
+
so the actions line up with the surface's heading and content; the modal sets its own inset,
|
|
1389
|
+
a bubble 16px. A label too long for the row wraps inside its button instead of being cut off.
|
|
1390
|
+
|
|
1391
|
+
The buttons are drawn in the footer's own shadow root. A test that reached a dialog's buttons
|
|
1392
|
+
through `modal.shadowRoot.querySelectorAll('dees-button')` reads them one root further down:
|
|
1393
|
+
`modal.shadowRoot.querySelector('dees-actionfooter').shadowRoot.querySelectorAll('dees-button')`.
|
|
1394
|
+
Role and text locators find them as before.
|
|
1395
|
+
|
|
1340
1396
|
#### `DeesHeading`
|
|
1341
1397
|
Consistent heading component; the text is slotted.
|
|
1342
1398
|
|
|
@@ -1825,7 +1881,7 @@ translate the inner input event into their own public event should stop the inne
|
|
|
1825
1881
|
event's propagation.
|
|
1826
1882
|
|
|
1827
1883
|
#### `DeesInputRadiogroup`
|
|
1828
|
-
Radio-style single-choice form input, including required validation and optional payload values. For a segmented view switcher, use [`dees-input-multitoggle`](#deesinputmultitoggle). Object options use `{ key, option, payload? }`; the visible text field is `option`, unlike multitoggle's `label`.
|
|
1884
|
+
Radio-style single-choice form input, including required validation and optional payload values. For a segmented view switcher, use [`dees-input-multitoggle`](#deesinputmultitoggle). Object options use `{ key, option, payload?, description? }`; the visible text field is `option`, unlike multitoggle's `label`. A `description` is a line under the option's label that explains the choice (secondary footnote text); the circle stays on the label's line, and the description is the radio's accessible description.
|
|
1829
1885
|
|
|
1830
1886
|
The options sit in one `radiogroup` named by the label (with `aria-required`, `aria-disabled` and `aria-invalid`), and the group is one tab stop: Tab reaches the chosen option, or the first while nothing is chosen. The arrow keys move the choice with the focus and wrap; Space chooses the focused option. Enter belongs to the form, as in a native radio group: it moves to the next field, or submits from the last.
|
|
1831
1887
|
|
|
@@ -1850,6 +1906,16 @@ The options sit in one `radiogroup` named by the label (with `aria-required`, `a
|
|
|
1850
1906
|
]}
|
|
1851
1907
|
selectedOption="medium"
|
|
1852
1908
|
></dees-input-radiogroup>
|
|
1909
|
+
|
|
1910
|
+
// Choices that explain themselves
|
|
1911
|
+
<dees-input-radiogroup
|
|
1912
|
+
key="source"
|
|
1913
|
+
label="How do you want to add the contact?"
|
|
1914
|
+
.options=${[
|
|
1915
|
+
{ key: 'manual', option: 'Enter the details yourself', description: 'Type the name and whatever else you know.' },
|
|
1916
|
+
{ key: 'text', option: 'Read them from a text', description: 'Paste a signature; a language model picks out the details.' }
|
|
1917
|
+
]}
|
|
1918
|
+
></dees-input-radiogroup>
|
|
1853
1919
|
```
|
|
1854
1920
|
|
|
1855
1921
|
#### `DeesInputTags`
|
|
@@ -3841,6 +3907,29 @@ with their container and recreate their engines when reattached. Assign a bounde
|
|
|
3841
3907
|
height when embedding in a dashboard. Every chart, `dees-chart-log` included, accepts
|
|
3842
3908
|
[`frameless`](#frameless-components) when the dashboard cell or panel owns the frame.
|
|
3843
3909
|
|
|
3910
|
+
An ECharts chart (`dees-chart-line`, `-bar`, `-donut`, `-gauge`, `-radar`) also carries what a
|
|
3911
|
+
host would otherwise wrap it in a tile for. `meta` is a short text at the end of the header bar,
|
|
3912
|
+
beside the `label`: what the figures cover, or the terms they are stated in. It is muted, as a
|
|
3913
|
+
table's `heading2`, in the header's size, and where the bar is too narrow for both it wraps under
|
|
3914
|
+
the title at its start and the bar grows. The host's own rows go into the tile around the plot:
|
|
3915
|
+
an element with `slot="above"` sits between the header and the plot, one with `slot="below"`
|
|
3916
|
+
between the plot and the legend, both at the header's inset, framed or frameless. The legend
|
|
3917
|
+
stays the tile's last row, at its full width. The host's height holds the whole tile (400px by
|
|
3918
|
+
default) and the plot takes what the header, the rows and the legend leave; a chart whose rows
|
|
3919
|
+
vary takes `height: auto`, and its plot is then `--dees-chart-plot-height` tall (320px by
|
|
3920
|
+
default; a donut keeps its own plot height). `dees-chart-area` and `dees-chart-log` have frames
|
|
3921
|
+
of their own and take neither.
|
|
3922
|
+
|
|
3923
|
+
```typescript
|
|
3924
|
+
html`<dees-chart-line label="Bank balances" meta="as each bank statement states them"
|
|
3925
|
+
style="height: auto; --dees-chart-plot-height: 240px"
|
|
3926
|
+
.series=${balances}
|
|
3927
|
+
>
|
|
3928
|
+
<dees-hint slot="above" type="warning" text="Two statements for 30 September state different balances."></dees-hint>
|
|
3929
|
+
<ul slot="below"><li>Savings: 6,000.00 € on 31 July, its latest statement</li></ul>
|
|
3930
|
+
</dees-chart-line>`;
|
|
3931
|
+
```
|
|
3932
|
+
|
|
3844
3933
|
A series or a slice says what it stands for with `tone` — `'neutral'`, `'accent'`,
|
|
3845
3934
|
`'success'`, `'warning'` or `'danger'` — and is drawn in the theme's colour for it, in the
|
|
3846
3935
|
bright and the dark theme alike, so a host never passes a hex for "paid" or "overdue". An
|
|
@@ -4256,9 +4345,12 @@ or a pixel value. `minWidth` and `maxWidth` remain bounded by the viewport.
|
|
|
4256
4345
|
`showCloseButton`, `showHelpButton`, and `onHelp`. `contentPadding` defaults to 24px; at 0 the
|
|
4257
4346
|
body runs to the sheet's edges and declares the heading's inset as the
|
|
4258
4347
|
[region inset](#region-inset), so a frameless table or code view in it lines up with the heading.
|
|
4259
|
-
The
|
|
4260
|
-
`
|
|
4261
|
-
|
|
4348
|
+
The `menuOptions` stand in the dialog's action footer, a
|
|
4349
|
+
[`dees-actionfooter`](#deesactionfooter) inset like the heading. The final action is the primary
|
|
4350
|
+
one, drawn as an `accent` button and standing rightmost, unless an action carries `primary`
|
|
4351
|
+
(`IActionFooterAction`); set `primaryActionType: 'destructive'` to draw it as a destructive button
|
|
4352
|
+
for an action that deletes or cannot be taken back. `disabled: true` shows an action that cannot
|
|
4353
|
+
be taken yet. An action whose label is
|
|
4262
4354
|
wider than the dialog wraps onto more lines inside it rather than being cut off; a label
|
|
4263
4355
|
that fits keeps the one-line action.
|
|
4264
4356
|
|
|
@@ -4395,6 +4487,7 @@ The catalog's one speech bubble: nonmodal content anchored in the browser's top
|
|
|
4395
4487
|
- **Placement.** `.placement` (`TDeesPopoverPlacement`) is `'auto'` by default: the bubble measures the room around the part of its anchor the reader sees — its box cut by the viewport and the scroll containers around it — and opens below or above it, wherever it fits with more room (below a header, above a footer), beside it only when neither fits, and on the side with the most room for its size when nothing fits. `'top'`, `'bottom'`, `'start'` and `'end'` (the inline sides in the anchor's writing direction; `'end'` is the right in a left-to-right page) name the side, which then holds. Either way the bubble keeps 8px from the viewport's edges, sliding along its side, and its tail keeps pointing at the anchor's middle. The side it took is the `actual-placement` attribute (`top`, `bottom`, `left`, `right`). While open it places itself again as the page scrolls or resizes and as its anchor or its content resizes, keeping its side while it still fits there. It eases in from its anchor on that side, at once under `prefers-reduced-motion: reduce`.
|
|
4396
4488
|
- **Scrolling.** Content taller than `.maxHeight` scrolls inside the bubble's frame and fades out toward the edges past which more lies ([Scroll edges](#scroll-edges), the fade look); content that fits fades nowhere.
|
|
4397
4489
|
- **Controls inside.** A dropdown's list, a date picker or a context menu opened from a control inside the bubble shows above it: they mount in the bubble's own top layer (its `overlayLayer`, which `getOverlayContainer` finds as it finds an open dialog), and the bubble leaves the keys to them while one is open, so Escape closes the list first and the bubble with the next press. A press in the list does not close the bubble. A toast raised inside the bubble is no part of it: it shows above the bubble and stays when it closes.
|
|
4490
|
+
- **Actions.** `.actions` (`IActionFooterAction<DeesPopover>[]`) are the bubble's actions about what it shows, such as a filter bubble's "Clear filters". They stand in its [action footer](#deesactionfooter) at the bottom edge, which stays in place while the content scrolls: the primary rightmost (the last action unless one carries `primary`; `primary: false` on all of them draws plain buttons), one action at a time, each called with the bubble, a failure announced with the source `popover-action`. A press on one keeps the bubble open. When the tail leaves the bubble from the footer — the bubble above its anchor, or beside it level with the footer — it takes the footer's tint. Without actions the bubble has no footer; a tooltip has none.
|
|
4398
4491
|
- **Tooltip.** A host that opens the bubble on hover gives it `role="tooltip"`: it is then named by its content, not by `.label`, and leaves its anchor's state alone (no `aria-expanded`, `aria-haspopup` or `aria-controls`); the host describes the anchor by it. `dees-speechbubble` does this for its rich bubbles.
|
|
4399
4492
|
|
|
4400
4493
|
```typescript
|
|
@@ -4534,6 +4627,15 @@ modal with `DeesStepper.createAndShow({ steps, cancelable: true })`.
|
|
|
4534
4627
|
a small modal), where the card also tightens its padding in any layout. The ribbon follows
|
|
4535
4628
|
the writing direction: in a right-to-left page it stands on the steps' right, the
|
|
4536
4629
|
strip fills from the right and the steps slide the other way.
|
|
4630
|
+
- **A centred card.** `cardAlign` (also a `createAndShow` option) sets where the card
|
|
4631
|
+
stands in the stepper's height. `'start'` (default) sets it at an offset from the top.
|
|
4632
|
+
`'center'` centres it, with as much room above it as below and the ribbon at its top
|
|
4633
|
+
edge (in the vertical layout the strip and the card stand centred together): a
|
|
4634
|
+
focused, dialog-like card inside a page or a tab that the flow has to itself, without
|
|
4635
|
+
a modal. Each step is centred at its own height, a leaving step fades out where it
|
|
4636
|
+
stood, and a step taller than the stepper scrolls inside its card. The text in the
|
|
4637
|
+
card keeps its alignment. (The property is not called `align`: on an element, that
|
|
4638
|
+
attribute is the browser's legacy text alignment.)
|
|
4537
4639
|
- Async actions prevent duplicate activation and display failures in the current
|
|
4538
4640
|
step. The running action alone shows its busy face; the others are disabled
|
|
4539
4641
|
until it settles. Progress failures expose **Try again**; `retryStep()` reruns validation.
|
|
@@ -4548,18 +4650,29 @@ modal with `DeesStepper.createAndShow({ steps, cancelable: true })`.
|
|
|
4548
4650
|
and `goBack()` keep what the reader entered, and custom elements in it disconnect
|
|
4549
4651
|
while their step is off the stage and connect again when it returns. Back honors
|
|
4550
4652
|
`allowBack: false`. A leaving step is inert. A step starts at a fixed height and
|
|
4551
|
-
grows downward
|
|
4552
|
-
scrolls to place a step. Transitions use the
|
|
4553
|
-
where they are when interrupted, and are instant
|
|
4653
|
+
grows downward (a centred card grows from its middle), so new content never moves
|
|
4654
|
+
its title; nothing in the stepper scrolls to place a step. Transitions use the
|
|
4655
|
+
theme's motion tokens, turn from where they are when interrupted, and are instant
|
|
4656
|
+
under reduced motion.
|
|
4554
4657
|
- **Cancelling.** Each step's header carries `dees-modal`'s close control (×) at its
|
|
4555
4658
|
inline end. It, Escape (overlay mode) and backdrop clicks (anywhere beside the current
|
|
4556
4659
|
step and the ribbon) share a confirmation flow (an Escape that closes an open bubble closes only the
|
|
4557
4660
|
bubble); `cancelable: false` removes the close control and
|
|
4558
|
-
disables those dismissal paths, however often Escape is pressed. A
|
|
4661
|
+
disables those dismissal paths, however often Escape is pressed. A flow that knows
|
|
4662
|
+
what a cancel would lose sets `beforeClose` (also a `createAndShow` option), which
|
|
4663
|
+
is asked in place of the stepper's own confirmation, as `dees-modal`'s is: only
|
|
4664
|
+
`false` keeps the flow open, so the flow can ask its own question, or close at once
|
|
4665
|
+
while nothing is entered. A hook that throws or rejects keeps the flow open and is
|
|
4666
|
+
announced through `dees-action-error` with the source `stepper-cancel`. A close the
|
|
4559
4667
|
browser still forces, such as a system back gesture, ends the flow as a
|
|
4560
4668
|
dismissal: the step's work is aborted, the stepper is removed and `stepper-close`
|
|
4561
|
-
fires. `destroy()` closes the flow
|
|
4562
|
-
|
|
4669
|
+
fires. `destroy()` closes the flow: the stepper removes itself and `stepper-close`
|
|
4670
|
+
fires, once. Only closing the flow fires it: `destroy()`, a confirmed cancel, or a
|
|
4671
|
+
close the browser forces. When the page takes an inline stepper out and puts it
|
|
4672
|
+
back (a tab switch, a re-render that moves it), the flow goes on: the step, what was
|
|
4673
|
+
entered and a running action are kept, and no `stepper-close` fires. While it is out,
|
|
4674
|
+
the step's `validationFunc` work is aborted, and it starts again when the stepper is
|
|
4675
|
+
back; observers and the confirmation are released. Overlay mode uses native
|
|
4563
4676
|
dialog focus containment and restoration.
|
|
4564
4677
|
- The stepper fires `deesElementConnected` once it has connected and made its
|
|
4565
4678
|
selected step the working one (its form read for the primary, its work started);
|
|
@@ -4572,8 +4685,11 @@ modal with `DeesStepper.createAndShow({ steps, cancelable: true })`.
|
|
|
4572
4685
|
|
|
4573
4686
|
The catalog demo combines setup fields, preferences, a review, background work,
|
|
4574
4687
|
and completion. **Retry example** fails the first background attempt and preserves
|
|
4575
|
-
the choices for recovery, **Lookup** a flow of unknown length (`'position'`),
|
|
4576
|
-
**
|
|
4688
|
+
the choices for recovery, **Lookup** a flow of unknown length (`'position'`),
|
|
4689
|
+
**Choice first** a flow whose later steps follow the first step's answer (three
|
|
4690
|
+
described choices in a `dees-input-radiogroup`; its `beforeClose` asks first only once
|
|
4691
|
+
something was read), and **Long flow** a ribbon that
|
|
4692
|
+
scrolls. **Narrow** shows the strip, **Centred** the centred card. It also shows
|
|
4577
4693
|
optional and required-completion overlays.
|
|
4578
4694
|
|
|
4579
4695
|
```typescript
|
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export const commitinfo = {
|
|
5
5
|
name: '@design.estate/dees-catalog',
|
|
6
|
-
version: '21.
|
|
6
|
+
version: '21.29.0',
|
|
7
7
|
description: 'A comprehensive library that provides dynamic web components for building sophisticated and modern web applications using JavaScript and TypeScript.'
|
|
8
8
|
}
|
package/ts_web/demos/charts.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { operationsDemoStyles } from './operations.js';
|
|
|
5
5
|
import { themeDefaultStyles } from '../elements/00theme.js';
|
|
6
6
|
import { getChartPalette } from '../elements/00group-chart/dees-chart-echarts-theme.js';
|
|
7
7
|
import '../elements/00group-button/dees-button/dees-button.js';
|
|
8
|
+
import '../elements/00group-feedback/dees-hint/dees-hint.js';
|
|
8
9
|
|
|
9
10
|
export const chartSamples = (step = 0, sampledAt = Date.now()) => {
|
|
10
11
|
const offset = [0, 8, -4, 12][step % 4];
|
|
@@ -74,10 +75,10 @@ type TChartDemo = 'area' | 'bar' | 'donut' | 'gauge' | 'line' | 'radar';
|
|
|
74
75
|
const languages = [{ key: 'en', label: 'English' }, { key: 'de', label: 'Deutsch' }];
|
|
75
76
|
const descriptions = {
|
|
76
77
|
area: ['Activity over time', 'Follow a service through the latest sample. Drag across the plot to inspect a time range. Below, the host states throughput unrounded: hovering shows each value in full, while the axis keeps the width of its own labels.'],
|
|
77
|
-
bar: ['Compare traffic', 'Compare requests and cache hits across the week. Switch orientation or stack related series. Below, each month has two columns that reach both ways from zero: money in above, money out below, and the operating column marks its surplus or deficit at its end.'],
|
|
78
|
+
bar: ['Compare traffic', 'Compare requests and cache hits across the week. Switch orientation or stack related series. Below, each month has two columns that reach both ways from zero: money in above, money out below, and the operating column marks its surplus or deficit at its end. Its header states what the chart covers beside the title, and a line of the host\'s own under the plot, at the header\'s inset, names what the chart leaves out: the legend stays the tile\'s last row.'],
|
|
78
79
|
donut: ['Traffic distribution', 'Understand the share of requests from each region. Labels and legends remain optional. Below, three months of spending: each donut keeps one size whatever its legend holds, and the host\'s own list draws its dots in the charts\' palette.'],
|
|
79
80
|
gauge: ['Capacity', 'See used capacity against a defined range and warning thresholds.'],
|
|
80
|
-
line: ['Stated balances', 'Balances where the statements state them, on an axis proportional to time. A quarterly statement sits three months after the one before. With lines, an area can tint each course down to zero, and the legend can state each account\'s latest balance. The time axis labels whole days, months or years that differ and keep apart at any width: two statements a day apart are labelled by their days, and a year of month ends month by month where there is room. The value axis of the balances states whole euros, while hovering, the legend and the text summary keep the cents. A year of daily balances crowds its line with a dot a day: with markers hidden, lines and steps draw the course alone, hovering marks and reads out the day nearest the pointer, and a value with no neighbour, such as the single savings statement, keeps its dot.'],
|
|
81
|
+
line: ['Stated balances', 'Balances where the statements state them, on an axis proportional to time. A quarterly statement sits three months after the one before. With lines, an area can tint each course down to zero, and the legend can state each account\'s latest balance. The time axis labels whole days, months or years that differ and keep apart at any width: two statements a day apart are labelled by their days, and a year of month ends month by month where there is room. The value axis of the balances states whole euros, while hovering, the legend and the text summary keep the cents. A year of daily balances crowds its line with a dot a day: with markers hidden, lines and steps draw the course alone, hovering marks and reads out the day nearest the pointer, and a value with no neighbour, such as the single savings statement, keeps its dot. The balances state their terms beside the title, with a notice of the host\'s own over the plot and the balances the course does not end on under it, at the header\'s inset: the chart grows with these rows, its plot keeping 240 px, and the legend stays the tile\'s last row.'],
|
|
81
82
|
radar: ['Service profile', 'Compare the current service with its targets across five dimensions.'],
|
|
82
83
|
};
|
|
83
84
|
|
|
@@ -110,6 +111,10 @@ export class DeesDemoChartWorkspace extends DeesElement {
|
|
|
110
111
|
.key .dot { width: 8px; height: 8px; border-radius: 50%; }
|
|
111
112
|
.key strong { color: var(--dees-color-text-primary); font-weight: 500; font-variant-numeric: tabular-nums; }
|
|
112
113
|
.widths dees-chart-line { height: 320px; }
|
|
114
|
+
/* Rows of the host's own in a chart: it grows with them, its plot keeping its height. */
|
|
115
|
+
.withRows { height: auto; --dees-chart-plot-height: 240px; }
|
|
116
|
+
.note, .rowList { margin: 0; color: var(--dees-color-text-secondary); font: var(--dees-font-caption1-size)/var(--dees-font-caption1-line) var(--dees-font-family); }
|
|
117
|
+
.rowList { padding: 0; list-style: none; }
|
|
113
118
|
.wide { width: 1440px; }
|
|
114
119
|
.narrow { width: 420px; }
|
|
115
120
|
`];
|
|
@@ -166,13 +171,21 @@ export class DeesDemoChartWorkspace extends DeesElement {
|
|
|
166
171
|
</div>
|
|
167
172
|
<div class="options" role="group" aria-label="Language of the charts">${languages.map(({ key, label }) => toggle(label, this.language === key, () => { void this.setLanguage(key); }))}</div>
|
|
168
173
|
${this.kind === 'bar' ? html`<dees-chart-bar label="Requests and cache hits" .categories=${data.categories} .series=${this.empty ? [] : data.series} .horizontal=${this.alternate} .stacked=${this.secondary} .valueFormatter=${(value: number) => `${Math.round(value)}k`}></dees-chart-bar>
|
|
169
|
-
<dees-chart-bar label="Month by month, as booked" .categories=${data.bookings.categories} .series=${this.empty ? [] : data.bookings.series} .stacks=${data.bookings.stacks} .nets=${data.bookings.nets} .horizontal=${this.alternate} .valueFormatter=${this.euro(2)} .netLabelFormatter=${this.compactEuro()}
|
|
174
|
+
<dees-chart-bar label="Month by month, as booked" meta="Fiscal year 2026 to date · net of VAT" .categories=${data.bookings.categories} .series=${this.empty ? [] : data.bookings.series} .stacks=${data.bookings.stacks} .nets=${data.bookings.nets} .horizontal=${this.alternate} .valueFormatter=${this.euro(2)} .netLabelFormatter=${this.compactEuro()}>
|
|
175
|
+
<p slot="below" class="note">Left out: 0480 Office equipment and 1800 Private withdrawals, which are none of these parts.</p>
|
|
176
|
+
</dees-chart-bar>` : ''}
|
|
170
177
|
${this.kind === 'area' ? html`<dees-chart-area label="Requests per minute" .series=${this.empty ? [] : data.timeline} .yAxisFormatter=${(value: number) => `${Math.round(value)}k`} .legendStats=${['latest', 'min', 'max']} .chartLines=${[]} .rangeSelectionEnabled=${true}></dees-chart-area>
|
|
171
178
|
<dees-chart-area label="Network throughput" .series=${this.empty ? [] : data.throughput} .yAxisFormatter=${(value: number) => `${value} Mbit/s`} .legendStats=${['latest', 'max']}></dees-chart-area>` : ''}
|
|
172
179
|
${this.kind === 'donut' ? html`<dees-chart-donut label="Requests by region" .data=${this.empty ? [] : data.regions} .showLabels=${!this.alternate} .showLegend=${!this.secondary} .valueFormatter=${(value: number) => `${Math.round(value)}k`}></dees-chart-donut>
|
|
173
180
|
${this.renderSpending(data)}` : ''}
|
|
174
181
|
${this.kind === 'gauge' ? html`<dees-chart-gauge label="Queue capacity" .value=${data.capacity} .showTicks=${this.alternate} .thresholds=${[{value:60,tone:'success'},{value:80,tone:'warning'},{value:100,tone:'danger'}]}></dees-chart-gauge>` : ''}
|
|
175
|
-
${this.kind === 'line' ? html`<dees-chart-line label="Account balances" .series=${this.empty ? [] : data.statements} .presentation=${presentation} .fillArea=${this.filled} .showMarkers=${!this.dotless} .showLatestValue=${this.latest} .valueFormatter=${this.euro(2)} .axisValueFormatter=${wholeEuro}
|
|
182
|
+
${this.kind === 'line' ? html`<dees-chart-line class="withRows" label="Account balances" meta="as each bank statement states them" .series=${this.empty ? [] : data.statements} .presentation=${presentation} .fillArea=${this.filled} .showMarkers=${!this.dotless} .showLatestValue=${this.latest} .valueFormatter=${this.euro(2)} .axisValueFormatter=${wholeEuro}>
|
|
183
|
+
<dees-hint slot="above" type="warning" text="Two statements of the current account for 30 September 2026 state different balances: 2,246.86 € and 2,264.86 €."></dees-hint>
|
|
184
|
+
<ul slot="below" class="rowList">
|
|
185
|
+
<li>Savings: 6,000.00 € on 31 July 2026, its latest statement</li>
|
|
186
|
+
<li>Credit card: no statement states a balance</li>
|
|
187
|
+
</ul>
|
|
188
|
+
</dees-chart-line>
|
|
176
189
|
<dees-chart-line label="Stated a day apart" .series=${this.empty ? [] : data.dayApart} .presentation=${presentation} .fillArea=${this.filled} .showMarkers=${!this.dotless} .showLatestValue=${this.latest} .valueFormatter=${(value: number) => `$${this.i18n.format.number(value, 'integer')}`}></dees-chart-line>
|
|
177
190
|
<dees-chart-line label="A year of daily balances" .series=${this.empty ? [] : data.daily} .presentation=${presentation} .fillArea=${this.filled} .showMarkers=${!this.dotless} .showLatestValue=${this.latest} .valueFormatter=${this.euro(2)} .axisValueFormatter=${wholeEuro}></dees-chart-line>
|
|
178
191
|
<div class="widths" role="group" aria-label="A year of month ends at two widths">
|
|
@@ -8,14 +8,16 @@ export interface IActionErrorDetail<TAction = unknown> {
|
|
|
8
8
|
action: TAction;
|
|
9
9
|
/**
|
|
10
10
|
* Where the action was invoked from. Catalog sources are `modal-menu`,
|
|
11
|
-
* `modal-dismiss` (a failing `beforeClose` hook), `
|
|
11
|
+
* `modal-dismiss` (a failing `beforeClose` hook), `stepper-cancel` (a
|
|
12
|
+
* `dees-stepper`'s failing `beforeClose` hook), `table-header`,
|
|
12
13
|
* `table-footer`, `table-empty`, `table-row`, `table-rowmenu`,
|
|
13
14
|
* `table-contextmenu`, `table-doubleclick`, `table-rowclick`,
|
|
14
15
|
* `table-keycombination`, `page-action` (a
|
|
15
16
|
* `dees-appui-page` header action), `state-action` and `state-retry` (a
|
|
16
17
|
* `dees-state` action and its Retry), and `statusbutton-action` (a
|
|
17
18
|
* `dees-statusbutton` status's action); `tile-header` and `tile-footer` are
|
|
18
|
-
* a `dees-tile`'s actions
|
|
19
|
+
* a `dees-tile`'s actions; `popover-action` is a `dees-popover`'s action and
|
|
20
|
+
* `actionfooter` one of a `dees-actionfooter` placed on its own.
|
|
19
21
|
*/
|
|
20
22
|
source: string;
|
|
21
23
|
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { html } from '@design.estate/dees-element';
|
|
2
|
+
import { demoPage, demoSection, demoOutput, demoCode, showDemoResult } from '../../../demos/templates.js';
|
|
3
|
+
import type { IActionFooterAction } from './dees-actionfooter.js';
|
|
4
|
+
|
|
5
|
+
const surfaceStyles = html`<style>
|
|
6
|
+
.demo-surface { display: grid; max-width: 480px; overflow: hidden; border-radius: var(--dees-radius-2xl); background: var(--dees-material-thick-bg-opaque); box-shadow: 0 0 0 var(--dees-line-width-hairline) var(--dees-color-border-subtle), var(--dees-shadow-lg); }
|
|
7
|
+
.demo-surface.narrow { max-width: 280px; }
|
|
8
|
+
.demo-surface-body { padding: var(--dees-spacing-xl); font-size: var(--dees-font-footnote-size); line-height: var(--dees-font-footnote-line); color: var(--dees-color-text-secondary); }
|
|
9
|
+
.demo-surface-body strong { display: block; margin-bottom: var(--dees-spacing-xs); font-size: var(--dees-font-subhead-size); line-height: var(--dees-font-subhead-line); color: var(--dees-color-text-primary); }
|
|
10
|
+
</style>`;
|
|
11
|
+
|
|
12
|
+
/** A surface with a body and the footer at its bottom edge, as a dialog or a card draws it. */
|
|
13
|
+
const surface = (title: string, body: string, footer: ReturnType<typeof html>, narrow = false) => html`
|
|
14
|
+
<div class="demo-surface ${narrow ? 'narrow' : ''}">
|
|
15
|
+
<div class="demo-surface-body"><strong>${title}</strong>${body}</div>
|
|
16
|
+
${footer}
|
|
17
|
+
</div>`;
|
|
18
|
+
|
|
19
|
+
const report = (name: string): IActionFooterAction<HTMLElement>['action'] => async (footer) => {
|
|
20
|
+
showDemoResult(footer!, `${name} pressed`);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const demoFunc = () => demoPage('Action footer', 'The action row at the bottom edge of a dialog, a speech bubble or a card: a divider, a tinted strip, the primary rightmost.', html`
|
|
24
|
+
${surfaceStyles}
|
|
25
|
+
${demoSection('Two actions', 'The last action is the primary unless one says otherwise; the others are secondary.', html`
|
|
26
|
+
${surface('Save the draft?', 'Your changes stay on this device until you save them.', html`
|
|
27
|
+
<dees-actionfooter .actions=${[
|
|
28
|
+
{ name: 'Cancel', action: report('Cancel') },
|
|
29
|
+
{ name: 'Save changes', action: report('Save changes') },
|
|
30
|
+
]}></dees-actionfooter>`)}
|
|
31
|
+
${demoOutput('Press an action.')}
|
|
32
|
+
${demoCode("<dees-actionfooter .actions=${[\n { name: 'Cancel', action: cancel },\n { name: 'Save changes', action: save },\n]}></dees-actionfooter>")}`)}
|
|
33
|
+
${demoSection('A destructive primary', 'An action that deletes or cannot be taken back is drawn as destructive.', html`
|
|
34
|
+
${surface('Remove this member?', 'They lose access to the workspace immediately.', html`
|
|
35
|
+
<dees-actionfooter primaryActionType="destructive" .actions=${[
|
|
36
|
+
{ name: 'Keep', action: report('Keep') },
|
|
37
|
+
{ name: 'Remove', action: report('Remove') },
|
|
38
|
+
]}></dees-actionfooter>`)}
|
|
39
|
+
${demoOutput('Press an action.')}`)}
|
|
40
|
+
${demoSection('No primary', 'Actions all marked primary: false are ordinary buttons, as a filter bubble\'s Clear filters. A disabled action stays visible.', html`
|
|
41
|
+
${surface('Filters', 'Two filters narrow the list.', html`
|
|
42
|
+
<dees-actionfooter style="--dees-actionfooter-inset: var(--dees-spacing-lg)" .actions=${[
|
|
43
|
+
{ name: 'Undo', primary: false, disabled: true, action: report('Undo') },
|
|
44
|
+
{ name: 'Clear filters', primary: false, action: report('Clear filters') },
|
|
45
|
+
]}></dees-actionfooter>`)}
|
|
46
|
+
${demoOutput('Press Clear filters.')}`)}
|
|
47
|
+
${demoSection('Actions that take a moment', 'One action runs at a time: its button shows the busy face and the others wait. A failure is announced and hands the row back.', html`
|
|
48
|
+
${surface('Issue the invoice', 'Issuing takes a moment; failing shows a notification.', html`
|
|
49
|
+
<dees-actionfooter .actions=${[
|
|
50
|
+
{ name: 'Fail', action: async () => { throw new Error('The invoicing service is unavailable.'); } },
|
|
51
|
+
{ name: 'Issue', action: async (footer: HTMLElement) => {
|
|
52
|
+
await new Promise((resolve) => setTimeout(resolve, 1500));
|
|
53
|
+
showDemoResult(footer, 'Issued once');
|
|
54
|
+
} },
|
|
55
|
+
]}></dees-actionfooter>`)}
|
|
56
|
+
${demoOutput('Press Issue twice in a row to see it run once.')}`)}
|
|
57
|
+
${demoSection('Long labels', 'A label too long for the row wraps inside its button instead of being cut off.', html`
|
|
58
|
+
${surface('Discard the import?', 'The imported rows have not been checked yet.', html`
|
|
59
|
+
<dees-actionfooter .actions=${[
|
|
60
|
+
{ name: 'Discard all imported rows', action: report('Discard') },
|
|
61
|
+
{ name: 'Check the imported rows one by one', action: report('Check') },
|
|
62
|
+
]}></dees-actionfooter>`, true)}
|
|
63
|
+
${demoOutput('Press an action.')}`)}
|
|
64
|
+
`);
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import * as plugins from '../../00plugins.js';
|
|
2
|
+
import { runAction } from '../../00actionerror.js';
|
|
3
|
+
import { dcMessages } from '../../../i18n/messages.js';
|
|
4
|
+
import { dcLocalize } from '../../../i18n/localize.js';
|
|
5
|
+
import {
|
|
6
|
+
DeesElement,
|
|
7
|
+
css,
|
|
8
|
+
cssManager,
|
|
9
|
+
customElement,
|
|
10
|
+
html,
|
|
11
|
+
property,
|
|
12
|
+
state,
|
|
13
|
+
type TemplateResult,
|
|
14
|
+
} from '@design.estate/dees-element';
|
|
15
|
+
|
|
16
|
+
import { demoFunc } from './dees-actionfooter.demo.js';
|
|
17
|
+
import { themeDefaultStyles } from '../../00theme.js';
|
|
18
|
+
import '../dees-button/dees-button.js';
|
|
19
|
+
|
|
20
|
+
declare global {
|
|
21
|
+
interface HTMLElementTagNameMap {
|
|
22
|
+
'dees-actionfooter': DeesActionFooter;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* One action of a footer. Without `primary` on any of the actions, the last one is the primary.
|
|
28
|
+
* Once one of them carries `primary`, only the first marked `primary: true` is: actions that are
|
|
29
|
+
* all marked `primary: false` have no primary, as a bubble's lone "Clear filters".
|
|
30
|
+
*/
|
|
31
|
+
export interface IActionFooterAction<T = any> extends plugins.tsclass.website.IMenuItem<T> {
|
|
32
|
+
/** Whether this is the footer's primary action, drawn in the primary type and run by `runPrimary()`. */
|
|
33
|
+
primary?: boolean;
|
|
34
|
+
/** Shown but not available, as "Clear filters" while nothing is filtered. */
|
|
35
|
+
disabled?: boolean;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** The dees-button types the primary action may take. */
|
|
39
|
+
export type TActionFooterPrimaryType = 'accent' | 'destructive';
|
|
40
|
+
|
|
41
|
+
/** The catalog words an action of `catalogAction()` may be named by. */
|
|
42
|
+
export type TActionFooterWord = 'common.cancel' | 'common.create' | 'modal.continue';
|
|
43
|
+
|
|
44
|
+
/** The catalog word of each action `catalogAction()` made. */
|
|
45
|
+
const catalogWords = new WeakMap<IActionFooterAction, TActionFooterWord>();
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* An action named by a catalog word rather than by its caller: the footer reads its name in the
|
|
49
|
+
* reader's language while it renders, so the name follows a change of language while the footer
|
|
50
|
+
* shows, as the Cancel and Create of `DeesModal.prompt()` do.
|
|
51
|
+
*/
|
|
52
|
+
export const catalogAction = <T = any>(
|
|
53
|
+
wordArg: TActionFooterWord,
|
|
54
|
+
actionArg: IActionFooterAction<T>['action'],
|
|
55
|
+
): IActionFooterAction<T> => {
|
|
56
|
+
const item: IActionFooterAction<T> = { name: dcMessages.entries[wordArg].message, action: actionArg };
|
|
57
|
+
catalogWords.set(item, wordArg);
|
|
58
|
+
return item;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* The action row at the bottom edge of a surface — a dialog, a speech bubble, a card: a hairline
|
|
63
|
+
* divider, a tinted strip, the actions on the inline end with the primary rightmost in the accent
|
|
64
|
+
* colour and the others secondary. A label too long for the row wraps inside its button instead of
|
|
65
|
+
* being cut off. `dees-modal` and `dees-popover` draw their actions with it.
|
|
66
|
+
*
|
|
67
|
+
* It runs one action at a time: while an action's promise is pending, its button shows the busy
|
|
68
|
+
* face and the others are unavailable, so a second press cannot run an irreversible operation
|
|
69
|
+
* twice. A rejection is announced through `dees-action-error` and, unless a listener cancels it,
|
|
70
|
+
* a notification in the dialog the footer sits in; the footer is usable again either way.
|
|
71
|
+
*
|
|
72
|
+
* The surface sets the inline inset with `--dees-actionfooter-inset` (24px by default) so the
|
|
73
|
+
* actions line up with its heading and content.
|
|
74
|
+
*/
|
|
75
|
+
@customElement('dees-actionfooter')
|
|
76
|
+
export class DeesActionFooter extends DeesElement {
|
|
77
|
+
public static demo = demoFunc;
|
|
78
|
+
public static demoGroups = ['Button'];
|
|
79
|
+
|
|
80
|
+
private readonly t = dcLocalize(this);
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* The actions, in reading order; the primary always stands rightmost, wherever it sits here. A
|
|
84
|
+
* running action is known by its object, so a host keeps its action objects while one runs.
|
|
85
|
+
*/
|
|
86
|
+
@property({ attribute: false })
|
|
87
|
+
accessor actions: IActionFooterAction[] = [];
|
|
88
|
+
|
|
89
|
+
/** What each action's callback receives: the dialog, the bubble or the card the footer belongs to; the footer itself when unset. */
|
|
90
|
+
@property({ attribute: false })
|
|
91
|
+
accessor context: unknown = undefined;
|
|
92
|
+
|
|
93
|
+
/** How the primary action is drawn: `accent` for a step forward, `destructive` for one that deletes or cannot be taken back. */
|
|
94
|
+
@property({ type: String, reflect: true })
|
|
95
|
+
accessor primaryActionType: TActionFooterPrimaryType = 'accent';
|
|
96
|
+
|
|
97
|
+
/** Every action unavailable, as while the dialog the footer belongs to confirms a prompt. */
|
|
98
|
+
@property({ type: Boolean, reflect: true })
|
|
99
|
+
accessor disabled = false;
|
|
100
|
+
|
|
101
|
+
/** The `source` of a failed action's `dees-action-error`, naming the surface: `modal-menu`, `popover-action`. */
|
|
102
|
+
@property({ type: String, reflect: true })
|
|
103
|
+
accessor source = 'actionfooter';
|
|
104
|
+
|
|
105
|
+
/** The action whose promise is still pending, if any. */
|
|
106
|
+
@state()
|
|
107
|
+
private accessor pendingAction: IActionFooterAction | null = null;
|
|
108
|
+
|
|
109
|
+
public static styles = [
|
|
110
|
+
themeDefaultStyles,
|
|
111
|
+
cssManager.defaultStyles,
|
|
112
|
+
css`
|
|
113
|
+
:host {
|
|
114
|
+
display: flex;
|
|
115
|
+
flex-wrap: wrap;
|
|
116
|
+
justify-content: flex-end;
|
|
117
|
+
align-items: center;
|
|
118
|
+
gap: var(--dees-spacing-sm);
|
|
119
|
+
padding: var(--dees-spacing-md) var(--dees-actionfooter-inset, var(--dees-spacing-xl));
|
|
120
|
+
border-top: var(--dees-line-width-hairline) solid var(--dees-color-border-subtle);
|
|
121
|
+
background: var(--dees-color-modal-sidebar);
|
|
122
|
+
font-family: var(--dees-font-family);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
:host([hidden]) {
|
|
126
|
+
display: none;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/* An action keeps the one-line 28px face while its label fits. A label wider than the row
|
|
130
|
+
(a long confirmation on a phone) wraps onto more lines inside it instead of being cut
|
|
131
|
+
off: the face grows in height, never past the row's width. */
|
|
132
|
+
.action {
|
|
133
|
+
max-width: 100%;
|
|
134
|
+
min-width: 0;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.action::part(button) {
|
|
138
|
+
height: auto;
|
|
139
|
+
min-height: var(--dees-control-height-md);
|
|
140
|
+
max-width: 100%;
|
|
141
|
+
padding-block: var(--dees-spacing-xs);
|
|
142
|
+
white-space: normal;
|
|
143
|
+
/* anywhere, not break-word: only anywhere counts toward min-content, so an unbreakable
|
|
144
|
+
token (an e-mail address, an identifier) breaks inside the face instead of spilling */
|
|
145
|
+
overflow-wrap: anywhere;
|
|
146
|
+
text-align: center;
|
|
147
|
+
font-size: var(--dees-font-control-size);
|
|
148
|
+
border-radius: var(--dees-radius-md);
|
|
149
|
+
}
|
|
150
|
+
`,
|
|
151
|
+
];
|
|
152
|
+
|
|
153
|
+
public render(): TemplateResult {
|
|
154
|
+
const primary = this.primaryAction;
|
|
155
|
+
const ordered = primary ? [...this.actions.filter((action) => action !== primary), primary] : this.actions;
|
|
156
|
+
return html`${ordered.map((action) => html`
|
|
157
|
+
<dees-button class="action" .text=${this.actionName(action)}
|
|
158
|
+
.disabled=${this.disabled || !!action.disabled || (this.pendingAction !== null && this.pendingAction !== action)}
|
|
159
|
+
.status=${this.pendingAction === action ? 'pending' : 'normal'}
|
|
160
|
+
.type=${action === primary ? this.primaryActionType : 'secondary'}
|
|
161
|
+
@clicked=${() => this.run(action)}></dees-button>
|
|
162
|
+
`)}`;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/** The primary action: the first marked `primary: true`, or the last when none carries the flag. */
|
|
166
|
+
public get primaryAction(): IActionFooterAction | undefined {
|
|
167
|
+
if (this.actions.some((action) => action.primary !== undefined)) return this.actions.find((action) => action.primary === true);
|
|
168
|
+
return this.actions[this.actions.length - 1];
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Runs the primary action as a press on its button would — Enter in a dialog's form does this.
|
|
173
|
+
* Nothing starts while an action runs, while the footer or the primary is disabled, or without a
|
|
174
|
+
* primary.
|
|
175
|
+
*/
|
|
176
|
+
public async runPrimary(): Promise<void> {
|
|
177
|
+
const primary = this.primaryAction;
|
|
178
|
+
if (primary) await this.run(primary);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/** An action's name: the caller's, or the catalog's for an action `catalogAction()` made. */
|
|
182
|
+
private actionName(actionArg: IActionFooterAction): string {
|
|
183
|
+
const word = catalogWords.get(actionArg);
|
|
184
|
+
return word ? this.t(word) : actionArg.name;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
private async run(actionArg: IActionFooterAction): Promise<void> {
|
|
188
|
+
if (this.pendingAction || this.disabled || actionArg.disabled) return;
|
|
189
|
+
this.pendingAction = actionArg;
|
|
190
|
+
try {
|
|
191
|
+
await runAction(this, { action: actionArg, source: this.source, ownerElement: this }, () => actionArg.action(this.context ?? this));
|
|
192
|
+
} finally {
|
|
193
|
+
this.pendingAction = null;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './dees-actionfooter.js';
|