@commmerce/ui 1.1.1 → 1.3.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.d.ts +38 -0
- package/dist/calendar.js +109 -0
- package/dist/cdn.js +1010 -533
- package/dist/components/board.d.ts +338 -0
- package/dist/components/board.js +1017 -0
- package/dist/components/button.d.ts +10 -0
- package/dist/components/button.js +25 -0
- package/dist/components/card.d.ts +7 -1
- package/dist/components/card.js +58 -7
- package/dist/components/color-field.d.ts +153 -0
- package/dist/components/color-field.js +369 -0
- package/dist/components/combobox.d.ts +17 -4
- package/dist/components/combobox.js +55 -23
- package/dist/components/date-picker.d.ts +49 -5
- package/dist/components/date-picker.js +211 -48
- package/dist/components/empty-state.d.ts +19 -4
- package/dist/components/empty-state.js +59 -5
- package/dist/components/file-upload.d.ts +33 -0
- package/dist/components/file-upload.js +80 -9
- package/dist/components/global-search.js +2 -7
- package/dist/components/metric.d.ts +97 -0
- package/dist/components/metric.js +168 -0
- package/dist/components/nested-list.d.ts +33 -1
- package/dist/components/nested-list.js +197 -18
- package/dist/components/option-group.d.ts +15 -6
- package/dist/components/option-group.js +25 -6
- package/dist/components/page-header.js +3 -2
- package/dist/components/resource-list.d.ts +14 -2
- package/dist/components/resource-list.js +48 -6
- package/dist/components/select.d.ts +20 -3
- package/dist/components/select.js +35 -11
- package/dist/components/table-header.d.ts +14 -0
- package/dist/components/table-header.js +21 -0
- package/dist/components/text-field.d.ts +36 -2
- package/dist/components/text-field.js +86 -14
- package/dist/components/timeline.d.ts +210 -0
- package/dist/components/timeline.js +380 -0
- package/dist/custom-elements.json +9371 -4963
- package/dist/index.d.ts +10 -0
- package/dist/index.js +5 -0
- package/dist/move-model.d.ts +93 -0
- package/dist/move-model.js +169 -0
- package/dist/popover.d.ts +24 -0
- package/dist/popover.js +59 -0
- package/package.json +3 -3
|
@@ -16,6 +16,7 @@ declare module '../localize.js' {
|
|
|
16
16
|
/**
|
|
17
17
|
* Black primary or outlined secondary action. With `icon-only` it is a square button that shows just an icon
|
|
18
18
|
* (bell, refresh, search, row actions) and is named by `label`. `count` adds a small counter ("3", "99+").
|
|
19
|
+
* `tone` colours a button by the outcome it records (`success`, `critical`); the label still carries the meaning.
|
|
19
20
|
* @element cm-button
|
|
20
21
|
* @slot - Label. Visually hidden when `icon-only` (it still names the button if `label` is empty).
|
|
21
22
|
* @slot icon - Optional leading icon. Overrides the `icon` attribute.
|
|
@@ -54,6 +55,9 @@ export declare class CmButton extends CmLocalizedElement {
|
|
|
54
55
|
count: {
|
|
55
56
|
type: NumberConstructor;
|
|
56
57
|
};
|
|
58
|
+
tone: {
|
|
59
|
+
reflect: boolean;
|
|
60
|
+
};
|
|
57
61
|
};
|
|
58
62
|
/** `primary` = black fill (one per group); `secondary` = light fill, black outline. */
|
|
59
63
|
variant: 'primary' | 'secondary';
|
|
@@ -77,6 +81,12 @@ export declare class CmButton extends CmLocalizedElement {
|
|
|
77
81
|
label: string;
|
|
78
82
|
/** Small counter on the button, e.g. unread notifications. Hidden at 0; over 99 shows "99+". Screen readers hear the exact number ("Notifications, 3 unread"). */
|
|
79
83
|
count: number;
|
|
84
|
+
/**
|
|
85
|
+
* Colours the button by meaning: `critical` (red: delete, "Not interested") or `success` (green: "Sale closed").
|
|
86
|
+
* Secondary: tone text, icon and outline on a white fill. Primary: filled in the tone. Leave unset for the
|
|
87
|
+
* standard black and white. Colour is never the only signal: the label must say what happens. Since 1.2.
|
|
88
|
+
*/
|
|
89
|
+
tone?: 'critical' | 'success';
|
|
80
90
|
static styles: import("lit").CSSResult[];
|
|
81
91
|
constructor();
|
|
82
92
|
updated(): void;
|
|
@@ -27,6 +27,7 @@ const strings = defineStrings('button', {
|
|
|
27
27
|
/**
|
|
28
28
|
* Black primary or outlined secondary action. With `icon-only` it is a square button that shows just an icon
|
|
29
29
|
* (bell, refresh, search, row actions) and is named by `label`. `count` adds a small counter ("3", "99+").
|
|
30
|
+
* `tone` colours a button by the outcome it records (`success`, `critical`); the label still carries the meaning.
|
|
30
31
|
* @element cm-button
|
|
31
32
|
* @slot - Label. Visually hidden when `icon-only` (it still names the button if `label` is empty).
|
|
32
33
|
* @slot icon - Optional leading icon. Overrides the `icon` attribute.
|
|
@@ -115,6 +116,7 @@ CmButton.properties = {
|
|
|
115
116
|
icon: {},
|
|
116
117
|
label: {},
|
|
117
118
|
count: { type: Number },
|
|
119
|
+
tone: { reflect: true },
|
|
118
120
|
};
|
|
119
121
|
CmButton.styles = [
|
|
120
122
|
base,
|
|
@@ -138,6 +140,29 @@ CmButton.styles = [
|
|
|
138
140
|
:host([disabled]) .btn, :host([loading]) .btn {
|
|
139
141
|
background: var(--cm-action-disabled); border-color: var(--cm-action-disabled); color: var(--cm-action-disabled-text); cursor: not-allowed;
|
|
140
142
|
}
|
|
143
|
+
/* Tones (1.2). Secondary sits on bg-surface, not bg-hover: text-critical on bg-hover is under 4.5:1 in dark.
|
|
144
|
+
Success has no border token: its outline is text-success (4.8:1 or more on every surface; icon-success is 2.9:1 on bg-page).
|
|
145
|
+
Primary fills with the tone's text colour and takes action-primary-text, like the black primary (5.1:1 or more).
|
|
146
|
+
Hover darkens it towards text-default, which only raises the label's contrast. Pairs: packages/tokens/scripts/contrast.mjs. */
|
|
147
|
+
:host([tone='critical']:not([variant='primary']):not([disabled]):not([loading])) .btn {
|
|
148
|
+
background: var(--cm-bg-surface); color: var(--cm-text-critical); border-color: var(--cm-border-critical);
|
|
149
|
+
}
|
|
150
|
+
:host([tone='critical']:not([variant='primary']):not([disabled]):not([loading])) .btn:hover { background: var(--cm-bg-critical); }
|
|
151
|
+
:host([tone='success']:not([variant='primary']):not([disabled]):not([loading])) .btn {
|
|
152
|
+
background: var(--cm-bg-surface); color: var(--cm-text-success); border-color: var(--cm-text-success);
|
|
153
|
+
}
|
|
154
|
+
:host([tone='success']:not([variant='primary']):not([disabled]):not([loading])) .btn:hover {
|
|
155
|
+
background: linear-gradient(var(--cm-bg-success-soft), var(--cm-bg-success-soft)) var(--cm-bg-surface);
|
|
156
|
+
}
|
|
157
|
+
:host([tone='critical'][variant='primary']:not([disabled]):not([loading])) .btn { --_tone: var(--cm-text-critical); }
|
|
158
|
+
:host([tone='success'][variant='primary']:not([disabled]):not([loading])) .btn { --_tone: var(--cm-text-success); }
|
|
159
|
+
:host([tone='critical'][variant='primary']:not([disabled]):not([loading])) .btn, :host([tone='success'][variant='primary']:not([disabled]):not([loading])) .btn {
|
|
160
|
+
background: var(--_tone); border-color: var(--_tone); color: var(--cm-action-primary-text);
|
|
161
|
+
}
|
|
162
|
+
:host([tone='critical'][variant='primary']:not([disabled]):not([loading])) .btn:hover, :host([tone='success'][variant='primary']:not([disabled]):not([loading])) .btn:hover {
|
|
163
|
+
background: color-mix(in srgb, var(--_tone) 80%, var(--cm-text-default));
|
|
164
|
+
border-color: color-mix(in srgb, var(--_tone) 80%, var(--cm-text-default));
|
|
165
|
+
}
|
|
141
166
|
.btn:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
142
167
|
.spinner {
|
|
143
168
|
width: 1em; height: 1em; border-radius: 50%;
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import { LitElement } from 'lit';
|
|
2
2
|
/**
|
|
3
3
|
* White section card with optional title, description and header actions.
|
|
4
|
+
*
|
|
5
|
+
* On narrow cards the header wraps instead of squeezing the heading: the title adornment moves under the heading
|
|
6
|
+
* when both don't fit on one line, and the actions move under the title when the title would be narrower than
|
|
7
|
+
* about 12 characters. Wide cards keep everything on one row.
|
|
4
8
|
* @element cm-card
|
|
5
9
|
* @slot - Body.
|
|
6
|
-
* @slot actions - Header actions (buttons, links),
|
|
10
|
+
* @slot actions - Header actions (buttons, links), at the end of the header. Since 1.3 they also show on a card with no
|
|
11
|
+
* `heading` or `description`, in a row of their own at the top of the card.
|
|
7
12
|
* @slot title-adornment - Badge or icon next to the title.
|
|
8
13
|
*/
|
|
9
14
|
export declare class CmCard extends LitElement {
|
|
15
|
+
#private;
|
|
10
16
|
static properties: {
|
|
11
17
|
heading: {};
|
|
12
18
|
description: {};
|
package/dist/components/card.js
CHANGED
|
@@ -1,15 +1,33 @@
|
|
|
1
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
2
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
3
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
|
+
};
|
|
6
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
7
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
9
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
10
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
11
|
+
};
|
|
12
|
+
var _CmCard_instances, _CmCard_adorned, _CmCard_bareActions, _CmCard_onAdornment, _CmCard_onBareActions;
|
|
1
13
|
import { LitElement, html, css, nothing } from 'lit';
|
|
2
14
|
import { base, define } from '../base.js';
|
|
3
15
|
/**
|
|
4
16
|
* White section card with optional title, description and header actions.
|
|
17
|
+
*
|
|
18
|
+
* On narrow cards the header wraps instead of squeezing the heading: the title adornment moves under the heading
|
|
19
|
+
* when both don't fit on one line, and the actions move under the title when the title would be narrower than
|
|
20
|
+
* about 12 characters. Wide cards keep everything on one row.
|
|
5
21
|
* @element cm-card
|
|
6
22
|
* @slot - Body.
|
|
7
|
-
* @slot actions - Header actions (buttons, links),
|
|
23
|
+
* @slot actions - Header actions (buttons, links), at the end of the header. Since 1.3 they also show on a card with no
|
|
24
|
+
* `heading` or `description`, in a row of their own at the top of the card.
|
|
8
25
|
* @slot title-adornment - Badge or icon next to the title.
|
|
9
26
|
*/
|
|
10
27
|
export class CmCard extends LitElement {
|
|
11
28
|
constructor() {
|
|
12
29
|
super(...arguments);
|
|
30
|
+
_CmCard_instances.add(this);
|
|
13
31
|
/** Card title, rendered as a heading at `heading-level`. */
|
|
14
32
|
this.heading = '';
|
|
15
33
|
/** One sentence under the title in text-tertiary. */
|
|
@@ -18,21 +36,36 @@ export class CmCard extends LitElement {
|
|
|
18
36
|
this.flush = false;
|
|
19
37
|
/** Heading level for the title, so pages keep a correct outline. Default 2. */
|
|
20
38
|
this.headingLevel = 2;
|
|
39
|
+
_CmCard_adorned.set(this, false);
|
|
40
|
+
_CmCard_bareActions.set(this, false);
|
|
21
41
|
}
|
|
22
42
|
render() {
|
|
23
43
|
const level = Math.min(6, Math.max(2, this.headingLevel || 2));
|
|
24
44
|
const title = this.heading
|
|
25
|
-
? html `<div role="heading" aria-level=${level} class="title" part="title">${this.heading}
|
|
45
|
+
? html `<div role="heading" aria-level=${level} class="title" part="title"><span class="text">${this.heading}</span><span class="adornment" ?hidden=${!__classPrivateFieldGet(this, _CmCard_adorned, "f")}><slot name="title-adornment" @slotchange=${__classPrivateFieldGet(this, _CmCard_instances, "m", _CmCard_onAdornment)}></slot></span></div>`
|
|
26
46
|
: nothing;
|
|
27
47
|
return html `<section part="card" aria-label=${this.heading || nothing}>
|
|
28
48
|
${this.heading || this.description
|
|
29
|
-
? html `<header><div>${title}${this.description ? html `<p class="desc">${this.description}</p>` : nothing}</div>
|
|
49
|
+
? html `<header><div class="main">${this.heading ? html `<span class="strut" aria-hidden="true">${this.heading}</span>` : nothing}${title}${this.description ? html `<p class="desc">${this.description}</p>` : nothing}</div>
|
|
30
50
|
<div class="actions"><slot name="actions"></slot></div></header>`
|
|
31
|
-
:
|
|
51
|
+
: html `<div class="bare" ?hidden=${!__classPrivateFieldGet(this, _CmCard_bareActions, "f")}><div class="actions"><slot name="actions" @slotchange=${__classPrivateFieldGet(this, _CmCard_instances, "m", _CmCard_onBareActions)}></slot></div></div>`}
|
|
32
52
|
<slot></slot>
|
|
33
53
|
</section>`;
|
|
34
54
|
}
|
|
35
55
|
}
|
|
56
|
+
_CmCard_adorned = new WeakMap(), _CmCard_bareActions = new WeakMap(), _CmCard_instances = new WeakSet(), _CmCard_onAdornment = function _CmCard_onAdornment(e) {
|
|
57
|
+
const adorned = e.target.assignedNodes().some((n) => n.nodeType === Node.ELEMENT_NODE || n.textContent?.trim());
|
|
58
|
+
if (adorned !== __classPrivateFieldGet(this, _CmCard_adorned, "f")) {
|
|
59
|
+
__classPrivateFieldSet(this, _CmCard_adorned, adorned, "f");
|
|
60
|
+
this.requestUpdate();
|
|
61
|
+
}
|
|
62
|
+
}, _CmCard_onBareActions = function _CmCard_onBareActions(e) {
|
|
63
|
+
const has = e.target.assignedNodes().some((n) => n.nodeType === Node.ELEMENT_NODE || n.textContent?.trim());
|
|
64
|
+
if (has !== __classPrivateFieldGet(this, _CmCard_bareActions, "f")) {
|
|
65
|
+
__classPrivateFieldSet(this, _CmCard_bareActions, has, "f");
|
|
66
|
+
this.requestUpdate();
|
|
67
|
+
}
|
|
68
|
+
};
|
|
36
69
|
CmCard.properties = {
|
|
37
70
|
heading: {},
|
|
38
71
|
description: {},
|
|
@@ -48,11 +81,29 @@ CmCard.styles = [
|
|
|
48
81
|
border-radius: var(--cm-radius-md); padding: var(--cm-space-20);
|
|
49
82
|
}
|
|
50
83
|
:host([flush]) section { padding: 0; }
|
|
51
|
-
|
|
84
|
+
/* Wraps only on narrow cards. .main grows from a 0 basis (wide cards look exactly as before: its content stays
|
|
85
|
+
at the start), and its minimum width comes from .strut: the heading on one line, capped at 12 characters. So
|
|
86
|
+
the actions move under the title only when the heading would get less than that. */
|
|
87
|
+
header {
|
|
88
|
+
display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between;
|
|
89
|
+
gap: var(--cm-space-10) var(--cm-space-20); margin-bottom: var(--cm-space-20);
|
|
90
|
+
}
|
|
52
91
|
:host([flush]) header { padding: var(--cm-space-20) var(--cm-space-20) 0; }
|
|
53
|
-
.
|
|
92
|
+
.main { flex: 1 1 0%; max-inline-size: 100%; }
|
|
93
|
+
.strut {
|
|
94
|
+
display: block; block-size: 0; overflow: hidden; visibility: hidden; white-space: nowrap;
|
|
95
|
+
max-inline-size: 12ch; font-size: var(--cm-type-heading-sm-size); font-weight: 600;
|
|
96
|
+
}
|
|
97
|
+
.title { margin: 0; font-size: var(--cm-type-heading-sm-size); font-weight: 600; display: flex; flex-wrap: wrap; align-items: center; gap: var(--cm-space-10); }
|
|
98
|
+
/* 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-10); }
|
|
100
|
+
.adornment[hidden] { display: none; }
|
|
54
101
|
.desc { margin: 6px 0 0; font-size: 16px; color: var(--cm-text-tertiary); }
|
|
55
|
-
.actions { display: flex; gap: var(--cm-space-20); align-items: center; }
|
|
102
|
+
.actions { display: flex; flex-wrap: wrap; gap: var(--cm-space-20); align-items: center; }
|
|
103
|
+
/* 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-20); }
|
|
105
|
+
.bare[hidden] { display: none; }
|
|
106
|
+
:host([flush]) .bare { padding: var(--cm-space-20) var(--cm-space-20) 0; }
|
|
56
107
|
`,
|
|
57
108
|
];
|
|
58
109
|
define('cm-card', CmCard);
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { CmLocalizedElement } from '../localize.js';
|
|
2
|
+
import './icon.js';
|
|
3
|
+
declare const strings: {
|
|
4
|
+
/** Accessible name of each swatch with a name: "Blue, #2e6faf". */
|
|
5
|
+
swatch: string;
|
|
6
|
+
/** Accessible name of the hex box. `hexNamed` is used when the field has a label. */
|
|
7
|
+
hex: string;
|
|
8
|
+
hexNamed: string;
|
|
9
|
+
/** Placeholder of the hex box. */
|
|
10
|
+
placeholder: string;
|
|
11
|
+
/** Accessible name of the native colour picker button (`picker`). `pickerNamed` is used with a label. */
|
|
12
|
+
picker: string;
|
|
13
|
+
pickerNamed: string;
|
|
14
|
+
/** Validation message when `required` and no colour is chosen. */
|
|
15
|
+
required: string;
|
|
16
|
+
/** Validation message for text that isn't a colour. */
|
|
17
|
+
invalid: string;
|
|
18
|
+
/** Names of the default swatches. */
|
|
19
|
+
black: string;
|
|
20
|
+
grey: string;
|
|
21
|
+
lightGrey: string;
|
|
22
|
+
red: string;
|
|
23
|
+
darkOrange: string;
|
|
24
|
+
orange: string;
|
|
25
|
+
yellow: string;
|
|
26
|
+
lightGreen: string;
|
|
27
|
+
green: string;
|
|
28
|
+
lightBlue: string;
|
|
29
|
+
blue: string;
|
|
30
|
+
indigo: string;
|
|
31
|
+
};
|
|
32
|
+
declare module '../localize.js' {
|
|
33
|
+
interface CmStrings {
|
|
34
|
+
colorField: typeof strings;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/** A swatch: a colour as `#rrggbb` and an optional name for its accessible name and tooltip. */
|
|
38
|
+
export interface ColorSwatch {
|
|
39
|
+
value: string;
|
|
40
|
+
name?: string;
|
|
41
|
+
}
|
|
42
|
+
/** `#RGB`, `RRGGBB`, `#RRGGBB` (any case, spaces around) -> `#rrggbb`; anything else -> null. */
|
|
43
|
+
export declare function normalizeHex(text: string): string | null;
|
|
44
|
+
/**
|
|
45
|
+
* Black or white, whichever contrasts more with the swatch (always 4.5:1 or more). The swatch colour is data, not
|
|
46
|
+
* a theme colour, so this pairs it with plain black or white rather than a token that changes with the theme.
|
|
47
|
+
*/
|
|
48
|
+
export declare function checkColor(hex: string): '#000000' | '#ffffff';
|
|
49
|
+
/**
|
|
50
|
+
* Colour field: a palette of swatches, a hex box and, optionally, the browser's colour picker. For colours that
|
|
51
|
+
* mean something to the merchant, such as the colour of each lead status. The value is lowercase `#rrggbb`.
|
|
52
|
+
* Participates in native forms.
|
|
53
|
+
* @element cm-color-field
|
|
54
|
+
* @fires input - When the colour changes: a swatch, a complete hex code typed, or the picker moving.
|
|
55
|
+
* @fires change - When the colour is committed: a swatch picked, the hex box left or Enter pressed, the picker closed.
|
|
56
|
+
* @csspart label - The label.
|
|
57
|
+
* @csspart swatches - The swatch radio group.
|
|
58
|
+
* @csspart swatch - Each swatch.
|
|
59
|
+
* @csspart input - The hex box.
|
|
60
|
+
*/
|
|
61
|
+
export declare class CmColorField extends CmLocalizedElement {
|
|
62
|
+
#private;
|
|
63
|
+
static formAssociated: boolean;
|
|
64
|
+
static shadowRootOptions: {
|
|
65
|
+
delegatesFocus: boolean;
|
|
66
|
+
mode: ShadowRootMode;
|
|
67
|
+
serializable?: boolean;
|
|
68
|
+
slotAssignment?: SlotAssignmentMode;
|
|
69
|
+
};
|
|
70
|
+
static properties: {
|
|
71
|
+
label: {};
|
|
72
|
+
hint: {};
|
|
73
|
+
helpText: {
|
|
74
|
+
attribute: string;
|
|
75
|
+
};
|
|
76
|
+
error: {
|
|
77
|
+
reflect: boolean;
|
|
78
|
+
};
|
|
79
|
+
name: {
|
|
80
|
+
reflect: boolean;
|
|
81
|
+
};
|
|
82
|
+
value: {};
|
|
83
|
+
swatches: {
|
|
84
|
+
type: ArrayConstructor;
|
|
85
|
+
};
|
|
86
|
+
picker: {
|
|
87
|
+
type: BooleanConstructor;
|
|
88
|
+
};
|
|
89
|
+
required: {
|
|
90
|
+
type: BooleanConstructor;
|
|
91
|
+
reflect: boolean;
|
|
92
|
+
};
|
|
93
|
+
disabled: {
|
|
94
|
+
type: BooleanConstructor;
|
|
95
|
+
reflect: boolean;
|
|
96
|
+
};
|
|
97
|
+
_draft: {
|
|
98
|
+
state: boolean;
|
|
99
|
+
};
|
|
100
|
+
_invalid: {
|
|
101
|
+
state: boolean;
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
/** Visible label above the swatches, e.g. "Colour". Without one, give the element an `aria-label`. */
|
|
105
|
+
label: string;
|
|
106
|
+
/** Lowercase bracketed note after the label, e.g. "shown on the status tag". */
|
|
107
|
+
hint: string;
|
|
108
|
+
/** One sentence under the field in text-tertiary. */
|
|
109
|
+
helpText: string;
|
|
110
|
+
/** Error message from your own validation; turns the hex box critical and is announced. */
|
|
111
|
+
error: string;
|
|
112
|
+
/** Form field name. */
|
|
113
|
+
name: string;
|
|
114
|
+
/** The colour as lowercase `#rrggbb`, or empty for none. `#ABC` and `ABCDEF` are accepted and normalised. */
|
|
115
|
+
value: string;
|
|
116
|
+
/**
|
|
117
|
+
* The palette, as `#rrggbb` strings or `{ value, name }`. Names are read out with the hex code and shown as a
|
|
118
|
+
* tooltip. Default: 12 colours from the Commmerce tokens (black, greys, red, oranges, yellow, greens, blues).
|
|
119
|
+
* In HTML, pass JSON: `swatches='["#2e6faf", {"value": "#de0000", "name": "Lost"}]'`.
|
|
120
|
+
*/
|
|
121
|
+
swatches?: Array<string | ColorSwatch>;
|
|
122
|
+
/** Adds a button that opens the browser's own colour picker, for colours outside the palette. */
|
|
123
|
+
picker: boolean;
|
|
124
|
+
/** Shows a red asterisk and blocks form submission until a colour is chosen. */
|
|
125
|
+
required: boolean;
|
|
126
|
+
/** Blocks interaction. Also set by a disabled `<fieldset>`. */
|
|
127
|
+
disabled: boolean;
|
|
128
|
+
/** Text in the hex box while it differs from `value`. */
|
|
129
|
+
_draft?: string;
|
|
130
|
+
/** The hex box holds text that isn't a colour (after it was committed). */
|
|
131
|
+
_invalid: boolean;
|
|
132
|
+
static styles: import("lit").CSSResult[];
|
|
133
|
+
connectedCallback(): void;
|
|
134
|
+
get form(): HTMLFormElement | null;
|
|
135
|
+
get validity(): ValidityState;
|
|
136
|
+
get validationMessage(): string;
|
|
137
|
+
checkValidity(): boolean;
|
|
138
|
+
reportValidity(): boolean;
|
|
139
|
+
formResetCallback(): void;
|
|
140
|
+
formDisabledCallback(d: boolean): void;
|
|
141
|
+
formStateRestoreCallback(state: string): void;
|
|
142
|
+
/** The swatches in use, normalised, with their names. Invalid colours are left out. */
|
|
143
|
+
get items(): ColorSwatch[];
|
|
144
|
+
willUpdate(changed: Map<string, unknown>): void;
|
|
145
|
+
updated(): void;
|
|
146
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
147
|
+
}
|
|
148
|
+
declare global {
|
|
149
|
+
interface HTMLElementTagNameMap {
|
|
150
|
+
'cm-color-field': CmColorField;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
export {};
|