@commmerce/ui 1.4.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/calendar.js +15 -19
- package/dist/cdn.js +1267 -1138
- package/dist/components/accordion.js +9 -8
- package/dist/components/action-bar.js +15 -15
- package/dist/components/action-menu.js +10 -9
- package/dist/components/app-card.js +15 -14
- package/dist/components/app-frame.d.ts +14 -0
- package/dist/components/app-frame.js +20 -1
- package/dist/components/badge.d.ts +2 -1
- package/dist/components/badge.js +4 -3
- package/dist/components/banner.js +6 -5
- package/dist/components/board.js +18 -18
- package/dist/components/bottom-navigation.d.ts +1 -1
- package/dist/components/bottom-navigation.js +9 -7
- package/dist/components/bottom-sheet.d.ts +1 -1
- package/dist/components/bottom-sheet.js +9 -8
- package/dist/components/button.d.ts +3 -3
- package/dist/components/button.js +22 -19
- package/dist/components/calendar.js +29 -28
- package/dist/components/card.d.ts +1 -1
- package/dist/components/card.js +18 -12
- package/dist/components/checkbox.js +8 -7
- package/dist/components/color-field.js +9 -13
- package/dist/components/combobox.d.ts +8 -0
- package/dist/components/combobox.js +18 -18
- package/dist/components/comment.d.ts +1 -1
- package/dist/components/comment.js +12 -13
- package/dist/components/data-table.js +12 -11
- package/dist/components/date-picker.js +1 -1
- package/dist/components/date-range-picker.js +7 -7
- package/dist/components/empty-state.d.ts +1 -1
- package/dist/components/empty-state.js +16 -16
- package/dist/components/file-upload.js +18 -16
- package/dist/components/filter-panel.js +1 -1
- package/dist/components/flash-offer-bar.js +8 -7
- package/dist/components/global-search.d.ts +1 -1
- package/dist/components/global-search.js +12 -9
- package/dist/components/grid.d.ts +1 -1
- package/dist/components/grid.js +1 -1
- package/dist/components/header-bar.js +38 -31
- package/dist/components/info-panel.d.ts +1 -1
- package/dist/components/info-panel.js +11 -10
- package/dist/components/layout.d.ts +1 -1
- package/dist/components/layout.js +1 -1
- package/dist/components/link-tabs.js +8 -7
- package/dist/components/metric.js +4 -4
- package/dist/components/mobile-menu.js +16 -15
- package/dist/components/modal.js +2 -1
- package/dist/components/nested-list.d.ts +2 -2
- package/dist/components/nested-list.js +21 -22
- package/dist/components/notification-panel.js +12 -11
- package/dist/components/option-group.js +10 -11
- package/dist/components/page-header.js +16 -15
- package/dist/components/page.d.ts +18 -4
- package/dist/components/page.js +22 -7
- package/dist/components/pagination.d.ts +1 -1
- package/dist/components/pagination.js +16 -9
- package/dist/components/progress-bar.js +4 -3
- package/dist/components/radio.js +12 -12
- package/dist/components/report-tile.d.ts +2 -2
- package/dist/components/report-tile.js +18 -18
- package/dist/components/resource-list.d.ts +22 -6
- package/dist/components/resource-list.js +92 -52
- package/dist/components/save-bar.js +8 -8
- package/dist/components/search.d.ts +5 -2
- package/dist/components/search.js +20 -14
- package/dist/components/segmented-control.d.ts +67 -0
- package/dist/components/segmented-control.js +76 -0
- package/dist/components/select.d.ts +8 -0
- package/dist/components/select.js +18 -18
- package/dist/components/side-navigation.js +20 -17
- package/dist/components/side-panel.js +4 -3
- package/dist/components/signature-field.js +20 -18
- package/dist/components/skeleton-display.js +4 -4
- package/dist/components/skeleton.d.ts +1 -1
- package/dist/components/skeleton.js +2 -2
- package/dist/components/smart-tip.d.ts +1 -1
- package/dist/components/smart-tip.js +16 -16
- package/dist/components/spinner.js +1 -1
- package/dist/components/stack.d.ts +1 -1
- package/dist/components/stack.js +1 -1
- package/dist/components/status-tabs.d.ts +4 -3
- package/dist/components/status-tabs.js +26 -12
- package/dist/components/table-header.d.ts +4 -3
- package/dist/components/table-header.js +22 -15
- package/dist/components/tag.js +3 -4
- package/dist/components/text-field.d.ts +1 -1
- package/dist/components/text-field.js +8 -15
- package/dist/components/thumbnail.js +1 -1
- package/dist/components/timeline.js +12 -11
- package/dist/components/toast.js +6 -6
- package/dist/components/toggle.js +12 -11
- package/dist/components/tooltip.js +4 -3
- package/dist/custom-elements.json +929 -160
- package/dist/field.d.ts +15 -0
- package/dist/field.js +47 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/overlay.js +5 -4
- package/dist/popover.js +8 -8
- package/dist/spacing.d.ts +14 -4
- package/dist/spacing.js +13 -4
- package/package.json +3 -3
package/dist/field.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The field scale (1.5.0), shared by every labelled form control: cm-text-field, cm-select, cm-combobox, cm-search,
|
|
3
|
+
* cm-date-picker, cm-date-range-picker and cm-color-field.
|
|
4
|
+
*
|
|
5
|
+
* - Box height `--_cm-field-h`: 36px (`--cm-control-height-md`), 32px with `size="small"` (toolbars and filters),
|
|
6
|
+
* 44px on touch screens (`pointer: coarse`) whatever the size, so every field stays easy to tap.
|
|
7
|
+
* - Value text 14px; 16px on touch screens, where smaller text makes iOS Safari zoom the page on focus.
|
|
8
|
+
* - Label 14px medium, 8px above the box (13px and 4px when small); help and error text 13px under it.
|
|
9
|
+
*
|
|
10
|
+
* A component sets `height: var(--_cm-field-h)` and `font-size: var(--_cm-field-font)` on its box and uses the
|
|
11
|
+
* `.field`, `.label`, `.req`, `.hint`, `.help` and `.error` classes.
|
|
12
|
+
*/
|
|
13
|
+
export declare const fieldStyles: import("lit").CSSResult;
|
|
14
|
+
/** Options in a dropdown list (cm-select, cm-combobox): 32px rows of 14px text, 36px on touch screens. */
|
|
15
|
+
export declare const optionStyles: import("lit").CSSResult;
|
package/dist/field.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
/**
|
|
3
|
+
* The field scale (1.5.0), shared by every labelled form control: cm-text-field, cm-select, cm-combobox, cm-search,
|
|
4
|
+
* cm-date-picker, cm-date-range-picker and cm-color-field.
|
|
5
|
+
*
|
|
6
|
+
* - Box height `--_cm-field-h`: 36px (`--cm-control-height-md`), 32px with `size="small"` (toolbars and filters),
|
|
7
|
+
* 44px on touch screens (`pointer: coarse`) whatever the size, so every field stays easy to tap.
|
|
8
|
+
* - Value text 14px; 16px on touch screens, where smaller text makes iOS Safari zoom the page on focus.
|
|
9
|
+
* - Label 14px medium, 8px above the box (13px and 4px when small); help and error text 13px under it.
|
|
10
|
+
*
|
|
11
|
+
* A component sets `height: var(--_cm-field-h)` and `font-size: var(--_cm-field-font)` on its box and uses the
|
|
12
|
+
* `.field`, `.label`, `.req`, `.hint`, `.help` and `.error` classes.
|
|
13
|
+
*/
|
|
14
|
+
export const fieldStyles = css `
|
|
15
|
+
:host {
|
|
16
|
+
--_cm-field-h: var(--cm-control-height-md, 36px);
|
|
17
|
+
--_cm-field-font: var(--cm-font-size-14, 14px);
|
|
18
|
+
--_cm-field-pad: var(--cm-space-12, 12px);
|
|
19
|
+
}
|
|
20
|
+
:host([size='small']) { --_cm-field-h: var(--cm-control-height-sm, 32px); --_cm-field-pad: var(--cm-space-8, 8px); }
|
|
21
|
+
@media (pointer: coarse) {
|
|
22
|
+
:host, :host([size='small']) { --_cm-field-h: var(--cm-control-height-touch, 44px); --_cm-field-font: var(--cm-font-size-16, 16px); }
|
|
23
|
+
}
|
|
24
|
+
.field { display: flex; flex-direction: column; gap: var(--cm-space-8); }
|
|
25
|
+
.label {
|
|
26
|
+
font-size: var(--cm-type-label-size); line-height: var(--cm-type-label-line-height); font-weight: var(--cm-type-label-weight);
|
|
27
|
+
color: var(--cm-text-default);
|
|
28
|
+
}
|
|
29
|
+
.req { color: var(--cm-text-critical); margin-inline-start: 2px; }
|
|
30
|
+
.hint { margin-inline-start: var(--cm-space-8); font-size: var(--cm-type-body-sm-size); font-weight: 400; color: var(--cm-text-tertiary); text-transform: lowercase; }
|
|
31
|
+
.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); }
|
|
32
|
+
.error { color: var(--cm-text-critical); }
|
|
33
|
+
:host([size='small']) .field { gap: var(--cm-space-4); }
|
|
34
|
+
:host([size='small']) .label { font-size: var(--cm-font-size-13); line-height: var(--cm-line-height-13); }
|
|
35
|
+
`;
|
|
36
|
+
/** Options in a dropdown list (cm-select, cm-combobox): 32px rows of 14px text, 36px on touch screens. */
|
|
37
|
+
export const optionStyles = css `
|
|
38
|
+
[role='listbox'] {
|
|
39
|
+
max-height: 264px; overflow-y: auto; margin: 0; padding: var(--cm-space-4); list-style: none;
|
|
40
|
+
}
|
|
41
|
+
[role='option'] {
|
|
42
|
+
display: flex; align-items: center; min-height: var(--cm-control-height-sm, 32px); padding: var(--cm-space-4) var(--cm-space-8);
|
|
43
|
+
font-size: var(--cm-font-size-14); line-height: var(--cm-line-height-14); color: var(--cm-text-default);
|
|
44
|
+
border-radius: var(--cm-radius-sm); cursor: pointer;
|
|
45
|
+
}
|
|
46
|
+
@media (pointer: coarse) { [role='option'] { min-height: var(--cm-control-height-touch, 44px); } }
|
|
47
|
+
`;
|
package/dist/index.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export type { ColorSwatch } from './components/color-field.js';
|
|
|
18
18
|
export { CmSignatureField } from './components/signature-field.js';
|
|
19
19
|
export { CmOptionGroup } from './components/option-group.js';
|
|
20
20
|
export type { OptionGroupOption } from './components/option-group.js';
|
|
21
|
+
export { CmSegmentedControl } from './components/segmented-control.js';
|
|
21
22
|
export { CmTag } from './components/tag.js';
|
|
22
23
|
export { CmPageHeader } from './components/page-header.js';
|
|
23
24
|
export type { Breadcrumb } from './components/page-header.js';
|
package/dist/index.js
CHANGED
|
@@ -13,6 +13,7 @@ export { CmFileUpload } from './components/file-upload.js';
|
|
|
13
13
|
export { CmColorField, normalizeHex } from './components/color-field.js';
|
|
14
14
|
export { CmSignatureField } from './components/signature-field.js';
|
|
15
15
|
export { CmOptionGroup } from './components/option-group.js';
|
|
16
|
+
export { CmSegmentedControl } from './components/segmented-control.js';
|
|
16
17
|
export { CmTag } from './components/tag.js';
|
|
17
18
|
export { CmPageHeader } from './components/page-header.js';
|
|
18
19
|
export { CmActionBar } from './components/action-bar.js';
|
package/dist/overlay.js
CHANGED
|
@@ -179,7 +179,7 @@ CmOverlay.overlayStyles = [
|
|
|
179
179
|
overflow: hidden; outline: none;
|
|
180
180
|
}
|
|
181
181
|
.head {
|
|
182
|
-
display: flex; align-items: center; gap: var(--cm-space-
|
|
182
|
+
display: flex; align-items: center; gap: var(--cm-space-8); flex: none; min-height: 40px; padding-block: var(--cm-space-8); padding-inline: var(--cm-space-16) var(--cm-space-8);
|
|
183
183
|
background: var(--cm-bg-panel-header); color: var(--cm-text-on-dark);
|
|
184
184
|
}
|
|
185
185
|
.head h2 { flex: 1; min-width: 0; margin: 0; font-size: 14px; line-height: 20px; font-weight: 500; overflow-wrap: anywhere; }
|
|
@@ -190,12 +190,13 @@ CmOverlay.overlayStyles = [
|
|
|
190
190
|
.x:focus-visible { outline: 2px solid var(--cm-text-on-dark); outline-offset: 0; }
|
|
191
191
|
.body { flex: 1 1 auto; min-height: 0; overflow: auto; padding: var(--cm-space-20); font-size: 14px; line-height: 20px; }
|
|
192
192
|
.foot {
|
|
193
|
-
display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--cm-space-
|
|
194
|
-
border-top: var(--cm-border-1) solid var(--cm-border-
|
|
193
|
+
display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--cm-space-8); flex: none; padding: var(--cm-space-12) var(--cm-space-20);
|
|
194
|
+
border-top: var(--cm-border-1) solid var(--cm-border-subtle);
|
|
195
195
|
}
|
|
196
196
|
.foot[hidden] { display: none; }
|
|
197
197
|
@media (prefers-reduced-motion: no-preference) {
|
|
198
|
-
dialog[open] .panel { animation: cm-ovl-in
|
|
198
|
+
dialog[open] .panel { animation: cm-ovl-in var(--cm-duration-base) var(--cm-easing-standard); }
|
|
199
|
+
|
|
199
200
|
}
|
|
200
201
|
@keyframes cm-ovl-in { from { opacity: 0; } to { opacity: 1; } }
|
|
201
202
|
`,
|
package/dist/popover.js
CHANGED
|
@@ -6,12 +6,12 @@ import { css } from 'lit';
|
|
|
6
6
|
*/
|
|
7
7
|
export const popoverStyles = css `
|
|
8
8
|
.pop {
|
|
9
|
-
position: absolute; z-index: 20; inset-block-start: calc(100% + var(--cm-space-
|
|
10
|
-
background: var(--cm-bg-surface); border: var(--cm-border-1) solid var(--cm-border-
|
|
11
|
-
border-radius: var(--cm-radius-md); box-shadow: var(--cm-shadow-
|
|
9
|
+
position: absolute; z-index: 20; inset-block-start: calc(100% + var(--cm-space-4)); inset-inline: 0;
|
|
10
|
+
background: var(--cm-bg-surface); border: var(--cm-border-1) solid var(--cm-border-subtle);
|
|
11
|
+
border-radius: var(--cm-radius-md); box-shadow: var(--cm-shadow-md); overflow: hidden;
|
|
12
12
|
}
|
|
13
13
|
.pop[hidden] { display: none; }
|
|
14
|
-
.message { display: flex; align-items: center; gap: var(--cm-space-
|
|
14
|
+
.message { display: flex; align-items: center; gap: var(--cm-space-8); margin: 0; padding: var(--cm-space-12) var(--cm-space-20); font-size: 14px; color: var(--cm-text-tertiary); }
|
|
15
15
|
.vh {
|
|
16
16
|
position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
|
|
17
17
|
clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
|
|
@@ -30,11 +30,11 @@ export function closeOnOutsidePointer(host, isOpen, close) {
|
|
|
30
30
|
* is never an option. Groups after another group, or after an ungrouped option, get a line above them.
|
|
31
31
|
*/
|
|
32
32
|
export const groupStyles = css `
|
|
33
|
-
[role='group'] + [role='group'] { margin-block-start:
|
|
34
|
-
[role='option'] + [role='group'], [role='group'] + [role='option'] { margin-block-start:
|
|
33
|
+
[role='group'] + [role='group'] { margin-block-start: var(--cm-space-4); padding-block-start: var(--cm-space-4); border-top: var(--cm-border-1) solid var(--cm-border-subtle); }
|
|
34
|
+
[role='option'] + [role='group'], [role='group'] + [role='option'] { margin-block-start: var(--cm-space-4); padding-block-start: var(--cm-space-4); border-top: var(--cm-border-1) solid var(--cm-border-subtle); }
|
|
35
35
|
.gh {
|
|
36
|
-
display: flex; align-items: baseline; gap: var(--cm-space-
|
|
37
|
-
font-size:
|
|
36
|
+
display: flex; align-items: baseline; gap: var(--cm-space-8); padding: var(--cm-space-8) var(--cm-space-8) var(--cm-space-4);
|
|
37
|
+
font-size: var(--cm-font-size-12); line-height: var(--cm-line-height-12); font-weight: 500; color: var(--cm-text-tertiary);
|
|
38
38
|
}
|
|
39
39
|
.gh .count { font-weight: 400; color: var(--cm-text-tertiary); }
|
|
40
40
|
.gopts { list-style: none; margin: 0; padding: 0; }
|
package/dist/spacing.d.ts
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import { type CSSResult } from 'lit';
|
|
2
|
-
/** Spacing
|
|
3
|
-
export declare const SPACE_STEPS: readonly ["0", "
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
/** Spacing steps that layout components accept in `gap`: `--cm-space-<step>` on the 4px grid, or `0`. */
|
|
3
|
+
export declare const SPACE_STEPS: readonly ["0", "4", "8", "12", "16", "20", "24", "32", "40", "48", "64"];
|
|
4
|
+
/**
|
|
5
|
+
* Steps from before 1.5 that were off the 4px grid. Still accepted, so existing pages keep working, but drawn with
|
|
6
|
+
* the nearest grid step: 10 → 8, 15 → 16, 22 → 24, 30 → 32. Deprecated: write the grid step.
|
|
7
|
+
*/
|
|
8
|
+
export declare const LEGACY_SPACE_STEPS: {
|
|
9
|
+
readonly '10': "8";
|
|
10
|
+
readonly '15': "16";
|
|
11
|
+
readonly '22': "24";
|
|
12
|
+
readonly '30': "32";
|
|
13
|
+
};
|
|
14
|
+
export type SpaceStep = (typeof SPACE_STEPS)[number] | keyof typeof LEGACY_SPACE_STEPS;
|
|
15
|
+
/** `:host([<attr>='20']) { <prop>: var(--cm-space-20) }` for every step (and legacy step). Unknown values keep the default. */
|
|
6
16
|
export declare function spaceRules(attr: string, prop: string): CSSResult;
|
package/dist/spacing.js
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
import { unsafeCSS } from 'lit';
|
|
2
|
-
/** Spacing
|
|
3
|
-
export const SPACE_STEPS = ['0', '
|
|
4
|
-
/**
|
|
2
|
+
/** Spacing steps that layout components accept in `gap`: `--cm-space-<step>` on the 4px grid, or `0`. */
|
|
3
|
+
export const SPACE_STEPS = ['0', '4', '8', '12', '16', '20', '24', '32', '40', '48', '64'];
|
|
4
|
+
/**
|
|
5
|
+
* Steps from before 1.5 that were off the 4px grid. Still accepted, so existing pages keep working, but drawn with
|
|
6
|
+
* the nearest grid step: 10 → 8, 15 → 16, 22 → 24, 30 → 32. Deprecated: write the grid step.
|
|
7
|
+
*/
|
|
8
|
+
export const LEGACY_SPACE_STEPS = { '10': '8', '15': '16', '22': '24', '30': '32' };
|
|
9
|
+
/** `:host([<attr>='20']) { <prop>: var(--cm-space-20) }` for every step (and legacy step). Unknown values keep the default. */
|
|
5
10
|
export function spaceRules(attr, prop) {
|
|
6
|
-
|
|
11
|
+
const rule = (s, to) => `:host([${attr}='${s}']) { ${prop}: ${to === '0' ? '0px' : `var(--cm-space-${to})`}; }`;
|
|
12
|
+
return unsafeCSS([
|
|
13
|
+
...SPACE_STEPS.map((s) => rule(s, s)),
|
|
14
|
+
...Object.entries(LEGACY_SPACE_STEPS).map(([s, to]) => rule(s, to)),
|
|
15
|
+
].join('\n'));
|
|
7
16
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commmerce/ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "Commmerce UI web components: build apps that feel native to the Commmerce admin. Works in plain HTML, React, Vue and server-rendered pages.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"web-components",
|
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
"test": "vitest run"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@commmerce/icons": "1.
|
|
54
|
-
"@commmerce/tokens": "1.
|
|
53
|
+
"@commmerce/icons": "1.5.0",
|
|
54
|
+
"@commmerce/tokens": "1.5.0",
|
|
55
55
|
"lit": "3.2.1"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|