@oscarpalmer/oui 0.34.0 → 0.36.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/combobox.css +1 -1
- package/dist/css/listbox.css +152 -0
- package/dist/js/combobox/constants.combobox.d.mts +2 -2
- package/dist/js/combobox/constants.combobox.mjs +40 -33
- package/dist/js/combobox/dom.combobox.d.mts +8 -91
- package/dist/js/combobox/dom.combobox.mjs +204 -2
- package/dist/js/combobox/event.combobox.d.mts +14 -8
- package/dist/js/combobox/event.combobox.mjs +2 -2
- package/dist/js/combobox/index.d.mts +1 -1
- package/dist/js/combobox/index.mjs +21 -18
- package/dist/js/combobox/misc.combobox.d.mts +2 -14
- package/dist/js/combobox/misc.combobox.mjs +2 -2
- package/dist/js/combobox/models.combobox.d.mts +44 -2
- package/dist/js/combobox/state.combobox.d.mts +9 -8
- package/dist/js/combobox/state.combobox.mjs +2 -2
- package/dist/js/constants.combobox-DmRAMC64.d.mts +26 -0
- package/dist/js/constants.listbox-DRsXUxd3.d.mts +14 -0
- package/dist/js/index-EfkUSals.d.mts +139 -0
- package/dist/js/index.d.mts +4 -2
- package/dist/js/index.mjs +4 -2
- package/dist/js/internal/attributable.mjs +4 -3
- package/dist/js/internal/listbox/listbox.constants.d.mts +11 -0
- package/dist/js/internal/listbox/listbox.constants.mjs +23 -0
- package/dist/js/internal/listbox/listbox.data.d.mts +20 -0
- package/dist/js/internal/listbox/listbox.data.mjs +2 -0
- package/dist/js/internal/listbox/listbox.dom.d.mts +66 -0
- package/dist/js/internal/listbox/listbox.dom.mjs +2 -0
- package/dist/js/internal/listbox/listbox.event.d.mts +5 -0
- package/dist/js/internal/listbox/listbox.event.mjs +63 -0
- package/dist/js/internal/listbox/listbox.form.d.mts +6 -0
- package/dist/js/internal/listbox/listbox.form.mjs +52 -0
- package/dist/js/internal/listbox/listbox.misc.d.mts +12 -0
- package/dist/js/internal/listbox/listbox.misc.mjs +2 -0
- package/dist/js/internal/listbox/listbox.model.d.mts +2 -0
- package/dist/js/internal/listbox/listbox.model.mjs +1 -0
- package/dist/js/internal/listbox/listbox.state.d.mts +7 -0
- package/dist/js/internal/listbox/listbox.state.mjs +40 -0
- package/dist/js/internal/misc.d.mts +6 -0
- package/dist/js/internal/misc.mjs +13 -0
- package/dist/js/l10n-Bn-7RcwR.d.mts +20 -0
- package/dist/js/l10n.d.mts +2 -0
- package/dist/js/l10n.mjs +80 -0
- package/dist/js/listbox/constants.listbox.d.mts +2 -0
- package/dist/js/listbox/constants.listbox.mjs +40 -0
- package/dist/js/listbox/event.listbox.d.mts +8 -0
- package/dist/js/listbox/event.listbox.mjs +2 -0
- package/dist/js/listbox/index.d.mts +116 -0
- package/dist/js/listbox/index.mjs +189 -0
- package/dist/js/listbox/misc.listbox.d.mts +2 -0
- package/dist/js/listbox/misc.listbox.mjs +2 -0
- package/dist/js/listbox/state.listbox.d.mts +11 -0
- package/dist/js/listbox/state.listbox.mjs +2 -0
- package/dist/js/listbox.data-BWd0PCy7.mjs +424 -0
- package/dist/js/listbox.model-CRReGOmu.d.mts +125 -0
- package/dist/js/misc.listbox-BI-XsTOf.mjs +197 -0
- package/dist/js/misc.listbox-gnoJhrTr.d.mts +20 -0
- package/dist/js/sortable/sortable.embedded.mjs +4 -2
- package/dist/js/state.combobox-4xq0FPCF.mjs +365 -0
- package/package.json +7 -3
- package/src/css/combobox.scss +1 -1
- package/src/css/listbox.scss +149 -0
- package/src/js/combobox/constants.combobox.ts +46 -25
- package/src/js/combobox/dom.combobox.ts +65 -452
- package/src/js/combobox/event.combobox.ts +129 -218
- package/src/js/combobox/index.ts +43 -30
- package/src/js/combobox/misc.combobox.ts +60 -94
- package/src/js/combobox/models.combobox.ts +7 -47
- package/src/js/combobox/state.combobox.ts +136 -125
- package/src/js/index.ts +1 -0
- package/src/js/internal/listbox/listbox.constants.ts +25 -0
- package/src/js/{combobox/data.combobox.ts → internal/listbox/listbox.data.ts} +94 -43
- package/src/js/internal/listbox/listbox.dom.ts +445 -0
- package/src/js/internal/listbox/listbox.event.ts +129 -0
- package/src/js/{combobox/form.combobox.ts → internal/listbox/listbox.form.ts} +33 -33
- package/src/js/internal/listbox/listbox.misc.ts +135 -0
- package/src/js/internal/listbox/listbox.model.ts +169 -0
- package/src/js/internal/listbox/listbox.state.ts +82 -0
- package/src/js/internal/misc.ts +27 -0
- package/src/js/l10n.ts +192 -0
- package/src/js/listbox/constants.listbox.ts +61 -0
- package/src/js/listbox/event.listbox.ts +106 -0
- package/src/js/listbox/index.ts +302 -0
- package/src/js/listbox/misc.listbox.ts +70 -0
- package/src/js/listbox/state.listbox.ts +196 -0
- package/dist/js/combobox/data.combobox.d.mts +0 -18
- package/dist/js/combobox/data.combobox.mjs +0 -2
- package/dist/js/combobox/form.combobox.d.mts +0 -6
- package/dist/js/combobox/form.combobox.mjs +0 -2
- package/dist/js/combobox/i18n.combobox.d.mts +0 -2
- package/dist/js/combobox/i18n.combobox.mjs +0 -2
- package/dist/js/constants.combobox-DqNUGBLS.d.mts +0 -243
- package/dist/js/data.combobox-8RwBv5ey.mjs +0 -1077
- package/src/js/combobox/i18n.combobox.ts +0 -179
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { n as OuiLocalizationsValues, t as OuiLocalizations } from "./l10n-Bn-7RcwR.mjs";
|
|
2
|
+
import { RemovableEventListener } from "@oscarpalmer/toretto/models";
|
|
3
|
+
//#region src/js/internal/listbox/listbox.model.d.ts
|
|
4
|
+
type OuiListboxAttributes = {
|
|
5
|
+
active: string;
|
|
6
|
+
content: string;
|
|
7
|
+
empty: string;
|
|
8
|
+
filter: string;
|
|
9
|
+
group: string;
|
|
10
|
+
header: string;
|
|
11
|
+
hidden: string;
|
|
12
|
+
input: string;
|
|
13
|
+
list: string;
|
|
14
|
+
message: string;
|
|
15
|
+
option: string;
|
|
16
|
+
};
|
|
17
|
+
type OuiListboxAutoComplete = Record<OuiListboxAutoCompleteType, boolean> & {
|
|
18
|
+
value?: OuiListboxAutoCompleteType;
|
|
19
|
+
};
|
|
20
|
+
type OuiListboxAutoCompleteType = 'both' | 'inline' | 'list' | 'none';
|
|
21
|
+
type OuiListboxCallbacks<State extends OuiListboxState = OuiListboxState> = {
|
|
22
|
+
data: OuiListboxCallbacksData<State>;
|
|
23
|
+
keydown: OuiListboxCallbacksKeydown<State>;
|
|
24
|
+
};
|
|
25
|
+
type OuiListboxCallbacksData<State extends OuiListboxState = OuiListboxState> = {
|
|
26
|
+
onApply: OuiListboxCallbacksDataOnApply<State>;
|
|
27
|
+
onFilter: OuiListboxCallbacksDataOnFilter<State>;
|
|
28
|
+
onForm: (state: State) => void;
|
|
29
|
+
onPreview: OuiListboxCallbacksDataOnPreview<State>;
|
|
30
|
+
onToggle: (state: State) => void;
|
|
31
|
+
};
|
|
32
|
+
type OuiListboxCallbacksDataOnApply<State extends OuiListboxState = OuiListboxState> = (state: State, option: HTMLElement | undefined, values: string[], added: boolean, selected?: HTMLElement[], emit?: boolean) => void;
|
|
33
|
+
type OuiListboxCallbacksDataOnFilter<State extends OuiListboxState = OuiListboxState> = (preview: OuiListboxPreview, state: State, update: boolean, active?: HTMLElement, emit?: boolean) => void;
|
|
34
|
+
type OuiListboxCallbacksDataOnPreview<State extends OuiListboxState = OuiListboxState> = (preview: OuiListboxPreview, state: State, active?: HTMLElement) => void;
|
|
35
|
+
type OuiListboxCallbacksKeydown<State extends OuiListboxState = OuiListboxState> = {
|
|
36
|
+
onActivation?: (state: State) => void;
|
|
37
|
+
onEnter?: (state: State) => void;
|
|
38
|
+
onEscape?: (state: State) => void;
|
|
39
|
+
onNavigation: OuiListboxCallbacksDataOnNavigation<State>;
|
|
40
|
+
onSelection?: (state: State) => void;
|
|
41
|
+
onTab?: (state: State) => void;
|
|
42
|
+
onToggle?: (state: State) => void;
|
|
43
|
+
preventActivation?: (state: State) => boolean;
|
|
44
|
+
skipNavigation?: (state: State) => boolean;
|
|
45
|
+
};
|
|
46
|
+
type OuiListboxCallbacksDataOnNavigation<State extends OuiListboxState = OuiListboxState> = (preview: OuiListboxPreview, state: State, active?: HTMLElement) => void;
|
|
47
|
+
type OuiListboxFilter = {
|
|
48
|
+
element: HTMLInputElement;
|
|
49
|
+
value: string;
|
|
50
|
+
};
|
|
51
|
+
type OuiListboxFooter = {
|
|
52
|
+
container: HTMLElement;
|
|
53
|
+
message: HTMLElement;
|
|
54
|
+
};
|
|
55
|
+
type OuiListboxGroup = {
|
|
56
|
+
element: HTMLElement;
|
|
57
|
+
header: HTMLElement;
|
|
58
|
+
options: HTMLElement[];
|
|
59
|
+
};
|
|
60
|
+
type OuiListboxLabel = {
|
|
61
|
+
element: HTMLLabelElement;
|
|
62
|
+
id: string;
|
|
63
|
+
};
|
|
64
|
+
type OuiListboxLocalization<Localizations extends OuiLocalizationsValues> = {
|
|
65
|
+
component: Record<string, Partial<Localizations>>;
|
|
66
|
+
global: OuiLocalizations<Localizations>;
|
|
67
|
+
};
|
|
68
|
+
type OuiListboxLocalizations = {
|
|
69
|
+
empty: string | (() => string);
|
|
70
|
+
input: string | (() => string);
|
|
71
|
+
invalid: string | (() => string);
|
|
72
|
+
max: string | ((max: number) => string);
|
|
73
|
+
min: string | ((min: number) => string);
|
|
74
|
+
remove: string | ((label: string, value: string) => string);
|
|
75
|
+
results: string | ((amount: number) => string);
|
|
76
|
+
selected: string | ((amount: number) => string);
|
|
77
|
+
};
|
|
78
|
+
type OuiListboxOptions = {
|
|
79
|
+
all: HTMLElement[];
|
|
80
|
+
selected: HTMLElement[];
|
|
81
|
+
};
|
|
82
|
+
type OuiListboxPreview = 'none' | 'set' | 'typed';
|
|
83
|
+
type OuiListboxState = {
|
|
84
|
+
active?: HTMLElement;
|
|
85
|
+
attributes: OuiListboxAttributes;
|
|
86
|
+
autocomplete: OuiListboxAutoComplete;
|
|
87
|
+
callbacks: OuiListboxCallbacks;
|
|
88
|
+
content: HTMLDivElement;
|
|
89
|
+
disabled: boolean;
|
|
90
|
+
elements: Array<HTMLElement | undefined>;
|
|
91
|
+
filter: OuiListboxFilter;
|
|
92
|
+
footer?: OuiListboxFooter;
|
|
93
|
+
groups?: OuiListboxGroup[];
|
|
94
|
+
host: HTMLElement;
|
|
95
|
+
id: string;
|
|
96
|
+
internals: ElementInternals;
|
|
97
|
+
label: OuiListboxLabel;
|
|
98
|
+
list: HTMLUListElement;
|
|
99
|
+
listbox: boolean;
|
|
100
|
+
listeners: RemovableEventListener[];
|
|
101
|
+
localizations: OuiListboxLocalization<OuiListboxLocalizations>;
|
|
102
|
+
max?: number;
|
|
103
|
+
min?: number;
|
|
104
|
+
message: HTMLElement;
|
|
105
|
+
multiple: boolean;
|
|
106
|
+
name: string;
|
|
107
|
+
options: OuiListboxOptions;
|
|
108
|
+
readonly: boolean;
|
|
109
|
+
required: boolean;
|
|
110
|
+
select: HTMLSelectElement;
|
|
111
|
+
type: OuiListboxType;
|
|
112
|
+
values: OuiListboxValues;
|
|
113
|
+
};
|
|
114
|
+
type OuiListboxStates<State extends OuiListboxState = OuiListboxState> = {
|
|
115
|
+
map: WeakMap<HTMLElement, State>;
|
|
116
|
+
set: Set<State>;
|
|
117
|
+
};
|
|
118
|
+
type OuiListboxType = 'autocomplete' | 'select';
|
|
119
|
+
type OuiListboxValues = {
|
|
120
|
+
current: string[];
|
|
121
|
+
initial: string[];
|
|
122
|
+
label: HTMLElement;
|
|
123
|
+
};
|
|
124
|
+
//#endregion
|
|
125
|
+
export { OuiListboxGroup as a, OuiListboxPreview as c, OuiListboxType as d, OuiListboxCallbacks as i, OuiListboxState as l, OuiListboxAutoComplete as n, OuiListboxLocalizations as o, OuiListboxAutoCompleteType as r, OuiListboxOptions as s, OuiListboxAttributes as t, OuiListboxStates as u };
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { getLocalizations, updateLocalizations } from "./l10n.mjs";
|
|
2
|
+
import { b as updateListboxValueLabel, c as createListboxContent, n as filterListbox, s as toggleListboxOption, t as applyListboxSelection, v as updateListboxMessage, x as generateListboxIds, y as updateListboxPreview } from "./listbox.data-BWd0PCy7.mjs";
|
|
3
|
+
import { initializeListboxState } from "./internal/listbox/listbox.state.mjs";
|
|
4
|
+
import { getBooleanAriaValue } from "./internal/misc.mjs";
|
|
5
|
+
import { processListboxKeydown } from "./internal/listbox/listbox.event.mjs";
|
|
6
|
+
import { LISTBOX_ATTRIBUTES, LISTBOX_MESSAGES, LISTBOX_SELECTORS, LISTBOX_TAGNAME } from "./listbox/constants.listbox.mjs";
|
|
7
|
+
import { on } from "@oscarpalmer/toretto/event";
|
|
8
|
+
import { setAttribute, setAttributes } from "@oscarpalmer/toretto/attribute";
|
|
9
|
+
import { findAncestor } from "@oscarpalmer/toretto/find";
|
|
10
|
+
import { getData } from "@oscarpalmer/toretto/data";
|
|
11
|
+
import { noop } from "@oscarpalmer/atoms/function";
|
|
12
|
+
//#region src/js/listbox/event.listbox.ts
|
|
13
|
+
function onListboxClick(event) {
|
|
14
|
+
const listbox = findAncestor(event, LISTBOX_TAGNAME);
|
|
15
|
+
const state = listboxStates.map.get(listbox);
|
|
16
|
+
if (listbox == null || state == null) return;
|
|
17
|
+
const option = findAncestor(event, LISTBOX_SELECTORS.option);
|
|
18
|
+
if (option == null) return;
|
|
19
|
+
if (state.disabled) state.filter.element.focus();
|
|
20
|
+
else if (state.readonly) updateListboxPreview("none", state, option, false);
|
|
21
|
+
else toggleListboxOption(state, option);
|
|
22
|
+
}
|
|
23
|
+
function onListboxEnter(state) {
|
|
24
|
+
if (!state.disabled && !state.readonly) toggleListboxOption(state, state.active);
|
|
25
|
+
}
|
|
26
|
+
function onListboxFilter(preview, state, _, active) {
|
|
27
|
+
updateListboxPreview(preview, state, active);
|
|
28
|
+
}
|
|
29
|
+
function onListboxInput(event) {
|
|
30
|
+
const listbox = findAncestor(event, LISTBOX_TAGNAME);
|
|
31
|
+
const state = listboxStates.map.get(listbox);
|
|
32
|
+
if (state?.filter.element === event.target) filterListbox(event.inputType, state);
|
|
33
|
+
}
|
|
34
|
+
function onListboxKeydown(event) {
|
|
35
|
+
const listbox = findAncestor(event, LISTBOX_TAGNAME);
|
|
36
|
+
const state = listboxStates.map.get(listbox);
|
|
37
|
+
if (state?.filter.element === event.target) processListboxKeydown(event, state);
|
|
38
|
+
}
|
|
39
|
+
function onListboxNavigation(preview, state, active) {
|
|
40
|
+
if (state.multiple || state.readonly) updateListboxPreview(preview, state, active);
|
|
41
|
+
else applyListboxSelection({
|
|
42
|
+
state,
|
|
43
|
+
option: active,
|
|
44
|
+
added: true,
|
|
45
|
+
selected: active == null ? [] : [active]
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
function onListboxToggle(state) {
|
|
49
|
+
state.filter.element.focus();
|
|
50
|
+
}
|
|
51
|
+
on(document, "click", onListboxClick);
|
|
52
|
+
on(document, "input", onListboxInput);
|
|
53
|
+
on(document, "keydown", onListboxKeydown, { passive: false });
|
|
54
|
+
//#endregion
|
|
55
|
+
//#region src/js/listbox/state.listbox.ts
|
|
56
|
+
function createListboxState(element, internals) {
|
|
57
|
+
const select = element.querySelector("select");
|
|
58
|
+
if (select == null) throw new Error(LISTBOX_MESSAGES.select);
|
|
59
|
+
const label = element.querySelector(`label[for="${select.id}"]`);
|
|
60
|
+
if (label == null) throw new Error(LISTBOX_MESSAGES.label);
|
|
61
|
+
element.id = select.id;
|
|
62
|
+
setAttribute(element, "name", select.name === "" ? select.id : select.name);
|
|
63
|
+
const disabled = getBooleanAriaValue(element, "disabled") || select.disabled;
|
|
64
|
+
const multiple = element.multiple || select.multiple;
|
|
65
|
+
const readonly = getBooleanAriaValue(element, "readonly");
|
|
66
|
+
const required = getBooleanAriaValue(element, "required") || select.required;
|
|
67
|
+
setAttributes(element, {
|
|
68
|
+
autocomplete: "none",
|
|
69
|
+
name: select.name === "" ? select.id : select.name
|
|
70
|
+
});
|
|
71
|
+
const id = getListboxId();
|
|
72
|
+
const labelId = label.id;
|
|
73
|
+
label.htmlFor = id;
|
|
74
|
+
label.id = `${id}_label`;
|
|
75
|
+
generateListboxIds(id, select);
|
|
76
|
+
const type = "select";
|
|
77
|
+
const content = createListboxContent({
|
|
78
|
+
element,
|
|
79
|
+
id,
|
|
80
|
+
label,
|
|
81
|
+
multiple,
|
|
82
|
+
select,
|
|
83
|
+
type,
|
|
84
|
+
attributes: LISTBOX_ATTRIBUTES,
|
|
85
|
+
autocomplete: listboxAutoComplete,
|
|
86
|
+
listbox: true
|
|
87
|
+
});
|
|
88
|
+
const { selected } = content.list.options;
|
|
89
|
+
const values = selected.length === 0 ? [""] : selected.map((option) => getData(option, "value", false) ?? "");
|
|
90
|
+
const state = {
|
|
91
|
+
disabled,
|
|
92
|
+
id,
|
|
93
|
+
internals,
|
|
94
|
+
message: content.message,
|
|
95
|
+
multiple,
|
|
96
|
+
readonly,
|
|
97
|
+
required,
|
|
98
|
+
select,
|
|
99
|
+
type,
|
|
100
|
+
active: selected[0],
|
|
101
|
+
attributes: LISTBOX_ATTRIBUTES,
|
|
102
|
+
autocomplete: listboxAutoComplete,
|
|
103
|
+
callbacks: listboxCallbacks,
|
|
104
|
+
content: content.element,
|
|
105
|
+
elements: [element, content.filter.element],
|
|
106
|
+
filter: {
|
|
107
|
+
element: content.filter.element,
|
|
108
|
+
value: ""
|
|
109
|
+
},
|
|
110
|
+
host: element,
|
|
111
|
+
label: {
|
|
112
|
+
id: labelId,
|
|
113
|
+
element: label
|
|
114
|
+
},
|
|
115
|
+
list: content.list.element,
|
|
116
|
+
listeners: [],
|
|
117
|
+
listbox: true,
|
|
118
|
+
localizations: {
|
|
119
|
+
component: {},
|
|
120
|
+
global: listboxLocalizations
|
|
121
|
+
},
|
|
122
|
+
name: element.name,
|
|
123
|
+
options: content.list.options,
|
|
124
|
+
values: {
|
|
125
|
+
current: values.slice(),
|
|
126
|
+
initial: values.slice(),
|
|
127
|
+
label: content.value
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
return initializeListboxState(state, listboxStates, onAttachListbox);
|
|
131
|
+
}
|
|
132
|
+
function onAttachListbox(state) {
|
|
133
|
+
const { content, select } = state;
|
|
134
|
+
select.hidden = true;
|
|
135
|
+
select.insertAdjacentElement("afterend", content);
|
|
136
|
+
select.remove();
|
|
137
|
+
}
|
|
138
|
+
function onDetachListbox(state) {
|
|
139
|
+
const { content, select } = state;
|
|
140
|
+
content.insertAdjacentElement("beforebegin", select);
|
|
141
|
+
content.remove();
|
|
142
|
+
select.hidden = false;
|
|
143
|
+
}
|
|
144
|
+
const listboxAutoComplete = {
|
|
145
|
+
both: false,
|
|
146
|
+
inline: false,
|
|
147
|
+
list: false,
|
|
148
|
+
none: true
|
|
149
|
+
};
|
|
150
|
+
const listboxCallbacks = {
|
|
151
|
+
data: {
|
|
152
|
+
onApply: noop,
|
|
153
|
+
onFilter: onListboxFilter,
|
|
154
|
+
onForm: noop,
|
|
155
|
+
onPreview: noop,
|
|
156
|
+
onToggle: onListboxToggle
|
|
157
|
+
},
|
|
158
|
+
keydown: {
|
|
159
|
+
onEnter: onListboxEnter,
|
|
160
|
+
onNavigation: onListboxNavigation,
|
|
161
|
+
onToggle: onListboxToggle
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
const listboxLocalizations = getLocalizations({
|
|
165
|
+
empty: "No results found",
|
|
166
|
+
input: "",
|
|
167
|
+
invalid: "Please select an option from the list",
|
|
168
|
+
max: (max) => `Please select fewer options (maximum is ${max})`,
|
|
169
|
+
min: (min) => `Please select more options (minimum is ${min})`,
|
|
170
|
+
remove: "",
|
|
171
|
+
results: (amount) => `${amount} results available`,
|
|
172
|
+
selected: (amount) => `${amount} selected`
|
|
173
|
+
});
|
|
174
|
+
const listboxStates = {
|
|
175
|
+
map: /* @__PURE__ */ new WeakMap(),
|
|
176
|
+
set: /* @__PURE__ */ new Set()
|
|
177
|
+
};
|
|
178
|
+
//#endregion
|
|
179
|
+
//#region src/js/listbox/misc.listbox.ts
|
|
180
|
+
function getListboxId() {
|
|
181
|
+
index += 1;
|
|
182
|
+
return `oui_listbox_${index}`;
|
|
183
|
+
}
|
|
184
|
+
function setListboxLocalizations(first, second) {
|
|
185
|
+
updateListboxLocalizations(listboxLocalizations, listboxLocalizations.values, first, second);
|
|
186
|
+
}
|
|
187
|
+
function updateListboxLocalizations(instance, destination, first, second) {
|
|
188
|
+
updateLocalizations(instance, typeof first === "string" ? { [first]: second } : first, destination, () => {
|
|
189
|
+
for (const state of listboxStates.set) {
|
|
190
|
+
updateListboxMessage(state);
|
|
191
|
+
updateListboxValueLabel(state);
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
let index = 0;
|
|
196
|
+
//#endregion
|
|
197
|
+
export { listboxLocalizations as a, onDetachListbox as c, onListboxNavigation as d, onListboxToggle as f, createListboxState as i, onListboxEnter as l, setListboxLocalizations as n, listboxStates as o, updateListboxLocalizations as r, onAttachListbox as s, getListboxId as t, onListboxFilter as u };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { t as OuiLocalizations } from "./l10n-Bn-7RcwR.mjs";
|
|
2
|
+
import { o as OuiListboxLocalizations } from "./listbox.model-CRReGOmu.mjs";
|
|
3
|
+
//#region src/js/listbox/misc.listbox.d.ts
|
|
4
|
+
declare function getListboxId(): string;
|
|
5
|
+
/**
|
|
6
|
+
* Set listbox localizations for a specific language
|
|
7
|
+
*
|
|
8
|
+
* @param language Language code
|
|
9
|
+
* @param localizations Localizations for language
|
|
10
|
+
*/
|
|
11
|
+
declare function setListboxLocalizations(language: string, localizations: Partial<OuiListboxLocalizations>): void;
|
|
12
|
+
/**
|
|
13
|
+
* Set listbox localizations for one or more languages
|
|
14
|
+
*
|
|
15
|
+
* @param localizations Localizations for one or more languages
|
|
16
|
+
*/
|
|
17
|
+
declare function setListboxLocalizations(localizations: Record<string, Partial<OuiListboxLocalizations>>): void;
|
|
18
|
+
declare function updateListboxLocalizations(instance: OuiLocalizations<OuiListboxLocalizations>, destination: Record<string, Partial<OuiListboxLocalizations>>, first: string | Record<string, Partial<OuiListboxLocalizations>>, second?: Partial<OuiListboxLocalizations>): void;
|
|
19
|
+
//#endregion
|
|
20
|
+
export { setListboxLocalizations as n, updateListboxLocalizations as r, getListboxId as t };
|
|
@@ -98,8 +98,10 @@ function onEnd(event, globals, item, reset) {
|
|
|
98
98
|
};
|
|
99
99
|
const target = getElementFromPosition(position)[0];
|
|
100
100
|
let element = findAncestor(target, SELECTOR_ITEM);
|
|
101
|
-
if (element?.hasAttribute(ATTRIBUTE_PLACEHOLDER_POSITION))
|
|
102
|
-
|
|
101
|
+
if (element?.hasAttribute(ATTRIBUTE_PLACEHOLDER_POSITION)) {
|
|
102
|
+
if (getAttribute(element, ATTRIBUTE_PLACEHOLDER_POSITION) === "after") element = element.previousElementSibling;
|
|
103
|
+
else element = element.nextElementSibling;
|
|
104
|
+
}
|
|
103
105
|
let insert = "insert";
|
|
104
106
|
let toInstance;
|
|
105
107
|
let toState;
|