@oscarpalmer/oui 0.37.0 → 0.38.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/a11y.css +1 -0
- package/dist/css/badge.css +1 -0
- package/dist/css/button.css +5 -0
- package/dist/css/color-picker.css +377 -0
- package/dist/css/color.css +0 -1
- package/dist/css/combobox.css +7 -0
- package/dist/css/content.css +1 -0
- package/dist/css/floatable.css +2 -0
- package/dist/css/form.css +7 -0
- package/dist/css/listbox.css +2 -0
- package/dist/css/message.css +2 -0
- package/dist/css/mixins/badge.mixins.css +2 -0
- package/dist/css/mixins/button.mixins.css +2 -0
- package/dist/css/mixins/message.mixins.css +1 -0
- package/dist/css/mixins/misc.mixins.css +2 -0
- package/dist/css/mixins/shadow.mixins.css +1 -0
- package/dist/css/reset.css +2 -2
- package/dist/css/splitter.css +1 -1
- package/dist/css/tabs.css +21 -21
- package/dist/js/color-picker.d.mts +213 -0
- package/dist/js/color-picker.mjs +924 -0
- package/dist/js/combobox/dom.combobox.mjs +8 -4
- package/dist/js/combobox/event.combobox.mjs +1 -1
- package/dist/js/combobox/index.d.mts +1 -1
- package/dist/js/combobox/index.mjs +56 -2
- package/dist/js/combobox/misc.combobox.d.mts +1 -1
- package/dist/js/combobox/misc.combobox.mjs +1 -1
- package/dist/js/combobox/state.combobox.d.mts +1 -1
- package/dist/js/combobox/state.combobox.mjs +1 -1
- package/dist/js/dialog.mjs +2 -2
- package/dist/js/floatable/floatable.embedded.mjs +13 -10
- package/dist/js/focus-trap/focus-trap.embedded.mjs +3 -3
- package/dist/js/{index-EfkUSals.d.mts → index-DJdFlTLm.d.mts} +39 -1
- package/dist/js/index.d.mts +3 -2
- package/dist/js/index.mjs +4 -3
- package/dist/js/internal/draggable.mjs +4 -4
- package/dist/js/internal/listbox/listbox.data.mjs +1 -1
- package/dist/js/internal/listbox/listbox.dom.mjs +1 -1
- package/dist/js/internal/listbox/listbox.event.mjs +1 -1
- package/dist/js/internal/listbox/listbox.form.mjs +16 -15
- package/dist/js/internal/listbox/listbox.misc.mjs +1 -1
- package/dist/js/internal/listbox/listbox.state.mjs +3 -3
- package/dist/js/internal/navigable.mjs +4 -3
- package/dist/js/listbox/event.listbox.mjs +1 -1
- package/dist/js/listbox/index.d.mts +38 -0
- package/dist/js/listbox/index.mjs +56 -2
- package/dist/js/listbox/misc.listbox.mjs +1 -1
- package/dist/js/listbox/state.listbox.mjs +1 -1
- package/dist/js/{listbox.data-BWd0PCy7.mjs → listbox.data-C7CRa5Ya.mjs} +5 -4
- package/dist/js/menu.mjs +1 -1
- package/dist/js/{misc.listbox-BI-XsTOf.mjs → misc.listbox-Cyz2CRDy.mjs} +2 -3
- package/dist/js/movable/movable.embedded.mjs +2 -2
- package/dist/js/popover.mjs +2 -2
- package/dist/js/resizable/resizable.embedded.mjs +5 -5
- package/dist/js/sortable/sortable.embedded.mjs +4 -4
- package/dist/js/splitter.mjs +6 -6
- package/dist/js/{state.combobox-4xq0FPCF.mjs → state.combobox-Qm3FWzYW.mjs} +3 -3
- package/dist/js/tabs.mjs +4 -7
- package/dist/js/tooltip.mjs +3 -3
- package/package.json +7 -5
- package/src/css/a11y.scss +2 -2
- package/src/css/badge.scss +8 -8
- package/src/css/button.scss +8 -8
- package/src/css/color-picker.scss +344 -0
- package/src/css/color.scss +0 -2
- package/src/css/combobox.scss +12 -9
- package/src/css/content.scss +11 -10
- package/src/css/floatable.scss +6 -3
- package/src/css/form.scss +12 -10
- package/src/css/listbox.scss +4 -3
- package/src/css/message.scss +9 -8
- package/src/css/mixins/badge.mixins.scss +53 -0
- package/src/css/mixins/button.mixins.scss +112 -0
- package/src/css/mixins/input.mixins.scss +114 -0
- package/src/css/mixins/message.mixins.scss +41 -0
- package/src/css/mixins/misc.mixins.scss +48 -0
- package/src/css/mixins/shadow.mixins.scss +57 -0
- package/src/css/reset.scss +2 -2
- package/src/css/splitter.scss +1 -1
- package/src/css/tabs.scss +20 -31
- package/src/js/color-picker.ts +1653 -0
- package/src/js/combobox/dom.combobox.ts +4 -0
- package/src/js/combobox/index.ts +63 -1
- package/src/js/dialog.ts +1 -1
- package/src/js/floatable/floatable.embedded.ts +18 -14
- package/src/js/index.ts +1 -0
- package/src/js/internal/listbox/listbox.dom.ts +2 -1
- package/src/js/internal/listbox/listbox.form.ts +31 -21
- package/src/js/internal/listbox/listbox.state.ts +2 -2
- package/src/js/internal/navigable.ts +2 -0
- package/src/js/listbox/index.ts +62 -0
- package/src/js/listbox/state.listbox.ts +0 -2
- package/src/js/popover.ts +1 -1
- package/src/js/tabs.ts +4 -10
- package/src/css/mixins.scss +0 -419
- /package/dist/css/{mixins.css → mixins/input.mixins.css} +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { getLocalization, localize } from "../l10n.mjs";
|
|
2
|
-
import { _ as createListboxValueLabel, f as createListboxInput, l as createListboxFilter, m as createListboxMessage, p as createListboxList } from "../listbox.data-
|
|
2
|
+
import { _ as createListboxValueLabel, f as createListboxInput, l as createListboxFilter, m as createListboxMessage, p as createListboxList } from "../listbox.data-C7CRa5Ya.mjs";
|
|
3
3
|
import { COMBOBOX_ATTRIBUTE_ANCHOR, COMBOBOX_ATTRIBUTE_SELECTION, COMBOBOX_ATTRIBUTE_SELECTION_ITEM } from "./constants.combobox.mjs";
|
|
4
4
|
import { setAria } from "@oscarpalmer/toretto/aria";
|
|
5
5
|
import { setAttribute } from "@oscarpalmer/toretto/attribute";
|
|
6
|
-
import { getData } from "@oscarpalmer/toretto/data";
|
|
7
6
|
import { createElement } from "@oscarpalmer/toretto/create";
|
|
7
|
+
import { getData } from "@oscarpalmer/toretto/data";
|
|
8
8
|
//#region src/js/combobox/dom.combobox.ts
|
|
9
9
|
function createComboboxAnchor(parameters) {
|
|
10
10
|
const { select } = parameters;
|
|
@@ -29,7 +29,10 @@ function createComboboxButton(parameters) {
|
|
|
29
29
|
haspopup: "listbox",
|
|
30
30
|
labelledby: `${label.id} ${id}_value`
|
|
31
31
|
},
|
|
32
|
-
property: {
|
|
32
|
+
property: {
|
|
33
|
+
textContent: multiple ? "" : select.selectedOptions[0]?.textContent ?? "",
|
|
34
|
+
type: "button"
|
|
35
|
+
}
|
|
33
36
|
});
|
|
34
37
|
if (!multiple) return { element };
|
|
35
38
|
const container = createElement("div");
|
|
@@ -101,7 +104,8 @@ function createComboboxSelectionItem(option, state) {
|
|
|
101
104
|
[COMBOBOX_ATTRIBUTE_SELECTION_ITEM]: "",
|
|
102
105
|
tabindex: -1
|
|
103
106
|
},
|
|
104
|
-
data: { option: option.id }
|
|
107
|
+
data: { option: option.id },
|
|
108
|
+
property: { type: "button" }
|
|
105
109
|
});
|
|
106
110
|
const icon = createElement("span", {
|
|
107
111
|
aria: { hidden: true },
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as skipComboboxNavigation, S as preventComboboxActivation, _ as onComboboxPreview, b as onComboboxTab, c as onComboboxClickContent, d as onComboboxFilter, f as onComboboxFocusout, g as onComboboxNavigation, h as onComboboxKeydownSelection, l as onComboboxEnter, m as onComboboxKeydown, o as onComboboxActivation, p as onComboboxInput, s as onComboboxApply, u as onComboboxEscape, v as onComboboxRemoveSelection, x as onComboboxToggle, y as onComboboxSelection } from "../state.combobox-
|
|
1
|
+
import { C as skipComboboxNavigation, S as preventComboboxActivation, _ as onComboboxPreview, b as onComboboxTab, c as onComboboxClickContent, d as onComboboxFilter, f as onComboboxFocusout, g as onComboboxNavigation, h as onComboboxKeydownSelection, l as onComboboxEnter, m as onComboboxKeydown, o as onComboboxActivation, p as onComboboxInput, s as onComboboxApply, u as onComboboxEscape, v as onComboboxRemoveSelection, x as onComboboxToggle, y as onComboboxSelection } from "../state.combobox-Qm3FWzYW.mjs";
|
|
2
2
|
export { onComboboxActivation, onComboboxApply, onComboboxClickContent, onComboboxEnter, onComboboxEscape, onComboboxFilter, onComboboxFocusout, onComboboxInput, onComboboxKeydown, onComboboxKeydownSelection, onComboboxNavigation, onComboboxPreview, onComboboxRemoveSelection, onComboboxSelection, onComboboxTab, onComboboxToggle, preventComboboxActivation, skipComboboxNavigation };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as setComboboxLocalizations, t as OuiComboboxElement } from "../index-
|
|
1
|
+
import { a as setComboboxLocalizations, t as OuiComboboxElement } from "../index-DJdFlTLm.mjs";
|
|
2
2
|
export { OuiComboboxElement, setComboboxLocalizations };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { updateLocalizations } from "../l10n.mjs";
|
|
2
|
-
import { C as setListboxDisabled, D as setListboxReadonly, O as setListboxRequired, T as setListboxLimit, a as setListboxValue, o as setListboxValues, w as setListboxFilter } from "../listbox.data-
|
|
2
|
+
import { C as setListboxDisabled, D as setListboxReadonly, O as setListboxRequired, T as setListboxLimit, a as setListboxValue, o as setListboxValues, w as setListboxFilter } from "../listbox.data-C7CRa5Ya.mjs";
|
|
3
3
|
import { attachListbox, detachListbox } from "../internal/listbox/listbox.state.mjs";
|
|
4
4
|
import { COMBOBOX_TAGNAME } from "./constants.combobox.mjs";
|
|
5
|
-
import { D as setComboboxLocalizations, a as onDetachCombobox, i as onAttachCombobox, n as comboboxStates, r as createComboboxState } from "../state.combobox-
|
|
5
|
+
import { D as setComboboxLocalizations, a as onDetachCombobox, i as onAttachCombobox, n as comboboxStates, r as createComboboxState } from "../state.combobox-Qm3FWzYW.mjs";
|
|
6
6
|
import { getAttribute } from "@oscarpalmer/toretto/attribute";
|
|
7
7
|
import { parse } from "@oscarpalmer/atoms/string";
|
|
8
8
|
//#region src/js/combobox/index.ts
|
|
@@ -42,6 +42,18 @@ var OuiComboboxElement = class extends HTMLElement {
|
|
|
42
42
|
setListboxFilter(this.#state, value);
|
|
43
43
|
}
|
|
44
44
|
/**
|
|
45
|
+
* Form element associated with the combobox
|
|
46
|
+
*/
|
|
47
|
+
get form() {
|
|
48
|
+
return this.#internals.form;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Label elements associated with the combobox
|
|
52
|
+
*/
|
|
53
|
+
get labels() {
|
|
54
|
+
return this.#internals.labels;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
45
57
|
* Maximum number of selected options
|
|
46
58
|
*/
|
|
47
59
|
get max() {
|
|
@@ -114,6 +126,18 @@ var OuiComboboxElement = class extends HTMLElement {
|
|
|
114
126
|
return this.#state.type;
|
|
115
127
|
}
|
|
116
128
|
/**
|
|
129
|
+
* Validation message for the combobox
|
|
130
|
+
*/
|
|
131
|
+
get validationMessage() {
|
|
132
|
+
return this.#internals.validationMessage;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Validity state for the combobox
|
|
136
|
+
*/
|
|
137
|
+
get validity() {
|
|
138
|
+
return this.#internals.validity;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
117
141
|
* Current value
|
|
118
142
|
*/
|
|
119
143
|
get value() {
|
|
@@ -137,6 +161,12 @@ var OuiComboboxElement = class extends HTMLElement {
|
|
|
137
161
|
set values(values) {
|
|
138
162
|
setListboxValues(this.#state, values);
|
|
139
163
|
}
|
|
164
|
+
/**
|
|
165
|
+
* Can the combobox be validated?
|
|
166
|
+
*/
|
|
167
|
+
get willValidate() {
|
|
168
|
+
return this.#internals.willValidate;
|
|
169
|
+
}
|
|
140
170
|
constructor() {
|
|
141
171
|
super();
|
|
142
172
|
this.#internals = this.attachInternals();
|
|
@@ -155,6 +185,14 @@ var OuiComboboxElement = class extends HTMLElement {
|
|
|
155
185
|
}
|
|
156
186
|
}
|
|
157
187
|
/**
|
|
188
|
+
* Check if the combobox is valid
|
|
189
|
+
*
|
|
190
|
+
* @returns `true` if the combobox is valid, otherwise `false`
|
|
191
|
+
*/
|
|
192
|
+
checkValidity() {
|
|
193
|
+
return this.#internals.checkValidity();
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
158
196
|
* Clear all selected options
|
|
159
197
|
*/
|
|
160
198
|
clear() {
|
|
@@ -180,6 +218,22 @@ var OuiComboboxElement = class extends HTMLElement {
|
|
|
180
218
|
if (this.#state == null) this.#restored = parsed;
|
|
181
219
|
else setListboxValues(this.#state, parsed);
|
|
182
220
|
}
|
|
221
|
+
/**
|
|
222
|
+
* Check if the combobox is valid and report any validation errors
|
|
223
|
+
*
|
|
224
|
+
* @returns `true` if the combobox is valid, otherwise `false`
|
|
225
|
+
*/
|
|
226
|
+
reportValidity() {
|
|
227
|
+
return this.#internals.reportValidity();
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Set a custom validation message for the combobox
|
|
231
|
+
*
|
|
232
|
+
* @param message Validation message
|
|
233
|
+
*/
|
|
234
|
+
setCustomValidity(message) {
|
|
235
|
+
this.#internals.setValidity({ customError: message !== "" }, message, this);
|
|
236
|
+
}
|
|
183
237
|
setLocalizations(first, second) {
|
|
184
238
|
updateLocalizations(this.#state.localizations.global, typeof first === "string" ? { [first]: second } : first, this.#state.localizations.component);
|
|
185
239
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as setComboboxLocalizations, i as hasTextSelection, n as getComboboxAutoComplete, o as updateComboboxLocalizations, r as getComboboxId } from "../index-
|
|
1
|
+
import { a as setComboboxLocalizations, i as hasTextSelection, n as getComboboxAutoComplete, o as updateComboboxLocalizations, r as getComboboxId } from "../index-DJdFlTLm.mjs";
|
|
2
2
|
export { getComboboxAutoComplete, getComboboxId, hasTextSelection, setComboboxLocalizations, updateComboboxLocalizations };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { D as setComboboxLocalizations, E as hasTextSelection, O as updateComboboxLocalizations, T as getComboboxId, w as getComboboxAutoComplete } from "../state.combobox-
|
|
1
|
+
import { D as setComboboxLocalizations, E as hasTextSelection, O as updateComboboxLocalizations, T as getComboboxId, w as getComboboxAutoComplete } from "../state.combobox-Qm3FWzYW.mjs";
|
|
2
2
|
export { getComboboxAutoComplete, getComboboxId, hasTextSelection, setComboboxLocalizations, updateComboboxLocalizations };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as OuiLocalizations } from "../l10n-Bn-7RcwR.mjs";
|
|
2
2
|
import { o as OuiListboxLocalizations, u as OuiListboxStates } from "../listbox.model-CRReGOmu.mjs";
|
|
3
3
|
import { OuiComboboxState } from "./models.combobox.mjs";
|
|
4
|
-
import { t as OuiComboboxElement } from "../index-
|
|
4
|
+
import { t as OuiComboboxElement } from "../index-DJdFlTLm.mjs";
|
|
5
5
|
//#region src/js/combobox/state.combobox.d.ts
|
|
6
6
|
declare function createComboboxState(element: OuiComboboxElement, internals: ElementInternals): OuiComboboxState;
|
|
7
7
|
declare function onAttachCombobox(state: OuiComboboxState): void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as onDetachCombobox, i as onAttachCombobox, n as comboboxStates, r as createComboboxState, t as comboboxLocalizations } from "../state.combobox-
|
|
1
|
+
import { a as onDetachCombobox, i as onAttachCombobox, n as comboboxStates, r as createComboboxState, t as comboboxLocalizations } from "../state.combobox-Qm3FWzYW.mjs";
|
|
2
2
|
export { comboboxLocalizations, comboboxStates, createComboboxState, onAttachCombobox, onDetachCombobox };
|
package/dist/js/dialog.mjs
CHANGED
|
@@ -4,8 +4,8 @@ import { ATTRIBUTE_MOVABLE_HANDLE, createMovable } from "./movable/movable.embed
|
|
|
4
4
|
import "./movable/movable.standalone.mjs";
|
|
5
5
|
import { RESIZABLE_ATTRIBUTE_HANDLE, createResizable } from "./resizable/resizable.embedded.mjs";
|
|
6
6
|
import { getAria, setAria } from "@oscarpalmer/toretto/aria";
|
|
7
|
-
import { on } from "@oscarpalmer/toretto/event";
|
|
8
7
|
import { getAttribute, setAttribute } from "@oscarpalmer/toretto/attribute";
|
|
8
|
+
import { on } from "@oscarpalmer/toretto/event";
|
|
9
9
|
import { setStyles } from "@oscarpalmer/toretto/style";
|
|
10
10
|
//#region src/js/dialog.ts
|
|
11
11
|
var OuiDialog = class {
|
|
@@ -106,7 +106,7 @@ function getState(element) {
|
|
|
106
106
|
state.resizable?.reset();
|
|
107
107
|
}
|
|
108
108
|
})],
|
|
109
|
-
modal: getAria(element, "modal") ===
|
|
109
|
+
modal: getAria(element, "modal") === true || element.matches(":modal")
|
|
110
110
|
};
|
|
111
111
|
state.dialog = new OuiDialog(state);
|
|
112
112
|
state.movable = getMovable(element);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { getAria } from "@oscarpalmer/toretto/aria";
|
|
2
|
+
import { getAttribute, setAttribute } from "@oscarpalmer/toretto/attribute";
|
|
2
3
|
import { on } from "@oscarpalmer/toretto/event";
|
|
4
|
+
import { setStyle, setStyles } from "@oscarpalmer/toretto/style";
|
|
3
5
|
import { isPlainObject } from "@oscarpalmer/atoms/is";
|
|
4
|
-
import { getAttribute, setAttribute } from "@oscarpalmer/toretto/attribute";
|
|
5
6
|
import { isHTMLOrSVGElement } from "@oscarpalmer/toretto/is";
|
|
6
|
-
import { setStyle, setStyles } from "@oscarpalmer/toretto/style";
|
|
7
7
|
//#region src/js/floatable/floatable.embedded.ts
|
|
8
8
|
var OuiFloatable = class {
|
|
9
9
|
#destroyed = false;
|
|
@@ -23,13 +23,7 @@ var OuiFloatable = class {
|
|
|
23
23
|
}
|
|
24
24
|
constructor(state, standalone) {
|
|
25
25
|
this.#state = state;
|
|
26
|
-
|
|
27
|
-
if (standalone) {
|
|
28
|
-
setAttribute(content, ATTRIBUTE_FLOATABLE, "");
|
|
29
|
-
content.popover = "manual";
|
|
30
|
-
} else content.popover ??= "auto";
|
|
31
|
-
setStyle(anchor, "anchorName", state.name);
|
|
32
|
-
setStyle(content, "positionAnchor", state.name);
|
|
26
|
+
this.#initialize(state, standalone);
|
|
33
27
|
}
|
|
34
28
|
/**
|
|
35
29
|
* Destroy the floatable, removing it from the DOM and cleaning up references
|
|
@@ -61,6 +55,15 @@ var OuiFloatable = class {
|
|
|
61
55
|
update(position) {
|
|
62
56
|
if (!this.#destroyed) setPosition(this.#state, position);
|
|
63
57
|
}
|
|
58
|
+
#initialize(state, standalone) {
|
|
59
|
+
const { anchor, content } = state;
|
|
60
|
+
if (standalone) {
|
|
61
|
+
setAttribute(content, ATTRIBUTE_FLOATABLE, "");
|
|
62
|
+
content.popover = "manual";
|
|
63
|
+
} else content.popover ??= "auto";
|
|
64
|
+
setStyle(anchor, "anchorName", state.name);
|
|
65
|
+
setStyle(content, "positionAnchor", state.name);
|
|
66
|
+
}
|
|
64
67
|
};
|
|
65
68
|
function getAnchorName(anchor) {
|
|
66
69
|
let { anchorName } = anchor.style;
|
|
@@ -101,7 +104,7 @@ function createInstance(anchor, content, options, standalone) {
|
|
|
101
104
|
function getOnBeforeToggleListener(element) {
|
|
102
105
|
return on(element, "beforetoggle", (event) => {
|
|
103
106
|
const { newState, source } = event;
|
|
104
|
-
if (newState === "open" && source != null && getAria(source, "disabled") ===
|
|
107
|
+
if (newState === "open" && source != null && getAria(source, "disabled") === true) event.preventDefault();
|
|
105
108
|
}, { passive: false });
|
|
106
109
|
}
|
|
107
110
|
function getOptions(input) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { attributable } from "../internal/attributable.mjs";
|
|
2
|
+
import { clamp } from "@oscarpalmer/atoms/number";
|
|
3
|
+
import { setAttribute } from "@oscarpalmer/toretto/attribute";
|
|
2
4
|
import { dispatch, on } from "@oscarpalmer/toretto/event";
|
|
5
|
+
import { findAncestor } from "@oscarpalmer/toretto/find";
|
|
3
6
|
import { isPlainObject } from "@oscarpalmer/atoms/is";
|
|
4
|
-
import { setAttribute } from "@oscarpalmer/toretto/attribute";
|
|
5
7
|
import { isHTMLOrSVGElement } from "@oscarpalmer/toretto/is";
|
|
6
|
-
import { clamp } from "@oscarpalmer/atoms/number";
|
|
7
|
-
import { findAncestor } from "@oscarpalmer/toretto/find";
|
|
8
8
|
import { getFocusable } from "@oscarpalmer/toretto/focusable";
|
|
9
9
|
//#region src/js/focus-trap/focus-trap.embedded.ts
|
|
10
10
|
var OuiFocusTrap = class {
|
|
@@ -46,6 +46,14 @@ declare class OuiComboboxElement extends HTMLElement {
|
|
|
46
46
|
* Set the filter value
|
|
47
47
|
*/
|
|
48
48
|
set filter(value: string);
|
|
49
|
+
/**
|
|
50
|
+
* Form element associated with the combobox
|
|
51
|
+
*/
|
|
52
|
+
get form(): HTMLFormElement | null;
|
|
53
|
+
/**
|
|
54
|
+
* Label elements associated with the combobox
|
|
55
|
+
*/
|
|
56
|
+
get labels(): NodeList;
|
|
49
57
|
/**
|
|
50
58
|
* Maximum number of selected options
|
|
51
59
|
*/
|
|
@@ -94,6 +102,14 @@ declare class OuiComboboxElement extends HTMLElement {
|
|
|
94
102
|
* Type of combobox
|
|
95
103
|
*/
|
|
96
104
|
get type(): OuiListboxType;
|
|
105
|
+
/**
|
|
106
|
+
* Validation message for the combobox
|
|
107
|
+
*/
|
|
108
|
+
get validationMessage(): string;
|
|
109
|
+
/**
|
|
110
|
+
* Validity state for the combobox
|
|
111
|
+
*/
|
|
112
|
+
get validity(): ValidityState;
|
|
97
113
|
/**
|
|
98
114
|
* Current value
|
|
99
115
|
*/
|
|
@@ -110,8 +126,18 @@ declare class OuiComboboxElement extends HTMLElement {
|
|
|
110
126
|
* Set the values
|
|
111
127
|
*/
|
|
112
128
|
set values(values: unknown[]);
|
|
129
|
+
/**
|
|
130
|
+
* Can the combobox be validated?
|
|
131
|
+
*/
|
|
132
|
+
get willValidate(): boolean;
|
|
113
133
|
constructor();
|
|
114
134
|
attributeChangedCallback(name: string, _: string | null, value: string | null): void;
|
|
135
|
+
/**
|
|
136
|
+
* Check if the combobox is valid
|
|
137
|
+
*
|
|
138
|
+
* @returns `true` if the combobox is valid, otherwise `false`
|
|
139
|
+
*/
|
|
140
|
+
checkValidity(): boolean;
|
|
115
141
|
/**
|
|
116
142
|
* Clear all selected options
|
|
117
143
|
*/
|
|
@@ -120,7 +146,19 @@ declare class OuiComboboxElement extends HTMLElement {
|
|
|
120
146
|
disconnectedCallback(): void;
|
|
121
147
|
formDisabledCallback(disabled: boolean): void;
|
|
122
148
|
formResetCallback(): void;
|
|
123
|
-
formStateRestoreCallback(state:
|
|
149
|
+
formStateRestoreCallback(state: unknown, reason: unknown): void;
|
|
150
|
+
/**
|
|
151
|
+
* Check if the combobox is valid and report any validation errors
|
|
152
|
+
*
|
|
153
|
+
* @returns `true` if the combobox is valid, otherwise `false`
|
|
154
|
+
*/
|
|
155
|
+
reportValidity(): boolean;
|
|
156
|
+
/**
|
|
157
|
+
* Set a custom validation message for the combobox
|
|
158
|
+
*
|
|
159
|
+
* @param message Validation message
|
|
160
|
+
*/
|
|
161
|
+
setCustomValidity(message: string): void;
|
|
124
162
|
/**
|
|
125
163
|
* Set combobox localizations for a specific language
|
|
126
164
|
*
|
package/dist/js/index.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { OuiColorPickerElement, OuiColorPickerEvent, setColorPickerLocalizations } from "./color-picker.mjs";
|
|
1
2
|
import { a as OuiFloatablePosition, n as CreateOuiFloatableOptions, r as OuiFloatable, s as createFloatable } from "./floatable.embedded-Bct4U5Dm.mjs";
|
|
2
|
-
import { a as setComboboxLocalizations, t as OuiComboboxElement } from "./index-
|
|
3
|
+
import { a as setComboboxLocalizations, t as OuiComboboxElement } from "./index-DJdFlTLm.mjs";
|
|
3
4
|
import { d as OuiSortable, f as createSortable, g as createMovable, h as OuiMovable, t as CreateOuiDraggableOptions } from "./draggable-a6w0J1OD.mjs";
|
|
4
5
|
import "./movable/movable.standalone.mjs";
|
|
5
6
|
import { a as createResizable, n as OuiResizable, t as CreateOuiResizableOptions } from "./resizable.embedded-3qoR0Bjm.mjs";
|
|
@@ -14,4 +15,4 @@ import "./sortable/sortable.standalone.mjs";
|
|
|
14
15
|
import { OuiSplitterElement } from "./splitter.mjs";
|
|
15
16
|
import { OuiTabsElement, OuiTabsEvent } from "./tabs.mjs";
|
|
16
17
|
import { OuiTooltip, getTooltip, setTooltipDelay } from "./tooltip.mjs";
|
|
17
|
-
export { type CreateOuiFloatableOptions, type CreateOuiDraggableOptions as CreateOuiMovableOptions, type CreateOuiDraggableOptions as CreateOuiSortableOptions, type CreateOuiResizableOptions, 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, setComboboxLocalizations, setListboxLocalizations, setTooltipDelay };
|
|
18
|
+
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
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { createFloatable } from "./floatable/floatable.embedded.mjs";
|
|
2
|
+
import { OuiColorPickerElement, OuiColorPickerEvent, setColorPickerLocalizations } from "./color-picker.mjs";
|
|
2
3
|
import { createMovable } from "./movable/movable.embedded.mjs";
|
|
3
4
|
import "./movable/movable.standalone.mjs";
|
|
4
5
|
import { createResizable } from "./resizable/resizable.embedded.mjs";
|
|
5
6
|
import { getDialog } from "./dialog.mjs";
|
|
6
7
|
import "./menu.mjs";
|
|
7
8
|
import "./toolbar.mjs";
|
|
8
|
-
import { D as setComboboxLocalizations } from "./state.combobox-
|
|
9
|
+
import { D as setComboboxLocalizations } from "./state.combobox-Qm3FWzYW.mjs";
|
|
9
10
|
import { OuiComboboxElement } from "./combobox/index.mjs";
|
|
10
11
|
import "./floatable/floatable.standalone.mjs";
|
|
11
12
|
import { createFocusTrap } from "./focus-trap/focus-trap.embedded.mjs";
|
|
12
13
|
import "./focus-trap/focus-trap.standalone.mjs";
|
|
13
|
-
import { n as setListboxLocalizations } from "./misc.listbox-
|
|
14
|
+
import { n as setListboxLocalizations } from "./misc.listbox-Cyz2CRDy.mjs";
|
|
14
15
|
import { OuiListboxElement } from "./listbox/index.mjs";
|
|
15
16
|
import { getPopover } from "./popover.mjs";
|
|
16
17
|
import "./resizable/resizable.standalone.mjs";
|
|
@@ -19,4 +20,4 @@ import "./sortable/sortable.standalone.mjs";
|
|
|
19
20
|
import { OuiSplitterElement } from "./splitter.mjs";
|
|
20
21
|
import { OuiTabsElement, OuiTabsEvent } from "./tabs.mjs";
|
|
21
22
|
import { getTooltip, setTooltipDelay } from "./tooltip.mjs";
|
|
22
|
-
export { OuiComboboxElement, OuiListboxElement, OuiSplitterElement, OuiTabsElement, OuiTabsEvent, createFloatable, createFocusTrap, createMovable, createResizable as createOuiResizable, createSortable, getDialog, getPopover, getTooltip, setComboboxLocalizations, setListboxLocalizations, setTooltipDelay };
|
|
23
|
+
export { OuiColorPickerElement, OuiColorPickerEvent, OuiComboboxElement, OuiListboxElement, OuiSplitterElement, OuiTabsElement, OuiTabsEvent, createFloatable, createFocusTrap, createMovable, createResizable as createOuiResizable, createSortable, getDialog, getPopover, getTooltip, setColorPickerLocalizations, setComboboxLocalizations, setListboxLocalizations, setTooltipDelay };
|
|
@@ -1,10 +1,10 @@
|
|
|
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
1
|
import { clamp } from "@oscarpalmer/atoms/number";
|
|
2
|
+
import { getAttribute, setAttribute } from "@oscarpalmer/toretto/attribute";
|
|
3
|
+
import { dispatch, getEventPosition, on } from "@oscarpalmer/toretto/event";
|
|
6
4
|
import { findAncestor } from "@oscarpalmer/toretto/find";
|
|
5
|
+
import { setStyle, setStyles, toggleStyles } from "@oscarpalmer/toretto/style";
|
|
7
6
|
import supportsTouch from "@oscarpalmer/toretto/touch";
|
|
7
|
+
import { isHTMLOrSVGElement } from "@oscarpalmer/toretto/is";
|
|
8
8
|
//#region src/js/internal/draggable.ts
|
|
9
9
|
var OuiDraggable = class {
|
|
10
10
|
#destroyed = false;
|
|
@@ -1,2 +1,2 @@
|
|
|
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-
|
|
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-C7CRa5Ya.mjs";
|
|
2
2
|
export { applyListboxSelection, filterListbox, filterListboxOption, filterListboxOptions, setListboxValue, setListboxValues, toggleListboxOption };
|
|
@@ -1,2 +1,2 @@
|
|
|
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-
|
|
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-C7CRa5Ya.mjs";
|
|
2
2
|
export { createListboxContent, createListboxFilter, createListboxGroup, createListboxHeader, createListboxInput, createListboxList, createListboxMessage, createListboxOption, createListboxOptions, createListboxValueLabel, updateListboxMessage, updateListboxPreview, updateListboxValueLabel };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LISTBOX_KEYS } from "./listbox.constants.mjs";
|
|
2
|
-
import { S as getListboxVisibleOptions } from "../../listbox.data-
|
|
2
|
+
import { S as getListboxVisibleOptions } from "../../listbox.data-C7CRa5Ya.mjs";
|
|
3
3
|
import { clamp } from "@oscarpalmer/atoms/number";
|
|
4
4
|
//#region src/js/internal/listbox/listbox.event.ts
|
|
5
5
|
function processListboxKeydown(event, state) {
|
|
@@ -15,11 +15,12 @@ function updateListboxForm(state, values, emit) {
|
|
|
15
15
|
if (emit ?? true) dispatch(state.host, "oui:change");
|
|
16
16
|
}
|
|
17
17
|
function updateListboxValidity(state) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
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();
|
|
23
24
|
return;
|
|
24
25
|
}
|
|
25
26
|
let data = {};
|
|
@@ -27,26 +28,26 @@ function updateListboxValidity(state) {
|
|
|
27
28
|
let key;
|
|
28
29
|
let parameters = [];
|
|
29
30
|
switch (true) {
|
|
30
|
-
case
|
|
31
|
+
case required && options.selected.length === 0:
|
|
31
32
|
error = "badInput";
|
|
32
33
|
key = "input";
|
|
33
34
|
break;
|
|
34
|
-
case
|
|
35
|
-
data = { amount:
|
|
35
|
+
case multiple && typeof max === "number" && options.selected.length > max:
|
|
36
|
+
data = { amount: max };
|
|
36
37
|
error = "rangeOverflow";
|
|
37
38
|
key = "max";
|
|
38
|
-
parameters = [
|
|
39
|
+
parameters = [max];
|
|
39
40
|
break;
|
|
40
|
-
case
|
|
41
|
-
data = { amount:
|
|
41
|
+
case multiple && typeof min === "number" && options.selected.length < min:
|
|
42
|
+
data = { amount: min };
|
|
42
43
|
error = "rangeUnderflow";
|
|
43
44
|
key = "min";
|
|
44
|
-
parameters = [
|
|
45
|
+
parameters = [min];
|
|
45
46
|
}
|
|
46
|
-
const localization = key == null ? void 0 : getLocalization(
|
|
47
|
+
const localization = key == null ? void 0 : getLocalization(localizations.global, host, key, localizations.component);
|
|
47
48
|
const message = localization == null ? void 0 : localize(localization, data, parameters);
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
internals.setValidity(error == null ? {} : { [error]: true }, message);
|
|
50
|
+
internals.checkValidity();
|
|
50
51
|
}
|
|
51
52
|
//#endregion
|
|
52
53
|
export { updateListboxForm, updateListboxValidity };
|
|
@@ -1,2 +1,2 @@
|
|
|
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-
|
|
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-C7CRa5Ya.mjs";
|
|
2
2
|
export { generateListboxIds, getListboxVisibleOptions, setListboxDisabled, setListboxFilter, setListboxLimit, setListboxMultiple, setListboxReadonly, setListboxRequired };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
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-
|
|
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-C7CRa5Ya.mjs";
|
|
3
3
|
import { getAttribute } from "@oscarpalmer/toretto/attribute";
|
|
4
4
|
//#region src/js/internal/listbox/listbox.state.ts
|
|
5
5
|
function attachListbox(state, states, onAttach) {
|
|
6
|
-
const { filter, host, label } = state;
|
|
6
|
+
const { filter, host, id, label } = state;
|
|
7
7
|
label.element.htmlFor = filter.element.id;
|
|
8
|
-
label.element.id = `${
|
|
8
|
+
label.element.id = `${id}_label`;
|
|
9
9
|
onAttach(state);
|
|
10
10
|
states.map.set(host, state);
|
|
11
11
|
states.set.add(state);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { clamp } from "@oscarpalmer/atoms/number";
|
|
1
2
|
import { getAria, setAria, setRole } from "@oscarpalmer/toretto/aria";
|
|
2
|
-
import { on } from "@oscarpalmer/toretto/event";
|
|
3
3
|
import { getAttribute } from "@oscarpalmer/toretto/attribute";
|
|
4
|
-
import {
|
|
5
|
-
import { clamp } from "@oscarpalmer/atoms/number";
|
|
4
|
+
import { on } from "@oscarpalmer/toretto/event";
|
|
6
5
|
import { findAncestor } from "@oscarpalmer/toretto/find";
|
|
6
|
+
import { isHTMLOrSVGElement } from "@oscarpalmer/toretto/is";
|
|
7
7
|
//#region src/js/internal/navigable.ts
|
|
8
8
|
var OuiNavigable = class {
|
|
9
9
|
active = { index: 0 };
|
|
@@ -97,6 +97,7 @@ function onKeydown(navigable, event) {
|
|
|
97
97
|
const items = getItems(navigable.element, navigable.options.selector);
|
|
98
98
|
const { length } = items;
|
|
99
99
|
if (length === 0) return;
|
|
100
|
+
event.preventDefault();
|
|
100
101
|
let index;
|
|
101
102
|
if (KEYS_ABSOLUTE.has(event.key)) index = event.key === "Home" ? 0 : items.length - 1;
|
|
102
103
|
else {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { d as onListboxNavigation, f as onListboxToggle, l as onListboxEnter, u as onListboxFilter } from "../misc.listbox-
|
|
1
|
+
import { d as onListboxNavigation, f as onListboxToggle, l as onListboxEnter, u as onListboxFilter } from "../misc.listbox-Cyz2CRDy.mjs";
|
|
2
2
|
export { onListboxEnter, onListboxFilter, onListboxNavigation, onListboxToggle };
|
|
@@ -27,6 +27,14 @@ declare class OuiListboxElement extends HTMLElement {
|
|
|
27
27
|
* Set the filter value
|
|
28
28
|
*/
|
|
29
29
|
set filter(value: string);
|
|
30
|
+
/**
|
|
31
|
+
* Form element associated with the listbox
|
|
32
|
+
*/
|
|
33
|
+
get form(): HTMLFormElement | null;
|
|
34
|
+
/**
|
|
35
|
+
* Label elements associated with the listbox
|
|
36
|
+
*/
|
|
37
|
+
get labels(): NodeList;
|
|
30
38
|
/**
|
|
31
39
|
* Maximum number of selected options
|
|
32
40
|
*/
|
|
@@ -71,6 +79,14 @@ declare class OuiListboxElement extends HTMLElement {
|
|
|
71
79
|
* Selected options
|
|
72
80
|
*/
|
|
73
81
|
get selected(): HTMLElement[];
|
|
82
|
+
/**
|
|
83
|
+
* Validation message for the listbox
|
|
84
|
+
*/
|
|
85
|
+
get validationMessage(): string;
|
|
86
|
+
/**
|
|
87
|
+
* Validity state for the listbox
|
|
88
|
+
*/
|
|
89
|
+
get validity(): ValidityState;
|
|
74
90
|
/**
|
|
75
91
|
* Current value
|
|
76
92
|
*/
|
|
@@ -87,8 +103,18 @@ declare class OuiListboxElement extends HTMLElement {
|
|
|
87
103
|
* Set the values
|
|
88
104
|
*/
|
|
89
105
|
set values(values: unknown[]);
|
|
106
|
+
/**
|
|
107
|
+
* Can the listbox be validated?
|
|
108
|
+
*/
|
|
109
|
+
get willValidate(): boolean;
|
|
90
110
|
constructor();
|
|
91
111
|
attributeChangedCallback(name: string, _: string | null, value: string | null): void;
|
|
112
|
+
/**
|
|
113
|
+
* Check if the listbox is valid
|
|
114
|
+
*
|
|
115
|
+
* @returns `true` if the listbox is valid, otherwise `false`
|
|
116
|
+
*/
|
|
117
|
+
checkValidity(): boolean;
|
|
92
118
|
/**
|
|
93
119
|
* Clear all selected options
|
|
94
120
|
*/
|
|
@@ -98,6 +124,18 @@ declare class OuiListboxElement extends HTMLElement {
|
|
|
98
124
|
formDisabledCallback(disabled: boolean): void;
|
|
99
125
|
formResetCallback(): void;
|
|
100
126
|
formStateRestoreCallback(state: string | File | FormData, reason: unknown): void;
|
|
127
|
+
/**
|
|
128
|
+
* Check if the listbox is valid and report any validation errors
|
|
129
|
+
*
|
|
130
|
+
* @returns `true` if the listbox is valid, otherwise `false`
|
|
131
|
+
*/
|
|
132
|
+
reportValidity(): boolean;
|
|
133
|
+
/**
|
|
134
|
+
* Set a custom validation message for the listbox
|
|
135
|
+
*
|
|
136
|
+
* @param message Validation message
|
|
137
|
+
*/
|
|
138
|
+
setCustomValidity(message: string): void;
|
|
101
139
|
/**
|
|
102
140
|
* Set listbox localizations for a specific language
|
|
103
141
|
*
|