@commmerce/ui 1.4.0 → 1.5.1
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 +1270 -1139
- 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 +22 -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 +19 -4
- package/dist/components/page.js +24 -8
- 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 +933 -158
- 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
|
@@ -38,9 +38,9 @@ const strings = defineStrings('button', {
|
|
|
38
38
|
export class CmButton extends CmLocalizedElement {
|
|
39
39
|
constructor() {
|
|
40
40
|
super();
|
|
41
|
-
/** `primary` = black fill (one per group); `secondary` =
|
|
41
|
+
/** `primary` = black fill (one per group); `secondary` = white fill with a grey outline, like a field (since 1.5; was a black outline). */
|
|
42
42
|
this.variant = 'secondary';
|
|
43
|
-
/** `large`
|
|
43
|
+
/** `large` 40px (save bars, page actions), `medium` 36px (default), `slim` 32px (toolbars, table rows). Text is 14px (13px on slim). On touch screens every size is at least 44px tall. Sizes changed in 1.5 (were 46, 32 and 24px). */
|
|
44
44
|
this.size = 'medium';
|
|
45
45
|
/** Form behaviour when inside a `<form>`: `submit` submits it, `reset` resets it. */
|
|
46
46
|
this.type = 'button';
|
|
@@ -50,7 +50,7 @@ export class CmButton extends CmLocalizedElement {
|
|
|
50
50
|
this.loading = false;
|
|
51
51
|
/** Square button that shows only its icon (from `icon` or the `icon` slot). Give it a `label`. */
|
|
52
52
|
this.iconOnly = false;
|
|
53
|
-
/** Name of a @commmerce/icons icon shown before the label (16px
|
|
53
|
+
/** Name of a @commmerce/icons icon shown before the label (16px at every size). */
|
|
54
54
|
this.icon = '';
|
|
55
55
|
/** Accessible name of an `icon-only` button ("Notifications", "Refresh"). Required with `icon-only`; ignored otherwise, so the visible text stays the name. */
|
|
56
56
|
this.label = '';
|
|
@@ -82,10 +82,9 @@ export class CmButton extends CmLocalizedElement {
|
|
|
82
82
|
}
|
|
83
83
|
render() {
|
|
84
84
|
const count = Number.isFinite(this.count) && this.count > 0 ? Math.floor(this.count) : 0;
|
|
85
|
-
const iconSize = this.size === 'large' ? 20 : 16;
|
|
86
85
|
const icon = this.loading
|
|
87
86
|
? html `<span class="spinner" aria-hidden="true"></span>`
|
|
88
|
-
: html `<slot name="icon">${this.icon ? html `<cm-icon name=${this.icon} size
|
|
87
|
+
: html `<slot name="icon">${this.icon ? html `<cm-icon name=${this.icon} size="16"></cm-icon>` : nothing}</slot>`;
|
|
89
88
|
const text = this.iconOnly ? html `<span class="vh"><slot></slot></span>` : html `<slot></slot>`;
|
|
90
89
|
const counter = count
|
|
91
90
|
? html `<span class="count" part="count" aria-hidden="true">${count > COUNT_MAX ? this.t('countOverflow', { max: COUNT_MAX }) : this.formatNumber(count)}</span>${this.iconOnly ? nothing : html `<span class="vh"> ${this.t('count', { count })}</span>`}`
|
|
@@ -123,20 +122,22 @@ CmButton.styles = [
|
|
|
123
122
|
css `
|
|
124
123
|
:host { display: inline-flex; vertical-align: middle; }
|
|
125
124
|
.btn {
|
|
126
|
-
display: inline-flex; align-items: center; justify-content: center; gap:
|
|
125
|
+
display: inline-flex; align-items: center; justify-content: center; gap: var(--cm-space-8);
|
|
127
126
|
width: 100%; font: inherit; font-weight: 500; line-height: 1; white-space: nowrap;
|
|
128
127
|
border-radius: var(--cm-radius-sm); border: var(--cm-border-1) solid transparent;
|
|
129
128
|
cursor: pointer; text-decoration: none;
|
|
130
129
|
}
|
|
131
|
-
:
|
|
132
|
-
|
|
133
|
-
:host([size='
|
|
130
|
+
/* 1.5 scale: large 40, medium 36, slim 32 (--cm-control-height-*); 14px text, 13px on slim. */
|
|
131
|
+
:host([size='large']) .btn { height: var(--cm-control-height-lg, 40px); padding: 0 var(--cm-space-20); font-size: var(--cm-font-size-14); }
|
|
132
|
+
.btn, :host([size='medium']) .btn { height: var(--cm-control-height-md, 36px); padding: 0 var(--cm-space-16); font-size: var(--cm-font-size-14); }
|
|
133
|
+
:host([size='slim']) .btn { height: var(--cm-control-height-sm, 32px); padding: 0 var(--cm-space-12); font-size: var(--cm-font-size-13); }
|
|
134
134
|
:host([variant='primary']) .btn { background: var(--cm-action-primary); color: var(--cm-action-primary-text); border-color: var(--cm-action-primary); }
|
|
135
135
|
:host([variant='primary']) .btn:hover { background: var(--cm-action-primary-hover); border-color: var(--cm-action-primary-hover); }
|
|
136
|
+
/* Secondary (1.5): white with the same outline as fields (border-input), grey on hover. */
|
|
136
137
|
.btn, :host([variant='secondary']) .btn {
|
|
137
|
-
background: var(--cm-bg-
|
|
138
|
+
background: var(--cm-bg-surface); color: var(--cm-text-default); border-color: var(--cm-border-input);
|
|
138
139
|
}
|
|
139
|
-
:host([variant='
|
|
140
|
+
:host(:not([variant='primary']):not([disabled]):not([loading])) .btn:hover { background: var(--cm-bg-hover); }
|
|
140
141
|
:host([disabled]) .btn, :host([loading]) .btn {
|
|
141
142
|
background: var(--cm-action-disabled); border-color: var(--cm-action-disabled); color: var(--cm-action-disabled-text); cursor: not-allowed;
|
|
142
143
|
}
|
|
@@ -172,23 +173,25 @@ CmButton.styles = [
|
|
|
172
173
|
@keyframes spin { to { transform: rotate(360deg); } }
|
|
173
174
|
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2s; } }
|
|
174
175
|
::slotted([slot='icon']) { display: inline-flex; }
|
|
175
|
-
/* Icon-only: a square of the size's height
|
|
176
|
+
/* Icon-only: a square of the size's height. */
|
|
176
177
|
:host([icon-only]) .btn { position: relative; padding: 0; }
|
|
177
|
-
:host([icon-only][size='large']) .btn { width:
|
|
178
|
-
:host([icon-only]) .btn, :host([icon-only][size='medium']) .btn { width:
|
|
179
|
-
:host([icon-only][size='slim']) .btn { width:
|
|
178
|
+
:host([icon-only][size='large']) .btn { width: var(--cm-control-height-lg, 40px); }
|
|
179
|
+
:host([icon-only]) .btn, :host([icon-only][size='medium']) .btn { width: var(--cm-control-height-md, 36px); }
|
|
180
|
+
:host([icon-only][size='slim']) .btn { width: var(--cm-control-height-sm, 32px); }
|
|
181
|
+
/* Touch screens: every button is at least 44px tall (icon-only: 44 x 44), whatever its size. */
|
|
180
182
|
@media (pointer: coarse) {
|
|
181
|
-
|
|
183
|
+
.btn { min-height: var(--cm-control-height-touch, 44px); }
|
|
184
|
+
:host([icon-only]) .btn { min-width: var(--cm-control-height-touch, 44px); }
|
|
182
185
|
}
|
|
183
186
|
.vh { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
|
|
184
187
|
.count {
|
|
185
188
|
display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box;
|
|
186
|
-
min-width:
|
|
187
|
-
font-size:
|
|
189
|
+
min-width: 16px; height: 16px; padding: 0 var(--cm-space-4); border-radius: var(--cm-radius-full);
|
|
190
|
+
font-size: var(--cm-font-size-12); font-weight: 500; line-height: 1; font-variant-numeric: tabular-nums;
|
|
188
191
|
color: var(--cm-text-on-dark); background: var(--cm-nav-badge);
|
|
189
192
|
}
|
|
190
193
|
:host([icon-only]) .count {
|
|
191
|
-
position: absolute; inset-block-start: -
|
|
194
|
+
position: absolute; inset-block-start: -6px; inset-inline-end: -6px;
|
|
192
195
|
box-shadow: 0 0 0 2px var(--cm-bg-surface); pointer-events: none;
|
|
193
196
|
}
|
|
194
197
|
`,
|
|
@@ -1317,7 +1317,7 @@ CmCalendar.styles = [
|
|
|
1317
1317
|
css `
|
|
1318
1318
|
:host { display: block; position: relative; min-width: 0; font-size: 14px; line-height: 20px; }
|
|
1319
1319
|
:host([dragging]) { cursor: grabbing; user-select: none; -webkit-user-select: none; }
|
|
1320
|
-
.cal { display: flex; flex-direction: column; gap: var(--cm-space-
|
|
1320
|
+
.cal { display: flex; flex-direction: column; gap: var(--cm-space-12); min-width: 0; }
|
|
1321
1321
|
button { font: inherit; color: inherit; margin: 0; }
|
|
1322
1322
|
[hidden] { display: none !important; }
|
|
1323
1323
|
.vh {
|
|
@@ -1327,11 +1327,11 @@ CmCalendar.styles = [
|
|
|
1327
1327
|
:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
1328
1328
|
|
|
1329
1329
|
/* Header */
|
|
1330
|
-
.head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--cm-space-
|
|
1330
|
+
.head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--cm-space-8) var(--cm-space-12); }
|
|
1331
1331
|
.nav { display: flex; align-items: center; gap: 4px; }
|
|
1332
|
-
.title { flex: 1 1 10rem; min-width: 0; margin: 0; font-size:
|
|
1332
|
+
.title { flex: 1 1 10rem; min-width: 0; margin: 0; font-size: var(--cm-type-heading-sm-size); line-height: var(--cm-type-heading-sm-line-height); font-weight: 600; display: flex; align-items: center; gap: var(--cm-space-8); }
|
|
1333
1333
|
.hb {
|
|
1334
|
-
display: inline-flex; align-items: center; justify-content: center; height:
|
|
1334
|
+
display: inline-flex; align-items: center; justify-content: center; height: var(--cm-control-height-md); min-width: var(--cm-control-height-md); padding: 0 var(--cm-space-12);
|
|
1335
1335
|
background: var(--cm-bg-surface); color: var(--cm-text-default); border: var(--cm-border-1) solid var(--cm-border-input);
|
|
1336
1336
|
border-radius: var(--cm-radius-sm); cursor: pointer; white-space: nowrap;
|
|
1337
1337
|
}
|
|
@@ -1346,7 +1346,7 @@ CmCalendar.styles = [
|
|
|
1346
1346
|
|
|
1347
1347
|
/* Chips */
|
|
1348
1348
|
.chip {
|
|
1349
|
-
position: relative; display: flex; align-items: center; gap: 4px; width: 100%; min-width: 0; min-height: 24px; padding: 2px
|
|
1349
|
+
position: relative; display: flex; align-items: center; gap: 4px; width: 100%; min-width: 0; min-height: 24px; padding: 2px var(--cm-space-4);
|
|
1350
1350
|
border: 0; border-inline-start: 3px solid var(--bar); border-radius: var(--cm-radius-xs);
|
|
1351
1351
|
background: linear-gradient(var(--fill), var(--fill)), var(--cm-bg-surface); color: var(--cm-text-default);
|
|
1352
1352
|
font-size: 12px; line-height: 16px; text-align: start; text-decoration: none; white-space: nowrap; overflow: hidden;
|
|
@@ -1366,24 +1366,24 @@ CmCalendar.styles = [
|
|
|
1366
1366
|
.chip.moving { outline: 2px dashed var(--cm-border-strong); outline-offset: -2px; background: var(--cm-bg-page); }
|
|
1367
1367
|
.chip.pending { background: var(--cm-bg-page); cursor: progress; }
|
|
1368
1368
|
.spin {
|
|
1369
|
-
flex: none; width:
|
|
1369
|
+
flex: none; width: 12px; height: 12px; border: 2px solid currentColor; border-inline-end-color: transparent; border-radius: 50%;
|
|
1370
1370
|
animation: cm-cal-spin 0.8s linear infinite;
|
|
1371
1371
|
}
|
|
1372
1372
|
@keyframes cm-cal-spin { to { transform: rotate(360deg); } }
|
|
1373
1373
|
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 2.4s; } }
|
|
1374
1374
|
.ph {
|
|
1375
|
-
display: flex; align-items: center; min-height: 24px; padding: 2px
|
|
1375
|
+
display: flex; align-items: center; min-height: 24px; padding: 2px var(--cm-space-4); border: 2px dashed var(--cm-border-strong);
|
|
1376
1376
|
border-radius: var(--cm-radius-xs); background: var(--cm-bg-surface); color: var(--cm-text-tertiary);
|
|
1377
1377
|
font-size: 12px; line-height: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none;
|
|
1378
1378
|
}
|
|
1379
1379
|
|
|
1380
1380
|
/* Month */
|
|
1381
1381
|
/* Separate borders: collapsed ones spill half a pixel outside the table (sideways scroll at 320px in WebKit). */
|
|
1382
|
-
.month { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; background: var(--cm-bg-surface); border: var(--cm-border-1) solid var(--cm-border-
|
|
1383
|
-
.month th { padding:
|
|
1382
|
+
.month { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; background: var(--cm-bg-surface); border: var(--cm-border-1) solid var(--cm-border-subtle); }
|
|
1383
|
+
.month th { padding: var(--cm-space-4) var(--cm-space-8); font-size: 12px; line-height: 16px; font-weight: 500; color: var(--cm-text-tertiary); text-align: start; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
1384
1384
|
.month td {
|
|
1385
1385
|
position: relative; vertical-align: top; height: var(--cm-calendar-day-height, 112px); padding: 4px;
|
|
1386
|
-
border: 0; border-block-start: var(--cm-border-1) solid var(--cm-border-
|
|
1386
|
+
border: 0; border-block-start: var(--cm-border-1) solid var(--cm-border-subtle); border-inline-start: var(--cm-border-1) solid var(--cm-border-subtle);
|
|
1387
1387
|
background: var(--cm-bg-surface);
|
|
1388
1388
|
}
|
|
1389
1389
|
.month td:first-child { border-inline-start: 0; }
|
|
@@ -1407,19 +1407,19 @@ CmCalendar.styles = [
|
|
|
1407
1407
|
.evs { list-style: none; margin: 2px 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
|
|
1408
1408
|
.evs li { display: block; min-width: 0; }
|
|
1409
1409
|
.more {
|
|
1410
|
-
display: block; width: 100%; min-height: 24px; margin-block-start: 2px; padding: 2px
|
|
1410
|
+
display: block; width: 100%; min-height: 24px; margin-block-start: 2px; padding: 2px var(--cm-space-4); border: 0; border-radius: var(--cm-radius-xs);
|
|
1411
1411
|
background: none; color: var(--cm-text-default); font-size: 12px; line-height: 16px; font-weight: 500; text-align: start; cursor: pointer;
|
|
1412
1412
|
}
|
|
1413
1413
|
.more:hover { background: var(--cm-bg-hover); text-decoration: underline; }
|
|
1414
1414
|
.pop {
|
|
1415
1415
|
position: absolute; z-index: 5; inset-block-start: 0; inset-inline-start: 0; width: max(100%, 15rem); max-width: 80vw;
|
|
1416
|
-
padding: var(--cm-space-
|
|
1417
|
-
border-radius: var(--cm-radius-md); box-shadow: var(--cm-shadow-
|
|
1416
|
+
padding: var(--cm-space-8); background: var(--cm-bg-surface); border: var(--cm-border-1) solid var(--cm-border-subtle);
|
|
1417
|
+
border-radius: var(--cm-radius-md); box-shadow: var(--cm-shadow-md);
|
|
1418
1418
|
}
|
|
1419
1419
|
.pop.end { inset-inline-start: auto; inset-inline-end: 0; }
|
|
1420
|
-
.pop-h { display: flex; align-items: center; justify-content: space-between; gap: var(--cm-space-
|
|
1420
|
+
.pop-h { display: flex; align-items: center; justify-content: space-between; gap: var(--cm-space-8); margin-block-end: var(--cm-space-4); font-size: 14px; font-weight: 500; }
|
|
1421
1421
|
.pop ul, .ag-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
|
|
1422
|
-
.chip.list { min-height: 40px; padding:
|
|
1422
|
+
.chip.list { min-height: 40px; padding: var(--cm-space-4) var(--cm-space-8); flex-wrap: wrap; column-gap: var(--cm-space-8); row-gap: 0; white-space: normal; font-size: 14px; line-height: 20px; }
|
|
1423
1423
|
.chip.list .h { flex: 1 1 8rem; overflow-wrap: anywhere; }
|
|
1424
1424
|
.chip.list .k { font-size: 12px; }
|
|
1425
1425
|
|
|
@@ -1432,36 +1432,37 @@ CmCalendar.styles = [
|
|
|
1432
1432
|
}
|
|
1433
1433
|
.dayb:hover { background: var(--cm-bg-hover); }
|
|
1434
1434
|
td[aria-selected='true'] .num { box-shadow: 0 0 0 2px var(--cm-border-strong); }
|
|
1435
|
-
.dots { display: flex; gap: 2px; height: 6px; }
|
|
1436
|
-
.dot { width: 6px; height: 6px; border-radius: var(--cm-radius-full); background: var(--bar); }
|
|
1437
|
-
.agenda { display: flex; flex-direction: column; gap: var(--cm-space-
|
|
1438
|
-
.ag-h { display: flex; align-items: center; justify-content: space-between; gap: var(--cm-space-
|
|
1439
|
-
.ag-t { margin: 0; font-size: 16px; line-height: 24px; font-weight:
|
|
1440
|
-
.empty { margin: 0; padding: var(--cm-space-
|
|
1435
|
+
.dots { display: flex; gap: 2px; height: 6px; } /* scale-exempt: event dots are a mark, not a layout size */
|
|
1436
|
+
.dot { width: 6px; height: 6px; /* scale-exempt: event dot */ border-radius: var(--cm-radius-full); background: var(--bar); }
|
|
1437
|
+
.agenda { display: flex; flex-direction: column; gap: var(--cm-space-8); }
|
|
1438
|
+
.ag-h { display: flex; align-items: center; justify-content: space-between; gap: var(--cm-space-8); }
|
|
1439
|
+
.ag-t { margin: 0; font-size: 16px; line-height: 24px; font-weight: 600; }
|
|
1440
|
+
.empty { margin: 0; padding: var(--cm-space-12) 0; color: var(--cm-text-tertiary); font-size: 14px; }
|
|
1441
1441
|
|
|
1442
1442
|
/* Week and day */
|
|
1443
1443
|
.tg {
|
|
1444
1444
|
--h: var(--cm-calendar-hour-height, 48px); --axis: 56px;
|
|
1445
1445
|
position: relative; max-block-size: var(--cm-calendar-time-height, 600px); overflow-y: auto; overscroll-behavior: contain;
|
|
1446
|
-
border: var(--cm-border-1) solid var(--cm-border-
|
|
1446
|
+
border: var(--cm-border-1) solid var(--cm-border-subtle); border-radius: var(--cm-radius-md); background: var(--cm-bg-surface);
|
|
1447
1447
|
scroll-padding-block-start: 104px;
|
|
1448
1448
|
}
|
|
1449
1449
|
.narrow .tg { --axis: 44px; }
|
|
1450
1450
|
.row { display: grid; grid-template-columns: var(--axis) repeat(var(--cols), minmax(0, 1fr)); }
|
|
1451
|
-
.tg-top { position: sticky; inset-block-start: 0; z-index: 4; background: var(--cm-bg-surface); border-block-end: var(--cm-border-1) solid var(--cm-border-
|
|
1452
|
-
.colh { padding:
|
|
1451
|
+
.tg-top { position: sticky; inset-block-start: 0; z-index: 4; background: var(--cm-bg-surface); border-block-end: var(--cm-border-1) solid var(--cm-border-subtle); }
|
|
1452
|
+
.colh { padding: var(--cm-space-4) 2px; text-align: center; font-size: 12px; line-height: 16px; color: var(--cm-text-tertiary); border-inline-start: var(--cm-border-1) solid var(--cm-border-subtle); min-width: 0; overflow: hidden; }
|
|
1453
1453
|
.colh .dn { display: inline-grid; place-items: center; min-width: 28px; height: 28px; margin-block-start: 2px; padding: 0 4px; border-radius: var(--cm-radius-full); font-size: 16px; line-height: 24px; font-weight: 500; color: var(--cm-text-default); }
|
|
1454
1454
|
.colh .wd { display: block; }
|
|
1455
|
-
.axis { padding-inline-end:
|
|
1455
|
+
.axis { padding-inline-end: var(--cm-space-8); font-size: 12px; line-height: 16px; color: var(--cm-text-tertiary); text-align: end; }
|
|
1456
1456
|
.adrow .axis { align-self: center; padding-block: 4px; overflow-wrap: anywhere; }
|
|
1457
|
-
.adcell { position: relative; display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 4px; min-height: 36px; border-inline-start: var(--cm-border-1) solid var(--cm-border-
|
|
1457
|
+
.adcell { position: relative; display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 4px; min-height: 36px; border-inline-start: var(--cm-border-1) solid var(--cm-border-subtle); }
|
|
1458
1458
|
.adcell.over { box-shadow: inset 0 0 0 2px var(--cm-border-strong); }
|
|
1459
1459
|
.adcell .add { align-self: flex-end; width: 24px; height: 24px; }
|
|
1460
1460
|
.hr .axis span { position: relative; inset-block-start: -8px; }
|
|
1461
1461
|
.hr:first-child .axis span { inset-block-start: 0; }
|
|
1462
|
-
.tcell { position: relative; block-size: var(--h); min-width: 0; border-inline-start: var(--cm-border-1) solid var(--cm-border-
|
|
1462
|
+
.tcell { position: relative; block-size: var(--h); min-width: 0; border-inline-start: var(--cm-border-1) solid var(--cm-border-subtle); border-block-start: var(--cm-border-1) solid var(--cm-border-subtle); }
|
|
1463
1463
|
.hr:first-child .tcell { border-block-start: 0; }
|
|
1464
|
-
.slot { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; background: none; cursor: pointer; color: var(--cm-icon-selected); font-size:
|
|
1464
|
+
.slot { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; background: none; cursor: pointer; color: var(--cm-icon-selected); font-size: 16px; line-height: 1; }
|
|
1465
|
+
|
|
1465
1466
|
.slot:hover { background: var(--cm-bg-hover); }
|
|
1466
1467
|
.slot:hover::after, .slot:focus-visible::after { content: '+'; }
|
|
1467
1468
|
.slot:focus-visible { outline-offset: -2px; }
|
|
@@ -27,7 +27,7 @@ export declare class CmCard extends LitElement {
|
|
|
27
27
|
};
|
|
28
28
|
/** Card title, rendered as a heading at `heading-level`. */
|
|
29
29
|
heading: string;
|
|
30
|
-
/** One sentence under the title in text-tertiary. */
|
|
30
|
+
/** One sentence under the title, 13px in text-tertiary. */
|
|
31
31
|
description: string;
|
|
32
32
|
/** Removes body padding, for lists and tables that run edge to edge. */
|
|
33
33
|
flush: boolean;
|
package/dist/components/card.js
CHANGED
|
@@ -30,7 +30,7 @@ export class CmCard extends LitElement {
|
|
|
30
30
|
_CmCard_instances.add(this);
|
|
31
31
|
/** Card title, rendered as a heading at `heading-level`. */
|
|
32
32
|
this.heading = '';
|
|
33
|
-
/** One sentence under the title in text-tertiary. */
|
|
33
|
+
/** One sentence under the title, 13px in text-tertiary. */
|
|
34
34
|
this.description = '';
|
|
35
35
|
/** Removes body padding, for lists and tables that run edge to edge. */
|
|
36
36
|
this.flush = false;
|
|
@@ -76,9 +76,11 @@ CmCard.styles = [
|
|
|
76
76
|
base,
|
|
77
77
|
css `
|
|
78
78
|
:host { display: block; }
|
|
79
|
+
/* Flat: a 1px border-subtle and no shadow (shadows are for overlays). 16px 20px around the header, 20px around the body. */
|
|
79
80
|
section {
|
|
80
|
-
background: var(--cm-bg-surface); border: var(--cm-border-1) solid var(--cm-border-
|
|
81
|
-
border-radius: var(--cm-radius-md); padding: var(--cm-space-20);
|
|
81
|
+
background: var(--cm-bg-surface); border: var(--cm-border-1) solid var(--cm-border-subtle);
|
|
82
|
+
border-radius: var(--cm-radius-md); padding: var(--cm-space-16) var(--cm-space-20) var(--cm-space-20);
|
|
83
|
+
font-size: var(--cm-font-size-14); line-height: var(--cm-line-height-14);
|
|
82
84
|
}
|
|
83
85
|
:host([flush]) section { padding: 0; }
|
|
84
86
|
/* Wraps only on narrow cards. .main grows from a 0 basis (wide cards look exactly as before: its content stays
|
|
@@ -86,24 +88,28 @@ CmCard.styles = [
|
|
|
86
88
|
the actions move under the title only when the heading would get less than that. */
|
|
87
89
|
header {
|
|
88
90
|
display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between;
|
|
89
|
-
gap: var(--cm-space-
|
|
91
|
+
gap: var(--cm-space-8) var(--cm-space-16); margin-bottom: var(--cm-space-12);
|
|
90
92
|
}
|
|
91
|
-
:
|
|
92
|
-
|
|
93
|
+
/* Flush: the header keeps its padding and the body (a list, a table) starts right under it. */
|
|
94
|
+
:host([flush]) header { padding: var(--cm-space-16) var(--cm-space-20) 0; margin-bottom: var(--cm-space-8); }
|
|
95
|
+
.main { flex: 1 1 0%; max-inline-size: 100%; align-self: center; }
|
|
93
96
|
.strut {
|
|
94
97
|
display: block; block-size: 0; overflow: hidden; visibility: hidden; white-space: nowrap;
|
|
95
98
|
max-inline-size: 12ch; font-size: var(--cm-type-heading-sm-size); font-weight: 600;
|
|
96
99
|
}
|
|
97
|
-
.title {
|
|
100
|
+
.title {
|
|
101
|
+
margin: 0; font-size: var(--cm-type-heading-sm-size); line-height: var(--cm-type-heading-sm-line-height); font-weight: 600;
|
|
102
|
+
display: flex; flex-wrap: wrap; align-items: center; gap: var(--cm-space-8);
|
|
103
|
+
}
|
|
98
104
|
/* Flex-wrap moves the badges under the heading before the heading itself would wrap. */
|
|
99
|
-
.adornment { display: flex; flex-wrap: wrap; align-items: center; gap: var(--cm-space-
|
|
105
|
+
.adornment { display: flex; flex-wrap: wrap; align-items: center; gap: var(--cm-space-8); }
|
|
100
106
|
.adornment[hidden] { display: none; }
|
|
101
|
-
.desc { margin:
|
|
102
|
-
.actions { display: flex; flex-wrap: wrap; gap: var(--cm-space-
|
|
107
|
+
.desc { margin: var(--cm-space-4) 0 0; font-size: var(--cm-font-size-13); line-height: var(--cm-line-height-13); color: var(--cm-text-tertiary); }
|
|
108
|
+
.actions { display: flex; flex-wrap: wrap; gap: var(--cm-space-8); align-items: center; }
|
|
103
109
|
/* Actions on a card without a heading or description: a row of their own, at the end. */
|
|
104
|
-
.bare { display: flex; justify-content: flex-end; margin-bottom: var(--cm-space-
|
|
110
|
+
.bare { display: flex; justify-content: flex-end; margin-bottom: var(--cm-space-12); }
|
|
105
111
|
.bare[hidden] { display: none; }
|
|
106
|
-
:host([flush]) .bare { padding: var(--cm-space-
|
|
112
|
+
:host([flush]) .bare { padding: var(--cm-space-16) var(--cm-space-20) 0; margin-bottom: var(--cm-space-8); }
|
|
107
113
|
`,
|
|
108
114
|
];
|
|
109
115
|
define('cm-card', CmCard);
|
|
@@ -99,20 +99,21 @@ CmCheckbox.styles = [
|
|
|
99
99
|
base,
|
|
100
100
|
css `
|
|
101
101
|
:host { display: inline-flex; }
|
|
102
|
-
label { position: relative; display: inline-flex; align-items: flex-start; gap: var(--cm-space-
|
|
103
|
-
|
|
102
|
+
label { position: relative; display: inline-flex; align-items: flex-start; gap: var(--cm-space-8); padding-block: 2px; cursor: pointer; }
|
|
103
|
+
/* The 16px box sits on the label's first line (20px); the invisible input around it is a 24px target. */
|
|
104
|
+
input { position: absolute; inset-block-start: 0; inset-inline-start: -4px; opacity: 0; width: 24px; height: 24px; margin: 0; cursor: inherit; }
|
|
104
105
|
.box {
|
|
105
|
-
flex: none; width:
|
|
106
|
+
flex: none; width: 16px; height: 16px; margin-block: 2px; display: inline-flex; align-items: center; justify-content: center;
|
|
106
107
|
border: var(--cm-border-1) solid var(--cm-border-strong); border-radius: var(--cm-radius-xs);
|
|
107
108
|
background: var(--cm-bg-surface); color: transparent;
|
|
108
109
|
}
|
|
109
110
|
input:checked + .box, input:indeterminate + .box { color: var(--cm-text-default); }
|
|
110
111
|
input:focus-visible + .box { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
111
|
-
.text { display: flex; flex-direction: column; gap:
|
|
112
|
-
.label { font-size:
|
|
113
|
-
.desc { font-size:
|
|
112
|
+
.text { display: flex; flex-direction: column; gap: 2px; }
|
|
113
|
+
.label { font-size: var(--cm-type-body-md-size); line-height: var(--cm-type-body-md-line-height); }
|
|
114
|
+
.desc { font-size: var(--cm-type-body-sm-size); line-height: var(--cm-type-body-sm-line-height); color: var(--cm-text-tertiary); }
|
|
114
115
|
:host([disabled]) label { cursor: not-allowed; }
|
|
115
|
-
:host([disabled]) .box { background: var(--cm-bg-input-filled); border-color: var(--cm-border-
|
|
116
|
+
:host([disabled]) .box { background: var(--cm-bg-input-filled); border-color: var(--cm-border-subtle); }
|
|
116
117
|
:host([disabled]) .label { color: var(--cm-text-secondary); }
|
|
117
118
|
`,
|
|
118
119
|
];
|
|
@@ -12,6 +12,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
12
12
|
var _CmColorField_instances, _CmColorField_internals, _CmColorField_id, _CmColorField_defaultValue, _CmColorField_typed, _CmColorField_emit, _CmColorField_pick, _CmColorField_onSwatchKey, _CmColorField_onHexInput, _CmColorField_commitHex, _CmColorField_onHexChange, _CmColorField_onHexKey, _CmColorField_onPickerInput, _CmColorField_onPickerChange;
|
|
13
13
|
import { LitElement, html, css, nothing } from 'lit';
|
|
14
14
|
import { live } from 'lit/directives/live.js';
|
|
15
|
+
import { fieldStyles } from '../field.js';
|
|
15
16
|
import { base, define, nextId, logicalKey } from '../base.js';
|
|
16
17
|
import { CmLocalizedElement, defineStrings } from '../localize.js';
|
|
17
18
|
import './icon.js';
|
|
@@ -199,7 +200,7 @@ export class CmColorField extends CmLocalizedElement {
|
|
|
199
200
|
return html `<button type="button" class="swatch" part="swatch" role="radio" aria-checked=${i === sel ? 'true' : 'false'}
|
|
200
201
|
aria-label=${name} title=${s.name || s.value} tabindex=${i === (sel >= 0 ? sel : 0) ? '0' : '-1'} ?disabled=${this.disabled}
|
|
201
202
|
style="background-color:${s.value};color:${checkColor(s.value)}"
|
|
202
|
-
@click=${() => __classPrivateFieldGet(this, _CmColorField_instances, "m", _CmColorField_pick).call(this, i)} @keydown=${(e) => __classPrivateFieldGet(this, _CmColorField_instances, "m", _CmColorField_onSwatchKey).call(this, e, i)}><cm-icon name="check" size="
|
|
203
|
+
@click=${() => __classPrivateFieldGet(this, _CmColorField_instances, "m", _CmColorField_pick).call(this, i)} @keydown=${(e) => __classPrivateFieldGet(this, _CmColorField_instances, "m", _CmColorField_onSwatchKey).call(this, e, i)}><cm-icon name="check" size="16"></cm-icon></button>`;
|
|
203
204
|
})}
|
|
204
205
|
</div>`
|
|
205
206
|
: nothing}
|
|
@@ -321,13 +322,10 @@ CmColorField.properties = {
|
|
|
321
322
|
};
|
|
322
323
|
CmColorField.styles = [
|
|
323
324
|
base,
|
|
325
|
+
fieldStyles,
|
|
324
326
|
css `
|
|
325
327
|
:host { display: block; }
|
|
326
|
-
.
|
|
327
|
-
.label { font-size: var(--cm-type-label-size); color: var(--cm-text-default); }
|
|
328
|
-
.req { color: var(--cm-text-critical); margin-inline-start: 2px; }
|
|
329
|
-
.hint { margin-inline-start: var(--cm-space-10); font-size: 12px; color: var(--cm-text-tertiary); text-transform: lowercase; }
|
|
330
|
-
.swatches { display: flex; flex-wrap: wrap; gap: var(--cm-space-10); padding: 4px; margin: -4px; }
|
|
328
|
+
.swatches { display: flex; flex-wrap: wrap; gap: var(--cm-space-8); padding: 4px; margin: -4px; }
|
|
331
329
|
.swatch {
|
|
332
330
|
position: relative; display: inline-flex; align-items: center; justify-content: center;
|
|
333
331
|
width: 32px; height: 32px; padding: 0; cursor: pointer; border-radius: var(--cm-radius-full);
|
|
@@ -338,9 +336,9 @@ CmColorField.styles = [
|
|
|
338
336
|
.swatch[aria-checked='true'] cm-icon { visibility: visible; }
|
|
339
337
|
.swatch:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 6px; }
|
|
340
338
|
.swatch:disabled { cursor: not-allowed; opacity: 0.4; }
|
|
341
|
-
.row { display: flex; align-items: center; gap: var(--cm-space-
|
|
339
|
+
.row { display: flex; align-items: center; gap: var(--cm-space-8); }
|
|
342
340
|
.preview, .pick {
|
|
343
|
-
position: relative; flex: none; width:
|
|
341
|
+
position: relative; flex: none; width: var(--_cm-field-h); height: var(--_cm-field-h); border-radius: var(--cm-radius-sm);
|
|
344
342
|
border: var(--cm-border-1) solid var(--cm-border-input); background: var(--cm-bg-inset);
|
|
345
343
|
}
|
|
346
344
|
.pick { cursor: pointer; }
|
|
@@ -351,19 +349,17 @@ CmColorField.styles = [
|
|
|
351
349
|
background: var(--cm-bg-surface); color: var(--cm-text-default); border: var(--cm-border-1) solid var(--cm-border-input);
|
|
352
350
|
}
|
|
353
351
|
.input {
|
|
354
|
-
width: 11ch; min-width: 0; flex: 0 1 auto; height:
|
|
355
|
-
font: inherit; font-size:
|
|
352
|
+
width: 11ch; min-width: 0; flex: 0 1 auto; height: calc(var(--_cm-field-h) - 2px); padding: 0 var(--_cm-field-pad);
|
|
353
|
+
font: inherit; font-size: var(--_cm-field-font); font-variant-numeric: tabular-nums; color: var(--cm-text-default);
|
|
356
354
|
background: var(--cm-bg-surface); border: var(--cm-border-1) solid var(--cm-border-input);
|
|
357
355
|
border-radius: var(--cm-radius-sm); outline: none; box-sizing: content-box;
|
|
358
356
|
}
|
|
359
357
|
.input::placeholder { color: var(--cm-text-tertiary); }
|
|
360
358
|
.input:focus { border-color: var(--cm-border-strong); box-shadow: 0 0 0 1px var(--cm-border-strong); }
|
|
361
359
|
.input[aria-invalid='true'] { border-color: var(--cm-border-critical); }
|
|
362
|
-
.input:disabled { background: var(--cm-bg-input-filled); color: var(--cm-text-secondary); border-color: var(--cm-border-
|
|
360
|
+
.input:disabled { background: var(--cm-bg-input-filled); color: var(--cm-text-secondary); border-color: var(--cm-border-subtle); cursor: not-allowed; }
|
|
363
361
|
:host([disabled]) .pick { cursor: not-allowed; opacity: 0.4; }
|
|
364
362
|
:host([disabled]) .preview { opacity: 0.4; }
|
|
365
|
-
.help { margin: 0; font-size: 12px; color: var(--cm-text-tertiary); }
|
|
366
|
-
.error { margin: 0; font-size: 12px; color: var(--cm-text-critical); }
|
|
367
363
|
`,
|
|
368
364
|
];
|
|
369
365
|
define('cm-color-field', CmColorField);
|
|
@@ -79,6 +79,9 @@ export declare class CmCombobox extends CmLocalizedElement {
|
|
|
79
79
|
type: BooleanConstructor;
|
|
80
80
|
reflect: boolean;
|
|
81
81
|
};
|
|
82
|
+
size: {
|
|
83
|
+
reflect: boolean;
|
|
84
|
+
};
|
|
82
85
|
allowCustom: {
|
|
83
86
|
type: BooleanConstructor;
|
|
84
87
|
attribute: string;
|
|
@@ -143,6 +146,11 @@ export declare class CmCombobox extends CmLocalizedElement {
|
|
|
143
146
|
options: Array<string | SelectOption>;
|
|
144
147
|
/** Lets the merchant choose several options, shown as removable tags. Backspace in the empty box removes the last one. */
|
|
145
148
|
multiple: boolean;
|
|
149
|
+
/**
|
|
150
|
+
* `small`: a 32px box with a 13px label, for toolbars, filter rows and filter panels. Default: a 36px box. On touch
|
|
151
|
+
* screens both are 44px. Since 1.5.
|
|
152
|
+
*/
|
|
153
|
+
size: 'default' | 'small';
|
|
146
154
|
/** Lets the merchant add what they typed when it isn't an option ("Add “summer”"). Fires a cancelable `cm-create`. */
|
|
147
155
|
allowCustom: boolean;
|
|
148
156
|
/** How typing narrows the list: `contains` (default), `starts-with`, or `none` when you filter on the server from `cm-search`. */
|
|
@@ -12,6 +12,7 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
|
|
|
12
12
|
var _CmCombobox_instances, _CmCombobox_internals, _CmCombobox_id, _CmCombobox_default, _CmCombobox_labels, _CmCombobox_groups, _CmCombobox_observer, _CmCombobox_stopOutside, _CmCombobox_readChildren, _CmCombobox_labelOf, _CmCombobox_displayOf, _CmCombobox_createText_get, _CmCombobox_rows, _CmCombobox_emit, _CmCombobox_show, _CmCombobox_hide, _CmCombobox_enabled, _CmCombobox_move, _CmCombobox_choose, _CmCombobox_create, _CmCombobox_focusInput, _CmCombobox_onInput, _CmCombobox_onKeyDown, _CmCombobox_onBlur, _CmCombobox_highlight;
|
|
13
13
|
import { LitElement, html, css, nothing } from 'lit';
|
|
14
14
|
import { live } from 'lit/directives/live.js';
|
|
15
|
+
import { fieldStyles, optionStyles } from '../field.js';
|
|
15
16
|
import { base, define, nextId } from '../base.js';
|
|
16
17
|
import { CmLocalizedElement, defineStrings } from '../localize.js';
|
|
17
18
|
import { popoverStyles, groupStyles, sortByGroup, groupRuns, closeOnOutsidePointer } from '../popover.js';
|
|
@@ -75,6 +76,11 @@ export class CmCombobox extends CmLocalizedElement {
|
|
|
75
76
|
this.options = [];
|
|
76
77
|
/** Lets the merchant choose several options, shown as removable tags. Backspace in the empty box removes the last one. */
|
|
77
78
|
this.multiple = false;
|
|
79
|
+
/**
|
|
80
|
+
* `small`: a 32px box with a 13px label, for toolbars, filter rows and filter panels. Default: a 36px box. On touch
|
|
81
|
+
* screens both are 44px. Since 1.5.
|
|
82
|
+
*/
|
|
83
|
+
this.size = 'default';
|
|
78
84
|
/** Lets the merchant add what they typed when it isn't an option ("Add “summer”"). Fires a cancelable `cm-create`. */
|
|
79
85
|
this.allowCustom = false;
|
|
80
86
|
/** How typing narrows the list: `contains` (default), `starts-with`, or `none` when you filter on the server from `cm-search`. */
|
|
@@ -476,6 +482,7 @@ CmCombobox.properties = {
|
|
|
476
482
|
placeholder: {},
|
|
477
483
|
options: { type: Array },
|
|
478
484
|
multiple: { type: Boolean, reflect: true },
|
|
485
|
+
size: { reflect: true },
|
|
479
486
|
allowCustom: { type: Boolean, attribute: 'allow-custom' },
|
|
480
487
|
filter: {},
|
|
481
488
|
loading: { type: Boolean, reflect: true },
|
|
@@ -492,49 +499,42 @@ CmCombobox.properties = {
|
|
|
492
499
|
};
|
|
493
500
|
CmCombobox.styles = [
|
|
494
501
|
base,
|
|
502
|
+
fieldStyles,
|
|
495
503
|
popoverStyles,
|
|
504
|
+
optionStyles,
|
|
496
505
|
groupStyles,
|
|
497
506
|
css `
|
|
498
507
|
:host { display: block; position: relative; }
|
|
499
|
-
.field { display: flex; flex-direction: column; gap: var(--cm-space-10); }
|
|
500
|
-
.label { font-size: var(--cm-type-label-size); color: var(--cm-text-default); }
|
|
501
|
-
.req { color: var(--cm-text-critical); margin-inline-start: 2px; }
|
|
502
508
|
.wrap { position: relative; }
|
|
503
509
|
.box {
|
|
504
|
-
display: flex; flex-wrap: wrap; align-items: center; gap:
|
|
510
|
+
display: flex; flex-wrap: wrap; align-items: center; gap: var(--cm-space-4); width: 100%; min-height: var(--_cm-field-h);
|
|
511
|
+
padding-block: var(--cm-space-4); padding-inline: var(--_cm-field-pad) var(--cm-space-8);
|
|
505
512
|
background: var(--cm-bg-surface); border: var(--cm-border-1) solid var(--cm-border-input); border-radius: var(--cm-radius-sm); cursor: text;
|
|
506
513
|
}
|
|
514
|
+
:host([size='small']) .box { padding-block: 2px; }
|
|
507
515
|
.box:focus-within { border-color: var(--cm-border-strong); box-shadow: 0 0 0 1px var(--cm-border-strong); }
|
|
508
516
|
.tags { display: contents; }
|
|
509
517
|
input {
|
|
510
|
-
flex: 1 1 80px; min-width: 80px; height:
|
|
511
|
-
font: inherit; font-size:
|
|
518
|
+
flex: 1 1 80px; min-width: 80px; height: 24px; padding: 0; border: 0; outline: none; background: none;
|
|
519
|
+
font: inherit; font-size: var(--_cm-field-font); color: var(--cm-text-default);
|
|
512
520
|
}
|
|
513
521
|
input::placeholder { color: var(--cm-text-tertiary); }
|
|
514
|
-
.chev { flex: none; margin-inline-start: auto; color: var(--cm-icon-selected); transition: transform
|
|
522
|
+
.chev { flex: none; margin-inline-start: auto; color: var(--cm-icon-selected); transition: transform var(--cm-duration-fast) var(--cm-easing-standard); }
|
|
515
523
|
:host([open]) .chev { transform: rotate(180deg); }
|
|
516
524
|
:host([error]:not([error=''])) .box { border-color: var(--cm-border-critical); }
|
|
517
|
-
:host([disabled]) .box { background: var(--cm-bg-input-filled); border-color: var(--cm-border-
|
|
525
|
+
:host([disabled]) .box { background: var(--cm-bg-input-filled); border-color: var(--cm-border-subtle); cursor: not-allowed; }
|
|
518
526
|
:host([disabled]) input { color: var(--cm-text-secondary); cursor: not-allowed; }
|
|
519
|
-
[role='listbox'] { max-height: 242px; overflow-y: auto; margin: 0; padding: var(--cm-space-10) 0; list-style: none; }
|
|
520
527
|
[role='listbox'][hidden] { display: none; }
|
|
521
|
-
[role='option'] {
|
|
522
|
-
display: flex; align-items: center; gap: var(--cm-space-10); min-height: 40px; padding: 6px var(--cm-space-20);
|
|
523
|
-
font-size: 16px; color: var(--cm-text-default); cursor: pointer;
|
|
524
|
-
}
|
|
528
|
+
[role='option'] { gap: var(--cm-space-8); }
|
|
525
529
|
[role='option'] .check { flex: none; visibility: hidden; }
|
|
526
530
|
[role='option'][aria-selected='true'] .check { visibility: visible; }
|
|
527
|
-
[role='option'].active { background: var(--cm-bg-hover);
|
|
528
|
-
[role='option'].active:dir(rtl) { box-shadow: inset -2px 0 0 var(--cm-border-strong); }
|
|
531
|
+
[role='option'].active { background: var(--cm-bg-hover); }
|
|
529
532
|
:host(:not([multiple])) [role='option'][aria-selected='true'] { background: var(--cm-action-primary); color: var(--cm-action-primary-text); }
|
|
530
533
|
:host(:not([multiple])) [role='option'][aria-selected='true'].active { background: var(--cm-action-primary-hover); }
|
|
531
534
|
[role='option'][aria-disabled='true'] { color: var(--cm-text-secondary); cursor: not-allowed; }
|
|
532
535
|
[role='option'] mark { background: none; color: inherit; font-weight: 600; }
|
|
533
536
|
.create { font-style: normal; }
|
|
534
|
-
.help, .error { margin: 0; font-size: 12px; color: var(--cm-text-tertiary); }
|
|
535
|
-
.error { color: var(--cm-text-critical); }
|
|
536
537
|
slot { display: none; }
|
|
537
|
-
@media (max-width: 640px) { [role='option'] { font-size: 14px; min-height: 30px; padding-inline: var(--cm-space-15); } }
|
|
538
538
|
@media (prefers-reduced-motion: reduce) { .chev { transition: none; } }
|
|
539
539
|
`,
|
|
540
540
|
];
|
|
@@ -13,7 +13,7 @@ declare module '../localize.js' {
|
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
15
|
* One entry in an order or customer timeline: when it was written, what it says and who wrote it.
|
|
16
|
-
* Stack several inside any container, `space-
|
|
16
|
+
* Stack several inside any container, `space-8` apart; put a `cm-comment-box` above or below to add new ones.
|
|
17
17
|
* @element cm-comment
|
|
18
18
|
* @slot - The comment text.
|
|
19
19
|
*/
|
|
@@ -16,7 +16,7 @@ const boxStrings = defineStrings('commentBox', {
|
|
|
16
16
|
});
|
|
17
17
|
/**
|
|
18
18
|
* One entry in an order or customer timeline: when it was written, what it says and who wrote it.
|
|
19
|
-
* Stack several inside any container, `space-
|
|
19
|
+
* Stack several inside any container, `space-8` apart; put a `cm-comment-box` above or below to add new ones.
|
|
20
20
|
* @element cm-comment
|
|
21
21
|
* @slot - The comment text.
|
|
22
22
|
*/
|
|
@@ -66,11 +66,11 @@ CmComment.styles = [
|
|
|
66
66
|
css `
|
|
67
67
|
:host { display: block; }
|
|
68
68
|
article {
|
|
69
|
-
display: flex; flex-direction: column; gap:
|
|
70
|
-
background: var(--cm-bg-surface); border: var(--cm-border-1) solid var(--cm-border-
|
|
69
|
+
display: flex; flex-direction: column; gap: var(--cm-space-4); padding: var(--cm-space-12);
|
|
70
|
+
background: var(--cm-bg-surface); border: var(--cm-border-1) solid var(--cm-border-subtle); border-radius: var(--cm-radius-sm);
|
|
71
71
|
}
|
|
72
|
-
.meta { font-size:
|
|
73
|
-
.body { font-size:
|
|
72
|
+
.meta { font-size: var(--cm-font-size-12); line-height: var(--cm-line-height-12); color: var(--cm-text-tertiary); }
|
|
73
|
+
.body { font-size: var(--cm-font-size-14); line-height: var(--cm-line-height-14); overflow-wrap: anywhere; }
|
|
74
74
|
`,
|
|
75
75
|
];
|
|
76
76
|
define('cm-comment', CmComment);
|
|
@@ -121,7 +121,7 @@ export class CmCommentBox extends CmLocalizedElement {
|
|
|
121
121
|
<textarea part="input" aria-label=${this.label} placeholder=${this.placeholder || nothing} .value=${this.value}
|
|
122
122
|
?disabled=${this.disabled} @input=${(e) => { this.value = e.target.value; }}
|
|
123
123
|
@keydown=${__classPrivateFieldGet(this, _CmCommentBox_instances, "m", _CmCommentBox_key)}></textarea>
|
|
124
|
-
<div class="actions"><cm-button variant="primary"
|
|
124
|
+
<div class="actions"><cm-button variant="primary" ?disabled=${this.disabled} @click=${() => this.submit()}>${this.action}</cm-button></div>
|
|
125
125
|
<div class="list" role="list" ?hidden=${!this.hasComments}>
|
|
126
126
|
<slot @slotchange=${(e) => { this.hasComments = e.target.assignedElements().length > 0; this.requestUpdate(); }}></slot>
|
|
127
127
|
</div>
|
|
@@ -147,10 +147,10 @@ CmCommentBox.styles = [
|
|
|
147
147
|
base,
|
|
148
148
|
css `
|
|
149
149
|
:host { display: block; }
|
|
150
|
-
section { display: flex; flex-direction: column; gap: var(--cm-space-
|
|
151
|
-
.title { margin: 0; font-size:
|
|
150
|
+
section { display: flex; flex-direction: column; gap: var(--cm-space-12); }
|
|
151
|
+
.title { margin: 0; font-size: var(--cm-type-heading-sm-size); line-height: var(--cm-type-heading-sm-line-height); font-weight: 600; }
|
|
152
152
|
textarea {
|
|
153
|
-
display: block; width: 100%; min-height: 128px; padding: var(--cm-space-
|
|
153
|
+
display: block; width: 100%; min-height: 128px; padding: var(--cm-space-8); resize: vertical;
|
|
154
154
|
border: var(--cm-border-1) solid var(--cm-border-input); border-radius: var(--cm-radius-sm);
|
|
155
155
|
background: var(--cm-bg-surface); color: var(--cm-text-default); font: inherit; font-size: 14px;
|
|
156
156
|
}
|
|
@@ -158,12 +158,11 @@ CmCommentBox.styles = [
|
|
|
158
158
|
textarea:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 0; border-color: var(--cm-border-strong); }
|
|
159
159
|
textarea:disabled { background: var(--cm-bg-input-filled); color: var(--cm-text-secondary); }
|
|
160
160
|
.actions { display: flex; }
|
|
161
|
-
.list { display: flex; flex-direction: column; gap: var(--cm-space-
|
|
161
|
+
.list { display: flex; flex-direction: column; gap: var(--cm-space-8); }
|
|
162
162
|
.list[hidden] { display: none; }
|
|
163
163
|
@media (max-width: 640px) {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
textarea { min-height: 100px; }
|
|
164
|
+
textarea { min-height: 96px; }
|
|
165
|
+
|
|
167
166
|
.actions { justify-content: flex-end; }
|
|
168
167
|
}
|
|
169
168
|
`,
|