@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
|
@@ -20,11 +20,20 @@ import { dcLocalize } from '../../i18n/localize.js';
|
|
|
20
20
|
* Handles library loading, chart lifecycle, resize observation, and theme switching.
|
|
21
21
|
* Subclasses implement `buildOption()` to define their chart configuration.
|
|
22
22
|
*
|
|
23
|
-
* A chart is a tile (`dees-tile`): its `label` heads it in the standard header bar
|
|
24
|
-
* a `dees-legend` whose items switch their series, is in the
|
|
25
|
-
*
|
|
26
|
-
*
|
|
23
|
+
* A chart is a tile (`dees-tile`): its `label` heads it in the standard header bar, with `meta` at
|
|
24
|
+
* the bar's end, and its legend, a `dees-legend` whose items switch their series, is in the
|
|
25
|
+
* standard footer bar. Rows of the host's own about the chart (a notice, what the chart leaves out,
|
|
26
|
+
* figures it does not end on) go into the slots `above` and `below`, over and under the plot: at
|
|
27
|
+
* the tile's inset, the header's, with the legend still the tile's last row at its full width. A
|
|
28
|
+
* host so needs no tile of its own around a chart: the chart is the tile. One header per tile: a
|
|
29
|
+
* chart in a pane that heads it already hands its title to the pane's header and leaves `label`
|
|
30
|
+
* and `meta` empty, and then draws no header row of its own; `summary` still names it to a screen
|
|
27
31
|
* reader.
|
|
32
|
+
*
|
|
33
|
+
* The host's height holds the whole tile (400px by default): the header, the rows, the plot and the
|
|
34
|
+
* legend, the plot taking what the rest leaves. A chart whose rows vary takes `height: auto`, and
|
|
35
|
+
* its plot is then `--dees-chart-plot-height` tall (320px by default, what the default height
|
|
36
|
+
* leaves the plot under a header and a legend of one row).
|
|
28
37
|
*/
|
|
29
38
|
export abstract class DeesChartEchartsBase extends DeesElement {
|
|
30
39
|
/** The chart's words and formats, in the reader's language. */
|
|
@@ -38,6 +47,14 @@ export abstract class DeesChartEchartsBase extends DeesElement {
|
|
|
38
47
|
@property({ reflect: true })
|
|
39
48
|
accessor label: string = '';
|
|
40
49
|
|
|
50
|
+
/**
|
|
51
|
+
* A short text at the end of the header bar, beside `label`: what the chart covers or in which
|
|
52
|
+
* terms ("Fiscal year 2026 to date · net of VAT"). Muted, as a table's `heading2`; where the tile
|
|
53
|
+
* is too narrow for both it wraps under the label, at its start, and the bar grows by that line.
|
|
54
|
+
*/
|
|
55
|
+
@property({ reflect: true })
|
|
56
|
+
accessor meta: string = '';
|
|
57
|
+
|
|
41
58
|
/** Drop the chart's outer frame and surface: the host already owns the surface. */
|
|
42
59
|
@property({ type: Boolean, reflect: true })
|
|
43
60
|
accessor frameless: boolean = false;
|
|
@@ -139,18 +156,34 @@ export abstract class DeesChartEchartsBase extends DeesElement {
|
|
|
139
156
|
off: !this.legendShown(item.name),
|
|
140
157
|
}));
|
|
141
158
|
return html`<dees-tile .frameless=${this.frameless}>
|
|
142
|
-
${this.label ? html`<div slot="header" class="chartHeader
|
|
143
|
-
|
|
159
|
+
${this.label || this.meta ? html`<div slot="header" class="chartHeader ${this.meta ? 'hasMeta' : ''}">${this.label
|
|
160
|
+
? html`<h2 class="chartLabel">${this.label}</h2>`
|
|
161
|
+
: ''}${this.meta ? html`<span class="chartMeta">${this.meta}</span>` : ''}</div>` : ''}
|
|
162
|
+
${this.renderRows('above')}
|
|
163
|
+
<div class="chartArea">
|
|
164
|
+
<div class="chartContainer" aria-hidden="true"><div class="chartPlot"></div></div>
|
|
165
|
+
${message ? html`<div class="chartState" role="status">${message}</div>` : ''}
|
|
166
|
+
</div>
|
|
167
|
+
${this.renderRows('below')}
|
|
144
168
|
<p class="chartSummary">${this.summary || this.dataSummary()}</p>
|
|
145
169
|
${legend.length ? html`<div slot="footer" class="chartLegend"><dees-legend interactive label=${this.t('chart.series')} .items=${legend} @item-toggle=${(event: CustomEvent<IDeesLegendToggleDetail>) => {
|
|
146
170
|
const hidden = new Set(this.hiddenSeries);
|
|
147
171
|
if (event.detail.on) hidden.delete(event.detail.item.label); else hidden.add(event.detail.item.label);
|
|
148
172
|
this.hiddenSeries = hidden; this.updateChart();
|
|
149
173
|
}}></dees-legend></div>` : ''}
|
|
150
|
-
${message ? html`<div class="chartState" role="status">${message}</div>` : ''}
|
|
151
174
|
</dees-tile>`;
|
|
152
175
|
}
|
|
153
176
|
|
|
177
|
+
/**
|
|
178
|
+
* The host's rows over or under the plot, from the slot `above` or `below`; no row, and no room,
|
|
179
|
+
* while nothing is slotted there. Read from the light DOM as each render runs, so the first frame
|
|
180
|
+
* already has them; a `slotchange` renders again.
|
|
181
|
+
*/
|
|
182
|
+
private renderRows(placeArg: 'above' | 'below'): TemplateResult {
|
|
183
|
+
const slotted = this.querySelector(`:scope > [slot="${placeArg}"]`) !== null;
|
|
184
|
+
return html`<div class="chartRows ${placeArg} ${slotted ? '' : 'empty'}"><slot name=${placeArg} @slotchange=${() => this.requestUpdate()}></slot></div>`;
|
|
185
|
+
}
|
|
186
|
+
|
|
154
187
|
public async updated(changedProperties: Map<PropertyKey, unknown>) {
|
|
155
188
|
super.updated(changedProperties);
|
|
156
189
|
if (changedProperties.has('goBright') && this.chartInstance) {
|
|
@@ -20,6 +20,11 @@ export const chartFrameStyles = css`
|
|
|
20
20
|
dees-tile::part(outer) { border-color: var(--dees-color-border-subtle); }
|
|
21
21
|
.chartHeader { ${tileHeaderBar} }
|
|
22
22
|
.chartLabel { flex: 1; min-width: 0; margin: 0; font: inherit; overflow-wrap: anywhere; }
|
|
23
|
+
/* The meta text at the end of the header's line, muted as a table's subtitle; where the tile is
|
|
24
|
+
too narrow for both it wraps under the title, at its start, and the bar grows by that line. */
|
|
25
|
+
.chartHeader.hasMeta { flex-wrap: wrap; gap: var(--dees-spacing-2xs) var(--dees-spacing-md); }
|
|
26
|
+
.chartHeader.hasMeta .chartLabel { flex: 1 1 auto; }
|
|
27
|
+
.chartMeta { min-width: 0; color: var(--dees-color-text-muted); font-weight: 400; overflow-wrap: anywhere; }
|
|
23
28
|
.chartLegend { ${tileFooterBar} }
|
|
24
29
|
.chartContainer { position: absolute; inset: 0; }
|
|
25
30
|
.chartState { position: absolute; inset: 0; display: grid; place-content: center; padding: 24px; text-align: center; color: var(--dees-color-text-muted); background: var(--dees-color-bg-primary); }
|
|
@@ -30,11 +35,19 @@ export const chartFrameStyles = css`
|
|
|
30
35
|
@media (pointer: coarse) { .expandBtn { width: var(--dees-control-height-touch); height: var(--dees-control-height-touch); } }
|
|
31
36
|
`;
|
|
32
37
|
/**
|
|
33
|
-
* The
|
|
34
|
-
*
|
|
35
|
-
*
|
|
38
|
+
* The tile's content is a column: the host's rows above, the plot, the host's rows below. The rows
|
|
39
|
+
* keep their height and sit at the tile's inset, the header's; the plot takes the rest of the
|
|
40
|
+
* host's height, or, while the host's height is `auto`, `--dees-chart-plot-height`.
|
|
41
|
+
*
|
|
42
|
+
* The element ECharts draws into fills the plot's frame, whatever position ECharts writes on it.
|
|
43
|
+
* ECharts insets its plot by 16px itself; under a region inset the frame adds the rest, so axes
|
|
44
|
+
* and labels line up with the header.
|
|
36
45
|
*/
|
|
37
46
|
const echartsPlotStyles = css`
|
|
47
|
+
dees-tile::part(content) { display: flex; flex-direction: column; }
|
|
48
|
+
.chartArea { position: relative; flex: 1 1 var(--dees-chart-plot-height, 320px); min-height: 0; }
|
|
49
|
+
.chartRows { flex: none; display: flex; flex-direction: column; gap: var(--dees-spacing-md); padding: var(--dees-spacing-md) var(--chart-inset-inline, var(--dees-spacing-lg)); }
|
|
50
|
+
.chartRows.empty { display: none; }
|
|
38
51
|
.chartContainer { inset-inline: calc(var(--chart-inset-inline, 16px) - 16px); }
|
|
39
52
|
.chartPlot { width: 100%; height: 100%; }
|
|
40
53
|
`;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { css, html, type CSSResult, type TemplateResult } from '@design.estate/dees-element';
|
|
2
2
|
import type { TDcLocalizer } from '../../../i18n/messages.js';
|
|
3
|
+
import type { IActionFooterAction } from '../../00group-button/dees-actionfooter/dees-actionfooter.js';
|
|
3
4
|
import type { DeesTable } from './dees-table.js';
|
|
4
5
|
import type { Column, TTableSearchMode } from './types.js';
|
|
5
6
|
import '../../00group-input/dees-input-dropdown/dees-input-dropdown.js';
|
|
@@ -8,7 +9,6 @@ import '../../00group-input/dees-input-datepicker/index.js';
|
|
|
8
9
|
import '../../00group-input/dees-input-text/dees-input-text.js';
|
|
9
10
|
import '../../00group-input/dees-input-toggle/dees-input-toggle.js';
|
|
10
11
|
import '../../00group-input/dees-input-radiogroup/dees-input-radiogroup.js';
|
|
11
|
-
import '../../00group-button/dees-button/dees-button.js';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* The value of a view's filter: an option's `key` (`'select'`), on or off (`'toggle'`), a day as
|
|
@@ -116,11 +116,6 @@ export const tableFilterPanelStyles: CSSResult = css`
|
|
|
116
116
|
padding-top: 14px;
|
|
117
117
|
border-top: var(--dees-line-width-hairline) solid var(--dees-color-border-subtle);
|
|
118
118
|
}
|
|
119
|
-
|
|
120
|
-
.filterPanelFooter {
|
|
121
|
-
display: flex;
|
|
122
|
-
justify-content: flex-end;
|
|
123
|
-
}
|
|
124
119
|
`;
|
|
125
120
|
|
|
126
121
|
/** Renders one filter as its field; a choice applies as it is made. */
|
|
@@ -156,8 +151,8 @@ const renderFilterField = (tableArg: DeesTable<any>, filterArg: ITableFilter): T
|
|
|
156
151
|
|
|
157
152
|
/**
|
|
158
153
|
* The filter bubble's content for a table: its filters, "Filter by column" for its column filter
|
|
159
|
-
* row, where its search looks ("Search in", the scope its search field's menu chose before)
|
|
160
|
-
* "Clear filters".
|
|
154
|
+
* row, and where its search looks ("Search in", the scope its search field's menu chose before).
|
|
155
|
+
* "Clear filters" is the bubble's action (`tableFilterActions`).
|
|
161
156
|
*/
|
|
162
157
|
export const renderTableFilterPanel = (tableArg: DeesTable<any>, t: TDcLocalizer): TemplateResult => {
|
|
163
158
|
const filterable = tableArg.hasFilterableColumns;
|
|
@@ -181,11 +176,16 @@ export const renderTableFilterPanel = (tableArg: DeesTable<any>, t: TDcLocalizer
|
|
|
181
176
|
}}
|
|
182
177
|
></dees-input-radiogroup>
|
|
183
178
|
</div>
|
|
184
|
-
<div class="filterPanelFooter">
|
|
185
|
-
<dees-button class="clearFilters" type="outline" size="sm" .text=${t('table.clearFilters')}
|
|
186
|
-
.disabled=${!tableArg.activeFilters.length}
|
|
187
|
-
@clicked=${() => tableArg.clearFilters()}
|
|
188
|
-
></dees-button>
|
|
189
|
-
</div>
|
|
190
179
|
</div>`;
|
|
191
180
|
};
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* The filter bubble's action: "Clear filters", in its action footer. It is no step forward, so it
|
|
184
|
+
* is not drawn as a primary; while nothing is filtered it is unavailable.
|
|
185
|
+
*/
|
|
186
|
+
export const tableFilterActions = (tableArg: DeesTable<any>, t: TDcLocalizer): IActionFooterAction[] => [{
|
|
187
|
+
name: t('table.clearFilters'),
|
|
188
|
+
primary: false,
|
|
189
|
+
disabled: !tableArg.activeFilters.length,
|
|
190
|
+
action: async () => tableArg.clearFilters(),
|
|
191
|
+
}];
|
|
@@ -6,7 +6,7 @@ import type { DeesPopover, IDeesPopoverCloseDetail } from '../../00group-overlay
|
|
|
6
6
|
import '../../00group-overlay/dees-popover/dees-popover.js';
|
|
7
7
|
import type { DeesTable } from './dees-table.js';
|
|
8
8
|
import { dataNameForms } from './data.js';
|
|
9
|
-
import { renderTableFilterPanel } from './filters.js';
|
|
9
|
+
import { renderTableFilterPanel, tableFilterActions } from './filters.js';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* A table's search field: the query input and, at its end, the table's filter button. The table
|
|
@@ -59,6 +59,7 @@ export class TableSearchField implements TReactiveController {
|
|
|
59
59
|
</div>${table
|
|
60
60
|
? html`<dees-popover class="filterBubble" .label=${this.t('table.filters')} .open=${this.filtersOpen}
|
|
61
61
|
.dismissOnTab=${false} width="min(320px, calc(100vw - 16px))" maxHeight="min(70vh, 560px)"
|
|
62
|
+
.actions=${tableFilterActions(table, this.t)}
|
|
62
63
|
@dees-popover-close=${this.handleClose}
|
|
63
64
|
>${renderTableFilterPanel(table, this.t)}</dees-popover>`
|
|
64
65
|
: ''}`;
|
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
import { html } from '@design.estate/dees-element';
|
|
1
2
|
import { focusedInputDemo } from '../../../demos/inputs.js';
|
|
3
|
+
import { demoSection, demoOutput, demoCode, showDemoResult } from '../../../demos/templates.js';
|
|
4
|
+
import type { DeesInputRadiogroup } from './dees-input-radiogroup.js';
|
|
2
5
|
|
|
3
|
-
|
|
6
|
+
const imports = [
|
|
7
|
+
{ key: 'manual', option: 'Enter the details yourself', description: 'Type the name and whatever else you know.' },
|
|
8
|
+
{ key: 'text', option: 'Read them from a text', description: 'Paste a signature or a letterhead; a language model picks out the details.' },
|
|
9
|
+
{ key: 'website', option: 'Read them from a website', description: 'Give the address of an imprint page; a language model reads it.' },
|
|
10
|
+
];
|
|
11
|
+
|
|
12
|
+
const sections = html`
|
|
13
|
+
${demoSection('Choices that explain themselves',
|
|
14
|
+
'An option can carry a description: a line under its label that says what the choice does. The circle stays on the label\'s line, and assistive technology reads the description with the option.',
|
|
15
|
+
html`
|
|
16
|
+
<dees-input-radiogroup key="source" label="How do you want to add the contact?" .options=${imports} selectedOption="manual"
|
|
17
|
+
@change=${(event: Event) => showDemoResult(event.currentTarget as Element,
|
|
18
|
+
`Chosen: ${(event.currentTarget as DeesInputRadiogroup).selectedOption}`)}></dees-input-radiogroup>
|
|
19
|
+
${demoOutput('Chosen: manual')}
|
|
20
|
+
${demoCode("<dees-input-radiogroup .options=${[\n { key: 'manual', option: 'Enter the details yourself', description: 'Type the name and whatever else you know.' },\n ...\n]}></dees-input-radiogroup>")}
|
|
21
|
+
`)}
|
|
22
|
+
`;
|
|
23
|
+
|
|
24
|
+
export const demoFunc = () => focusedInputDemo('radiogroup', sections);
|
|
@@ -16,8 +16,12 @@ declare global {
|
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
/**
|
|
20
|
-
|
|
19
|
+
/**
|
|
20
|
+
* One entry of `options`: a label that is its own key, or a label (`option`)
|
|
21
|
+
* with a `key`, an optional `payload` and an optional `description`, a line
|
|
22
|
+
* under the label that explains the choice.
|
|
23
|
+
*/
|
|
24
|
+
export type TRadiogroupOption = string | { option: string; key: string; payload?: any; description?: string };
|
|
21
25
|
|
|
22
26
|
@customElement('dees-input-radiogroup')
|
|
23
27
|
export class DeesInputRadiogroup extends DeesInputBase<string | object> {
|
|
@@ -162,6 +166,18 @@ export class DeesInputRadiogroup extends DeesInputBase<string | object> {
|
|
|
162
166
|
line-height: var(--dees-font-subhead-line);
|
|
163
167
|
}
|
|
164
168
|
|
|
169
|
+
/* Described choices: the explanation under the label, the circle on the label's line. */
|
|
170
|
+
.maincontainer.vertical.described { gap: var(--dees-spacing-md); }
|
|
171
|
+
.radio-option.described { align-items: flex-start; }
|
|
172
|
+
.radio-text { min-width: 0; }
|
|
173
|
+
.radio-description {
|
|
174
|
+
margin-block-start: var(--dees-spacing-2xs);
|
|
175
|
+
font-size: var(--dees-font-footnote-size);
|
|
176
|
+
line-height: var(--dees-font-footnote-line);
|
|
177
|
+
color: var(--dees-color-text-secondary);
|
|
178
|
+
overflow-wrap: anywhere;
|
|
179
|
+
}
|
|
180
|
+
|
|
165
181
|
@media (pointer: coarse) {
|
|
166
182
|
.radio-option { min-height: var(--dees-control-height-touch); }
|
|
167
183
|
}
|
|
@@ -237,21 +253,23 @@ export class DeesInputRadiogroup extends DeesInputBase<string | object> {
|
|
|
237
253
|
public render(): TemplateResult {
|
|
238
254
|
const keys = this.options.map((option) => this.getOptionKey(option));
|
|
239
255
|
const tabStop = keys.includes(this.selectedOption) ? this.selectedOption : keys[0];
|
|
256
|
+
const described = this.options.some((option) => this.getOptionDescription(option));
|
|
240
257
|
return html`
|
|
241
258
|
<div class="input-wrapper">
|
|
242
259
|
${this.label ? this.renderLabel() : ''}
|
|
243
|
-
<div class="maincontainer ${this.direction}" role="radiogroup"
|
|
260
|
+
<div class="maincontainer ${this.direction} ${described ? 'described' : ''}" role="radiogroup"
|
|
244
261
|
aria-label=${this.label} aria-required=${this.required ? 'true' : 'false'}
|
|
245
262
|
aria-disabled=${this.disabled ? 'true' : 'false'}
|
|
246
263
|
aria-invalid=${this.validationState === 'invalid' ? 'true' : 'false'}>
|
|
247
264
|
${this.options.map((option) => {
|
|
248
265
|
const optionKey = this.getOptionKey(option);
|
|
249
266
|
const optionLabel = this.getOptionLabel(option);
|
|
267
|
+
const optionDescription = this.getOptionDescription(option);
|
|
250
268
|
const isSelected = this.selectedOption === optionKey;
|
|
251
269
|
|
|
252
270
|
return html`
|
|
253
271
|
<div
|
|
254
|
-
class="radio-option ${isSelected ? 'selected' : ''}"
|
|
272
|
+
class="radio-option ${isSelected ? 'selected' : ''} ${optionDescription ? 'described' : ''}"
|
|
255
273
|
@click="${() => this.selectOption(optionKey)}"
|
|
256
274
|
@keydown="${(e: KeyboardEvent) => this.handleKeydown(e, optionKey)}"
|
|
257
275
|
>
|
|
@@ -261,8 +279,12 @@ export class DeesInputRadiogroup extends DeesInputBase<string | object> {
|
|
|
261
279
|
role="radio"
|
|
262
280
|
aria-checked="${isSelected}"
|
|
263
281
|
aria-label="${optionLabel}"
|
|
282
|
+
.ariaDescription=${optionDescription || null}
|
|
264
283
|
></div>
|
|
265
|
-
<div class="radio-
|
|
284
|
+
<div class="radio-text">
|
|
285
|
+
<div class="radio-label">${optionLabel}</div>
|
|
286
|
+
${optionDescription ? html`<div class="radio-description">${optionDescription}</div>` : ''}
|
|
287
|
+
</div>
|
|
266
288
|
</div>
|
|
267
289
|
`;
|
|
268
290
|
})}
|
|
@@ -286,6 +308,10 @@ export class DeesInputRadiogroup extends DeesInputBase<string | object> {
|
|
|
286
308
|
return option.option;
|
|
287
309
|
}
|
|
288
310
|
|
|
311
|
+
private getOptionDescription(option: TRadiogroupOption): string | undefined {
|
|
312
|
+
return typeof option === 'string' ? undefined : option.description || undefined;
|
|
313
|
+
}
|
|
314
|
+
|
|
289
315
|
private getOptionByKey(key: string): TRadiogroupOption | undefined {
|
|
290
316
|
return this.options.find(opt => this.getOptionKey(opt) === key);
|
|
291
317
|
}
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
import { cssGeistFontFamily } from '../../00fonts.js';
|
|
12
12
|
import { zIndexRegistry } from '../../00zindex.js';
|
|
13
13
|
import '../../00group-utility/dees-icon/dees-icon.js';
|
|
14
|
-
import '../../00group-button/dees-
|
|
14
|
+
import '../../00group-button/dees-actionfooter/dees-actionfooter.js';
|
|
15
15
|
import '../../00group-overlay/dees-windowlayer/dees-windowlayer.js';
|
|
16
16
|
import { DeesWindowLayer } from '../../00group-overlay/dees-windowlayer/dees-windowlayer.js';
|
|
17
17
|
import { ImageCropper } from './profilepicture.cropper.js';
|
|
@@ -197,14 +197,6 @@ export class ProfilePictureModal extends DeesElement {
|
|
|
197
197
|
100% { transform: scale(1); opacity: 1; }
|
|
198
198
|
}
|
|
199
199
|
|
|
200
|
-
.modal-footer {
|
|
201
|
-
padding: 20px 24px;
|
|
202
|
-
border-top: var(--dees-line-width-hairline) solid var(--dees-color-hover);
|
|
203
|
-
display: flex;
|
|
204
|
-
gap: 10px;
|
|
205
|
-
justify-content: flex-end;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
200
|
.instructions {
|
|
209
201
|
text-align: center;
|
|
210
202
|
color: var(--dees-color-text-muted);
|
|
@@ -312,16 +304,12 @@ export class ProfilePictureModal extends DeesElement {
|
|
|
312
304
|
`}
|
|
313
305
|
</div>
|
|
314
306
|
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
${this.t('common.save')}
|
|
322
|
-
</dees-button>
|
|
323
|
-
` : ''}
|
|
324
|
-
</div>
|
|
307
|
+
${this.currentStep === 'crop' ? html`
|
|
308
|
+
<dees-actionfooter .actions=${[
|
|
309
|
+
{ name: this.t('common.cancel'), action: () => this.close() },
|
|
310
|
+
{ name: this.t('common.save'), action: () => this.handleCrop() },
|
|
311
|
+
]}></dees-actionfooter>
|
|
312
|
+
` : ''}
|
|
325
313
|
</div>
|
|
326
314
|
`;
|
|
327
315
|
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { DeesElement, customElement, property, state, html, css, cssManager } from '@design.estate/dees-element';
|
|
2
|
-
import { DeesStepper, type IStep, type TStepperLayout } from './dees-stepper.js';
|
|
2
|
+
import { DeesStepper, type IStep, type TStepperCardAlign, type TStepperLayout } from './dees-stepper.js';
|
|
3
3
|
import { DeesModal } from '../../00group-overlay/dees-modal/dees-modal.js';
|
|
4
4
|
import { themeDefaultStyles } from '../../00theme.js';
|
|
5
5
|
import { demoPage } from '../../../demos/templates.js';
|
|
6
6
|
import '../../00group-form/dees-form/dees-form.js';
|
|
7
7
|
import '../../00group-input/dees-input-text/dees-input-text.js';
|
|
8
8
|
import '../../00group-input/dees-input-multitoggle/dees-input-multitoggle.js';
|
|
9
|
+
import '../../00group-input/dees-input-radiogroup/dees-input-radiogroup.js';
|
|
10
|
+
import '../../00group-input/dees-input-textarea/dees-input-textarea.js';
|
|
9
11
|
import '../../00group-input/dees-input-toggle/dees-input-toggle.js';
|
|
10
12
|
|
|
11
13
|
const waitForProgressTick = (duration: number, signal?: AbortSignal): Promise<boolean> => new Promise(resolve => {
|
|
@@ -153,14 +155,101 @@ const createLongSteps = (finish: (name: string) => void): IStep[] => {
|
|
|
153
155
|
}));
|
|
154
156
|
};
|
|
155
157
|
|
|
158
|
+
/**
|
|
159
|
+
* A flow that starts with a choice: the first step asks how, and the steps
|
|
160
|
+
* after it follow the answer. Entering the details takes one more step; reading
|
|
161
|
+
* them from a text or a website reads first (not a step of its own) and then
|
|
162
|
+
* shows what was read for checking. Nothing is kept before Create. Cancelling
|
|
163
|
+
* closes at once until something was read and asks first after that.
|
|
164
|
+
*/
|
|
165
|
+
const createChoiceSteps = (finish: (name: string) => void): { steps: IStep[]; beforeClose: () => Promise<boolean> } => {
|
|
166
|
+
let source = 'manual';
|
|
167
|
+
const read = { name: '', email: '' };
|
|
168
|
+
const create = { name: 'Create contact', action: async (stepper?: DeesStepper) => { finish(read.name); await stepper?.destroy(); } };
|
|
169
|
+
const collect = (event: CustomEvent<{ data: { name?: string; email?: string } }>) => { Object.assign(read, event.detail.data); };
|
|
170
|
+
const reviewForm = () => html`<dees-form @formData=${collect}>
|
|
171
|
+
<dees-input-text key="name" label="Name" .value=${read.name} required></dees-input-text>
|
|
172
|
+
<dees-input-text key="email" label="Email" .value=${read.email} type="email"></dees-input-text>
|
|
173
|
+
</dees-form>`;
|
|
174
|
+
const review: IStep = {
|
|
175
|
+
title: 'Check the details.',
|
|
176
|
+
description: 'Correct anything that was read wrongly. Nothing is saved until you create the contact.',
|
|
177
|
+
content: reviewForm(),
|
|
178
|
+
menuOptions: [create],
|
|
179
|
+
};
|
|
180
|
+
const reading = (label: string, readDetails: () => void): IStep => ({
|
|
181
|
+
title: 'Reading the details.',
|
|
182
|
+
description: 'This takes a few seconds.',
|
|
183
|
+
countsAsStep: false,
|
|
184
|
+
content: html``,
|
|
185
|
+
progressStep: { label, indeterminate: true, showPercentage: false },
|
|
186
|
+
validationFunc: async (_stepper, _element, signal) => {
|
|
187
|
+
if (!await waitForProgressTick(1800, signal)) return;
|
|
188
|
+
readDetails();
|
|
189
|
+
review.content = reviewForm();
|
|
190
|
+
},
|
|
191
|
+
});
|
|
192
|
+
const flows: Record<string, IStep[]> = {
|
|
193
|
+
manual: [{
|
|
194
|
+
title: 'Enter the details.',
|
|
195
|
+
description: 'Only the name is required. You can add the rest later.',
|
|
196
|
+
content: html`<dees-form @formData=${collect}>
|
|
197
|
+
<dees-input-text key="name" label="Name" placeholder="Northwind Traders GmbH" required></dees-input-text>
|
|
198
|
+
<dees-input-text key="email" label="Email" placeholder="hello@northwind.example" type="email"></dees-input-text>
|
|
199
|
+
</dees-form>`,
|
|
200
|
+
menuOptions: [create],
|
|
201
|
+
}],
|
|
202
|
+
text: [{
|
|
203
|
+
title: 'Paste the text.',
|
|
204
|
+
description: 'A signature, a letterhead or an email: whatever names the contact.',
|
|
205
|
+
content: html`<dees-form>
|
|
206
|
+
<dees-input-textarea key="text" label="Text" .rows=${5} required
|
|
207
|
+
.value=${'Northwind Traders GmbH\nHafenstraße 12, 20457 Hamburg\nhello@northwind.example'}></dees-input-textarea>
|
|
208
|
+
</dees-form>`,
|
|
209
|
+
menuOptions: [{ name: 'Read the details', action: async (stepper) => stepper?.goNext() }],
|
|
210
|
+
}, reading('Reading the text', () => Object.assign(read, { name: 'Northwind Traders GmbH', email: 'hello@northwind.example' })), review],
|
|
211
|
+
website: [{
|
|
212
|
+
title: 'Give the website.',
|
|
213
|
+
description: 'The address of its imprint page, or the website itself.',
|
|
214
|
+
content: html`<dees-form>
|
|
215
|
+
<dees-input-text key="url" label="Imprint address" value="https://northwind.example/imprint" required></dees-input-text>
|
|
216
|
+
</dees-form>`,
|
|
217
|
+
menuOptions: [{ name: 'Read the imprint', action: async (stepper) => stepper?.goNext() }],
|
|
218
|
+
}, reading('Reading the imprint', () => Object.assign(read, { name: 'Northwind Traders GmbH', email: 'imprint@northwind.example' })), review],
|
|
219
|
+
};
|
|
220
|
+
const choose: IStep = {
|
|
221
|
+
title: 'Add a contact.',
|
|
222
|
+
description: 'How do you want to bring in the details?',
|
|
223
|
+
content: html`<dees-form @formData=${(event: CustomEvent<{ data: { source?: string } }>) => { source = event.detail.data.source || source; }}>
|
|
224
|
+
<dees-input-radiogroup key="source" label="Source" labelPosition="none" selectedOption="manual" .options=${[
|
|
225
|
+
{ key: 'manual', option: 'Enter the details yourself', description: 'Type the name and whatever else you know.' },
|
|
226
|
+
{ key: 'text', option: 'Read them from a text', description: 'Paste a signature or a letterhead; a language model picks out the details.' },
|
|
227
|
+
{ key: 'website', option: 'Read them from a website', description: 'Give the address of an imprint page; a language model reads it.' },
|
|
228
|
+
]}></dees-input-radiogroup>
|
|
229
|
+
</dees-form>`,
|
|
230
|
+
menuOptions: [{ name: 'Continue', action: async (stepper) => {
|
|
231
|
+
if (!stepper) return;
|
|
232
|
+
// The steps after the choice follow it; going back and choosing again replaces them.
|
|
233
|
+
stepper.steps = [choose, ...flows[source]];
|
|
234
|
+
stepper.goNext();
|
|
235
|
+
} }],
|
|
236
|
+
};
|
|
237
|
+
// A reading is not free to repeat: once one is held, cancelling asks first.
|
|
238
|
+
const beforeClose = async () => !read.name
|
|
239
|
+
|| DeesModal.confirm({ heading: 'Discard what was read?', question: 'Reading the details again takes another request.', confirmLabel: 'Discard' });
|
|
240
|
+
return { steps: [choose, ...flows.manual], beforeClose };
|
|
241
|
+
};
|
|
242
|
+
|
|
156
243
|
@customElement('dees-demo-stepper')
|
|
157
244
|
class DeesDemoStepper extends DeesElement {
|
|
158
245
|
@property() accessor scenario = 'Standard setup';
|
|
159
246
|
@property() accessor width = 'Wide';
|
|
160
247
|
@property() accessor layout = 'Auto';
|
|
248
|
+
@property() accessor card = 'Top';
|
|
161
249
|
@state() private accessor closed = false;
|
|
162
250
|
@state() private accessor result = '';
|
|
163
251
|
private steps = createDemoSteps(false, name => { this.result = `${name} is ready.`; });
|
|
252
|
+
private beforeClose?: () => Promise<boolean>;
|
|
164
253
|
private overlayStepper?: DeesStepper;
|
|
165
254
|
|
|
166
255
|
public static styles = [themeDefaultStyles, cssManager.defaultStyles, css`
|
|
@@ -181,8 +270,12 @@ class DeesDemoStepper extends DeesElement {
|
|
|
181
270
|
private reset() {
|
|
182
271
|
this.result = '';
|
|
183
272
|
this.closed = false;
|
|
273
|
+
const choice = this.scenario === 'Choice first' ? createChoiceSteps(name => { this.result = `${name} was added.`; }) : null;
|
|
274
|
+
this.beforeClose = choice?.beforeClose;
|
|
184
275
|
this.steps = this.scenario === 'Lookup'
|
|
185
276
|
? createLookupSteps(name => { this.result = `${name} was added.`; })
|
|
277
|
+
: choice
|
|
278
|
+
? choice.steps
|
|
186
279
|
: this.scenario === 'Long flow'
|
|
187
280
|
? createLongSteps(name => { this.result = `${name} is complete.`; })
|
|
188
281
|
: createDemoSteps(this.scenario === 'Retry example', name => { this.result = `${name} is ready.`; });
|
|
@@ -194,6 +287,7 @@ class DeesDemoStepper extends DeesElement {
|
|
|
194
287
|
this.overlayStepper = await DeesStepper.createAndShow({
|
|
195
288
|
cancelable,
|
|
196
289
|
layout: this.stepperLayout(),
|
|
290
|
+
cardAlign: this.stepperAlign(),
|
|
197
291
|
steps: createDemoSteps(this.scenario === 'Retry example', name => { this.result = `${name} is ready.`; }),
|
|
198
292
|
});
|
|
199
293
|
}
|
|
@@ -202,10 +296,14 @@ class DeesDemoStepper extends DeesElement {
|
|
|
202
296
|
return this.layout === 'Horizontal' ? 'horizontal' : this.layout === 'Vertical' ? 'vertical' : 'auto';
|
|
203
297
|
}
|
|
204
298
|
|
|
299
|
+
private stepperAlign(): TStepperCardAlign {
|
|
300
|
+
return this.card === 'Centred' ? 'center' : 'start';
|
|
301
|
+
}
|
|
302
|
+
|
|
205
303
|
public render() {
|
|
206
304
|
return html`<div class="toolbar">
|
|
207
305
|
<dees-input-multitoggle size="sm" label="Demo scenario" labelPosition="none"
|
|
208
|
-
.options=${['Standard setup', 'Retry example', 'Lookup', 'Long flow']} .selectedOption=${this.scenario}
|
|
306
|
+
.options=${['Standard setup', 'Retry example', 'Lookup', 'Choice first', 'Long flow']} .selectedOption=${this.scenario}
|
|
209
307
|
@change=${(event: CustomEvent<{ value: string }>) => { this.scenario = event.detail.value; this.reset(); }}></dees-input-multitoggle>
|
|
210
308
|
<dees-input-multitoggle size="sm" label="Demo width" labelPosition="none"
|
|
211
309
|
.options=${['Wide', 'Narrow']} .selectedOption=${this.width}
|
|
@@ -213,6 +311,9 @@ class DeesDemoStepper extends DeesElement {
|
|
|
213
311
|
<dees-input-multitoggle size="sm" label="Demo layout" labelPosition="none"
|
|
214
312
|
.options=${['Auto', 'Horizontal', 'Vertical']} .selectedOption=${this.layout}
|
|
215
313
|
@change=${(event: CustomEvent<{ value: string }>) => { this.layout = event.detail.value; }}></dees-input-multitoggle>
|
|
314
|
+
<dees-input-multitoggle size="sm" label="Demo card" labelPosition="none"
|
|
315
|
+
.options=${['Top', 'Centred']} .selectedOption=${this.card}
|
|
316
|
+
@change=${(event: CustomEvent<{ value: string }>) => { this.card = event.detail.value; }}></dees-input-multitoggle>
|
|
216
317
|
<div class="actions"><dees-button type="secondary" text="Open overlay" @clicked=${() => this.openOverlay()}></dees-button>
|
|
217
318
|
<dees-button type="ghost" text="Reset" @clicked=${this.reset}></dees-button></div>
|
|
218
319
|
</div>
|
|
@@ -220,11 +321,12 @@ class DeesDemoStepper extends DeesElement {
|
|
|
220
321
|
<dees-icon icon=${this.result ? 'lucide:CircleCheck' : 'lucide:Layers'} iconSize="32"></dees-icon>
|
|
221
322
|
<h2>${this.result || 'Setup cancelled.'}</h2><p>This example uses local sample data.</p>
|
|
222
323
|
<dees-button type="secondary" text="Start again" @clicked=${this.reset}></dees-button>
|
|
223
|
-
</div>` : html`<dees-stepper .steps=${this.steps} .layout=${this.stepperLayout()} .stepCounter=${this.scenario === 'Lookup' ? 'position' : 'total'} @stepper-close=${() => { this.closed = true; }}></dees-stepper>`}</div>
|
|
324
|
+
</div>` : html`<dees-stepper .steps=${this.steps} .layout=${this.stepperLayout()} .cardAlign=${this.stepperAlign()} .stepCounter=${this.scenario === 'Lookup' ? 'position' : 'total'} .beforeClose=${this.beforeClose} @stepper-close=${() => { this.closed = true; }}></dees-stepper>`}</div>
|
|
224
325
|
<p class="caption">${this.scenario === 'Retry example' ? 'The first setup attempt pauses with an error. Try again to continue with your saved choices.'
|
|
225
326
|
: this.scenario === 'Lookup' ? 'The counter says only where you are and the ribbon fades out after it; the lookup is not a step of its own and can be stopped while it runs. Discard asks first, and only Discard waits for the answer.'
|
|
327
|
+
: this.scenario === 'Choice first' ? 'The first step asks how; the steps after it follow the answer. Entering the details takes one more step; reading them from a text or a website reads first and then shows what was read for checking. Cancelling closes at once until something was read, and asks first after that. Centred stands the card in the middle of the stage, as a flow with a tab of its own would.'
|
|
226
328
|
: this.scenario === 'Long flow' ? 'More steps than the ribbon has room for: it scrolls and keeps the current marker in view. Use a completed marker to go back.'
|
|
227
|
-
: 'Move forward, go back with Back or a completed marker in the ribbon, and review your choices. Vertical, and Auto on a narrow surface, show the ribbon as a strip above the steps, and the steps slide sideways.'}</p>
|
|
329
|
+
: 'Move forward, go back with Back or a completed marker in the ribbon, and review your choices. Vertical, and Auto on a narrow surface, show the ribbon as a strip above the steps, and the steps slide sideways. Centred stands the card in the middle of the stage.'}</p>
|
|
228
330
|
<details><summary class="caption">Completion required</summary>
|
|
229
331
|
<p class="caption">For a flow that must finish, such as a required update, cancellation can be disabled.</p>
|
|
230
332
|
<dees-button type="secondary" text="Open required setup" @clicked=${() => this.openOverlay(false)}></dees-button>
|