@oscarpalmer/oui 0.39.0 → 0.41.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/README.md +1 -1
- package/dist/css/color-picker.css +80 -69
- package/dist/css/listbox.css +169 -0
- package/dist/js/color-picker/color-picker.constants.d.mts +2 -0
- package/dist/js/color-picker/{constants.color-picker.mjs → color-picker.constants.mjs} +7 -4
- package/dist/js/color-picker/{dom.color-picker.d.mts → color-picker.dom.d.mts} +2 -2
- package/dist/js/color-picker/{dom.color-picker.mjs → color-picker.dom.mjs} +33 -16
- package/dist/js/color-picker/{event.color-picker.d.mts → color-picker.event.d.mts} +3 -3
- package/dist/js/color-picker/color-picker.event.mjs +233 -0
- package/dist/js/color-picker/{form.color-picker.d.mts → color-picker.form.d.mts} +2 -2
- package/dist/js/color-picker/{form.color-picker.mjs → color-picker.form.mjs} +9 -8
- package/dist/js/color-picker/color-picker.misc.d.mts +2 -0
- package/dist/js/color-picker/color-picker.misc.mjs +104 -0
- package/dist/js/color-picker/color-picker.model.d.mts +2 -0
- package/dist/js/color-picker/{models.color-picker.mjs → color-picker.model.mjs} +1 -1
- package/dist/js/color-picker/{output.color-picker.d.mts → color-picker.output.d.mts} +2 -2
- package/dist/js/color-picker/{output.color-picker.mjs → color-picker.output.mjs} +19 -18
- package/dist/js/color-picker/color-picker.state.d.mts +8 -0
- package/dist/js/color-picker/color-picker.state.mjs +168 -0
- package/dist/js/color-picker/index.d.mts +172 -2
- package/dist/js/color-picker/index.mjs +66 -59
- package/dist/js/color-picker.constants-BZgXQr5o.d.mts +177 -0
- package/dist/js/color-picker.misc-BIS3R6jk.d.mts +31 -0
- package/dist/js/combobox/combobox.constants.d.mts +2 -0
- package/dist/js/combobox/{constants.combobox.mjs → combobox.constants.mjs} +21 -21
- package/dist/js/combobox/combobox.dom.d.mts +25 -0
- package/dist/js/combobox/{dom.combobox.mjs → combobox.dom.mjs} +51 -49
- package/dist/js/combobox/{event.combobox.d.mts → combobox.event.d.mts} +9 -9
- package/dist/js/combobox/{event.combobox.mjs → combobox.event.mjs} +1 -1
- package/dist/js/combobox/combobox.misc.d.mts +2 -0
- package/dist/js/combobox/combobox.misc.mjs +2 -0
- package/dist/js/combobox/combobox.model.d.mts +2 -0
- package/dist/js/combobox/combobox.state.d.mts +9 -0
- package/dist/js/combobox/combobox.state.mjs +2 -0
- package/dist/js/combobox/index.d.mts +152 -2
- package/dist/js/combobox/index.mjs +54 -55
- package/dist/js/combobox.constants-Hb3bqqQJ.d.mts +19 -0
- package/dist/js/combobox.misc-DRDFk6X8.d.mts +26 -0
- package/dist/js/combobox.model-gjEI2VqZ.d.mts +46 -0
- package/dist/js/{state.combobox-BWDFHwoi.mjs → combobox.state-AstCICiH.mjs} +109 -106
- package/dist/js/dialog/dialog.model.d.mts +2 -0
- package/dist/js/dialog/dialog.model.mjs +11 -0
- package/dist/js/dialog/index.d.mts +12 -0
- package/dist/js/dialog/index.mjs +123 -0
- package/dist/js/dialog.model-HVzYWoDo.d.mts +45 -0
- package/dist/js/floatable/floatable.embedded.d.mts +2 -2
- package/dist/js/floatable/floatable.embedded.mjs +64 -92
- package/dist/js/floatable/floatable.model.d.mts +2 -0
- package/dist/js/floatable/floatable.model.mjs +23 -0
- package/dist/js/floatable/floatable.standalone.d.mts +2 -1
- package/dist/js/floatable.embedded-ncshL3Sa.d.mts +17 -0
- package/dist/js/{floatable.embedded-DQYkXt8X.d.mts → floatable.model-DXsQgoU7.d.mts} +13 -20
- package/dist/js/focus-trap/focus-trap.embedded.d.mts +2 -2
- package/dist/js/focus-trap/focus-trap.embedded.mjs +117 -138
- package/dist/js/focus-trap/focus-trap.model.d.mts +2 -0
- package/dist/js/focus-trap/focus-trap.model.mjs +15 -0
- package/dist/js/focus-trap/focus-trap.standalone.d.mts +2 -1
- package/dist/js/focus-trap.embedded-DpcPkP7c.d.mts +13 -0
- package/dist/js/{focus-trap.embedded-CjyFQYow.d.mts → focus-trap.model-CpltX5B5.d.mts} +16 -18
- package/dist/js/index.d.mts +26 -14
- package/dist/js/index.mjs +18 -17
- package/dist/js/internal/attributable.d.mts +1 -1
- package/dist/js/internal/attributable.mjs +3 -2
- package/dist/js/internal/draggable/draggable.model.d.mts +2 -0
- package/dist/js/internal/draggable/draggable.model.mjs +37 -0
- package/dist/js/internal/draggable/index.d.mts +13 -0
- package/dist/js/internal/draggable/index.mjs +243 -0
- package/dist/js/internal/l10n/index.d.mts +5 -0
- package/dist/js/internal/l10n/index.mjs +147 -0
- package/dist/js/internal/l10n/l10n.model.d.mts +2 -0
- package/dist/js/internal/l10n/l10n.model.mjs +12 -0
- package/dist/js/internal/misc.d.mts +3 -2
- package/dist/js/internal/misc.mjs +4 -6
- package/dist/js/internal/navigable/index.d.mts +6 -0
- package/dist/js/internal/navigable/index.mjs +125 -0
- package/dist/js/internal/navigable/navigable.model.d.mts +2 -0
- package/dist/js/internal/navigable/navigable.model.mjs +18 -0
- package/dist/js/internal/option-list/option-list.constants.d.mts +8 -0
- package/dist/js/internal/option-list/option-list.constants.mjs +22 -0
- package/dist/js/internal/option-list/option-list.data.d.mts +21 -0
- package/dist/js/internal/option-list/option-list.data.mjs +2 -0
- package/dist/js/internal/option-list/option-list.dom.d.mts +18 -0
- package/dist/js/internal/option-list/option-list.dom.mjs +2 -0
- package/dist/js/internal/option-list/option-list.event.d.mts +6 -0
- package/dist/js/internal/option-list/option-list.event.mjs +66 -0
- package/dist/js/internal/option-list/option-list.form.d.mts +7 -0
- package/dist/js/internal/option-list/option-list.form.mjs +53 -0
- package/dist/js/internal/option-list/option-list.misc.d.mts +13 -0
- package/dist/js/internal/option-list/option-list.misc.mjs +2 -0
- package/dist/js/internal/option-list/option-list.model.d.mts +2 -0
- package/dist/js/internal/option-list/option-list.state.d.mts +8 -0
- package/dist/js/internal/option-list/option-list.state.mjs +39 -0
- package/dist/js/l10n/index.d.mts +3 -0
- package/dist/js/l10n/index.mjs +2 -0
- package/dist/js/l10n.model-D1E1u35L.d.mts +54 -0
- package/dist/js/listbox/index.d.mts +9 -18
- package/dist/js/listbox/index.mjs +49 -52
- package/dist/js/listbox/listbox.constants.d.mts +2 -0
- package/dist/js/listbox/{constants.listbox.mjs → listbox.constants.mjs} +11 -15
- package/dist/js/listbox/listbox.dom.d.mts +5 -0
- package/dist/js/listbox/listbox.dom.mjs +2 -0
- package/dist/js/listbox/listbox.event.d.mts +9 -0
- package/dist/js/listbox/listbox.event.mjs +2 -0
- package/dist/js/listbox/listbox.misc.d.mts +2 -0
- package/dist/js/listbox/listbox.misc.mjs +2 -0
- package/dist/js/listbox/listbox.model.d.mts +2 -0
- package/dist/js/listbox/listbox.model.mjs +1 -0
- package/dist/js/listbox/listbox.state.d.mts +9 -0
- package/dist/js/listbox/listbox.state.mjs +2 -0
- package/dist/js/listbox.constants-DOBMwKup.d.mts +9 -0
- package/dist/js/listbox.misc-DwfB4Mu_.d.mts +24 -0
- package/dist/js/listbox.model-C0MYWXZe.d.mts +20 -0
- package/dist/js/listbox.state-BrN296BM.mjs +240 -0
- package/dist/js/menu/index.mjs +171 -0
- package/dist/js/menu/menu.model.d.mts +33 -0
- package/dist/js/menu/menu.model.mjs +15 -0
- package/dist/js/movable/movable.embedded.d.mts +2 -2
- package/dist/js/movable/movable.embedded.mjs +77 -86
- package/dist/js/movable/movable.model.d.mts +2 -0
- package/dist/js/movable/movable.model.mjs +12 -0
- package/dist/js/movable/movable.standalone.d.mts +2 -1
- package/dist/js/movable.embedded-C1bDTLGs.d.mts +11 -0
- package/dist/js/movable.model-D9nnPWKk.d.mts +186 -0
- package/dist/js/navigable.model-BqoR6iBv.d.mts +44 -0
- package/dist/js/option-list.data-CgMyUwPc.mjs +441 -0
- package/dist/js/option-list.model-CCPUlPeX.d.mts +169 -0
- package/dist/js/popover/index.d.mts +12 -0
- package/dist/js/{popover.mjs → popover/index.mjs} +41 -51
- package/dist/js/popover/popover.model.d.mts +2 -0
- package/dist/js/popover/popover.model.mjs +12 -0
- package/dist/js/popover.model-DiLdz0Hc.d.mts +38 -0
- package/dist/js/resizable/resizable.embedded.d.mts +2 -2
- package/dist/js/resizable/resizable.embedded.mjs +43 -58
- package/dist/js/resizable/resizable.model.d.mts +2 -0
- package/dist/js/resizable/resizable.model.mjs +21 -0
- package/dist/js/resizable/resizable.standalone.d.mts +2 -1
- package/dist/js/resizable.embedded-BemH-7Re.d.mts +11 -0
- package/dist/js/resizable.model-YEtcC9li.d.mts +46 -0
- package/dist/js/sortable/sortable.embedded.d.mts +2 -2
- package/dist/js/sortable/sortable.embedded.mjs +111 -116
- package/dist/js/sortable/sortable.model.d.mts +2 -0
- package/dist/js/sortable/sortable.model.mjs +24 -0
- package/dist/js/sortable/sortable.standalone.d.mts +2 -1
- package/dist/js/sortable.embedded-CrEGff9k.d.mts +11 -0
- package/dist/js/{splitter.d.mts → splitter/index.d.mts} +6 -4
- package/dist/js/{splitter.mjs → splitter/index.mjs} +90 -128
- package/dist/js/splitter/splitter.model.d.mts +2 -0
- package/dist/js/splitter/splitter.model.mjs +37 -0
- package/dist/js/splitter.model-C24W6eZ7.d.mts +57 -0
- package/dist/js/{tabs.d.mts → tabs/index.d.mts} +8 -8
- package/dist/js/{tabs.mjs → tabs/index.mjs} +58 -58
- package/dist/js/tabs/tabs.model.d.mts +2 -0
- package/dist/js/tabs/tabs.model.mjs +18 -0
- package/dist/js/tabs.model-BHPy7fPo.d.mts +40 -0
- package/dist/js/toolbar/index.mjs +27 -0
- package/dist/js/toolbar/toolbar.model.d.mts +11 -0
- package/dist/js/toolbar/toolbar.model.mjs +7 -0
- package/dist/js/tooltip/index.d.mts +19 -0
- package/dist/js/{tooltip.mjs → tooltip/index.mjs} +61 -86
- package/dist/js/tooltip/tooltip.model.d.mts +2 -0
- package/dist/js/tooltip/tooltip.model.mjs +15 -0
- package/dist/js/tooltip.model-BpNStw5z.d.mts +37 -0
- package/package.json +30 -24
- package/dist/js/color-picker/constants.color-picker.d.mts +0 -2
- package/dist/js/color-picker/event.color-picker.mjs +0 -2
- package/dist/js/color-picker/misc.color-picker.d.mts +0 -2
- package/dist/js/color-picker/misc.color-picker.mjs +0 -2
- package/dist/js/color-picker/models.color-picker.d.mts +0 -2
- package/dist/js/color-picker/state.color-picker.d.mts +0 -8
- package/dist/js/color-picker/state.color-picker.mjs +0 -2
- package/dist/js/combobox/constants.combobox.d.mts +0 -2
- package/dist/js/combobox/dom.combobox.d.mts +0 -26
- package/dist/js/combobox/misc.combobox.d.mts +0 -2
- package/dist/js/combobox/misc.combobox.mjs +0 -2
- package/dist/js/combobox/models.combobox.d.mts +0 -43
- package/dist/js/combobox/state.combobox.d.mts +0 -11
- package/dist/js/combobox/state.combobox.mjs +0 -2
- package/dist/js/constants.color-picker-B-gFjL8m.d.mts +0 -364
- package/dist/js/constants.combobox-8EMRmv09.d.mts +0 -18
- package/dist/js/constants.listbox-DGnX32kv.d.mts +0 -8
- package/dist/js/dialog.d.mts +0 -47
- package/dist/js/dialog.mjs +0 -131
- package/dist/js/draggable-B5-70SZm.d.mts +0 -155
- package/dist/js/event.color-picker-BEpq0Adu.mjs +0 -485
- package/dist/js/index-C5D3-oiI.d.mts +0 -177
- package/dist/js/internal/draggable.d.mts +0 -2
- package/dist/js/internal/draggable.mjs +0 -265
- package/dist/js/internal/listbox/listbox.constants.d.mts +0 -8
- package/dist/js/internal/listbox/listbox.constants.mjs +0 -22
- package/dist/js/internal/listbox/listbox.data.d.mts +0 -19
- package/dist/js/internal/listbox/listbox.data.mjs +0 -2
- package/dist/js/internal/listbox/listbox.dom.d.mts +0 -65
- package/dist/js/internal/listbox/listbox.dom.mjs +0 -2
- package/dist/js/internal/listbox/listbox.event.d.mts +0 -4
- package/dist/js/internal/listbox/listbox.event.mjs +0 -63
- package/dist/js/internal/listbox/listbox.form.d.mts +0 -5
- package/dist/js/internal/listbox/listbox.form.mjs +0 -53
- package/dist/js/internal/listbox/listbox.misc.d.mts +0 -11
- package/dist/js/internal/listbox/listbox.misc.mjs +0 -2
- package/dist/js/internal/listbox/listbox.model.d.mts +0 -2
- package/dist/js/internal/listbox/listbox.state.d.mts +0 -6
- package/dist/js/internal/listbox/listbox.state.mjs +0 -40
- package/dist/js/internal/navigable.d.mts +0 -36
- package/dist/js/internal/navigable.mjs +0 -135
- package/dist/js/l10n-Bn-7RcwR.d.mts +0 -20
- package/dist/js/l10n.d.mts +0 -2
- package/dist/js/l10n.mjs +0 -80
- package/dist/js/listbox/constants.listbox.d.mts +0 -2
- package/dist/js/listbox/event.listbox.d.mts +0 -7
- package/dist/js/listbox/event.listbox.mjs +0 -2
- package/dist/js/listbox/misc.listbox.d.mts +0 -2
- package/dist/js/listbox/misc.listbox.mjs +0 -2
- package/dist/js/listbox/state.listbox.d.mts +0 -10
- package/dist/js/listbox/state.listbox.mjs +0 -2
- package/dist/js/listbox.data-DQ7-x2uY.mjs +0 -425
- package/dist/js/listbox.model-BHPA7GM4.d.mts +0 -125
- package/dist/js/menu.mjs +0 -172
- package/dist/js/misc.listbox-DKB-j0UK.mjs +0 -196
- package/dist/js/misc.listbox-mZMuYOxg.d.mts +0 -20
- package/dist/js/popover.d.mts +0 -38
- package/dist/js/resizable.embedded-dvhdfQgt.d.mts +0 -34
- package/dist/js/toolbar.mjs +0 -31
- package/dist/js/tooltip.d.mts +0 -45
- /package/dist/js/combobox/{models.combobox.mjs → combobox.model.mjs} +0 -0
- /package/dist/js/internal/{listbox/listbox.model.mjs → option-list/option-list.model.mjs} +0 -0
- /package/dist/js/{menu.d.mts → menu/index.d.mts} +0 -0
- /package/dist/js/{toolbar.d.mts → toolbar/index.d.mts} +0 -0
|
@@ -1,265 +0,0 @@
|
|
|
1
|
-
import { dispatch, getEventPosition, on } from "@oscarpalmer/toretto/event";
|
|
2
|
-
import { getAttribute, setAttribute } from "@oscarpalmer/toretto/attribute";
|
|
3
|
-
import { isHTMLOrSVGElement } from "@oscarpalmer/toretto/is";
|
|
4
|
-
import { setStyle, setStyles, toggleStyles } from "@oscarpalmer/toretto/style";
|
|
5
|
-
import { clamp } from "@oscarpalmer/atoms/number";
|
|
6
|
-
import { findAncestor } from "@oscarpalmer/toretto/find";
|
|
7
|
-
import { supportsTouch } from "@oscarpalmer/toretto/touch";
|
|
8
|
-
//#region src/js/internal/draggable.ts
|
|
9
|
-
var OuiDraggable = class {
|
|
10
|
-
#destroyed = false;
|
|
11
|
-
#state;
|
|
12
|
-
get element() {
|
|
13
|
-
return this.#state.element;
|
|
14
|
-
}
|
|
15
|
-
constructor(name, event, attribute, element, options, extras) {
|
|
16
|
-
this.#state = {
|
|
17
|
-
...extras,
|
|
18
|
-
attribute,
|
|
19
|
-
element,
|
|
20
|
-
event,
|
|
21
|
-
name,
|
|
22
|
-
options,
|
|
23
|
-
horizontal: true,
|
|
24
|
-
vertical: true,
|
|
25
|
-
styling: toggleStyles(element, styles)
|
|
26
|
-
};
|
|
27
|
-
const item = {
|
|
28
|
-
instance: this,
|
|
29
|
-
state: this.#state
|
|
30
|
-
};
|
|
31
|
-
setContainer(item);
|
|
32
|
-
setDirection(item);
|
|
33
|
-
setAttribute(element, attribute, "");
|
|
34
|
-
let states = globals.states.get(element);
|
|
35
|
-
states ??= {};
|
|
36
|
-
states[this.#state.name] = this.#state;
|
|
37
|
-
globals.states.set(element, states);
|
|
38
|
-
}
|
|
39
|
-
destroy() {
|
|
40
|
-
if (this.#destroyed) return;
|
|
41
|
-
this.#destroyed = true;
|
|
42
|
-
destroyInstance(this, this.#state);
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
function addDraggable(element, options) {
|
|
46
|
-
let instances = globals.instances.get(element);
|
|
47
|
-
if (instances == null) {
|
|
48
|
-
instances = {};
|
|
49
|
-
globals.instances.set(element, instances);
|
|
50
|
-
}
|
|
51
|
-
instances[this.property] ??= new this.constructor(element, options);
|
|
52
|
-
return instances[this.property];
|
|
53
|
-
}
|
|
54
|
-
function cancelDrag(item) {
|
|
55
|
-
if (item == null) return;
|
|
56
|
-
item.state.options.drag.onCancel?.(globals, item);
|
|
57
|
-
dispatch(item.state.element, `oui:${item.state.name}:cancel`, { detail: { element: item.state.options.getOrigin() } });
|
|
58
|
-
reset();
|
|
59
|
-
}
|
|
60
|
-
function destroyInstance(instance, state) {
|
|
61
|
-
unsetContainer({
|
|
62
|
-
instance,
|
|
63
|
-
state
|
|
64
|
-
});
|
|
65
|
-
state.element.removeAttribute(state.attribute);
|
|
66
|
-
state.styling.remove();
|
|
67
|
-
state.container = void 0;
|
|
68
|
-
state.element = void 0;
|
|
69
|
-
state.options = void 0;
|
|
70
|
-
state.styling = void 0;
|
|
71
|
-
}
|
|
72
|
-
function getDraggableStates(element) {
|
|
73
|
-
return globals.states.get(element);
|
|
74
|
-
}
|
|
75
|
-
function getHandle(event, isMovable) {
|
|
76
|
-
return findAncestor(event, isMovable ? SELECTOR_MOVABLE_HANDLE : SELECTOR_SORTABLE_HANDLE);
|
|
77
|
-
}
|
|
78
|
-
function getNextPosition(item, position) {
|
|
79
|
-
let x = globals.original?.x ?? 0;
|
|
80
|
-
let y = globals.original?.y ?? 0;
|
|
81
|
-
if (item.state.horizontal) {
|
|
82
|
-
x = position.x - (globals.offset?.x ?? 0);
|
|
83
|
-
if (globals.container != null && globals.element != null) x = clamp(x, globals.container.left, globals.container.right - globals.element.rectangle.width);
|
|
84
|
-
}
|
|
85
|
-
if (item.state.vertical) {
|
|
86
|
-
y = position.y - (globals.offset?.y ?? 0);
|
|
87
|
-
if (globals.container != null && globals.element != null) y = clamp(y, globals.container.top, globals.container.bottom - globals.element.rectangle.height);
|
|
88
|
-
}
|
|
89
|
-
return {
|
|
90
|
-
x,
|
|
91
|
-
y
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
function onKeydown(event) {
|
|
95
|
-
if (current != null && event.key === KEY_ESCAPE) cancelDrag(current);
|
|
96
|
-
}
|
|
97
|
-
function onPointerdown(event) {
|
|
98
|
-
if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey || (supportsTouch.value ? event.type === "mousedown" : event.type === "touchstart" || event.button !== 0)) return;
|
|
99
|
-
const container = findAncestor(event, SELECTOR);
|
|
100
|
-
const instances = globals.instances.get(container);
|
|
101
|
-
const states = globals.states.get(container);
|
|
102
|
-
if (instances == null || states == null) return;
|
|
103
|
-
const isMovable = container.hasAttribute(ATTRIBUTE_MOVABLE);
|
|
104
|
-
const item = {
|
|
105
|
-
instance: isMovable ? instances.movable : instances.sortable,
|
|
106
|
-
state: isMovable ? states.movable : states.sortable
|
|
107
|
-
};
|
|
108
|
-
if (item.instance == null || item.state == null) return;
|
|
109
|
-
if (supportsTouch.value) event.preventDefault();
|
|
110
|
-
let element = container;
|
|
111
|
-
if (!isMovable) {
|
|
112
|
-
element = findAncestor(event, SELECTOR_SORTABLE_ITEM);
|
|
113
|
-
if (element == null || element.parentElement !== container) return;
|
|
114
|
-
}
|
|
115
|
-
let handle = element;
|
|
116
|
-
item.state.hasHandles ??= element.querySelector(SELECTOR_SORTABLE_HANDLE) != null;
|
|
117
|
-
if (item.state.hasHandles) handle = getHandle(event, isMovable);
|
|
118
|
-
if (handle == null) return;
|
|
119
|
-
const dragged = item.state.options.getDragged();
|
|
120
|
-
const rectangle = dragged.getBoundingClientRect();
|
|
121
|
-
const position = getEventPosition(event) ?? {
|
|
122
|
-
x: 0,
|
|
123
|
-
y: 0
|
|
124
|
-
};
|
|
125
|
-
current = item;
|
|
126
|
-
globals.container = item.state.container?.getBoundingClientRect();
|
|
127
|
-
globals.element = {
|
|
128
|
-
rectangle,
|
|
129
|
-
node: dragged
|
|
130
|
-
};
|
|
131
|
-
globals.offset = item.state.options.position.getOffset(globals, item, element, position);
|
|
132
|
-
globals.original = item.state.options.position.getOriginal(globals, item, position);
|
|
133
|
-
if (dispatch(item.state.element, `oui:${item.state.name}:begin`, { detail: {
|
|
134
|
-
element,
|
|
135
|
-
position: { ...globals.original }
|
|
136
|
-
} }).defaultPrevented) {
|
|
137
|
-
item.state.options.drag.onCancel?.(globals, item);
|
|
138
|
-
reset();
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
|
-
const next = getNextPosition(item, position);
|
|
142
|
-
setStyles(dragged, {
|
|
143
|
-
position: "fixed",
|
|
144
|
-
inset: `${next.y}px auto auto ${next.x}px`,
|
|
145
|
-
transform: "translate3d(0, 0, 0)"
|
|
146
|
-
});
|
|
147
|
-
item.state.options.drag.onBegin?.(event, globals, item, element, handle, next);
|
|
148
|
-
item.state.styling.set();
|
|
149
|
-
styleToggler.set();
|
|
150
|
-
}
|
|
151
|
-
function onPointermove(event) {
|
|
152
|
-
if (current == null) return;
|
|
153
|
-
const position = getEventPosition(event);
|
|
154
|
-
if (position == null) return;
|
|
155
|
-
const next = getNextPosition(current, position);
|
|
156
|
-
if (globals.element != null) setStyle(globals.element.node, "inset", `${next.y}px auto auto ${next.x}px`);
|
|
157
|
-
const detail = current.state.options.drag.onMove(event, globals, current, {
|
|
158
|
-
calculated: next,
|
|
159
|
-
original: position
|
|
160
|
-
});
|
|
161
|
-
if (dispatch(current.state.element, `oui:${current.state.name}:move`, { detail }).defaultPrevented) cancelDrag(current);
|
|
162
|
-
}
|
|
163
|
-
function onPointerup(event) {
|
|
164
|
-
current?.state.options.drag.onEnd?.(event, globals, current, reset);
|
|
165
|
-
}
|
|
166
|
-
function removeDraggable(element) {
|
|
167
|
-
const { property } = this;
|
|
168
|
-
removeInstance(globals.instances, property, element);
|
|
169
|
-
removeInstance(globals.states, property, element);
|
|
170
|
-
}
|
|
171
|
-
function removeInstance(map, name, element) {
|
|
172
|
-
const instances = map.get(element);
|
|
173
|
-
if (instances == null || instances[name] == null) return;
|
|
174
|
-
if (typeof instances[name].destroy === "function") instances[name].destroy();
|
|
175
|
-
instances[name] = void 0;
|
|
176
|
-
if (instances[properties[name]] == null) map.delete(element);
|
|
177
|
-
}
|
|
178
|
-
function reset() {
|
|
179
|
-
current?.state.styling.remove();
|
|
180
|
-
styleToggler.remove();
|
|
181
|
-
current = void 0;
|
|
182
|
-
globals.container = void 0;
|
|
183
|
-
globals.element = void 0;
|
|
184
|
-
globals.offset = void 0;
|
|
185
|
-
globals.original = void 0;
|
|
186
|
-
}
|
|
187
|
-
function setContainer(item) {
|
|
188
|
-
const { container } = item.state.options.input ?? {};
|
|
189
|
-
if (isHTMLOrSVGElement(container)) {
|
|
190
|
-
setContainerElement(item, container);
|
|
191
|
-
return;
|
|
192
|
-
}
|
|
193
|
-
const selector = container ?? getAttribute(item.instance.element, item.state.options.container.attribute);
|
|
194
|
-
if (typeof selector !== "string") return;
|
|
195
|
-
const element = containers.has(selector) ? item.state.element.ownerDocument.body : document.querySelector(selector) ?? void 0;
|
|
196
|
-
if (isHTMLOrSVGElement(element)) setContainerElement(item, element);
|
|
197
|
-
}
|
|
198
|
-
function setContainerElement(item, element) {
|
|
199
|
-
item.state.container = element;
|
|
200
|
-
const set = item.state.options.container.map.get(element);
|
|
201
|
-
if (set == null) item.state.options.container.map.set(element, /* @__PURE__ */ new Set([item.instance]));
|
|
202
|
-
else set.add(item.instance);
|
|
203
|
-
item.state.options.container.onInitialize?.(item);
|
|
204
|
-
}
|
|
205
|
-
function setDirection(item) {
|
|
206
|
-
const direction = getAttribute(item.state.element, item.state.options.direction.attribute);
|
|
207
|
-
if (horizontals.has(direction)) item.state.vertical = false;
|
|
208
|
-
else if (verticals.has(direction)) item.state.horizontal = false;
|
|
209
|
-
item.state.options.direction.onAfter?.(item);
|
|
210
|
-
}
|
|
211
|
-
function unsetContainer(item) {
|
|
212
|
-
const { container } = item.state;
|
|
213
|
-
if (container == null) return;
|
|
214
|
-
const set = item.state.options.container.map.get(container);
|
|
215
|
-
let empty = false;
|
|
216
|
-
if (set != null) {
|
|
217
|
-
set.delete(item.instance);
|
|
218
|
-
if (set.size === 0) {
|
|
219
|
-
empty = true;
|
|
220
|
-
item.state.options.container.map.delete(container);
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
item.state.options.container.onDestroy?.(item, container, empty);
|
|
224
|
-
}
|
|
225
|
-
const ATTRIBUTE_MOVABLE = "oui-movable";
|
|
226
|
-
const ATTRIBUTE_SORTABLE = "oui-sortable";
|
|
227
|
-
const KEY_ESCAPE = "Escape";
|
|
228
|
-
const SELECTOR = `[${ATTRIBUTE_MOVABLE}], [${ATTRIBUTE_SORTABLE}]`;
|
|
229
|
-
const SELECTOR_MOVABLE_HANDLE = `[${ATTRIBUTE_MOVABLE}-handle]`;
|
|
230
|
-
const SELECTOR_SORTABLE_HANDLE = `[${ATTRIBUTE_SORTABLE}-handle]`;
|
|
231
|
-
const SELECTOR_SORTABLE_ITEM = `[${ATTRIBUTE_SORTABLE}] > *`;
|
|
232
|
-
const containers = /* @__PURE__ */ new Set([
|
|
233
|
-
"body",
|
|
234
|
-
"document",
|
|
235
|
-
"window"
|
|
236
|
-
]);
|
|
237
|
-
const horizontals = /* @__PURE__ */ new Set(["horizontal", "x"]);
|
|
238
|
-
const properties = {
|
|
239
|
-
movable: "sortable",
|
|
240
|
-
sortable: "movable"
|
|
241
|
-
};
|
|
242
|
-
const globals = {
|
|
243
|
-
container: void 0,
|
|
244
|
-
element: void 0,
|
|
245
|
-
instances: /* @__PURE__ */ new WeakMap(),
|
|
246
|
-
offset: void 0,
|
|
247
|
-
original: void 0,
|
|
248
|
-
states: /* @__PURE__ */ new WeakMap()
|
|
249
|
-
};
|
|
250
|
-
const styles = {
|
|
251
|
-
touchAction: "none",
|
|
252
|
-
userSelect: "none",
|
|
253
|
-
webkitUserSelect: "none"
|
|
254
|
-
};
|
|
255
|
-
const styleToggler = toggleStyles(document.body, styles);
|
|
256
|
-
const verticals = /* @__PURE__ */ new Set(["vertical", "y"]);
|
|
257
|
-
let current;
|
|
258
|
-
on(document, "keydown", onKeydown);
|
|
259
|
-
on(document, "mousedown", onPointerdown);
|
|
260
|
-
on(document, "pointermove", onPointermove);
|
|
261
|
-
on(document, "pointerup", onPointerup);
|
|
262
|
-
on(document, "touchcancel", onPointerup);
|
|
263
|
-
on(document, "touchstart", onPointerdown, { passive: false });
|
|
264
|
-
//#endregion
|
|
265
|
-
export { OuiDraggable, addDraggable, getDraggableStates, removeDraggable };
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { d as OuiListboxType } from "../../listbox.model-BHPA7GM4.mjs";
|
|
2
|
-
//#region src/js/internal/listbox/listbox.constants.d.ts
|
|
3
|
-
export declare const LISTBOX_KEYS_ACTIVATION: Set<string>;
|
|
4
|
-
export declare const LISTBOX_KEYS_NAVIGATION: Set<string>;
|
|
5
|
-
export declare const LISTBOX_KEYS_SELECTION: Set<string>;
|
|
6
|
-
export declare const LISTBOX_TYPES: Set<OuiListboxType>;
|
|
7
|
-
export declare const listboxScrollOptions: ScrollIntoViewOptions;
|
|
8
|
-
//#endregion
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
//#region src/js/internal/listbox/listbox.constants.ts
|
|
2
|
-
const LISTBOX_KEYS_ACTIVATION = /* @__PURE__ */ new Set([
|
|
3
|
-
" ",
|
|
4
|
-
"Backspace",
|
|
5
|
-
"Delete",
|
|
6
|
-
"Enter"
|
|
7
|
-
]);
|
|
8
|
-
const LISTBOX_KEYS_NAVIGATION = /* @__PURE__ */ new Set([
|
|
9
|
-
"ArrowDown",
|
|
10
|
-
"ArrowUp",
|
|
11
|
-
"PageDown",
|
|
12
|
-
"PageUp"
|
|
13
|
-
]);
|
|
14
|
-
const LISTBOX_KEYS_SELECTION = /* @__PURE__ */ new Set(["ArrowRight", "End"]);
|
|
15
|
-
const LISTBOX_TYPES = /* @__PURE__ */ new Set(["autocomplete", "select"]);
|
|
16
|
-
const listboxScrollOptions = {
|
|
17
|
-
behavior: "auto",
|
|
18
|
-
block: "nearest",
|
|
19
|
-
inline: "nearest"
|
|
20
|
-
};
|
|
21
|
-
//#endregion
|
|
22
|
-
export { LISTBOX_KEYS_ACTIVATION, LISTBOX_KEYS_NAVIGATION, LISTBOX_KEYS_SELECTION, LISTBOX_TYPES, listboxScrollOptions };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { l as OuiListboxState } from "../../listbox.model-BHPA7GM4.mjs";
|
|
2
|
-
//#region src/js/internal/listbox/listbox.data.d.ts
|
|
3
|
-
type ApplySelectionParameters<State extends OuiListboxState = OuiListboxState> = {
|
|
4
|
-
added: boolean;
|
|
5
|
-
emit?: boolean;
|
|
6
|
-
option?: HTMLElement;
|
|
7
|
-
scroll?: boolean;
|
|
8
|
-
selected?: HTMLElement[];
|
|
9
|
-
state: State;
|
|
10
|
-
values?: string[];
|
|
11
|
-
};
|
|
12
|
-
export declare function applyListboxSelection<State extends OuiListboxState>(parameters: ApplySelectionParameters<State>): void;
|
|
13
|
-
export declare function filterListbox(type: InputEvent["inputType"], state: OuiListboxState): void;
|
|
14
|
-
export declare function filterListboxOption(state: OuiListboxState, value: unknown, textContent?: boolean): HTMLElement | undefined;
|
|
15
|
-
export declare function filterListboxOptions(state: OuiListboxState): HTMLElement | undefined;
|
|
16
|
-
export declare function setListboxValue<State extends OuiListboxState>(state: State, value: unknown, emit?: boolean): void;
|
|
17
|
-
export declare function setListboxValues<State extends OuiListboxState>(state: State, value: unknown[], emit?: boolean): void;
|
|
18
|
-
export declare function toggleListboxOption<State extends OuiListboxState>(state: State, option?: HTMLElement): void;
|
|
19
|
-
//#endregion
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { a as setListboxValue, i as filterListboxOptions, n as filterListbox, o as setListboxValues, r as filterListboxOption, s as toggleListboxOption, t as applyListboxSelection } from "../../listbox.data-DQ7-x2uY.mjs";
|
|
2
|
-
export { applyListboxSelection, filterListbox, filterListboxOption, filterListboxOptions, setListboxValue, setListboxValues, toggleListboxOption };
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { a as OuiListboxGroup, c as OuiListboxPreview, d as OuiListboxType, l as OuiListboxState, n as OuiListboxAutoComplete, s as OuiListboxOptions, t as OuiListboxAttributes } from "../../listbox.model-BHPA7GM4.mjs";
|
|
2
|
-
//#region src/js/internal/listbox/listbox.dom.d.ts
|
|
3
|
-
export type CreateListboxContent = {
|
|
4
|
-
element: HTMLDivElement;
|
|
5
|
-
filter?: CreateListboxFilter;
|
|
6
|
-
list: CreateListboxList;
|
|
7
|
-
message: HTMLDivElement;
|
|
8
|
-
value: HTMLSpanElement;
|
|
9
|
-
};
|
|
10
|
-
export type CreateListboxContentParameters = {
|
|
11
|
-
attributes: OuiListboxAttributes;
|
|
12
|
-
autocomplete: OuiListboxAutoComplete;
|
|
13
|
-
element: HTMLElement;
|
|
14
|
-
id: string;
|
|
15
|
-
label: HTMLLabelElement;
|
|
16
|
-
listbox: boolean;
|
|
17
|
-
multiple: boolean;
|
|
18
|
-
select: HTMLSelectElement;
|
|
19
|
-
type: OuiListboxType;
|
|
20
|
-
};
|
|
21
|
-
export type CreateListboxFilter = {
|
|
22
|
-
container: HTMLElement;
|
|
23
|
-
element: HTMLInputElement;
|
|
24
|
-
};
|
|
25
|
-
type CreateListboxGroupParameters = {
|
|
26
|
-
group: HTMLOptGroupElement;
|
|
27
|
-
groupOptions: HTMLOptionElement[];
|
|
28
|
-
original: CreateListboxContentParameters;
|
|
29
|
-
selected: HTMLElement[];
|
|
30
|
-
type: OuiListboxType;
|
|
31
|
-
};
|
|
32
|
-
export type CreateListboxList = {
|
|
33
|
-
element: HTMLUListElement;
|
|
34
|
-
groups?: OuiListboxGroup[];
|
|
35
|
-
options: OuiListboxOptions;
|
|
36
|
-
};
|
|
37
|
-
type CreateListboxOptionParameters = {
|
|
38
|
-
group?: string;
|
|
39
|
-
index: number;
|
|
40
|
-
option: HTMLOptionElement;
|
|
41
|
-
original: CreateListboxContentParameters;
|
|
42
|
-
type: OuiListboxType;
|
|
43
|
-
};
|
|
44
|
-
type CreateListboxOptionsParameters = {
|
|
45
|
-
group?: string;
|
|
46
|
-
list: HTMLElement;
|
|
47
|
-
options: HTMLOptionElement[];
|
|
48
|
-
original: CreateListboxContentParameters;
|
|
49
|
-
selected: HTMLElement[];
|
|
50
|
-
type: OuiListboxType;
|
|
51
|
-
};
|
|
52
|
-
export declare function createListboxContent(parameters: CreateListboxContentParameters): CreateListboxContent;
|
|
53
|
-
export declare function createListboxFilter(parameters: CreateListboxContentParameters): CreateListboxFilter | undefined;
|
|
54
|
-
export declare function createListboxGroup(parameters: CreateListboxGroupParameters): OuiListboxGroup;
|
|
55
|
-
export declare function createListboxHeader(parameters: CreateListboxGroupParameters, group: HTMLOptGroupElement): HTMLElement;
|
|
56
|
-
export declare function createListboxInput(parameters: CreateListboxContentParameters, value: string): HTMLInputElement;
|
|
57
|
-
export declare function createListboxList(parameters: CreateListboxContentParameters): CreateListboxList;
|
|
58
|
-
export declare function createListboxMessage(attribute: string): HTMLDivElement;
|
|
59
|
-
export declare function createListboxOption(parameters: CreateListboxOptionParameters): HTMLElement;
|
|
60
|
-
export declare function createListboxOptions(parameters: CreateListboxOptionsParameters): HTMLElement[];
|
|
61
|
-
export declare function createListboxValueLabel(id: string): HTMLSpanElement;
|
|
62
|
-
export declare function updateListboxMessage(state: OuiListboxState): void;
|
|
63
|
-
export declare function updateListboxPreview<State extends OuiListboxState>(preview: OuiListboxPreview, state: State, active?: HTMLElement, scroll?: boolean): void;
|
|
64
|
-
export declare function updateListboxValueLabel<State extends OuiListboxState>(state: State): void;
|
|
65
|
-
//#endregion
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { _ as createListboxValueLabel, b as updateListboxValueLabel, c as createListboxContent, d as createListboxHeader, f as createListboxInput, g as createListboxOptions, h as createListboxOption, l as createListboxFilter, m as createListboxMessage, p as createListboxList, u as createListboxGroup, v as updateListboxMessage, y as updateListboxPreview } from "../../listbox.data-DQ7-x2uY.mjs";
|
|
2
|
-
export { createListboxContent, createListboxFilter, createListboxGroup, createListboxHeader, createListboxInput, createListboxList, createListboxMessage, createListboxOption, createListboxOptions, createListboxValueLabel, updateListboxMessage, updateListboxPreview, updateListboxValueLabel };
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { LISTBOX_KEYS_NAVIGATION, LISTBOX_KEYS_SELECTION } from "./listbox.constants.mjs";
|
|
2
|
-
import { S as getListboxVisibleOptions } from "../../listbox.data-DQ7-x2uY.mjs";
|
|
3
|
-
import { clamp } from "@oscarpalmer/atoms/number";
|
|
4
|
-
//#region src/js/internal/listbox/listbox.event.ts
|
|
5
|
-
function processListboxKeydown(event, state) {
|
|
6
|
-
const ignore = state.disabled || state.readonly;
|
|
7
|
-
const isSelect = state.type === "select";
|
|
8
|
-
let preventDefault = ignore;
|
|
9
|
-
switch (true) {
|
|
10
|
-
case event.key === " ":
|
|
11
|
-
if (!state.disabled) state.callbacks.keydown.onActivation?.(state);
|
|
12
|
-
break;
|
|
13
|
-
case event.key === "Enter":
|
|
14
|
-
preventDefault = state.callbacks.keydown.preventActivation?.(state) ?? true;
|
|
15
|
-
if (preventDefault) state.callbacks.keydown.onEnter?.(state);
|
|
16
|
-
else if (!ignore && state.type === "select") state.callbacks.keydown.onActivation?.(state);
|
|
17
|
-
else if (!ignore) state.internals.form?.requestSubmit();
|
|
18
|
-
break;
|
|
19
|
-
case event.key === "Escape":
|
|
20
|
-
preventDefault = false;
|
|
21
|
-
state.callbacks.keydown.onEscape?.(state);
|
|
22
|
-
break;
|
|
23
|
-
case !isSelect && LISTBOX_KEYS_SELECTION.has(event.key):
|
|
24
|
-
if (!ignore) state.callbacks.keydown.onSelection?.(state);
|
|
25
|
-
break;
|
|
26
|
-
case LISTBOX_KEYS_NAVIGATION.has(event.key):
|
|
27
|
-
if (!state.disabled) onNavigation(event, state);
|
|
28
|
-
break;
|
|
29
|
-
default:
|
|
30
|
-
preventDefault = false;
|
|
31
|
-
if (event.key === "Tab") state.callbacks.keydown.onTab?.(state);
|
|
32
|
-
}
|
|
33
|
-
if (preventDefault) {
|
|
34
|
-
event.preventDefault();
|
|
35
|
-
event.stopPropagation();
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
function onNavigation(event, state) {
|
|
39
|
-
const skip = state.callbacks.keydown.skipNavigation?.(state) ?? false;
|
|
40
|
-
const visible = getListboxVisibleOptions(state);
|
|
41
|
-
if (visible.length === 0) return;
|
|
42
|
-
let next;
|
|
43
|
-
if (skip || state.active == null) next = state.active ?? visible.at(event.key === "ArrowDown" ? 0 : -1);
|
|
44
|
-
else {
|
|
45
|
-
const current = visible.findIndex((option) => option.id === state.active?.id);
|
|
46
|
-
let index;
|
|
47
|
-
switch (event.key) {
|
|
48
|
-
case "ArrowDown":
|
|
49
|
-
case "ArrowUp":
|
|
50
|
-
index = clamp(current + (event.key === "ArrowDown" ? 1 : -1), 0, visible.length - 1, true);
|
|
51
|
-
break;
|
|
52
|
-
case "PageDown":
|
|
53
|
-
case "PageUp": index = clamp(current + (event.key === "PageDown" ? 10 : -10), 0, visible.length - 1);
|
|
54
|
-
}
|
|
55
|
-
if (index != null) next = visible[index];
|
|
56
|
-
}
|
|
57
|
-
let preview;
|
|
58
|
-
if (state.type === "autocomplete" && (state.autocomplete.both || state.autocomplete.inline)) preview = "set";
|
|
59
|
-
else preview = "none";
|
|
60
|
-
state.callbacks.keydown.onNavigation(preview, state, next ?? state.active ?? visible[0]);
|
|
61
|
-
}
|
|
62
|
-
//#endregion
|
|
63
|
-
export { processListboxKeydown };
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { l as OuiListboxState } from "../../listbox.model-BHPA7GM4.mjs";
|
|
2
|
-
//#region src/js/internal/listbox/listbox.form.d.ts
|
|
3
|
-
export declare function updateListboxForm<State extends OuiListboxState>(state: State, values: string[], emit?: boolean): void;
|
|
4
|
-
export declare function updateListboxValidity(state: OuiListboxState): void;
|
|
5
|
-
//#endregion
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { getLocalization, localize } from "../../l10n.mjs";
|
|
2
|
-
import { dispatch } from "@oscarpalmer/toretto/event";
|
|
3
|
-
//#region src/js/internal/listbox/listbox.form.ts
|
|
4
|
-
function updateListboxForm(state, values, emit) {
|
|
5
|
-
let value;
|
|
6
|
-
if (state.multiple) {
|
|
7
|
-
const { length } = values;
|
|
8
|
-
value = new FormData();
|
|
9
|
-
for (let index = 0; index < length; index += 1) value.append(state.name, values[index]);
|
|
10
|
-
} else value = values[0];
|
|
11
|
-
state.values.current = values;
|
|
12
|
-
state.internals.setFormValue(value, JSON.stringify(values));
|
|
13
|
-
state.callbacks.data.onForm(state);
|
|
14
|
-
updateListboxValidity(state);
|
|
15
|
-
if (emit ?? true) dispatch(state.host, "oui:change");
|
|
16
|
-
}
|
|
17
|
-
function updateListboxValidity(state) {
|
|
18
|
-
const { autocomplete, filter, host, internals, listbox, localizations, max, min, multiple, options, required } = state;
|
|
19
|
-
if (autocomplete.none && !listbox) {
|
|
20
|
-
const valueMissing = required && filter.element.value.length === 0;
|
|
21
|
-
const localization = getLocalization(localizations.global, host, "invalid", localizations.component);
|
|
22
|
-
internals.setValidity({ valueMissing }, localize(localization, {}, []));
|
|
23
|
-
internals.checkValidity();
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
let data = {};
|
|
27
|
-
let error;
|
|
28
|
-
let key;
|
|
29
|
-
let parameters = [];
|
|
30
|
-
switch (true) {
|
|
31
|
-
case required && options.selected.length === 0:
|
|
32
|
-
error = "badInput";
|
|
33
|
-
key = "input";
|
|
34
|
-
break;
|
|
35
|
-
case multiple && typeof max === "number" && options.selected.length > max:
|
|
36
|
-
data = { amount: max };
|
|
37
|
-
error = "rangeOverflow";
|
|
38
|
-
key = "max";
|
|
39
|
-
parameters = [max];
|
|
40
|
-
break;
|
|
41
|
-
case multiple && typeof min === "number" && options.selected.length < min:
|
|
42
|
-
data = { amount: min };
|
|
43
|
-
error = "rangeUnderflow";
|
|
44
|
-
key = "min";
|
|
45
|
-
parameters = [min];
|
|
46
|
-
}
|
|
47
|
-
const localization = key == null ? void 0 : getLocalization(localizations.global, host, key, localizations.component);
|
|
48
|
-
const message = localization == null ? void 0 : localize(localization, data, parameters);
|
|
49
|
-
internals.setValidity(error == null ? {} : { [error]: true }, message);
|
|
50
|
-
internals.checkValidity();
|
|
51
|
-
}
|
|
52
|
-
//#endregion
|
|
53
|
-
export { updateListboxForm, updateListboxValidity };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { l as OuiListboxState } from "../../listbox.model-BHPA7GM4.mjs";
|
|
2
|
-
//#region src/js/internal/listbox/listbox.misc.d.ts
|
|
3
|
-
export declare function generateListboxIds(prefix: string, select: HTMLSelectElement): void;
|
|
4
|
-
export declare function getListboxVisibleOptions(state: OuiListboxState): HTMLElement[];
|
|
5
|
-
export declare function setListboxDisabled<State extends OuiListboxState>(state: State, value: boolean): void;
|
|
6
|
-
export declare function setListboxFilter<State extends OuiListboxState>(state: State, value: unknown): void;
|
|
7
|
-
export declare function setListboxLimit<State extends OuiListboxState>(type: "max" | "min", state: State, value?: unknown): void;
|
|
8
|
-
export declare function setListboxMultiple(element: HTMLElement, value: boolean): void;
|
|
9
|
-
export declare function setListboxReadonly<State extends OuiListboxState>(state: State, value: boolean): void;
|
|
10
|
-
export declare function setListboxRequired<State extends OuiListboxState>(state: State, value: boolean): void;
|
|
11
|
-
//#endregion
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { C as setListboxDisabled, D as setListboxReadonly, E as setListboxMultiple, O as setListboxRequired, S as getListboxVisibleOptions, T as setListboxLimit, w as setListboxFilter, x as generateListboxIds } from "../../listbox.data-DQ7-x2uY.mjs";
|
|
2
|
-
export { generateListboxIds, getListboxVisibleOptions, setListboxDisabled, setListboxFilter, setListboxLimit, setListboxMultiple, setListboxReadonly, setListboxRequired };
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { a as OuiListboxGroup, c as OuiListboxPreview, d as OuiListboxType, i as OuiListboxCallbacks, l as OuiListboxState, n as OuiListboxAutoComplete, o as OuiListboxLocalizations, r as OuiListboxAutoCompleteType, s as OuiListboxOptions, t as OuiListboxAttributes, u as OuiListboxStates } from "../../listbox.model-BHPA7GM4.mjs";
|
|
2
|
-
export { OuiListboxAttributes, OuiListboxAutoComplete, OuiListboxAutoCompleteType, OuiListboxCallbacks, OuiListboxGroup, OuiListboxLocalizations, OuiListboxOptions, OuiListboxPreview, OuiListboxState, OuiListboxStates, OuiListboxType };
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { l as OuiListboxState, u as OuiListboxStates } from "../../listbox.model-BHPA7GM4.mjs";
|
|
2
|
-
//#region src/js/internal/listbox/listbox.state.d.ts
|
|
3
|
-
export declare function attachListbox<State extends OuiListboxState>(state: State, states: OuiListboxStates<State>, onAttach: (state: State) => void): void;
|
|
4
|
-
export declare function detachListbox<State extends OuiListboxState>(state: State, states: OuiListboxStates<State>, onDetach: (state: State) => void): void;
|
|
5
|
-
export declare function initializeListboxState<State extends OuiListboxState>(state: State, states: OuiListboxStates<State>, onAttach: (state: State) => void): State;
|
|
6
|
-
//#endregion
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { updateListboxForm } from "./listbox.form.mjs";
|
|
2
|
-
import { C as setListboxDisabled, D as setListboxReadonly, E as setListboxMultiple, O as setListboxRequired, T as setListboxLimit, b as updateListboxValueLabel, i as filterListboxOptions, v as updateListboxMessage, y as updateListboxPreview } from "../../listbox.data-DQ7-x2uY.mjs";
|
|
3
|
-
import { getAttribute } from "@oscarpalmer/toretto/attribute";
|
|
4
|
-
//#region src/js/internal/listbox/listbox.state.ts
|
|
5
|
-
function attachListbox(state, states, onAttach) {
|
|
6
|
-
const { filter, host, id, label } = state;
|
|
7
|
-
label.element.htmlFor = filter.element.id;
|
|
8
|
-
label.element.id = `${id}_label`;
|
|
9
|
-
onAttach(state);
|
|
10
|
-
states.map.set(host, state);
|
|
11
|
-
states.set.add(state);
|
|
12
|
-
}
|
|
13
|
-
function detachListbox(state, states, onDetach) {
|
|
14
|
-
const { host, label, select } = state;
|
|
15
|
-
const listeners = state.listeners.splice(0);
|
|
16
|
-
const { length } = listeners;
|
|
17
|
-
for (let index = 0; index < length; index += 1) listeners[index]();
|
|
18
|
-
label.element.htmlFor = select.id;
|
|
19
|
-
label.element.id = label.id;
|
|
20
|
-
onDetach(state);
|
|
21
|
-
states.map.delete(host);
|
|
22
|
-
states.set.delete(state);
|
|
23
|
-
}
|
|
24
|
-
function initializeListboxState(state, states, onAttach) {
|
|
25
|
-
attachListbox(state, states, onAttach);
|
|
26
|
-
setListboxDisabled(state, state.disabled);
|
|
27
|
-
setListboxLimit("max", state, getAttribute(state.host, "max"));
|
|
28
|
-
setListboxLimit("min", state, getAttribute(state.host, "min"));
|
|
29
|
-
setListboxMultiple(state.host, state.multiple);
|
|
30
|
-
setListboxReadonly(state, state.readonly);
|
|
31
|
-
setListboxRequired(state, state.required);
|
|
32
|
-
filterListboxOptions(state);
|
|
33
|
-
updateListboxForm(state, state.values.current, false);
|
|
34
|
-
updateListboxMessage(state);
|
|
35
|
-
updateListboxValueLabel(state);
|
|
36
|
-
if (state.options.selected.length > 0) updateListboxPreview("none", state, state.options.selected[0], false);
|
|
37
|
-
return state;
|
|
38
|
-
}
|
|
39
|
-
//#endregion
|
|
40
|
-
export { attachListbox, detachListbox, initializeListboxState };
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { AriaRole, RemovableEventListener } from "@oscarpalmer/toretto/models";
|
|
2
|
-
//#region src/js/internal/navigable.d.ts
|
|
3
|
-
export declare class OuiNavigable {
|
|
4
|
-
active: OuiNavigableActive;
|
|
5
|
-
element: HTMLElement;
|
|
6
|
-
listeners: RemovableEventListener[];
|
|
7
|
-
options: OuiNavigableOptions;
|
|
8
|
-
orientation: OuiNavigableOrientation;
|
|
9
|
-
constructor(element: HTMLElement, options: OuiNavigableOptions);
|
|
10
|
-
destroy(): void;
|
|
11
|
-
navigate(index: number, focus?: boolean): void;
|
|
12
|
-
}
|
|
13
|
-
type OuiNavigableActive = {
|
|
14
|
-
element?: HTMLElement;
|
|
15
|
-
index: number;
|
|
16
|
-
};
|
|
17
|
-
type OuiNavigableCallback<ReturnType> = (event: KeyboardEvent, navigable: OuiNavigable) => ReturnType;
|
|
18
|
-
export type OuiNavigableOptions = {
|
|
19
|
-
orientation?: OuiNavigableOrientation;
|
|
20
|
-
role?: AriaRole;
|
|
21
|
-
selector: string;
|
|
22
|
-
vertical: boolean;
|
|
23
|
-
onActivate?: (navigable: OuiNavigable) => void;
|
|
24
|
-
onDeactivate?: OuiNavigableCallback<void>;
|
|
25
|
-
onNavigation?: (navigable: OuiNavigable) => void;
|
|
26
|
-
onPreventNavigation?: OuiNavigableCallback<boolean>;
|
|
27
|
-
onShouldActivate?: OuiNavigableCallback<boolean>;
|
|
28
|
-
onShouldDeactivate?: OuiNavigableCallback<boolean | undefined>;
|
|
29
|
-
};
|
|
30
|
-
export type OuiNavigableOrientation = "horizontal" | "vertical";
|
|
31
|
-
export declare function getNavigable(element: HTMLElement, options: OuiNavigableOptions): OuiNavigable;
|
|
32
|
-
export declare function getNavigableOrientation(element: HTMLElement, vertical: boolean, aria?: boolean): OuiNavigableOrientation;
|
|
33
|
-
export declare function updateNavigableFocus(navigable: OuiNavigable, focus: boolean, items?: HTMLElement[]): void;
|
|
34
|
-
export declare const NAVIGABLE_KEYS_HORIZONTAL: Set<string>;
|
|
35
|
-
export declare const NAVIGABLE_KEYS_VERTICAL: Set<string>;
|
|
36
|
-
//#endregion
|