@commmerce/ui 1.3.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/THIRD_PARTY_NOTICES.txt +101 -0
- package/dist/calendar.js +15 -19
- package/dist/cdn.js +1669 -1193
- 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 +15 -0
- package/dist/components/app-frame.js +22 -2
- 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.d.ts +380 -0
- package/dist/components/calendar.js +1480 -0
- 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.d.ts +153 -0
- package/dist/components/signature-field.js +728 -0
- 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 +13655 -9770
- package/dist/field.d.ts +15 -0
- package/dist/field.js +47 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +3 -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
|
@@ -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
|
*
|
|
@@ -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
|
];
|