le-kit 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LLM_CONTEXT.md +1377 -0
- package/dist/cjs/le-bar_16.cjs.entry.js +15 -15
- package/dist/cjs/le-code-input.cjs.entry.js +181 -0
- package/dist/cjs/le-combobox.cjs.entry.js +1 -1
- package/dist/cjs/le-header-placeholder.cjs.entry.js +1 -1
- package/dist/cjs/le-kit.cjs.js +1 -1
- package/dist/cjs/le-multiselect.cjs.entry.js +3 -3
- package/dist/cjs/le-number-input.cjs.entry.js +1 -1
- package/dist/cjs/le-round-progress.cjs.entry.js +1 -1
- package/dist/cjs/le-segmented-control.cjs.entry.js +1 -1
- package/dist/cjs/le-stack.cjs.entry.js +1 -1
- package/dist/cjs/le-tab-bar.cjs.entry.js +1 -1
- package/dist/cjs/le-tab-panel.cjs.entry.js +2 -2
- package/dist/cjs/le-tab.cjs.entry.js +1 -1
- package/dist/cjs/le-tabs.cjs.entry.js +2 -2
- package/dist/cjs/le-tag.cjs.entry.js +1 -1
- package/dist/cjs/le-turntable.cjs.entry.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/le-code-input/le-code-input.css +106 -0
- package/dist/collection/components/le-code-input/le-code-input.js +466 -0
- package/dist/collection/components/le-code-input/le-code-input.js.map +1 -0
- package/dist/collection/components/le-collapse/le-collapse.js +1 -1
- package/dist/collection/components/le-combobox/le-combobox.js +1 -1
- package/dist/collection/components/le-current-heading/le-current-heading.js +1 -1
- package/dist/collection/components/le-dropdown-base/le-dropdown-base.js +1 -1
- package/dist/collection/components/le-header/le-header.js +2 -2
- package/dist/collection/components/le-header-placeholder/le-header-placeholder.js +1 -1
- package/dist/collection/components/le-icon/le-icon.js +1 -1
- package/dist/collection/components/le-multiselect/le-multiselect.js +3 -3
- package/dist/collection/components/le-number-input/le-number-input.js +1 -1
- package/dist/collection/components/le-popover/le-popover.js +3 -3
- package/dist/collection/components/le-round-progress/le-round-progress.js +1 -1
- package/dist/collection/components/le-scroll-progress/le-scroll-progress.js +1 -1
- package/dist/collection/components/le-segmented-control/le-segmented-control.js +1 -1
- package/dist/collection/components/le-select/le-select.js +2 -2
- package/dist/collection/components/le-slot/le-slot.js +1 -1
- package/dist/collection/components/le-stack/le-stack.js +1 -1
- package/dist/collection/components/le-string-input/le-string-input.js +2 -2
- package/dist/collection/components/le-tab/le-tab.js +1 -1
- package/dist/collection/components/le-tab-bar/le-tab-bar.js +1 -1
- package/dist/collection/components/le-tab-panel/le-tab-panel.js +2 -2
- package/dist/collection/components/le-tabs/le-tabs.js +2 -2
- package/dist/collection/components/le-tag/le-tag.js +1 -1
- package/dist/collection/components/le-turntable/le-turntable.js +1 -1
- package/dist/collection/dist/components/assets/custom-elements.json +1248 -871
- package/dist/components/assets/custom-elements.json +1248 -871
- package/dist/components/le-button2.js +5 -5
- package/dist/components/le-code-input.d.ts +11 -0
- package/dist/components/le-code-input.js +265 -0
- package/dist/components/le-code-input.js.map +1 -0
- package/dist/components/le-collapse2.js +1 -1
- package/dist/components/le-combobox.js +1 -1
- package/dist/components/le-current-heading.js +1 -1
- package/dist/components/le-dropdown-base2.js +1 -1
- package/dist/components/le-header-placeholder.js +1 -1
- package/dist/components/le-header.js +2 -2
- package/dist/components/le-icon2.js +1 -1
- package/dist/components/le-multiselect.js +3 -3
- package/dist/components/le-number-input.js +1 -1
- package/dist/components/le-popover2.js +3 -3
- package/dist/components/le-round-progress.js +1 -1
- package/dist/components/le-scroll-progress.js +1 -1
- package/dist/components/le-segmented-control.js +1 -1
- package/dist/components/le-stack.js +1 -1
- package/dist/components/le-tab-bar.js +1 -1
- package/dist/components/le-tab-panel.js +2 -2
- package/dist/components/le-tab2.js +1 -1
- package/dist/components/le-tabs.js +2 -2
- package/dist/components/le-tag2.js +1 -1
- package/dist/components/le-turntable.js +1 -1
- package/dist/docs.json +442 -1
- package/dist/esm/le-bar_16.entry.js +15 -15
- package/dist/esm/le-code-input.entry.js +179 -0
- package/dist/esm/le-code-input.entry.js.map +1 -0
- package/dist/esm/le-combobox.entry.js +1 -1
- package/dist/esm/le-header-placeholder.entry.js +1 -1
- package/dist/esm/le-kit.js +1 -1
- package/dist/esm/le-multiselect.entry.js +3 -3
- package/dist/esm/le-number-input.entry.js +1 -1
- package/dist/esm/le-round-progress.entry.js +1 -1
- package/dist/esm/le-segmented-control.entry.js +1 -1
- package/dist/esm/le-stack.entry.js +1 -1
- package/dist/esm/le-tab-bar.entry.js +1 -1
- package/dist/esm/le-tab-panel.entry.js +2 -2
- package/dist/esm/le-tab.entry.js +1 -1
- package/dist/esm/le-tabs.entry.js +2 -2
- package/dist/esm/le-tag.entry.js +1 -1
- package/dist/esm/le-turntable.entry.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/le-kit/dist/components/assets/custom-elements.json +1248 -871
- package/dist/le-kit/le-kit.esm.js +1 -1
- package/dist/le-kit/{p-c4975e66.entry.js → p-24112ca3.entry.js} +2 -2
- package/dist/le-kit/{p-3f26be75.entry.js → p-2c6d080d.entry.js} +2 -2
- package/dist/le-kit/p-516c8531.entry.js +2 -0
- package/dist/le-kit/{p-69dd089a.entry.js → p-6b69f9a2.entry.js} +2 -2
- package/dist/le-kit/{p-6da2d81a.entry.js → p-6d14306f.entry.js} +2 -2
- package/dist/le-kit/{p-7201ae65.entry.js → p-7bcdf2d4.entry.js} +2 -2
- package/dist/le-kit/{p-36f126bb.entry.js → p-7cf1e23c.entry.js} +2 -2
- package/dist/le-kit/{p-d449a88b.entry.js → p-85f2fd4d.entry.js} +2 -2
- package/dist/le-kit/{p-d1eee582.entry.js → p-ab6c1def.entry.js} +2 -2
- package/dist/le-kit/{p-3f31e31b.entry.js → p-ae4ead64.entry.js} +2 -2
- package/dist/le-kit/{p-33a24394.entry.js → p-b05d4511.entry.js} +2 -2
- package/dist/le-kit/{p-9863d6fb.entry.js → p-b6ac02ff.entry.js} +2 -2
- package/dist/le-kit/{p-cd38c01b.entry.js → p-c24769e2.entry.js} +2 -2
- package/dist/le-kit/{p-bf66757c.entry.js → p-dc0445ad.entry.js} +2 -2
- package/dist/le-kit/p-eb5286f2.entry.js +2 -0
- package/dist/le-kit/p-eb5286f2.entry.js.map +1 -0
- package/dist/types/components/le-code-input/le-code-input.d.ts +102 -0
- package/dist/types/components.d.ts +183 -0
- package/package.json +7 -5
- package/dist/le-kit/p-7a60bfff.entry.js +0 -2
- /package/dist/le-kit/{p-c4975e66.entry.js.map → p-24112ca3.entry.js.map} +0 -0
- /package/dist/le-kit/{p-3f26be75.entry.js.map → p-2c6d080d.entry.js.map} +0 -0
- /package/dist/le-kit/{p-7a60bfff.entry.js.map → p-516c8531.entry.js.map} +0 -0
- /package/dist/le-kit/{p-69dd089a.entry.js.map → p-6b69f9a2.entry.js.map} +0 -0
- /package/dist/le-kit/{p-6da2d81a.entry.js.map → p-6d14306f.entry.js.map} +0 -0
- /package/dist/le-kit/{p-7201ae65.entry.js.map → p-7bcdf2d4.entry.js.map} +0 -0
- /package/dist/le-kit/{p-36f126bb.entry.js.map → p-7cf1e23c.entry.js.map} +0 -0
- /package/dist/le-kit/{p-d449a88b.entry.js.map → p-85f2fd4d.entry.js.map} +0 -0
- /package/dist/le-kit/{p-d1eee582.entry.js.map → p-ab6c1def.entry.js.map} +0 -0
- /package/dist/le-kit/{p-3f31e31b.entry.js.map → p-ae4ead64.entry.js.map} +0 -0
- /package/dist/le-kit/{p-33a24394.entry.js.map → p-b05d4511.entry.js.map} +0 -0
- /package/dist/le-kit/{p-9863d6fb.entry.js.map → p-b6ac02ff.entry.js.map} +0 -0
- /package/dist/le-kit/{p-cd38c01b.entry.js.map → p-c24769e2.entry.js.map} +0 -0
- /package/dist/le-kit/{p-bf66757c.entry.js.map → p-dc0445ad.entry.js.map} +0 -0
|
@@ -0,0 +1,466 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import { classnames } from "../../utils/utils";
|
|
3
|
+
/**
|
|
4
|
+
* A one-time code input component with individual frames for each character.
|
|
5
|
+
* Supports standard copy/paste and range selection behaviors.
|
|
6
|
+
*
|
|
7
|
+
* @slot description - Additional description text displayed below the input
|
|
8
|
+
*
|
|
9
|
+
* @cssprop --le-code-box-size - Size of each character box (default: 40px width, 48px height)
|
|
10
|
+
* @cssprop --le-input-bg - Input background color
|
|
11
|
+
* @cssprop --le-input-color - Input text color
|
|
12
|
+
* @cssprop --le-input-border - Input border style
|
|
13
|
+
* @cssprop --le-input-border-focus - Input border style when focused
|
|
14
|
+
* @cssprop --le-input-border-error - Input border style when invalid
|
|
15
|
+
* @cssprop --le-input-radius - Input border radius
|
|
16
|
+
*/
|
|
17
|
+
export class LeCodeInput {
|
|
18
|
+
el;
|
|
19
|
+
/**
|
|
20
|
+
* The value of the input
|
|
21
|
+
*/
|
|
22
|
+
value = '';
|
|
23
|
+
/**
|
|
24
|
+
* The name of the input
|
|
25
|
+
*/
|
|
26
|
+
name;
|
|
27
|
+
/**
|
|
28
|
+
* Label for the input
|
|
29
|
+
*/
|
|
30
|
+
label;
|
|
31
|
+
/**
|
|
32
|
+
* Length of the code (number of characters)
|
|
33
|
+
*/
|
|
34
|
+
length = 6;
|
|
35
|
+
/**
|
|
36
|
+
* Description text displayed below the input
|
|
37
|
+
* in case there is a more complex markup,
|
|
38
|
+
* it can be provided via slot as well
|
|
39
|
+
*/
|
|
40
|
+
description;
|
|
41
|
+
/**
|
|
42
|
+
* The type of code (numeric or alphanumeric)
|
|
43
|
+
* This affects the keyboard layout on mobile devices.
|
|
44
|
+
*/
|
|
45
|
+
type = 'text';
|
|
46
|
+
/**
|
|
47
|
+
* Whether the input is disabled
|
|
48
|
+
*/
|
|
49
|
+
disabled = false;
|
|
50
|
+
/**
|
|
51
|
+
* Whether the input is read-only
|
|
52
|
+
*/
|
|
53
|
+
readonly = false;
|
|
54
|
+
/**
|
|
55
|
+
* External ID for linking with external systems
|
|
56
|
+
*/
|
|
57
|
+
externalId;
|
|
58
|
+
/**
|
|
59
|
+
* Internal validation state (can be set externally manually or via simple check)
|
|
60
|
+
*/
|
|
61
|
+
error = false;
|
|
62
|
+
/**
|
|
63
|
+
* Emitted when the value changes (on blur or Enter)
|
|
64
|
+
*/
|
|
65
|
+
leChange;
|
|
66
|
+
/**
|
|
67
|
+
* Emitted when the input value changes (on keystroke)
|
|
68
|
+
*/
|
|
69
|
+
leInput;
|
|
70
|
+
/**
|
|
71
|
+
* Emitted when the input is focused
|
|
72
|
+
*/
|
|
73
|
+
leFocus;
|
|
74
|
+
/**
|
|
75
|
+
* Emitted when the input is blurred
|
|
76
|
+
*/
|
|
77
|
+
leBlur;
|
|
78
|
+
isFocused = false;
|
|
79
|
+
selectionStart = 0;
|
|
80
|
+
selectionEnd = 0;
|
|
81
|
+
valueChanged(newValue) {
|
|
82
|
+
if (newValue && newValue.length > this.length) {
|
|
83
|
+
this.value = newValue.slice(0, this.length);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
componentWillLoad() {
|
|
87
|
+
if (this.value && this.value.length > this.length) {
|
|
88
|
+
this.value = this.value.slice(0, this.length);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
handleInput = (ev) => {
|
|
92
|
+
const input = ev.target;
|
|
93
|
+
let val = input.value;
|
|
94
|
+
// Enforce length limit
|
|
95
|
+
if (val.length > this.length) {
|
|
96
|
+
val = val.slice(0, this.length);
|
|
97
|
+
// We need to force update the input value if it exceeded length
|
|
98
|
+
// because Stencil prop update might not happen if value is same as prop but input is different
|
|
99
|
+
input.value = val;
|
|
100
|
+
}
|
|
101
|
+
this.value = val;
|
|
102
|
+
this.updateSelection(input);
|
|
103
|
+
this.leInput.emit({
|
|
104
|
+
value: this.value,
|
|
105
|
+
name: this.name,
|
|
106
|
+
externalId: this.externalId,
|
|
107
|
+
});
|
|
108
|
+
};
|
|
109
|
+
handleChange = () => {
|
|
110
|
+
this.leChange.emit({
|
|
111
|
+
value: this.value,
|
|
112
|
+
name: this.name,
|
|
113
|
+
externalId: this.externalId,
|
|
114
|
+
});
|
|
115
|
+
};
|
|
116
|
+
handleFocus = (ev) => {
|
|
117
|
+
this.isFocused = true;
|
|
118
|
+
const input = ev.target;
|
|
119
|
+
// Move cursor to the end on focus so typing appends to current value
|
|
120
|
+
window.requestAnimationFrame(() => {
|
|
121
|
+
const len = input.value.length;
|
|
122
|
+
input.setSelectionRange(len, len);
|
|
123
|
+
this.updateSelection(input);
|
|
124
|
+
});
|
|
125
|
+
this.leFocus.emit();
|
|
126
|
+
};
|
|
127
|
+
handleBlur = () => {
|
|
128
|
+
this.isFocused = false;
|
|
129
|
+
this.leBlur.emit();
|
|
130
|
+
// Trigger change on blur
|
|
131
|
+
this.handleChange();
|
|
132
|
+
};
|
|
133
|
+
handleSelect = (ev) => {
|
|
134
|
+
this.updateSelection(ev.target);
|
|
135
|
+
};
|
|
136
|
+
updateSelection(input) {
|
|
137
|
+
this.selectionStart = input.selectionStart || 0;
|
|
138
|
+
this.selectionEnd = input.selectionEnd || 0;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Helper to determine active index for focus ring
|
|
142
|
+
*/
|
|
143
|
+
getActiveIndex() {
|
|
144
|
+
if (!this.isFocused)
|
|
145
|
+
return -1;
|
|
146
|
+
// If we have a range selection, usually focus ring is not shown or shown around selection?
|
|
147
|
+
// We'll stick to showing it at the cursor end (selectionEnd) or start?
|
|
148
|
+
// If range selected, `selectionStart` is start of range.
|
|
149
|
+
// If cursor is at the very end (pos == length), we highlight the last box
|
|
150
|
+
if (this.selectionStart === this.length && this.length > 0) {
|
|
151
|
+
return this.length - 1;
|
|
152
|
+
}
|
|
153
|
+
return this.selectionStart;
|
|
154
|
+
}
|
|
155
|
+
renderBoxes() {
|
|
156
|
+
const boxes = [];
|
|
157
|
+
const activeIndex = this.getActiveIndex();
|
|
158
|
+
const isRangeSelection = this.selectionEnd - this.selectionStart > 0;
|
|
159
|
+
for (let i = 0; i < this.length; i++) {
|
|
160
|
+
const char = this.value ? this.value[i] : '';
|
|
161
|
+
const isActive = this.isFocused && !isRangeSelection && i === activeIndex;
|
|
162
|
+
const isSelected = this.isFocused && isRangeSelection && i >= this.selectionStart && i < this.selectionEnd;
|
|
163
|
+
boxes.push(h("div", { class: classnames('code-box', {
|
|
164
|
+
'active': isActive,
|
|
165
|
+
'selected': isSelected,
|
|
166
|
+
'has-value': !!char,
|
|
167
|
+
}) }, char));
|
|
168
|
+
}
|
|
169
|
+
return boxes;
|
|
170
|
+
}
|
|
171
|
+
render() {
|
|
172
|
+
return (h("le-component", { key: '74615aa06971f7b2883e4a8e6f77b76918722e53', component: "le-code-input", hostClass: classnames({ 'disabled': this.disabled, 'has-error': this.error }) }, h("div", { key: '423a974717f0676b266a362d0151540577ae8845', class: "le-code-input-wrapper" }, this.label && (h("label", { key: 'f2ba7d9c8a8a400ca31adc944919e4750785503d', class: "le-input-label", htmlFor: this.name }, this.label)), h("div", { key: 'f56b80ffc1362c164bdfe473877d934c252c9bd5', class: classnames('input-group', { 'has-error': this.error }) }, h("input", { key: 'a94d422a0884c731ecfc6221133d725057fbb87c', class: "ghost-input", id: this.name, name: this.name, type: "text", inputMode: this.type === 'number' ? 'numeric' : 'text', pattern: this.type === 'number' ? '[0-9]*' : undefined, autocomplete: "one-time-code", value: this.value, maxLength: this.length, disabled: this.disabled, readOnly: this.readonly, onInput: this.handleInput, onFocus: this.handleFocus, onBlur: this.handleBlur, onSelect: this.handleSelect,
|
|
173
|
+
// Prevent browser autofill background from messing up visual
|
|
174
|
+
spellcheck: false, autoCapitalize: "none", autoCorrect: "off" }), h("div", { key: '9436ca5298d83aae923e762748d634b9517a3b17', class: "visual-container" }, this.renderBoxes())), !this.error && (h("div", { key: '398a377af9c6c26f441e94b3598a1007c64e6ea0', class: "le-input-description" }, h("le-slot", { key: '3d9a8c248efc57ffa026f9ffdf889599b276f344', name: "description", type: "text", tag: "p", label: "Description" }, h("slot", { key: '6873dec4bea990f9fe6de013e8fa729fc385871c', name: "description" }, this.description)))))));
|
|
175
|
+
}
|
|
176
|
+
static get is() { return "le-code-input"; }
|
|
177
|
+
static get encapsulation() { return "shadow"; }
|
|
178
|
+
static get originalStyleUrls() {
|
|
179
|
+
return {
|
|
180
|
+
"$": ["le-code-input.css"]
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
static get styleUrls() {
|
|
184
|
+
return {
|
|
185
|
+
"$": ["le-code-input.css"]
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
static get properties() {
|
|
189
|
+
return {
|
|
190
|
+
"value": {
|
|
191
|
+
"type": "string",
|
|
192
|
+
"mutable": true,
|
|
193
|
+
"complexType": {
|
|
194
|
+
"original": "string",
|
|
195
|
+
"resolved": "string",
|
|
196
|
+
"references": {}
|
|
197
|
+
},
|
|
198
|
+
"required": false,
|
|
199
|
+
"optional": false,
|
|
200
|
+
"docs": {
|
|
201
|
+
"tags": [],
|
|
202
|
+
"text": "The value of the input"
|
|
203
|
+
},
|
|
204
|
+
"getter": false,
|
|
205
|
+
"setter": false,
|
|
206
|
+
"reflect": true,
|
|
207
|
+
"attribute": "value",
|
|
208
|
+
"defaultValue": "''"
|
|
209
|
+
},
|
|
210
|
+
"name": {
|
|
211
|
+
"type": "string",
|
|
212
|
+
"mutable": false,
|
|
213
|
+
"complexType": {
|
|
214
|
+
"original": "string",
|
|
215
|
+
"resolved": "string",
|
|
216
|
+
"references": {}
|
|
217
|
+
},
|
|
218
|
+
"required": false,
|
|
219
|
+
"optional": false,
|
|
220
|
+
"docs": {
|
|
221
|
+
"tags": [],
|
|
222
|
+
"text": "The name of the input"
|
|
223
|
+
},
|
|
224
|
+
"getter": false,
|
|
225
|
+
"setter": false,
|
|
226
|
+
"reflect": false,
|
|
227
|
+
"attribute": "name"
|
|
228
|
+
},
|
|
229
|
+
"label": {
|
|
230
|
+
"type": "string",
|
|
231
|
+
"mutable": false,
|
|
232
|
+
"complexType": {
|
|
233
|
+
"original": "string",
|
|
234
|
+
"resolved": "string",
|
|
235
|
+
"references": {}
|
|
236
|
+
},
|
|
237
|
+
"required": false,
|
|
238
|
+
"optional": false,
|
|
239
|
+
"docs": {
|
|
240
|
+
"tags": [],
|
|
241
|
+
"text": "Label for the input"
|
|
242
|
+
},
|
|
243
|
+
"getter": false,
|
|
244
|
+
"setter": false,
|
|
245
|
+
"reflect": false,
|
|
246
|
+
"attribute": "label"
|
|
247
|
+
},
|
|
248
|
+
"length": {
|
|
249
|
+
"type": "number",
|
|
250
|
+
"mutable": false,
|
|
251
|
+
"complexType": {
|
|
252
|
+
"original": "number",
|
|
253
|
+
"resolved": "number",
|
|
254
|
+
"references": {}
|
|
255
|
+
},
|
|
256
|
+
"required": false,
|
|
257
|
+
"optional": false,
|
|
258
|
+
"docs": {
|
|
259
|
+
"tags": [],
|
|
260
|
+
"text": "Length of the code (number of characters)"
|
|
261
|
+
},
|
|
262
|
+
"getter": false,
|
|
263
|
+
"setter": false,
|
|
264
|
+
"reflect": false,
|
|
265
|
+
"attribute": "length",
|
|
266
|
+
"defaultValue": "6"
|
|
267
|
+
},
|
|
268
|
+
"description": {
|
|
269
|
+
"type": "string",
|
|
270
|
+
"mutable": false,
|
|
271
|
+
"complexType": {
|
|
272
|
+
"original": "string",
|
|
273
|
+
"resolved": "string",
|
|
274
|
+
"references": {}
|
|
275
|
+
},
|
|
276
|
+
"required": false,
|
|
277
|
+
"optional": true,
|
|
278
|
+
"docs": {
|
|
279
|
+
"tags": [],
|
|
280
|
+
"text": "Description text displayed below the input\nin case there is a more complex markup,\nit can be provided via slot as well"
|
|
281
|
+
},
|
|
282
|
+
"getter": false,
|
|
283
|
+
"setter": false,
|
|
284
|
+
"reflect": false,
|
|
285
|
+
"attribute": "description"
|
|
286
|
+
},
|
|
287
|
+
"type": {
|
|
288
|
+
"type": "string",
|
|
289
|
+
"mutable": false,
|
|
290
|
+
"complexType": {
|
|
291
|
+
"original": "'text' | 'number'",
|
|
292
|
+
"resolved": "\"number\" | \"text\"",
|
|
293
|
+
"references": {}
|
|
294
|
+
},
|
|
295
|
+
"required": false,
|
|
296
|
+
"optional": false,
|
|
297
|
+
"docs": {
|
|
298
|
+
"tags": [],
|
|
299
|
+
"text": "The type of code (numeric or alphanumeric)\nThis affects the keyboard layout on mobile devices."
|
|
300
|
+
},
|
|
301
|
+
"getter": false,
|
|
302
|
+
"setter": false,
|
|
303
|
+
"reflect": false,
|
|
304
|
+
"attribute": "type",
|
|
305
|
+
"defaultValue": "'text'"
|
|
306
|
+
},
|
|
307
|
+
"disabled": {
|
|
308
|
+
"type": "boolean",
|
|
309
|
+
"mutable": false,
|
|
310
|
+
"complexType": {
|
|
311
|
+
"original": "boolean",
|
|
312
|
+
"resolved": "boolean",
|
|
313
|
+
"references": {}
|
|
314
|
+
},
|
|
315
|
+
"required": false,
|
|
316
|
+
"optional": false,
|
|
317
|
+
"docs": {
|
|
318
|
+
"tags": [],
|
|
319
|
+
"text": "Whether the input is disabled"
|
|
320
|
+
},
|
|
321
|
+
"getter": false,
|
|
322
|
+
"setter": false,
|
|
323
|
+
"reflect": false,
|
|
324
|
+
"attribute": "disabled",
|
|
325
|
+
"defaultValue": "false"
|
|
326
|
+
},
|
|
327
|
+
"readonly": {
|
|
328
|
+
"type": "boolean",
|
|
329
|
+
"mutable": false,
|
|
330
|
+
"complexType": {
|
|
331
|
+
"original": "boolean",
|
|
332
|
+
"resolved": "boolean",
|
|
333
|
+
"references": {}
|
|
334
|
+
},
|
|
335
|
+
"required": false,
|
|
336
|
+
"optional": false,
|
|
337
|
+
"docs": {
|
|
338
|
+
"tags": [],
|
|
339
|
+
"text": "Whether the input is read-only"
|
|
340
|
+
},
|
|
341
|
+
"getter": false,
|
|
342
|
+
"setter": false,
|
|
343
|
+
"reflect": false,
|
|
344
|
+
"attribute": "readonly",
|
|
345
|
+
"defaultValue": "false"
|
|
346
|
+
},
|
|
347
|
+
"externalId": {
|
|
348
|
+
"type": "string",
|
|
349
|
+
"mutable": false,
|
|
350
|
+
"complexType": {
|
|
351
|
+
"original": "string",
|
|
352
|
+
"resolved": "string",
|
|
353
|
+
"references": {}
|
|
354
|
+
},
|
|
355
|
+
"required": false,
|
|
356
|
+
"optional": false,
|
|
357
|
+
"docs": {
|
|
358
|
+
"tags": [],
|
|
359
|
+
"text": "External ID for linking with external systems"
|
|
360
|
+
},
|
|
361
|
+
"getter": false,
|
|
362
|
+
"setter": false,
|
|
363
|
+
"reflect": false,
|
|
364
|
+
"attribute": "external-id"
|
|
365
|
+
},
|
|
366
|
+
"error": {
|
|
367
|
+
"type": "boolean",
|
|
368
|
+
"mutable": false,
|
|
369
|
+
"complexType": {
|
|
370
|
+
"original": "boolean",
|
|
371
|
+
"resolved": "boolean",
|
|
372
|
+
"references": {}
|
|
373
|
+
},
|
|
374
|
+
"required": false,
|
|
375
|
+
"optional": false,
|
|
376
|
+
"docs": {
|
|
377
|
+
"tags": [],
|
|
378
|
+
"text": "Internal validation state (can be set externally manually or via simple check)"
|
|
379
|
+
},
|
|
380
|
+
"getter": false,
|
|
381
|
+
"setter": false,
|
|
382
|
+
"reflect": false,
|
|
383
|
+
"attribute": "error",
|
|
384
|
+
"defaultValue": "false"
|
|
385
|
+
}
|
|
386
|
+
};
|
|
387
|
+
}
|
|
388
|
+
static get states() {
|
|
389
|
+
return {
|
|
390
|
+
"isFocused": {},
|
|
391
|
+
"selectionStart": {},
|
|
392
|
+
"selectionEnd": {}
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
static get events() {
|
|
396
|
+
return [{
|
|
397
|
+
"method": "leChange",
|
|
398
|
+
"name": "leChange",
|
|
399
|
+
"bubbles": true,
|
|
400
|
+
"cancelable": true,
|
|
401
|
+
"composed": true,
|
|
402
|
+
"docs": {
|
|
403
|
+
"tags": [],
|
|
404
|
+
"text": "Emitted when the value changes (on blur or Enter)"
|
|
405
|
+
},
|
|
406
|
+
"complexType": {
|
|
407
|
+
"original": "{ value: string; name: string; externalId: string }",
|
|
408
|
+
"resolved": "{ value: string; name: string; externalId: string; }",
|
|
409
|
+
"references": {}
|
|
410
|
+
}
|
|
411
|
+
}, {
|
|
412
|
+
"method": "leInput",
|
|
413
|
+
"name": "leInput",
|
|
414
|
+
"bubbles": true,
|
|
415
|
+
"cancelable": true,
|
|
416
|
+
"composed": true,
|
|
417
|
+
"docs": {
|
|
418
|
+
"tags": [],
|
|
419
|
+
"text": "Emitted when the input value changes (on keystroke)"
|
|
420
|
+
},
|
|
421
|
+
"complexType": {
|
|
422
|
+
"original": "{ value: string; name: string; externalId: string }",
|
|
423
|
+
"resolved": "{ value: string; name: string; externalId: string; }",
|
|
424
|
+
"references": {}
|
|
425
|
+
}
|
|
426
|
+
}, {
|
|
427
|
+
"method": "leFocus",
|
|
428
|
+
"name": "leFocus",
|
|
429
|
+
"bubbles": true,
|
|
430
|
+
"cancelable": true,
|
|
431
|
+
"composed": true,
|
|
432
|
+
"docs": {
|
|
433
|
+
"tags": [],
|
|
434
|
+
"text": "Emitted when the input is focused"
|
|
435
|
+
},
|
|
436
|
+
"complexType": {
|
|
437
|
+
"original": "void",
|
|
438
|
+
"resolved": "void",
|
|
439
|
+
"references": {}
|
|
440
|
+
}
|
|
441
|
+
}, {
|
|
442
|
+
"method": "leBlur",
|
|
443
|
+
"name": "leBlur",
|
|
444
|
+
"bubbles": true,
|
|
445
|
+
"cancelable": true,
|
|
446
|
+
"composed": true,
|
|
447
|
+
"docs": {
|
|
448
|
+
"tags": [],
|
|
449
|
+
"text": "Emitted when the input is blurred"
|
|
450
|
+
},
|
|
451
|
+
"complexType": {
|
|
452
|
+
"original": "void",
|
|
453
|
+
"resolved": "void",
|
|
454
|
+
"references": {}
|
|
455
|
+
}
|
|
456
|
+
}];
|
|
457
|
+
}
|
|
458
|
+
static get elementRef() { return "el"; }
|
|
459
|
+
static get watchers() {
|
|
460
|
+
return [{
|
|
461
|
+
"propName": "value",
|
|
462
|
+
"methodName": "valueChanged"
|
|
463
|
+
}];
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
//# sourceMappingURL=le-code-input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"le-code-input.js","sourceRoot":"","sources":["../../../src/components/le-code-input/le-code-input.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAgB,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC/F,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C;;;;;;;;;;;;;GAaG;AAMH,MAAM,OAAO,WAAW;IACX,EAAE,CAAc;IAE3B;;OAEG;IACqC,KAAK,GAAW,EAAE,CAAC;IAE3D;;OAEG;IACK,IAAI,CAAS;IAErB;;OAEG;IACK,KAAK,CAAS;IAEtB;;OAEG;IACK,MAAM,GAAW,CAAC,CAAC;IAE3B;;;;OAIG;IACK,WAAW,CAAU;IAE7B;;;OAGG;IACK,IAAI,GAAsB,MAAM,CAAC;IAEzC;;OAEG;IACK,QAAQ,GAAY,KAAK,CAAC;IAElC;;OAEG;IACK,QAAQ,GAAY,KAAK,CAAC;IAElC;;OAEG;IACK,UAAU,CAAS;IAE3B;;OAEG;IACK,KAAK,GAAY,KAAK,CAAC;IAE/B;;OAEG;IACM,QAAQ,CAAoE;IAErF;;OAEG;IACM,OAAO,CAAoE;IAEpF;;OAEG;IACM,OAAO,CAAqB;IAErC;;OAEG;IACM,MAAM,CAAqB;IAEnB,SAAS,GAAY,KAAK,CAAC;IAC3B,cAAc,GAAW,CAAC,CAAC;IAC3B,YAAY,GAAW,CAAC,CAAC;IAG1C,YAAY,CAAC,QAAgB;QAC3B,IAAI,QAAQ,IAAI,QAAQ,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;YAC9C,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAC9C,CAAC;IACH,CAAC;I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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Prop, Event, EventEmitter, State, h, Element, Watch } from '@stencil/core';\nimport { classnames } from '../../utils/utils';\n\n/**\n * A one-time code input component with individual frames for each character.\n * Supports standard copy/paste and range selection behaviors.\n *\n * @slot description - Additional description text displayed below the input\n *\n * @cssprop --le-code-box-size - Size of each character box (default: 40px width, 48px height)\n * @cssprop --le-input-bg - Input background color\n * @cssprop --le-input-color - Input text color\n * @cssprop --le-input-border - Input border style\n * @cssprop --le-input-border-focus - Input border style when focused\n * @cssprop --le-input-border-error - Input border style when invalid\n * @cssprop --le-input-radius - Input border radius\n */\n@Component({\n tag: 'le-code-input',\n styleUrl: 'le-code-input.css',\n shadow: true,\n})\nexport class LeCodeInput {\n @Element() el: HTMLElement;\n\n /**\n * The value of the input\n */\n @Prop({ mutable: true, reflect: true }) value: string = '';\n\n /**\n * The name of the input\n */\n @Prop() name: string;\n\n /**\n * Label for the input\n */\n @Prop() label: string;\n\n /**\n * Length of the code (number of characters)\n */\n @Prop() length: number = 6;\n\n /**\n * Description text displayed below the input\n * in case there is a more complex markup,\n * it can be provided via slot as well\n */\n @Prop() description?: string;\n\n /**\n * The type of code (numeric or alphanumeric)\n * This affects the keyboard layout on mobile devices.\n */\n @Prop() type: 'text' | 'number' = 'text';\n\n /**\n * Whether the input is disabled\n */\n @Prop() disabled: boolean = false;\n\n /**\n * Whether the input is read-only\n */\n @Prop() readonly: boolean = false;\n\n /**\n * External ID for linking with external systems\n */\n @Prop() externalId: string;\n\n /**\n * Internal validation state (can be set externally manually or via simple check)\n */\n @Prop() error: boolean = false;\n\n /**\n * Emitted when the value changes (on blur or Enter)\n */\n @Event() leChange: EventEmitter<{ value: string; name: string; externalId: string }>;\n\n /**\n * Emitted when the input value changes (on keystroke)\n */\n @Event() leInput: EventEmitter<{ value: string; name: string; externalId: string }>;\n\n /**\n * Emitted when the input is focused\n */\n @Event() leFocus: EventEmitter<void>;\n\n /**\n * Emitted when the input is blurred\n */\n @Event() leBlur: EventEmitter<void>;\n\n @State() private isFocused: boolean = false;\n @State() private selectionStart: number = 0;\n @State() private selectionEnd: number = 0;\n\n @Watch('value')\n valueChanged(newValue: string) {\n if (newValue && newValue.length > this.length) {\n this.value = newValue.slice(0, this.length);\n }\n }\n\n componentWillLoad() {\n if (this.value && this.value.length > this.length) {\n this.value = this.value.slice(0, this.length);\n }\n }\n\n private handleInput = (ev: Event) => {\n const input = ev.target as HTMLInputElement;\n let val = input.value;\n\n // Enforce length limit\n if (val.length > this.length) {\n val = val.slice(0, this.length);\n // We need to force update the input value if it exceeded length\n // because Stencil prop update might not happen if value is same as prop but input is different\n input.value = val;\n }\n\n this.value = val;\n this.updateSelection(input);\n\n this.leInput.emit({\n value: this.value,\n name: this.name,\n externalId: this.externalId,\n });\n };\n\n private handleChange = () => {\n this.leChange.emit({\n value: this.value,\n name: this.name,\n externalId: this.externalId,\n });\n };\n\n private handleFocus = (ev: Event) => {\n this.isFocused = true;\n const input = ev.target as HTMLInputElement;\n\n // Move cursor to the end on focus so typing appends to current value\n window.requestAnimationFrame(() => {\n const len = input.value.length;\n input.setSelectionRange(len, len);\n this.updateSelection(input);\n });\n\n this.leFocus.emit();\n };\n\n private handleBlur = () => {\n this.isFocused = false;\n this.leBlur.emit();\n // Trigger change on blur\n this.handleChange();\n };\n\n private handleSelect = (ev: Event) => {\n this.updateSelection(ev.target as HTMLInputElement);\n };\n\n private updateSelection(input: HTMLInputElement) {\n this.selectionStart = input.selectionStart || 0;\n this.selectionEnd = input.selectionEnd || 0;\n }\n\n /**\n * Helper to determine active index for focus ring\n */\n private getActiveIndex(): number {\n if (!this.isFocused) return -1;\n\n // If we have a range selection, usually focus ring is not shown or shown around selection?\n // We'll stick to showing it at the cursor end (selectionEnd) or start?\n // If range selected, `selectionStart` is start of range.\n\n // If cursor is at the very end (pos == length), we highlight the last box\n if (this.selectionStart === this.length && this.length > 0) {\n return this.length - 1;\n }\n\n return this.selectionStart;\n }\n\n private renderBoxes() {\n const boxes = [];\n const activeIndex = this.getActiveIndex();\n const isRangeSelection = this.selectionEnd - this.selectionStart > 0;\n\n for (let i = 0; i < this.length; i++) {\n const char = this.value ? this.value[i] : '';\n const isActive = this.isFocused && !isRangeSelection && i === activeIndex;\n const isSelected =\n this.isFocused && isRangeSelection && i >= this.selectionStart && i < this.selectionEnd;\n\n boxes.push(\n <div\n class={classnames('code-box', {\n 'active': isActive,\n 'selected': isSelected,\n 'has-value': !!char,\n })}\n >\n {char}\n </div>,\n );\n }\n return boxes;\n }\n\n render() {\n return (\n <le-component\n component=\"le-code-input\"\n hostClass={classnames({ 'disabled': this.disabled, 'has-error': this.error })}\n >\n <div class=\"le-code-input-wrapper\">\n {this.label && (\n <label class=\"le-input-label\" htmlFor={this.name}>\n {this.label}\n </label>\n )}\n\n <div class={classnames('input-group', { 'has-error': this.error })}>\n <input\n class=\"ghost-input\"\n id={this.name}\n name={this.name}\n type=\"text\"\n inputMode={this.type === 'number' ? 'numeric' : 'text'}\n pattern={this.type === 'number' ? '[0-9]*' : undefined}\n autocomplete=\"one-time-code\"\n value={this.value}\n maxLength={this.length}\n disabled={this.disabled}\n readOnly={this.readonly}\n onInput={this.handleInput}\n onFocus={this.handleFocus}\n onBlur={this.handleBlur}\n onSelect={this.handleSelect}\n // Prevent browser autofill background from messing up visual\n spellcheck={false}\n autoCapitalize=\"none\"\n autoCorrect=\"off\"\n />\n\n <div class=\"visual-container\">{this.renderBoxes()}</div>\n </div>\n\n {!this.error && (\n <div class=\"le-input-description\">\n <le-slot name=\"description\" type=\"text\" tag=\"p\" label=\"Description\">\n <slot name=\"description\">{this.description}</slot>\n </le-slot>\n </div>\n )}\n </div>\n </le-component>\n );\n }\n}\n"]}
|
|
@@ -58,7 +58,7 @@ export class LeCollapse {
|
|
|
58
58
|
this.el.toggleAttribute('data-open', nextOpen);
|
|
59
59
|
}
|
|
60
60
|
render() {
|
|
61
|
-
return (h(Host, { key: '
|
|
61
|
+
return (h(Host, { key: 'e0882ec40ed132dbd6eeaa43da4aff03b6e45352', "data-open": this.shouldBeOpen() ? 'true' : 'false' }, h("le-component", { key: '55c98e5382ddd6b5ef8a8f506f9a2901fc0b48ce', component: "le-collapse" }, h("div", { key: '0bcfa5aada8a7a6f9c86011e6a3dfa5bbb5e08c4', class: { 'region': true, 'scroll-down': this.scrollDown }, part: "region" }, h("slot", { key: '7b762e372802512a287ae98d4aeecdb3160bb54e' })))));
|
|
62
62
|
}
|
|
63
63
|
static get is() { return "le-collapse"; }
|
|
64
64
|
static get encapsulation() { return "shadow"; }
|
|
@@ -238,7 +238,7 @@ export class LeCombobox {
|
|
|
238
238
|
}
|
|
239
239
|
render() {
|
|
240
240
|
const hasValue = this.inputValue.length > 0;
|
|
241
|
-
return (h("le-component", { key: '
|
|
241
|
+
return (h("le-component", { key: '77660875e900dceb4cca50087a9ea7fad38d0de8', component: "le-combobox" }, h("le-dropdown-base", { key: 'a7d46b3226322945465a8d22c87c3df1939d0c11', ref: el => (this.dropdownEl = el), options: this.parsedOptions, value: this.value, disabled: this.disabled, filterFn: this.filterOption, filterQuery: this.inputValue, emptyText: this.emptyText, fullWidth: this.fullWidth, closeOnClickOutside: false, onLeOptionSelect: this.handleOptionSelect, onLeDropdownOpen: this.handleDropdownOpen, onLeDropdownClose: this.handleDropdownClose }, h("div", { key: 'bc402ba87163d604c49d41acf32a2da7710c12d5', slot: "trigger", class: { 'combobox-trigger': true, 'is-open': this.open } }, h("le-string-input", { key: 'd676bb665963d090e88195b133f7a0f5e379b9e9', mode: "default", hideDescription: true, inputRef: el => (this.inputEl = el), type: "text", class: "combobox-input", value: this.inputValue, placeholder: this.placeholder, disabled: this.disabled, "aria-haspopup": "listbox", "aria-expanded": this.open ? 'true' : 'false', "aria-autocomplete": "list", onInput: this.handleInputChange, onFocus: this.handleInputFocus, onKeyDown: this.handleInputKeyDown }), hasValue && !this.disabled && (h("button", { key: '78446bc41c35fa2815acbfc34ea377dc33a1e55b', type: "button", class: "combobox-clear", onClick: this.handleClear, "aria-label": "Clear", tabIndex: -1 }, h("svg", { key: 'a596191694990ebb2e48d1529da0e0a6eb61e5b9', viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", "stroke-width": "2" }, h("path", { key: 'd6503800924e82555571c8955b33bcfddd90c7d0', d: "M4 4l8 8M12 4l-8 8" })))), h("span", { key: 'a032adbc03c135bf0e9c28f7272fa125c22fd37c', class: "combobox-arrow" }, h("svg", { key: '258a8d6a98071654a8bf59ac23dc517a9af19daa', viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", "stroke-width": "2" }, h("path", { key: '5960ffe0d91ae52563420fa901653e17d458b522', d: "M4 6l4 4 4-4" }))))), this.name && h("input", { key: '44791ad0af7eae39a3d8b7cabf12a68b11fc20ba', type: "hidden", name: this.name, value: this.value?.toString() ?? '' })));
|
|
242
242
|
}
|
|
243
243
|
static get is() { return "le-combobox"; }
|
|
244
244
|
static get encapsulation() { return "shadow"; }
|
|
@@ -61,7 +61,7 @@ export class LeCurrentHeading {
|
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
render() {
|
|
64
|
-
return (h(Host, { key: '
|
|
64
|
+
return (h(Host, { key: 'c8d94a695a402039000210914b6780264a034a89' }, this.activeText ? (h("span", { class: "title", part: "title" }, this.activeText)) : (h("slot", null))));
|
|
65
65
|
}
|
|
66
66
|
static get is() { return "le-current-heading"; }
|
|
67
67
|
static get encapsulation() { return "shadow"; }
|
|
@@ -339,7 +339,7 @@ export class LeDropdownBase {
|
|
|
339
339
|
}
|
|
340
340
|
render() {
|
|
341
341
|
const dropdownWidth = this.width || (this.triggerWidth ? `${this.triggerWidth}px` : undefined);
|
|
342
|
-
return (h(Host, { key: '
|
|
342
|
+
return (h(Host, { key: '90bca5763b9110f8e5cad70870110cab1efeeec6' }, h("le-popover", { key: 'ebded64a4f2b23c8b1a954dd995c4d6171ef9c88', ref: el => (this.popoverEl = el), position: "bottom", align: "start", showClose: false, closeOnClickOutside: this.closeOnClickOutside, closeOnEscape: true, offset: 4, width: dropdownWidth, minWidth: "150px", "trigger-full-width": this.fullWidth, onLePopoverOpen: this.handlePopoverOpen, onLePopoverClose: this.handlePopoverClose }, h("slot", { key: '57e540660ee269de594209186d6fbe066b9c8fc1', name: "trigger", slot: "trigger" }), h("slot", { key: 'e58a76a0097f938873f5462c844ee9f1a5eece72', name: "header" }), h("div", { key: 'c4fa35069438df82894e45e87f46aef67a189c43', class: "dropdown-list", role: "listbox", "aria-multiselectable": this.multiple ? 'true' : undefined, ref: el => (this.listEl = el), style: { maxHeight: this.maxHeight } }, this.renderOptions()))));
|
|
343
343
|
}
|
|
344
344
|
static get is() { return "le-dropdown-base"; }
|
|
345
345
|
static get encapsulation() { return "shadow"; }
|
|
@@ -268,7 +268,7 @@ export class LeHeader {
|
|
|
268
268
|
'is-hidden': !this.revealed,
|
|
269
269
|
'is-shrunk': this.shrunk,
|
|
270
270
|
});
|
|
271
|
-
return (h(Host, { key: '
|
|
271
|
+
return (h(Host, { key: 'd1a4ae64dff81139b1c35681698539fdf072ae66', class: hostClass, onMouseEnter: () => {
|
|
272
272
|
if (!this.expandOnHover)
|
|
273
273
|
return;
|
|
274
274
|
this.hoverActive = true;
|
|
@@ -278,7 +278,7 @@ export class LeHeader {
|
|
|
278
278
|
return;
|
|
279
279
|
this.hoverActive = false;
|
|
280
280
|
this.scheduleUpdate(true);
|
|
281
|
-
} }, h("le-component", { key: '
|
|
281
|
+
} }, h("le-component", { key: '305bc8b4aefaf2ef1dd7287422167cfd68d3e8c2', component: "le-header" }, h("header", { key: '1cf3b2ab01140e14870c1282e49e6eb3dbae5bf8', class: "header", part: "header", role: "banner", ref: el => (this.headerEl = el) }, h("div", { key: 'b238e3762dd31228f3ab3627fbca2ff1a9c630fd', class: "inner", part: "inner" }, h("div", { key: 'f186fbecc9c9b6f6f08f45c272c292af9333450e', class: "row", part: "row" }, h("div", { key: 'e496055801a36f4cf7a045513df2bc917a573786', class: "start", part: "start" }, h("le-slot", { key: '697b90a8291836452c17d2c9d3759c23b7238e93', name: "start", label: "Start", description: "Logo / back button / nav", "allowed-components": "le-button,le-text,le-tag,le-box,le-stack" }, h("slot", { key: 'e7e2b7ad283ce089def47d1f11f78a8a1603face', name: "start" }))), h("div", { key: '145aaadb93972b9018f9303baee2d5b3c42db319', class: "title", part: "title" }, h("le-slot", { key: 'c488ef0d01da476a6351ae4b7dfb397950f9c3ce', name: "title", label: "Title", description: "Header title", type: "text", tag: "span" }, h("span", { key: '78c21f46cbc81dc720e2f803cb3edc81ba5f76cf', class: "title-slot", part: "title" }, h("slot", { key: 'a47d5c8d4d0ae42b1cb4d7fab98022cbb380a27e', name: "title" })))), h("div", { key: '5fb7c5febcfb9b837f313caa65ea9b5e08b6f9cb', class: "end", part: "end" }, h("le-slot", { key: 'cc2ed75ea779a29e5c616daafec3ef90bbec3cfc', name: "end", label: "End", description: "Actions", "allowed-components": "le-button,le-text,le-tag,le-box,le-stack" }, h("slot", { key: '135e8c2c0d7a7d9bef174f380d1f31d377cb043f', name: "end" })))), h("div", { key: 'b0d9e5fba045b7cfd5640e7ba700cb44d673f982', class: "secondary", part: "secondary" }, h("le-slot", { key: '75ed60e3ddef918db1534f8818cd0f337c71e8db', name: "", label: "Secondary", description: "Secondary row content", "allowed-components": "le-tabs,le-tab-bar,le-select,le-combobox,le-text,le-stack,le-box" }, h("slot", { key: '1266dc5bb54bf22055acbfc23befb398c1ee5a31' }))))))));
|
|
282
282
|
}
|
|
283
283
|
static get is() { return "le-header"; }
|
|
284
284
|
static get encapsulation() { return "shadow"; }
|
|
@@ -11,7 +11,7 @@ import { h, Host } from "@stencil/core";
|
|
|
11
11
|
*/
|
|
12
12
|
export class LeHeaderPlaceholder {
|
|
13
13
|
render() {
|
|
14
|
-
return (h(Host, { key: '
|
|
14
|
+
return (h(Host, { key: '0b056eac512d668bc8c3aa7000bdc7363dace713', "aria-hidden": "true", style: {
|
|
15
15
|
display: 'block',
|
|
16
16
|
height: 'var(--le-header-height, 64px)',
|
|
17
17
|
} }));
|
|
@@ -109,7 +109,7 @@ export class LeIcon {
|
|
|
109
109
|
return svgElements;
|
|
110
110
|
}
|
|
111
111
|
render() {
|
|
112
|
-
return (h("svg", { key: '
|
|
112
|
+
return (h("svg", { key: '679c2641c722c5321ffc90a372d3f5fa5d748946', xmlns: "http://www.w3.org/2000/svg", fill: "currentColor", height: this.size || 16, width: this.size || 16, viewBox: this.iconData?.viewBox || `0 0 ${this.size || 16} ${this.size || 16}` }, this.renderSVGContent(this.iconData?.children)));
|
|
113
113
|
}
|
|
114
114
|
static get is() { return "le-icon"; }
|
|
115
115
|
static get encapsulation() { return "shadow"; }
|
|
@@ -308,13 +308,13 @@ export class LeMultiselect {
|
|
|
308
308
|
render() {
|
|
309
309
|
const hasSelections = this.selectedOptions.length > 0;
|
|
310
310
|
const atMaxSelections = this.maxSelections && this.value.length >= this.maxSelections;
|
|
311
|
-
return (h("le-component", { key: '
|
|
311
|
+
return (h("le-component", { key: 'e6183adb112775737e6a7f47b0be614a76a1c110', component: "le-multiselect" }, h("le-dropdown-base", { key: 'ee8ba9e02608a5c26d8a8b0a659e89e5631f3f6a', ref: el => (this.dropdownEl = el), options: this.effectiveOptions, value: this.value, multiple: true, disabled: this.disabled, filterFn: this.searchable ? this.filterOption : undefined, filterQuery: this.searchQuery, emptyText: this.emptyText, showCheckboxes: true, fullWidth: this.fullWidth, onLeOptionSelect: this.handleOptionSelect, onLeDropdownOpen: this.handleDropdownOpen, onLeDropdownClose: this.handleDropdownClose }, h("div", { key: '4c87bf167dd876476dae3b0259cda2f28e3787a5', slot: "trigger", class: {
|
|
312
312
|
'multiselect-trigger': true,
|
|
313
313
|
'has-selections': hasSelections,
|
|
314
314
|
'is-open': this.open,
|
|
315
315
|
'is-disabled': this.disabled,
|
|
316
|
-
}, tabIndex: this.disabled ? -1 : 0, role: "combobox", "aria-haspopup": "listbox", "aria-expanded": this.open ? 'true' : 'false', "aria-disabled": this.disabled ? 'true' : undefined, onClick: this.handleTriggerClick, onKeyDown: this.handleTriggerKeyDown }, this.renderTags(), h("div", { key: '
|
|
317
|
-
this.value.map(val => (h("input", { type: "hidden", name: this.name, value: val.toString(), key: val.toString() }))), atMaxSelections && (h("span", { key: '
|
|
316
|
+
}, tabIndex: this.disabled ? -1 : 0, role: "combobox", "aria-haspopup": "listbox", "aria-expanded": this.open ? 'true' : 'false', "aria-disabled": this.disabled ? 'true' : undefined, onClick: this.handleTriggerClick, onKeyDown: this.handleTriggerKeyDown }, this.renderTags(), h("div", { key: 'be629671c75d408127edb480df54c6649e28ca2a', class: "multiselect-actions" }, hasSelections && !this.disabled && (h("button", { key: '67f4c2152e4b2f8f52b8b98093fbb238571f6105', type: "button", class: "multiselect-clear", onClick: this.handleClearAll, "aria-label": "Clear all", tabIndex: -1 }, h("svg", { key: '5894bfb10a310a29f21c865323b2175cde05173e', viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", "stroke-width": "2" }, h("path", { key: '50f7445b3627bf110a899dbba2b5f7244d706a49', d: "M4 4l8 8M12 4l-8 8" })))), h("span", { key: '58ef10834f74ce5b21b675b47a4c2a96df4bd173', class: "multiselect-arrow" }, h("svg", { key: '74a20681e12aff0295c219c8ff8f953908aa9a94', viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", "stroke-width": "2" }, h("path", { key: '8e48c5333f7f3035e4c4f80f7c3507e5d3d4caaa', d: "M4 6l4 4 4-4" }))))), this.searchable && this.open && (h("div", { key: '906f9596d6a0da2840d534570d38ea008d7cdb4b', class: "multiselect-search", slot: "header" }, h("le-string-input", { key: 'ccd7f1b2594be3440adb16ef5c001beaa5547396', mode: "default", inputRef: el => (this.inputEl = el), class: "search-input", placeholder: "Search...", value: this.searchQuery, onInput: this.handleSearchInput })))), this.name &&
|
|
317
|
+
this.value.map(val => (h("input", { type: "hidden", name: this.name, value: val.toString(), key: val.toString() }))), atMaxSelections && (h("span", { key: 'c329c06d0e00a1516c9d3323ad4a83b81a205f13', class: "multiselect-status" }, "Maximum ", this.maxSelections, " selections"))));
|
|
318
318
|
}
|
|
319
319
|
static get is() { return "le-multiselect"; }
|
|
320
320
|
static get encapsulation() { return "shadow"; }
|