@oscarpalmer/oui 0.36.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 +19 -15
- package/dist/css/button.css +40 -31
- package/dist/css/color-picker.css +377 -0
- package/dist/css/color.css +20 -21
- package/dist/css/combobox.css +140 -34
- package/dist/css/content.css +30 -10
- package/dist/css/floatable.css +12 -10
- package/dist/css/form.css +400 -129
- package/dist/css/listbox.css +43 -17
- package/dist/css/message.css +15 -10
- 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 +31 -90
- package/dist/css/splitter.css +3 -3
- package/dist/css/tabs.css +103 -0
- 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 +9 -13
- package/dist/js/{index-EfkUSals.d.mts → index-DJdFlTLm.d.mts} +39 -1
- package/dist/js/index.d.mts +4 -2
- package/dist/js/index.mjs +5 -3
- package/dist/js/internal/draggable.mjs +20 -26
- 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 +17 -16
- package/dist/js/internal/listbox/listbox.misc.mjs +1 -1
- package/dist/js/internal/listbox/listbox.state.mjs +4 -4
- package/dist/js/internal/navigable.d.mts +11 -5
- package/dist/js/internal/navigable.mjs +46 -19
- 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 +5 -8
- package/dist/js/popover.mjs +2 -2
- package/dist/js/resizable/resizable.embedded.mjs +21 -31
- package/dist/js/sortable/sortable.embedded.mjs +4 -4
- package/dist/js/splitter.mjs +20 -17
- package/dist/js/{state.combobox-4xq0FPCF.mjs → state.combobox-Qm3FWzYW.mjs} +3 -3
- package/dist/js/tabs.d.mts +25 -0
- package/dist/js/tabs.mjs +237 -0
- package/dist/js/tooltip.mjs +16 -15
- package/package.json +7 -5
- package/src/css/a11y.scss +2 -2
- package/src/css/badge.scss +8 -20
- package/src/css/button.scss +8 -47
- package/src/css/color-picker.scss +344 -0
- package/src/css/color.scss +20 -22
- package/src/css/combobox.scss +29 -57
- package/src/css/content.scss +34 -6
- package/src/css/floatable.scss +22 -19
- package/src/css/form.scss +94 -80
- package/src/css/listbox.scss +6 -34
- package/src/css/message.scss +16 -30
- 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 +39 -88
- package/src/css/splitter.scss +3 -3
- package/src/css/tabs.scss +74 -0
- 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/focus-trap/focus-trap.embedded.ts +11 -19
- package/src/js/index.ts +2 -0
- package/src/js/internal/draggable.ts +29 -33
- package/src/js/internal/listbox/listbox.dom.ts +2 -1
- package/src/js/internal/listbox/listbox.form.ts +32 -22
- package/src/js/internal/listbox/listbox.state.ts +3 -3
- package/src/js/internal/navigable.ts +82 -23
- package/src/js/listbox/index.ts +62 -0
- package/src/js/listbox/state.listbox.ts +0 -2
- package/src/js/movable/movable.embedded.ts +11 -13
- package/src/js/popover.ts +1 -1
- package/src/js/resizable/resizable.embedded.ts +25 -39
- package/src/js/splitter.ts +21 -18
- package/src/js/tabs.ts +441 -0
- package/src/js/tooltip.ts +20 -17
- package/src/css/mixins.scss +0 -194
- /package/dist/css/{mixins.css → mixins/input.mixins.css} +0 -0
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { getAria, setRole } from "@oscarpalmer/toretto/aria";
|
|
2
|
-
import { dispatch, on } from "@oscarpalmer/toretto/event";
|
|
3
|
-
import { isHTMLOrSVGElement } from "@oscarpalmer/toretto/is";
|
|
4
1
|
import { clamp } from "@oscarpalmer/atoms/number";
|
|
2
|
+
import { getAria, setAria, setRole } from "@oscarpalmer/toretto/aria";
|
|
3
|
+
import { getAttribute } from "@oscarpalmer/toretto/attribute";
|
|
4
|
+
import { on } from "@oscarpalmer/toretto/event";
|
|
5
5
|
import { findAncestor } from "@oscarpalmer/toretto/find";
|
|
6
|
+
import { isHTMLOrSVGElement } from "@oscarpalmer/toretto/is";
|
|
6
7
|
//#region src/js/internal/navigable.ts
|
|
7
8
|
var OuiNavigable = class {
|
|
8
9
|
active = { index: 0 };
|
|
@@ -13,12 +14,19 @@ var OuiNavigable = class {
|
|
|
13
14
|
constructor(element, options) {
|
|
14
15
|
this.element = element;
|
|
15
16
|
this.options = options;
|
|
16
|
-
this.listeners = [
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
this.listeners = [
|
|
18
|
+
on(element, "click", (event) => {
|
|
19
|
+
onClick(this, event);
|
|
20
|
+
}, { passive: false }),
|
|
21
|
+
on(element, "focusin", (event) => {
|
|
22
|
+
onFocusin(this, event);
|
|
23
|
+
}),
|
|
24
|
+
on(element, "keydown", (event) => {
|
|
25
|
+
onKeydown(this, event);
|
|
26
|
+
}, { passive: false })
|
|
27
|
+
];
|
|
28
|
+
this.orientation = options?.orientation ?? getNavigableOrientation(element, options.vertical);
|
|
29
|
+
setAria(element, "orientation", this.orientation);
|
|
22
30
|
if (options.role != null) setRole(element, options.role);
|
|
23
31
|
}
|
|
24
32
|
destroy() {
|
|
@@ -27,6 +35,10 @@ var OuiNavigable = class {
|
|
|
27
35
|
this.active.element = void 0;
|
|
28
36
|
this.element = void 0;
|
|
29
37
|
}
|
|
38
|
+
navigate(index, focus) {
|
|
39
|
+
const items = getItems(this.element, this.options.selector);
|
|
40
|
+
if (index >= 0 && index < items.length) onNavigate(this, index, items, focus ?? false);
|
|
41
|
+
}
|
|
30
42
|
};
|
|
31
43
|
function getItems(container, selector) {
|
|
32
44
|
return [...container.querySelectorAll(selector)].filter(isValidItem);
|
|
@@ -34,13 +46,28 @@ function getItems(container, selector) {
|
|
|
34
46
|
function getNavigable(element, options) {
|
|
35
47
|
return new OuiNavigable(element, options);
|
|
36
48
|
}
|
|
37
|
-
function
|
|
38
|
-
const attribute = getAria(element, "orientation");
|
|
39
|
-
return ORIENTATIONS.has(attribute) ? attribute :
|
|
49
|
+
function getNavigableOrientation(element, vertical, aria) {
|
|
50
|
+
const attribute = aria ?? true ? getAria(element, "orientation") : getAttribute(element, "orientation");
|
|
51
|
+
return ORIENTATIONS.has(attribute) ? attribute : vertical ? ORIENTATION_VERTICAL : ORIENTATION_HORIZONTAL;
|
|
40
52
|
}
|
|
41
53
|
function isValidItem(element) {
|
|
42
54
|
return "disabled" in element ? element.disabled !== true : true;
|
|
43
55
|
}
|
|
56
|
+
function onClick(navigable, event) {
|
|
57
|
+
const item = findAncestor(event, navigable.options.selector);
|
|
58
|
+
const items = getItems(navigable.element, navigable.options.selector);
|
|
59
|
+
const index = items.indexOf(item);
|
|
60
|
+
if (index === -1) return;
|
|
61
|
+
if (index !== navigable.active.index) onNavigate(navigable, index, items, false);
|
|
62
|
+
navigable.options.onActivate?.(navigable);
|
|
63
|
+
item.focus();
|
|
64
|
+
}
|
|
65
|
+
function onNavigate(navigable, index, items, focus) {
|
|
66
|
+
navigable.active.element = items[index];
|
|
67
|
+
navigable.active.index = index;
|
|
68
|
+
updateNavigableFocus(navigable, focus, items);
|
|
69
|
+
navigable.options.onNavigation?.(navigable);
|
|
70
|
+
}
|
|
44
71
|
function onFocusin(navigable, event) {
|
|
45
72
|
const item = findAncestor(event, navigable.options.selector);
|
|
46
73
|
if (!isHTMLOrSVGElement(item) || !isValidItem(item)) return;
|
|
@@ -63,10 +90,14 @@ function onKeydown(navigable, event) {
|
|
|
63
90
|
const mustActivate = KEYS_ACTIVATE.has(event.key);
|
|
64
91
|
const shouldActivate = navigable.options.onShouldActivate?.(event, navigable) === true;
|
|
65
92
|
if (mustActivate || shouldActivate || navigable.options.onPreventNavigation?.(event, navigable) === true) event.stopPropagation();
|
|
66
|
-
if (mustActivate || shouldActivate)
|
|
93
|
+
if (mustActivate || shouldActivate) {
|
|
94
|
+
navigable.options.onActivate?.(navigable);
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
67
97
|
const items = getItems(navigable.element, navigable.options.selector);
|
|
68
98
|
const { length } = items;
|
|
69
99
|
if (length === 0) return;
|
|
100
|
+
event.preventDefault();
|
|
70
101
|
let index;
|
|
71
102
|
if (KEYS_ABSOLUTE.has(event.key)) index = event.key === "Home" ? 0 : items.length - 1;
|
|
72
103
|
else {
|
|
@@ -76,10 +107,7 @@ function onKeydown(navigable, event) {
|
|
|
76
107
|
index = clamp(navigable.active.index + (KEYS_NEXT.has(event.key) ? 1 : -1), 0, length - 1, true);
|
|
77
108
|
}
|
|
78
109
|
}
|
|
79
|
-
if (index
|
|
80
|
-
navigable.active.element = items[index];
|
|
81
|
-
navigable.active.index = index;
|
|
82
|
-
updateNavigableFocus(navigable, true, items);
|
|
110
|
+
if (index != null && index !== navigable.active.index) onNavigate(navigable, index, items, true);
|
|
83
111
|
}
|
|
84
112
|
function updateNavigableFocus(navigable, focus, items) {
|
|
85
113
|
const updated = items ?? getItems(navigable.element, navigable.options.selector);
|
|
@@ -88,7 +116,6 @@ function updateNavigableFocus(navigable, focus, items) {
|
|
|
88
116
|
for (let index = 0; index < length; index += 1) updated[index].tabIndex = index === navigable.active.index ? 0 : -1;
|
|
89
117
|
navigable.active.element ??= updated[navigable.active.index];
|
|
90
118
|
if (focus) navigable.active.element?.focus();
|
|
91
|
-
dispatch(navigable.active.element, "navigable:change", { detail: { ...navigable.active } });
|
|
92
119
|
}
|
|
93
120
|
const KEYS_ABSOLUTE = /* @__PURE__ */ new Set(["End", "Home"]);
|
|
94
121
|
const KEYS_ACTIVATE = /* @__PURE__ */ new Set(["Enter", " "]);
|
|
@@ -105,4 +132,4 @@ const ORIENTATION_HORIZONTAL = "horizontal";
|
|
|
105
132
|
const ORIENTATION_VERTICAL = "vertical";
|
|
106
133
|
const ORIENTATIONS = /* @__PURE__ */ new Set([ORIENTATION_HORIZONTAL, ORIENTATION_VERTICAL]);
|
|
107
134
|
//#endregion
|
|
108
|
-
export { NAVIGABLE_KEYS_HORIZONTAL, NAVIGABLE_KEYS_VERTICAL, OuiNavigable, getNavigable, updateNavigableFocus };
|
|
135
|
+
export { NAVIGABLE_KEYS_HORIZONTAL, NAVIGABLE_KEYS_VERTICAL, OuiNavigable, getNavigable, getNavigableOrientation, updateNavigableFocus };
|
|
@@ -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
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
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-
|
|
1
|
+
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";
|
|
2
2
|
import { attachListbox, detachListbox } from "../internal/listbox/listbox.state.mjs";
|
|
3
3
|
import { LISTBOX_TAGNAME } from "./constants.listbox.mjs";
|
|
4
|
-
import { c as onDetachListbox, i as createListboxState, n as setListboxLocalizations, o as listboxStates, r as updateListboxLocalizations, s as onAttachListbox } from "../misc.listbox-
|
|
4
|
+
import { c as onDetachListbox, i as createListboxState, n as setListboxLocalizations, o as listboxStates, r as updateListboxLocalizations, s as onAttachListbox } from "../misc.listbox-Cyz2CRDy.mjs";
|
|
5
5
|
import { getAttribute } from "@oscarpalmer/toretto/attribute";
|
|
6
6
|
import { parse } from "@oscarpalmer/atoms/string";
|
|
7
7
|
//#region src/js/listbox/index.ts
|
|
@@ -41,6 +41,18 @@ var OuiListboxElement = class extends HTMLElement {
|
|
|
41
41
|
setListboxFilter(this.#state, value);
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
44
|
+
* Form element associated with the listbox
|
|
45
|
+
*/
|
|
46
|
+
get form() {
|
|
47
|
+
return this.#internals.form;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Label elements associated with the listbox
|
|
51
|
+
*/
|
|
52
|
+
get labels() {
|
|
53
|
+
return this.#internals.labels;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
44
56
|
* Maximum number of selected options
|
|
45
57
|
*/
|
|
46
58
|
get max() {
|
|
@@ -107,6 +119,18 @@ var OuiListboxElement = class extends HTMLElement {
|
|
|
107
119
|
return this.#state.options.selected.slice();
|
|
108
120
|
}
|
|
109
121
|
/**
|
|
122
|
+
* Validation message for the listbox
|
|
123
|
+
*/
|
|
124
|
+
get validationMessage() {
|
|
125
|
+
return this.#internals.validationMessage;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Validity state for the listbox
|
|
129
|
+
*/
|
|
130
|
+
get validity() {
|
|
131
|
+
return this.#internals.validity;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
110
134
|
* Current value
|
|
111
135
|
*/
|
|
112
136
|
get value() {
|
|
@@ -130,6 +154,12 @@ var OuiListboxElement = class extends HTMLElement {
|
|
|
130
154
|
set values(values) {
|
|
131
155
|
setListboxValues(this.#state, values);
|
|
132
156
|
}
|
|
157
|
+
/**
|
|
158
|
+
* Can the listbox be validated?
|
|
159
|
+
*/
|
|
160
|
+
get willValidate() {
|
|
161
|
+
return this.#internals.willValidate;
|
|
162
|
+
}
|
|
133
163
|
constructor() {
|
|
134
164
|
super();
|
|
135
165
|
this.#internals = this.attachInternals();
|
|
@@ -148,6 +178,14 @@ var OuiListboxElement = class extends HTMLElement {
|
|
|
148
178
|
}
|
|
149
179
|
}
|
|
150
180
|
/**
|
|
181
|
+
* Check if the listbox is valid
|
|
182
|
+
*
|
|
183
|
+
* @returns `true` if the listbox is valid, otherwise `false`
|
|
184
|
+
*/
|
|
185
|
+
checkValidity() {
|
|
186
|
+
return this.#internals.checkValidity();
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
151
189
|
* Clear all selected options
|
|
152
190
|
*/
|
|
153
191
|
clear() {
|
|
@@ -173,6 +211,22 @@ var OuiListboxElement = class extends HTMLElement {
|
|
|
173
211
|
if (this.#state == null) this.#restored = parsed;
|
|
174
212
|
else setListboxValues(this.#state, parsed);
|
|
175
213
|
}
|
|
214
|
+
/**
|
|
215
|
+
* Check if the listbox is valid and report any validation errors
|
|
216
|
+
*
|
|
217
|
+
* @returns `true` if the listbox is valid, otherwise `false`
|
|
218
|
+
*/
|
|
219
|
+
reportValidity() {
|
|
220
|
+
return this.#internals.reportValidity();
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Set a custom validation message for the listbox
|
|
224
|
+
*
|
|
225
|
+
* @param message Validation message
|
|
226
|
+
*/
|
|
227
|
+
setCustomValidity(message) {
|
|
228
|
+
this.#internals.setValidity({ customError: message !== "" }, message, this);
|
|
229
|
+
}
|
|
176
230
|
setLocalizations(first, second) {
|
|
177
231
|
updateListboxLocalizations(this.#state.localizations.global, this.#state.localizations.component, first, second);
|
|
178
232
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as setListboxLocalizations, r as updateListboxLocalizations, t as getListboxId } from "../misc.listbox-
|
|
1
|
+
import { n as setListboxLocalizations, r as updateListboxLocalizations, t as getListboxId } from "../misc.listbox-Cyz2CRDy.mjs";
|
|
2
2
|
export { getListboxId, setListboxLocalizations, updateListboxLocalizations };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as listboxLocalizations, c as onDetachListbox, i as createListboxState, o as listboxStates, s as onAttachListbox } from "../misc.listbox-
|
|
1
|
+
import { a as listboxLocalizations, c as onDetachListbox, i as createListboxState, o as listboxStates, s as onAttachListbox } from "../misc.listbox-Cyz2CRDy.mjs";
|
|
2
2
|
export { createListboxState, listboxLocalizations, listboxStates, onAttachListbox, onDetachListbox };
|
|
@@ -2,8 +2,8 @@ import { getLocalization, localize } from "./l10n.mjs";
|
|
|
2
2
|
import { listboxScrollOptions } from "./internal/listbox/listbox.constants.mjs";
|
|
3
3
|
import { updateListboxForm, updateListboxValidity } from "./internal/listbox/listbox.form.mjs";
|
|
4
4
|
import { setAria } from "@oscarpalmer/toretto/aria";
|
|
5
|
-
import { dispatch } from "@oscarpalmer/toretto/event";
|
|
6
5
|
import { setAttribute } from "@oscarpalmer/toretto/attribute";
|
|
6
|
+
import { dispatch } from "@oscarpalmer/toretto/event";
|
|
7
7
|
import { getString } from "@oscarpalmer/atoms/string";
|
|
8
8
|
import { getData } from "@oscarpalmer/toretto/data";
|
|
9
9
|
import { createElement, setAria as setAria$1, setAttribute as setAttribute$1 } from "@oscarpalmer/toretto";
|
|
@@ -134,13 +134,14 @@ function createListboxInput(parameters, value) {
|
|
|
134
134
|
autocorrect: "off",
|
|
135
135
|
autocomplete: "off",
|
|
136
136
|
form: "",
|
|
137
|
-
|
|
138
|
-
|
|
137
|
+
inputmode: "text",
|
|
138
|
+
spellcheck: "false"
|
|
139
139
|
},
|
|
140
140
|
property: {
|
|
141
141
|
id,
|
|
142
142
|
value,
|
|
143
|
-
role: isAutocomplete || listbox ? "combobox" : "searchbox"
|
|
143
|
+
role: isAutocomplete || listbox ? "combobox" : "searchbox",
|
|
144
|
+
type: "text"
|
|
144
145
|
}
|
|
145
146
|
});
|
|
146
147
|
if (isAutocomplete || listbox) setAria$1(input, "expanded", listbox);
|
package/dist/js/menu.mjs
CHANGED
|
@@ -2,8 +2,8 @@ import { createEmbeddedFloatable, getOnBeforeToggleListener } from "./floatable/
|
|
|
2
2
|
import { attributable } from "./internal/attributable.mjs";
|
|
3
3
|
import { NAVIGABLE_KEYS_HORIZONTAL, NAVIGABLE_KEYS_VERTICAL, getNavigable, updateNavigableFocus } from "./internal/navigable.mjs";
|
|
4
4
|
import { setAria, setRole } from "@oscarpalmer/toretto/aria";
|
|
5
|
-
import { on } from "@oscarpalmer/toretto/event";
|
|
6
5
|
import { setAttribute, setAttributes } from "@oscarpalmer/toretto/attribute";
|
|
6
|
+
import { on } from "@oscarpalmer/toretto/event";
|
|
7
7
|
import { findAncestor } from "@oscarpalmer/toretto/find";
|
|
8
8
|
//#region src/js/menu.ts
|
|
9
9
|
var OuiMenu = class {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
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-
|
|
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-C7CRa5Ya.mjs";
|
|
3
3
|
import { initializeListboxState } from "./internal/listbox/listbox.state.mjs";
|
|
4
4
|
import { getBooleanAriaValue } from "./internal/misc.mjs";
|
|
5
5
|
import { processListboxKeydown } from "./internal/listbox/listbox.event.mjs";
|
|
6
6
|
import { LISTBOX_ATTRIBUTES, LISTBOX_MESSAGES, LISTBOX_SELECTORS, LISTBOX_TAGNAME } from "./listbox/constants.listbox.mjs";
|
|
7
|
+
import { setAttributes } from "@oscarpalmer/toretto/attribute";
|
|
7
8
|
import { on } from "@oscarpalmer/toretto/event";
|
|
8
|
-
import { setAttribute, setAttributes } from "@oscarpalmer/toretto/attribute";
|
|
9
9
|
import { findAncestor } from "@oscarpalmer/toretto/find";
|
|
10
10
|
import { getData } from "@oscarpalmer/toretto/data";
|
|
11
11
|
import { noop } from "@oscarpalmer/atoms/function";
|
|
@@ -59,7 +59,6 @@ function createListboxState(element, internals) {
|
|
|
59
59
|
const label = element.querySelector(`label[for="${select.id}"]`);
|
|
60
60
|
if (label == null) throw new Error(LISTBOX_MESSAGES.label);
|
|
61
61
|
element.id = select.id;
|
|
62
|
-
setAttribute(element, "name", select.name === "" ? select.id : select.name);
|
|
63
62
|
const disabled = getBooleanAriaValue(element, "disabled") || select.disabled;
|
|
64
63
|
const multiple = element.multiple || select.multiple;
|
|
65
64
|
const readonly = getBooleanAriaValue(element, "readonly");
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { attributable } from "../internal/attributable.mjs";
|
|
2
2
|
import { OuiDraggable, addDraggable, getDraggableStates, removeDraggable } from "../internal/draggable.mjs";
|
|
3
|
-
import { dispatch, getEventPosition, on } from "@oscarpalmer/toretto/event";
|
|
4
3
|
import { setAttribute } from "@oscarpalmer/toretto/attribute";
|
|
5
|
-
import {
|
|
4
|
+
import { dispatch, getEventPosition, on } from "@oscarpalmer/toretto/event";
|
|
6
5
|
import { getStyles, setStyle, setStyles } from "@oscarpalmer/toretto/style";
|
|
6
|
+
import { isHTMLOrSVGElement } from "@oscarpalmer/toretto/is";
|
|
7
7
|
//#region src/js/movable/movable.embedded.ts
|
|
8
8
|
var OuiMovable = class extends OuiDraggable {
|
|
9
9
|
#element;
|
|
@@ -110,14 +110,11 @@ function onEnd(event, globals, item, reset) {
|
|
|
110
110
|
}
|
|
111
111
|
const container = state.container?.getBoundingClientRect();
|
|
112
112
|
if (container != null) setOffset(state, container);
|
|
113
|
-
|
|
113
|
+
if (dispatch(state.element, "oui:movable:end", { detail: {
|
|
114
114
|
from: { ...globals.original },
|
|
115
115
|
to: getEventPosition(event)
|
|
116
|
-
} });
|
|
117
|
-
|
|
118
|
-
if (dispatched.defaultPrevented) onCancel(globals, item);
|
|
119
|
-
reset();
|
|
120
|
-
});
|
|
116
|
+
} }).defaultPrevented) onCancel(globals, item);
|
|
117
|
+
reset();
|
|
121
118
|
}
|
|
122
119
|
function onMove(_, globals, __, position) {
|
|
123
120
|
setAttribute(globals.element?.node, ATTRIBUTE_MOVING, "");
|
package/dist/js/popover.mjs
CHANGED
|
@@ -2,8 +2,8 @@ import { createEmbeddedFloatable, getOnBeforeToggleListener } from "./floatable/
|
|
|
2
2
|
import { attributable } from "./internal/attributable.mjs";
|
|
3
3
|
import { createFocusTrap } from "./focus-trap/focus-trap.embedded.mjs";
|
|
4
4
|
import { getAria, setAria } from "@oscarpalmer/toretto/aria";
|
|
5
|
-
import { on } from "@oscarpalmer/toretto/event";
|
|
6
5
|
import { setAttribute } from "@oscarpalmer/toretto/attribute";
|
|
6
|
+
import { on } from "@oscarpalmer/toretto/event";
|
|
7
7
|
import { isHTMLOrSVGElement } from "@oscarpalmer/toretto/is";
|
|
8
8
|
//#region src/js/popover.ts
|
|
9
9
|
var OuiPopover = class {
|
|
@@ -74,7 +74,7 @@ function getState(anchor, content) {
|
|
|
74
74
|
anchor,
|
|
75
75
|
content,
|
|
76
76
|
floatable: createEmbeddedFloatable(anchor, content, options),
|
|
77
|
-
focusTrap: getAria(content, "modal") ===
|
|
77
|
+
focusTrap: getAria(content, "modal") === true ? createFocusTrap(content, { noescape: true }) : void 0,
|
|
78
78
|
listeners: [getOnBeforeToggleListener(content), on(content, "toggle", (event) => {
|
|
79
79
|
const expanded = event.newState === "open";
|
|
80
80
|
if (expanded) {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { attributable } from "../internal/attributable.mjs";
|
|
2
|
-
import { dispatch, getEventPosition, on } from "@oscarpalmer/toretto/event";
|
|
3
|
-
import { isPlainObject } from "@oscarpalmer/atoms/is";
|
|
4
|
-
import { getAttribute, setAttribute } from "@oscarpalmer/toretto/attribute";
|
|
5
|
-
import { isHTMLOrSVGElement } from "@oscarpalmer/toretto/is";
|
|
6
|
-
import { setStyles, toggleStyles } from "@oscarpalmer/toretto/style";
|
|
7
2
|
import { getNumber } from "@oscarpalmer/atoms/number";
|
|
3
|
+
import { getAttribute, setAttribute } from "@oscarpalmer/toretto/attribute";
|
|
4
|
+
import { dispatch, getEventPosition, on } from "@oscarpalmer/toretto/event";
|
|
8
5
|
import { findAncestor } from "@oscarpalmer/toretto/find";
|
|
6
|
+
import { setStyles, toggleStyles } from "@oscarpalmer/toretto/style";
|
|
9
7
|
import supportsTouch from "@oscarpalmer/toretto/touch";
|
|
8
|
+
import { isPlainObject } from "@oscarpalmer/atoms/is";
|
|
9
|
+
import { isHTMLOrSVGElement } from "@oscarpalmer/toretto/is";
|
|
10
10
|
//#region src/js/resizable/resizable.embedded.ts
|
|
11
11
|
var OuiResizable = class {
|
|
12
12
|
#state;
|
|
@@ -49,7 +49,7 @@ function cancelResize(item) {
|
|
|
49
49
|
width: `${item.state.width}px`
|
|
50
50
|
});
|
|
51
51
|
resetResizable();
|
|
52
|
-
dispatch(item.state.element, "resizable:cancel");
|
|
52
|
+
dispatch(item.state.element, "oui:resizable:cancel");
|
|
53
53
|
}
|
|
54
54
|
/**
|
|
55
55
|
* Creates _(or retrieves)_ a _OuiResizable_ instance for an element
|
|
@@ -130,14 +130,11 @@ function onPointerdown(event) {
|
|
|
130
130
|
const position = getEventPosition(event);
|
|
131
131
|
if (stored == null || position == null) return;
|
|
132
132
|
if (supportsTouch.value) event.preventDefault();
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
current.state.styles.set();
|
|
139
|
-
styleToggler.set();
|
|
140
|
-
});
|
|
133
|
+
if (dispatch(element, "oui:resizable:begin").defaultPrevented) return;
|
|
134
|
+
current = stored;
|
|
135
|
+
start = position;
|
|
136
|
+
current.state.styles.set();
|
|
137
|
+
styleToggler.set();
|
|
141
138
|
}
|
|
142
139
|
function onPointermove(event) {
|
|
143
140
|
if (current == null) return;
|
|
@@ -149,27 +146,20 @@ function onPointermove(event) {
|
|
|
149
146
|
height,
|
|
150
147
|
width
|
|
151
148
|
});
|
|
152
|
-
|
|
149
|
+
if (dispatch(current.state.element, "oui:resizable:resize", { detail: {
|
|
153
150
|
height,
|
|
154
151
|
width
|
|
155
|
-
} });
|
|
156
|
-
setTimeout(() => {
|
|
157
|
-
if (dispatched.defaultPrevented) cancelResize(current);
|
|
158
|
-
});
|
|
152
|
+
} }).defaultPrevented) cancelResize(current);
|
|
159
153
|
}
|
|
160
154
|
function onPointerup() {
|
|
161
|
-
if (current == null)
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
current.state.height = height;
|
|
170
|
-
current.state.width = width;
|
|
171
|
-
resetResizable();
|
|
172
|
-
});
|
|
155
|
+
if (current == null || dispatch(current.state.element, "oui:resizable:end").defaultPrevented) {
|
|
156
|
+
cancelResize(current);
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
const { height, width } = current.state.element.getBoundingClientRect();
|
|
160
|
+
current.state.height = height;
|
|
161
|
+
current.state.width = width;
|
|
162
|
+
resetResizable();
|
|
173
163
|
}
|
|
174
164
|
function removeResizable(element) {
|
|
175
165
|
items.get(element)?.instance.destroy();
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { attributable } from "../internal/attributable.mjs";
|
|
2
2
|
import { OuiDraggable, addDraggable, getDraggableStates, removeDraggable } from "../internal/draggable.mjs";
|
|
3
|
-
import { dispatch, getEventPosition } from "@oscarpalmer/toretto/event";
|
|
4
3
|
import { getAttribute, setAttribute, setAttributes } from "@oscarpalmer/toretto/attribute";
|
|
5
|
-
import { isHTMLOrSVGElement } from "@oscarpalmer/toretto/is";
|
|
6
|
-
import { setStyle } from "@oscarpalmer/toretto/style";
|
|
7
|
-
import { findAncestor, getElementFromPosition } from "@oscarpalmer/toretto/find";
|
|
8
4
|
import { createElement } from "@oscarpalmer/toretto/create";
|
|
5
|
+
import { dispatch, getEventPosition } from "@oscarpalmer/toretto/event";
|
|
6
|
+
import { findAncestor, getElementFromPosition } from "@oscarpalmer/toretto/find";
|
|
7
|
+
import { setStyle } from "@oscarpalmer/toretto/style";
|
|
8
|
+
import { isHTMLOrSVGElement } from "@oscarpalmer/toretto/is";
|
|
9
9
|
//#region src/js/sortable/sortable.embedded.ts
|
|
10
10
|
var OuiSortable = class extends OuiDraggable {
|
|
11
11
|
constructor(element, options) {
|
package/dist/js/splitter.mjs
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
+
import { round } from "@oscarpalmer/atoms/math";
|
|
2
|
+
import { clamp } from "@oscarpalmer/atoms/number";
|
|
1
3
|
import { setAria } from "@oscarpalmer/toretto/aria";
|
|
2
|
-
import { getEventPosition, on } from "@oscarpalmer/toretto/event";
|
|
3
|
-
import { isNullableOrWhitespace } from "@oscarpalmer/atoms/is";
|
|
4
4
|
import { getAttribute, setAttribute } from "@oscarpalmer/toretto/attribute";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { createElement } from "@oscarpalmer/toretto/create";
|
|
6
|
+
import { getEventPosition, on } from "@oscarpalmer/toretto/event";
|
|
7
7
|
import { findAncestor } from "@oscarpalmer/toretto/find";
|
|
8
|
+
import { setStyle, toggleStyles } from "@oscarpalmer/toretto/style";
|
|
8
9
|
import supportsTouch from "@oscarpalmer/toretto/touch";
|
|
9
|
-
import {
|
|
10
|
+
import { isNullableOrWhitespace } from "@oscarpalmer/atoms/is";
|
|
10
11
|
//#region src/js/splitter.ts
|
|
11
12
|
const ATTRIBUTE_MAX = "max";
|
|
12
13
|
const ATTRIBUTE_MIN = "min";
|
|
@@ -135,21 +136,23 @@ var OuiSplitterElement = class extends HTMLElement {
|
|
|
135
136
|
}
|
|
136
137
|
};
|
|
137
138
|
function createHandle() {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
139
|
+
return createElement("span", {
|
|
140
|
+
aria: { hidden: true },
|
|
141
|
+
attribute: { [ATTRIBUTE_HANDLE]: "" }
|
|
142
|
+
});
|
|
142
143
|
}
|
|
143
144
|
function createSeparator(splitter) {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
145
|
+
return createElement("div", {
|
|
146
|
+
aria: {
|
|
147
|
+
controls: splitter.element.id,
|
|
148
|
+
label: "Resize panels"
|
|
149
|
+
},
|
|
150
|
+
attribute: { [ATTRIBUTE_SEPARATOR]: "" },
|
|
151
|
+
property: {
|
|
152
|
+
role: "separator",
|
|
153
|
+
tabIndex: 0
|
|
154
|
+
}
|
|
150
155
|
});
|
|
151
|
-
setAttribute(separator, ATTRIBUTE_SEPARATOR, "");
|
|
152
|
-
return separator;
|
|
153
156
|
}
|
|
154
157
|
function getContained(min, value, max) {
|
|
155
158
|
return round(clamp(value, min, max), VALUE_DECIMALS);
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { createEmbeddedFloatable } from "./floatable/floatable.embedded.mjs";
|
|
2
2
|
import { getLocalizations, updateLocalizations } from "./l10n.mjs";
|
|
3
3
|
import { LISTBOX_KEYS, LISTBOX_TYPES } from "./internal/listbox/listbox.constants.mjs";
|
|
4
|
-
import { b as updateListboxValueLabel, i as filterListboxOptions, n as filterListbox, r as filterListboxOption, s as toggleListboxOption, t as applyListboxSelection, v as updateListboxMessage, x as generateListboxIds, y as updateListboxPreview } from "./listbox.data-
|
|
4
|
+
import { b as updateListboxValueLabel, i as filterListboxOptions, n as filterListbox, r as filterListboxOption, s as toggleListboxOption, t as applyListboxSelection, v as updateListboxMessage, x as generateListboxIds, y as updateListboxPreview } from "./listbox.data-C7CRa5Ya.mjs";
|
|
5
5
|
import { initializeListboxState } from "./internal/listbox/listbox.state.mjs";
|
|
6
6
|
import { COMBOBOX_ATTRIBUTES, COMBOBOX_ATTRIBUTE_SELECTION_ITEM, COMBOBOX_AUTOCOMPLETES, COMBOBOX_MESSAGES, COMBOBOX_SELECTORS, COMBOBOX_TAGNAME } from "./combobox/constants.combobox.mjs";
|
|
7
7
|
import { getAttributeValue, getBooleanAriaValue } from "./internal/misc.mjs";
|
|
8
8
|
import { createComboboxAnchor, createComboboxContent, updateComboboxAutocomplete, updateComboboxSelection, updateComboboxSelectionItems, updateComboboxTabindices } from "./combobox/dom.combobox.mjs";
|
|
9
9
|
import { processListboxKeydown } from "./internal/listbox/listbox.event.mjs";
|
|
10
|
+
import { clamp } from "@oscarpalmer/atoms/number";
|
|
10
11
|
import { setAria } from "@oscarpalmer/toretto/aria";
|
|
11
|
-
import { on } from "@oscarpalmer/toretto/event";
|
|
12
12
|
import { setAttributes } from "@oscarpalmer/toretto/attribute";
|
|
13
|
-
import {
|
|
13
|
+
import { on } from "@oscarpalmer/toretto/event";
|
|
14
14
|
import { getData } from "@oscarpalmer/toretto/data";
|
|
15
15
|
import { findAncestor, getData as getData$1 } from "@oscarpalmer/toretto";
|
|
16
16
|
import { noop } from "@oscarpalmer/atoms/function";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
//#region src/js/tabs.d.ts
|
|
2
|
+
declare global {
|
|
3
|
+
interface HTMLElementTagNameMap {
|
|
4
|
+
[TAGNAME]: OuiTabsElement;
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
declare class OuiTabsEvent extends Event {
|
|
8
|
+
oldIndex: number;
|
|
9
|
+
newIndex: number;
|
|
10
|
+
constructor(name: 'oui:beforechange' | 'oui:change', oldIndex: number, newIndex: number, cancelable: boolean);
|
|
11
|
+
}
|
|
12
|
+
declare class OuiTabsElement extends HTMLElement {
|
|
13
|
+
#private;
|
|
14
|
+
static observedAttributes: string[];
|
|
15
|
+
get active(): number;
|
|
16
|
+
set active(value: number);
|
|
17
|
+
get panel(): HTMLElement;
|
|
18
|
+
get tab(): HTMLButtonElement;
|
|
19
|
+
attributeChangedCallback(name: string, _: string | null, value: string | null): void;
|
|
20
|
+
connectedCallback(): void;
|
|
21
|
+
disconnectedCallback(): void;
|
|
22
|
+
}
|
|
23
|
+
declare const TAGNAME = "oui-tabs";
|
|
24
|
+
//#endregion
|
|
25
|
+
export { OuiTabsElement, OuiTabsEvent };
|