@commmerce/ui 1.2.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/THIRD_PARTY_NOTICES.txt +101 -0
- package/dist/cdn.js +1144 -547
- package/dist/components/app-frame.d.ts +1 -0
- package/dist/components/app-frame.js +2 -1
- package/dist/components/board.d.ts +338 -0
- package/dist/components/board.js +1017 -0
- package/dist/components/calendar.d.ts +380 -0
- package/dist/components/calendar.js +1479 -0
- package/dist/components/card.d.ts +2 -1
- package/dist/components/card.js +16 -4
- 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/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/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/select.d.ts +20 -3
- package/dist/components/select.js +35 -11
- package/dist/components/signature-field.d.ts +153 -0
- package/dist/components/signature-field.js +726 -0
- package/dist/custom-elements.json +11895 -6087
- 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
|
@@ -7,7 +7,8 @@ import { LitElement } from 'lit';
|
|
|
7
7
|
* about 12 characters. Wide cards keep everything on one row.
|
|
8
8
|
* @element cm-card
|
|
9
9
|
* @slot - Body.
|
|
10
|
-
* @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.
|
|
11
12
|
* @slot title-adornment - Badge or icon next to the title.
|
|
12
13
|
*/
|
|
13
14
|
export declare class CmCard extends LitElement {
|
package/dist/components/card.js
CHANGED
|
@@ -9,7 +9,7 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
|
|
|
9
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
10
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
11
11
|
};
|
|
12
|
-
var _CmCard_instances, _CmCard_adorned, _CmCard_onAdornment;
|
|
12
|
+
var _CmCard_instances, _CmCard_adorned, _CmCard_bareActions, _CmCard_onAdornment, _CmCard_onBareActions;
|
|
13
13
|
import { LitElement, html, css, nothing } from 'lit';
|
|
14
14
|
import { base, define } from '../base.js';
|
|
15
15
|
/**
|
|
@@ -20,7 +20,8 @@ import { base, define } from '../base.js';
|
|
|
20
20
|
* about 12 characters. Wide cards keep everything on one row.
|
|
21
21
|
* @element cm-card
|
|
22
22
|
* @slot - Body.
|
|
23
|
-
* @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.
|
|
24
25
|
* @slot title-adornment - Badge or icon next to the title.
|
|
25
26
|
*/
|
|
26
27
|
export class CmCard extends LitElement {
|
|
@@ -36,6 +37,7 @@ export class CmCard extends LitElement {
|
|
|
36
37
|
/** Heading level for the title, so pages keep a correct outline. Default 2. */
|
|
37
38
|
this.headingLevel = 2;
|
|
38
39
|
_CmCard_adorned.set(this, false);
|
|
40
|
+
_CmCard_bareActions.set(this, false);
|
|
39
41
|
}
|
|
40
42
|
render() {
|
|
41
43
|
const level = Math.min(6, Math.max(2, this.headingLevel || 2));
|
|
@@ -46,17 +48,23 @@ export class CmCard extends LitElement {
|
|
|
46
48
|
${this.heading || this.description
|
|
47
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>
|
|
48
50
|
<div class="actions"><slot name="actions"></slot></div></header>`
|
|
49
|
-
:
|
|
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>`}
|
|
50
52
|
<slot></slot>
|
|
51
53
|
</section>`;
|
|
52
54
|
}
|
|
53
55
|
}
|
|
54
|
-
_CmCard_adorned = new WeakMap(), _CmCard_instances = new WeakSet(), _CmCard_onAdornment = function _CmCard_onAdornment(e) {
|
|
56
|
+
_CmCard_adorned = new WeakMap(), _CmCard_bareActions = new WeakMap(), _CmCard_instances = new WeakSet(), _CmCard_onAdornment = function _CmCard_onAdornment(e) {
|
|
55
57
|
const adorned = e.target.assignedNodes().some((n) => n.nodeType === Node.ELEMENT_NODE || n.textContent?.trim());
|
|
56
58
|
if (adorned !== __classPrivateFieldGet(this, _CmCard_adorned, "f")) {
|
|
57
59
|
__classPrivateFieldSet(this, _CmCard_adorned, adorned, "f");
|
|
58
60
|
this.requestUpdate();
|
|
59
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
|
+
}
|
|
60
68
|
};
|
|
61
69
|
CmCard.properties = {
|
|
62
70
|
heading: {},
|
|
@@ -92,6 +100,10 @@ CmCard.styles = [
|
|
|
92
100
|
.adornment[hidden] { display: none; }
|
|
93
101
|
.desc { margin: 6px 0 0; font-size: 16px; color: var(--cm-text-tertiary); }
|
|
94
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; }
|
|
95
107
|
`,
|
|
96
108
|
];
|
|
97
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 {};
|
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
2
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
4
|
+
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");
|
|
5
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
6
|
+
};
|
|
7
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9
|
+
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");
|
|
10
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
+
};
|
|
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
|
+
import { LitElement, html, css, nothing } from 'lit';
|
|
14
|
+
import { live } from 'lit/directives/live.js';
|
|
15
|
+
import { base, define, nextId, logicalKey } from '../base.js';
|
|
16
|
+
import { CmLocalizedElement, defineStrings } from '../localize.js';
|
|
17
|
+
import './icon.js';
|
|
18
|
+
const strings = defineStrings('colorField', {
|
|
19
|
+
/** Accessible name of each swatch with a name: "Blue, #2e6faf". */
|
|
20
|
+
swatch: '{name}, {hex}',
|
|
21
|
+
/** Accessible name of the hex box. `hexNamed` is used when the field has a label. */
|
|
22
|
+
hex: 'Hex code',
|
|
23
|
+
hexNamed: '{label}, hex code',
|
|
24
|
+
/** Placeholder of the hex box. */
|
|
25
|
+
placeholder: '#RRGGBB',
|
|
26
|
+
/** Accessible name of the native colour picker button (`picker`). `pickerNamed` is used with a label. */
|
|
27
|
+
picker: 'Choose a custom colour',
|
|
28
|
+
pickerNamed: 'Choose a custom colour for {label}',
|
|
29
|
+
/** Validation message when `required` and no colour is chosen. */
|
|
30
|
+
required: 'Please choose a colour.',
|
|
31
|
+
/** Validation message for text that isn't a colour. */
|
|
32
|
+
invalid: 'Enter a colour as #RRGGBB, for example #2e6faf.',
|
|
33
|
+
/** Names of the default swatches. */
|
|
34
|
+
black: 'Black',
|
|
35
|
+
grey: 'Grey',
|
|
36
|
+
lightGrey: 'Light grey',
|
|
37
|
+
red: 'Red',
|
|
38
|
+
darkOrange: 'Dark orange',
|
|
39
|
+
orange: 'Orange',
|
|
40
|
+
yellow: 'Yellow',
|
|
41
|
+
lightGreen: 'Light green',
|
|
42
|
+
green: 'Green',
|
|
43
|
+
lightBlue: 'Light blue',
|
|
44
|
+
blue: 'Blue',
|
|
45
|
+
indigo: 'Indigo',
|
|
46
|
+
});
|
|
47
|
+
/**
|
|
48
|
+
* The default palette: the hues of Commmerce's light theme tokens (text-*, bg-*, icon-rating, nav-badge, gray-*), so
|
|
49
|
+
* colours picked for pick-list values sit well next to the admin. Names are built-in strings (translatable).
|
|
50
|
+
*/
|
|
51
|
+
const DEFAULT_SWATCHES = [
|
|
52
|
+
{ value: '#000000', key: 'black' },
|
|
53
|
+
{ value: '#707070', key: 'grey' },
|
|
54
|
+
{ value: '#c9c9c9', key: 'lightGrey' },
|
|
55
|
+
{ value: '#de0000', key: 'red' },
|
|
56
|
+
{ value: '#ad5500', key: 'darkOrange' },
|
|
57
|
+
{ value: '#f1a953', key: 'orange' },
|
|
58
|
+
{ value: '#ffc107', key: 'yellow' },
|
|
59
|
+
{ value: '#81bb47', key: 'lightGreen' },
|
|
60
|
+
{ value: '#3c7c00', key: 'green' },
|
|
61
|
+
{ value: '#5394d9', key: 'lightBlue' },
|
|
62
|
+
{ value: '#2e6faf', key: 'blue' },
|
|
63
|
+
{ value: '#446beb', key: 'indigo' },
|
|
64
|
+
];
|
|
65
|
+
/** `#RGB`, `RRGGBB`, `#RRGGBB` (any case, spaces around) -> `#rrggbb`; anything else -> null. */
|
|
66
|
+
export function normalizeHex(text) {
|
|
67
|
+
const m = /^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(text.trim());
|
|
68
|
+
if (!m)
|
|
69
|
+
return null;
|
|
70
|
+
const h = m[1].length === 3 ? [...m[1]].map((c) => c + c).join('') : m[1];
|
|
71
|
+
return `#${h.toLowerCase()}`;
|
|
72
|
+
}
|
|
73
|
+
const luminance = (hex) => {
|
|
74
|
+
const n = parseInt(hex.slice(1), 16);
|
|
75
|
+
return [(n >> 16) & 255, (n >> 8) & 255, n & 255]
|
|
76
|
+
.map((v) => v / 255)
|
|
77
|
+
.map((v) => (v <= 0.04045 ? v / 12.92 : ((v + 0.055) / 1.055) ** 2.4))
|
|
78
|
+
.reduce((s, v, i) => s + v * [0.2126, 0.7152, 0.0722][i], 0);
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Black or white, whichever contrasts more with the swatch (always 4.5:1 or more). The swatch colour is data, not
|
|
82
|
+
* a theme colour, so this pairs it with plain black or white rather than a token that changes with the theme.
|
|
83
|
+
*/
|
|
84
|
+
export function checkColor(hex) {
|
|
85
|
+
const l = luminance(hex);
|
|
86
|
+
return (l + 0.05) / 0.05 >= 1.05 / (l + 0.05) ? '#000000' : '#ffffff';
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Colour field: a palette of swatches, a hex box and, optionally, the browser's colour picker. For colours that
|
|
90
|
+
* mean something to the merchant, such as the colour of each lead status. The value is lowercase `#rrggbb`.
|
|
91
|
+
* Participates in native forms.
|
|
92
|
+
* @element cm-color-field
|
|
93
|
+
* @fires input - When the colour changes: a swatch, a complete hex code typed, or the picker moving.
|
|
94
|
+
* @fires change - When the colour is committed: a swatch picked, the hex box left or Enter pressed, the picker closed.
|
|
95
|
+
* @csspart label - The label.
|
|
96
|
+
* @csspart swatches - The swatch radio group.
|
|
97
|
+
* @csspart swatch - Each swatch.
|
|
98
|
+
* @csspart input - The hex box.
|
|
99
|
+
*/
|
|
100
|
+
export class CmColorField extends CmLocalizedElement {
|
|
101
|
+
constructor() {
|
|
102
|
+
super(...arguments);
|
|
103
|
+
_CmColorField_instances.add(this);
|
|
104
|
+
/** Visible label above the swatches, e.g. "Colour". Without one, give the element an `aria-label`. */
|
|
105
|
+
this.label = '';
|
|
106
|
+
/** Lowercase bracketed note after the label, e.g. "shown on the status tag". */
|
|
107
|
+
this.hint = '';
|
|
108
|
+
/** One sentence under the field in text-tertiary. */
|
|
109
|
+
this.helpText = '';
|
|
110
|
+
/** Error message from your own validation; turns the hex box critical and is announced. */
|
|
111
|
+
this.error = '';
|
|
112
|
+
/** Form field name. */
|
|
113
|
+
this.name = '';
|
|
114
|
+
/** The colour as lowercase `#rrggbb`, or empty for none. `#ABC` and `ABCDEF` are accepted and normalised. */
|
|
115
|
+
this.value = '';
|
|
116
|
+
/** Adds a button that opens the browser's own colour picker, for colours outside the palette. */
|
|
117
|
+
this.picker = false;
|
|
118
|
+
/** Shows a red asterisk and blocks form submission until a colour is chosen. */
|
|
119
|
+
this.required = false;
|
|
120
|
+
/** Blocks interaction. Also set by a disabled `<fieldset>`. */
|
|
121
|
+
this.disabled = false;
|
|
122
|
+
/** The hex box holds text that isn't a colour (after it was committed). */
|
|
123
|
+
this._invalid = false;
|
|
124
|
+
_CmColorField_internals.set(this, this.attachInternals());
|
|
125
|
+
_CmColorField_id.set(this, nextId('cm-cf'));
|
|
126
|
+
_CmColorField_defaultValue.set(this, '');
|
|
127
|
+
/** The value this element set itself from the hex box; any other new value replaces the box's text. */
|
|
128
|
+
_CmColorField_typed.set(this, void 0);
|
|
129
|
+
}
|
|
130
|
+
connectedCallback() {
|
|
131
|
+
super.connectedCallback();
|
|
132
|
+
__classPrivateFieldSet(this, _CmColorField_defaultValue, normalizeHex(this.value) ?? this.value, "f");
|
|
133
|
+
}
|
|
134
|
+
get form() { return __classPrivateFieldGet(this, _CmColorField_internals, "f").form; }
|
|
135
|
+
get validity() { return __classPrivateFieldGet(this, _CmColorField_internals, "f").validity; }
|
|
136
|
+
get validationMessage() { return __classPrivateFieldGet(this, _CmColorField_internals, "f").validationMessage; }
|
|
137
|
+
checkValidity() { return __classPrivateFieldGet(this, _CmColorField_internals, "f").checkValidity(); }
|
|
138
|
+
reportValidity() { return __classPrivateFieldGet(this, _CmColorField_internals, "f").reportValidity(); }
|
|
139
|
+
formResetCallback() {
|
|
140
|
+
this.value = __classPrivateFieldGet(this, _CmColorField_defaultValue, "f");
|
|
141
|
+
this._draft = undefined;
|
|
142
|
+
this._invalid = false;
|
|
143
|
+
}
|
|
144
|
+
formDisabledCallback(d) { this.disabled = d; }
|
|
145
|
+
formStateRestoreCallback(state) { this.value = state; }
|
|
146
|
+
/** The swatches in use, normalised, with their names. Invalid colours are left out. */
|
|
147
|
+
get items() {
|
|
148
|
+
if (!this.swatches)
|
|
149
|
+
return DEFAULT_SWATCHES.map((s) => ({ value: s.value, name: this.t(s.key) }));
|
|
150
|
+
return this.swatches.flatMap((s) => {
|
|
151
|
+
const o = typeof s === 'string' ? { value: s } : s;
|
|
152
|
+
const value = normalizeHex(o?.value ?? '');
|
|
153
|
+
return value ? [{ value, name: o.name }] : [];
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
willUpdate(changed) {
|
|
157
|
+
if (changed.has('value')) {
|
|
158
|
+
const n = normalizeHex(this.value ?? '');
|
|
159
|
+
if (n && n !== this.value)
|
|
160
|
+
this.value = n;
|
|
161
|
+
if (this.hasUpdated && this.value !== __classPrivateFieldGet(this, _CmColorField_typed, "f")) {
|
|
162
|
+
this._draft = undefined;
|
|
163
|
+
this._invalid = false;
|
|
164
|
+
}
|
|
165
|
+
__classPrivateFieldSet(this, _CmColorField_typed, undefined, "f");
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
updated() {
|
|
169
|
+
const ok = !this.value || normalizeHex(this.value) !== null;
|
|
170
|
+
__classPrivateFieldGet(this, _CmColorField_internals, "f").setFormValue(this.value && ok ? this.value : null, this.value);
|
|
171
|
+
const anchor = this.renderRoot.querySelector('.input') ?? undefined;
|
|
172
|
+
if (this.error)
|
|
173
|
+
__classPrivateFieldGet(this, _CmColorField_internals, "f").setValidity({ customError: true }, this.error, anchor);
|
|
174
|
+
else if (this._invalid || !ok)
|
|
175
|
+
__classPrivateFieldGet(this, _CmColorField_internals, "f").setValidity({ patternMismatch: true }, this.t('invalid'), anchor);
|
|
176
|
+
else if (this.required && !this.value)
|
|
177
|
+
__classPrivateFieldGet(this, _CmColorField_internals, "f").setValidity({ valueMissing: true }, this.t('required'), anchor);
|
|
178
|
+
else
|
|
179
|
+
__classPrivateFieldGet(this, _CmColorField_internals, "f").setValidity({});
|
|
180
|
+
}
|
|
181
|
+
render() {
|
|
182
|
+
const items = this.items;
|
|
183
|
+
const current = normalizeHex(this.value ?? '');
|
|
184
|
+
const sel = items.findIndex((s) => s.value === current);
|
|
185
|
+
const message = this.error || (this._invalid || (this.value && !current) ? this.t('invalid') : '');
|
|
186
|
+
const describedBy = [message && `${__classPrivateFieldGet(this, _CmColorField_id, "f")}-err`, this.helpText && `${__classPrivateFieldGet(this, _CmColorField_id, "f")}-help`].filter(Boolean).join(' ') || nothing;
|
|
187
|
+
const hostLabel = this.getAttribute('aria-label');
|
|
188
|
+
const named = this.label || hostLabel || '';
|
|
189
|
+
return html `<div class="field">
|
|
190
|
+
${this.label
|
|
191
|
+
? html `<span class="label" id="${__classPrivateFieldGet(this, _CmColorField_id, "f")}-l" part="label">${this.label}${this.required ? html `<span class="req" aria-hidden="true">*</span>` : nothing}${this.hint ? html `<span class="hint">[${this.hint}]</span>` : nothing}</span>`
|
|
192
|
+
: nothing}
|
|
193
|
+
${items.length
|
|
194
|
+
? html `<div class="swatches" part="swatches" role="radiogroup"
|
|
195
|
+
aria-labelledby=${this.label ? `${__classPrivateFieldGet(this, _CmColorField_id, "f")}-l` : nothing} aria-label=${!this.label && hostLabel ? hostLabel : nothing}
|
|
196
|
+
aria-required=${this.required ? 'true' : nothing} aria-describedby=${describedBy}>
|
|
197
|
+
${items.map((s, i) => {
|
|
198
|
+
const name = s.name ? this.t('swatch', { name: s.name, hex: s.value }) : s.value;
|
|
199
|
+
return html `<button type="button" class="swatch" part="swatch" role="radio" aria-checked=${i === sel ? 'true' : 'false'}
|
|
200
|
+
aria-label=${name} title=${s.name || s.value} tabindex=${i === (sel >= 0 ? sel : 0) ? '0' : '-1'} ?disabled=${this.disabled}
|
|
201
|
+
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="18"></cm-icon></button>`;
|
|
203
|
+
})}
|
|
204
|
+
</div>`
|
|
205
|
+
: nothing}
|
|
206
|
+
<div class="row">
|
|
207
|
+
${this.picker
|
|
208
|
+
? html `<label class="pick" part="picker" style=${current ? `background-color:${current}` : nothing}>
|
|
209
|
+
<input type="color" .value=${live(current ?? '#000000')} ?disabled=${this.disabled}
|
|
210
|
+
aria-label=${named ? this.t('pickerNamed', { label: named }) : this.t('picker')}
|
|
211
|
+
@input=${__classPrivateFieldGet(this, _CmColorField_instances, "m", _CmColorField_onPickerInput)} @change=${__classPrivateFieldGet(this, _CmColorField_instances, "m", _CmColorField_onPickerChange)} />
|
|
212
|
+
<cm-icon name="edit" size="12" aria-hidden="true"></cm-icon>
|
|
213
|
+
</label>`
|
|
214
|
+
: html `<span class="preview" part="preview" aria-hidden="true" style=${current ? `background-color:${current}` : nothing}></span>`}
|
|
215
|
+
<input class="input" part="input" id=${__classPrivateFieldGet(this, _CmColorField_id, "f")} type="text" inputmode="text" autocomplete="off" spellcheck="false"
|
|
216
|
+
maxlength="7" .value=${live(this._draft ?? this.value ?? '')} placeholder=${this.t('placeholder')}
|
|
217
|
+
aria-label=${named ? this.t('hexNamed', { label: named }) : this.t('hex')}
|
|
218
|
+
?required=${this.required} ?disabled=${this.disabled}
|
|
219
|
+
aria-invalid=${message ? 'true' : nothing} aria-describedby=${describedBy}
|
|
220
|
+
@input=${__classPrivateFieldGet(this, _CmColorField_instances, "m", _CmColorField_onHexInput)} @change=${__classPrivateFieldGet(this, _CmColorField_instances, "m", _CmColorField_onHexChange)} @keydown=${__classPrivateFieldGet(this, _CmColorField_instances, "m", _CmColorField_onHexKey)} />
|
|
221
|
+
</div>
|
|
222
|
+
${message ? html `<p class="error" id="${__classPrivateFieldGet(this, _CmColorField_id, "f")}-err" role="alert">${message}</p>` : nothing}
|
|
223
|
+
${this.helpText ? html `<p class="help" id="${__classPrivateFieldGet(this, _CmColorField_id, "f")}-help">${this.helpText}</p>` : nothing}
|
|
224
|
+
</div>`;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
_CmColorField_internals = new WeakMap(), _CmColorField_id = new WeakMap(), _CmColorField_defaultValue = new WeakMap(), _CmColorField_typed = new WeakMap(), _CmColorField_instances = new WeakSet(), _CmColorField_emit = function _CmColorField_emit(...types) {
|
|
228
|
+
for (const type of types)
|
|
229
|
+
this.dispatchEvent(new Event(type, { bubbles: true, composed: true }));
|
|
230
|
+
}, _CmColorField_pick = function _CmColorField_pick(i) {
|
|
231
|
+
const s = this.items[i];
|
|
232
|
+
if (!s || this.disabled)
|
|
233
|
+
return;
|
|
234
|
+
this.updateComplete.then(() => this.renderRoot.querySelectorAll('.swatch')[i]?.focus());
|
|
235
|
+
this._draft = undefined;
|
|
236
|
+
this._invalid = false;
|
|
237
|
+
if (s.value === this.value)
|
|
238
|
+
return;
|
|
239
|
+
this.value = s.value;
|
|
240
|
+
__classPrivateFieldGet(this, _CmColorField_instances, "m", _CmColorField_emit).call(this, 'input', 'change');
|
|
241
|
+
}, _CmColorField_onSwatchKey = function _CmColorField_onSwatchKey(e, i) {
|
|
242
|
+
const n = this.items.length;
|
|
243
|
+
const key = logicalKey(e, this);
|
|
244
|
+
let next;
|
|
245
|
+
if (key === 'ArrowRight' || e.key === 'ArrowDown')
|
|
246
|
+
next = (i + 1) % n;
|
|
247
|
+
else if (key === 'ArrowLeft' || e.key === 'ArrowUp')
|
|
248
|
+
next = (i - 1 + n) % n;
|
|
249
|
+
else if (e.key === 'Home')
|
|
250
|
+
next = 0;
|
|
251
|
+
else if (e.key === 'End')
|
|
252
|
+
next = n - 1;
|
|
253
|
+
else if (e.key === ' ' || e.key === 'Enter')
|
|
254
|
+
next = i;
|
|
255
|
+
else
|
|
256
|
+
return;
|
|
257
|
+
e.preventDefault();
|
|
258
|
+
__classPrivateFieldGet(this, _CmColorField_instances, "m", _CmColorField_pick).call(this, next);
|
|
259
|
+
}, _CmColorField_onHexInput = function _CmColorField_onHexInput(e) {
|
|
260
|
+
e.stopPropagation();
|
|
261
|
+
const text = e.target.value;
|
|
262
|
+
this._draft = text;
|
|
263
|
+
const n = /^#?[0-9a-f]{6}$/i.test(text.trim()) ? normalizeHex(text) : null; // live only for full codes
|
|
264
|
+
if (n && n !== this.value) {
|
|
265
|
+
__classPrivateFieldSet(this, _CmColorField_typed, n, "f");
|
|
266
|
+
this.value = n;
|
|
267
|
+
__classPrivateFieldGet(this, _CmColorField_instances, "m", _CmColorField_emit).call(this, 'input');
|
|
268
|
+
}
|
|
269
|
+
if (this._invalid && (n || !text.trim()))
|
|
270
|
+
this._invalid = false;
|
|
271
|
+
}, _CmColorField_commitHex = function _CmColorField_commitHex() {
|
|
272
|
+
if (this._draft === undefined)
|
|
273
|
+
return;
|
|
274
|
+
const text = this._draft.trim();
|
|
275
|
+
const n = text ? normalizeHex(text) : '';
|
|
276
|
+
if (n === null) {
|
|
277
|
+
this._invalid = true;
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
const before = this.value;
|
|
281
|
+
this.value = n;
|
|
282
|
+
this._draft = undefined;
|
|
283
|
+
this._invalid = false;
|
|
284
|
+
if (n !== before)
|
|
285
|
+
__classPrivateFieldGet(this, _CmColorField_instances, "m", _CmColorField_emit).call(this, 'input');
|
|
286
|
+
__classPrivateFieldGet(this, _CmColorField_instances, "m", _CmColorField_emit).call(this, 'change');
|
|
287
|
+
}, _CmColorField_onHexChange = function _CmColorField_onHexChange(e) {
|
|
288
|
+
e.stopPropagation();
|
|
289
|
+
__classPrivateFieldGet(this, _CmColorField_instances, "m", _CmColorField_commitHex).call(this);
|
|
290
|
+
}, _CmColorField_onHexKey = function _CmColorField_onHexKey(e) {
|
|
291
|
+
if (e.key === 'Enter')
|
|
292
|
+
__classPrivateFieldGet(this, _CmColorField_instances, "m", _CmColorField_commitHex).call(this);
|
|
293
|
+
}, _CmColorField_onPickerInput = function _CmColorField_onPickerInput(e) {
|
|
294
|
+
e.stopPropagation();
|
|
295
|
+
const n = normalizeHex(e.target.value);
|
|
296
|
+
if (!n || n === this.value)
|
|
297
|
+
return;
|
|
298
|
+
this.value = n;
|
|
299
|
+
this._draft = undefined;
|
|
300
|
+
this._invalid = false;
|
|
301
|
+
__classPrivateFieldGet(this, _CmColorField_instances, "m", _CmColorField_emit).call(this, 'input');
|
|
302
|
+
}, _CmColorField_onPickerChange = function _CmColorField_onPickerChange(e) {
|
|
303
|
+
e.stopPropagation();
|
|
304
|
+
__classPrivateFieldGet(this, _CmColorField_instances, "m", _CmColorField_emit).call(this, 'change');
|
|
305
|
+
};
|
|
306
|
+
CmColorField.formAssociated = true;
|
|
307
|
+
CmColorField.shadowRootOptions = { ...LitElement.shadowRootOptions, delegatesFocus: true };
|
|
308
|
+
CmColorField.properties = {
|
|
309
|
+
label: {},
|
|
310
|
+
hint: {},
|
|
311
|
+
helpText: { attribute: 'help-text' },
|
|
312
|
+
error: { reflect: true },
|
|
313
|
+
name: { reflect: true },
|
|
314
|
+
value: {},
|
|
315
|
+
swatches: { type: Array },
|
|
316
|
+
picker: { type: Boolean },
|
|
317
|
+
required: { type: Boolean, reflect: true },
|
|
318
|
+
disabled: { type: Boolean, reflect: true },
|
|
319
|
+
_draft: { state: true },
|
|
320
|
+
_invalid: { state: true },
|
|
321
|
+
};
|
|
322
|
+
CmColorField.styles = [
|
|
323
|
+
base,
|
|
324
|
+
css `
|
|
325
|
+
:host { display: block; }
|
|
326
|
+
.field { display: flex; flex-direction: column; gap: var(--cm-space-10); }
|
|
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; }
|
|
331
|
+
.swatch {
|
|
332
|
+
position: relative; display: inline-flex; align-items: center; justify-content: center;
|
|
333
|
+
width: 32px; height: 32px; padding: 0; cursor: pointer; border-radius: var(--cm-radius-full);
|
|
334
|
+
border: var(--cm-border-1) solid var(--cm-border-input);
|
|
335
|
+
}
|
|
336
|
+
.swatch cm-icon { visibility: hidden; }
|
|
337
|
+
.swatch[aria-checked='true'] { box-shadow: 0 0 0 2px var(--cm-bg-surface), 0 0 0 4px var(--cm-border-strong); }
|
|
338
|
+
.swatch[aria-checked='true'] cm-icon { visibility: visible; }
|
|
339
|
+
.swatch:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 6px; }
|
|
340
|
+
.swatch:disabled { cursor: not-allowed; opacity: 0.4; }
|
|
341
|
+
.row { display: flex; align-items: center; gap: var(--cm-space-10); }
|
|
342
|
+
.preview, .pick {
|
|
343
|
+
position: relative; flex: none; width: 42px; height: 42px; border-radius: var(--cm-radius-sm);
|
|
344
|
+
border: var(--cm-border-1) solid var(--cm-border-input); background: var(--cm-bg-inset);
|
|
345
|
+
}
|
|
346
|
+
.pick { cursor: pointer; }
|
|
347
|
+
.pick input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: inherit; padding: 0; border: 0; }
|
|
348
|
+
.pick:focus-within { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
349
|
+
.pick cm-icon {
|
|
350
|
+
position: absolute; inset-inline-end: -6px; bottom: -6px; padding: 2px; border-radius: var(--cm-radius-full);
|
|
351
|
+
background: var(--cm-bg-surface); color: var(--cm-text-default); border: var(--cm-border-1) solid var(--cm-border-input);
|
|
352
|
+
}
|
|
353
|
+
.input {
|
|
354
|
+
width: 11ch; min-width: 0; flex: 0 1 auto; height: 42px; padding: 0 var(--cm-space-10);
|
|
355
|
+
font: inherit; font-size: 16px; font-variant-numeric: tabular-nums; color: var(--cm-text-default);
|
|
356
|
+
background: var(--cm-bg-surface); border: var(--cm-border-1) solid var(--cm-border-input);
|
|
357
|
+
border-radius: var(--cm-radius-sm); outline: none; box-sizing: content-box;
|
|
358
|
+
}
|
|
359
|
+
.input::placeholder { color: var(--cm-text-tertiary); }
|
|
360
|
+
.input:focus { border-color: var(--cm-border-strong); box-shadow: 0 0 0 1px var(--cm-border-strong); }
|
|
361
|
+
.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-default); cursor: not-allowed; }
|
|
363
|
+
:host([disabled]) .pick { cursor: not-allowed; opacity: 0.4; }
|
|
364
|
+
: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
|
+
`,
|
|
368
|
+
];
|
|
369
|
+
define('cm-color-field', CmColorField);
|
|
@@ -20,6 +20,8 @@ declare const strings: {
|
|
|
20
20
|
required: string;
|
|
21
21
|
/** Validation: `required`, `multiple` and nothing chosen. */
|
|
22
22
|
requiredMultiple: string;
|
|
23
|
+
/** The chosen option in the box or its tag with `show-group`: "Lead: Company". */
|
|
24
|
+
grouped: string;
|
|
23
25
|
};
|
|
24
26
|
declare module '../localize.js' {
|
|
25
27
|
interface CmStrings {
|
|
@@ -32,9 +34,11 @@ declare module '../localize.js' {
|
|
|
32
34
|
* tags). With `filter="none"` it doesn't filter by itself: listen for `cm-search`, fetch matches, set `options`
|
|
33
35
|
* and toggle `loading`. With `allow-custom` the merchant can add a value that isn't in the list (a new product tag).
|
|
34
36
|
*
|
|
35
|
-
* Options come from `<option>` children or the `options` property, as for `cm-select
|
|
37
|
+
* Options come from `<option>` children or the `options` property, as for `cm-select`, and can be grouped under
|
|
38
|
+
* headings with `<optgroup label="…">` or a `group` on each option (since 1.3). Filtering keeps the heading of
|
|
39
|
+
* every group that still has a match.
|
|
36
40
|
* @element cm-combobox
|
|
37
|
-
* @slot - `<option value="…">Label</option>` elements
|
|
41
|
+
* @slot - `<option value="…">Label</option>` elements, optionally inside `<optgroup label="…">`. `disabled` (also on an optgroup) and `selected` are honoured.
|
|
38
42
|
* @fires change - When the value changes (an option picked or removed, or a custom value added).
|
|
39
43
|
* @fires input - Same moment as `change`.
|
|
40
44
|
* @fires cm-search - As the merchant types, with `detail: { query }`. Use it to load matches from the server.
|
|
@@ -104,6 +108,10 @@ export declare class CmCombobox extends CmLocalizedElement {
|
|
|
104
108
|
type: BooleanConstructor;
|
|
105
109
|
reflect: boolean;
|
|
106
110
|
};
|
|
111
|
+
showGroup: {
|
|
112
|
+
type: BooleanConstructor;
|
|
113
|
+
attribute: string;
|
|
114
|
+
};
|
|
107
115
|
_query: {
|
|
108
116
|
state: boolean;
|
|
109
117
|
};
|
|
@@ -131,7 +139,7 @@ export declare class CmCombobox extends CmLocalizedElement {
|
|
|
131
139
|
values: string[];
|
|
132
140
|
/** Shown in the empty text box, e.g. "Search tags". */
|
|
133
141
|
placeholder: string;
|
|
134
|
-
/** Options as strings or `{ value, label, disabled }`. Used instead of `<option>` children when set. */
|
|
142
|
+
/** Options as strings or `{ value, label, disabled, group }`. Used instead of `<option>` children when set. */
|
|
135
143
|
options: Array<string | SelectOption>;
|
|
136
144
|
/** Lets the merchant choose several options, shown as removable tags. Backspace in the empty box removes the last one. */
|
|
137
145
|
multiple: boolean;
|
|
@@ -151,6 +159,11 @@ export declare class CmCombobox extends CmLocalizedElement {
|
|
|
151
159
|
disabled: boolean;
|
|
152
160
|
/** Whether the list is showing. */
|
|
153
161
|
open: boolean;
|
|
162
|
+
/**
|
|
163
|
+
* Shows the chosen option's group before its label in the box, or in its tag with `multiple` ("Lead: Company"),
|
|
164
|
+
* for grouped lists where labels repeat across groups. The list itself shows the bare label under its heading. Since 1.3.
|
|
165
|
+
*/
|
|
166
|
+
showGroup: boolean;
|
|
154
167
|
_query: string;
|
|
155
168
|
_active: number;
|
|
156
169
|
_slotted: SelectOption[];
|
|
@@ -167,7 +180,7 @@ export declare class CmCombobox extends CmLocalizedElement {
|
|
|
167
180
|
formResetCallback(): void;
|
|
168
181
|
formDisabledCallback(d: boolean): void;
|
|
169
182
|
formStateRestoreCallback(state: string | FormData): void;
|
|
170
|
-
/** All options in use, normalised (before filtering). */
|
|
183
|
+
/** All options in use, normalised (before filtering), in the order shown (options of a group together). */
|
|
171
184
|
get items(): SelectOption[];
|
|
172
185
|
/** The options shown for the current query. */
|
|
173
186
|
get filteredItems(): SelectOption[];
|