@commmerce/ui 1.0.0-rc.3 → 1.0.0-rc.5
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/README.md +1 -1
- package/dist/base.d.ts +5 -0
- package/dist/base.js +10 -0
- package/dist/calendar.d.ts +95 -0
- package/dist/calendar.js +280 -0
- package/dist/cdn.js +721 -477
- package/dist/components/accordion.js +2 -2
- package/dist/components/action-bar.d.ts +12 -2
- package/dist/components/action-bar.js +10 -5
- package/dist/components/action-menu.d.ts +17 -4
- package/dist/components/action-menu.js +8 -5
- package/dist/components/app-card.d.ts +24 -2
- package/dist/components/app-card.js +25 -10
- package/dist/components/banner.d.ts +2 -2
- package/dist/components/banner.js +4 -3
- package/dist/components/bottom-navigation.d.ts +16 -4
- package/dist/components/bottom-navigation.js +10 -7
- package/dist/components/bottom-sheet.d.ts +4 -1
- package/dist/components/bottom-sheet.js +2 -2
- package/dist/components/checkbox.d.ts +12 -2
- package/dist/components/checkbox.js +7 -2
- package/dist/components/combobox.d.ts +186 -0
- package/dist/components/combobox.js +521 -0
- package/dist/components/comment.d.ts +27 -9
- package/dist/components/comment.js +14 -13
- package/dist/components/data-table.d.ts +14 -2
- package/dist/components/data-table.js +31 -10
- package/dist/components/date-picker.d.ts +179 -0
- package/dist/components/date-picker.js +336 -0
- package/dist/components/date-range-picker.d.ts +251 -0
- package/dist/components/date-range-picker.js +484 -0
- package/dist/components/file-upload.d.ts +30 -4
- package/dist/components/file-upload.js +37 -17
- package/dist/components/filter-panel.d.ts +29 -6
- package/dist/components/filter-panel.js +16 -14
- package/dist/components/flash-offer-bar.d.ts +18 -4
- package/dist/components/flash-offer-bar.js +13 -8
- package/dist/components/header-bar.d.ts +20 -4
- package/dist/components/header-bar.js +20 -13
- package/dist/components/icon.d.ts +7 -0
- package/dist/components/icon.js +9 -1
- package/dist/components/link-tabs.d.ts +16 -4
- package/dist/components/link-tabs.js +10 -7
- package/dist/components/mobile-menu.d.ts +19 -4
- package/dist/components/mobile-menu.js +16 -10
- package/dist/components/modal.d.ts +4 -1
- package/dist/components/nested-list.d.ts +22 -3
- package/dist/components/nested-list.js +25 -12
- package/dist/components/notification-panel.d.ts +26 -5
- package/dist/components/notification-panel.js +17 -11
- package/dist/components/option-group.d.ts +12 -2
- package/dist/components/option-group.js +13 -7
- package/dist/components/page-header.d.ts +18 -2
- package/dist/components/page-header.js +23 -10
- package/dist/components/pagination.d.ts +27 -4
- package/dist/components/pagination.js +28 -16
- package/dist/components/progress-bar.d.ts +12 -2
- package/dist/components/progress-bar.js +9 -4
- package/dist/components/radio.d.ts +12 -1
- package/dist/components/radio.js +12 -6
- package/dist/components/report-tile.d.ts +12 -1
- package/dist/components/report-tile.js +9 -4
- package/dist/components/resource-list.d.ts +36 -5
- package/dist/components/resource-list.js +50 -23
- package/dist/components/save-bar.d.ts +23 -6
- package/dist/components/save-bar.js +14 -12
- package/dist/components/search.d.ts +28 -7
- package/dist/components/search.js +18 -13
- package/dist/components/select.d.ts +12 -2
- package/dist/components/select.js +9 -4
- package/dist/components/side-navigation.d.ts +16 -4
- package/dist/components/side-navigation.js +16 -12
- package/dist/components/side-panel.d.ts +5 -2
- package/dist/components/side-panel.js +5 -3
- package/dist/components/skeleton-display.d.ts +6 -4
- package/dist/components/skeleton-display.js +4 -5
- package/dist/components/smart-tip.d.ts +25 -6
- package/dist/components/smart-tip.js +18 -12
- package/dist/components/spinner.d.ts +4 -3
- package/dist/components/spinner.js +5 -6
- package/dist/components/status-tabs.d.ts +12 -2
- package/dist/components/status-tabs.js +14 -8
- package/dist/components/table-header.d.ts +15 -2
- package/dist/components/table-header.js +13 -5
- package/dist/components/tag.d.ts +12 -2
- package/dist/components/tag.js +9 -4
- package/dist/components/text-field.d.ts +12 -2
- package/dist/components/text-field.js +9 -4
- package/dist/components/thumbnail.d.ts +12 -2
- package/dist/components/thumbnail.js +8 -3
- package/dist/components/toast.d.ts +14 -3
- package/dist/components/toast.js +20 -9
- package/dist/components/toggle.js +2 -0
- package/dist/custom-elements.json +16477 -6434
- package/dist/index.d.ts +7 -1
- package/dist/index.js +5 -1
- package/dist/localize.d.ts +130 -0
- package/dist/localize.js +232 -0
- package/dist/overlay.d.ts +8 -4
- package/dist/overlay.js +9 -12
- package/package.json +4 -4
|
@@ -62,9 +62,9 @@ CmAccordion.styles = [
|
|
|
62
62
|
.h { margin: 0; font: inherit; }
|
|
63
63
|
button {
|
|
64
64
|
display: flex; align-items: center; justify-content: space-between; gap: var(--cm-space-15); width: 100%;
|
|
65
|
-
min-height: 60px; padding: var(--cm-space-12)
|
|
65
|
+
min-height: 60px; padding-block: var(--cm-space-12); padding-inline: var(--cm-space-20) var(--cm-space-15);
|
|
66
66
|
border: 0; border-radius: inherit; background: none; color: var(--cm-text-default);
|
|
67
|
-
font: inherit; font-size: 16px; text-align:
|
|
67
|
+
font: inherit; font-size: 16px; text-align: start; cursor: pointer;
|
|
68
68
|
}
|
|
69
69
|
button:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
70
70
|
button:disabled { color: var(--cm-text-secondary); cursor: not-allowed; }
|
|
@@ -1,5 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CmLocalizedElement } from '../localize.js';
|
|
2
2
|
import './icon.js';
|
|
3
|
+
declare const strings: {
|
|
4
|
+
/** Accessible name of the bar's region when it has no `label`, `heading` or `eyebrow`. */
|
|
5
|
+
label: string;
|
|
6
|
+
};
|
|
7
|
+
declare module '../localize.js' {
|
|
8
|
+
interface CmStrings {
|
|
9
|
+
actionBar: typeof strings;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
3
12
|
/**
|
|
4
13
|
* Bar at the bottom of a long form or record page that repeats what the page is about and its
|
|
5
14
|
* main actions, so they stay in reach. The Figma file calls this the "Bottom Tab".
|
|
@@ -9,7 +18,7 @@ import './icon.js';
|
|
|
9
18
|
* @slot adornment - Badge next to the eyebrow (for example the order status).
|
|
10
19
|
* @slot actions - Buttons, secondary first and the primary action last (large size).
|
|
11
20
|
*/
|
|
12
|
-
export declare class CmActionBar extends
|
|
21
|
+
export declare class CmActionBar extends CmLocalizedElement {
|
|
13
22
|
static properties: {
|
|
14
23
|
eyebrow: {};
|
|
15
24
|
heading: {};
|
|
@@ -40,3 +49,4 @@ declare global {
|
|
|
40
49
|
'cm-action-bar': CmActionBar;
|
|
41
50
|
}
|
|
42
51
|
}
|
|
52
|
+
export {};
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { html, css, nothing } from 'lit';
|
|
2
2
|
import { base, define } from '../base.js';
|
|
3
|
+
import { CmLocalizedElement, defineStrings } from '../localize.js';
|
|
3
4
|
import './icon.js';
|
|
5
|
+
const strings = defineStrings('actionBar', {
|
|
6
|
+
/** Accessible name of the bar's region when it has no `label`, `heading` or `eyebrow`. */
|
|
7
|
+
label: 'Actions',
|
|
8
|
+
});
|
|
4
9
|
/**
|
|
5
10
|
* Bar at the bottom of a long form or record page that repeats what the page is about and its
|
|
6
11
|
* main actions, so they stay in reach. The Figma file calls this the "Bottom Tab".
|
|
@@ -10,7 +15,7 @@ import './icon.js';
|
|
|
10
15
|
* @slot adornment - Badge next to the eyebrow (for example the order status).
|
|
11
16
|
* @slot actions - Buttons, secondary first and the primary action last (large size).
|
|
12
17
|
*/
|
|
13
|
-
export class CmActionBar extends
|
|
18
|
+
export class CmActionBar extends CmLocalizedElement {
|
|
14
19
|
constructor() {
|
|
15
20
|
super(...arguments);
|
|
16
21
|
/** Small line above the heading: the page or record ID ("Add product", "#ODYOD0744"). */
|
|
@@ -26,7 +31,7 @@ export class CmActionBar extends LitElement {
|
|
|
26
31
|
}
|
|
27
32
|
render() {
|
|
28
33
|
const critical = this.tone === 'critical';
|
|
29
|
-
return html `<div class="bar" part="bar" role="region" aria-label=${this.label || this.heading || this.eyebrow || '
|
|
34
|
+
return html `<div class="bar" part="bar" role="region" aria-label=${this.label || this.heading || this.eyebrow || this.t('label')}>
|
|
30
35
|
<div class="lead">
|
|
31
36
|
${critical ? html `<span class="icon" aria-hidden="true"><cm-icon name="alert" size="20"></cm-icon></span>` : nothing}
|
|
32
37
|
<div class="text">
|
|
@@ -53,7 +58,7 @@ CmActionBar.styles = [
|
|
|
53
58
|
:host([sticky]) { position: sticky; bottom: 0; z-index: 10; }
|
|
54
59
|
.bar {
|
|
55
60
|
display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--cm-space-20);
|
|
56
|
-
min-height: 80px; padding: var(--cm-space-15) var(--cm-space-20)
|
|
61
|
+
min-height: 80px; padding: var(--cm-space-15) var(--cm-space-20);
|
|
57
62
|
background: var(--cm-bg-surface); border: var(--cm-border-1) solid var(--cm-border-card); border-radius: var(--cm-radius-md);
|
|
58
63
|
}
|
|
59
64
|
:host([sticky]) .bar { box-shadow: var(--cm-shadow-100); }
|
|
@@ -70,7 +75,7 @@ CmActionBar.styles = [
|
|
|
70
75
|
flex: none; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px;
|
|
71
76
|
border-radius: var(--cm-radius-full); background: var(--cm-bg-surface); color: var(--cm-icon-critical);
|
|
72
77
|
}
|
|
73
|
-
.actions { flex: none; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--cm-space-20); margin-
|
|
78
|
+
.actions { flex: none; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--cm-space-20); margin-inline-start: auto; }
|
|
74
79
|
@media (max-width: 640px) {
|
|
75
80
|
.bar { min-height: 68px; padding: var(--cm-space-10); gap: var(--cm-space-10); }
|
|
76
81
|
.heading { font-size: 14px; }
|
|
@@ -1,6 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type PropertyValues } from 'lit';
|
|
2
|
+
import { CmLocalizedElement } from '../localize.js';
|
|
2
3
|
import { type MenuItem } from './menu-item.js';
|
|
3
4
|
import './icon.js';
|
|
5
|
+
declare const strings: {
|
|
6
|
+
/** Text of the trigger button (its accessible name when `icon-only`), and the menu's name. */
|
|
7
|
+
label: string;
|
|
8
|
+
};
|
|
9
|
+
declare module '../localize.js' {
|
|
10
|
+
interface CmStrings {
|
|
11
|
+
actionMenu: typeof strings;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
4
14
|
/**
|
|
5
15
|
* A button that opens a short list of actions: row actions in a table ("Cancel shipment", "Change tracking
|
|
6
16
|
* info"), "Add…" menus, or the account menu with the merchant's name and email on top. The highlighted choice
|
|
@@ -15,7 +25,7 @@ import './icon.js';
|
|
|
15
25
|
* @fires cm-select - When a choice is made. `detail: { value, item }`. Cancelable: for link items, `preventDefault()` stops the navigation.
|
|
16
26
|
* @fires cm-toggle - When the menu opens or closes. `detail: { open }`.
|
|
17
27
|
*/
|
|
18
|
-
export declare class CmActionMenu extends
|
|
28
|
+
export declare class CmActionMenu extends CmLocalizedElement {
|
|
19
29
|
#private;
|
|
20
30
|
static properties: {
|
|
21
31
|
items: {
|
|
@@ -25,7 +35,9 @@ export declare class CmActionMenu extends LitElement {
|
|
|
25
35
|
type: BooleanConstructor;
|
|
26
36
|
reflect: boolean;
|
|
27
37
|
};
|
|
28
|
-
label: {
|
|
38
|
+
label: {
|
|
39
|
+
string: string;
|
|
40
|
+
};
|
|
29
41
|
triggerLabel: {
|
|
30
42
|
attribute: string;
|
|
31
43
|
};
|
|
@@ -53,7 +65,7 @@ export declare class CmActionMenu extends LitElement {
|
|
|
53
65
|
items: MenuItem[];
|
|
54
66
|
/** Shows the menu. */
|
|
55
67
|
open: boolean;
|
|
56
|
-
/** Accessible name of the menu. Also the trigger's name when it is icon-only. */
|
|
68
|
+
/** Accessible name of the menu. Also the trigger's name when it is icon-only. Default: the built-in string `label` ("Actions"). */
|
|
57
69
|
label: string;
|
|
58
70
|
/** Text of the built-in trigger. Empty uses `label`. */
|
|
59
71
|
triggerLabel: string;
|
|
@@ -87,3 +99,4 @@ declare global {
|
|
|
87
99
|
'cm-action-menu': CmActionMenu;
|
|
88
100
|
}
|
|
89
101
|
}
|
|
102
|
+
export {};
|
|
@@ -10,10 +10,15 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
|
|
|
10
10
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
11
11
|
};
|
|
12
12
|
var _CmActionMenu_instances, _CmActionMenu_observer, _CmActionMenu_id, _CmActionMenu_typed, _CmActionMenu_typedAt, _CmActionMenu_read, _CmActionMenu_outside, _CmActionMenu_trigger, _CmActionMenu_enabled, _CmActionMenu_setOpen, _CmActionMenu_focusActive, _CmActionMenu_triggerKey, _CmActionMenu_triggerClick, _CmActionMenu_move, _CmActionMenu_menuKey, _CmActionMenu_choose, _CmActionMenu_item;
|
|
13
|
-
import {
|
|
13
|
+
import { html, css, nothing } from 'lit';
|
|
14
14
|
import { base, define, nextId } from '../base.js';
|
|
15
|
+
import { CmLocalizedElement, defineStrings } from '../localize.js';
|
|
15
16
|
import { readMenuItems, watchMenuItems } from './menu-item.js';
|
|
16
17
|
import './icon.js';
|
|
18
|
+
const strings = defineStrings('actionMenu', {
|
|
19
|
+
/** Text of the trigger button (its accessible name when `icon-only`), and the menu's name. */
|
|
20
|
+
label: 'Actions',
|
|
21
|
+
});
|
|
17
22
|
/**
|
|
18
23
|
* A button that opens a short list of actions: row actions in a table ("Cancel shipment", "Change tracking
|
|
19
24
|
* info"), "Add…" menus, or the account menu with the merchant's name and email on top. The highlighted choice
|
|
@@ -28,7 +33,7 @@ import './icon.js';
|
|
|
28
33
|
* @fires cm-select - When a choice is made. `detail: { value, item }`. Cancelable: for link items, `preventDefault()` stops the navigation.
|
|
29
34
|
* @fires cm-toggle - When the menu opens or closes. `detail: { open }`.
|
|
30
35
|
*/
|
|
31
|
-
export class CmActionMenu extends
|
|
36
|
+
export class CmActionMenu extends CmLocalizedElement {
|
|
32
37
|
constructor() {
|
|
33
38
|
super(...arguments);
|
|
34
39
|
_CmActionMenu_instances.add(this);
|
|
@@ -36,8 +41,6 @@ export class CmActionMenu extends LitElement {
|
|
|
36
41
|
this.items = [];
|
|
37
42
|
/** Shows the menu. */
|
|
38
43
|
this.open = false;
|
|
39
|
-
/** Accessible name of the menu. Also the trigger's name when it is icon-only. */
|
|
40
|
-
this.label = 'Actions';
|
|
41
44
|
/** Text of the built-in trigger. Empty uses `label`. */
|
|
42
45
|
this.triggerLabel = '';
|
|
43
46
|
/** The built-in trigger is a "more" (⋮) icon button, e.g. for table rows. */
|
|
@@ -232,7 +235,7 @@ _CmActionMenu_observer = new WeakMap(), _CmActionMenu_id = new WeakMap(), _CmAct
|
|
|
232
235
|
CmActionMenu.properties = {
|
|
233
236
|
items: { type: Array },
|
|
234
237
|
open: { type: Boolean, reflect: true },
|
|
235
|
-
label: {},
|
|
238
|
+
label: { string: 'label' },
|
|
236
239
|
triggerLabel: { attribute: 'trigger-label' },
|
|
237
240
|
iconOnly: { type: Boolean, attribute: 'icon-only' },
|
|
238
241
|
icon: {},
|
|
@@ -1,5 +1,26 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CmLocalizedElement } from '../localize.js';
|
|
2
2
|
import './icon.js';
|
|
3
|
+
declare const strings: {
|
|
4
|
+
/** The developer line. */
|
|
5
|
+
developer: string;
|
|
6
|
+
/** The rating for screen readers. `{rating}` has one decimal. */
|
|
7
|
+
rating: string;
|
|
8
|
+
/** The reviews count, in plural forms. */
|
|
9
|
+
reviews: {
|
|
10
|
+
one: string;
|
|
11
|
+
other: string;
|
|
12
|
+
};
|
|
13
|
+
/** Read before the offer. */
|
|
14
|
+
offer: string;
|
|
15
|
+
/** The details link, and its accessible name. */
|
|
16
|
+
details: string;
|
|
17
|
+
detailsLabel: string;
|
|
18
|
+
};
|
|
19
|
+
declare module '../localize.js' {
|
|
20
|
+
interface CmStrings {
|
|
21
|
+
appCard: typeof strings;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
3
24
|
/**
|
|
4
25
|
* A card for one app in the Commmerce app marketplace: logo tile, name, developer, rating, pricing,
|
|
5
26
|
* an optional offer, and actions (Sign Up, Contact, View Details).
|
|
@@ -8,7 +29,7 @@ import './icon.js';
|
|
|
8
29
|
* @slot actions - Buttons, e.g. `<cm-button variant="primary">Sign Up</cm-button>` and `<cm-button>Contact</cm-button>`.
|
|
9
30
|
* @slot status - Top-right corner, e.g. a `cm-toggle` that turns an installed app on and off.
|
|
10
31
|
*/
|
|
11
|
-
export declare class CmAppCard extends
|
|
32
|
+
export declare class CmAppCard extends CmLocalizedElement {
|
|
12
33
|
static properties: {
|
|
13
34
|
name: {};
|
|
14
35
|
developer: {};
|
|
@@ -55,3 +76,4 @@ declare global {
|
|
|
55
76
|
'cm-app-card': CmAppCard;
|
|
56
77
|
}
|
|
57
78
|
}
|
|
79
|
+
export {};
|
|
@@ -1,6 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { html, css, nothing } from 'lit';
|
|
2
2
|
import { base, define } from '../base.js';
|
|
3
|
+
import { CmLocalizedElement, defineStrings } from '../localize.js';
|
|
3
4
|
import './icon.js';
|
|
5
|
+
const strings = defineStrings('appCard', {
|
|
6
|
+
/** The developer line. */
|
|
7
|
+
developer: 'By {developer}',
|
|
8
|
+
/** The rating for screen readers. `{rating}` has one decimal. */
|
|
9
|
+
rating: 'Rated {rating} out of 5',
|
|
10
|
+
/** The reviews count, in plural forms. */
|
|
11
|
+
reviews: { one: '{count} Review', other: '{count} Reviews' },
|
|
12
|
+
/** Read before the offer. */
|
|
13
|
+
offer: 'Offer: ',
|
|
14
|
+
/** The details link, and its accessible name. */
|
|
15
|
+
details: 'View Details',
|
|
16
|
+
detailsLabel: 'View details of {name}',
|
|
17
|
+
});
|
|
4
18
|
/**
|
|
5
19
|
* A card for one app in the Commmerce app marketplace: logo tile, name, developer, rating, pricing,
|
|
6
20
|
* an optional offer, and actions (Sign Up, Contact, View Details).
|
|
@@ -9,7 +23,7 @@ import './icon.js';
|
|
|
9
23
|
* @slot actions - Buttons, e.g. `<cm-button variant="primary">Sign Up</cm-button>` and `<cm-button>Contact</cm-button>`.
|
|
10
24
|
* @slot status - Top-right corner, e.g. a `cm-toggle` that turns an installed app on and off.
|
|
11
25
|
*/
|
|
12
|
-
export class CmAppCard extends
|
|
26
|
+
export class CmAppCard extends CmLocalizedElement {
|
|
13
27
|
constructor() {
|
|
14
28
|
super(...arguments);
|
|
15
29
|
/** App name, the card's heading. */
|
|
@@ -30,19 +44,20 @@ export class CmAppCard extends LitElement {
|
|
|
30
44
|
render() {
|
|
31
45
|
const lvl = Math.min(6, Math.max(2, Math.round(this.headingLevel) || 3));
|
|
32
46
|
const hasRating = typeof this.rating === 'number' && !Number.isNaN(this.rating);
|
|
33
|
-
const reviews = typeof this.reviews === 'number' ?
|
|
47
|
+
const reviews = typeof this.reviews === 'number' ? this.t('reviews', { count: this.reviews }) : '';
|
|
48
|
+
const rating = hasRating ? this.formatNumber(this.rating, { minimumFractionDigits: 1, maximumFractionDigits: 1 }) : '';
|
|
34
49
|
return html `<article part="card" aria-labelledby="name">
|
|
35
50
|
<div class="logo" part="logo"><slot name="logo"></slot></div>
|
|
36
51
|
<div class="status"><slot name="status"></slot></div>
|
|
37
52
|
<div class="name" id="name" role="heading" aria-level=${lvl}>${this.name}</div>
|
|
38
|
-
${this.developer ? html `<p class="by"
|
|
53
|
+
${this.developer ? html `<p class="by">${this.t('developer', { developer: this.developer })}</p>` : nothing}
|
|
39
54
|
${hasRating ? html `<p class="rating"><cm-icon class="star" name="star" size="12"></cm-icon>
|
|
40
|
-
<span aria-hidden="true">${
|
|
55
|
+
<span aria-hidden="true">${rating}</span><span class="sr">${this.t('rating', { rating })}</span>
|
|
41
56
|
${reviews ? (this.reviewsHref ? html `<a href=${this.reviewsHref}>${reviews}</a>` : html `<span>${reviews}</span>`) : nothing}</p>` : nothing}
|
|
42
57
|
${this.pricing ? html `<p class="pricing">${this.pricing}</p>` : nothing}
|
|
43
|
-
${this.offer ? html `<p class="offer"><cm-icon name="percent" size="12"></cm-icon><span><span class="sr"
|
|
58
|
+
${this.offer ? html `<p class="offer"><cm-icon name="percent" size="12"></cm-icon><span><span class="sr">${this.t('offer')}</span>${this.offer}</span></p>` : nothing}
|
|
44
59
|
<div class="actions"><slot name="actions"></slot>${this.href ? html `<a class="details" part="details" href=${this.href}
|
|
45
|
-
aria-label=${
|
|
60
|
+
aria-label=${this.t('detailsLabel', { name: this.name })}>${this.t('details')}</a>` : nothing}</div>
|
|
46
61
|
</article>`;
|
|
47
62
|
}
|
|
48
63
|
}
|
|
@@ -71,7 +86,7 @@ CmAppCard.styles = [
|
|
|
71
86
|
background: var(--cm-bg-inset); border-radius: var(--cm-radius-xs);
|
|
72
87
|
}
|
|
73
88
|
::slotted([slot='logo']) { max-width: 100%; max-height: 100%; object-fit: contain; }
|
|
74
|
-
.status { position: absolute; top: var(--cm-space-20);
|
|
89
|
+
.status { position: absolute; top: var(--cm-space-20); inset-inline-end: var(--cm-space-20); }
|
|
75
90
|
.name { margin: 0; font-size: 16px; font-weight: 500; line-height: 1.3; overflow-wrap: anywhere; }
|
|
76
91
|
.by { margin: -6px 0 0; }
|
|
77
92
|
.rating { display: flex; align-items: center; gap: 5px; margin: 0; }
|
|
@@ -91,9 +106,9 @@ CmAppCard.styles = [
|
|
|
91
106
|
@container (max-width: 380px) {
|
|
92
107
|
article { padding: var(--cm-space-10); }
|
|
93
108
|
.logo { width: 100px; height: 40px; padding: 6px; }
|
|
94
|
-
.status { top: var(--cm-space-10);
|
|
109
|
+
.status { top: var(--cm-space-10); inset-inline-end: var(--cm-space-10); }
|
|
95
110
|
.actions { gap: var(--cm-space-10); }
|
|
96
|
-
.details { margin-
|
|
111
|
+
.details { margin-inline-start: auto; }
|
|
97
112
|
}
|
|
98
113
|
`,
|
|
99
114
|
];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { LitElement } from 'lit';
|
|
2
1
|
import { type Tone } from '../base.js';
|
|
2
|
+
import { CmLocalizedElement } from '../localize.js';
|
|
3
3
|
/**
|
|
4
4
|
* Full-width message about the page or a task. Critical banners are announced immediately.
|
|
5
5
|
* @element cm-banner
|
|
@@ -7,7 +7,7 @@ import { type Tone } from '../base.js';
|
|
|
7
7
|
* @slot actions - Buttons or links under the message.
|
|
8
8
|
* @fires cm-dismiss - When the close button is pressed (cancelable; default hides the banner).
|
|
9
9
|
*/
|
|
10
|
-
export declare class CmBanner extends
|
|
10
|
+
export declare class CmBanner extends CmLocalizedElement {
|
|
11
11
|
#private;
|
|
12
12
|
static properties: {
|
|
13
13
|
tone: {
|
|
@@ -4,8 +4,9 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
4
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
5
|
};
|
|
6
6
|
var _CmBanner_instances, _CmBanner_onSlot, _CmBanner_dismiss;
|
|
7
|
-
import {
|
|
7
|
+
import { html, svg, css, nothing } from 'lit';
|
|
8
8
|
import { base, define } from '../base.js';
|
|
9
|
+
import { CmLocalizedElement } from '../localize.js';
|
|
9
10
|
/**
|
|
10
11
|
* Full-width message about the page or a task. Critical banners are announced immediately.
|
|
11
12
|
* @element cm-banner
|
|
@@ -13,7 +14,7 @@ import { base, define } from '../base.js';
|
|
|
13
14
|
* @slot actions - Buttons or links under the message.
|
|
14
15
|
* @fires cm-dismiss - When the close button is pressed (cancelable; default hides the banner).
|
|
15
16
|
*/
|
|
16
|
-
export class CmBanner extends
|
|
17
|
+
export class CmBanner extends CmLocalizedElement {
|
|
17
18
|
constructor() {
|
|
18
19
|
super(...arguments);
|
|
19
20
|
_CmBanner_instances.add(this);
|
|
@@ -39,7 +40,7 @@ export class CmBanner extends LitElement {
|
|
|
39
40
|
<div class="actions" ?hidden=${!this.hasActions}><slot name="actions" @slotchange=${__classPrivateFieldGet(this, _CmBanner_instances, "m", _CmBanner_onSlot)}></slot></div>
|
|
40
41
|
</div>
|
|
41
42
|
${this.dismissible
|
|
42
|
-
? html `<button class="close" aria-label
|
|
43
|
+
? html `<button class="close" aria-label=${this.t('dismiss')} @click=${__classPrivateFieldGet(this, _CmBanner_instances, "m", _CmBanner_dismiss)}>
|
|
43
44
|
<svg width="16" height="16" viewBox="0 0 16 16" aria-hidden="true"><path d="m4 4 8 8M12 4l-8 8" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/></svg></button>`
|
|
44
45
|
: nothing}
|
|
45
46
|
</div>`;
|
|
@@ -1,6 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CmLocalizedElement } from '../localize.js';
|
|
2
2
|
import { type NavItem } from './nav-item.js';
|
|
3
3
|
import './icon.js';
|
|
4
|
+
declare const strings: {
|
|
5
|
+
/** Accessible name of the navigation landmark. */
|
|
6
|
+
label: string;
|
|
7
|
+
};
|
|
8
|
+
declare module '../localize.js' {
|
|
9
|
+
interface CmStrings {
|
|
10
|
+
bottomNavigation: typeof strings;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
4
13
|
/**
|
|
5
14
|
* The admin's tab bar on phones and small tablets: up to five destinations with an icon over an uppercase
|
|
6
15
|
* label, in a white bar with rounded top corners. The last item ("More") usually opens the Mobile menu.
|
|
@@ -12,13 +21,15 @@ import './icon.js';
|
|
|
12
21
|
* @slot - `cm-nav-item` elements (no nesting).
|
|
13
22
|
* @fires cm-navigate - When an item is chosen. `detail: { item, value, href }`. Cancelable: call `preventDefault()` to route in your app. Items without `href` only fire this event (e.g. "More" opens the Mobile menu).
|
|
14
23
|
*/
|
|
15
|
-
export declare class CmBottomNavigation extends
|
|
24
|
+
export declare class CmBottomNavigation extends CmLocalizedElement {
|
|
16
25
|
#private;
|
|
17
26
|
static properties: {
|
|
18
27
|
items: {
|
|
19
28
|
type: ArrayConstructor;
|
|
20
29
|
};
|
|
21
|
-
label: {
|
|
30
|
+
label: {
|
|
31
|
+
string: string;
|
|
32
|
+
};
|
|
22
33
|
fixed: {
|
|
23
34
|
type: BooleanConstructor;
|
|
24
35
|
reflect: boolean;
|
|
@@ -29,7 +40,7 @@ export declare class CmBottomNavigation extends LitElement {
|
|
|
29
40
|
};
|
|
30
41
|
/** Items as data. Used instead of `cm-nav-item` children when set. */
|
|
31
42
|
items: NavItem[];
|
|
32
|
-
/** Accessible name of the navigation landmark. */
|
|
43
|
+
/** Accessible name of the navigation landmark. Default: the built-in string `label` ("Main"). */
|
|
33
44
|
label: string;
|
|
34
45
|
/** Pins the bar to the bottom of the viewport, above the device's home indicator. */
|
|
35
46
|
fixed: boolean;
|
|
@@ -46,3 +57,4 @@ declare global {
|
|
|
46
57
|
'cm-bottom-navigation': CmBottomNavigation;
|
|
47
58
|
}
|
|
48
59
|
}
|
|
60
|
+
export {};
|
|
@@ -10,10 +10,15 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
|
|
|
10
10
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
11
11
|
};
|
|
12
12
|
var _CmBottomNavigation_instances, _CmBottomNavigation_observer, _CmBottomNavigation_read, _CmBottomNavigation_item;
|
|
13
|
-
import {
|
|
13
|
+
import { html, css, nothing } from 'lit';
|
|
14
14
|
import { base, define } from '../base.js';
|
|
15
|
+
import { CmLocalizedElement, defineStrings } from '../localize.js';
|
|
15
16
|
import { readNavItems, watchNavItems, fireNavigate } from './nav-item.js';
|
|
16
17
|
import './icon.js';
|
|
18
|
+
const strings = defineStrings('bottomNavigation', {
|
|
19
|
+
/** Accessible name of the navigation landmark. */
|
|
20
|
+
label: 'Main',
|
|
21
|
+
});
|
|
17
22
|
/**
|
|
18
23
|
* The admin's tab bar on phones and small tablets: up to five destinations with an icon over an uppercase
|
|
19
24
|
* label, in a white bar with rounded top corners. The last item ("More") usually opens the Mobile menu.
|
|
@@ -25,14 +30,12 @@ import './icon.js';
|
|
|
25
30
|
* @slot - `cm-nav-item` elements (no nesting).
|
|
26
31
|
* @fires cm-navigate - When an item is chosen. `detail: { item, value, href }`. Cancelable: call `preventDefault()` to route in your app. Items without `href` only fire this event (e.g. "More" opens the Mobile menu).
|
|
27
32
|
*/
|
|
28
|
-
export class CmBottomNavigation extends
|
|
33
|
+
export class CmBottomNavigation extends CmLocalizedElement {
|
|
29
34
|
constructor() {
|
|
30
35
|
super(...arguments);
|
|
31
36
|
_CmBottomNavigation_instances.add(this);
|
|
32
37
|
/** Items as data. Used instead of `cm-nav-item` children when set. */
|
|
33
38
|
this.items = [];
|
|
34
|
-
/** Accessible name of the navigation landmark. */
|
|
35
|
-
this.label = 'Main';
|
|
36
39
|
/** Pins the bar to the bottom of the viewport, above the device's home indicator. */
|
|
37
40
|
this.fixed = false;
|
|
38
41
|
this._slotted = [];
|
|
@@ -50,7 +53,7 @@ export class CmBottomNavigation extends LitElement {
|
|
|
50
53
|
/** The items in use. */
|
|
51
54
|
get navItems() { return this.items.length ? this.items : this._slotted; }
|
|
52
55
|
render() {
|
|
53
|
-
return html `<nav part="nav" aria-label=${this.label || '
|
|
56
|
+
return html `<nav part="nav" aria-label=${this.label || this.t('label')}>
|
|
54
57
|
<ul>${this.navItems.slice(0, 5).map((it) => html `<li>${__classPrivateFieldGet(this, _CmBottomNavigation_instances, "m", _CmBottomNavigation_item).call(this, it)}</li>`)}</ul>
|
|
55
58
|
<slot hidden></slot>
|
|
56
59
|
</nav>`;
|
|
@@ -67,7 +70,7 @@ _CmBottomNavigation_observer = new WeakMap(), _CmBottomNavigation_instances = ne
|
|
|
67
70
|
};
|
|
68
71
|
CmBottomNavigation.properties = {
|
|
69
72
|
items: { type: Array },
|
|
70
|
-
label: {},
|
|
73
|
+
label: { string: 'label' },
|
|
71
74
|
fixed: { type: Boolean, reflect: true },
|
|
72
75
|
_slotted: { state: true },
|
|
73
76
|
};
|
|
@@ -75,7 +78,7 @@ CmBottomNavigation.styles = [
|
|
|
75
78
|
base,
|
|
76
79
|
css `
|
|
77
80
|
:host { display: block; }
|
|
78
|
-
:host([fixed]) { position: fixed;
|
|
81
|
+
:host([fixed]) { position: fixed; inset-inline: 0; bottom: 0; z-index: 20; }
|
|
79
82
|
nav {
|
|
80
83
|
background: var(--cm-bg-surface); border-radius: 16px 16px 0 0; box-shadow: var(--cm-shadow-100);
|
|
81
84
|
padding: 10px 6px calc(8px + env(safe-area-inset-bottom, 0px));
|
|
@@ -29,10 +29,13 @@ export declare class CmBottomSheet extends CmOverlay {
|
|
|
29
29
|
type: BooleanConstructor;
|
|
30
30
|
reflect: boolean;
|
|
31
31
|
};
|
|
32
|
-
heading: {
|
|
32
|
+
heading: {
|
|
33
|
+
string: string;
|
|
34
|
+
};
|
|
33
35
|
label: {};
|
|
34
36
|
closeLabel: {
|
|
35
37
|
attribute: string;
|
|
38
|
+
string: string;
|
|
36
39
|
};
|
|
37
40
|
};
|
|
38
41
|
/** Hidden title that names the sheet for screen readers, e.g. "Order actions". Set it (or `label`). */
|
|
@@ -56,7 +56,7 @@ export class CmBottomSheet extends CmOverlay {
|
|
|
56
56
|
const items = this.sheetItems.filter((it) => !it.divider);
|
|
57
57
|
const icons = items.some((it) => it.icon);
|
|
58
58
|
return this.renderDialog(html `<div class="panel" part="panel" tabindex="-1">
|
|
59
|
-
<button type="button" class="x" part="close" aria-label=${this.closeLabel || '
|
|
59
|
+
<button type="button" class="x" part="close" aria-label=${this.closeLabel || this.t('close')} @click=${() => this.requestClose('close-button')}>
|
|
60
60
|
<cm-icon name="close" size="16"></cm-icon></button>
|
|
61
61
|
${this.heading ? html `<h2 class="vh" id="${this.uid}-h">${this.heading}</h2>` : nothing}
|
|
62
62
|
<div class="content">
|
|
@@ -103,7 +103,7 @@ CmBottomSheet.styles = [
|
|
|
103
103
|
border-radius: 20px 20px 0 0; box-shadow: var(--cm-shadow-100);
|
|
104
104
|
}
|
|
105
105
|
.x {
|
|
106
|
-
position: absolute; top: -18px; left: 50%; transform: translateX(-50%); width: 36px; height: 36px; border-radius: 50%;
|
|
106
|
+
position: absolute; top: -18px; left: 50%; transform: translateX(-50%); /* centred: the same in both directions */ width: 36px; height: 36px; border-radius: 50%;
|
|
107
107
|
background: var(--cm-bg-panel-header); color: var(--cm-text-on-dark);
|
|
108
108
|
}
|
|
109
109
|
.x:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
@@ -1,11 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CmLocalizedElement } from '../localize.js';
|
|
2
|
+
declare const strings: {
|
|
3
|
+
/** Validation message when `required` and not ticked. */
|
|
4
|
+
required: string;
|
|
5
|
+
};
|
|
6
|
+
declare module '../localize.js' {
|
|
7
|
+
interface CmStrings {
|
|
8
|
+
checkbox: typeof strings;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
2
11
|
/**
|
|
3
12
|
* Checkbox with label and optional description. Participates in native forms.
|
|
4
13
|
* @element cm-checkbox
|
|
5
14
|
* @slot - Rich label content, used instead of `label`.
|
|
6
15
|
* @fires change - When toggled by the user.
|
|
7
16
|
*/
|
|
8
|
-
export declare class CmCheckbox extends
|
|
17
|
+
export declare class CmCheckbox extends CmLocalizedElement {
|
|
9
18
|
#private;
|
|
10
19
|
static formAssociated: boolean;
|
|
11
20
|
static shadowRootOptions: {
|
|
@@ -66,3 +75,4 @@ declare global {
|
|
|
66
75
|
'cm-checkbox': CmCheckbox;
|
|
67
76
|
}
|
|
68
77
|
}
|
|
78
|
+
export {};
|
|
@@ -12,13 +12,18 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
12
12
|
var _CmCheckbox_instances, _CmCheckbox_internals, _CmCheckbox_id, _CmCheckbox_defaultChecked, _CmCheckbox_onChange;
|
|
13
13
|
import { LitElement, html, css, nothing } from 'lit';
|
|
14
14
|
import { base, define, nextId } from '../base.js';
|
|
15
|
+
import { CmLocalizedElement, defineStrings } from '../localize.js';
|
|
16
|
+
const strings = defineStrings('checkbox', {
|
|
17
|
+
/** Validation message when `required` and not ticked. */
|
|
18
|
+
required: 'Please tick this box.',
|
|
19
|
+
});
|
|
15
20
|
/**
|
|
16
21
|
* Checkbox with label and optional description. Participates in native forms.
|
|
17
22
|
* @element cm-checkbox
|
|
18
23
|
* @slot - Rich label content, used instead of `label`.
|
|
19
24
|
* @fires change - When toggled by the user.
|
|
20
25
|
*/
|
|
21
|
-
export class CmCheckbox extends
|
|
26
|
+
export class CmCheckbox extends CmLocalizedElement {
|
|
22
27
|
constructor() {
|
|
23
28
|
super(...arguments);
|
|
24
29
|
_CmCheckbox_instances.add(this);
|
|
@@ -53,7 +58,7 @@ export class CmCheckbox extends LitElement {
|
|
|
53
58
|
updated() {
|
|
54
59
|
__classPrivateFieldGet(this, _CmCheckbox_internals, "f").setFormValue(this.checked ? this.value : null);
|
|
55
60
|
if (this.required && !this.checked)
|
|
56
|
-
__classPrivateFieldGet(this, _CmCheckbox_internals, "f").setValidity({ valueMissing: true },
|
|
61
|
+
__classPrivateFieldGet(this, _CmCheckbox_internals, "f").setValidity({ valueMissing: true }, this.t('required'));
|
|
57
62
|
else
|
|
58
63
|
__classPrivateFieldGet(this, _CmCheckbox_internals, "f").setValidity({});
|
|
59
64
|
}
|