@odx/foundation 1.0.0-beta.10 → 1.0.0-beta.12
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/cdk/control/listbox-form-control.d.ts +22 -0
- package/dist/cdk/control/option-control.d.ts +16 -7
- package/dist/cdk/interactive/interactive-element.d.ts +1 -1
- package/dist/cdk/main.d.ts +1 -1
- package/dist/cdk/popover/popover-host.d.ts +2 -0
- package/dist/cdk.js +173 -120
- package/dist/components/checkbox/checkbox.d.ts +1 -1
- package/dist/components/chip/chip.d.ts +2 -2
- package/dist/components/combobox/combobox.d.ts +20 -0
- package/dist/components/combobox/index.d.ts +2 -0
- package/dist/components/dropdown/dropdown.d.ts +6 -2
- package/dist/components/highlight/highlight.d.ts +3 -0
- package/dist/components/main.d.ts +1 -0
- package/dist/components/option/option.d.ts +0 -1
- package/dist/components/select/select.d.ts +6 -5
- package/dist/components/table/table-row.d.ts +1 -1
- package/dist/components.js +602 -480
- package/dist/lib/controllers/active-desendants-controller.d.ts +25 -0
- package/dist/lib/main.d.ts +3 -0
- package/dist/lib/mixins/can-be-highlighted.d.ts +8 -0
- package/dist/lib/mixins/form-control.d.ts +1 -1
- package/dist/lib/utils/query-assigned-element.d.ts +16 -0
- package/dist/lib/utils/search-text-content.d.ts +1 -0
- package/dist/loader.js +1 -1
- package/dist/main.js +112 -2
- package/package.json +2 -2
- package/dist/cdk/control/select-form-control.d.ts +0 -19
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { CustomElement } from '../../lib/main.js';
|
|
2
|
+
import { PropertyValues } from 'lit';
|
|
3
|
+
import { OptionControl } from './option-control.js';
|
|
4
|
+
declare const ListboxFormControl_base: import('../../lib/main.js').Constructor<import('../../lib/main.js').IsFormControl<string | string[]>> & typeof CustomElement;
|
|
5
|
+
export declare abstract class ListboxFormControl<Option extends OptionControl> extends ListboxFormControl_base {
|
|
6
|
+
#private;
|
|
7
|
+
protected abstract options: Option[];
|
|
8
|
+
autoSelect: boolean;
|
|
9
|
+
multiple: boolean;
|
|
10
|
+
value: string[] | string;
|
|
11
|
+
get selectedOptions(): MapIterator<Option>;
|
|
12
|
+
constructor();
|
|
13
|
+
canAutoSelect(option: Option): boolean;
|
|
14
|
+
canSelect(option: Option): boolean;
|
|
15
|
+
toggleOption(option: Option, state?: boolean): void;
|
|
16
|
+
connectedCallback(): void;
|
|
17
|
+
protected updateValue(option: Option): void;
|
|
18
|
+
protected willUpdate(props: PropertyValues<this>): void;
|
|
19
|
+
protected updateSelection(): void;
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=listbox-form-control.d.ts.map
|
|
@@ -1,15 +1,24 @@
|
|
|
1
|
-
import { CanBeDisabled, CustomElement } from '../../lib/main.js';
|
|
1
|
+
import { CanBeDisabled, CanBeHighlighted, CustomElement } from '../../lib/main.js';
|
|
2
2
|
import { PropertyValueMap } from 'lit';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
export interface Option {
|
|
4
|
+
label?: string;
|
|
5
|
+
value: string;
|
|
6
6
|
selected: boolean;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
}
|
|
9
|
+
declare const OptionControl_base: import('../../lib/main.js').Constructor<CanBeHighlighted> & import('../../lib/main.js').Constructor<CanBeDisabled> & typeof CustomElement;
|
|
10
|
+
export declare abstract class OptionControl extends OptionControl_base implements Option {
|
|
11
|
+
#private;
|
|
12
|
+
role: 'option' | 'gridcell' | 'row' | 'tab' | null;
|
|
13
|
+
set label(value: string);
|
|
14
|
+
get label(): string;
|
|
7
15
|
value: string;
|
|
16
|
+
selected: boolean;
|
|
17
|
+
type?: 'checkbox' | null;
|
|
8
18
|
getTextLabel(): string;
|
|
9
|
-
|
|
10
|
-
setInactive(): void;
|
|
19
|
+
toggle(force?: boolean): void;
|
|
11
20
|
connectedCallback(): void;
|
|
12
|
-
protected willUpdate(
|
|
21
|
+
protected willUpdate(props: PropertyValueMap<this>): void;
|
|
13
22
|
}
|
|
14
23
|
export {};
|
|
15
24
|
//# sourceMappingURL=option-control.d.ts.map
|
|
@@ -15,8 +15,8 @@ declare const InteractiveElement_base: import('../../lib/main.js').Constructor<i
|
|
|
15
15
|
*/
|
|
16
16
|
export declare class InteractiveElement extends InteractiveElement_base implements InteractiveElement {
|
|
17
17
|
#private;
|
|
18
|
-
nativeElement: HTMLButtonElement | HTMLAnchorElement;
|
|
19
18
|
static readonly styles: import('lit').CSSResult;
|
|
19
|
+
nativeElement: HTMLButtonElement | HTMLAnchorElement;
|
|
20
20
|
loaderSlot?: 'prefix' | 'suffix';
|
|
21
21
|
lineClamp: 1 | 2;
|
|
22
22
|
protected render(): TemplateResult;
|
package/dist/cdk/main.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export * from './control/checkbox-form-control.js';
|
|
2
2
|
export * from './control/checkbox-group-form-control.js';
|
|
3
|
+
export * from './control/listbox-form-control.js';
|
|
3
4
|
export * from './control/option-control.js';
|
|
4
5
|
export * from './control/radio-group-form-control.js';
|
|
5
|
-
export * from './control/select-form-control.js';
|
|
6
6
|
export * from './drag-drop/drag-events.js';
|
|
7
7
|
export * from './drag-drop/drag.controller.js';
|
|
8
8
|
export * from './drag-drop/is-draggable.js';
|
|
@@ -15,9 +15,11 @@ export declare class PopoverHost extends CustomElement {
|
|
|
15
15
|
unmountPopover(referenceElement: HTMLElement): void;
|
|
16
16
|
isPopoverOpen(): boolean;
|
|
17
17
|
togglePopover(force?: boolean): boolean;
|
|
18
|
+
canPopoverShow?(): boolean;
|
|
18
19
|
onBeforePopoverShow?(): void;
|
|
19
20
|
onPopoverShow?(): void;
|
|
20
21
|
onBeforePopoverHide?(): void;
|
|
21
22
|
onPopoverHide?(): void;
|
|
23
|
+
canPopoverHide?(): boolean;
|
|
22
24
|
}
|
|
23
25
|
//# sourceMappingURL=popover-host.d.ts.map
|
package/dist/cdk.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FormControl, CustomElement, getKeyboardEventInfo, toAriaBooleanAttribute, CanBeDisabled, getElementFromEvent, dedupeMixin, optionalAttr, requestUpdateOnAriaChange, WithLoadingState, getAssignedElements, toPx, waitForAnimations, findClosestDocument, createMutationObserver, customElement } from '@odx/foundation';
|
|
1
|
+
import { FormControl, CustomElement, getKeyboardEventInfo, toAriaBooleanAttribute, CanBeHighlighted, CanBeDisabled, toggleAttribute, getUniqueId, getElementFromEvent, ActiveDescendantsController, dedupeMixin, optionalAttr, requestUpdateOnAriaChange, WithLoadingState, getAssignedElements, toPx, waitForAnimations, findClosestDocument, createMutationObserver, customElement } from '@odx/foundation';
|
|
2
2
|
import { isServer, html, unsafeCSS } from 'lit';
|
|
3
3
|
import { property, queryAssignedElements, query, state } from 'lit/decorators.js';
|
|
4
4
|
import { R as RovingTabindexController, m as minBy } from './vendor-dJxQG085.js';
|
|
@@ -189,39 +189,50 @@ var __decorateClass$7 = (decorators, target, key, kind) => {
|
|
|
189
189
|
if (kind && result) __defProp$7(target, key, result);
|
|
190
190
|
return result;
|
|
191
191
|
};
|
|
192
|
-
class OptionControl extends CanBeDisabled(CustomElement) {
|
|
192
|
+
class OptionControl extends CanBeHighlighted(CanBeDisabled(CustomElement)) {
|
|
193
193
|
constructor() {
|
|
194
194
|
super(...arguments);
|
|
195
195
|
this.role = null;
|
|
196
|
-
this.selected = false;
|
|
197
196
|
this.value = "";
|
|
197
|
+
this.selected = false;
|
|
198
|
+
}
|
|
199
|
+
#label;
|
|
200
|
+
set label(value) {
|
|
201
|
+
this.#label = value;
|
|
202
|
+
}
|
|
203
|
+
get label() {
|
|
204
|
+
return this.#label || this.getTextLabel();
|
|
198
205
|
}
|
|
199
206
|
getTextLabel() {
|
|
200
207
|
return this.textContent?.trim() ?? "";
|
|
201
208
|
}
|
|
202
|
-
|
|
203
|
-
this
|
|
204
|
-
}
|
|
205
|
-
setInactive() {
|
|
206
|
-
this.removeAttribute("odx-active");
|
|
209
|
+
toggle(force) {
|
|
210
|
+
toggleAttribute(this, "odx-active", force ?? !this.hasAttribute("odx-active"));
|
|
207
211
|
}
|
|
208
212
|
connectedCallback() {
|
|
209
213
|
super.connectedCallback();
|
|
210
214
|
this.role ||= "option";
|
|
215
|
+
this.id ||= getUniqueId(this.localName);
|
|
211
216
|
}
|
|
212
|
-
willUpdate(
|
|
213
|
-
super.willUpdate?.(
|
|
214
|
-
if (
|
|
217
|
+
willUpdate(props) {
|
|
218
|
+
super.willUpdate?.(props);
|
|
219
|
+
if (props.has("selected")) {
|
|
215
220
|
this.ariaSelected = toAriaBooleanAttribute(this.selected, false);
|
|
216
221
|
}
|
|
217
222
|
}
|
|
218
223
|
}
|
|
219
224
|
__decorateClass$7([
|
|
220
|
-
property({ type:
|
|
221
|
-
], OptionControl.prototype, "
|
|
225
|
+
property({ type: String })
|
|
226
|
+
], OptionControl.prototype, "label", 1);
|
|
222
227
|
__decorateClass$7([
|
|
223
228
|
property()
|
|
224
229
|
], OptionControl.prototype, "value", 2);
|
|
230
|
+
__decorateClass$7([
|
|
231
|
+
property({ type: Boolean })
|
|
232
|
+
], OptionControl.prototype, "selected", 2);
|
|
233
|
+
__decorateClass$7([
|
|
234
|
+
property({ reflect: true })
|
|
235
|
+
], OptionControl.prototype, "type", 2);
|
|
225
236
|
|
|
226
237
|
var __defProp$6 = Object.defineProperty;
|
|
227
238
|
var __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor;
|
|
@@ -233,6 +244,148 @@ var __decorateClass$6 = (decorators, target, key, kind) => {
|
|
|
233
244
|
if (kind && result) __defProp$6(target, key, result);
|
|
234
245
|
return result;
|
|
235
246
|
};
|
|
247
|
+
class ListboxFormControl extends FormControl(CustomElement) {
|
|
248
|
+
constructor() {
|
|
249
|
+
super();
|
|
250
|
+
this.#selectedOptions = /* @__PURE__ */ new Map();
|
|
251
|
+
this.autoSelect = false;
|
|
252
|
+
this.multiple = false;
|
|
253
|
+
this.value = "";
|
|
254
|
+
this.#handleBlur = (_event) => {
|
|
255
|
+
this.#activeDecendants.deactivate();
|
|
256
|
+
};
|
|
257
|
+
this.#handleClick = (event) => {
|
|
258
|
+
const option = getElementFromEvent(event, (node) => node instanceof OptionControl);
|
|
259
|
+
if (!option) return;
|
|
260
|
+
this.toggleOption(option);
|
|
261
|
+
};
|
|
262
|
+
this.#handleFocus = (_event) => {
|
|
263
|
+
const selectedIndex = this.options.findIndex((option) => !option.disabled && option.selected);
|
|
264
|
+
this.#activeDecendants.activate(selectedIndex === -1 ? void 0 : selectedIndex);
|
|
265
|
+
};
|
|
266
|
+
this.#handleKeyEvent = (event) => {
|
|
267
|
+
const activeOption = this.#activeDecendants.activeItem;
|
|
268
|
+
if (!activeOption) return;
|
|
269
|
+
const { actions } = getKeyboardEventInfo(event);
|
|
270
|
+
if (actions.enter || actions.space || actions.tab && this.canAutoSelect(activeOption)) {
|
|
271
|
+
if (this.multiple) {
|
|
272
|
+
event.stopPropagation();
|
|
273
|
+
event.stopImmediatePropagation();
|
|
274
|
+
}
|
|
275
|
+
this.toggleOption(activeOption);
|
|
276
|
+
}
|
|
277
|
+
};
|
|
278
|
+
if (!isServer) {
|
|
279
|
+
this.addEventListener("blur", this.#handleBlur);
|
|
280
|
+
this.addEventListener("focusin", this.#handleFocus);
|
|
281
|
+
this.addEventListener("click", this.#handleClick);
|
|
282
|
+
this.addEventListener("keydown", this.#handleKeyEvent);
|
|
283
|
+
}
|
|
284
|
+
this.#activeDecendants = new ActiveDescendantsController(this, {
|
|
285
|
+
getItems: () => this.options,
|
|
286
|
+
onChange: (_, option, firstChange) => {
|
|
287
|
+
option?.scrollIntoView();
|
|
288
|
+
if (!option || !this.canAutoSelect(option) || firstChange || option.selected) return;
|
|
289
|
+
this.toggleOption(option, true);
|
|
290
|
+
}
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
#activeDecendants;
|
|
294
|
+
#selectedOptions;
|
|
295
|
+
get selectedOptions() {
|
|
296
|
+
return this.#selectedOptions.values();
|
|
297
|
+
}
|
|
298
|
+
canAutoSelect(option) {
|
|
299
|
+
return this.autoSelect && !option.disabled && !this.multiple;
|
|
300
|
+
}
|
|
301
|
+
canSelect(option) {
|
|
302
|
+
return !option.disabled;
|
|
303
|
+
}
|
|
304
|
+
toggleOption(option, state) {
|
|
305
|
+
if (!this.canSelect(option)) return;
|
|
306
|
+
const newState = state ?? (this.required && !this.multiple || !option.selected);
|
|
307
|
+
if (this.disabled || newState === option.selected) return;
|
|
308
|
+
option.selected = newState;
|
|
309
|
+
this.updateValue(option);
|
|
310
|
+
if (newState) {
|
|
311
|
+
option.scrollIntoView();
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
connectedCallback() {
|
|
315
|
+
super.connectedCallback();
|
|
316
|
+
this.role ||= "listbox";
|
|
317
|
+
this.id ||= getUniqueId(this.localName);
|
|
318
|
+
}
|
|
319
|
+
updateValue(option) {
|
|
320
|
+
if (this.multiple) {
|
|
321
|
+
const value = typeof this.value === "string" ? [this.value].filter(Boolean) : this.value;
|
|
322
|
+
this.value = option.selected ? [...value, option.value] : value.filter((value2) => value2 !== option.value);
|
|
323
|
+
} else {
|
|
324
|
+
this.value = option.selected ? option.value : "";
|
|
325
|
+
}
|
|
326
|
+
this.#activeDecendants.select(option);
|
|
327
|
+
this.updateSelection();
|
|
328
|
+
this.emit("change");
|
|
329
|
+
}
|
|
330
|
+
willUpdate(props) {
|
|
331
|
+
super.willUpdate?.(props);
|
|
332
|
+
if (props.has("multiple")) {
|
|
333
|
+
this.#handleMultipleChange();
|
|
334
|
+
}
|
|
335
|
+
if (props.has("required") || props.has("value")) {
|
|
336
|
+
const [selectedOption] = this.#selectedOptions.values();
|
|
337
|
+
if (!selectedOption?.selected) return;
|
|
338
|
+
this.setValidity({ valueMissing: this.required && this.value.length === 0 }, selectedOption);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
updateSelection() {
|
|
342
|
+
if (this.disabled) return;
|
|
343
|
+
for (const option of this.options ?? []) {
|
|
344
|
+
if (option.disabled) continue;
|
|
345
|
+
option.selected = this.multiple ? this.value.includes(option.value) : this.value === option.value;
|
|
346
|
+
if (option.selected) {
|
|
347
|
+
this.#selectedOptions.set(option.value, option);
|
|
348
|
+
} else {
|
|
349
|
+
this.#selectedOptions.delete(option.value);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
#handleBlur;
|
|
354
|
+
#handleClick;
|
|
355
|
+
#handleFocus;
|
|
356
|
+
#handleKeyEvent;
|
|
357
|
+
#handleMultipleChange() {
|
|
358
|
+
const optionType = this.multiple ? "checkbox" : null;
|
|
359
|
+
for (const option of this.options) {
|
|
360
|
+
option.type = optionType;
|
|
361
|
+
}
|
|
362
|
+
if (this.multiple) return;
|
|
363
|
+
const [selectedOption] = this.#selectedOptions.values();
|
|
364
|
+
if (selectedOption) {
|
|
365
|
+
this.updateValue(selectedOption);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
__decorateClass$6([
|
|
370
|
+
property({ type: Boolean, attribute: "auto-select", reflect: true })
|
|
371
|
+
], ListboxFormControl.prototype, "autoSelect", 2);
|
|
372
|
+
__decorateClass$6([
|
|
373
|
+
property({ type: Boolean, reflect: true })
|
|
374
|
+
], ListboxFormControl.prototype, "multiple", 2);
|
|
375
|
+
__decorateClass$6([
|
|
376
|
+
property()
|
|
377
|
+
], ListboxFormControl.prototype, "value", 2);
|
|
378
|
+
|
|
379
|
+
var __defProp$5 = Object.defineProperty;
|
|
380
|
+
var __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor;
|
|
381
|
+
var __decorateClass$5 = (decorators, target, key, kind) => {
|
|
382
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target;
|
|
383
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
384
|
+
if (decorator = decorators[i])
|
|
385
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
386
|
+
if (kind && result) __defProp$5(target, key, result);
|
|
387
|
+
return result;
|
|
388
|
+
};
|
|
236
389
|
class RadioGroupFormControl extends FormControl(CustomElement) {
|
|
237
390
|
static {
|
|
238
391
|
this.shadowRootOptions = {
|
|
@@ -299,110 +452,10 @@ class RadioGroupFormControl extends FormControl(CustomElement) {
|
|
|
299
452
|
this.value = target.value;
|
|
300
453
|
};
|
|
301
454
|
}
|
|
302
|
-
__decorateClass$
|
|
455
|
+
__decorateClass$5([
|
|
303
456
|
queryAssignedElements({ flatten: true })
|
|
304
457
|
], RadioGroupFormControl.prototype, "elements", 2);
|
|
305
458
|
|
|
306
|
-
var __defProp$5 = Object.defineProperty;
|
|
307
|
-
var __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor;
|
|
308
|
-
var __decorateClass$5 = (decorators, target, key, kind) => {
|
|
309
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target;
|
|
310
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
311
|
-
if (decorator = decorators[i])
|
|
312
|
-
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
313
|
-
if (kind && result) __defProp$5(target, key, result);
|
|
314
|
-
return result;
|
|
315
|
-
};
|
|
316
|
-
class SelectFormControl extends FormControl(
|
|
317
|
-
CustomElement
|
|
318
|
-
) {
|
|
319
|
-
constructor() {
|
|
320
|
-
super();
|
|
321
|
-
this.#selectedOptions = /* @__PURE__ */ new Map();
|
|
322
|
-
this.multiple = false;
|
|
323
|
-
this.value = "";
|
|
324
|
-
this.handleKeyboardEvent = (event) => {
|
|
325
|
-
const { actions } = getKeyboardEventInfo(event);
|
|
326
|
-
const option = getElementFromEvent(event, (node) => node instanceof OptionControl);
|
|
327
|
-
if (!option || !actions.enter && !actions.space) return;
|
|
328
|
-
event.preventDefault();
|
|
329
|
-
if (event.type === "keydown") return;
|
|
330
|
-
this.toggle(option, void 0, true);
|
|
331
|
-
};
|
|
332
|
-
this.#handleClick = (event) => {
|
|
333
|
-
const option = getElementFromEvent(event, (node) => node instanceof OptionControl);
|
|
334
|
-
if (!option) return;
|
|
335
|
-
this.toggle(option, void 0, true);
|
|
336
|
-
};
|
|
337
|
-
if (!isServer) {
|
|
338
|
-
this.addEventListener("click", this.#handleClick);
|
|
339
|
-
this.addEventListener("keydown", this.handleKeyboardEvent);
|
|
340
|
-
this.addEventListener("keyup", this.handleKeyboardEvent);
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
#selectedOptions;
|
|
344
|
-
get selectedOptions() {
|
|
345
|
-
return this.#selectedOptions.values();
|
|
346
|
-
}
|
|
347
|
-
toggle(option, state, emitEvent = false) {
|
|
348
|
-
const currentState = option.selected;
|
|
349
|
-
const newState = state ?? !option.selected;
|
|
350
|
-
if (this.disabled || newState === option.selected) return;
|
|
351
|
-
option.selected = newState;
|
|
352
|
-
this.updateValue(option);
|
|
353
|
-
if (!emitEvent || !this.emit("change")) return;
|
|
354
|
-
option.selected = currentState;
|
|
355
|
-
this.updateValue(option);
|
|
356
|
-
}
|
|
357
|
-
updateValue(option) {
|
|
358
|
-
if (this.multiple) {
|
|
359
|
-
const value = typeof this.value === "string" ? [this.value].filter(Boolean) : this.value;
|
|
360
|
-
this.value = option.selected ? [...value, option.value] : value.filter((value2) => value2 !== option.value);
|
|
361
|
-
} else {
|
|
362
|
-
this.value = option.value;
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
willUpdate(changes) {
|
|
366
|
-
super.willUpdate?.(changes);
|
|
367
|
-
if (changes.has("multiple")) {
|
|
368
|
-
const [selectedOption] = Array.from(this.#selectedOptions.entries());
|
|
369
|
-
if (selectedOption) {
|
|
370
|
-
this.updateValue(selectedOption[1]);
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
if (changes.has("value")) {
|
|
374
|
-
this.updateSelection();
|
|
375
|
-
}
|
|
376
|
-
if (changes.has("required") || changes.has("value")) {
|
|
377
|
-
const [selectedOption] = this.#selectedOptions.values();
|
|
378
|
-
if (!selectedOption?.selected) return;
|
|
379
|
-
this.setValidity({ valueMissing: this.required && this.value.length === 0 }, selectedOption);
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
async updateSelection() {
|
|
383
|
-
if (this.disabled) return;
|
|
384
|
-
await 0;
|
|
385
|
-
for (const option of this.options ?? []) {
|
|
386
|
-
if (option.disabled) continue;
|
|
387
|
-
option.selected = this.multiple ? this.value.includes(option.value) : this.value === option.value;
|
|
388
|
-
option.setInactive();
|
|
389
|
-
if (option.selected) {
|
|
390
|
-
this.#selectedOptions.set(option.value, option);
|
|
391
|
-
} else {
|
|
392
|
-
this.#selectedOptions.delete(option.value);
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
this.requestUpdate();
|
|
396
|
-
}
|
|
397
|
-
#handleClick;
|
|
398
|
-
}
|
|
399
|
-
__decorateClass$5([
|
|
400
|
-
property({ type: Boolean, reflect: true })
|
|
401
|
-
], SelectFormControl.prototype, "multiple", 2);
|
|
402
|
-
__decorateClass$5([
|
|
403
|
-
property()
|
|
404
|
-
], SelectFormControl.prototype, "value", 2);
|
|
405
|
-
|
|
406
459
|
var __defProp$4 = Object.defineProperty;
|
|
407
460
|
var __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor;
|
|
408
461
|
var __decorateClass$4 = (decorators, target, key, kind) => {
|
|
@@ -763,7 +816,6 @@ class PopoverHost extends CustomElement {
|
|
|
763
816
|
this.referenceElement = null;
|
|
764
817
|
this.anchor = "";
|
|
765
818
|
this.#handleToggle = async ({ newState }) => {
|
|
766
|
-
this.isOpen = newState === "open";
|
|
767
819
|
if (this.isOpen) {
|
|
768
820
|
this.onBeforePopoverShow?.();
|
|
769
821
|
await waitForAnimations(this);
|
|
@@ -773,6 +825,7 @@ class PopoverHost extends CustomElement {
|
|
|
773
825
|
await waitForAnimations(this);
|
|
774
826
|
this.onPopoverHide?.();
|
|
775
827
|
}
|
|
828
|
+
this.isOpen = newState === "open";
|
|
776
829
|
};
|
|
777
830
|
if (!isServer) {
|
|
778
831
|
this.addEventListener("toggle", this.#handleToggle);
|
|
@@ -816,13 +869,13 @@ class PopoverHost extends CustomElement {
|
|
|
816
869
|
this.hidePopover();
|
|
817
870
|
}
|
|
818
871
|
isPopoverOpen() {
|
|
819
|
-
return this.isOpen
|
|
872
|
+
return this.isOpen;
|
|
820
873
|
}
|
|
821
874
|
togglePopover(force) {
|
|
822
875
|
const isOpen = force ?? !this.isPopoverOpen();
|
|
823
|
-
if (isOpen) {
|
|
876
|
+
if (isOpen && this.canPopoverShow?.() !== false) {
|
|
824
877
|
this.showPopover();
|
|
825
|
-
} else {
|
|
878
|
+
} else if (this.canPopoverHide?.() !== false) {
|
|
826
879
|
this.hidePopover();
|
|
827
880
|
}
|
|
828
881
|
return isOpen;
|
|
@@ -859,7 +912,7 @@ __decorateClass$1([
|
|
|
859
912
|
property({ reflect: true })
|
|
860
913
|
], PopoverHost.prototype, "placement", 2);
|
|
861
914
|
|
|
862
|
-
const styles = ":host{--_arrow-size: var(--odx-size-50);--_outer-padding: var(--odx-size-75);--_border-radius: var(--odx-popover-border-radius, var(--odx-border-radius-controls));display:flex;background-color:transparent}:host::part(arrow),:host
|
|
915
|
+
const styles = ":host{--_arrow-size: var(--odx-size-50);--_outer-padding: var(--odx-size-75);--_border-radius: var(--odx-popover-border-radius, var(--odx-border-radius-controls));display:flex;background-color:transparent;border-radius:var(--_border-radius);padding-block:var(--_outer-padding);box-shadow:var(--_popover-shadow)}:host::part(arrow),:host{background-color:var(--_popover-color-background)}:host::part(content){display:flex;flex-direction:column;position:relative;inset-block-start:0!important;inset-inline-start:0!important;block-size:fit-content;min-block-size:var(--_popover-min-block-size);max-block-size:100%;min-inline-size:var(--_popover-min-inline-size);max-inline-size:100%;color:var(--_popover-color-foreground);padding-inline:var(--_outer-padding);border-radius:inherit;z-index:2;overflow:auto;scrollbar-width:thin;scroll-behavior:smooth;scroll-padding-block:calc(var(--odx-size-150) + var(--_outer-padding))}:host::part(arrow){border-radius:var(--odx-border-radius-sm);position:absolute;inline-size:var(--_arrow-size);block-size:var(--_arrow-size);z-index:3;inset:0;transform:translate3d(var(--_popover-arrow-position-x),var(--_popover-arrow-position-y),0) rotate(45deg)}";
|
|
863
916
|
|
|
864
917
|
var __defProp = Object.defineProperty;
|
|
865
918
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -892,4 +945,4 @@ OdxPopover = __decorateClass([
|
|
|
892
945
|
customElement("odx-popover", [styles])
|
|
893
946
|
], OdxPopover);
|
|
894
947
|
|
|
895
|
-
export { CheckboxFormControl, CheckboxGroupFormControl, DragController, DragControllerOptions, IS_DRAG_ACTIVE_ATTRIBUTE, InteractiveElement, InteractiveLink, IsDraggable, OdxPopover, OptionControl, PopoverHost, PopoverPlacement, PopoverPlacementOptions, PopoverSide, RadioGroupFormControl,
|
|
948
|
+
export { CheckboxFormControl, CheckboxGroupFormControl, DragController, DragControllerOptions, IS_DRAG_ACTIVE_ATTRIBUTE, InteractiveElement, InteractiveLink, IsDraggable, ListboxFormControl, OdxPopover, OptionControl, PopoverHost, PopoverPlacement, PopoverPlacementOptions, PopoverSide, RadioGroupFormControl, isDraggableElement };
|
|
@@ -8,7 +8,7 @@ declare global {
|
|
|
8
8
|
export declare class OdxCheckbox extends CheckboxFormControl {
|
|
9
9
|
indeterminate: boolean;
|
|
10
10
|
protected render(): TemplateResult;
|
|
11
|
-
protected willUpdate(
|
|
11
|
+
protected willUpdate(props: PropertyValueMap<this>): void;
|
|
12
12
|
toggle(state?: boolean, dispatchEvent?: boolean): void;
|
|
13
13
|
}
|
|
14
14
|
//# sourceMappingURL=checkbox.d.ts.map
|
|
@@ -15,8 +15,8 @@ export declare class OdxChip extends OdxChip_base {
|
|
|
15
15
|
variant?: ChipVariant;
|
|
16
16
|
protected render(): TemplateResult;
|
|
17
17
|
protected renderAction(): TemplateResult;
|
|
18
|
-
protected willUpdate(
|
|
19
|
-
protected updated(
|
|
18
|
+
protected willUpdate(props: PropertyValues<this>): void;
|
|
19
|
+
protected updated(props: PropertyValues<this>): void;
|
|
20
20
|
}
|
|
21
21
|
export {};
|
|
22
22
|
//# sourceMappingURL=chip.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ListboxFormControl, OptionControl } from '../../cdk/main.js';
|
|
2
|
+
import { TemplateResult } from 'lit';
|
|
3
|
+
import { OdxDropdown } from '../dropdown/index.js';
|
|
4
|
+
import { OdxOption } from '../option/index.js';
|
|
5
|
+
declare global {
|
|
6
|
+
interface HTMLElementTagNameMap {
|
|
7
|
+
'odx-combobox': OdxCombobox;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export declare class OdxCombobox extends ListboxFormControl<OptionControl> {
|
|
11
|
+
#private;
|
|
12
|
+
control?: HTMLInputElement | HTMLButtonElement;
|
|
13
|
+
protected options: OdxOption[];
|
|
14
|
+
protected readonly dropdown: OdxDropdown;
|
|
15
|
+
protected base?: HTMLDivElement;
|
|
16
|
+
constructor();
|
|
17
|
+
canAutoSelect(option: OptionControl): boolean;
|
|
18
|
+
protected render(): TemplateResult;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=combobox.d.ts.map
|
|
@@ -10,15 +10,19 @@ declare global {
|
|
|
10
10
|
declare const OdxDropdown_base: import('../../lib/main.js').Constructor<CanBeDisabled> & typeof PopoverHost;
|
|
11
11
|
export declare class OdxDropdown extends OdxDropdown_base {
|
|
12
12
|
#private;
|
|
13
|
-
|
|
13
|
+
popoverElement: OdxPopover;
|
|
14
14
|
matchReferenceWidth: boolean;
|
|
15
15
|
placement: DropdownPlacement;
|
|
16
16
|
get options(): PopoverPlacementOptions;
|
|
17
17
|
connectedCallback(): void;
|
|
18
18
|
mountPopover(referenceElement?: HTMLElement | null): void;
|
|
19
19
|
unmountPopover(referenceElement: HTMLElement): void;
|
|
20
|
+
onBeforePopoverShow(): void;
|
|
21
|
+
onPopoverShow(): void;
|
|
22
|
+
onBeforePopoverHide(): void;
|
|
23
|
+
onPopoverHide(): void;
|
|
20
24
|
protected render(): TemplateResult;
|
|
21
|
-
protected willUpdate(
|
|
25
|
+
protected willUpdate(props: PropertyValues<this>): void;
|
|
22
26
|
}
|
|
23
27
|
export {};
|
|
24
28
|
//# sourceMappingURL=dropdown.d.ts.map
|
|
@@ -7,7 +7,10 @@ declare global {
|
|
|
7
7
|
}
|
|
8
8
|
export declare class OdxHighlight extends CustomElement {
|
|
9
9
|
query?: string | null;
|
|
10
|
+
selector?: string;
|
|
10
11
|
minlength: number;
|
|
12
|
+
subtle: boolean;
|
|
13
|
+
disabled: boolean;
|
|
11
14
|
protected updated(props: PropertyValueMap<this>): void;
|
|
12
15
|
protected highlight(): void;
|
|
13
16
|
}
|
|
@@ -13,6 +13,7 @@ export * from './checkbox-group/index.js';
|
|
|
13
13
|
export * from './checkbox/index.js';
|
|
14
14
|
export * from './chip/index.js';
|
|
15
15
|
export * from './circular-progress-bar/index.js';
|
|
16
|
+
export * from './combobox/index.js';
|
|
16
17
|
export * from './content-box/index.js';
|
|
17
18
|
export * from './dropdown/index.js';
|
|
18
19
|
export * from './form-field/index.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { ListboxFormControl, OptionControl } from '../../cdk/main.js';
|
|
2
|
+
import { TemplateResult } from 'lit';
|
|
3
3
|
import { OdxDropdown } from '../dropdown/index.js';
|
|
4
4
|
import { OdxOption } from '../option/index.js';
|
|
5
5
|
declare global {
|
|
@@ -7,12 +7,13 @@ declare global {
|
|
|
7
7
|
'odx-select': OdxSelect;
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
|
-
export declare class OdxSelect extends
|
|
10
|
+
export declare class OdxSelect extends ListboxFormControl<OptionControl> {
|
|
11
11
|
#private;
|
|
12
12
|
protected options: OdxOption[];
|
|
13
|
-
protected
|
|
13
|
+
protected readonly dropdown: OdxDropdown;
|
|
14
|
+
maxVisibleSelectedOptions: number;
|
|
15
|
+
constructor();
|
|
14
16
|
protected render(): TemplateResult;
|
|
15
17
|
protected renderSelectedOptions(): TemplateResult;
|
|
16
|
-
protected willUpdate(changes: PropertyValues<this>): void;
|
|
17
18
|
}
|
|
18
19
|
//# sourceMappingURL=select.d.ts.map
|
|
@@ -14,7 +14,7 @@ export declare class OdxTableRow extends OdxTableRow_base {
|
|
|
14
14
|
value: string;
|
|
15
15
|
connectedCallback(): void;
|
|
16
16
|
protected render(): TemplateResult;
|
|
17
|
-
protected willUpdate(
|
|
17
|
+
protected willUpdate(props: PropertyValues<this>): void;
|
|
18
18
|
}
|
|
19
19
|
export {};
|
|
20
20
|
//# sourceMappingURL=table-row.d.ts.map
|