@oscarpalmer/oui 0.39.0 → 0.40.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/js/color-picker/color-picker.constants.d.mts +2 -0
- package/dist/js/color-picker/{constants.color-picker.mjs → color-picker.constants.mjs} +5 -4
- package/dist/js/color-picker/{dom.color-picker.d.mts → color-picker.dom.d.mts} +2 -2
- package/dist/js/color-picker/{dom.color-picker.mjs → color-picker.dom.mjs} +3 -3
- package/dist/js/color-picker/{event.color-picker.d.mts → color-picker.event.d.mts} +2 -2
- package/dist/js/color-picker/{event.color-picker.mjs → color-picker.event.mjs} +1 -1
- package/dist/js/color-picker/{form.color-picker.d.mts → color-picker.form.d.mts} +2 -2
- package/dist/js/color-picker/{form.color-picker.mjs → color-picker.form.mjs} +9 -6
- package/dist/js/color-picker/color-picker.misc.d.mts +2 -0
- package/dist/js/color-picker/{misc.color-picker.mjs → color-picker.misc.mjs} +1 -1
- package/dist/js/color-picker/color-picker.model.d.mts +2 -0
- package/dist/js/color-picker/{models.color-picker.mjs → color-picker.model.mjs} +1 -1
- package/dist/js/color-picker/{output.color-picker.d.mts → color-picker.output.d.mts} +2 -2
- package/dist/js/color-picker/{output.color-picker.mjs → color-picker.output.mjs} +13 -11
- package/dist/js/color-picker/color-picker.state.d.mts +8 -0
- package/dist/js/color-picker/color-picker.state.mjs +2 -0
- package/dist/js/color-picker/index.d.mts +180 -2
- package/dist/js/color-picker/index.mjs +59 -57
- package/dist/js/color-picker.constants-D1mxw_Le.d.mts +179 -0
- package/dist/js/{event.color-picker-BEpq0Adu.mjs → color-picker.event-Cksj5TvS.mjs} +105 -90
- package/dist/js/color-picker.misc-CtsXGrOe.d.mts +27 -0
- package/dist/js/combobox/combobox.constants.d.mts +2 -0
- package/dist/js/combobox/{constants.combobox.mjs → combobox.constants.mjs} +21 -21
- package/dist/js/combobox/{dom.combobox.d.mts → combobox.dom.d.mts} +3 -3
- package/dist/js/combobox/{dom.combobox.mjs → combobox.dom.mjs} +40 -36
- package/dist/js/combobox/{event.combobox.d.mts → combobox.event.d.mts} +3 -3
- package/dist/js/combobox/{event.combobox.mjs → combobox.event.mjs} +1 -1
- package/dist/js/combobox/combobox.misc.d.mts +2 -0
- package/dist/js/combobox/{misc.combobox.mjs → combobox.misc.mjs} +1 -1
- package/dist/js/combobox/combobox.model.d.mts +2 -0
- package/dist/js/combobox/combobox.state.d.mts +10 -0
- package/dist/js/combobox/combobox.state.mjs +2 -0
- package/dist/js/combobox/index.d.mts +163 -2
- package/dist/js/combobox/index.mjs +53 -52
- package/dist/js/combobox.constants-DZVkMP5g.d.mts +19 -0
- package/dist/js/combobox.misc-C1tPZZDi.d.mts +22 -0
- package/dist/js/combobox.model-oDV06XCN.d.mts +44 -0
- package/dist/js/{state.combobox-BWDFHwoi.mjs → combobox.state-BfJ3Hxg8.mjs} +94 -80
- package/dist/js/constants.listbox-C5Ap6Ag_.d.mts +9 -0
- package/dist/js/dialog/dialog.model.d.mts +2 -0
- package/dist/js/dialog/dialog.model.mjs +11 -0
- package/dist/js/dialog/index.d.mts +12 -0
- package/dist/js/dialog/index.mjs +123 -0
- package/dist/js/dialog.model-DX2mndMh.d.mts +45 -0
- package/dist/js/floatable/floatable.embedded.d.mts +2 -2
- package/dist/js/floatable/floatable.embedded.mjs +64 -92
- package/dist/js/floatable/floatable.model.d.mts +2 -0
- package/dist/js/floatable/floatable.model.mjs +23 -0
- package/dist/js/floatable/floatable.standalone.d.mts +2 -1
- package/dist/js/floatable.embedded-MeTyXjFn.d.mts +17 -0
- package/dist/js/{floatable.embedded-DQYkXt8X.d.mts → floatable.model-DXsQgoU7.d.mts} +13 -20
- package/dist/js/focus-trap/focus-trap.embedded.d.mts +2 -2
- package/dist/js/focus-trap/focus-trap.embedded.mjs +113 -135
- package/dist/js/focus-trap/focus-trap.model.d.mts +2 -0
- package/dist/js/focus-trap/focus-trap.model.mjs +15 -0
- package/dist/js/focus-trap/focus-trap.standalone.d.mts +2 -1
- package/dist/js/focus-trap.embedded-DIU05m1z.d.mts +13 -0
- package/dist/js/{focus-trap.embedded-CjyFQYow.d.mts → focus-trap.model-BeX6UYlw.d.mts} +16 -18
- package/dist/js/index.d.mts +26 -14
- package/dist/js/index.mjs +18 -17
- package/dist/js/internal/attributable.mjs +3 -2
- package/dist/js/internal/draggable/draggable.model.d.mts +2 -0
- package/dist/js/internal/draggable/draggable.model.mjs +37 -0
- package/dist/js/internal/draggable/index.d.mts +13 -0
- package/dist/js/internal/{draggable.mjs → draggable/index.mjs} +82 -113
- package/dist/js/internal/listbox/listbox.constants.d.mts +1 -1
- package/dist/js/internal/listbox/listbox.data.d.mts +1 -1
- package/dist/js/internal/listbox/listbox.data.mjs +1 -1
- package/dist/js/internal/listbox/listbox.dom.d.mts +1 -1
- package/dist/js/internal/listbox/listbox.dom.mjs +1 -1
- package/dist/js/internal/listbox/listbox.event.d.mts +1 -1
- package/dist/js/internal/listbox/listbox.event.mjs +20 -17
- package/dist/js/internal/listbox/listbox.form.d.mts +1 -1
- package/dist/js/internal/listbox/listbox.form.mjs +15 -12
- package/dist/js/internal/listbox/listbox.misc.d.mts +1 -1
- package/dist/js/internal/listbox/listbox.misc.mjs +1 -1
- package/dist/js/internal/listbox/listbox.model.d.mts +2 -2
- package/dist/js/internal/listbox/listbox.state.d.mts +4 -4
- package/dist/js/internal/listbox/listbox.state.mjs +19 -20
- package/dist/js/internal/misc.d.mts +1 -0
- package/dist/js/internal/misc.mjs +4 -6
- package/dist/js/internal/navigable/index.d.mts +6 -0
- package/dist/js/internal/navigable/index.mjs +125 -0
- package/dist/js/internal/navigable/navigable.model.d.mts +2 -0
- package/dist/js/internal/navigable/navigable.model.mjs +18 -0
- package/dist/js/l10n/index.d.mts +9 -0
- package/dist/js/{l10n.mjs → l10n/index.mjs} +50 -23
- package/dist/js/l10n/l10n.model.d.mts +2 -0
- package/dist/js/l10n/l10n.model.mjs +9 -0
- package/dist/js/l10n.model-D6a9frgl.d.mts +26 -0
- package/dist/js/listbox/constants.listbox.d.mts +2 -2
- package/dist/js/listbox/constants.listbox.mjs +10 -14
- package/dist/js/listbox/event.listbox.d.mts +1 -1
- package/dist/js/listbox/event.listbox.mjs +47 -1
- package/dist/js/listbox/index.d.mts +6 -4
- package/dist/js/listbox/index.mjs +47 -49
- package/dist/js/listbox/misc.listbox.d.mts +1 -1
- package/dist/js/listbox/misc.listbox.mjs +1 -1
- package/dist/js/listbox/state.listbox.d.mts +4 -5
- package/dist/js/listbox/state.listbox.mjs +2 -2
- package/dist/js/{listbox.data-DQ7-x2uY.mjs → listbox.data-BQyZGKgr.mjs} +87 -70
- package/dist/js/{listbox.model-BHPA7GM4.d.mts → listbox.model-CuBOj4qe.d.mts} +12 -8
- package/dist/js/menu/index.mjs +167 -0
- package/dist/js/menu/menu.model.d.mts +33 -0
- package/dist/js/menu/menu.model.mjs +15 -0
- package/dist/js/{misc.listbox-DKB-j0UK.mjs → misc.listbox-CjfBUbHD.mjs} +25 -67
- package/dist/js/{misc.listbox-mZMuYOxg.d.mts → misc.listbox-CtoGvXQo.d.mts} +2 -2
- package/dist/js/movable/movable.embedded.d.mts +2 -2
- package/dist/js/movable/movable.embedded.mjs +60 -72
- package/dist/js/movable/movable.model.d.mts +2 -0
- package/dist/js/movable/movable.model.mjs +12 -0
- package/dist/js/movable/movable.standalone.d.mts +2 -1
- package/dist/js/movable.embedded-DoyXLegc.d.mts +11 -0
- package/dist/js/{draggable-B5-70SZm.d.mts → movable.model-BHaK_mKw.d.mts} +81 -50
- package/dist/js/navigable.model-BPOM8DZk.d.mts +44 -0
- package/dist/js/popover/index.d.mts +12 -0
- package/dist/js/{popover.mjs → popover/index.mjs} +41 -51
- package/dist/js/popover/popover.model.d.mts +2 -0
- package/dist/js/popover/popover.model.mjs +12 -0
- package/dist/js/popover.model-ubKNG612.d.mts +38 -0
- package/dist/js/resizable/resizable.embedded.d.mts +2 -2
- package/dist/js/resizable/resizable.embedded.mjs +43 -58
- package/dist/js/resizable/resizable.model.d.mts +2 -0
- package/dist/js/resizable/resizable.model.mjs +21 -0
- package/dist/js/resizable/resizable.standalone.d.mts +2 -1
- package/dist/js/resizable.embedded-Bf1qBUdt.d.mts +11 -0
- package/dist/js/resizable.model-BwzJcTVJ.d.mts +46 -0
- package/dist/js/sortable/sortable.embedded.d.mts +2 -2
- package/dist/js/sortable/sortable.embedded.mjs +69 -82
- package/dist/js/sortable/sortable.model.d.mts +2 -0
- package/dist/js/sortable/sortable.model.mjs +24 -0
- package/dist/js/sortable/sortable.standalone.d.mts +2 -1
- package/dist/js/sortable.embedded-DzBKAwSG.d.mts +11 -0
- package/dist/js/{splitter.d.mts → splitter/index.d.mts} +6 -4
- package/dist/js/{splitter.mjs → splitter/index.mjs} +90 -128
- package/dist/js/splitter/splitter.model.d.mts +2 -0
- package/dist/js/splitter/splitter.model.mjs +37 -0
- package/dist/js/splitter.model-DOLNjLVS.d.mts +57 -0
- package/dist/js/{tabs.d.mts → tabs/index.d.mts} +7 -7
- package/dist/js/{tabs.mjs → tabs/index.mjs} +58 -58
- package/dist/js/tabs/tabs.model.d.mts +2 -0
- package/dist/js/tabs/tabs.model.mjs +18 -0
- package/dist/js/tabs.model-DRBX_JtI.d.mts +40 -0
- package/dist/js/toolbar/index.mjs +27 -0
- package/dist/js/toolbar/toolbar.model.d.mts +11 -0
- package/dist/js/toolbar/toolbar.model.mjs +7 -0
- package/dist/js/tooltip/index.d.mts +19 -0
- package/dist/js/{tooltip.mjs → tooltip/index.mjs} +61 -86
- package/dist/js/tooltip/tooltip.model.d.mts +2 -0
- package/dist/js/tooltip/tooltip.model.mjs +15 -0
- package/dist/js/tooltip.model-DRkY_BsL.d.mts +37 -0
- package/package.json +30 -24
- package/dist/js/color-picker/constants.color-picker.d.mts +0 -2
- package/dist/js/color-picker/misc.color-picker.d.mts +0 -2
- package/dist/js/color-picker/models.color-picker.d.mts +0 -2
- package/dist/js/color-picker/state.color-picker.d.mts +0 -8
- package/dist/js/color-picker/state.color-picker.mjs +0 -2
- package/dist/js/combobox/constants.combobox.d.mts +0 -2
- package/dist/js/combobox/misc.combobox.d.mts +0 -2
- package/dist/js/combobox/models.combobox.d.mts +0 -43
- package/dist/js/combobox/state.combobox.d.mts +0 -11
- package/dist/js/combobox/state.combobox.mjs +0 -2
- package/dist/js/constants.color-picker-B-gFjL8m.d.mts +0 -364
- package/dist/js/constants.combobox-8EMRmv09.d.mts +0 -18
- package/dist/js/constants.listbox-DGnX32kv.d.mts +0 -8
- package/dist/js/dialog.d.mts +0 -47
- package/dist/js/dialog.mjs +0 -131
- package/dist/js/index-C5D3-oiI.d.mts +0 -177
- package/dist/js/internal/draggable.d.mts +0 -2
- package/dist/js/internal/navigable.d.mts +0 -36
- package/dist/js/internal/navigable.mjs +0 -135
- package/dist/js/l10n-Bn-7RcwR.d.mts +0 -20
- package/dist/js/l10n.d.mts +0 -2
- package/dist/js/menu.mjs +0 -172
- package/dist/js/popover.d.mts +0 -38
- package/dist/js/resizable.embedded-dvhdfQgt.d.mts +0 -34
- package/dist/js/toolbar.mjs +0 -31
- package/dist/js/tooltip.d.mts +0 -45
- /package/dist/js/combobox/{models.combobox.mjs → combobox.model.mjs} +0 -0
- /package/dist/js/{menu.d.mts → menu/index.d.mts} +0 -0
- /package/dist/js/{toolbar.d.mts → toolbar/index.d.mts} +0 -0
|
@@ -1,30 +1,31 @@
|
|
|
1
1
|
import { createEmbeddedFloatable } from "./floatable/floatable.embedded.mjs";
|
|
2
|
-
import { getLocalization, localize, updateLocalizations } from "./l10n.mjs";
|
|
3
|
-
import { COLOR_PICKER_ATTRIBUTE_COPY_ERROR, COLOR_PICKER_ATTRIBUTE_COPY_SUCCESS, COLOR_PICKER_EXPRESSION_HEX_PREFIX, COLOR_PICKER_INPUT_TYPES, COLOR_PICKER_KEYS, COLOR_PICKER_MESSAGE_INPUT, COLOR_PICKER_MESSAGE_LABEL, COLOR_PICKER_OUTPUTS, COLOR_PICKER_SELECTOR_COPY, COLOR_PICKER_SELECTOR_INPUT, COLOR_PICKER_SELECTOR_OUTPUT_INPUT, COLOR_PICKER_SELECTOR_WELL, COLOR_PICKER_SELECTOR_WELL_KNOB, COLOR_PICKER_TAGNAME, colorPickerLocalizations } from "./color-picker/
|
|
2
|
+
import { getLocalization, localize, updateLocalizations } from "./l10n/index.mjs";
|
|
3
|
+
import { COLOR_PICKER_ATTRIBUTE_COPY_ERROR, COLOR_PICKER_ATTRIBUTE_COPY_SUCCESS, COLOR_PICKER_EXPRESSION_HEX_PREFIX, COLOR_PICKER_INPUT_TYPES, COLOR_PICKER_KEYS, COLOR_PICKER_MESSAGE_INPUT, COLOR_PICKER_MESSAGE_LABEL, COLOR_PICKER_OUTPUTS, COLOR_PICKER_SELECTOR_COPY, COLOR_PICKER_SELECTOR_INPUT, COLOR_PICKER_SELECTOR_OUTPUT_INPUT, COLOR_PICKER_SELECTOR_WELL, COLOR_PICKER_SELECTOR_WELL_KNOB, COLOR_PICKER_SYMBOL, COLOR_PICKER_TAGNAME, colorPickerLocalizations } from "./color-picker/color-picker.constants.mjs";
|
|
4
4
|
import { copyValue } from "./internal/misc.mjs";
|
|
5
|
-
import { OuiColorPickerEvent } from "./color-picker/
|
|
6
|
-
import { updateColorPickerForm, updateColorPickerValidity } from "./color-picker/
|
|
7
|
-
import { getColorPickerOutputFormat, updateColorPickerOutputCopyLabel, updateColorPickerOutputInputs, updateColorPickerOutputLabels } from "./color-picker/
|
|
8
|
-
import { createColorPickerAnchor, createColorPickerContent } from "./color-picker/
|
|
5
|
+
import { OuiColorPickerEvent } from "./color-picker/color-picker.model.mjs";
|
|
6
|
+
import { updateColorPickerForm, updateColorPickerValidity } from "./color-picker/color-picker.form.mjs";
|
|
7
|
+
import { getColorPickerOutputFormat, updateColorPickerOutputCopyLabel, updateColorPickerOutputInputs, updateColorPickerOutputLabels } from "./color-picker/color-picker.output.mjs";
|
|
8
|
+
import { createColorPickerAnchor, createColorPickerContent } from "./color-picker/color-picker.dom.mjs";
|
|
9
9
|
import { getAria, setAria } from "@oscarpalmer/toretto/aria";
|
|
10
|
+
import { getAttribute, setAttribute, setAttributes } from "@oscarpalmer/toretto/attribute";
|
|
10
11
|
import { dispatch, getEventPosition, on } from "@oscarpalmer/toretto/event";
|
|
11
|
-
import { setAttribute, setAttributes } from "@oscarpalmer/toretto/attribute";
|
|
12
|
-
import { toggleStyles } from "@oscarpalmer/toretto/style";
|
|
13
12
|
import { findAncestor } from "@oscarpalmer/toretto/find";
|
|
13
|
+
import { toggleStyles } from "@oscarpalmer/toretto/style";
|
|
14
|
+
import { clamp } from "@oscarpalmer/atoms/number";
|
|
14
15
|
import { supportsTouch } from "@oscarpalmer/toretto/touch";
|
|
16
|
+
import { createElement } from "@oscarpalmer/toretto/create";
|
|
15
17
|
import { getColor, getForegroundColor, isHexColor, isHslColor, isHslaColor, isHwbColor, isHwbaColor, isRgbColor, isRgbaColor } from "@oscarpalmer/atoms/color";
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
import { createElement as createElement$1 } from "@oscarpalmer/toretto/create";
|
|
19
|
-
//#region src/js/color-picker/state.color-picker.ts
|
|
18
|
+
import { setProperty } from "@oscarpalmer/toretto/property";
|
|
19
|
+
//#region src/js/color-picker/color-picker.state.ts
|
|
20
20
|
function attachColorPicker(state) {
|
|
21
|
-
const {
|
|
21
|
+
const { component } = state;
|
|
22
|
+
const { anchor, content, host, id, inline, input, label, listeners, style } = state.component;
|
|
22
23
|
if (!inline) {
|
|
23
|
-
|
|
24
|
+
component.floatable = createEmbeddedFloatable(anchor.container ?? anchor.container, content.element, {
|
|
24
25
|
position: "below-start",
|
|
25
26
|
reusable: false
|
|
26
27
|
});
|
|
27
|
-
|
|
28
|
+
component.floatable.update();
|
|
28
29
|
}
|
|
29
30
|
const labelId = `${id}_label`;
|
|
30
31
|
setAria(host, {
|
|
@@ -39,14 +40,14 @@ function attachColorPicker(state) {
|
|
|
39
40
|
input.remove();
|
|
40
41
|
listeners.push(on(host, "focusout", () => {
|
|
41
42
|
setTimeout(() => {
|
|
42
|
-
if (colorPickerMovement.parameters == null && !host.contains(document.activeElement))
|
|
43
|
+
if (colorPickerMovement.parameters == null && !host.contains(document.activeElement)) component.floatable?.hide();
|
|
43
44
|
});
|
|
44
45
|
}), on(anchor.input, "change", () => {
|
|
45
46
|
onColorPickerInput(state);
|
|
46
47
|
}), on(anchor.input, "input", () => {
|
|
47
48
|
onColorPickerInput(state);
|
|
48
49
|
}), on(content.element, "beforetoggle", (event) => {
|
|
49
|
-
if (
|
|
50
|
+
if (component.disabled) event.preventDefault();
|
|
50
51
|
}, { passive: false }), on(content.element, "toggle", (event) => {
|
|
51
52
|
const open = event.newState === "open";
|
|
52
53
|
if (anchor.toggle != null) setAria(anchor.toggle, "expanded", open);
|
|
@@ -64,11 +65,11 @@ function attachColorPicker(state) {
|
|
|
64
65
|
}), on(content.output.toggle, "change", () => {
|
|
65
66
|
onColorPickerOutputFormat(state);
|
|
66
67
|
}));
|
|
67
|
-
|
|
68
|
-
colorPickerSet.add(state);
|
|
68
|
+
colorPickers.add(state);
|
|
69
69
|
}
|
|
70
70
|
function detachColorPicker(state) {
|
|
71
|
-
const {
|
|
71
|
+
const { component } = state;
|
|
72
|
+
const { anchor, content, floatable, host, input, label, style } = component;
|
|
72
73
|
floatable?.destroy();
|
|
73
74
|
setAria(host, {
|
|
74
75
|
describedby: void 0,
|
|
@@ -81,13 +82,20 @@ function detachColorPicker(state) {
|
|
|
81
82
|
anchor.container.remove();
|
|
82
83
|
content.element.remove();
|
|
83
84
|
style.remove();
|
|
84
|
-
const listeners =
|
|
85
|
+
const listeners = component.listeners.splice(0);
|
|
85
86
|
const { length } = listeners;
|
|
86
87
|
for (let index = 0; index < length; index += 1) listeners[index]();
|
|
87
|
-
|
|
88
|
-
|
|
88
|
+
colorPickers.delete(state);
|
|
89
|
+
}
|
|
90
|
+
function initializeColorPicker(colorPicker) {
|
|
91
|
+
const state = colorPicker[COLOR_PICKER_SYMBOL];
|
|
92
|
+
colorPicker[COLOR_PICKER_SYMBOL].component = initializeColorPickerComponent(colorPicker, state);
|
|
93
|
+
if (state.form.restored != null) {
|
|
94
|
+
colorPicker.value = state.form.restored;
|
|
95
|
+
state.form.restored = void 0;
|
|
96
|
+
}
|
|
89
97
|
}
|
|
90
|
-
function
|
|
98
|
+
function initializeColorPickerComponent(element, state) {
|
|
91
99
|
const input = element.querySelector("input");
|
|
92
100
|
if (input == null || !COLOR_PICKER_INPUT_TYPES.has(input.type)) throw new Error(COLOR_PICKER_MESSAGE_INPUT);
|
|
93
101
|
const label = element.querySelector(`label[for="${input.id}"]`);
|
|
@@ -115,7 +123,7 @@ function initializeColorPicker(element, internals) {
|
|
|
115
123
|
const anchor = createColorPickerAnchor(parameters);
|
|
116
124
|
const content = createColorPickerContent(parameters);
|
|
117
125
|
const formatted = color.toHexString(alpha);
|
|
118
|
-
|
|
126
|
+
state.component = {
|
|
119
127
|
alpha,
|
|
120
128
|
anchor,
|
|
121
129
|
content,
|
|
@@ -124,7 +132,6 @@ function initializeColorPicker(element, internals) {
|
|
|
124
132
|
id,
|
|
125
133
|
inline,
|
|
126
134
|
input,
|
|
127
|
-
internals,
|
|
128
135
|
output,
|
|
129
136
|
readonly,
|
|
130
137
|
required,
|
|
@@ -142,7 +149,7 @@ function initializeColorPicker(element, internals) {
|
|
|
142
149
|
component: {},
|
|
143
150
|
global: colorPickerLocalizations
|
|
144
151
|
},
|
|
145
|
-
style: createElement
|
|
152
|
+
style: createElement("style"),
|
|
146
153
|
value: {
|
|
147
154
|
current: formatted,
|
|
148
155
|
initial: formatted
|
|
@@ -160,24 +167,24 @@ function initializeColorPicker(element, internals) {
|
|
|
160
167
|
setColorPickerRequired(state, required);
|
|
161
168
|
setColorPickerValues(state, false);
|
|
162
169
|
updateColorPickerLabels(state);
|
|
163
|
-
updateColorPickerValidity(state, isHexColor(state.value.current, alpha));
|
|
164
|
-
return state;
|
|
170
|
+
updateColorPickerValidity(state, isHexColor(state.component.value.current, alpha));
|
|
171
|
+
return state.component;
|
|
165
172
|
}
|
|
166
|
-
const
|
|
167
|
-
const colorPickerSet = /* @__PURE__ */ new Set();
|
|
173
|
+
const colorPickers = /* @__PURE__ */ new Set();
|
|
168
174
|
//#endregion
|
|
169
|
-
//#region src/js/color-picker/
|
|
175
|
+
//#region src/js/color-picker/color-picker.misc.ts
|
|
170
176
|
function getColorPickerId() {
|
|
171
177
|
index += 1;
|
|
172
178
|
return `oui_color_picker_${index}`;
|
|
173
179
|
}
|
|
174
180
|
function getColorPickerOutput(element) {
|
|
175
|
-
const attribute = getAttribute
|
|
181
|
+
const attribute = getAttribute(element, "output");
|
|
176
182
|
return COLOR_PICKER_OUTPUTS.has(attribute) ? attribute : "none";
|
|
177
183
|
}
|
|
178
184
|
function getColorPickerValueType(state, value) {
|
|
185
|
+
const { alpha } = state.component;
|
|
179
186
|
switch (true) {
|
|
180
|
-
case isHexColor(value,
|
|
187
|
+
case isHexColor(value, alpha): return alpha ? "hexa" : "hex";
|
|
181
188
|
case isHslColor(value): return "hsl";
|
|
182
189
|
case isHslaColor(value): return "hsla";
|
|
183
190
|
case isHwbColor(value): return "hwb";
|
|
@@ -190,38 +197,41 @@ function setColorPickerLocalizations(first, second) {
|
|
|
190
197
|
updateColorPickerLocalizations(colorPickerLocalizations, colorPickerLocalizations.values, first, second);
|
|
191
198
|
}
|
|
192
199
|
function setColorPickerDisabled(state, type, value) {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
if (
|
|
200
|
+
const { component } = state;
|
|
201
|
+
component[type] = value;
|
|
202
|
+
setAria(component.host, type, value);
|
|
203
|
+
component.anchor.input.readOnly = value;
|
|
204
|
+
setAria(component.anchor.input, type, value);
|
|
205
|
+
setProperty(component.content.hue.input, "disabled", component.disabled || component.readonly);
|
|
206
|
+
if (component.anchor.toggle != null) setAria(component.anchor.toggle, "disabled", component.disabled);
|
|
207
|
+
if (component.content.opacity != null) setProperty(component.content.opacity.input, "disabled", component.disabled || component.readonly);
|
|
200
208
|
}
|
|
201
209
|
function setColorPickerRequired(state, value) {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
setAria
|
|
205
|
-
|
|
210
|
+
const { component } = state;
|
|
211
|
+
component.required = value;
|
|
212
|
+
setAria(component.host, "required", value);
|
|
213
|
+
setAria(component.anchor.input, "required", value);
|
|
214
|
+
updateColorPickerValidity(state, isHexColor(component.value.current, component.alpha));
|
|
206
215
|
}
|
|
207
216
|
function setColorPickerValue(state, value, type) {
|
|
208
217
|
if (state == null) return;
|
|
209
218
|
const actual = type ?? getColorPickerValueType(state, value);
|
|
210
219
|
if (actual == null || type != null && type !== actual) return;
|
|
211
|
-
state.color.value[actual] = value;
|
|
220
|
+
state.component.color.value[actual] = value;
|
|
212
221
|
setColorPickerValues(state, true);
|
|
213
222
|
}
|
|
214
223
|
function setColorPickerValues(state, focus, input) {
|
|
215
|
-
const {
|
|
224
|
+
const { component } = state;
|
|
225
|
+
const { anchor, color, content, host, style } = component;
|
|
216
226
|
color.foreground = getForegroundColor(color.value).hex;
|
|
217
227
|
const { alpha, hex, hsl, rgb } = color.value;
|
|
218
228
|
const { hue, lightness, saturation } = hsl;
|
|
219
229
|
const { blue, green, red } = rgb;
|
|
220
|
-
const value = input ?? color.value.toHexString(
|
|
230
|
+
const value = input ?? color.value.toHexString(component.alpha);
|
|
221
231
|
anchor.input.value = value;
|
|
222
232
|
content.hue.input.valueAsNumber = hue;
|
|
223
233
|
if (content.opacity != null) content.opacity.input.valueAsNumber = alpha;
|
|
224
|
-
|
|
234
|
+
component.value.current = value;
|
|
225
235
|
style.textContent = `#${host.id} {
|
|
226
236
|
--oui-color-picker-alpha: ${alpha};
|
|
227
237
|
--oui-color-picker-blue: ${blue};
|
|
@@ -233,15 +243,15 @@ function setColorPickerValues(state, focus, input) {
|
|
|
233
243
|
--oui-color-picker-red: ${red};
|
|
234
244
|
--oui-color-picker-saturation: ${saturation};
|
|
235
245
|
}`;
|
|
236
|
-
updateColorPickerForm(state, isHexColor(
|
|
246
|
+
updateColorPickerForm(state, isHexColor(component.value.current, component.alpha));
|
|
237
247
|
updateColorPickerOutputInputs(state);
|
|
238
248
|
updateColorPickerWell(state);
|
|
239
249
|
if (focus) content.well.knob.focus();
|
|
240
250
|
}
|
|
241
251
|
function updateColorPickerLabels(state) {
|
|
242
|
-
const { anchor, content, host, localizations } = state;
|
|
252
|
+
const { anchor, content, host, localizations } = state.component;
|
|
243
253
|
const { component, global } = localizations;
|
|
244
|
-
if (anchor.toggle != null) setAria
|
|
254
|
+
if (anchor.toggle != null) setAria(anchor.toggle, "label", localize(getLocalization(global, host, "toggle", component), {}, []));
|
|
245
255
|
content.hue.label.textContent = localize(getLocalization(global, host, "hue", component), {}, []);
|
|
246
256
|
content.well.label.textContent = localize(getLocalization(global, host, "wellLabel", component), {}, []);
|
|
247
257
|
updateColorPickerOutputLabels(state);
|
|
@@ -250,23 +260,23 @@ function updateColorPickerLabels(state) {
|
|
|
250
260
|
}
|
|
251
261
|
function updateColorPickerLocalizations(instance, destination, first, second) {
|
|
252
262
|
updateLocalizations(instance, typeof first === "string" ? { [first]: second } : first, destination, () => {
|
|
253
|
-
for (const state of
|
|
263
|
+
for (const state of colorPickers) updateColorPickerLabels(state);
|
|
254
264
|
});
|
|
255
265
|
}
|
|
256
266
|
function updateColorPickerWell(state) {
|
|
257
|
-
const { color, content, host, localizations } = state;
|
|
267
|
+
const { color, content, host, localizations } = state.component;
|
|
258
268
|
const { component, global } = localizations;
|
|
259
269
|
const { lightness, saturation } = color.value.hsl;
|
|
260
|
-
setAria
|
|
270
|
+
setAria(content.well.knob, "valuetext", localize(getLocalization(global, host, "wellValue", component), {
|
|
261
271
|
lightness,
|
|
262
272
|
saturation
|
|
263
273
|
}, [lightness, saturation]));
|
|
264
274
|
}
|
|
265
275
|
let index = 0;
|
|
266
276
|
//#endregion
|
|
267
|
-
//#region src/js/color-picker/
|
|
277
|
+
//#region src/js/color-picker/color-picker.event.ts
|
|
268
278
|
function cancelMove(parameters) {
|
|
269
|
-
parameters.state.color.value.hexa = parameters.value;
|
|
279
|
+
parameters.state.component.color.value.hexa = parameters.value;
|
|
270
280
|
setColorPickerValues(parameters.state, true);
|
|
271
281
|
colorPickerMovement.parameters = void 0;
|
|
272
282
|
styleToggler.remove();
|
|
@@ -278,9 +288,10 @@ function onClick(event) {
|
|
|
278
288
|
[COLOR_PICKER_ATTRIBUTE_COPY_ERROR]: void 0,
|
|
279
289
|
[COLOR_PICKER_ATTRIBUTE_COPY_SUCCESS]: void 0
|
|
280
290
|
});
|
|
281
|
-
const state =
|
|
282
|
-
if (state == null || state.disabled) return;
|
|
283
|
-
const
|
|
291
|
+
const state = findAncestor(event, COLOR_PICKER_TAGNAME)?.[COLOR_PICKER_SYMBOL];
|
|
292
|
+
if (state == null || state.component.disabled) return;
|
|
293
|
+
const { component } = state;
|
|
294
|
+
const copy = button.dataset.color == null ? component.content.output?.copy : component.anchor.copy;
|
|
284
295
|
if (copy == null) return;
|
|
285
296
|
if (copy.timer != null) {
|
|
286
297
|
clearTimeout(copy.timer);
|
|
@@ -291,37 +302,37 @@ function onClick(event) {
|
|
|
291
302
|
let value;
|
|
292
303
|
switch (color) {
|
|
293
304
|
case "hex":
|
|
294
|
-
value =
|
|
305
|
+
value = component.color.value.toHexString(component.alpha);
|
|
295
306
|
break;
|
|
296
307
|
case "hsl":
|
|
297
|
-
value =
|
|
308
|
+
value = component.color.value.toHslString(component.alpha);
|
|
298
309
|
break;
|
|
299
310
|
case "hwb":
|
|
300
|
-
value =
|
|
311
|
+
value = component.color.value.toHwbString(component.alpha);
|
|
301
312
|
break;
|
|
302
|
-
case "rgb": value =
|
|
313
|
+
case "rgb": value = component.color.value.toRgbString(component.alpha);
|
|
303
314
|
}
|
|
304
315
|
if (value != null) copyValue(value, () => {
|
|
305
|
-
console.log("Copied value to clipboard:", value);
|
|
306
316
|
updateColorPickerCopy(copy, COLOR_PICKER_ATTRIBUTE_COPY_SUCCESS);
|
|
307
317
|
}, () => {
|
|
308
|
-
console.warn("Failed to copy value to clipboard:", value);
|
|
309
318
|
updateColorPickerCopy(copy, COLOR_PICKER_ATTRIBUTE_COPY_ERROR);
|
|
310
319
|
});
|
|
311
320
|
}
|
|
312
321
|
function onColorPickerHue(state) {
|
|
313
|
-
const
|
|
314
|
-
|
|
315
|
-
|
|
322
|
+
const { component } = state;
|
|
323
|
+
const hue = component.content.hue.input.valueAsNumber;
|
|
324
|
+
component.color.value.hsla = {
|
|
325
|
+
...component.color.value.hsla,
|
|
316
326
|
hue
|
|
317
327
|
};
|
|
318
328
|
setColorPickerValues(state, false);
|
|
319
329
|
}
|
|
320
330
|
function onColorPickerInput(state) {
|
|
321
|
-
const {
|
|
331
|
+
const { component } = state;
|
|
332
|
+
const { alpha, anchor, color, host } = component;
|
|
322
333
|
const value = anchor.input.value.replace(COLOR_PICKER_EXPRESSION_HEX_PREFIX, "");
|
|
323
334
|
if (value.toLowerCase() === (alpha ? color.value.hexa : color.value.hex).toLowerCase()) return;
|
|
324
|
-
|
|
335
|
+
component.value.current = anchor.input.value;
|
|
325
336
|
const { length } = value;
|
|
326
337
|
let valid;
|
|
327
338
|
if (alpha) valid = isHexColor(value, true) && (length === 4 || length === 8);
|
|
@@ -334,17 +345,19 @@ function onColorPickerInput(state) {
|
|
|
334
345
|
dispatch(host, new OuiColorPickerEvent("oui:input", color.value, valid));
|
|
335
346
|
}
|
|
336
347
|
function onColorPickerOpacity(state) {
|
|
337
|
-
const
|
|
348
|
+
const { component } = state;
|
|
349
|
+
const opacity = component.content.opacity?.input.valueAsNumber;
|
|
338
350
|
if (opacity == null) return;
|
|
339
|
-
|
|
351
|
+
component.color.value.alpha = opacity;
|
|
340
352
|
setColorPickerValues(state, false);
|
|
341
353
|
}
|
|
342
354
|
function onColorPickerOutputFormat(state) {
|
|
343
|
-
const {
|
|
355
|
+
const { content } = state.component;
|
|
356
|
+
const { items, toggle } = content.output ?? {};
|
|
344
357
|
if (items == null || toggle == null) return;
|
|
345
358
|
const attribute = `${COLOR_PICKER_TAGNAME}-output-${toggle.value}`;
|
|
346
359
|
for (const item of items) item.hidden = !item.hasAttribute(attribute);
|
|
347
|
-
if (
|
|
360
|
+
if (content.output?.copy != null) updateColorPickerOutputCopyLabel(state, content.output.copy.button);
|
|
348
361
|
}
|
|
349
362
|
function onColorPickerOutputValue(event, state) {
|
|
350
363
|
const input = findAncestor(event, COLOR_PICKER_SELECTOR_OUTPUT_INPUT);
|
|
@@ -355,19 +368,20 @@ function onColorPickerOutputValue(event, state) {
|
|
|
355
368
|
if (outputTimer != null) clearTimeout(outputTimer);
|
|
356
369
|
outputTimer = setTimeout(() => {
|
|
357
370
|
outputTimer = void 0;
|
|
358
|
-
state.color.value[color] = {
|
|
359
|
-
...state.color.value[color],
|
|
371
|
+
state.component.color.value[color] = {
|
|
372
|
+
...state.component.color.value[color],
|
|
360
373
|
[property]: input.valueAsNumber
|
|
361
374
|
};
|
|
362
375
|
setColorPickerValues(state, false);
|
|
363
376
|
});
|
|
364
377
|
}
|
|
365
378
|
function onEnter(state) {
|
|
366
|
-
const {
|
|
379
|
+
const { component, form } = state;
|
|
380
|
+
const { alpha, anchor, color } = component;
|
|
367
381
|
const input = anchor.input.value.replace(COLOR_PICKER_EXPRESSION_HEX_PREFIX, "");
|
|
368
382
|
const short = alpha ? input.length === 4 : input.length === 3;
|
|
369
383
|
if (isHexColor(input, alpha) && short) anchor.input.value = color.value.toHexString(alpha);
|
|
370
|
-
internals.form?.requestSubmit();
|
|
384
|
+
form.internals.form?.requestSubmit();
|
|
371
385
|
}
|
|
372
386
|
function onKeydown(event) {
|
|
373
387
|
if (colorPickerMovement.parameters != null && event.key === "Escape") {
|
|
@@ -376,16 +390,17 @@ function onKeydown(event) {
|
|
|
376
390
|
}
|
|
377
391
|
const knob = findAncestor(event, COLOR_PICKER_SELECTOR_WELL_KNOB);
|
|
378
392
|
if (!(event.key === "Enter" && findAncestor(event, COLOR_PICKER_SELECTOR_INPUT) != null || COLOR_PICKER_KEYS.has(event.key) && knob != null)) return;
|
|
379
|
-
const state =
|
|
380
|
-
if (state == null || state.disabled || state.readonly) return;
|
|
393
|
+
const state = findAncestor(event, COLOR_PICKER_TAGNAME)?.[COLOR_PICKER_SYMBOL];
|
|
394
|
+
if (state == null || state.component.disabled || state.component.readonly) return;
|
|
381
395
|
event.preventDefault();
|
|
396
|
+
const { component } = state;
|
|
382
397
|
if (event.key === "Enter") {
|
|
383
398
|
onEnter(state);
|
|
384
399
|
return;
|
|
385
400
|
}
|
|
386
401
|
if (knob == null) return;
|
|
387
402
|
const modifier = event.shiftKey ? 10 : 1;
|
|
388
|
-
let { lightness, saturation } =
|
|
403
|
+
let { lightness, saturation } = component.color.value.hsl;
|
|
389
404
|
switch (event.key) {
|
|
390
405
|
case "ArrowDown":
|
|
391
406
|
lightness -= 1 * modifier;
|
|
@@ -410,8 +425,8 @@ function onKeydown(event) {
|
|
|
410
425
|
break;
|
|
411
426
|
case "PageUp": lightness += 10;
|
|
412
427
|
}
|
|
413
|
-
|
|
414
|
-
...state.color.value.hsl,
|
|
428
|
+
component.color.value.hsl = {
|
|
429
|
+
...state.component.color.value.hsl,
|
|
415
430
|
lightness: clamp(lightness, 0, 100),
|
|
416
431
|
saturation: clamp(saturation, 0, 100)
|
|
417
432
|
};
|
|
@@ -425,12 +440,12 @@ function onPointerdown(event) {
|
|
|
425
440
|
if (element == null) return;
|
|
426
441
|
if (supportsTouch.value) event.preventDefault();
|
|
427
442
|
if (getEventPosition(event) == null) return;
|
|
428
|
-
const state =
|
|
429
|
-
if (state == null || state.disabled || state.readonly) return;
|
|
443
|
+
const state = element?.[COLOR_PICKER_SYMBOL];
|
|
444
|
+
if (state == null || state.component.disabled || state.component.readonly) return;
|
|
430
445
|
colorPickerMovement.parameters = {
|
|
431
446
|
state,
|
|
432
447
|
rectangle: well.getBoundingClientRect(),
|
|
433
|
-
value: state.color.value.hexa
|
|
448
|
+
value: state.component.color.value.hexa
|
|
434
449
|
};
|
|
435
450
|
styleToggler.set();
|
|
436
451
|
}
|
|
@@ -459,8 +474,8 @@ function updateColorPickerValues(parameters, position) {
|
|
|
459
474
|
const { x, y } = position;
|
|
460
475
|
const top = clamp((y - rectangle.top) / rectangle.height, 0, 1);
|
|
461
476
|
const left = clamp((x - rectangle.left) / rectangle.width, 0, 1);
|
|
462
|
-
state.color.value.hsl = {
|
|
463
|
-
...state.color.value.hsl,
|
|
477
|
+
state.component.color.value.hsl = {
|
|
478
|
+
...state.component.color.value.hsl,
|
|
464
479
|
lightness: (1 - top) * 100,
|
|
465
480
|
saturation: left * 100
|
|
466
481
|
};
|
|
@@ -482,4 +497,4 @@ on(document, "pointerup", onPointerup);
|
|
|
482
497
|
on(document, "touchcancel", onPointerup);
|
|
483
498
|
on(document, "touchstart", onPointerdown, { passive: false });
|
|
484
499
|
//#endregion
|
|
485
|
-
export { attachColorPicker as _, onColorPickerOutputFormat as a,
|
|
500
|
+
export { attachColorPicker as _, onColorPickerOutputFormat as a, initializeColorPicker as b, getColorPickerOutput as c, setColorPickerLocalizations as d, setColorPickerRequired as f, updateColorPickerLocalizations as g, updateColorPickerLabels as h, onColorPickerOpacity as i, getColorPickerValueType as l, setColorPickerValues as m, onColorPickerHue as n, onColorPickerOutputValue as o, setColorPickerValue as p, onColorPickerInput as r, getColorPickerId as s, colorPickerMovement as t, setColorPickerDisabled as u, colorPickers as v, initializeColorPickerComponent as x, detachColorPicker as y };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { c as OuiLocalizations } from "./l10n.model-D6a9frgl.mjs";
|
|
2
|
+
import { H as OuiColorPickerValueType, N as OuiColorPickerLocalizations, R as OuiColorPickerOutputType, S as GenericOuiColorPickerElement, z as OuiColorPickerState } from "./color-picker.constants-D1mxw_Le.mjs";
|
|
3
|
+
//#region src/js/color-picker/color-picker.misc.d.ts
|
|
4
|
+
declare function getColorPickerId(): string;
|
|
5
|
+
declare function getColorPickerOutput(element: GenericOuiColorPickerElement): OuiColorPickerOutputType;
|
|
6
|
+
declare function getColorPickerValueType(state: OuiColorPickerState, value: unknown): OuiColorPickerValueType | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* Set localizations for a specific language
|
|
9
|
+
*
|
|
10
|
+
* @param language Language code
|
|
11
|
+
* @param localizations Localizations for language
|
|
12
|
+
*/
|
|
13
|
+
declare function setColorPickerLocalizations(language: string, localizations: Partial<OuiColorPickerLocalizations>): void;
|
|
14
|
+
/**
|
|
15
|
+
* Set localizations for one or more languages
|
|
16
|
+
*
|
|
17
|
+
* @param localizations Localizations for one or more languages
|
|
18
|
+
*/
|
|
19
|
+
declare function setColorPickerLocalizations(localizations: Record<string, Partial<OuiColorPickerLocalizations>>): void;
|
|
20
|
+
declare function setColorPickerDisabled(state: OuiColorPickerState, type: "disabled" | "readonly", value: boolean): void;
|
|
21
|
+
declare function setColorPickerRequired(state: OuiColorPickerState, value: boolean): void;
|
|
22
|
+
declare function setColorPickerValue<Type extends OuiColorPickerValueType>(state: OuiColorPickerState, value: unknown, type?: Type): void;
|
|
23
|
+
declare function setColorPickerValues(state: OuiColorPickerState, focus: boolean, input?: string): void;
|
|
24
|
+
declare function updateColorPickerLabels(state: OuiColorPickerState): void;
|
|
25
|
+
declare function updateColorPickerLocalizations(instance: OuiLocalizations<OuiColorPickerLocalizations>, destination: Record<string, Partial<OuiColorPickerLocalizations>>, first: string | Record<string, Partial<OuiColorPickerLocalizations>>, second?: Partial<OuiColorPickerLocalizations>): void;
|
|
26
|
+
//#endregion
|
|
27
|
+
export { setColorPickerLocalizations as a, setColorPickerValues as c, setColorPickerDisabled as i, updateColorPickerLabels as l, getColorPickerOutput as n, setColorPickerRequired as o, getColorPickerValueType as r, setColorPickerValue as s, getColorPickerId as t, updateColorPickerLocalizations as u };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as COMBOBOX_SYMBOL, c as comboboxMessages, d as messageSelect, f as selectorAnchor, h as selectorSelectionItem, i as COMBOBOX_AUTOCOMPLETES, l as comboboxSelectors, m as selectorOption, n as COMBOBOX_ATTRIBUTE_SELECTION, o as COMBOBOX_TAGNAME, p as selectorContent, r as COMBOBOX_ATTRIBUTE_SELECTION_ITEM, s as comboboxAttributes, t as COMBOBOX_ATTRIBUTE_ANCHOR, u as messageLabel } from "../combobox.constants-DZVkMP5g.mjs";
|
|
2
|
+
export { COMBOBOX_ATTRIBUTE_ANCHOR, COMBOBOX_ATTRIBUTE_SELECTION, COMBOBOX_ATTRIBUTE_SELECTION_ITEM, COMBOBOX_AUTOCOMPLETES, COMBOBOX_SYMBOL, COMBOBOX_TAGNAME, comboboxAttributes, comboboxMessages, comboboxSelectors, messageLabel, messageSelect, selectorAnchor, selectorContent, selectorOption, selectorSelectionItem };
|
|
@@ -1,6 +1,15 @@
|
|
|
1
|
-
//#region src/js/combobox/constants.
|
|
1
|
+
//#region src/js/combobox/combobox.constants.ts
|
|
2
2
|
const COMBOBOX_TAGNAME = "oui-combobox";
|
|
3
3
|
const COMBOBOX_ATTRIBUTE_ANCHOR = `${COMBOBOX_TAGNAME}-anchor`;
|
|
4
|
+
const COMBOBOX_ATTRIBUTE_SELECTION = `${COMBOBOX_TAGNAME}-selection`;
|
|
5
|
+
const COMBOBOX_ATTRIBUTE_SELECTION_ITEM = `${COMBOBOX_TAGNAME}-selection-item`;
|
|
6
|
+
const COMBOBOX_AUTOCOMPLETES = /* @__PURE__ */ new Set([
|
|
7
|
+
"both",
|
|
8
|
+
"inline",
|
|
9
|
+
"list",
|
|
10
|
+
"none"
|
|
11
|
+
]);
|
|
12
|
+
const COMBOBOX_SYMBOL = Symbol(COMBOBOX_TAGNAME);
|
|
4
13
|
const attributeContent = `${COMBOBOX_TAGNAME}-content`;
|
|
5
14
|
const attributeFilter = `${COMBOBOX_TAGNAME}-filter`;
|
|
6
15
|
const attributeFilterInput = `${attributeFilter}-input`;
|
|
@@ -11,23 +20,8 @@ const attributeList = `${COMBOBOX_TAGNAME}-list`;
|
|
|
11
20
|
const attributeListEmpty = `${attributeList}-empty`;
|
|
12
21
|
const attributeMessage = `${COMBOBOX_TAGNAME}-message`;
|
|
13
22
|
const attributeOption = `${COMBOBOX_TAGNAME}-option`;
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
const COMBOBOX_ATTRIBUTE_SELECTION_ITEM = `${COMBOBOX_TAGNAME}-selection-item`;
|
|
17
|
-
const COMBOBOX_AUTOCOMPLETES = /* @__PURE__ */ new Set([
|
|
18
|
-
"both",
|
|
19
|
-
"inline",
|
|
20
|
-
"list",
|
|
21
|
-
"none"
|
|
22
|
-
]);
|
|
23
|
-
const messageLabel = `<${COMBOBOX_TAGNAME}> must contain a <label> element for the <select> element`;
|
|
24
|
-
const messageSelect = `<${COMBOBOX_TAGNAME}> must contain a valid <select> element`;
|
|
25
|
-
const selectorAnchor = `[${COMBOBOX_ATTRIBUTE_ANCHOR}]`;
|
|
26
|
-
const selectorContent = `[${attributeContent}]`;
|
|
27
|
-
const selectorOption = `[${attributeOption}]`;
|
|
28
|
-
const selectorSelectionItem = `[${COMBOBOX_ATTRIBUTE_SELECTION_ITEM}]`;
|
|
29
|
-
const COMBOBOX_ATTRIBUTES = {
|
|
30
|
-
active: attributeOptionActive,
|
|
23
|
+
const comboboxAttributes = {
|
|
24
|
+
active: `${COMBOBOX_TAGNAME}-option-active`,
|
|
31
25
|
content: attributeContent,
|
|
32
26
|
empty: attributeListEmpty,
|
|
33
27
|
filter: attributeFilter,
|
|
@@ -39,15 +33,21 @@ const COMBOBOX_ATTRIBUTES = {
|
|
|
39
33
|
message: attributeMessage,
|
|
40
34
|
option: attributeOption
|
|
41
35
|
};
|
|
42
|
-
const
|
|
36
|
+
const messageLabel = `<${COMBOBOX_TAGNAME}> must contain a <label> element for the <select> element`;
|
|
37
|
+
const messageSelect = `<${COMBOBOX_TAGNAME}> must contain a valid <select> element`;
|
|
38
|
+
const comboboxMessages = {
|
|
43
39
|
label: messageLabel,
|
|
44
40
|
select: messageSelect
|
|
45
41
|
};
|
|
46
|
-
const
|
|
42
|
+
const selectorAnchor = `[${COMBOBOX_ATTRIBUTE_ANCHOR}]`;
|
|
43
|
+
const selectorContent = `[${attributeContent}]`;
|
|
44
|
+
const selectorOption = `[${attributeOption}]`;
|
|
45
|
+
const selectorSelectionItem = `[${COMBOBOX_ATTRIBUTE_SELECTION_ITEM}]`;
|
|
46
|
+
const comboboxSelectors = {
|
|
47
47
|
anchor: selectorAnchor,
|
|
48
48
|
content: selectorContent,
|
|
49
49
|
selectionItem: selectorSelectionItem,
|
|
50
50
|
option: selectorOption
|
|
51
51
|
};
|
|
52
52
|
//#endregion
|
|
53
|
-
export {
|
|
53
|
+
export { COMBOBOX_ATTRIBUTE_ANCHOR, COMBOBOX_ATTRIBUTE_SELECTION, COMBOBOX_ATTRIBUTE_SELECTION_ITEM, COMBOBOX_AUTOCOMPLETES, COMBOBOX_SYMBOL, COMBOBOX_TAGNAME, comboboxAttributes, comboboxMessages, comboboxSelectors, messageLabel, messageSelect, selectorAnchor, selectorContent, selectorOption, selectorSelectionItem };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { c as OuiListboxPreview } from "../listbox.model-
|
|
1
|
+
import { c as OuiListboxPreview } from "../listbox.model-CuBOj4qe.mjs";
|
|
2
2
|
import { CreateListboxContent, CreateListboxContentParameters } from "../internal/listbox/listbox.dom.mjs";
|
|
3
|
-
import { OuiComboboxSelection, OuiComboboxSelectionItem
|
|
4
|
-
//#region src/js/combobox/dom.
|
|
3
|
+
import { c as OuiComboboxState, o as OuiComboboxSelection, s as OuiComboboxSelectionItem } from "../combobox.model-oDV06XCN.mjs";
|
|
4
|
+
//#region src/js/combobox/combobox.dom.d.ts
|
|
5
5
|
type CreateAnchor = {
|
|
6
6
|
container?: HTMLElement;
|
|
7
7
|
element: HTMLElement;
|