@oscarpalmer/oui 0.40.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/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 -2
- package/dist/js/color-picker/color-picker.constants.mjs +5 -3
- package/dist/js/color-picker/color-picker.dom.d.mts +1 -1
- package/dist/js/color-picker/color-picker.dom.mjs +31 -14
- package/dist/js/color-picker/color-picker.event.d.mts +2 -2
- package/dist/js/color-picker/color-picker.event.mjs +232 -1
- package/dist/js/color-picker/color-picker.form.d.mts +1 -1
- package/dist/js/color-picker/color-picker.form.mjs +1 -3
- package/dist/js/color-picker/color-picker.misc.d.mts +2 -2
- package/dist/js/color-picker/color-picker.misc.mjs +104 -2
- package/dist/js/color-picker/color-picker.model.d.mts +2 -2
- package/dist/js/color-picker/color-picker.output.d.mts +1 -1
- package/dist/js/color-picker/color-picker.output.mjs +7 -8
- package/dist/js/color-picker/color-picker.state.d.mts +1 -1
- package/dist/js/color-picker/color-picker.state.mjs +167 -1
- package/dist/js/color-picker/index.d.mts +7 -15
- package/dist/js/color-picker/index.mjs +11 -6
- package/dist/js/{color-picker.constants-D1mxw_Le.d.mts → color-picker.constants-BZgXQr5o.d.mts} +6 -8
- package/dist/js/{color-picker.misc-CtsXGrOe.d.mts → color-picker.misc-BIS3R6jk.d.mts} +8 -4
- package/dist/js/combobox/combobox.constants.d.mts +1 -1
- package/dist/js/combobox/combobox.dom.d.mts +12 -13
- package/dist/js/combobox/combobox.dom.mjs +15 -17
- package/dist/js/combobox/combobox.event.d.mts +8 -8
- package/dist/js/combobox/combobox.event.mjs +1 -1
- package/dist/js/combobox/combobox.misc.d.mts +2 -2
- package/dist/js/combobox/combobox.misc.mjs +2 -2
- package/dist/js/combobox/combobox.model.d.mts +2 -2
- package/dist/js/combobox/combobox.state.d.mts +3 -4
- package/dist/js/combobox/combobox.state.mjs +1 -1
- package/dist/js/combobox/index.d.mts +8 -19
- package/dist/js/combobox/index.mjs +21 -23
- package/dist/js/{combobox.constants-DZVkMP5g.d.mts → combobox.constants-Hb3bqqQJ.d.mts} +3 -3
- package/dist/js/combobox.misc-DRDFk6X8.d.mts +26 -0
- package/dist/js/combobox.model-gjEI2VqZ.d.mts +46 -0
- package/dist/js/{combobox.state-BfJ3Hxg8.mjs → combobox.state-AstCICiH.mjs} +30 -41
- package/dist/js/dialog/dialog.model.d.mts +1 -1
- package/dist/js/dialog/index.d.mts +1 -1
- package/dist/js/{dialog.model-DX2mndMh.d.mts → dialog.model-HVzYWoDo.d.mts} +3 -3
- package/dist/js/floatable/floatable.embedded.d.mts +1 -1
- package/dist/js/floatable/floatable.embedded.mjs +2 -2
- package/dist/js/floatable/floatable.standalone.d.mts +1 -1
- package/dist/js/{floatable.embedded-MeTyXjFn.d.mts → floatable.embedded-ncshL3Sa.d.mts} +3 -3
- package/dist/js/focus-trap/focus-trap.embedded.d.mts +1 -1
- package/dist/js/focus-trap/focus-trap.embedded.mjs +10 -9
- package/dist/js/focus-trap/focus-trap.model.d.mts +1 -1
- package/dist/js/focus-trap/focus-trap.standalone.d.mts +2 -2
- package/dist/js/{focus-trap.embedded-DIU05m1z.d.mts → focus-trap.embedded-DpcPkP7c.d.mts} +3 -3
- package/dist/js/{focus-trap.model-BeX6UYlw.d.mts → focus-trap.model-CpltX5B5.d.mts} +1 -1
- package/dist/js/index.d.mts +16 -16
- package/dist/js/index.mjs +3 -3
- package/dist/js/internal/attributable.d.mts +1 -1
- package/dist/js/internal/draggable/draggable.model.d.mts +1 -1
- package/dist/js/internal/draggable/index.d.mts +8 -8
- package/dist/js/internal/draggable/index.mjs +27 -18
- 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/{l10n → internal/l10n}/l10n.model.mjs +5 -2
- package/dist/js/internal/misc.d.mts +2 -2
- package/dist/js/internal/navigable/index.d.mts +3 -3
- package/dist/js/internal/navigable/index.mjs +1 -1
- package/dist/js/internal/navigable/navigable.model.d.mts +1 -1
- 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/{listbox/listbox.event.mjs → option-list/option-list.event.mjs} +7 -7
- package/dist/js/internal/option-list/option-list.form.d.mts +7 -0
- package/dist/js/internal/{listbox/listbox.form.mjs → option-list/option-list.form.mjs} +10 -13
- 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 -9
- package/dist/js/l10n/index.mjs +2 -107
- package/dist/js/l10n.model-D1E1u35L.d.mts +54 -0
- package/dist/js/listbox/index.d.mts +6 -17
- package/dist/js/listbox/index.mjs +22 -23
- package/dist/js/listbox/{constants.listbox.d.mts → listbox.constants.d.mts} +1 -1
- package/dist/js/listbox/{constants.listbox.mjs → listbox.constants.mjs} +1 -1
- 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/{constants.listbox-C5Ap6Ag_.d.mts → listbox.constants-DOBMwKup.d.mts} +3 -3
- 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 +7 -3
- package/dist/js/menu/menu.model.d.mts +7 -7
- package/dist/js/movable/movable.embedded.d.mts +1 -1
- package/dist/js/movable/movable.embedded.mjs +21 -18
- package/dist/js/movable/movable.model.d.mts +1 -1
- package/dist/js/movable/movable.standalone.d.mts +2 -2
- package/dist/js/{movable.embedded-DoyXLegc.d.mts → movable.embedded-C1bDTLGs.d.mts} +2 -2
- package/dist/js/{movable.model-BHaK_mKw.d.mts → movable.model-D9nnPWKk.d.mts} +41 -41
- package/dist/js/{navigable.model-BPOM8DZk.d.mts → navigable.model-BqoR6iBv.d.mts} +1 -1
- package/dist/js/{listbox.data-BQyZGKgr.mjs → option-list.data-CgMyUwPc.mjs} +70 -71
- package/dist/js/option-list.model-CCPUlPeX.d.mts +169 -0
- package/dist/js/popover/index.d.mts +2 -2
- package/dist/js/popover/index.mjs +1 -1
- package/dist/js/popover/popover.model.d.mts +1 -1
- package/dist/js/{popover.model-ubKNG612.d.mts → popover.model-DiLdz0Hc.d.mts} +4 -4
- package/dist/js/resizable/resizable.embedded.d.mts +1 -1
- package/dist/js/resizable/resizable.model.d.mts +1 -1
- package/dist/js/resizable/resizable.standalone.d.mts +2 -2
- package/dist/js/{resizable.embedded-Bf1qBUdt.d.mts → resizable.embedded-BemH-7Re.d.mts} +2 -2
- package/dist/js/{resizable.model-BwzJcTVJ.d.mts → resizable.model-YEtcC9li.d.mts} +3 -3
- package/dist/js/sortable/sortable.embedded.d.mts +1 -1
- package/dist/js/sortable/sortable.embedded.mjs +46 -38
- package/dist/js/sortable/sortable.model.d.mts +1 -1
- package/dist/js/sortable/sortable.standalone.d.mts +2 -2
- package/dist/js/{sortable.embedded-DzBKAwSG.d.mts → sortable.embedded-CrEGff9k.d.mts} +2 -2
- package/dist/js/splitter/index.d.mts +1 -1
- package/dist/js/splitter/splitter.model.d.mts +1 -1
- package/dist/js/{splitter.model-DOLNjLVS.d.mts → splitter.model-C24W6eZ7.d.mts} +2 -2
- package/dist/js/tabs/index.d.mts +2 -2
- package/dist/js/tabs/index.mjs +1 -1
- package/dist/js/tabs/tabs.model.d.mts +1 -1
- package/dist/js/{tabs.model-DRBX_JtI.d.mts → tabs.model-BHPy7fPo.d.mts} +1 -1
- package/dist/js/toolbar/toolbar.model.d.mts +2 -2
- package/dist/js/tooltip/index.d.mts +2 -2
- package/dist/js/tooltip/tooltip.model.d.mts +1 -1
- package/dist/js/{tooltip.model-DRkY_BsL.d.mts → tooltip.model-BpNStw5z.d.mts} +3 -3
- package/package.json +1 -1
- package/dist/js/color-picker.event-Cksj5TvS.mjs +0 -500
- package/dist/js/combobox.misc-C1tPZZDi.d.mts +0 -22
- package/dist/js/combobox.model-oDV06XCN.d.mts +0 -44
- 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.form.d.mts +0 -5
- 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 -39
- package/dist/js/l10n/l10n.model.d.mts +0 -2
- package/dist/js/l10n.model-D6a9frgl.d.mts +0 -26
- package/dist/js/listbox/event.listbox.d.mts +0 -7
- package/dist/js/listbox/event.listbox.mjs +0 -48
- 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 -9
- package/dist/js/listbox/state.listbox.mjs +0 -2
- package/dist/js/listbox.model-CuBOj4qe.d.mts +0 -129
- package/dist/js/misc.listbox-CjfBUbHD.mjs +0 -154
- package/dist/js/misc.listbox-CtoGvXQo.d.mts +0 -20
- /package/dist/js/internal/{listbox/listbox.model.mjs → option-list/option-list.model.mjs} +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { createEmbeddedFloatable } from "./floatable/floatable.embedded.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { createDefaultLocalizations, createLocalizations } from "./internal/l10n/index.mjs";
|
|
3
3
|
import { getAttributeValue, getBooleanAriaValue } from "./internal/misc.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { OPTION_LIST_KEYS_ACTIVATION, OPTION_LIST_TYPES } from "./internal/option-list/option-list.constants.mjs";
|
|
5
|
+
import { i as filterOptionListOptions, n as filterOptionList, o as setOptionListValues, r as filterOptionListOption, s as toggleOptionListOption, t as applyOptionListSelection, x as generateOptionListIds, y as updateOptionListPreview } from "./option-list.data-CgMyUwPc.mjs";
|
|
6
|
+
import { initializeOptionListState } from "./internal/option-list/option-list.state.mjs";
|
|
7
7
|
import { COMBOBOX_ATTRIBUTE_SELECTION_ITEM, COMBOBOX_AUTOCOMPLETES, COMBOBOX_SYMBOL, COMBOBOX_TAGNAME, comboboxAttributes, comboboxMessages, comboboxSelectors } from "./combobox/combobox.constants.mjs";
|
|
8
|
-
import { createComboboxAnchor, createComboboxContent, updateComboboxAutocomplete, updateComboboxSelection,
|
|
9
|
-
import {
|
|
8
|
+
import { createComboboxAnchor, createComboboxContent, updateComboboxAutocomplete, updateComboboxSelection, updateComboboxTabindices } from "./combobox/combobox.dom.mjs";
|
|
9
|
+
import { processOptionListKeydown } from "./internal/option-list/option-list.event.mjs";
|
|
10
10
|
import { setAria } from "@oscarpalmer/toretto/aria";
|
|
11
11
|
import { setAttributes } from "@oscarpalmer/toretto/attribute";
|
|
12
12
|
import { on } from "@oscarpalmer/toretto/event";
|
|
@@ -35,16 +35,8 @@ function hasTextSelection(element) {
|
|
|
35
35
|
return element instanceof HTMLInputElement && element.selectionStart !== element.selectionEnd;
|
|
36
36
|
}
|
|
37
37
|
function setComboboxLocalizations(first, second) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
function updateComboboxLocalizations(instance, destination, first, second) {
|
|
41
|
-
updateLocalizations(instance, typeof first === "string" ? { [first]: second } : first, destination, () => {
|
|
42
|
-
for (const state of comboboxes) {
|
|
43
|
-
updateListboxMessage(state);
|
|
44
|
-
updateListboxValueLabel(state);
|
|
45
|
-
updateComboboxSelectionItems(state);
|
|
46
|
-
}
|
|
47
|
-
});
|
|
38
|
+
if (second === true) comboboxLocalizations.setDefaults(first);
|
|
39
|
+
else comboboxLocalizations.setLanguages(first, second);
|
|
48
40
|
}
|
|
49
41
|
let index = 0;
|
|
50
42
|
//#endregion
|
|
@@ -62,7 +54,7 @@ function onComboboxClickContent(event, state) {
|
|
|
62
54
|
const option = findAncestor(event, comboboxSelectors.option);
|
|
63
55
|
if (!(option instanceof HTMLElement)) filter.element.focus();
|
|
64
56
|
else if (readonly) onComboboxPreview("set", state, option);
|
|
65
|
-
else
|
|
57
|
+
else toggleOptionListOption(state, option);
|
|
66
58
|
}
|
|
67
59
|
function onComboboxClickDocument(event) {
|
|
68
60
|
const combobox = findAncestor(event, COMBOBOX_TAGNAME);
|
|
@@ -86,7 +78,7 @@ function onComboboxClickDocument(event) {
|
|
|
86
78
|
const option = options.selected.find((option) => option.id === getData(selection, "option", false));
|
|
87
79
|
if (disabled) state.component.anchor.element.focus();
|
|
88
80
|
else if (readonly) updateComboboxTabindices(state, option);
|
|
89
|
-
else
|
|
81
|
+
else toggleOptionListOption(state, option);
|
|
90
82
|
return;
|
|
91
83
|
}
|
|
92
84
|
if (findAncestor(event, comboboxSelectors.anchor) != null && !disabled) {
|
|
@@ -98,18 +90,18 @@ function onComboboxEnter(state) {
|
|
|
98
90
|
const { active, anchor, disabled, readonly } = state.component;
|
|
99
91
|
if (disabled || readonly) return;
|
|
100
92
|
if (hasTextSelection(anchor.element)) onComboboxSelection(state, true);
|
|
101
|
-
else
|
|
93
|
+
else toggleOptionListOption(state, active);
|
|
102
94
|
}
|
|
103
95
|
function onComboboxEscape(state) {
|
|
104
96
|
state.component.floatable.hide();
|
|
105
97
|
}
|
|
106
98
|
function onComboboxFilter(preview, state, update, active, emit) {
|
|
107
|
-
if (state.component.autocomplete.none)
|
|
99
|
+
if (state.component.autocomplete.none) applyOptionListSelection({
|
|
108
100
|
state,
|
|
109
101
|
added: false,
|
|
110
102
|
emit: (emit ?? true) && update
|
|
111
103
|
});
|
|
112
|
-
else
|
|
104
|
+
else updateOptionListPreview(preview, state, active);
|
|
113
105
|
}
|
|
114
106
|
function onComboboxFocusout(event) {
|
|
115
107
|
setTimeout(() => {
|
|
@@ -117,8 +109,8 @@ function onComboboxFocusout(event) {
|
|
|
117
109
|
const state = combobox?.[COMBOBOX_SYMBOL];
|
|
118
110
|
const component = state?.component;
|
|
119
111
|
if (combobox == null || state == null || component == null || component.disabled || component.readonly || component.type === "select" || component.host === document.activeElement || component.host.contains(document.activeElement)) return;
|
|
120
|
-
const option =
|
|
121
|
-
|
|
112
|
+
const option = filterOptionListOption(state, component.filter.element.value, true);
|
|
113
|
+
applyOptionListSelection({
|
|
122
114
|
option,
|
|
123
115
|
state,
|
|
124
116
|
added: false,
|
|
@@ -129,7 +121,7 @@ function onComboboxFocusout(event) {
|
|
|
129
121
|
function onComboboxInput(event) {
|
|
130
122
|
const combobox = findAncestor(event, COMBOBOX_TAGNAME);
|
|
131
123
|
const state = combobox?.[COMBOBOX_SYMBOL];
|
|
132
|
-
if (combobox != null && state != null && event.target === state.component.filter.element)
|
|
124
|
+
if (combobox != null && state != null && event.target === state.component.filter.element) filterOptionList(event.inputType, state);
|
|
133
125
|
}
|
|
134
126
|
function onComboboxKeydown(event) {
|
|
135
127
|
const combobox = findAncestor(event, COMBOBOX_TAGNAME);
|
|
@@ -137,10 +129,10 @@ function onComboboxKeydown(event) {
|
|
|
137
129
|
if (combobox == null || state == null) return;
|
|
138
130
|
const item = findAncestor(event, comboboxSelectors.selectionItem);
|
|
139
131
|
if (item instanceof HTMLElement) onComboboxKeydownSelection(event, state, item);
|
|
140
|
-
else
|
|
132
|
+
else processOptionListKeydown(event, state);
|
|
141
133
|
}
|
|
142
134
|
function onComboboxKeydownSelection(event, state, item) {
|
|
143
|
-
if (
|
|
135
|
+
if (OPTION_LIST_KEYS_ACTIVATION.has(event.key)) {
|
|
144
136
|
event.preventDefault();
|
|
145
137
|
onComboboxRemoveSelection(state, item);
|
|
146
138
|
return;
|
|
@@ -180,16 +172,16 @@ function onComboboxRemoveSelection(state, item) {
|
|
|
180
172
|
const { disabled, options, readonly } = state.component;
|
|
181
173
|
if (disabled || readonly) return;
|
|
182
174
|
const option = options.selected.find((option) => option.id === getData(item, "option", false));
|
|
183
|
-
if (option != null)
|
|
175
|
+
if (option != null) toggleOptionListOption(state, option);
|
|
184
176
|
}
|
|
185
177
|
function onComboboxNavigation(preview, state, active) {
|
|
186
|
-
|
|
178
|
+
updateOptionListPreview(preview, state, active);
|
|
187
179
|
}
|
|
188
180
|
function onComboboxSelection(state, hasSelection) {
|
|
189
181
|
const { active, anchor, filter } = state.component;
|
|
190
182
|
if (!(hasSelection ?? hasTextSelection(anchor.element))) return;
|
|
191
183
|
filter.value = anchor.element === filter.element ? filter.element.value : "";
|
|
192
|
-
|
|
184
|
+
toggleOptionListOption(state, filterOptionListOptions(state) ?? active);
|
|
193
185
|
}
|
|
194
186
|
function onComboboxTab(state) {
|
|
195
187
|
setTimeout(() => {
|
|
@@ -217,16 +209,16 @@ on(document, "keydown", onComboboxKeydown, { passive: false });
|
|
|
217
209
|
//#region src/js/combobox/combobox.state.ts
|
|
218
210
|
function createComponentState(element, state) {
|
|
219
211
|
const select = element.querySelector("select");
|
|
220
|
-
if (select
|
|
212
|
+
if (!(select instanceof HTMLSelectElement) || select.id === "") throw new Error(comboboxMessages.select);
|
|
221
213
|
const label = element.querySelector(`label[for="${select.id}"]`);
|
|
222
|
-
if (label
|
|
214
|
+
if (!(label instanceof HTMLLabelElement)) throw new Error(comboboxMessages.label);
|
|
223
215
|
element.id = select.id;
|
|
224
216
|
const disabled = getBooleanAriaValue(element, "disabled") || select.disabled;
|
|
225
217
|
const multiple = element.multiple || select.multiple;
|
|
226
218
|
const readonly = getBooleanAriaValue(element, "readonly");
|
|
227
219
|
const required = getBooleanAriaValue(element, "required") || select.required;
|
|
228
220
|
const id = getComboboxId();
|
|
229
|
-
const type = multiple ? "select" : getAttributeValue(element, "type",
|
|
221
|
+
const type = multiple ? "select" : getAttributeValue(element, "type", OPTION_LIST_TYPES, "select");
|
|
230
222
|
const autocomplete = getComboboxAutoComplete(element, type === "select");
|
|
231
223
|
setAttributes(element, {
|
|
232
224
|
autocomplete: autocomplete.value,
|
|
@@ -235,7 +227,7 @@ function createComponentState(element, state) {
|
|
|
235
227
|
const labelId = label.id;
|
|
236
228
|
label.htmlFor = id;
|
|
237
229
|
label.id = `${id}_label`;
|
|
238
|
-
|
|
230
|
+
generateOptionListIds(id, select);
|
|
239
231
|
const parameters = {
|
|
240
232
|
autocomplete,
|
|
241
233
|
element,
|
|
@@ -287,10 +279,7 @@ function createComponentState(element, state) {
|
|
|
287
279
|
list: content.list.element,
|
|
288
280
|
listbox: false,
|
|
289
281
|
listeners: [],
|
|
290
|
-
localizations:
|
|
291
|
-
component: {},
|
|
292
|
-
global: comboboxLocalizations
|
|
293
|
-
},
|
|
282
|
+
localizations: createLocalizations(comboboxLocalizations),
|
|
294
283
|
message: content.message,
|
|
295
284
|
name: element.name,
|
|
296
285
|
options: {
|
|
@@ -304,13 +293,13 @@ function createComponentState(element, state) {
|
|
|
304
293
|
label: content.value
|
|
305
294
|
}
|
|
306
295
|
};
|
|
307
|
-
return
|
|
296
|
+
return initializeOptionListState(state, comboboxes, onAttachCombobox);
|
|
308
297
|
}
|
|
309
298
|
function initializeCombobox(element, state) {
|
|
310
299
|
element.tabIndex = -1;
|
|
311
300
|
createComponentState(element, state);
|
|
312
301
|
if (state.form.restored != null) {
|
|
313
|
-
|
|
302
|
+
setOptionListValues(state, state.form.restored);
|
|
314
303
|
state.form.restored = void 0;
|
|
315
304
|
}
|
|
316
305
|
}
|
|
@@ -364,7 +353,7 @@ const comboboxCallbacks = {
|
|
|
364
353
|
skipNavigation: skipComboboxNavigation
|
|
365
354
|
}
|
|
366
355
|
};
|
|
367
|
-
const comboboxLocalizations =
|
|
356
|
+
const comboboxLocalizations = createDefaultLocalizations({
|
|
368
357
|
empty: "No results found",
|
|
369
358
|
input: "Please enter a value",
|
|
370
359
|
invalid: "Please select an option from the list",
|
|
@@ -376,4 +365,4 @@ const comboboxLocalizations = createLocalizations({
|
|
|
376
365
|
});
|
|
377
366
|
const comboboxes = /* @__PURE__ */ new Set();
|
|
378
367
|
//#endregion
|
|
379
|
-
export { skipComboboxNavigation as C, setComboboxLocalizations as D, hasTextSelection as E,
|
|
368
|
+
export { skipComboboxNavigation as C, setComboboxLocalizations as D, hasTextSelection as E, preventComboboxActivation as S, getComboboxId as T, onComboboxPreview as _, onDetachCombobox as a, onComboboxTab as b, onComboboxClickContent as c, onComboboxFilter as d, onComboboxFocusout as f, onComboboxNavigation as g, onComboboxKeydownSelection as h, onAttachCombobox as i, onComboboxEnter as l, onComboboxKeydown as m, comboboxes as n, onComboboxActivation as o, onComboboxInput as p, initializeCombobox as r, onComboboxApply as s, comboboxLocalizations as t, onComboboxEscape as u, onComboboxRemoveSelection as v, getComboboxAutoComplete as w, onComboboxToggle as x, onComboboxSelection as y };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as DIALOG_SELECTOR_MOVER, c as OuiDialog, i as DIALOG_MESSAGE, l as OuiDialogState, n as DIALOG_ATTRIBUTE_CONTAINER, o as DIALOG_SELECTOR_RESIZER, r as DIALOG_ATTRIBUTE_OPEN, s as DIALOG_SYMBOL, t as DIALOG_ATTRIBUTE, u as dialogs } from "../dialog.model-
|
|
1
|
+
import { a as DIALOG_SELECTOR_MOVER, c as OuiDialog, i as DIALOG_MESSAGE, l as OuiDialogState, n as DIALOG_ATTRIBUTE_CONTAINER, o as DIALOG_SELECTOR_RESIZER, r as DIALOG_ATTRIBUTE_OPEN, s as DIALOG_SYMBOL, t as DIALOG_ATTRIBUTE, u as dialogs } from "../dialog.model-HVzYWoDo.mjs";
|
|
2
2
|
export { DIALOG_ATTRIBUTE, DIALOG_ATTRIBUTE_CONTAINER, DIALOG_ATTRIBUTE_OPEN, DIALOG_MESSAGE, DIALOG_SELECTOR_MOVER, DIALOG_SELECTOR_RESIZER, DIALOG_SYMBOL, OuiDialog, OuiDialogState, dialogs };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as OuiDialog, l as OuiDialogState } from "../dialog.model-
|
|
1
|
+
import { c as OuiDialog, l as OuiDialogState } from "../dialog.model-HVzYWoDo.mjs";
|
|
2
2
|
//#region src/js/dialog/index.d.ts
|
|
3
3
|
declare function OuiDialog(this: OuiDialog, state: OuiDialogState): void;
|
|
4
4
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { u as OuiMovable } from "./movable.model-
|
|
2
|
-
import { n as OuiResizable } from "./resizable.model-
|
|
1
|
+
import { u as OuiMovable } from "./movable.model-D9nnPWKk.mjs";
|
|
2
|
+
import { n as OuiResizable } from "./resizable.model-YEtcC9li.mjs";
|
|
3
3
|
import { RemovableEventListener } from "@oscarpalmer/toretto/models";
|
|
4
4
|
//#region src/js/dialog/dialog.model.d.ts
|
|
5
5
|
type OuiDialog = {
|
|
@@ -40,6 +40,6 @@ declare const DIALOG_MESSAGE = "The element must be an instance of HTMLDialogEle
|
|
|
40
40
|
declare const DIALOG_SELECTOR_MOVER: string;
|
|
41
41
|
declare const DIALOG_SELECTOR_RESIZER: string;
|
|
42
42
|
declare const DIALOG_SYMBOL: unique symbol;
|
|
43
|
-
declare const dialogs: WeakMap<
|
|
43
|
+
declare const dialogs: WeakMap<Element, OuiDialogState>;
|
|
44
44
|
//#endregion
|
|
45
45
|
export { DIALOG_SELECTOR_MOVER as a, OuiDialog as c, DIALOG_MESSAGE as i, OuiDialogState as l, DIALOG_ATTRIBUTE_CONTAINER as n, DIALOG_SELECTOR_RESIZER as o, DIALOG_ATTRIBUTE_OPEN as r, DIALOG_SYMBOL as s, DIALOG_ATTRIBUTE as t, dialogs as u };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as removeFloatable, n as createFloatable, r as getOnBeforeToggleListener, t as createEmbeddedFloatable } from "../floatable.embedded-
|
|
1
|
+
import { i as removeFloatable, n as createFloatable, r as getOnBeforeToggleListener, t as createEmbeddedFloatable } from "../floatable.embedded-ncshL3Sa.mjs";
|
|
2
2
|
export { createEmbeddedFloatable, createFloatable, getOnBeforeToggleListener, removeFloatable };
|
|
@@ -60,8 +60,8 @@ function destroyFloatable() {
|
|
|
60
60
|
if (state.destroyed) return;
|
|
61
61
|
state.destroyed = true;
|
|
62
62
|
removeFloatable(state.content);
|
|
63
|
-
state.anchor =
|
|
64
|
-
state.content =
|
|
63
|
+
state.anchor = void 0;
|
|
64
|
+
state.content = void 0;
|
|
65
65
|
}
|
|
66
66
|
function getOnBeforeToggleListener(element) {
|
|
67
67
|
return on(element, "beforetoggle", (event) => {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { c as OuiFloatable, t as CreateOuiFloatableOptions, u as OuiFloatablePosition } from "../floatable.model-DXsQgoU7.mjs";
|
|
2
|
-
import { n as createFloatable } from "../floatable.embedded-
|
|
2
|
+
import { n as createFloatable } from "../floatable.embedded-ncshL3Sa.mjs";
|
|
3
3
|
export { type CreateOuiFloatableOptions, type OuiFloatable, type OuiFloatablePosition, createFloatable };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { c as OuiFloatable, l as OuiFloatableOptions, t as CreateOuiFloatableOptions } from "./floatable.model-DXsQgoU7.mjs";
|
|
2
2
|
import { RemovableEventListener } from "@oscarpalmer/toretto/models";
|
|
3
3
|
//#region src/js/floatable/floatable.embedded.d.ts
|
|
4
|
-
declare function createEmbeddedFloatable(anchor:
|
|
4
|
+
declare function createEmbeddedFloatable(anchor: Element, content: Element, options: OuiFloatableOptions): OuiFloatable;
|
|
5
5
|
/**
|
|
6
6
|
* Create a _OuiFloatable_ for an anchor and content element
|
|
7
7
|
*
|
|
@@ -10,8 +10,8 @@ declare function createEmbeddedFloatable(anchor: HTMLElement, content: HTMLEleme
|
|
|
10
10
|
* @param options _OuiFloatable_ options
|
|
11
11
|
* @returns _OuiFloatable_ instance
|
|
12
12
|
*/
|
|
13
|
-
declare function createFloatable(anchor:
|
|
14
|
-
declare function getOnBeforeToggleListener(element:
|
|
13
|
+
declare function createFloatable(anchor: Element, content: Element, options?: CreateOuiFloatableOptions): OuiFloatable;
|
|
14
|
+
declare function getOnBeforeToggleListener(element: Element): RemovableEventListener;
|
|
15
15
|
declare function removeFloatable(content: HTMLElement): void;
|
|
16
16
|
//#endregion
|
|
17
17
|
export { removeFloatable as i, createFloatable as n, getOnBeforeToggleListener as r, createEmbeddedFloatable as t };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as removeFocusTrap, t as createFocusTrap } from "../focus-trap.embedded-
|
|
1
|
+
import { n as removeFocusTrap, t as createFocusTrap } from "../focus-trap.embedded-DpcPkP7c.mjs";
|
|
2
2
|
export { createFocusTrap, removeFocusTrap };
|
|
@@ -103,12 +103,12 @@ function getState(element, options) {
|
|
|
103
103
|
}
|
|
104
104
|
function onEscape(event) {
|
|
105
105
|
let element = findAncestor(event, FOCUSTRAP_SELECTOR);
|
|
106
|
-
let instance = focusTraps.get(element);
|
|
106
|
+
let instance = element == null ? void 0 : focusTraps.get(element);
|
|
107
107
|
let state = instance?.[FOCUSTRAP_SYMBOL];
|
|
108
108
|
if (element == null || instance == null || state == null) return;
|
|
109
109
|
while (state.disabled) {
|
|
110
|
-
element = findAncestor(state.element.parentElement, FOCUSTRAP_SELECTOR);
|
|
111
|
-
instance = focusTraps.get(element);
|
|
110
|
+
element = state.element.parentElement == null ? void 0 : findAncestor(state.element.parentElement, FOCUSTRAP_SELECTOR);
|
|
111
|
+
instance = element == null ? void 0 : focusTraps.get(element);
|
|
112
112
|
state = instance?.[FOCUSTRAP_SYMBOL];
|
|
113
113
|
if (element == null || instance == null || state == null) return;
|
|
114
114
|
if (!state.disabled) break;
|
|
@@ -116,7 +116,8 @@ function onEscape(event) {
|
|
|
116
116
|
instance?.disable();
|
|
117
117
|
}
|
|
118
118
|
function onFocusIn(event) {
|
|
119
|
-
|
|
119
|
+
const target = findAncestor(event, FOCUSTRAP_SELECTOR);
|
|
120
|
+
lastTarget = (target == null ? void 0 : focusTraps.get(target)) != null && event.target instanceof HTMLElement ? event.target : void 0;
|
|
120
121
|
}
|
|
121
122
|
function onKeydown(event) {
|
|
122
123
|
switch (event.key) {
|
|
@@ -130,12 +131,12 @@ function onKeydown(event) {
|
|
|
130
131
|
}
|
|
131
132
|
}
|
|
132
133
|
function onPointerdown(event) {
|
|
133
|
-
const last = findAncestor(lastTarget, FOCUSTRAP_SELECTOR);
|
|
134
|
+
const last = lastTarget == null ? void 0 : findAncestor(lastTarget, FOCUSTRAP_SELECTOR);
|
|
134
135
|
const next = findAncestor(event, FOCUSTRAP_SELECTOR);
|
|
135
136
|
if (last != null && next !== last) {
|
|
136
137
|
if (focusTraps.get(last)?.[FOCUSTRAP_SYMBOL]?.options.contain ?? false) {
|
|
137
138
|
event.preventDefault();
|
|
138
|
-
lastTarget?.focus();
|
|
139
|
+
lastTarget?.focus?.();
|
|
139
140
|
}
|
|
140
141
|
}
|
|
141
142
|
if (disabledFocusTraps.size === 0) return;
|
|
@@ -146,8 +147,8 @@ function onPointerdown(event) {
|
|
|
146
147
|
}
|
|
147
148
|
function onTab(event) {
|
|
148
149
|
const element = findAncestor(event, FOCUSTRAP_SELECTOR);
|
|
149
|
-
const instance = focusTraps.get(element);
|
|
150
|
-
if (instance == null || dispatch(element, "oui:focus-trap").defaultPrevented) return;
|
|
150
|
+
const instance = element == null ? void 0 : focusTraps.get(element);
|
|
151
|
+
if (!(element instanceof HTMLElement) || instance == null || dispatch(element, "oui:focus-trap").defaultPrevented) return;
|
|
151
152
|
if (!instance.disabled) event.preventDefault();
|
|
152
153
|
const elements = getFocusable(element);
|
|
153
154
|
const index = elements.indexOf(event.target);
|
|
@@ -201,7 +202,7 @@ function tabToTrap(instance, elements, element, index) {
|
|
|
201
202
|
instance.enable();
|
|
202
203
|
} else {
|
|
203
204
|
const next = elements.length === 0 ? element : elements.at(index ?? 0);
|
|
204
|
-
next
|
|
205
|
+
next?.focus?.();
|
|
205
206
|
lastTarget = next;
|
|
206
207
|
}
|
|
207
208
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as FOCUSTRAP_MESSAGE, c as OuiFocusTrap, d as disabledFocusTraps, f as focusTraps, i as FOCUSTRAP_EVENT_OPTIONS, l as OuiFocusTrapOptions, n as FOCUSTRAP_ATTRIBUTE_CONTAIN, o as FOCUSTRAP_SELECTOR, r as FOCUSTRAP_ATTRIBUTE_NOESCAPE, s as FOCUSTRAP_SYMBOL, t as FOCUSTRAP_ATTRIBUTE, u as OuiFocusTrapState } from "../focus-trap.model-
|
|
1
|
+
import { a as FOCUSTRAP_MESSAGE, c as OuiFocusTrap, d as disabledFocusTraps, f as focusTraps, i as FOCUSTRAP_EVENT_OPTIONS, l as OuiFocusTrapOptions, n as FOCUSTRAP_ATTRIBUTE_CONTAIN, o as FOCUSTRAP_SELECTOR, r as FOCUSTRAP_ATTRIBUTE_NOESCAPE, s as FOCUSTRAP_SYMBOL, t as FOCUSTRAP_ATTRIBUTE, u as OuiFocusTrapState } from "../focus-trap.model-CpltX5B5.mjs";
|
|
2
2
|
export { FOCUSTRAP_ATTRIBUTE, FOCUSTRAP_ATTRIBUTE_CONTAIN, FOCUSTRAP_ATTRIBUTE_NOESCAPE, FOCUSTRAP_EVENT_OPTIONS, FOCUSTRAP_MESSAGE, FOCUSTRAP_SELECTOR, FOCUSTRAP_SYMBOL, OuiFocusTrap, OuiFocusTrapOptions, OuiFocusTrapState, disabledFocusTraps, focusTraps };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { c as OuiFocusTrap, l as OuiFocusTrapOptions } from "../focus-trap.model-
|
|
2
|
-
import { t as createFocusTrap } from "../focus-trap.embedded-
|
|
1
|
+
import { c as OuiFocusTrap, l as OuiFocusTrapOptions } from "../focus-trap.model-CpltX5B5.mjs";
|
|
2
|
+
import { t as createFocusTrap } from "../focus-trap.embedded-DpcPkP7c.mjs";
|
|
3
3
|
export { type OuiFocusTrap, type OuiFocusTrapOptions, createFocusTrap };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as OuiFocusTrap, l as OuiFocusTrapOptions } from "./focus-trap.model-
|
|
1
|
+
import { c as OuiFocusTrap, l as OuiFocusTrapOptions } from "./focus-trap.model-CpltX5B5.mjs";
|
|
2
2
|
//#region src/js/focus-trap/focus-trap.embedded.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* Creates _(or retrieves)_ a _focus trap_ for an element
|
|
@@ -7,7 +7,7 @@ import { c as OuiFocusTrap, l as OuiFocusTrapOptions } from "./focus-trap.model-
|
|
|
7
7
|
* @param options _Focus trap_ options
|
|
8
8
|
* @returns _Focus trap_ instance
|
|
9
9
|
*/
|
|
10
|
-
declare function createFocusTrap(element:
|
|
11
|
-
declare function removeFocusTrap(element:
|
|
10
|
+
declare function createFocusTrap(element: Element, options?: OuiFocusTrapOptions): OuiFocusTrap;
|
|
11
|
+
declare function removeFocusTrap(element: Element): void;
|
|
12
12
|
//#endregion
|
|
13
13
|
export { removeFocusTrap as n, createFocusTrap as t };
|
|
@@ -69,6 +69,6 @@ declare const FOCUSTRAP_MESSAGE = "Element must be an HTMLElement or SVGElement"
|
|
|
69
69
|
declare const FOCUSTRAP_SELECTOR: string;
|
|
70
70
|
declare const FOCUSTRAP_SYMBOL: unique symbol;
|
|
71
71
|
declare const disabledFocusTraps: Set<OuiFocusTrap>;
|
|
72
|
-
declare const focusTraps: WeakMap<
|
|
72
|
+
declare const focusTraps: WeakMap<Element, OuiFocusTrap>;
|
|
73
73
|
//#endregion
|
|
74
74
|
export { FOCUSTRAP_MESSAGE as a, OuiFocusTrap as c, disabledFocusTraps as d, focusTraps as f, FOCUSTRAP_EVENT_OPTIONS as i, OuiFocusTrapOptions as l, FOCUSTRAP_ATTRIBUTE_CONTAIN as n, FOCUSTRAP_SELECTOR as o, FOCUSTRAP_ATTRIBUTE_NOESCAPE as r, FOCUSTRAP_SYMBOL as s, FOCUSTRAP_ATTRIBUTE as t, OuiFocusTrapState as u };
|
package/dist/js/index.d.mts
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
import { c as OuiFloatable, t as CreateOuiFloatableOptions, u as OuiFloatablePosition } from "./floatable.model-DXsQgoU7.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import { a as setColorPickerLocalizations } from "./color-picker.misc-
|
|
2
|
+
import { N as OuiColorPickerEvent } from "./color-picker.constants-BZgXQr5o.mjs";
|
|
3
|
+
import { a as setColorPickerLocalizations } from "./color-picker.misc-BIS3R6jk.mjs";
|
|
4
4
|
import { OuiColorPickerElement } from "./color-picker/index.mjs";
|
|
5
|
-
import { i as setComboboxLocalizations } from "./combobox.misc-
|
|
5
|
+
import { i as setComboboxLocalizations } from "./combobox.misc-DRDFk6X8.mjs";
|
|
6
6
|
import { OuiComboboxElement } from "./combobox/index.mjs";
|
|
7
|
-
import { $ as OuiSortable, p as CreateOuiDraggableOptions, u as OuiMovable } from "./movable.model-
|
|
8
|
-
import { n as OuiResizable, t as CreateOuiResizableOptions } from "./resizable.model-
|
|
9
|
-
import { c as OuiDialog } from "./dialog.model-
|
|
7
|
+
import { $ as OuiSortable, p as CreateOuiDraggableOptions, u as OuiMovable } from "./movable.model-D9nnPWKk.mjs";
|
|
8
|
+
import { n as OuiResizable, t as CreateOuiResizableOptions } from "./resizable.model-YEtcC9li.mjs";
|
|
9
|
+
import { c as OuiDialog } from "./dialog.model-HVzYWoDo.mjs";
|
|
10
10
|
import { getDialog } from "./dialog/index.mjs";
|
|
11
|
-
import { n as createFloatable } from "./floatable.embedded-
|
|
11
|
+
import { n as createFloatable } from "./floatable.embedded-ncshL3Sa.mjs";
|
|
12
12
|
import "./floatable/floatable.standalone.mjs";
|
|
13
|
-
import { c as OuiFocusTrap, l as OuiFocusTrapOptions } from "./focus-trap.model-
|
|
14
|
-
import { t as createFocusTrap } from "./focus-trap.embedded-
|
|
15
|
-
import { t as createMovable } from "./movable.embedded-
|
|
13
|
+
import { c as OuiFocusTrap, l as OuiFocusTrapOptions } from "./focus-trap.model-CpltX5B5.mjs";
|
|
14
|
+
import { t as createFocusTrap } from "./focus-trap.embedded-DpcPkP7c.mjs";
|
|
15
|
+
import { t as createMovable } from "./movable.embedded-C1bDTLGs.mjs";
|
|
16
16
|
import "./movable/movable.standalone.mjs";
|
|
17
|
-
import { t as createResizable } from "./resizable.embedded-
|
|
17
|
+
import { t as createResizable } from "./resizable.embedded-BemH-7Re.mjs";
|
|
18
18
|
import "./resizable/resizable.standalone.mjs";
|
|
19
|
-
import { t as createSortable } from "./sortable.embedded-
|
|
19
|
+
import { t as createSortable } from "./sortable.embedded-CrEGff9k.mjs";
|
|
20
20
|
import "./sortable/sortable.standalone.mjs";
|
|
21
|
-
import { n as setListboxLocalizations } from "./misc
|
|
21
|
+
import { n as setListboxLocalizations } from "./listbox.misc-DwfB4Mu_.mjs";
|
|
22
22
|
import { OuiListboxElement } from "./listbox/index.mjs";
|
|
23
|
-
import { t as OuiPopover } from "./popover.model-
|
|
23
|
+
import { t as OuiPopover } from "./popover.model-DiLdz0Hc.mjs";
|
|
24
24
|
import { getPopover } from "./popover/index.mjs";
|
|
25
25
|
import { OuiSplitterElement } from "./splitter/index.mjs";
|
|
26
|
-
import { r as OuiTabsEvent } from "./tabs.model-
|
|
26
|
+
import { r as OuiTabsEvent } from "./tabs.model-BHPy7fPo.mjs";
|
|
27
27
|
import { OuiTabsElement } from "./tabs/index.mjs";
|
|
28
|
-
import { t as OuiTooltip } from "./tooltip.model-
|
|
28
|
+
import { t as OuiTooltip } from "./tooltip.model-BpNStw5z.mjs";
|
|
29
29
|
import { getTooltip, setTooltipDelay } from "./tooltip/index.mjs";
|
|
30
30
|
export { type CreateOuiFloatableOptions, type CreateOuiDraggableOptions as CreateOuiMovableOptions, type CreateOuiDraggableOptions as CreateOuiSortableOptions, type CreateOuiResizableOptions, OuiColorPickerElement, OuiColorPickerEvent, OuiComboboxElement, type OuiDialog, type OuiFloatable, type OuiFloatablePosition, type OuiFocusTrap, type OuiFocusTrapOptions, OuiListboxElement, type OuiMovable, type OuiPopover, type OuiResizable, type OuiSortable, OuiSplitterElement, OuiTabsElement, OuiTabsEvent, type OuiTooltip, createFloatable, createFocusTrap, createMovable, createResizable as createOuiResizable, createSortable, getDialog, getPopover, getTooltip, setColorPickerLocalizations, setComboboxLocalizations, setListboxLocalizations, setTooltipDelay };
|
package/dist/js/index.mjs
CHANGED
|
@@ -11,12 +11,12 @@ import "./resizable/resizable.standalone.mjs";
|
|
|
11
11
|
import { createSortable } from "./sortable/sortable.embedded.mjs";
|
|
12
12
|
import "./sortable/sortable.standalone.mjs";
|
|
13
13
|
import { OuiColorPickerEvent } from "./color-picker/color-picker.model.mjs";
|
|
14
|
-
import {
|
|
14
|
+
import { setColorPickerLocalizations } from "./color-picker/color-picker.misc.mjs";
|
|
15
15
|
import { OuiColorPickerElement } from "./color-picker/index.mjs";
|
|
16
|
-
import { D as setComboboxLocalizations } from "./combobox.state-
|
|
16
|
+
import { D as setComboboxLocalizations } from "./combobox.state-AstCICiH.mjs";
|
|
17
17
|
import { OuiComboboxElement } from "./combobox/index.mjs";
|
|
18
18
|
import { getDialog } from "./dialog/index.mjs";
|
|
19
|
-
import {
|
|
19
|
+
import { s as setListboxLocalizations } from "./listbox.state-BrN296BM.mjs";
|
|
20
20
|
import { OuiListboxElement } from "./listbox/index.mjs";
|
|
21
21
|
import { getPopover } from "./popover/index.mjs";
|
|
22
22
|
import { OuiSplitterElement } from "./splitter/index.mjs";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
//#region src/js/internal/attributable.d.ts
|
|
2
|
-
export declare function attributable(attribute: string, add: (element:
|
|
2
|
+
export declare function attributable(attribute: string, add: (element: Element) => void, remove: (element: Element) => void): void;
|
|
3
3
|
//#endregion
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as OuiDraggableGlobals, B as OuiDraggableOptionsDrag, C as OuiDragCancel, D as OuiDraggable, E as OuiDragMovePosition, F as OuiDraggableOptionsContainer, G as OuiDraggableStates, H as OuiDraggableOptionsPositionGetOffset, I as OuiDraggableOptionsContainerOnDestroy, J as draggableHorizontals, K as draggableContainers, L as OuiDraggableOptionsContainerOnInitialize, M as OuiDraggableInstances, N as OuiDraggableItem, O as OuiDraggableBound, P as OuiDraggableOptions, Q as draggableVerticals, R as OuiDraggableOptionsDirection, S as OuiDragBegin, T as OuiDragMove, U as OuiDraggableOptionsPositionGetOriginal, V as OuiDraggableOptionsPosition, W as OuiDraggableState, X as draggableStyleToggler, Y as draggableProperties, Z as draggableStyles, _ as DRAGGABLE_SELECTOR, b as DRAGGABLE_SELECTOR_SORTABLE_ITEM, g as DRAGGABLE_KEY_ESCAPE, h as DRAGGABLE_ATTRIBUTE_SORTABLE, j as OuiDraggableGlobalsElement, k as OuiDraggableDirection, m as DRAGGABLE_ATTRIBUTE_MOVABLE, p as CreateOuiDraggableOptions, q as draggableGlobals, v as DRAGGABLE_SELECTOR_MOVABLE_HANDLE, w as OuiDragEnd, x as DRAGGABLE_SYMBOL, y as DRAGGABLE_SELECTOR_SORTABLE_HANDLE, z as OuiDraggableOptionsDirectionOnAfter } from "../../movable.model-
|
|
1
|
+
import { A as OuiDraggableGlobals, B as OuiDraggableOptionsDrag, C as OuiDragCancel, D as OuiDraggable, E as OuiDragMovePosition, F as OuiDraggableOptionsContainer, G as OuiDraggableStates, H as OuiDraggableOptionsPositionGetOffset, I as OuiDraggableOptionsContainerOnDestroy, J as draggableHorizontals, K as draggableContainers, L as OuiDraggableOptionsContainerOnInitialize, M as OuiDraggableInstances, N as OuiDraggableItem, O as OuiDraggableBound, P as OuiDraggableOptions, Q as draggableVerticals, R as OuiDraggableOptionsDirection, S as OuiDragBegin, T as OuiDragMove, U as OuiDraggableOptionsPositionGetOriginal, V as OuiDraggableOptionsPosition, W as OuiDraggableState, X as draggableStyleToggler, Y as draggableProperties, Z as draggableStyles, _ as DRAGGABLE_SELECTOR, b as DRAGGABLE_SELECTOR_SORTABLE_ITEM, g as DRAGGABLE_KEY_ESCAPE, h as DRAGGABLE_ATTRIBUTE_SORTABLE, j as OuiDraggableGlobalsElement, k as OuiDraggableDirection, m as DRAGGABLE_ATTRIBUTE_MOVABLE, p as CreateOuiDraggableOptions, q as draggableGlobals, v as DRAGGABLE_SELECTOR_MOVABLE_HANDLE, w as OuiDragEnd, x as DRAGGABLE_SYMBOL, y as DRAGGABLE_SELECTOR_SORTABLE_HANDLE, z as OuiDraggableOptionsDirectionOnAfter } from "../../movable.model-D9nnPWKk.mjs";
|
|
2
2
|
export { CreateOuiDraggableOptions, DRAGGABLE_ATTRIBUTE_MOVABLE, DRAGGABLE_ATTRIBUTE_SORTABLE, DRAGGABLE_KEY_ESCAPE, DRAGGABLE_SELECTOR, DRAGGABLE_SELECTOR_MOVABLE_HANDLE, DRAGGABLE_SELECTOR_SORTABLE_HANDLE, DRAGGABLE_SELECTOR_SORTABLE_ITEM, DRAGGABLE_SYMBOL, OuiDragBegin, OuiDragCancel, OuiDragEnd, OuiDragMove, OuiDragMovePosition, OuiDraggable, OuiDraggableBound, OuiDraggableDirection, OuiDraggableGlobals, OuiDraggableGlobalsElement, OuiDraggableInstances, OuiDraggableItem, OuiDraggableOptions, OuiDraggableOptionsContainer, OuiDraggableOptionsContainerOnDestroy, OuiDraggableOptionsContainerOnInitialize, OuiDraggableOptionsDirection, OuiDraggableOptionsDirectionOnAfter, OuiDraggableOptionsDrag, OuiDraggableOptionsPosition, OuiDraggableOptionsPositionGetOffset, OuiDraggableOptionsPositionGetOriginal, OuiDraggableState, OuiDraggableStates, draggableContainers, draggableGlobals, draggableHorizontals, draggableProperties, draggableStyleToggler, draggableStyles, draggableVerticals };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { D as OuiDraggable, G as OuiDraggableStates, M as OuiDraggableInstances, O as OuiDraggableBound, P as OuiDraggableOptions, W as OuiDraggableState, p as CreateOuiDraggableOptions } from "../../movable.model-
|
|
1
|
+
import { D as OuiDraggable, G as OuiDraggableStates, M as OuiDraggableInstances, O as OuiDraggableBound, P as OuiDraggableOptions, W as OuiDraggableState, p as CreateOuiDraggableOptions } from "../../movable.model-D9nnPWKk.mjs";
|
|
2
2
|
import { PlainObject } from "@oscarpalmer/atoms/models";
|
|
3
3
|
//#region src/js/internal/draggable/index.d.ts
|
|
4
|
-
export declare function addDraggable<Property extends keyof OuiDraggableInstances, Instance extends OuiDraggableInstances[Property]>(this: OuiDraggableBound<Property, Instance>, element:
|
|
5
|
-
export declare function destroyDraggable(draggable: OuiDraggable): void;
|
|
6
|
-
export declare function getDraggableStates(element:
|
|
7
|
-
export declare function getDraggableElement(this: OuiDraggable):
|
|
8
|
-
export declare function initializeDraggable<ExtraState extends PlainObject
|
|
4
|
+
export declare function addDraggable<Property extends keyof OuiDraggableInstances, Instance extends OuiDraggableInstances[Property]>(this: OuiDraggableBound<Property, Instance>, element: Element, options?: CreateOuiDraggableOptions): Instance;
|
|
5
|
+
export declare function destroyDraggable<ExtraState extends PlainObject>(draggable: OuiDraggable<ExtraState>): void;
|
|
6
|
+
export declare function getDraggableStates(element: Element): OuiDraggableStates | undefined;
|
|
7
|
+
export declare function getDraggableElement<ExtraState extends PlainObject>(this: OuiDraggable<ExtraState>): Element;
|
|
8
|
+
export declare function initializeDraggable<ExtraState extends PlainObject>(draggable: OuiDraggable<ExtraState>, name: keyof OuiDraggableStates, event: string, attribute: string, element: Element, options: OuiDraggableOptions<ExtraState>, extras: ExtraState): OuiDraggableState<ExtraState>;
|
|
9
9
|
export declare function removeDraggable<Property extends keyof OuiDraggableInstances, Instance extends OuiDraggableInstances[Property]>(this: {
|
|
10
|
-
constructor: new (element:
|
|
10
|
+
constructor: new (element: Element) => Instance;
|
|
11
11
|
property: Property;
|
|
12
|
-
}, element:
|
|
12
|
+
}, element: Element): void;
|
|
13
13
|
//#endregion
|
|
@@ -19,7 +19,7 @@ function addDraggable(element, options) {
|
|
|
19
19
|
}
|
|
20
20
|
function cancelDrag(item) {
|
|
21
21
|
if (item == null) return;
|
|
22
|
-
item.state.options.drag.onCancel?.(
|
|
22
|
+
item.state.options.drag.onCancel?.(item);
|
|
23
23
|
dispatch(item.state.element, `oui:${item.state.name}:cancel`, { detail: { element: item.state.options.getOrigin() } });
|
|
24
24
|
reset();
|
|
25
25
|
}
|
|
@@ -74,10 +74,10 @@ function initializeDraggable(draggable, name, event, attribute, element, options
|
|
|
74
74
|
event,
|
|
75
75
|
name,
|
|
76
76
|
options,
|
|
77
|
-
horizontal: true,
|
|
78
|
-
vertical: true,
|
|
79
77
|
destroyed: false,
|
|
80
|
-
|
|
78
|
+
horizontal: true,
|
|
79
|
+
styling: toggleStyles(element, draggableStyles),
|
|
80
|
+
vertical: true
|
|
81
81
|
};
|
|
82
82
|
const item = {
|
|
83
83
|
state,
|
|
@@ -98,6 +98,7 @@ function onKeydown(event) {
|
|
|
98
98
|
function onPointerdown(event) {
|
|
99
99
|
if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey || (supportsTouch.value ? event.type === "mousedown" : event.type === "touchstart" || event.button !== 0)) return;
|
|
100
100
|
const container = findAncestor(event, DRAGGABLE_SELECTOR);
|
|
101
|
+
if (container == null) return;
|
|
101
102
|
const instances = draggableGlobals.instances.get(container);
|
|
102
103
|
const states = draggableGlobals.states.get(container);
|
|
103
104
|
if (instances == null || states == null) return;
|
|
@@ -129,13 +130,13 @@ function onPointerdown(event) {
|
|
|
129
130
|
rectangle,
|
|
130
131
|
node: dragged
|
|
131
132
|
};
|
|
132
|
-
draggableGlobals.offset = item.state.options.position.getOffset(
|
|
133
|
-
draggableGlobals.original = item.state.options.position.getOriginal(
|
|
133
|
+
draggableGlobals.offset = item.state.options.position.getOffset(item, element, position);
|
|
134
|
+
draggableGlobals.original = item.state.options.position.getOriginal(item, position);
|
|
134
135
|
if (dispatch(item.state.element, `oui:${item.state.name}:begin`, { detail: {
|
|
135
136
|
element,
|
|
136
137
|
position: { ...draggableGlobals.original }
|
|
137
138
|
} }).defaultPrevented) {
|
|
138
|
-
item.state.options.drag.onCancel?.(
|
|
139
|
+
item.state.options.drag.onCancel?.(item);
|
|
139
140
|
reset();
|
|
140
141
|
return;
|
|
141
142
|
}
|
|
@@ -145,7 +146,7 @@ function onPointerdown(event) {
|
|
|
145
146
|
inset: `${next.y}px auto auto ${next.x}px`,
|
|
146
147
|
transform: "translate3d(0, 0, 0)"
|
|
147
148
|
});
|
|
148
|
-
item.state.options.drag.onBegin?.(event,
|
|
149
|
+
item.state.options.drag.onBegin?.(event, item, element, handle, next);
|
|
149
150
|
item.state.styling.set();
|
|
150
151
|
draggableStyleToggler.set();
|
|
151
152
|
}
|
|
@@ -155,26 +156,34 @@ function onPointermove(event) {
|
|
|
155
156
|
if (position == null) return;
|
|
156
157
|
const next = getNextPosition(current, position);
|
|
157
158
|
if (draggableGlobals.element != null) setStyle(draggableGlobals.element.node, "inset", `${next.y}px auto auto ${next.x}px`);
|
|
158
|
-
const detail = current.state.options.drag.onMove(event,
|
|
159
|
+
const detail = current.state.options.drag.onMove(event, current, {
|
|
159
160
|
calculated: next,
|
|
160
161
|
original: position
|
|
161
162
|
});
|
|
162
163
|
if (dispatch(current.state.element, `oui:${current.state.name}:move`, { detail }).defaultPrevented) cancelDrag(current);
|
|
163
164
|
}
|
|
164
165
|
function onPointerup(event) {
|
|
165
|
-
current?.state.options.drag.onEnd?.(event,
|
|
166
|
+
current?.state.options.drag.onEnd?.(event, current, reset);
|
|
166
167
|
}
|
|
167
168
|
function removeDraggable(element) {
|
|
168
169
|
const { property } = this;
|
|
169
170
|
removeInstance(draggableGlobals.instances, property, element);
|
|
170
|
-
|
|
171
|
-
}
|
|
172
|
-
function removeInstance(
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
171
|
+
removeState(draggableGlobals.states, property, element);
|
|
172
|
+
}
|
|
173
|
+
function removeInstance(instances, name, element) {
|
|
174
|
+
removeStored(instances, name, element);
|
|
175
|
+
}
|
|
176
|
+
function removeState(map, name, element) {
|
|
177
|
+
removeStored(map, name, element);
|
|
178
|
+
}
|
|
179
|
+
function removeStored(map, name, element) {
|
|
180
|
+
const stored = map.get(element);
|
|
181
|
+
const item = stored?.[name];
|
|
182
|
+
if (stored == null || item == null) return;
|
|
183
|
+
const itemAsPlainObject = item;
|
|
184
|
+
if (typeof itemAsPlainObject.destroy === "function") itemAsPlainObject.destroy();
|
|
185
|
+
stored[name] = void 0;
|
|
186
|
+
if (stored[draggableProperties[name]] == null) map.delete(element);
|
|
178
187
|
}
|
|
179
188
|
function reset() {
|
|
180
189
|
current?.state.styling.remove();
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { _ as OuiLocalizationsValues, p as OuiLocalizations, u as OuiDefaultLocalizations } from "../../l10n.model-D1E1u35L.mjs";
|
|
2
|
+
//#region src/js/internal/l10n/index.d.ts
|
|
3
|
+
export declare function createDefaultLocalizations<Localizations extends OuiLocalizationsValues>(values: Localizations): OuiDefaultLocalizations<Localizations>;
|
|
4
|
+
export declare function createLocalizations<Localizations extends OuiLocalizationsValues>(defaults: OuiDefaultLocalizations<Localizations>): OuiLocalizations<Localizations>;
|
|
5
|
+
//#endregion
|