@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
|
@@ -24,7 +24,7 @@ const strings = defineStrings('pagination', {
|
|
|
24
24
|
next: 'Next page',
|
|
25
25
|
});
|
|
26
26
|
/**
|
|
27
|
-
* Moves through a long list one page at a time. A
|
|
27
|
+
* Moves through a long list one page at a time. A 52px bar under a list or table: rows per page on
|
|
28
28
|
* the left, "Showing 21–40 of 290" in the middle, and "Page [n] of N" with previous/next arrows on
|
|
29
29
|
* the right. On phones only the page field and arrows remain.
|
|
30
30
|
*
|
|
@@ -136,22 +136,23 @@ CmPagination.styles = [
|
|
|
136
136
|
css `
|
|
137
137
|
:host { display: block; }
|
|
138
138
|
nav {
|
|
139
|
-
display: flex; align-items: center; gap: var(--cm-space-20); min-height:
|
|
140
|
-
background: var(--cm-bg-surface); border-radius: var(--cm-radius-md); font-size:
|
|
139
|
+
display: flex; align-items: center; gap: var(--cm-space-20); min-height: 52px; padding: 0 var(--cm-space-16);
|
|
140
|
+
background: var(--cm-bg-surface); border-radius: var(--cm-radius-md); font-size: var(--cm-font-size-14); line-height: var(--cm-line-height-14);
|
|
141
|
+
font-variant-numeric: tabular-nums;
|
|
141
142
|
}
|
|
142
|
-
.rows, .pages, .counter { display: flex; align-items: center; gap: var(--cm-space-
|
|
143
|
+
.rows, .pages, .counter { display: flex; align-items: center; gap: var(--cm-space-8); white-space: nowrap; }
|
|
143
144
|
.summary { flex: 1; text-align: center; white-space: nowrap; }
|
|
144
145
|
.field { position: relative; display: inline-flex; }
|
|
145
146
|
select, input {
|
|
146
|
-
height:
|
|
147
|
+
height: var(--cm-control-height-sm); font: inherit; font-weight: 500; color: var(--cm-text-default); background: var(--cm-bg-surface);
|
|
147
148
|
border: var(--cm-border-1) solid var(--cm-border-input); border-radius: var(--cm-radius-sm);
|
|
148
149
|
}
|
|
149
|
-
select { appearance: none; padding-block: 0; padding-inline:
|
|
150
|
+
select { appearance: none; padding-block: 0; padding-inline: var(--cm-space-8) var(--cm-space-24); min-width: 56px; cursor: pointer; }
|
|
150
151
|
.field cm-icon { position: absolute; inset-inline-end: 8px; top: 50%; transform: translateY(-50%); pointer-events: none; }
|
|
151
|
-
input { width:
|
|
152
|
+
input { width: 40px; padding: 0; text-align: center; -moz-appearance: textfield; }
|
|
152
153
|
input::-webkit-inner-spin-button, input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
|
|
153
154
|
select:focus-visible, input:focus-visible, button:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
154
|
-
.arrows { display: flex; gap: var(--cm-space-
|
|
155
|
+
.arrows { display: flex; gap: var(--cm-space-8); margin-inline-start: var(--cm-space-8); }
|
|
155
156
|
button {
|
|
156
157
|
width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; padding: 0; cursor: pointer;
|
|
157
158
|
color: var(--cm-icon-selected); background: var(--cm-bg-hover);
|
|
@@ -160,8 +161,14 @@ CmPagination.styles = [
|
|
|
160
161
|
button:hover:not(:disabled) { border-color: var(--cm-border-strong); }
|
|
161
162
|
button:disabled { color: var(--cm-text-secondary); cursor: not-allowed; }
|
|
162
163
|
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
|
|
164
|
+
@media (pointer: coarse) {
|
|
165
|
+
select, input { height: var(--cm-control-height-touch); }
|
|
166
|
+
button { width: var(--cm-control-height-touch); height: var(--cm-control-height-touch); }
|
|
167
|
+
}
|
|
163
168
|
@media (max-width: 640px) {
|
|
164
|
-
nav { min-height:
|
|
169
|
+
nav { min-height: 48px;
|
|
170
|
+
padding: 0 var(--cm-space-8); justify-content: space-between; }
|
|
171
|
+
|
|
165
172
|
.rows, .summary { display: none; }
|
|
166
173
|
.pages { flex: 1; justify-content: space-between; }
|
|
167
174
|
.arrows { display: contents; }
|
|
@@ -66,15 +66,16 @@ CmProgressBar.styles = [
|
|
|
66
66
|
base,
|
|
67
67
|
css `
|
|
68
68
|
:host { display: block; }
|
|
69
|
-
.head { display: flex; justify-content: space-between; gap: var(--cm-space-
|
|
69
|
+
.head { display: flex; justify-content: space-between; gap: var(--cm-space-8); margin-block-end: var(--cm-space-8); font-size: var(--cm-font-size-14); line-height: var(--cm-line-height-14); }
|
|
70
70
|
.value { color: var(--cm-text-tertiary); font-variant-numeric: tabular-nums; }
|
|
71
71
|
.vh {
|
|
72
72
|
position: absolute; inline-size: 1px; block-size: 1px; margin: -1px; padding: 0; overflow: hidden;
|
|
73
73
|
clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
|
|
74
74
|
}
|
|
75
|
-
.track { position: relative; block-size: 8px; border-radius: var(--cm-radius-full); background: var(--cm-bg-inset); overflow: hidden; box-shadow: inset 0 0 0 1px var(--cm-border-
|
|
75
|
+
.track { position: relative; block-size: 8px; border-radius: var(--cm-radius-full); background: var(--cm-bg-inset); overflow: hidden; box-shadow: inset 0 0 0 1px var(--cm-border-subtle); }
|
|
76
76
|
:host([size='small']) .track { block-size: 4px; }
|
|
77
|
-
.fill { position: absolute; inset-block: 0; inset-inline-start: 0; border-radius: inherit; background: var(--cm-action-primary); transition: inline-size
|
|
77
|
+
.fill { position: absolute; inset-block: 0; inset-inline-start: 0; border-radius: inherit; background: var(--cm-action-primary); transition: inline-size var(--cm-duration-base) var(--cm-easing-standard); }
|
|
78
|
+
|
|
78
79
|
.indeterminate .fill { inline-size: 35%; animation: slide 1.4s ease-in-out infinite; }
|
|
79
80
|
@keyframes slide { from { inset-inline-start: -35%; } to { inset-inline-start: 100%; } }
|
|
80
81
|
@media (prefers-reduced-motion: reduce) {
|
package/dist/components/radio.js
CHANGED
|
@@ -63,9 +63,9 @@ CmRadio.styles = [
|
|
|
63
63
|
base,
|
|
64
64
|
css `
|
|
65
65
|
:host { display: inline-flex; }
|
|
66
|
-
.radio { display: inline-flex; align-items: flex-start; gap: var(--cm-space-
|
|
66
|
+
.radio { display: inline-flex; align-items: flex-start; gap: var(--cm-space-8); padding-block: 2px; cursor: pointer; outline: none; }
|
|
67
67
|
.dot {
|
|
68
|
-
position: relative; flex: none; width:
|
|
68
|
+
position: relative; flex: none; width: 16px; height: 16px; margin-block: 2px; border-radius: var(--cm-radius-full);
|
|
69
69
|
border: var(--cm-border-1) solid var(--cm-border-strong); background: var(--cm-bg-surface);
|
|
70
70
|
}
|
|
71
71
|
:host([checked]) .dot { background: var(--cm-border-strong); }
|
|
@@ -74,12 +74,12 @@ CmRadio.styles = [
|
|
|
74
74
|
border-radius: var(--cm-radius-full); background: var(--cm-bg-surface);
|
|
75
75
|
}
|
|
76
76
|
.radio:focus-visible .dot { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
77
|
-
.text { display: flex; flex-direction: column; gap:
|
|
78
|
-
.label { font-size:
|
|
79
|
-
.desc { font-size:
|
|
77
|
+
.text { display: flex; flex-direction: column; gap: 2px; }
|
|
78
|
+
.label { font-size: var(--cm-type-body-md-size); line-height: var(--cm-type-body-md-line-height); }
|
|
79
|
+
.desc { font-size: var(--cm-type-body-sm-size); line-height: var(--cm-type-body-sm-line-height); color: var(--cm-text-tertiary); }
|
|
80
80
|
:host([disabled]) .radio, :host([group-disabled]) .radio { cursor: not-allowed; }
|
|
81
|
-
:host([disabled]) .dot, :host([group-disabled]) .dot { background: var(--cm-bg-input-filled); border-color: var(--cm-border-
|
|
82
|
-
:host([disabled][checked]) .dot, :host([group-disabled][checked]) .dot { background: var(--cm-border-
|
|
81
|
+
:host([disabled]) .dot, :host([group-disabled]) .dot { background: var(--cm-bg-input-filled); border-color: var(--cm-border-subtle); }
|
|
82
|
+
:host([disabled][checked]) .dot, :host([group-disabled][checked]) .dot { background: var(--cm-border-subtle); }
|
|
83
83
|
:host([disabled]) .label, :host([group-disabled]) .label { color: var(--cm-text-secondary); }
|
|
84
84
|
`,
|
|
85
85
|
];
|
|
@@ -246,13 +246,13 @@ CmRadioGroup.styles = [
|
|
|
246
246
|
base,
|
|
247
247
|
css `
|
|
248
248
|
:host { display: block; }
|
|
249
|
-
.group { display: flex; flex-direction: column; gap: var(--cm-space-
|
|
250
|
-
.label { font-size: var(--cm-type-label-size); color: var(--cm-text-default); }
|
|
249
|
+
.group { display: flex; flex-direction: column; gap: var(--cm-space-8); }
|
|
250
|
+
.label { font-size: var(--cm-type-label-size); line-height: var(--cm-type-label-line-height); font-weight: var(--cm-type-label-weight); color: var(--cm-text-default); }
|
|
251
251
|
.req { color: var(--cm-text-critical); margin-inline-start: 2px; }
|
|
252
|
-
.help, .error { margin: 0; font-size:
|
|
252
|
+
.help, .error { margin: 0; font-size: var(--cm-type-body-sm-size); line-height: var(--cm-type-body-sm-line-height); color: var(--cm-text-tertiary); }
|
|
253
253
|
.error { color: var(--cm-text-critical); }
|
|
254
|
-
.options { display: flex; flex-direction: column; align-items: flex-start; gap: var(--cm-space-
|
|
255
|
-
:host([orientation='horizontal']) .options { flex-direction: row; flex-wrap: wrap; column-gap: var(--cm-space-
|
|
254
|
+
.options { display: flex; flex-direction: column; align-items: flex-start; gap: var(--cm-space-12); padding-top: var(--cm-space-4); }
|
|
255
|
+
:host([orientation='horizontal']) .options { flex-direction: row; flex-wrap: wrap; column-gap: var(--cm-space-24); }
|
|
256
256
|
`,
|
|
257
257
|
];
|
|
258
258
|
define('cm-radio-group', CmRadioGroup);
|
|
@@ -15,7 +15,7 @@ declare module '../localize.js' {
|
|
|
15
15
|
* A square tile that opens one report: a large icon over a short name, e.g. "Hourly sales".
|
|
16
16
|
* A pinned tile shows a pin in its corner. With `href` the tile is a link; without, a button.
|
|
17
17
|
* @element cm-report-tile
|
|
18
|
-
* @slot icon - Your own
|
|
18
|
+
* @slot icon - Your own 40px illustration, used instead of `icon`.
|
|
19
19
|
* @fires click - When a tile without `href` is chosen.
|
|
20
20
|
*/
|
|
21
21
|
export declare class CmReportTile extends CmLocalizedElement {
|
|
@@ -46,7 +46,7 @@ export declare class CmReportTile extends CmLocalizedElement {
|
|
|
46
46
|
render(): import("lit-html").TemplateResult<1>;
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
49
|
-
* A titled group of report tiles, e.g. "Sales". Tiles are 146px wide,
|
|
49
|
+
* A titled group of report tiles, e.g. "Sales". Tiles are 146px wide, 12px apart, and wrap;
|
|
50
50
|
* on phones three fit a row.
|
|
51
51
|
* @element cm-report-tiles
|
|
52
52
|
* @slot - `cm-report-tile` elements.
|
|
@@ -10,7 +10,7 @@ const strings = defineStrings('reportTile', {
|
|
|
10
10
|
* A square tile that opens one report: a large icon over a short name, e.g. "Hourly sales".
|
|
11
11
|
* A pinned tile shows a pin in its corner. With `href` the tile is a link; without, a button.
|
|
12
12
|
* @element cm-report-tile
|
|
13
|
-
* @slot icon - Your own
|
|
13
|
+
* @slot icon - Your own 40px illustration, used instead of `icon`.
|
|
14
14
|
* @fires click - When a tile without `href` is chosen.
|
|
15
15
|
*/
|
|
16
16
|
export class CmReportTile extends CmLocalizedElement {
|
|
@@ -27,9 +27,10 @@ export class CmReportTile extends CmLocalizedElement {
|
|
|
27
27
|
}
|
|
28
28
|
render() {
|
|
29
29
|
const inner = html `
|
|
30
|
-
<span class="icon" aria-hidden="true"><slot name="icon"><cm-icon name=${this.icon} size="
|
|
30
|
+
<span class="icon" aria-hidden="true"><slot name="icon"><cm-icon name=${this.icon} size="40"></cm-icon></slot></span>
|
|
31
31
|
<span class="label">${this.label}</span>
|
|
32
|
-
${this.pinned ? html `<span class="pin" part="pin"><cm-icon name="pin" size="
|
|
32
|
+
${this.pinned ? html `<span class="pin" part="pin"><cm-icon name="pin" size="16"></cm-icon>
|
|
33
|
+
<span class="sr">${this.t('pinned')}</span></span>` : nothing}
|
|
33
34
|
`;
|
|
34
35
|
return this.href
|
|
35
36
|
? html `<a class="tile" part="tile" href=${this.href}>${inner}</a>`
|
|
@@ -48,28 +49,27 @@ CmReportTile.styles = [
|
|
|
48
49
|
css `
|
|
49
50
|
:host { display: block; }
|
|
50
51
|
.tile {
|
|
51
|
-
position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--cm-space-
|
|
52
|
-
width: 100%; height:
|
|
52
|
+
position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--cm-space-12);
|
|
53
|
+
width: 100%; height: 120px; padding: var(--cm-space-8); font: inherit; font-size: var(--cm-font-size-14); line-height: var(--cm-line-height-14); font-weight: 500; text-align: center;
|
|
53
54
|
color: var(--cm-text-default); text-decoration: none; background: var(--cm-bg-surface); cursor: pointer;
|
|
54
|
-
border: var(--cm-border-1) solid var(--cm-border-
|
|
55
|
+
border: var(--cm-border-1) solid var(--cm-border-subtle); border-radius: var(--cm-radius-md);
|
|
55
56
|
}
|
|
56
57
|
.tile:hover { border-color: var(--cm-border-strong); }
|
|
57
58
|
.tile:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
58
59
|
.icon { display: inline-flex; color: var(--cm-icon-selected); }
|
|
59
|
-
::slotted([slot='icon']) { width:
|
|
60
|
-
.pin { position: absolute; top:
|
|
60
|
+
::slotted([slot='icon']) { width: 40px; height: 40px; }
|
|
61
|
+
.pin { position: absolute; top: var(--cm-space-8); inset-inline-end: var(--cm-space-8); color: var(--cm-icon-selected); }
|
|
61
62
|
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
|
|
62
63
|
@media (max-width: 640px) {
|
|
63
|
-
.tile { height:
|
|
64
|
-
.icon cm-icon::part(svg) { width:
|
|
65
|
-
::slotted([slot='icon']) { width:
|
|
66
|
-
.pin { top: 8px; inset-inline-end: 8px; }
|
|
64
|
+
.tile { height: 104px; gap: var(--cm-space-8); font-size: var(--cm-font-size-13); line-height: var(--cm-line-height-13); }
|
|
65
|
+
.icon cm-icon::part(svg) { width: 32px; height: 32px; }
|
|
66
|
+
::slotted([slot='icon']) { width: 32px; height: 32px; }
|
|
67
67
|
}
|
|
68
68
|
`,
|
|
69
69
|
];
|
|
70
70
|
define('cm-report-tile', CmReportTile);
|
|
71
71
|
/**
|
|
72
|
-
* A titled group of report tiles, e.g. "Sales". Tiles are 146px wide,
|
|
72
|
+
* A titled group of report tiles, e.g. "Sales". Tiles are 146px wide, 12px apart, and wrap;
|
|
73
73
|
* on phones three fit a row.
|
|
74
74
|
* @element cm-report-tiles
|
|
75
75
|
* @slot - `cm-report-tile` elements.
|
|
@@ -104,13 +104,13 @@ CmReportTiles.styles = [
|
|
|
104
104
|
base,
|
|
105
105
|
css `
|
|
106
106
|
:host { display: block; padding: var(--cm-space-20); background: var(--cm-bg-surface); border-radius: var(--cm-radius-md); }
|
|
107
|
-
.title { margin: 0 0 var(--cm-space-
|
|
108
|
-
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(146px, 1fr)); gap: var(--cm-space-
|
|
107
|
+
.title { margin: 0 0 var(--cm-space-16); font-size: var(--cm-type-heading-sm-size); line-height: var(--cm-type-heading-sm-line-height); font-weight: 600; }
|
|
108
|
+
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(146px, 1fr)); gap: var(--cm-space-12); }
|
|
109
109
|
@media (min-width: 641px) { .grid { grid-template-columns: repeat(auto-fill, 146px); } }
|
|
110
110
|
@media (max-width: 640px) {
|
|
111
|
-
:host { padding: var(--cm-space-
|
|
112
|
-
.title { margin-bottom: var(--cm-space-
|
|
113
|
-
.grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--cm-space-
|
|
111
|
+
:host { padding: var(--cm-space-8); }
|
|
112
|
+
.title { margin-bottom: var(--cm-space-8); }
|
|
113
|
+
.grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--cm-space-8); }
|
|
114
114
|
}
|
|
115
115
|
`,
|
|
116
116
|
];
|
|
@@ -35,7 +35,7 @@ declare module '../localize.js' {
|
|
|
35
35
|
* any content. With `href` the whole row is a link; otherwise clicking a selectable row ticks it.
|
|
36
36
|
* @element cm-resource-item
|
|
37
37
|
* @slot - Row content: name, details, badges. To line up with a `cm-table-header`, set `columns` and give one element per column.
|
|
38
|
-
* @slot media - A
|
|
38
|
+
* @slot media - A 40px thumbnail (32px on phones): a `cm-thumbnail` (recommended; `alt=""` when the row names the product) or an `<img>`.
|
|
39
39
|
* @slot actions - Buttons at the end of the row. They do not toggle selection.
|
|
40
40
|
* @fires cm-resource-select - `detail: { value, selected }` when the merchant ticks or unticks the row. The list handles it.
|
|
41
41
|
*/
|
|
@@ -92,17 +92,21 @@ export declare class CmResourceItem extends CmLocalizedElement {
|
|
|
92
92
|
}
|
|
93
93
|
/**
|
|
94
94
|
* A list of products, orders, customers or other resources, with optional bulk selection.
|
|
95
|
-
* When `selectable`,
|
|
96
|
-
*
|
|
95
|
+
* When `selectable`, the list's header row (a slim grey bar at the top) has a select-all box lined up with the rows' checkboxes and,
|
|
96
|
+
* next to it, a small chevron menu (this page, all matching, none). Once something is selected the same row shows
|
|
97
|
+
* "2 products selected", a button to select all matching results when there are more than the rows, and the bulk actions.
|
|
98
|
+
* With a `cm-table-header` in the `header` slot, that header is the row: the box sits in its checkbox column, and the
|
|
99
|
+
* selection status and bulk actions cover the column names while rows are selected. (Until something is selected the
|
|
100
|
+
* chevron is hidden there, since the column names use its room; the box selects the page.)
|
|
97
101
|
* Put a `cm-table-header` in the `header` slot for column names and `cm-pagination` under the list.
|
|
98
102
|
* The list lines a slotted `cm-table-header` up with its rows (it sets the header's `resource-rows`): lay each row's
|
|
99
103
|
* content out as a grid with `grid-template-columns: var(--cm-table-columns)` and `column-gap: var(--cm-space-20)`,
|
|
100
104
|
* and set `--cm-table-columns` on the list.
|
|
101
105
|
* @element cm-resource-list
|
|
102
106
|
* @slot - `cm-resource-item` rows.
|
|
103
|
-
* @slot header - A `cm-table-header` (or anything)
|
|
104
|
-
* @slot bulk-actions - Buttons that act on the selection, e.g. "Bulk orders". Shown once a row is selected.
|
|
105
|
-
* @slot actions - Buttons at the end of the
|
|
107
|
+
* @slot header - A `cm-table-header` (or anything) above the rows. A `cm-table-header` here is lined up with the rows, checkbox column included, and shares its row with the select-all box.
|
|
108
|
+
* @slot bulk-actions - Buttons that act on the selection, e.g. "Bulk orders". Shown once a row is selected, in the header row: use `size="slim"` buttons (32px, the row's height).
|
|
109
|
+
* @slot actions - Buttons at the end of the header row, e.g. "Customise columns". With a slotted header they get a row of their own above it.
|
|
106
110
|
* @slot empty - Shown instead of the rows when there are none, e.g. a `cm-empty-state`.
|
|
107
111
|
* @fires cm-selection-change - `detail: { selected, all }`: values of the selected rows, and whether every matching resource (all `total`) is selected.
|
|
108
112
|
*/
|
|
@@ -143,6 +147,15 @@ export declare class CmResourceList extends CmLocalizedElement {
|
|
|
143
147
|
_rows: {
|
|
144
148
|
state: boolean;
|
|
145
149
|
};
|
|
150
|
+
_hasHeader: {
|
|
151
|
+
state: boolean;
|
|
152
|
+
};
|
|
153
|
+
_hasTable: {
|
|
154
|
+
state: boolean;
|
|
155
|
+
};
|
|
156
|
+
_hasActions: {
|
|
157
|
+
state: boolean;
|
|
158
|
+
};
|
|
146
159
|
};
|
|
147
160
|
/** Rows get checkboxes and the selection toolbar appears. */
|
|
148
161
|
selectable: boolean;
|
|
@@ -162,6 +175,9 @@ export declare class CmResourceList extends CmLocalizedElement {
|
|
|
162
175
|
label: string;
|
|
163
176
|
_count: number;
|
|
164
177
|
_rows: number;
|
|
178
|
+
_hasHeader: boolean;
|
|
179
|
+
_hasTable: boolean;
|
|
180
|
+
_hasActions: boolean;
|
|
165
181
|
static styles: import("lit").CSSResult[];
|
|
166
182
|
constructor();
|
|
167
183
|
/** The `cm-resource-item` rows. */
|
|
@@ -9,7 +9,7 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
|
|
|
9
9
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
10
10
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
11
11
|
};
|
|
12
|
-
var _CmResourceItem_instances, _CmResourceItem_internals, _CmResourceItem_onRowClick, _CmResourceList_instances, _CmResourceList_id, _CmResourceList_headers, _CmResourceList_plural, _CmResourceList_syncHeaders, _CmResourceList_onHeaderSlot, _CmResourceList_sync, _CmResourceList_emit, _CmResourceList_menuSelect;
|
|
12
|
+
var _CmResourceItem_instances, _CmResourceItem_internals, _CmResourceItem_onRowClick, _CmResourceList_instances, _CmResourceList_id, _CmResourceList_headers, _CmResourceList_plural, _CmResourceList_syncHeaders, _CmResourceList_onHeaderSlot, _CmResourceList_onActionsSlot, _CmResourceList_sync, _CmResourceList_emit, _CmResourceList_menuSelect;
|
|
13
13
|
import { html, css, nothing } from 'lit';
|
|
14
14
|
import { base, define, nextId } from '../base.js';
|
|
15
15
|
import { CmLocalizedElement, defineStrings, pluralCategory } from '../localize.js';
|
|
@@ -39,7 +39,7 @@ const strings = defineStrings('resourceList', {
|
|
|
39
39
|
loading: 'Loading {resource}',
|
|
40
40
|
});
|
|
41
41
|
const checkboxStyles = css `
|
|
42
|
-
.check { position: relative; display: inline-flex; flex: none; width:
|
|
42
|
+
.check { position: relative; display: inline-flex; flex: none; width: 16px; height: 16px; }
|
|
43
43
|
.check input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
|
|
44
44
|
.check input:disabled { cursor: not-allowed; }
|
|
45
45
|
.box {
|
|
@@ -49,14 +49,14 @@ const checkboxStyles = css `
|
|
|
49
49
|
}
|
|
50
50
|
.dash { width: 50%; height: 2px; background: currentColor; }
|
|
51
51
|
.check input:focus-visible + .box { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
52
|
-
.check input:disabled + .box { border-color: var(--cm-border-
|
|
52
|
+
.check input:disabled + .box { border-color: var(--cm-border-subtle); background: var(--cm-bg-input-filled); }
|
|
53
53
|
`;
|
|
54
54
|
/**
|
|
55
55
|
* A row in a `cm-resource-list`: a checkbox when the list is selectable, an optional thumbnail and
|
|
56
56
|
* any content. With `href` the whole row is a link; otherwise clicking a selectable row ticks it.
|
|
57
57
|
* @element cm-resource-item
|
|
58
58
|
* @slot - Row content: name, details, badges. To line up with a `cm-table-header`, set `columns` and give one element per column.
|
|
59
|
-
* @slot media - A
|
|
59
|
+
* @slot media - A 40px thumbnail (32px on phones): a `cm-thumbnail` (recommended; `alt=""` when the row names the product) or an `<img>`.
|
|
60
60
|
* @slot actions - Buttons at the end of the row. They do not toggle selection.
|
|
61
61
|
* @fires cm-resource-select - `detail: { value, selected }` when the merchant ticks or unticks the row. The list handles it.
|
|
62
62
|
*/
|
|
@@ -111,7 +111,7 @@ export class CmResourceItem extends CmLocalizedElement {
|
|
|
111
111
|
${this.selectable
|
|
112
112
|
? html `<span class="check" part="checkbox"><input type="checkbox" aria-label=${this.t('select', { name: this.name })} .checked=${this.selected}
|
|
113
113
|
?disabled=${this.disabled} @change=${(e) => this.toggle(e.target.checked)} />
|
|
114
|
-
<span class="box" aria-hidden="true">${this.selected ? html `<cm-icon name="check" size="
|
|
114
|
+
<span class="box" aria-hidden="true">${this.selected ? html `<cm-icon name="check" size="12"></cm-icon>` : nothing}</span></span>`
|
|
115
115
|
: nothing}
|
|
116
116
|
<span class="media"><slot name="media"></slot></span>
|
|
117
117
|
<div class="content" part="content"><slot></slot></div>
|
|
@@ -143,20 +143,23 @@ CmResourceItem.styles = [
|
|
|
143
143
|
base,
|
|
144
144
|
checkboxStyles,
|
|
145
145
|
css `
|
|
146
|
-
:host { display: block; position: relative; border-bottom: var(--cm-border-1) solid var(--cm-border-
|
|
146
|
+
:host { display: block; position: relative; border-bottom: var(--cm-border-1) solid var(--cm-border-subtle); }
|
|
147
147
|
:host(:last-child) { border-bottom: 0; }
|
|
148
|
+
/* 56px rows (a 40px thumbnail with space-8 above and below), 14px text. A cm-table-header in the list's header
|
|
149
|
+
slot mirrors this geometry (resource-rows in table-header.ts): change both together. */
|
|
148
150
|
.row {
|
|
149
|
-
display: flex; align-items: center; gap: var(--cm-space-
|
|
150
|
-
|
|
151
|
+
display: flex; align-items: center; gap: var(--cm-space-12); box-sizing: border-box;
|
|
152
|
+
min-height: calc(var(--cm-control-height-lg) + 2 * var(--cm-space-8)); padding: var(--cm-space-8);
|
|
153
|
+
font-size: var(--cm-font-size-14); line-height: var(--cm-line-height-14);
|
|
151
154
|
}
|
|
152
|
-
:host(:hover:not([disabled])) .row, :host([selected]) .row { background: var(--cm-bg-
|
|
155
|
+
:host(:hover:not([disabled])) .row, :host([selected]) .row { background: var(--cm-bg-hover); }
|
|
153
156
|
:host([selectable]:not([href]):not([disabled])) .row { cursor: pointer; }
|
|
154
157
|
:host([disabled]) .row { color: var(--cm-text-tertiary); }
|
|
155
158
|
.media { display: contents; }
|
|
156
159
|
::slotted([slot='media']) {
|
|
157
|
-
flex: none; width:
|
|
160
|
+
flex: none; width: 40px; height: 40px; object-fit: cover; border-radius: var(--cm-radius-sm); background: var(--cm-thumb-bg);
|
|
158
161
|
}
|
|
159
|
-
::slotted(cm-thumbnail[slot='media']) { --cm-thumbnail-size:
|
|
162
|
+
::slotted(cm-thumbnail[slot='media']) { --cm-thumbnail-size: 40px; background: none; }
|
|
160
163
|
.content { flex: 1; min-width: 0; }
|
|
161
164
|
:host([columns]) .content {
|
|
162
165
|
display: grid; grid-template-columns: var(--cm-table-columns, minmax(0, 1fr)); column-gap: var(--cm-space-20); align-items: center;
|
|
@@ -165,30 +168,34 @@ CmResourceItem.styles = [
|
|
|
165
168
|
a { position: absolute; inset: 0; z-index: 0; border-radius: var(--cm-radius-xs); }
|
|
166
169
|
a:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: -2px; }
|
|
167
170
|
.check, .actions { position: relative; z-index: 1; }
|
|
168
|
-
.actions { display: flex; gap: var(--cm-space-
|
|
171
|
+
.actions { display: flex; gap: var(--cm-space-8); }
|
|
169
172
|
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
|
|
170
173
|
@media (max-width: 640px) {
|
|
171
|
-
.row { gap: var(--cm-space-
|
|
172
|
-
.check { width:
|
|
173
|
-
::slotted([slot='media']) { width:
|
|
174
|
-
::slotted(cm-thumbnail[slot='media']) { --cm-thumbnail-size:
|
|
174
|
+
.row { gap: var(--cm-space-8); padding: var(--cm-space-12) 0; }
|
|
175
|
+
.check { width: 20px; height: 20px; }
|
|
176
|
+
::slotted([slot='media']) { width: 32px; height: 32px; }
|
|
177
|
+
::slotted(cm-thumbnail[slot='media']) { --cm-thumbnail-size: 32px; }
|
|
175
178
|
}
|
|
176
179
|
`,
|
|
177
180
|
];
|
|
178
181
|
define('cm-resource-item', CmResourceItem);
|
|
179
182
|
/**
|
|
180
183
|
* A list of products, orders, customers or other resources, with optional bulk selection.
|
|
181
|
-
* When `selectable`,
|
|
182
|
-
*
|
|
184
|
+
* When `selectable`, the list's header row (a slim grey bar at the top) has a select-all box lined up with the rows' checkboxes and,
|
|
185
|
+
* next to it, a small chevron menu (this page, all matching, none). Once something is selected the same row shows
|
|
186
|
+
* "2 products selected", a button to select all matching results when there are more than the rows, and the bulk actions.
|
|
187
|
+
* With a `cm-table-header` in the `header` slot, that header is the row: the box sits in its checkbox column, and the
|
|
188
|
+
* selection status and bulk actions cover the column names while rows are selected. (Until something is selected the
|
|
189
|
+
* chevron is hidden there, since the column names use its room; the box selects the page.)
|
|
183
190
|
* Put a `cm-table-header` in the `header` slot for column names and `cm-pagination` under the list.
|
|
184
191
|
* The list lines a slotted `cm-table-header` up with its rows (it sets the header's `resource-rows`): lay each row's
|
|
185
192
|
* content out as a grid with `grid-template-columns: var(--cm-table-columns)` and `column-gap: var(--cm-space-20)`,
|
|
186
193
|
* and set `--cm-table-columns` on the list.
|
|
187
194
|
* @element cm-resource-list
|
|
188
195
|
* @slot - `cm-resource-item` rows.
|
|
189
|
-
* @slot header - A `cm-table-header` (or anything)
|
|
190
|
-
* @slot bulk-actions - Buttons that act on the selection, e.g. "Bulk orders". Shown once a row is selected.
|
|
191
|
-
* @slot actions - Buttons at the end of the
|
|
196
|
+
* @slot header - A `cm-table-header` (or anything) above the rows. A `cm-table-header` here is lined up with the rows, checkbox column included, and shares its row with the select-all box.
|
|
197
|
+
* @slot bulk-actions - Buttons that act on the selection, e.g. "Bulk orders". Shown once a row is selected, in the header row: use `size="slim"` buttons (32px, the row's height).
|
|
198
|
+
* @slot actions - Buttons at the end of the header row, e.g. "Customise columns". With a slotted header they get a row of their own above it.
|
|
192
199
|
* @slot empty - Shown instead of the rows when there are none, e.g. a `cm-empty-state`.
|
|
193
200
|
* @fires cm-selection-change - `detail: { selected, all }`: values of the selected rows, and whether every matching resource (all `total`) is selected.
|
|
194
201
|
*/
|
|
@@ -212,13 +219,19 @@ export class CmResourceList extends CmLocalizedElement {
|
|
|
212
219
|
this.label = '';
|
|
213
220
|
this._count = 0;
|
|
214
221
|
this._rows = 0;
|
|
222
|
+
this._hasHeader = false;
|
|
223
|
+
this._hasTable = false;
|
|
224
|
+
this._hasActions = false;
|
|
215
225
|
_CmResourceList_id.set(this, nextId('cm-rl'));
|
|
216
226
|
_CmResourceList_headers.set(this, new Set());
|
|
217
227
|
_CmResourceList_onHeaderSlot.set(this, (e) => {
|
|
218
228
|
const slot = e.target;
|
|
219
|
-
|
|
229
|
+
this._hasHeader = slot.assignedElements().length > 0;
|
|
220
230
|
__classPrivateFieldGet(this, _CmResourceList_instances, "m", _CmResourceList_syncHeaders).call(this, slot);
|
|
221
231
|
});
|
|
232
|
+
_CmResourceList_onActionsSlot.set(this, (e) => {
|
|
233
|
+
this._hasActions = e.target.assignedElements().length > 0;
|
|
234
|
+
});
|
|
222
235
|
_CmResourceList_menuSelect.set(this, (e) => {
|
|
223
236
|
e.stopPropagation(); // the list's own menu: don't leak its cm-select to the page
|
|
224
237
|
const v = e.detail.value;
|
|
@@ -286,27 +299,35 @@ export class CmResourceList extends CmLocalizedElement {
|
|
|
286
299
|
status = html `${this.t('selected', { count: n, resource: noun(n) })}${all && more
|
|
287
300
|
? html ` <button type="button" @click=${() => this.selectAll()}>${this.t('selectAll', { count: this.total, resource: plural })}</button>` : nothing}`;
|
|
288
301
|
}
|
|
302
|
+
const busy = n > 0 || this.allSelected;
|
|
303
|
+
const over = this._hasTable;
|
|
304
|
+
// The chevron needs the room the column names use, so over a header it waits until something is selected.
|
|
305
|
+
const menu = !this.hideSelectMenu && (!over || busy);
|
|
306
|
+
const actions = html `<slot name="actions" @slotchange=${__classPrivateFieldGet(this, _CmResourceList_onActionsSlot, "f")}></slot>`;
|
|
289
307
|
return html `
|
|
290
|
-
${this.selectable
|
|
291
|
-
|
|
308
|
+
${this.selectable && over ? html `<div class="top ${this._hasActions ? 'has' : ''}" part="top-actions">${actions}</div>` : nothing}
|
|
309
|
+
<div class="head ${this.selectable || this._hasHeader ? 'on' : ''} ${over ? 'over' : ''}">
|
|
310
|
+
<div class="header ${this._hasHeader ? 'has' : ''}"><slot name="header" @slotchange=${__classPrivateFieldGet(this, _CmResourceList_onHeaderSlot, "f")}></slot></div>
|
|
311
|
+
${this.selectable
|
|
312
|
+
? html `<div class="toolbar ${over ? 'over' : ''} ${busy ? 'busy' : ''}" part="toolbar">
|
|
292
313
|
<span class="select" part="select">
|
|
293
314
|
<span class="check"><input id="${__classPrivateFieldGet(this, _CmResourceList_id, "f")}-all" type="checkbox" .checked=${all} .indeterminate=${n > 0 && !all}
|
|
294
315
|
?disabled=${!enabled} @change=${(e) => this.selectPage(e.target.checked)} />
|
|
295
316
|
<span class="box" aria-hidden="true">${n > 0 && !all ? html `<span class="dash"></span>` : all ? html `<cm-icon name="check" size="12"></cm-icon>` : nothing}</span></span>
|
|
296
|
-
|
|
297
|
-
${this.hideSelectMenu ? nothing : html `<cm-action-menu icon-only icon="chevron-down" part="select-menu" label=${this.t('selectionOptions')}
|
|
317
|
+
${this.hideSelectMenu ? nothing : html `<cm-action-menu icon-only icon="chevron-down" part="select-menu" label=${this.t('selectionOptions')} ?hidden=${!menu}
|
|
298
318
|
.items=${[
|
|
299
319
|
{ label: this.t('selectPage', { count: enabled }), value: 'page', disabled: !enabled },
|
|
300
320
|
...(more ? [{ label: this.t('selectAll', { count: this.total, resource: plural }), value: 'all' }] : []),
|
|
301
321
|
{ label: this.t('selectNone'), value: 'none', disabled: !n && !this.allSelected },
|
|
302
322
|
]} @cm-select=${__classPrivateFieldGet(this, _CmResourceList_menuSelect, "f")}></cm-action-menu>`}
|
|
323
|
+
<label for="${__classPrivateFieldGet(this, _CmResourceList_id, "f")}-all" class=${over || busy ? 'sr' : 'label'}>${this.t('select')}<span class="sr"> ${this.t('selectPageHidden', { count: rows, resource: noun(rows) })}</span></label>
|
|
303
324
|
</span>
|
|
304
|
-
<span class="bulk" ?hidden=${!n}><slot name="bulk-actions"></slot></span>
|
|
305
325
|
<span class="status" part="status" role="status">${status}</span>
|
|
306
|
-
<span class="
|
|
326
|
+
<span class="bulk" ?hidden=${!n}><slot name="bulk-actions"></slot></span>
|
|
327
|
+
${over ? nothing : html `<span class="actions ${this._hasActions ? 'has' : ''}">${actions}</span>`}
|
|
307
328
|
</div>`
|
|
308
329
|
: nothing}
|
|
309
|
-
|
|
330
|
+
</div>
|
|
310
331
|
<div class="body">
|
|
311
332
|
<div class="list" part="list" role="list" aria-label=${this.label || plural.replace(/^./, (c) => c.toUpperCase())} aria-busy=${this.loading ? 'true' : 'false'}>
|
|
312
333
|
<slot @slotchange=${() => __classPrivateFieldGet(this, _CmResourceList_instances, "m", _CmResourceList_sync).call(this)}></slot>
|
|
@@ -317,7 +338,7 @@ export class CmResourceList extends CmLocalizedElement {
|
|
|
317
338
|
`;
|
|
318
339
|
}
|
|
319
340
|
}
|
|
320
|
-
_CmResourceList_id = new WeakMap(), _CmResourceList_headers = new WeakMap(), _CmResourceList_onHeaderSlot = new WeakMap(), _CmResourceList_menuSelect = new WeakMap(), _CmResourceList_instances = new WeakSet(), _CmResourceList_plural = function _CmResourceList_plural() {
|
|
341
|
+
_CmResourceList_id = new WeakMap(), _CmResourceList_headers = new WeakMap(), _CmResourceList_onHeaderSlot = new WeakMap(), _CmResourceList_onActionsSlot = new WeakMap(), _CmResourceList_menuSelect = new WeakMap(), _CmResourceList_instances = new WeakSet(), _CmResourceList_plural = function _CmResourceList_plural() {
|
|
321
342
|
if (this.resourceNamePlural)
|
|
322
343
|
return this.resourceNamePlural;
|
|
323
344
|
const own = this.resourceName;
|
|
@@ -338,6 +359,7 @@ _CmResourceList_id = new WeakMap(), _CmResourceList_headers = new WeakMap(), _Cm
|
|
|
338
359
|
for (const h of found)
|
|
339
360
|
h.setAttribute('resource-rows', this.selectable ? 'selectable' : 'plain');
|
|
340
361
|
__classPrivateFieldSet(this, _CmResourceList_headers, found, "f");
|
|
362
|
+
this._hasTable = found.size > 0;
|
|
341
363
|
}, _CmResourceList_sync = function _CmResourceList_sync() {
|
|
342
364
|
const items = this.items;
|
|
343
365
|
items.forEach((i) => (i.selectable = this.selectable));
|
|
@@ -357,34 +379,55 @@ CmResourceList.properties = {
|
|
|
357
379
|
label: {},
|
|
358
380
|
_count: { state: true },
|
|
359
381
|
_rows: { state: true },
|
|
382
|
+
_hasHeader: { state: true },
|
|
383
|
+
_hasTable: { state: true },
|
|
384
|
+
_hasActions: { state: true },
|
|
360
385
|
};
|
|
361
386
|
CmResourceList.styles = [
|
|
362
387
|
base,
|
|
363
388
|
checkboxStyles,
|
|
364
389
|
css `
|
|
365
|
-
:host { display: block; position: relative; background: var(--cm-bg-surface); border-radius: var(--cm-radius-md); }
|
|
366
|
-
.
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
390
|
+
:host { display: block; position: relative; background: var(--cm-bg-surface); border-radius: var(--cm-radius-md); --_pad: var(--cm-space-12); }
|
|
391
|
+
/* The header row. Rows sit --_pad in from the list's edges and pad space-8 inside (0 on phones), so their 16px
|
|
392
|
+
checkbox starts space-20 from the edge (space-12 on phones, 20px box). The header row runs edge to edge and puts
|
|
393
|
+
its box at the same place. The slotted header and the toolbar share one grid cell: the toolbar lies over the
|
|
394
|
+
header's checkbox column, and while rows are selected it covers the column names. */
|
|
395
|
+
.head { display: grid; grid-template-columns: minmax(0, 1fr); padding: 0 var(--_pad); }
|
|
396
|
+
.head:not(.on) { display: none; }
|
|
397
|
+
.head.over > * { grid-area: 1 / 1; }
|
|
398
|
+
.head:not(.over) .toolbar { order: -1; }
|
|
399
|
+
.head:not(.over) .header { padding-block-start: var(--cm-space-8); }
|
|
400
|
+
.header:not(.has) { display: none; }
|
|
401
|
+
.toolbar {
|
|
402
|
+
position: relative; z-index: 1; display: flex; flex-wrap: wrap; align-items: center; gap: var(--cm-space-4) var(--cm-space-8);
|
|
403
|
+
box-sizing: border-box; min-height: var(--cm-control-height-sm);
|
|
404
|
+
margin-inline: calc(-1 * var(--_pad)); padding-block: 0; padding-inline: calc(var(--_pad) + var(--cm-space-8)) var(--_pad);
|
|
405
|
+
font-size: var(--cm-font-size-13); line-height: var(--cm-line-height-13);
|
|
406
|
+
background: var(--cm-bg-hover); box-shadow: inset 0 var(--cm-border-1) 0 var(--cm-border-subtle), inset 0 calc(-1 * var(--cm-border-1)) 0 var(--cm-border-subtle);
|
|
370
407
|
}
|
|
371
|
-
|
|
372
|
-
.
|
|
373
|
-
.
|
|
374
|
-
.select
|
|
375
|
-
.
|
|
408
|
+
/* Over a slotted header with nothing selected: only the box shows, in the header's checkbox column. */
|
|
409
|
+
.toolbar.over:not(.busy) { background: none; box-shadow: none; pointer-events: none; }
|
|
410
|
+
.toolbar.over:not(.busy) > * { pointer-events: auto; }
|
|
411
|
+
.select { display: inline-flex; align-items: center; gap: var(--cm-space-4); }
|
|
412
|
+
.select label { cursor: pointer; font-weight: 500; }
|
|
413
|
+
.select .label[hidden] { display: none; }
|
|
414
|
+
.select cm-action-menu::part(trigger) { width: var(--cm-space-24); min-height: var(--cm-space-24); border-radius: var(--cm-radius-xs); }
|
|
415
|
+
.select cm-action-menu[hidden] { display: none; }
|
|
416
|
+
.bulk { display: flex; flex-wrap: wrap; gap: var(--cm-space-8); }
|
|
376
417
|
.bulk[hidden] { display: none; }
|
|
377
|
-
.status {
|
|
418
|
+
.status { font-weight: 500; font-variant-numeric: tabular-nums; }
|
|
419
|
+
.status:empty { display: none; }
|
|
378
420
|
.status button { font: inherit; font-weight: 500; color: inherit; text-decoration: underline; background: none; border: 0; padding: 0; cursor: pointer; }
|
|
379
421
|
.status button:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
380
|
-
.actions { display: flex; gap: var(--cm-space-
|
|
381
|
-
.
|
|
382
|
-
.
|
|
422
|
+
.actions { display: flex; gap: var(--cm-space-8); margin-inline-start: auto; }
|
|
423
|
+
.actions:not(.has) { display: none; }
|
|
424
|
+
.top { display: flex; justify-content: flex-end; gap: var(--cm-space-8); padding: var(--cm-space-8) var(--_pad); }
|
|
425
|
+
.top:not(.has) { display: none; }
|
|
383
426
|
.body { position: relative; }
|
|
384
|
-
.list { padding: 0 var(--
|
|
427
|
+
.list { padding: 0 var(--_pad) var(--cm-space-8); }
|
|
385
428
|
:host([loading]) .list ::slotted(*) { opacity: 0.4; }
|
|
386
429
|
.spinner {
|
|
387
|
-
position: absolute; inset-inline-start: 50%; top: 50%; width:
|
|
430
|
+
position: absolute; inset-inline-start: 50%; top: 50%; width: 48px; height: 48px; margin: -24px; border-radius: 50%;
|
|
388
431
|
border: 4px solid var(--cm-thumb-bg); border-top-color: var(--cm-icon-selected); animation: spin 0.8s linear infinite;
|
|
389
432
|
}
|
|
390
433
|
@keyframes spin { to { transform: rotate(360deg); } }
|
|
@@ -392,12 +435,9 @@ CmResourceList.styles = [
|
|
|
392
435
|
.empty:not(.show) { display: none; }
|
|
393
436
|
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
|
|
394
437
|
@media (max-width: 640px) {
|
|
395
|
-
.toolbar {
|
|
396
|
-
.
|
|
397
|
-
.
|
|
398
|
-
.header { padding: var(--cm-space-10) var(--cm-space-10) 0; }
|
|
399
|
-
.list { padding: 0 var(--cm-space-10); }
|
|
400
|
-
.spinner { width: 30px; height: 30px; margin: -15px; border-width: 3px; }
|
|
438
|
+
.toolbar { padding-inline: var(--_pad); }
|
|
439
|
+
.toolbar .check { width: 20px; height: 20px; }
|
|
440
|
+
.spinner { width: 32px; height: 32px; margin: -16px; border-width: 3px; }
|
|
401
441
|
}
|
|
402
442
|
`,
|
|
403
443
|
];
|
|
@@ -114,16 +114,16 @@ CmSaveBar.styles = [
|
|
|
114
114
|
:host(:not([open])) { display: none; }
|
|
115
115
|
.bar {
|
|
116
116
|
display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--cm-space-20);
|
|
117
|
-
min-height:
|
|
118
|
-
background: var(--cm-bg-surface); border: var(--cm-border-1) solid var(--cm-border-
|
|
119
|
-
border-radius: var(--cm-radius-md); box-shadow: var(--cm-shadow-
|
|
117
|
+
min-height: 64px; padding: var(--cm-space-12) var(--cm-space-20);
|
|
118
|
+
background: var(--cm-bg-surface); border: var(--cm-border-1) solid var(--cm-border-subtle);
|
|
119
|
+
border-radius: var(--cm-radius-md); box-shadow: var(--cm-shadow-lg);
|
|
120
120
|
}
|
|
121
|
-
.message { flex: 1 1 200px; margin: 0; font-size:
|
|
122
|
-
.actions { flex: none; display: flex; gap: var(--cm-space-
|
|
121
|
+
.message { flex: 1 1 200px; margin: 0; font-size: var(--cm-type-heading-sm-size); line-height: var(--cm-type-heading-sm-line-height); font-weight: 600; }
|
|
122
|
+
.actions { flex: none; display: flex; gap: var(--cm-space-8); margin-inline-start: auto; }
|
|
123
123
|
@media (max-width: 640px) {
|
|
124
|
-
.bar { min-height:
|
|
125
|
-
.message { font-size:
|
|
126
|
-
|
|
124
|
+
.bar { min-height: 56px; padding: var(--cm-space-8) var(--cm-space-12); gap: var(--cm-space-8); }
|
|
125
|
+
.message { font-size: var(--cm-font-size-14); line-height: var(--cm-line-height-14); font-weight: 500; }
|
|
126
|
+
|
|
127
127
|
}
|
|
128
128
|
`,
|
|
129
129
|
];
|