@commmerce/ui 1.4.0 → 1.5.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/calendar.js +15 -19
- package/dist/cdn.js +1267 -1138
- package/dist/components/accordion.js +9 -8
- package/dist/components/action-bar.js +15 -15
- package/dist/components/action-menu.js +10 -9
- package/dist/components/app-card.js +15 -14
- package/dist/components/app-frame.d.ts +14 -0
- package/dist/components/app-frame.js +20 -1
- package/dist/components/badge.d.ts +2 -1
- package/dist/components/badge.js +4 -3
- package/dist/components/banner.js +6 -5
- package/dist/components/board.js +18 -18
- package/dist/components/bottom-navigation.d.ts +1 -1
- package/dist/components/bottom-navigation.js +9 -7
- package/dist/components/bottom-sheet.d.ts +1 -1
- package/dist/components/bottom-sheet.js +9 -8
- package/dist/components/button.d.ts +3 -3
- package/dist/components/button.js +22 -19
- package/dist/components/calendar.js +29 -28
- package/dist/components/card.d.ts +1 -1
- package/dist/components/card.js +18 -12
- package/dist/components/checkbox.js +8 -7
- package/dist/components/color-field.js +9 -13
- package/dist/components/combobox.d.ts +8 -0
- package/dist/components/combobox.js +18 -18
- package/dist/components/comment.d.ts +1 -1
- package/dist/components/comment.js +12 -13
- package/dist/components/data-table.js +12 -11
- package/dist/components/date-picker.js +1 -1
- package/dist/components/date-range-picker.js +7 -7
- package/dist/components/empty-state.d.ts +1 -1
- package/dist/components/empty-state.js +16 -16
- package/dist/components/file-upload.js +18 -16
- package/dist/components/filter-panel.js +1 -1
- package/dist/components/flash-offer-bar.js +8 -7
- package/dist/components/global-search.d.ts +1 -1
- package/dist/components/global-search.js +12 -9
- package/dist/components/grid.d.ts +1 -1
- package/dist/components/grid.js +1 -1
- package/dist/components/header-bar.js +38 -31
- package/dist/components/info-panel.d.ts +1 -1
- package/dist/components/info-panel.js +11 -10
- package/dist/components/layout.d.ts +1 -1
- package/dist/components/layout.js +1 -1
- package/dist/components/link-tabs.js +8 -7
- package/dist/components/metric.js +4 -4
- package/dist/components/mobile-menu.js +16 -15
- package/dist/components/modal.js +2 -1
- package/dist/components/nested-list.d.ts +2 -2
- package/dist/components/nested-list.js +21 -22
- package/dist/components/notification-panel.js +12 -11
- package/dist/components/option-group.js +10 -11
- package/dist/components/page-header.js +16 -15
- package/dist/components/page.d.ts +18 -4
- package/dist/components/page.js +22 -7
- package/dist/components/pagination.d.ts +1 -1
- package/dist/components/pagination.js +16 -9
- package/dist/components/progress-bar.js +4 -3
- package/dist/components/radio.js +12 -12
- package/dist/components/report-tile.d.ts +2 -2
- package/dist/components/report-tile.js +18 -18
- package/dist/components/resource-list.d.ts +22 -6
- package/dist/components/resource-list.js +92 -52
- package/dist/components/save-bar.js +8 -8
- package/dist/components/search.d.ts +5 -2
- package/dist/components/search.js +20 -14
- package/dist/components/segmented-control.d.ts +67 -0
- package/dist/components/segmented-control.js +76 -0
- package/dist/components/select.d.ts +8 -0
- package/dist/components/select.js +18 -18
- package/dist/components/side-navigation.js +20 -17
- package/dist/components/side-panel.js +4 -3
- package/dist/components/signature-field.js +20 -18
- package/dist/components/skeleton-display.js +4 -4
- package/dist/components/skeleton.d.ts +1 -1
- package/dist/components/skeleton.js +2 -2
- package/dist/components/smart-tip.d.ts +1 -1
- package/dist/components/smart-tip.js +16 -16
- package/dist/components/spinner.js +1 -1
- package/dist/components/stack.d.ts +1 -1
- package/dist/components/stack.js +1 -1
- package/dist/components/status-tabs.d.ts +4 -3
- package/dist/components/status-tabs.js +26 -12
- package/dist/components/table-header.d.ts +4 -3
- package/dist/components/table-header.js +22 -15
- package/dist/components/tag.js +3 -4
- package/dist/components/text-field.d.ts +1 -1
- package/dist/components/text-field.js +8 -15
- package/dist/components/thumbnail.js +1 -1
- package/dist/components/timeline.js +12 -11
- package/dist/components/toast.js +6 -6
- package/dist/components/toggle.js +12 -11
- package/dist/components/tooltip.js +4 -3
- package/dist/custom-elements.json +929 -160
- package/dist/field.d.ts +15 -0
- package/dist/field.js +47 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/overlay.js +5 -4
- package/dist/popover.js +8 -8
- package/dist/spacing.d.ts +14 -4
- package/dist/spacing.js +13 -4
- package/package.json +3 -3
|
@@ -13,7 +13,7 @@ export declare class CmLayout extends LitElement {
|
|
|
13
13
|
reflect: boolean;
|
|
14
14
|
};
|
|
15
15
|
};
|
|
16
|
-
/** Space between sections, across and down: a spacing step (`0`, `
|
|
16
|
+
/** Space between sections, across and down: a spacing step on the 4px grid (`0`, `4`, `8`, `12`, `16`, `20`, `24`, `32`, `40`, `48`, `64`; the pre-1.5 steps `10`, `15`, `22` and `30` still work and draw as 8, 16, 24 and 32). Default `20`. */
|
|
17
17
|
gap: SpaceStep;
|
|
18
18
|
static styles: import("lit").CSSResult[];
|
|
19
19
|
render(): import("lit-html").TemplateResult<1>;
|
|
@@ -11,7 +11,7 @@ import { spaceRules } from '../spacing.js';
|
|
|
11
11
|
export class CmLayout extends LitElement {
|
|
12
12
|
constructor() {
|
|
13
13
|
super(...arguments);
|
|
14
|
-
/** Space between sections, across and down: a spacing step (`0`, `
|
|
14
|
+
/** Space between sections, across and down: a spacing step on the 4px grid (`0`, `4`, `8`, `12`, `16`, `20`, `24`, `32`, `40`, `48`, `64`; the pre-1.5 steps `10`, `15`, `22` and `30` still work and draw as 8, 16, 24 and 32). Default `20`. */
|
|
15
15
|
this.gap = '20';
|
|
16
16
|
}
|
|
17
17
|
render() {
|
|
@@ -68,21 +68,22 @@ CmLinkTabs.styles = [
|
|
|
68
68
|
css `
|
|
69
69
|
:host { display: block; }
|
|
70
70
|
ul {
|
|
71
|
-
display: flex; gap:
|
|
72
|
-
border-bottom: var(--cm-border-1) solid var(--cm-border-
|
|
71
|
+
display: flex; gap: var(--cm-space-24); margin: 0; padding: 2px 2px 0; list-style: none; overflow-x: auto; scrollbar-width: thin;
|
|
72
|
+
border-bottom: var(--cm-border-1) solid var(--cm-border-subtle); white-space: nowrap;
|
|
73
73
|
}
|
|
74
74
|
li { flex: none; display: flex; }
|
|
75
75
|
a {
|
|
76
|
-
position: relative; display: inline-flex; align-items: center; gap:
|
|
77
|
-
font-size:
|
|
76
|
+
position: relative; display: inline-flex; align-items: center; gap: var(--cm-space-8); padding: var(--cm-space-4) 0 var(--cm-space-12);
|
|
77
|
+
font-size: var(--cm-font-size-14); line-height: var(--cm-line-height-14); font-weight: 500; color: var(--cm-text-tertiary); text-decoration: none;
|
|
78
78
|
}
|
|
79
|
-
a::after { content: ''; position: absolute; inset-inline: 0; bottom: -1px; height: 2px; border-radius:
|
|
79
|
+
a::after { content: ''; position: absolute; inset-inline: 0; bottom: -1px; height: 2px; border-radius: var(--cm-radius-full); background: transparent; }
|
|
80
80
|
a:hover { color: var(--cm-text-default); }
|
|
81
81
|
a[aria-current='page'] { color: var(--cm-text-default); }
|
|
82
82
|
a[aria-current='page']::after { background: var(--cm-border-strong); }
|
|
83
83
|
a:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; border-radius: var(--cm-radius-xs); }
|
|
84
|
-
.badge { font-size:
|
|
85
|
-
@media (max-width: 640px) { ul { gap:
|
|
84
|
+
.badge { font-size: var(--cm-font-size-12); color: var(--cm-text-tertiary); font-variant-numeric: tabular-nums; }
|
|
85
|
+
@media (max-width: 640px) { ul { gap: var(--cm-space-16); } }
|
|
86
|
+
|
|
86
87
|
`,
|
|
87
88
|
];
|
|
88
89
|
define('cm-link-tabs', CmLinkTabs);
|
|
@@ -132,18 +132,18 @@ CmMetric.styles = [
|
|
|
132
132
|
.tile {
|
|
133
133
|
display: flex; flex-direction: column; gap: 4px; block-size: 100%; min-inline-size: 0;
|
|
134
134
|
padding: var(--cm-space-20); color: var(--cm-text-default); text-decoration: none; text-align: start;
|
|
135
|
-
background: var(--cm-bg-surface); border: var(--cm-border-1) solid var(--cm-border-
|
|
135
|
+
background: var(--cm-bg-surface); border: var(--cm-border-1) solid var(--cm-border-subtle); border-radius: var(--cm-radius-md);
|
|
136
136
|
}
|
|
137
137
|
a.tile { cursor: pointer; }
|
|
138
138
|
a.tile:hover { border-color: var(--cm-border-strong); }
|
|
139
139
|
a.tile:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
140
140
|
.label { font-size: var(--cm-type-body-md-size); font-weight: 500; line-height: var(--cm-type-body-md-line-height); overflow-wrap: anywhere; }
|
|
141
141
|
.value {
|
|
142
|
-
font-size: var(--cm-type-heading-lg-size); font-weight: var(--cm-type-heading-lg-weight); line-height:
|
|
142
|
+
font-size: var(--cm-type-heading-lg-size); font-weight: var(--cm-type-heading-lg-weight); line-height: var(--cm-type-heading-lg-line-height);
|
|
143
143
|
font-variant-numeric: tabular-nums; overflow-wrap: anywhere; min-block-size: 1.25em;
|
|
144
144
|
}
|
|
145
145
|
.value cm-skeleton { inline-size: 6ch; max-inline-size: 100%; --cm-skeleton-height: 0.9em; margin-block: 0.175em; }
|
|
146
|
-
.foot { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: var(--cm-space-
|
|
146
|
+
.foot { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: var(--cm-space-8); row-gap: 2px; }
|
|
147
147
|
.foot:not(.on) { display: none; }
|
|
148
148
|
.change {
|
|
149
149
|
display: inline-flex; align-items: center; gap: 2px; font-size: var(--cm-type-body-sm-size); font-weight: 500;
|
|
@@ -159,7 +159,7 @@ CmMetric.styles = [
|
|
|
159
159
|
.hint:not(.on) { display: none; }
|
|
160
160
|
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
|
|
161
161
|
@media (max-width: 640px) {
|
|
162
|
-
.tile { padding: var(--cm-space-
|
|
162
|
+
.tile { padding: var(--cm-space-12); }
|
|
163
163
|
.value { font-size: var(--cm-type-heading-lg-resp-size); }
|
|
164
164
|
}
|
|
165
165
|
@media (forced-colors: active) { .change { color: CanvasText; } }
|
|
@@ -83,7 +83,8 @@ export class CmMobileMenu extends CmLocalizedElement {
|
|
|
83
83
|
e.preventDefault();
|
|
84
84
|
this.back();
|
|
85
85
|
} }}>
|
|
86
|
-
<button type="button" class="back" part="back" @click=${() => this.back()}><cm-icon name="arrow-left" size="
|
|
86
|
+
<button type="button" class="back" part="back" @click=${() => this.back()}><cm-icon name="arrow-left" size="16"></cm-icon>
|
|
87
|
+
${page.label}</button>
|
|
87
88
|
<ul class="card" aria-label=${page.label}>${page.items.map((it) => html `<li>${__classPrivateFieldGet(this, _CmMobileMenu_instances, "m", _CmMobileMenu_row).call(this, it, 0, 0, true)}</li>`)}</ul>
|
|
88
89
|
<slot hidden></slot>
|
|
89
90
|
</nav>`;
|
|
@@ -109,7 +110,7 @@ _CmMobileMenu_observer = new WeakMap(), _CmMobileMenu_id = new WeakMap(), _CmMob
|
|
|
109
110
|
e.preventDefault(); };
|
|
110
111
|
if (it.primary && !sub)
|
|
111
112
|
return html `<button type="button" class="row action" part="row" @click=${go}>${it.label}</button>`;
|
|
112
|
-
const icon = it.icon && !sub ? html `<cm-icon class="icon" name=${it.icon} size="
|
|
113
|
+
const icon = it.icon && !sub ? html `<cm-icon class="icon" name=${it.icon} size="20"></cm-icon>` : nothing;
|
|
113
114
|
const badge = it.badge ? html `<span class="badge">${it.badge}</span>` : nothing;
|
|
114
115
|
if (it.items?.length && !sub) {
|
|
115
116
|
return html `<button type="button" class="row" part="row" data-row="${s}-${r}"
|
|
@@ -152,14 +153,14 @@ CmMobileMenu.styles = [
|
|
|
152
153
|
:host { display: block; background: var(--cm-bg-page); }
|
|
153
154
|
nav { padding: var(--cm-space-20); display: flex; flex-direction: column; gap: var(--cm-space-20); }
|
|
154
155
|
.heading {
|
|
155
|
-
margin: 0 0
|
|
156
|
-
color: var(--cm-text-
|
|
156
|
+
margin: 0 0 var(--cm-space-8); font-size: var(--cm-font-size-13); line-height: var(--cm-line-height-13); font-weight: 500;
|
|
157
|
+
color: var(--cm-text-tertiary);
|
|
157
158
|
}
|
|
158
|
-
.card { list-style: none; margin: 0; padding: 0
|
|
159
|
-
.card > li + li { border-top: var(--cm-border-1) solid var(--cm-border-
|
|
159
|
+
.card { list-style: none; margin: 0; padding: 0 var(--cm-space-16); background: var(--cm-bg-surface); border-radius: var(--cm-radius-lg); }
|
|
160
|
+
.card > li + li { border-top: var(--cm-border-1) solid var(--cm-border-subtle); }
|
|
160
161
|
.row {
|
|
161
|
-
display: flex; align-items: center; gap: var(--cm-space-
|
|
162
|
-
font: inherit; font-size:
|
|
162
|
+
display: flex; align-items: center; gap: var(--cm-space-12); width: 100%; min-height: 48px; padding-block: var(--cm-space-8); padding-inline: var(--cm-space-4);
|
|
163
|
+
font: inherit; font-size: var(--cm-font-size-16); line-height: var(--cm-line-height-16); font-weight: 500; color: var(--cm-text-default); text-align: start; text-decoration: none;
|
|
163
164
|
background: none; border: 0; cursor: pointer;
|
|
164
165
|
}
|
|
165
166
|
.row:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: -2px; border-radius: var(--cm-radius-sm); }
|
|
@@ -167,24 +168,24 @@ CmMobileMenu.styles = [
|
|
|
167
168
|
.label { flex: 1; min-width: 0; overflow-wrap: anywhere; }
|
|
168
169
|
.chev { color: var(--cm-icon-selected); }
|
|
169
170
|
.badge {
|
|
170
|
-
flex: none; padding:
|
|
171
|
-
|
|
171
|
+
flex: none; padding: 2px var(--cm-space-8); border-radius: var(--cm-radius-full); font-size: var(--cm-font-size-12); line-height: var(--cm-line-height-12); font-weight: 500;
|
|
172
|
+
font-variant-numeric: tabular-nums; color: var(--cm-text-on-dark); background: var(--cm-nav-badge);
|
|
172
173
|
}
|
|
173
|
-
.action { justify-content: center;
|
|
174
|
-
.eyebrow { display: block; font-size:
|
|
174
|
+
.action { justify-content: center; font-size: var(--cm-font-size-14); line-height: var(--cm-line-height-14); }
|
|
175
|
+
.eyebrow { display: block; font-size: var(--cm-font-size-12); line-height: var(--cm-line-height-12); font-weight: 400; color: var(--cm-text-tertiary); }
|
|
175
176
|
.stack { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; overflow-wrap: anywhere; }
|
|
176
|
-
.email { font-size:
|
|
177
|
+
.email { font-size: var(--cm-font-size-12); line-height: var(--cm-line-height-12); font-weight: 400; color: var(--cm-text-tertiary); }
|
|
177
178
|
.avatar {
|
|
178
179
|
display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 50%; overflow: hidden;
|
|
179
180
|
font-size: 12px; background: var(--cm-avatar-bg); border: var(--cm-border-1) solid var(--cm-border-strong); color: var(--cm-text-default);
|
|
180
181
|
}
|
|
181
182
|
.avatar img { width: 100%; height: 100%; object-fit: cover; }
|
|
182
183
|
.back {
|
|
183
|
-
display: inline-flex; align-items: center; gap:
|
|
184
|
+
display: inline-flex; align-items: center; gap: var(--cm-space-8); align-self: flex-start; min-height: var(--cm-control-height-md); padding: var(--cm-space-4); font: inherit; font-size: var(--cm-font-size-16); font-weight: 500;
|
|
184
185
|
color: var(--cm-text-default); background: none; border: 0; cursor: pointer; border-radius: var(--cm-radius-sm);
|
|
185
186
|
}
|
|
186
187
|
.back:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
187
|
-
.sub .row { font-size:
|
|
188
|
+
.sub .row { font-size: var(--cm-font-size-14); line-height: var(--cm-line-height-14); }
|
|
188
189
|
`,
|
|
189
190
|
];
|
|
190
191
|
define('cm-mobile-menu', CmMobileMenu);
|
package/dist/components/modal.js
CHANGED
|
@@ -53,7 +53,8 @@ CmModal.styles = [
|
|
|
53
53
|
dialog { position: fixed; inset: 0; margin: auto; width: min(var(--cm-modal-width, 620px), calc(100vw - 32px)); }
|
|
54
54
|
:host([size='small']) dialog { --cm-modal-width: 400px; }
|
|
55
55
|
:host([size='large']) dialog { --cm-modal-width: 900px; }
|
|
56
|
-
.panel { max-height: calc(100dvh - 64px); border-radius: var(--cm-radius-
|
|
56
|
+
.panel { max-height: calc(100dvh - 64px); border-radius: var(--cm-radius-lg); box-shadow: var(--cm-shadow-lg); }
|
|
57
|
+
|
|
57
58
|
`,
|
|
58
59
|
];
|
|
59
60
|
define('cm-modal', CmModal);
|
|
@@ -23,7 +23,7 @@ declare module '../localize.js' {
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
|
-
* One row in a `cm-nested-list`: a
|
|
26
|
+
* One row in a `cm-nested-list`: a 48px bordered row with a label and actions (toggle, edit, delete).
|
|
27
27
|
* Put more `cm-nested-item`s inside it to nest them; each level is indented.
|
|
28
28
|
* @element cm-nested-item
|
|
29
29
|
* @slot - Child `cm-nested-item`s.
|
|
@@ -77,7 +77,7 @@ export declare class CmNestedItem extends CmLocalizedElement {
|
|
|
77
77
|
}
|
|
78
78
|
/**
|
|
79
79
|
* A titled group of rows that nest inside each other, such as a navigation menu with links and
|
|
80
|
-
* sub-links, or categories and sub-categories. The heading sits in a
|
|
80
|
+
* sub-links, or categories and sub-categories. The heading sits in a 64px grey bar with its own
|
|
81
81
|
* actions; rows below are indented one step per level. With `sortable`, each row gets a drag
|
|
82
82
|
* handle that also works from the keyboard (↑/↓, Home/End). With `collapsible`, the bar gets a
|
|
83
83
|
* round button that shows and hides the rows. Give sortable lists the same `group` to let top-level rows move
|
|
@@ -31,7 +31,7 @@ const listStrings = defineStrings('nestedList', {
|
|
|
31
31
|
hide: 'Hide {heading}',
|
|
32
32
|
});
|
|
33
33
|
/**
|
|
34
|
-
* One row in a `cm-nested-list`: a
|
|
34
|
+
* One row in a `cm-nested-list`: a 48px bordered row with a label and actions (toggle, edit, delete).
|
|
35
35
|
* Put more `cm-nested-item`s inside it to nest them; each level is indented.
|
|
36
36
|
* @element cm-nested-item
|
|
37
37
|
* @slot - Child `cm-nested-item`s.
|
|
@@ -116,7 +116,7 @@ export class CmNestedItem extends CmLocalizedElement {
|
|
|
116
116
|
? html `<button class="handle" type="button" part="handle" draggable="true" aria-label=${this.t('reorder', { label: this.label })}
|
|
117
117
|
aria-describedby="hint"
|
|
118
118
|
@keydown=${__classPrivateFieldGet(this, _CmNestedItem_instances, "m", _CmNestedItem_onHandleKey)} @dragstart=${__classPrivateFieldGet(this, _CmNestedItem_instances, "m", _CmNestedItem_onDragStart)} @pointerdown=${__classPrivateFieldGet(this, _CmNestedItem_instances, "m", _CmNestedItem_onPointerDown)}
|
|
119
|
-
@dragend=${() => { this.classList.remove('dragging'); _a.dragged = null; markDrop(this, null); }}><cm-icon name="drag" size="
|
|
119
|
+
@dragend=${() => { this.classList.remove('dragging'); _a.dragged = null; markDrop(this, null); }}><cm-icon name="drag" size="16"></cm-icon></button>`
|
|
120
120
|
: nothing}
|
|
121
121
|
${this.sortable ? html `<span class="sr" id="hint">${this.t(this.list?.group ? 'hintGroup' : 'hint')}</span>` : nothing}
|
|
122
122
|
<span class="label" part="label">${this.label}</span>
|
|
@@ -275,28 +275,28 @@ CmNestedItem.styles = [
|
|
|
275
275
|
css `
|
|
276
276
|
:host { display: block; }
|
|
277
277
|
.row {
|
|
278
|
-
display: flex; align-items: center; gap: var(--cm-space-
|
|
279
|
-
background: var(--cm-bg-surface); border: var(--cm-border-1) solid var(--cm-border-
|
|
280
|
-
font-size:
|
|
278
|
+
display: flex; align-items: center; gap: var(--cm-space-12); min-height: 48px; padding: 0 var(--cm-space-16);
|
|
279
|
+
background: var(--cm-bg-surface); border: var(--cm-border-1) solid var(--cm-border-subtle); border-radius: var(--cm-radius-md);
|
|
280
|
+
font-size: var(--cm-font-size-14); line-height: var(--cm-line-height-14); font-weight: 500;
|
|
281
281
|
}
|
|
282
282
|
:host(.dragging) .row { opacity: 0.5; }
|
|
283
283
|
:host(.drop-before) .row { box-shadow: 0 -3px 0 var(--cm-border-strong); }
|
|
284
284
|
:host(.drop-after) .row { box-shadow: 0 3px 0 var(--cm-border-strong); }
|
|
285
285
|
.label { flex: 1; min-width: 0; overflow-wrap: anywhere; }
|
|
286
|
-
.actions { display: flex; align-items: center; gap: var(--cm-space-
|
|
286
|
+
.actions { display: flex; align-items: center; gap: var(--cm-space-12); }
|
|
287
287
|
.handle {
|
|
288
|
-
display: inline-flex; align-items: center; justify-content: center; width: 24px; height:
|
|
288
|
+
display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 32px; margin-inline-start: -4px; padding: 0;
|
|
289
289
|
color: var(--cm-icon-selected); background: none; border: 0; border-radius: var(--cm-radius-xs); cursor: grab;
|
|
290
290
|
}
|
|
291
291
|
.handle:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
292
292
|
/* Touch: a drag that starts on the handle moves the row instead of scrolling the page. */
|
|
293
293
|
.handle { touch-action: none; }
|
|
294
294
|
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
|
|
295
|
-
.children { margin-block: var(--cm-space-
|
|
295
|
+
.children { margin-block: var(--cm-space-8) 0; margin-inline: var(--cm-space-48) 0; display: flex; flex-direction: column; gap: var(--cm-space-8); }
|
|
296
296
|
.children:not(.has) { display: none; }
|
|
297
297
|
@media (max-width: 640px) {
|
|
298
|
-
.row {
|
|
299
|
-
.actions { gap: var(--cm-space-
|
|
298
|
+
.row { padding: 0 var(--cm-space-8); gap: var(--cm-space-8); }
|
|
299
|
+
.actions { gap: var(--cm-space-8); }
|
|
300
300
|
.children { margin-inline-start: var(--cm-space-20); }
|
|
301
301
|
}
|
|
302
302
|
`,
|
|
@@ -329,7 +329,7 @@ function markDrop(dragged, target) {
|
|
|
329
329
|
}
|
|
330
330
|
/**
|
|
331
331
|
* A titled group of rows that nest inside each other, such as a navigation menu with links and
|
|
332
|
-
* sub-links, or categories and sub-categories. The heading sits in a
|
|
332
|
+
* sub-links, or categories and sub-categories. The heading sits in a 64px grey bar with its own
|
|
333
333
|
* actions; rows below are indented one step per level. With `sortable`, each row gets a drag
|
|
334
334
|
* handle that also works from the keyboard (↑/↓, Home/End). With `collapsible`, the bar gets a
|
|
335
335
|
* round button that shows and hides the rows. Give sortable lists the same `group` to let top-level rows move
|
|
@@ -394,7 +394,7 @@ export class CmNestedList extends CmLocalizedElement {
|
|
|
394
394
|
${this.collapsible
|
|
395
395
|
? html `<button class="toggle" type="button" part="toggle" aria-expanded=${shown ? 'true' : 'false'} aria-controls="${__classPrivateFieldGet(this, _CmNestedList_id, "f")}-rows"
|
|
396
396
|
aria-label=${this.t(shown ? 'hide' : 'show', { heading: this.heading })} @click=${__classPrivateFieldGet(this, _CmNestedList_instances, "m", _CmNestedList_toggle)}>
|
|
397
|
-
<cm-icon name=${shown ? 'chevron-up' : 'chevron-down'} size="
|
|
397
|
+
<cm-icon name=${shown ? 'chevron-up' : 'chevron-down'} size="16"></cm-icon></button>`
|
|
398
398
|
: nothing}
|
|
399
399
|
</div>
|
|
400
400
|
<div class="rows ${this.group && this._empty ? 'empty' : ''}" id="${__classPrivateFieldGet(this, _CmNestedList_id, "f")}-rows" role="list" aria-labelledby="${__classPrivateFieldGet(this, _CmNestedList_id, "f")}-h" ?hidden=${!shown}
|
|
@@ -444,27 +444,26 @@ CmNestedList.styles = [
|
|
|
444
444
|
css `
|
|
445
445
|
:host { display: block; }
|
|
446
446
|
.bar {
|
|
447
|
-
display: flex; align-items: center; gap: var(--cm-space-
|
|
447
|
+
display: flex; align-items: center; gap: var(--cm-space-12); min-height: 64px; padding: 0 var(--cm-space-20);
|
|
448
448
|
background: var(--cm-bg-page); border-radius: var(--cm-radius-md);
|
|
449
449
|
}
|
|
450
|
-
.title { flex: 1; min-width: 0; margin: 0; font-size:
|
|
451
|
-
.actions { display: flex; align-items: center; gap: var(--cm-space-
|
|
450
|
+
.title { flex: 1; min-width: 0; margin: 0; font-size: var(--cm-type-heading-md-size); line-height: var(--cm-type-heading-md-line-height); font-weight: 600; }
|
|
451
|
+
.actions { display: flex; align-items: center; gap: var(--cm-space-12); }
|
|
452
452
|
.toggle {
|
|
453
|
-
display: inline-flex; align-items: center; justify-content: center; width:
|
|
453
|
+
display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0; flex: none;
|
|
454
454
|
color: var(--cm-action-primary-text); background: var(--cm-action-primary); border: 0; border-radius: var(--cm-radius-full); cursor: pointer;
|
|
455
455
|
}
|
|
456
456
|
.toggle:hover { background: var(--cm-action-primary-hover); }
|
|
457
457
|
.toggle:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
458
|
-
.rows { display: flex; flex-direction: column; gap: var(--cm-space-
|
|
458
|
+
.rows { display: flex; flex-direction: column; gap: var(--cm-space-8); margin-block: var(--cm-space-8) 0; margin-inline: var(--cm-space-48) 0; }
|
|
459
459
|
.rows[hidden] { display: none; }
|
|
460
|
-
.rows.empty { min-height:
|
|
460
|
+
.rows.empty { min-height: 48px; border: var(--cm-border-1) dashed var(--cm-border-subtle); border-radius: var(--cm-radius-md); }
|
|
461
461
|
:host(.drop-target) .rows.empty { border: 2px solid var(--cm-border-strong); }
|
|
462
462
|
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
|
|
463
463
|
@media (max-width: 640px) {
|
|
464
|
-
.bar { min-height:
|
|
465
|
-
.title { font-size:
|
|
466
|
-
.rows { margin-inline-start: var(--cm-space-
|
|
467
|
-
.toggle { width: 30px; height: 30px; }
|
|
464
|
+
.bar { min-height: 56px; padding: 0 var(--cm-space-8); gap: var(--cm-space-8); }
|
|
465
|
+
.title { font-size: var(--cm-type-heading-sm-size); line-height: var(--cm-type-heading-sm-line-height); }
|
|
466
|
+
.rows { margin-inline-start: var(--cm-space-8); }
|
|
468
467
|
}
|
|
469
468
|
`,
|
|
470
469
|
];
|
|
@@ -190,17 +190,17 @@ CmNotificationPanel.styles = [
|
|
|
190
190
|
position: fixed; inset-block: var(--cm-notification-panel-top, 64px) auto; inset-inline: auto var(--cm-notification-panel-end, 20px);
|
|
191
191
|
width: min(380px, calc(100vw - 32px));
|
|
192
192
|
}
|
|
193
|
-
.panel { max-height: calc(100dvh - var(--cm-notification-panel-top, 64px) - 16px); border-radius: var(--cm-radius-
|
|
193
|
+
.panel { max-height: calc(100dvh - var(--cm-notification-panel-top, 64px) - 16px); border-radius: var(--cm-radius-md); box-shadow: var(--cm-shadow-md); }
|
|
194
194
|
.list { flex: 1 1 auto; min-height: 0; overflow: auto; margin: 0; padding: 0; list-style: none; }
|
|
195
195
|
.list li:nth-child(even) .row { background: var(--cm-bg-hover); }
|
|
196
196
|
.row {
|
|
197
|
-
display: flex; align-items: center; gap: var(--cm-space-
|
|
198
|
-
font: inherit; font-size:
|
|
197
|
+
display: flex; align-items: center; gap: var(--cm-space-8); width: 100%; min-height: 40px; padding: var(--cm-space-8) var(--cm-space-12);
|
|
198
|
+
font: inherit; font-size: var(--cm-font-size-13); line-height: var(--cm-line-height-13); color: var(--cm-text-default); text-align: start; text-decoration: none;
|
|
199
199
|
background: var(--cm-bg-surface); border: 0; cursor: pointer;
|
|
200
200
|
}
|
|
201
201
|
.row:hover { text-decoration: underline; }
|
|
202
202
|
.row:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: -2px; }
|
|
203
|
-
.ic { display: grid; place-items: center; flex: none; width:
|
|
203
|
+
.ic { display: grid; place-items: center; flex: none; width: 24px; height: 24px; border-radius: var(--cm-radius-sm); }
|
|
204
204
|
.information { background: var(--cm-bg-information-soft); color: var(--cm-text-information); }
|
|
205
205
|
.attention { background: var(--cm-bg-attention); color: var(--cm-text-attention); }
|
|
206
206
|
.success { background: var(--cm-bg-success-soft); color: var(--cm-text-success); }
|
|
@@ -211,23 +211,24 @@ CmNotificationPanel.styles = [
|
|
|
211
211
|
.row:has(.desc) { align-items: flex-start; }
|
|
212
212
|
.row:has(.desc) .ic, .row:has(.desc) time { margin-block-start: 1px; }
|
|
213
213
|
.mark {
|
|
214
|
-
flex: none; padding:
|
|
214
|
+
flex: none; padding: var(--cm-space-4) var(--cm-space-8); border: 0; border-radius: var(--cm-radius-sm); background: none; color: inherit;
|
|
215
215
|
font: inherit; font-size: 12px; line-height: 16px; text-decoration: underline; cursor: pointer;
|
|
216
216
|
}
|
|
217
217
|
.mark:hover { text-decoration-thickness: 2px; }
|
|
218
218
|
.mark:focus-visible { outline: 2px solid var(--cm-text-on-dark); outline-offset: 0; }
|
|
219
219
|
.loading { flex: 1 1 auto; min-height: 0; margin: 0; padding: 0; list-style: none; }
|
|
220
|
-
.loading li { display: flex; align-items: center; gap: var(--cm-space-
|
|
220
|
+
.loading li { display: flex; align-items: center; gap: var(--cm-space-8); min-height: 40px; padding: var(--cm-space-8) var(--cm-space-12); }
|
|
221
221
|
.loading li:nth-child(even) { background: var(--cm-bg-hover); }
|
|
222
|
-
.loading .sk-ic { flex: none; width:
|
|
222
|
+
.loading .sk-ic { flex: none; width: 24px; }
|
|
223
223
|
.loading .sk-text { flex: 1; }
|
|
224
|
-
.footer { flex: none; padding: var(--cm-space-
|
|
224
|
+
.footer { flex: none; padding: var(--cm-space-8) var(--cm-space-12); font-size: 13px; border-top: var(--cm-border-1) solid var(--cm-border-subtle); }
|
|
225
225
|
.footer[hidden] { display: none; }
|
|
226
|
-
time { flex: none; font-size:
|
|
226
|
+
time { flex: none; font-size: var(--cm-font-size-12); line-height: var(--cm-line-height-12); color: var(--cm-text-tertiary); font-variant-numeric: tabular-nums; }
|
|
227
227
|
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
|
|
228
228
|
.more {
|
|
229
|
-
display: block; flex: none; padding:
|
|
230
|
-
|
|
229
|
+
display: block; flex: none; padding: var(--cm-space-12); font-size: var(--cm-font-size-13); line-height: var(--cm-line-height-13); text-align: center;
|
|
230
|
+
color: var(--cm-text-default);
|
|
231
|
+
border-top: var(--cm-border-1) solid var(--cm-border-subtle);
|
|
231
232
|
}
|
|
232
233
|
.more:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: -2px; }
|
|
233
234
|
.empty { margin: 0; padding: var(--cm-space-20); font-size: 13px; text-align: center; color: var(--cm-text-tertiary); }
|
|
@@ -161,18 +161,21 @@ CmOptionGroup.styles = [
|
|
|
161
161
|
base,
|
|
162
162
|
css `
|
|
163
163
|
:host { display: block; }
|
|
164
|
-
.label {
|
|
164
|
+
.label {
|
|
165
|
+
display: block; margin-bottom: var(--cm-space-8);
|
|
166
|
+
font-size: var(--cm-type-label-size); line-height: var(--cm-type-label-line-height); font-weight: var(--cm-type-label-weight);
|
|
167
|
+
}
|
|
165
168
|
.req { color: var(--cm-text-critical); margin-inline-start: 2px; }
|
|
166
|
-
.options { display: flex; flex-wrap: wrap; gap: var(--cm-space-
|
|
169
|
+
.options { display: flex; flex-wrap: wrap; gap: var(--cm-space-8); }
|
|
167
170
|
button {
|
|
168
|
-
height:
|
|
169
|
-
color: var(--cm-text-default); background: var(--cm-bg-
|
|
171
|
+
height: var(--cm-control-height-md, 36px); padding: 0 var(--cm-space-16); font: inherit; font-size: var(--cm-font-size-14); font-weight: 500; white-space: nowrap;
|
|
172
|
+
color: var(--cm-text-default); background: var(--cm-bg-surface); cursor: pointer;
|
|
170
173
|
border: var(--cm-border-1) solid var(--cm-border-input); border-radius: var(--cm-radius-sm);
|
|
171
174
|
}
|
|
172
|
-
button:hover {
|
|
175
|
+
button:hover { background: var(--cm-bg-hover); }
|
|
173
176
|
button[aria-checked='true'] { background: var(--cm-action-primary); color: var(--cm-action-primary-text); border-color: var(--cm-action-primary); }
|
|
174
177
|
button:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
175
|
-
button:disabled { background: var(--cm-bg-input-filled); color: var(--cm-text-secondary); border-color: var(--cm-border-
|
|
178
|
+
button:disabled { background: var(--cm-bg-input-filled); color: var(--cm-text-secondary); border-color: var(--cm-border-subtle); cursor: not-allowed; }
|
|
176
179
|
button[aria-checked='true']:disabled { background: var(--cm-action-disabled); color: var(--cm-action-disabled-text); }
|
|
177
180
|
/* Tones (1.3), the same token pairs as cm-button's tones (packages/tokens/scripts/contrast.mjs). Unselected: tone
|
|
178
181
|
text and outline on bg-surface (text-critical on bg-hover is under 4.5:1 in dark), hover tints it. Selected:
|
|
@@ -187,11 +190,7 @@ CmOptionGroup.styles = [
|
|
|
187
190
|
background: color-mix(in srgb, var(--_tone) 80%, var(--cm-text-default)); border-color: color-mix(in srgb, var(--_tone) 80%, var(--cm-text-default));
|
|
188
191
|
}
|
|
189
192
|
slot { display: none; }
|
|
190
|
-
@media (
|
|
191
|
-
.label { font-size: var(--cm-type-heading-sm-resp-size); }
|
|
192
|
-
.options { gap: var(--cm-space-10); }
|
|
193
|
-
button { height: 42px; padding: 0 var(--cm-space-15); font-size: 14px; }
|
|
194
|
-
}
|
|
193
|
+
@media (pointer: coarse) { button { min-height: var(--cm-control-height-touch, 44px); } }
|
|
195
194
|
`,
|
|
196
195
|
];
|
|
197
196
|
define('cm-option-group', CmOptionGroup);
|
|
@@ -91,13 +91,13 @@ CmPageHeader.styles = [
|
|
|
91
91
|
css `
|
|
92
92
|
:host { display: block; }
|
|
93
93
|
header {
|
|
94
|
-
display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--cm-space-20);
|
|
95
|
-
min-height:
|
|
96
|
-
background: var(--cm-bg-surface); border-bottom: var(--cm-border-1) solid var(--cm-border-
|
|
94
|
+
display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--cm-space-12) var(--cm-space-20);
|
|
95
|
+
min-height: 64px; padding: var(--cm-space-12) var(--cm-space-24);
|
|
96
|
+
background: var(--cm-bg-surface); border-bottom: var(--cm-border-1) solid var(--cm-border-subtle);
|
|
97
97
|
}
|
|
98
|
-
.lead { flex: 1 1 280px; display: flex; align-items: center; gap: var(--cm-space-
|
|
99
|
-
.titles { min-width: 0; display: flex; flex-direction: column; gap:
|
|
100
|
-
nav ol { display: flex; flex-wrap: wrap; margin: 0; padding: 0; list-style: none; font-size:
|
|
98
|
+
.lead { flex: 1 1 280px; display: flex; align-items: center; gap: var(--cm-space-8); min-width: 0; }
|
|
99
|
+
.titles { min-width: 0; display: flex; flex-direction: column; gap: var(--cm-space-4); }
|
|
100
|
+
nav ol { display: flex; flex-wrap: wrap; margin: 0; padding: 0; list-style: none; font-size: var(--cm-type-body-sm-size); line-height: var(--cm-type-body-sm-line-height); color: var(--cm-text-tertiary); }
|
|
101
101
|
nav li { white-space: nowrap; }
|
|
102
102
|
nav li + li::before { content: '/'; padding: 0 0.35em; }
|
|
103
103
|
nav a { color: inherit; text-decoration: none; border-radius: var(--cm-radius-xs); }
|
|
@@ -105,30 +105,31 @@ CmPageHeader.styles = [
|
|
|
105
105
|
nav a:focus-visible, .back:focus-visible, .arrow:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
106
106
|
nav [aria-current] { color: var(--cm-text-default); }
|
|
107
107
|
h1 {
|
|
108
|
-
display: flex; flex-wrap: wrap; align-items: center; gap:
|
|
109
|
-
font-size:
|
|
108
|
+
display: flex; flex-wrap: wrap; align-items: center; gap: var(--cm-space-4) var(--cm-space-8); margin: 0; min-width: 0;
|
|
109
|
+
font-size: var(--cm-type-heading-lg-size); font-weight: var(--cm-type-heading-lg-weight); line-height: var(--cm-type-heading-lg-line-height);
|
|
110
110
|
}
|
|
111
111
|
/* The title keeps at least about 12 characters; badges in title-adornment wrap below it instead of pushing the page wider. */
|
|
112
112
|
.text { flex: 0 1 auto; min-width: min(12ch, 100%); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
113
|
-
.actions { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: var(--cm-space-
|
|
114
|
-
.arrows { display: flex; gap: var(--cm-space-
|
|
113
|
+
.actions { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: var(--cm-space-8); margin-inline-start: auto; }
|
|
114
|
+
.arrows { display: flex; gap: var(--cm-space-8); }
|
|
115
115
|
.arrow, .back {
|
|
116
|
-
display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0;
|
|
116
|
+
display: inline-flex; align-items: center; justify-content: center; width: var(--cm-control-height-sm, 32px); height: var(--cm-control-height-sm, 32px); padding: 0;
|
|
117
117
|
border: var(--cm-border-1) solid var(--cm-border-input); border-radius: var(--cm-radius-sm);
|
|
118
118
|
background: var(--cm-bg-surface); color: var(--cm-icon-selected); cursor: pointer;
|
|
119
119
|
}
|
|
120
120
|
.arrow:hover:not(:disabled), .back:hover { background: var(--cm-bg-hover); }
|
|
121
|
-
.arrow:disabled { color: var(--cm-text-secondary); border-color: var(--cm-border-
|
|
121
|
+
.arrow:disabled { color: var(--cm-text-secondary); border-color: var(--cm-border-subtle); cursor: not-allowed; }
|
|
122
122
|
.back { display: none; border: 0; flex: none; text-decoration: none; }
|
|
123
|
+
@media (pointer: coarse) { .arrow, .back { width: var(--cm-control-height-touch, 44px); height: var(--cm-control-height-touch, 44px); } }
|
|
123
124
|
@media (max-width: 640px) {
|
|
124
125
|
/* Title and actions share one row while they fit; otherwise the actions wrap below, so nothing spills sideways. */
|
|
125
|
-
header { min-height:
|
|
126
|
+
header { min-height: 48px; padding: var(--cm-space-8) var(--cm-space-16); gap: var(--cm-space-8); }
|
|
126
127
|
.lead { flex: 1 1 160px; }
|
|
127
128
|
.actions { flex: 0 1 auto; min-width: 0; max-width: 100%; justify-content: flex-end; }
|
|
128
129
|
nav { display: none; }
|
|
129
130
|
.back { display: inline-flex; }
|
|
130
|
-
h1 { font-size:
|
|
131
|
-
.actions { gap: var(--cm-space-
|
|
131
|
+
h1 { font-size: var(--cm-type-heading-lg-resp-size); line-height: var(--cm-type-heading-lg-resp-line-height); }
|
|
132
|
+
.actions { gap: var(--cm-space-8); }
|
|
132
133
|
}
|
|
133
134
|
`,
|
|
134
135
|
];
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { LitElement } from 'lit';
|
|
2
2
|
/**
|
|
3
|
-
* A whole admin page: the page header across the top, then the content
|
|
4
|
-
*
|
|
3
|
+
* A whole admin page: the page header across the top, then the content with the page padding (`space-24`, or
|
|
4
|
+
* `space-16` when the page is 640px wide or less; the same side padding as `cm-page-header`, so titles and content
|
|
5
|
+
* line up), centred at a width that suits the page.
|
|
5
6
|
* `<cm-page><cm-page-header slot="header" heading="Orders"></cm-page-header><cm-layout>…</cm-layout></cm-page>`
|
|
7
|
+
*
|
|
8
|
+
* Page anatomy: the header (title, primary action at the end), then a filter or toolbar row, then the content.
|
|
9
|
+
* Pick the width by what the page holds: `form` (640px) for settings and single-column forms, `detail` (1040px) for
|
|
10
|
+
* one record (an order, a customer), the default (1600px) for lists and dashboards, `full` for wide tables and reports.
|
|
11
|
+
* The background is `bg-page`; inside `cm-app-frame panel` it is transparent, so the page sits on the white panel.
|
|
6
12
|
* @element cm-page
|
|
7
13
|
* @slot header - A `cm-page-header`. Runs edge to edge.
|
|
8
14
|
* @slot - The page content, usually a `cm-layout`.
|
|
@@ -10,6 +16,9 @@ import { LitElement } from 'lit';
|
|
|
10
16
|
*/
|
|
11
17
|
export declare class CmPage extends LitElement {
|
|
12
18
|
static properties: {
|
|
19
|
+
width: {
|
|
20
|
+
reflect: boolean;
|
|
21
|
+
};
|
|
13
22
|
fullWidth: {
|
|
14
23
|
type: BooleanConstructor;
|
|
15
24
|
attribute: string;
|
|
@@ -20,9 +29,14 @@ export declare class CmPage extends LitElement {
|
|
|
20
29
|
reflect: boolean;
|
|
21
30
|
};
|
|
22
31
|
};
|
|
23
|
-
/**
|
|
32
|
+
/**
|
|
33
|
+
* Largest width of the content, centred: `form` (640px), `detail` (1040px), `wide` (1600px) or `full` (no limit).
|
|
34
|
+
* Empty is `wide`, unless `narrow` or `full-width` is set.
|
|
35
|
+
*/
|
|
36
|
+
width: '' | 'form' | 'detail' | 'wide' | 'full';
|
|
37
|
+
/** Same as `width="full"`: the content uses every pixel of width (wide tables, reports). */
|
|
24
38
|
fullWidth: boolean;
|
|
25
|
-
/** Content at most 800px wide, centred
|
|
39
|
+
/** Content at most 800px wide, centred. Kept from 1.0; prefer `width="form"` (640px) or `width="detail"` (1040px). */
|
|
26
40
|
narrow: boolean;
|
|
27
41
|
static styles: import("lit").CSSResult[];
|
|
28
42
|
render(): import("lit-html").TemplateResult<1>;
|
package/dist/components/page.js
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { LitElement, html, css } from 'lit';
|
|
2
2
|
import { base, define } from '../base.js';
|
|
3
3
|
/**
|
|
4
|
-
* A whole admin page: the page header across the top, then the content
|
|
5
|
-
*
|
|
4
|
+
* A whole admin page: the page header across the top, then the content with the page padding (`space-24`, or
|
|
5
|
+
* `space-16` when the page is 640px wide or less; the same side padding as `cm-page-header`, so titles and content
|
|
6
|
+
* line up), centred at a width that suits the page.
|
|
6
7
|
* `<cm-page><cm-page-header slot="header" heading="Orders"></cm-page-header><cm-layout>…</cm-layout></cm-page>`
|
|
8
|
+
*
|
|
9
|
+
* Page anatomy: the header (title, primary action at the end), then a filter or toolbar row, then the content.
|
|
10
|
+
* Pick the width by what the page holds: `form` (640px) for settings and single-column forms, `detail` (1040px) for
|
|
11
|
+
* one record (an order, a customer), the default (1600px) for lists and dashboards, `full` for wide tables and reports.
|
|
12
|
+
* The background is `bg-page`; inside `cm-app-frame panel` it is transparent, so the page sits on the white panel.
|
|
7
13
|
* @element cm-page
|
|
8
14
|
* @slot header - A `cm-page-header`. Runs edge to edge.
|
|
9
15
|
* @slot - The page content, usually a `cm-layout`.
|
|
@@ -12,9 +18,14 @@ import { base, define } from '../base.js';
|
|
|
12
18
|
export class CmPage extends LitElement {
|
|
13
19
|
constructor() {
|
|
14
20
|
super(...arguments);
|
|
15
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* Largest width of the content, centred: `form` (640px), `detail` (1040px), `wide` (1600px) or `full` (no limit).
|
|
23
|
+
* Empty is `wide`, unless `narrow` or `full-width` is set.
|
|
24
|
+
*/
|
|
25
|
+
this.width = '';
|
|
26
|
+
/** Same as `width="full"`: the content uses every pixel of width (wide tables, reports). */
|
|
16
27
|
this.fullWidth = false;
|
|
17
|
-
/** Content at most 800px wide, centred
|
|
28
|
+
/** Content at most 800px wide, centred. Kept from 1.0; prefer `width="form"` (640px) or `width="detail"` (1040px). */
|
|
18
29
|
this.narrow = false;
|
|
19
30
|
}
|
|
20
31
|
render() {
|
|
@@ -22,6 +33,7 @@ export class CmPage extends LitElement {
|
|
|
22
33
|
}
|
|
23
34
|
}
|
|
24
35
|
CmPage.properties = {
|
|
36
|
+
width: { reflect: true },
|
|
25
37
|
fullWidth: { type: Boolean, attribute: 'full-width', reflect: true },
|
|
26
38
|
narrow: { type: Boolean, reflect: true },
|
|
27
39
|
};
|
|
@@ -31,11 +43,14 @@ CmPage.styles = [
|
|
|
31
43
|
:host { display: block; container: cm-page / inline-size; background: var(--cm-bg-page); min-block-size: 100%; }
|
|
32
44
|
.content {
|
|
33
45
|
box-sizing: content-box; max-inline-size: 1600px; margin-inline: auto;
|
|
34
|
-
padding: var(--cm-space-
|
|
46
|
+
padding: var(--cm-space-24);
|
|
35
47
|
}
|
|
36
48
|
:host([narrow]) .content { max-inline-size: 800px; }
|
|
37
|
-
:host([full-width]) .content { max-inline-size: none; }
|
|
38
|
-
|
|
49
|
+
:host([full-width]) .content, :host([width='full']) .content { max-inline-size: none; }
|
|
50
|
+
:host([width='form']) .content { max-inline-size: 640px; }
|
|
51
|
+
:host([width='detail']) .content { max-inline-size: 1040px; }
|
|
52
|
+
:host([width='wide']) .content { max-inline-size: 1600px; }
|
|
53
|
+
@container cm-page (max-width: 640px) { .content { padding: var(--cm-space-16); } }
|
|
39
54
|
`,
|
|
40
55
|
];
|
|
41
56
|
define('cm-page', CmPage);
|
|
@@ -21,7 +21,7 @@ declare module '../localize.js' {
|
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
|
-
* Moves through a long list one page at a time. A
|
|
24
|
+
* Moves through a long list one page at a time. A 52px bar under a list or table: rows per page on
|
|
25
25
|
* the left, "Showing 21–40 of 290" in the middle, and "Page [n] of N" with previous/next arrows on
|
|
26
26
|
* the right. On phones only the page field and arrows remain.
|
|
27
27
|
*
|