@oscarpalmer/oui 0.37.0 → 0.39.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 +12 -8
- package/dist/css/button.css +111 -14
- package/dist/css/color-picker.css +859 -0
- package/dist/css/color.css +86 -87
- package/dist/css/combobox.css +105 -4
- package/dist/css/content.css +8 -6
- package/dist/css/floatable.css +3 -3
- package/dist/css/form.css +106 -6
- package/dist/css/icon.css +99 -0
- package/dist/css/listbox.css +5 -0
- package/dist/css/message.css +6 -3
- package/dist/css/mixins/badge.mixins.css +2 -0
- package/dist/css/mixins/button.mixins.css +3 -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 +3 -3
- package/dist/css/splitter.css +1 -1
- package/dist/css/tabs.css +115 -23
- package/dist/css/typography.css +90 -0
- package/dist/js/color-picker/constants.color-picker.d.mts +2 -0
- package/dist/js/color-picker/constants.color-picker.mjs +59 -0
- package/dist/js/color-picker/dom.color-picker.d.mts +8 -0
- package/dist/js/color-picker/dom.color-picker.mjs +191 -0
- package/dist/js/color-picker/event.color-picker.d.mts +9 -0
- package/dist/js/color-picker/event.color-picker.mjs +2 -0
- package/dist/js/color-picker/form.color-picker.d.mts +5 -0
- package/dist/js/color-picker/form.color-picker.mjs +24 -0
- package/dist/js/color-picker/index.d.mts +2 -0
- package/dist/js/color-picker/index.mjs +303 -0
- package/dist/js/color-picker/misc.color-picker.d.mts +2 -0
- package/dist/js/color-picker/misc.color-picker.mjs +2 -0
- package/dist/js/color-picker/models.color-picker.d.mts +2 -0
- package/dist/js/color-picker/models.color-picker.mjs +24 -0
- package/dist/js/color-picker/output.color-picker.d.mts +8 -0
- package/dist/js/color-picker/output.color-picker.mjs +233 -0
- package/dist/js/color-picker/state.color-picker.d.mts +8 -0
- package/dist/js/color-picker/state.color-picker.mjs +2 -0
- package/dist/js/combobox/constants.combobox.d.mts +1 -1
- package/dist/js/combobox/dom.combobox.d.mts +12 -13
- package/dist/js/combobox/dom.combobox.mjs +12 -5
- package/dist/js/combobox/event.combobox.d.mts +20 -21
- 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/models.combobox.d.mts +12 -13
- package/dist/js/combobox/state.combobox.d.mts +8 -9
- package/dist/js/combobox/state.combobox.mjs +1 -1
- package/dist/js/constants.color-picker-B-gFjL8m.d.mts +364 -0
- package/dist/js/constants.combobox-8EMRmv09.d.mts +18 -0
- package/dist/js/constants.listbox-DGnX32kv.d.mts +8 -0
- package/dist/js/dialog.d.mts +2 -2
- package/dist/js/dialog.mjs +1 -1
- package/dist/js/{draggable-a6w0J1OD.d.mts → draggable-B5-70SZm.d.mts} +5 -4
- package/dist/js/event.color-picker-BEpq0Adu.mjs +485 -0
- package/dist/js/floatable/floatable.embedded.d.mts +1 -1
- package/dist/js/floatable/floatable.embedded.mjs +11 -8
- package/dist/js/floatable/floatable.standalone.d.mts +1 -1
- package/dist/js/{floatable.embedded-Bct4U5Dm.d.mts → floatable.embedded-DQYkXt8X.d.mts} +1 -1
- package/dist/js/focus-trap/focus-trap.embedded.d.mts +1 -1
- package/dist/js/focus-trap/focus-trap.standalone.d.mts +1 -1
- package/dist/js/{focus-trap.embedded-DR8NpZfr.d.mts → focus-trap.embedded-CjyFQYow.d.mts} +2 -2
- package/dist/js/{index-EfkUSals.d.mts → index-C5D3-oiI.d.mts} +41 -3
- package/dist/js/index.d.mts +8 -7
- package/dist/js/index.mjs +6 -3
- package/dist/js/internal/attributable.d.mts +2 -3
- package/dist/js/internal/draggable.d.mts +1 -1
- package/dist/js/internal/draggable.mjs +1 -1
- package/dist/js/internal/listbox/listbox.constants.d.mts +7 -10
- package/dist/js/internal/listbox/listbox.constants.mjs +15 -16
- package/dist/js/internal/listbox/listbox.data.d.mts +9 -10
- package/dist/js/internal/listbox/listbox.data.mjs +1 -1
- package/dist/js/internal/listbox/listbox.dom.d.mts +19 -20
- package/dist/js/internal/listbox/listbox.dom.mjs +1 -1
- package/dist/js/internal/listbox/listbox.event.d.mts +3 -4
- package/dist/js/internal/listbox/listbox.event.mjs +4 -4
- package/dist/js/internal/listbox/listbox.form.d.mts +4 -5
- package/dist/js/internal/listbox/listbox.form.mjs +16 -15
- package/dist/js/internal/listbox/listbox.misc.d.mts +10 -11
- package/dist/js/internal/listbox/listbox.misc.mjs +1 -1
- package/dist/js/internal/listbox/listbox.model.d.mts +1 -1
- package/dist/js/internal/listbox/listbox.state.d.mts +5 -6
- package/dist/js/internal/listbox/listbox.state.mjs +3 -3
- package/dist/js/internal/misc.d.mts +4 -4
- package/dist/js/internal/misc.mjs +9 -1
- package/dist/js/internal/navigable.d.mts +9 -10
- package/dist/js/internal/navigable.mjs +1 -0
- package/dist/js/listbox/constants.listbox.d.mts +1 -1
- package/dist/js/listbox/event.listbox.d.mts +6 -7
- package/dist/js/listbox/event.listbox.mjs +1 -1
- package/dist/js/listbox/index.d.mts +43 -5
- package/dist/js/listbox/index.mjs +56 -2
- 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 +7 -8
- package/dist/js/listbox/state.listbox.mjs +1 -1
- package/dist/js/{listbox.data-BWd0PCy7.mjs → listbox.data-DQ7-x2uY.mjs} +8 -7
- package/dist/js/{listbox.model-CRReGOmu.d.mts → listbox.model-BHPA7GM4.d.mts} +3 -3
- package/dist/js/menu.mjs +1 -1
- package/dist/js/{misc.listbox-BI-XsTOf.mjs → misc.listbox-DKB-j0UK.mjs} +4 -5
- package/dist/js/{misc.listbox-gnoJhrTr.d.mts → misc.listbox-mZMuYOxg.d.mts} +1 -1
- package/dist/js/movable/movable.embedded.d.mts +1 -1
- package/dist/js/movable/movable.standalone.d.mts +1 -1
- package/dist/js/popover.d.mts +2 -2
- package/dist/js/popover.mjs +1 -1
- package/dist/js/resizable/resizable.embedded.d.mts +1 -1
- package/dist/js/resizable/resizable.embedded.mjs +1 -1
- package/dist/js/resizable/resizable.standalone.d.mts +1 -1
- package/dist/js/{resizable.embedded-3qoR0Bjm.d.mts → resizable.embedded-dvhdfQgt.d.mts} +1 -1
- package/dist/js/sortable/sortable.embedded.d.mts +1 -1
- package/dist/js/sortable/sortable.standalone.d.mts +1 -1
- package/dist/js/splitter.d.mts +2 -3
- package/dist/js/splitter.mjs +2 -2
- package/dist/js/{state.combobox-4xq0FPCF.mjs → state.combobox-BWDFHwoi.mjs} +9 -9
- package/dist/js/tabs.d.mts +4 -5
- package/dist/js/tabs.mjs +4 -7
- package/dist/js/tooltip.d.mts +1 -1
- package/package.json +24 -22
- package/dist/js/constants.combobox-DmRAMC64.d.mts +0 -26
- package/dist/js/constants.listbox-DRsXUxd3.d.mts +0 -14
- package/src/css/a11y.scss +0 -13
- package/src/css/badge.scss +0 -62
- package/src/css/button.scss +0 -50
- package/src/css/color.scss +0 -115
- package/src/css/combobox.scss +0 -252
- package/src/css/content.scss +0 -180
- package/src/css/flex.scss +0 -107
- package/src/css/floatable.scss +0 -152
- package/src/css/form.scss +0 -573
- package/src/css/listbox.scss +0 -120
- package/src/css/message.scss +0 -73
- package/src/css/mixins.scss +0 -419
- package/src/css/reset.scss +0 -392
- package/src/css/splitter.scss +0 -89
- package/src/css/table.scss +0 -107
- package/src/css/tabs.scss +0 -85
- package/src/js/combobox/constants.combobox.ts +0 -83
- package/src/js/combobox/dom.combobox.ts +0 -407
- package/src/js/combobox/event.combobox.ts +0 -365
- package/src/js/combobox/index.ts +0 -320
- package/src/js/combobox/misc.combobox.ts +0 -104
- package/src/js/combobox/models.combobox.ts +0 -54
- package/src/js/combobox/state.combobox.ts +0 -246
- package/src/js/dialog.ts +0 -255
- package/src/js/floatable/floatable.embedded.ts +0 -332
- package/src/js/floatable/floatable.standalone.ts +0 -6
- package/src/js/focus-trap/focus-trap.embedded.ts +0 -411
- package/src/js/focus-trap/focus-trap.standalone.ts +0 -1
- package/src/js/index.ts +0 -15
- package/src/js/internal/attributable.ts +0 -73
- package/src/js/internal/draggable.ts +0 -657
- package/src/js/internal/listbox/listbox.constants.ts +0 -25
- package/src/js/internal/listbox/listbox.data.ts +0 -287
- package/src/js/internal/listbox/listbox.dom.ts +0 -445
- package/src/js/internal/listbox/listbox.event.ts +0 -129
- package/src/js/internal/listbox/listbox.form.ts +0 -115
- package/src/js/internal/listbox/listbox.misc.ts +0 -135
- package/src/js/internal/listbox/listbox.model.ts +0 -169
- package/src/js/internal/listbox/listbox.state.ts +0 -82
- package/src/js/internal/misc.ts +0 -27
- package/src/js/internal/navigable.ts +0 -315
- package/src/js/l10n.ts +0 -192
- package/src/js/listbox/constants.listbox.ts +0 -61
- package/src/js/listbox/event.listbox.ts +0 -106
- package/src/js/listbox/index.ts +0 -302
- package/src/js/listbox/misc.listbox.ts +0 -70
- package/src/js/listbox/state.listbox.ts +0 -196
- package/src/js/menu.ts +0 -348
- package/src/js/movable/movable.embedded.ts +0 -318
- package/src/js/movable/movable.standalone.ts +0 -2
- package/src/js/popover.ts +0 -229
- package/src/js/resizable/resizable.embedded.ts +0 -413
- package/src/js/resizable/resizable.standalone.ts +0 -5
- package/src/js/sortable/sortable.embedded.ts +0 -527
- package/src/js/sortable/sortable.standalone.ts +0 -2
- package/src/js/splitter.ts +0 -583
- package/src/js/tabs.ts +0 -447
- package/src/js/toolbar.ts +0 -63
- package/src/js/tooltip.ts +0 -367
- /package/dist/css/{mixins.css → mixins/input.mixins.css} +0 -0
|
@@ -0,0 +1,485 @@
|
|
|
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/constants.color-picker.mjs";
|
|
4
|
+
import { copyValue } from "./internal/misc.mjs";
|
|
5
|
+
import { OuiColorPickerEvent } from "./color-picker/models.color-picker.mjs";
|
|
6
|
+
import { updateColorPickerForm, updateColorPickerValidity } from "./color-picker/form.color-picker.mjs";
|
|
7
|
+
import { getColorPickerOutputFormat, updateColorPickerOutputCopyLabel, updateColorPickerOutputInputs, updateColorPickerOutputLabels } from "./color-picker/output.color-picker.mjs";
|
|
8
|
+
import { createColorPickerAnchor, createColorPickerContent } from "./color-picker/dom.color-picker.mjs";
|
|
9
|
+
import { getAria, setAria } from "@oscarpalmer/toretto/aria";
|
|
10
|
+
import { dispatch, getEventPosition, on } from "@oscarpalmer/toretto/event";
|
|
11
|
+
import { setAttribute, setAttributes } from "@oscarpalmer/toretto/attribute";
|
|
12
|
+
import { toggleStyles } from "@oscarpalmer/toretto/style";
|
|
13
|
+
import { findAncestor } from "@oscarpalmer/toretto/find";
|
|
14
|
+
import { supportsTouch } from "@oscarpalmer/toretto/touch";
|
|
15
|
+
import { getColor, getForegroundColor, isHexColor, isHslColor, isHslaColor, isHwbColor, isHwbaColor, isRgbColor, isRgbaColor } from "@oscarpalmer/atoms/color";
|
|
16
|
+
import { clamp } from "@oscarpalmer/atoms";
|
|
17
|
+
import { getAttribute as getAttribute$1, setAria as setAria$1, setProperty } from "@oscarpalmer/toretto";
|
|
18
|
+
import { createElement as createElement$1 } from "@oscarpalmer/toretto/create";
|
|
19
|
+
//#region src/js/color-picker/state.color-picker.ts
|
|
20
|
+
function attachColorPicker(state) {
|
|
21
|
+
const { anchor, content, host, id, inline, input, label, listeners, style } = state;
|
|
22
|
+
if (!inline) {
|
|
23
|
+
state.floatable = createEmbeddedFloatable(anchor.container ?? anchor.container, content.element, {
|
|
24
|
+
position: "below-start",
|
|
25
|
+
reusable: false
|
|
26
|
+
});
|
|
27
|
+
state.floatable.update();
|
|
28
|
+
}
|
|
29
|
+
const labelId = `${id}_label`;
|
|
30
|
+
setAria(host, {
|
|
31
|
+
describedby: getAria(input, "describedby"),
|
|
32
|
+
labelledby: labelId
|
|
33
|
+
});
|
|
34
|
+
setAttributes(host, { name: input.name === "" ? input.id : input.name });
|
|
35
|
+
label.element.htmlFor = anchor.input.id;
|
|
36
|
+
label.element.id = labelId;
|
|
37
|
+
if (anchor.toggle != null) setAria(anchor.toggle, "expanded", false);
|
|
38
|
+
input.before(style, anchor.container, content.element);
|
|
39
|
+
input.remove();
|
|
40
|
+
listeners.push(on(host, "focusout", () => {
|
|
41
|
+
setTimeout(() => {
|
|
42
|
+
if (colorPickerMovement.parameters == null && !host.contains(document.activeElement)) state.floatable?.hide();
|
|
43
|
+
});
|
|
44
|
+
}), on(anchor.input, "change", () => {
|
|
45
|
+
onColorPickerInput(state);
|
|
46
|
+
}), on(anchor.input, "input", () => {
|
|
47
|
+
onColorPickerInput(state);
|
|
48
|
+
}), on(content.element, "beforetoggle", (event) => {
|
|
49
|
+
if (state.disabled) event.preventDefault();
|
|
50
|
+
}, { passive: false }), on(content.element, "toggle", (event) => {
|
|
51
|
+
const open = event.newState === "open";
|
|
52
|
+
if (anchor.toggle != null) setAria(anchor.toggle, "expanded", open);
|
|
53
|
+
if (open) content.well.knob.focus();
|
|
54
|
+
}), on(content.hue.input, "input", () => {
|
|
55
|
+
onColorPickerHue(state);
|
|
56
|
+
}));
|
|
57
|
+
if (content.opacity != null) listeners.push(on(content.opacity.input, "input", () => {
|
|
58
|
+
onColorPickerOpacity(state);
|
|
59
|
+
}));
|
|
60
|
+
if (content.output?.toggle != null) listeners.push(on(content.element, "change", (event) => {
|
|
61
|
+
onColorPickerOutputValue(event, state);
|
|
62
|
+
}), on(content.element, "input", (event) => {
|
|
63
|
+
onColorPickerOutputValue(event, state);
|
|
64
|
+
}), on(content.output.toggle, "change", () => {
|
|
65
|
+
onColorPickerOutputFormat(state);
|
|
66
|
+
}));
|
|
67
|
+
colorPickerMap.set(host, state);
|
|
68
|
+
colorPickerSet.add(state);
|
|
69
|
+
}
|
|
70
|
+
function detachColorPicker(state) {
|
|
71
|
+
const { anchor, content, floatable, host, input, label, style } = state;
|
|
72
|
+
floatable?.destroy();
|
|
73
|
+
setAria(host, {
|
|
74
|
+
describedby: void 0,
|
|
75
|
+
labelledby: void 0
|
|
76
|
+
});
|
|
77
|
+
setAttributes(host, { name: void 0 });
|
|
78
|
+
label.element.htmlFor = input.id;
|
|
79
|
+
label.element.id = label.id;
|
|
80
|
+
anchor.container.before(input);
|
|
81
|
+
anchor.container.remove();
|
|
82
|
+
content.element.remove();
|
|
83
|
+
style.remove();
|
|
84
|
+
const listeners = state.listeners.splice(0);
|
|
85
|
+
const { length } = listeners;
|
|
86
|
+
for (let index = 0; index < length; index += 1) listeners[index]();
|
|
87
|
+
colorPickerMap.delete(state.host);
|
|
88
|
+
colorPickerSet.delete(state);
|
|
89
|
+
}
|
|
90
|
+
function initializeColorPicker(element, internals) {
|
|
91
|
+
const input = element.querySelector("input");
|
|
92
|
+
if (input == null || !COLOR_PICKER_INPUT_TYPES.has(input.type)) throw new Error(COLOR_PICKER_MESSAGE_INPUT);
|
|
93
|
+
const label = element.querySelector(`label[for="${input.id}"]`);
|
|
94
|
+
if (label == null) throw new Error(COLOR_PICKER_MESSAGE_LABEL);
|
|
95
|
+
element.id = input.id;
|
|
96
|
+
const id = getColorPickerId();
|
|
97
|
+
const labelId = label.id;
|
|
98
|
+
const alpha = element.hasAttribute("alpha");
|
|
99
|
+
const color = getColor(input.value);
|
|
100
|
+
const copy = element.hasAttribute("copy");
|
|
101
|
+
const disabled = element.hasAttribute("disabled") || input.disabled;
|
|
102
|
+
const inline = element.hasAttribute("inline");
|
|
103
|
+
const output = getColorPickerOutput(element);
|
|
104
|
+
const readonly = element.hasAttribute("readonly") || input.readOnly;
|
|
105
|
+
const required = element.hasAttribute("required") || input.required;
|
|
106
|
+
const parameters = {
|
|
107
|
+
alpha,
|
|
108
|
+
color,
|
|
109
|
+
copy,
|
|
110
|
+
id,
|
|
111
|
+
inline,
|
|
112
|
+
input,
|
|
113
|
+
output
|
|
114
|
+
};
|
|
115
|
+
const anchor = createColorPickerAnchor(parameters);
|
|
116
|
+
const content = createColorPickerContent(parameters);
|
|
117
|
+
const formatted = color.toHexString(alpha);
|
|
118
|
+
const state = {
|
|
119
|
+
alpha,
|
|
120
|
+
anchor,
|
|
121
|
+
content,
|
|
122
|
+
copy,
|
|
123
|
+
disabled,
|
|
124
|
+
id,
|
|
125
|
+
inline,
|
|
126
|
+
input,
|
|
127
|
+
internals,
|
|
128
|
+
output,
|
|
129
|
+
readonly,
|
|
130
|
+
required,
|
|
131
|
+
color: {
|
|
132
|
+
foreground: "",
|
|
133
|
+
value: color
|
|
134
|
+
},
|
|
135
|
+
host: element,
|
|
136
|
+
label: {
|
|
137
|
+
element: label,
|
|
138
|
+
id: labelId
|
|
139
|
+
},
|
|
140
|
+
listeners: [],
|
|
141
|
+
localizations: {
|
|
142
|
+
component: {},
|
|
143
|
+
global: colorPickerLocalizations
|
|
144
|
+
},
|
|
145
|
+
style: createElement$1("style"),
|
|
146
|
+
value: {
|
|
147
|
+
current: formatted,
|
|
148
|
+
initial: formatted
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
attachColorPicker(state);
|
|
152
|
+
setAttributes(element, {
|
|
153
|
+
output,
|
|
154
|
+
alpha: alpha ? "" : void 0,
|
|
155
|
+
copy: copy ? "" : void 0,
|
|
156
|
+
inline: inline ? "" : void 0
|
|
157
|
+
});
|
|
158
|
+
setColorPickerDisabled(state, "disabled", disabled);
|
|
159
|
+
setColorPickerDisabled(state, "readonly", readonly);
|
|
160
|
+
setColorPickerRequired(state, required);
|
|
161
|
+
setColorPickerValues(state, false);
|
|
162
|
+
updateColorPickerLabels(state);
|
|
163
|
+
updateColorPickerValidity(state, isHexColor(state.value.current, alpha));
|
|
164
|
+
return state;
|
|
165
|
+
}
|
|
166
|
+
const colorPickerMap = /* @__PURE__ */ new WeakMap();
|
|
167
|
+
const colorPickerSet = /* @__PURE__ */ new Set();
|
|
168
|
+
//#endregion
|
|
169
|
+
//#region src/js/color-picker/misc.color-picker.ts
|
|
170
|
+
function getColorPickerId() {
|
|
171
|
+
index += 1;
|
|
172
|
+
return `oui_color_picker_${index}`;
|
|
173
|
+
}
|
|
174
|
+
function getColorPickerOutput(element) {
|
|
175
|
+
const attribute = getAttribute$1(element, "output");
|
|
176
|
+
return COLOR_PICKER_OUTPUTS.has(attribute) ? attribute : "none";
|
|
177
|
+
}
|
|
178
|
+
function getColorPickerValueType(state, value) {
|
|
179
|
+
switch (true) {
|
|
180
|
+
case isHexColor(value, state.alpha): return state.alpha ? "hexa" : "hex";
|
|
181
|
+
case isHslColor(value): return "hsl";
|
|
182
|
+
case isHslaColor(value): return "hsla";
|
|
183
|
+
case isHwbColor(value): return "hwb";
|
|
184
|
+
case isHwbaColor(value): return "hwba";
|
|
185
|
+
case isRgbColor(value): return "rgb";
|
|
186
|
+
case isRgbaColor(value): return "rgba";
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
function setColorPickerLocalizations(first, second) {
|
|
190
|
+
updateColorPickerLocalizations(colorPickerLocalizations, colorPickerLocalizations.values, first, second);
|
|
191
|
+
}
|
|
192
|
+
function setColorPickerDisabled(state, type, value) {
|
|
193
|
+
state[type] = value;
|
|
194
|
+
setAria$1(state.host, type, value);
|
|
195
|
+
state.anchor.input.readOnly = value;
|
|
196
|
+
setAria$1(state.anchor.input, type, value);
|
|
197
|
+
setProperty(state.content.hue.input, "disabled", state.disabled || state.readonly);
|
|
198
|
+
if (state.anchor.toggle != null) setAria$1(state.anchor.toggle, "disabled", state.disabled);
|
|
199
|
+
if (state.content.opacity != null) setProperty(state.content.opacity.input, "disabled", state.disabled || state.readonly);
|
|
200
|
+
}
|
|
201
|
+
function setColorPickerRequired(state, value) {
|
|
202
|
+
state.required = value;
|
|
203
|
+
setAria$1(state.host, "required", value);
|
|
204
|
+
setAria$1(state.anchor.input, "required", value);
|
|
205
|
+
updateColorPickerValidity(state, isHexColor(state.value.current, state.alpha));
|
|
206
|
+
}
|
|
207
|
+
function setColorPickerValue(state, value, type) {
|
|
208
|
+
if (state == null) return;
|
|
209
|
+
const actual = type ?? getColorPickerValueType(state, value);
|
|
210
|
+
if (actual == null || type != null && type !== actual) return;
|
|
211
|
+
state.color.value[actual] = value;
|
|
212
|
+
setColorPickerValues(state, true);
|
|
213
|
+
}
|
|
214
|
+
function setColorPickerValues(state, focus, input) {
|
|
215
|
+
const { anchor, color, content, host, style } = state;
|
|
216
|
+
color.foreground = getForegroundColor(color.value).hex;
|
|
217
|
+
const { alpha, hex, hsl, rgb } = color.value;
|
|
218
|
+
const { hue, lightness, saturation } = hsl;
|
|
219
|
+
const { blue, green, red } = rgb;
|
|
220
|
+
const value = input ?? color.value.toHexString(state.alpha);
|
|
221
|
+
anchor.input.value = value;
|
|
222
|
+
content.hue.input.valueAsNumber = hue;
|
|
223
|
+
if (content.opacity != null) content.opacity.input.valueAsNumber = alpha;
|
|
224
|
+
state.value.current = value;
|
|
225
|
+
style.textContent = `#${host.id} {
|
|
226
|
+
--oui-color-picker-alpha: ${alpha};
|
|
227
|
+
--oui-color-picker-blue: ${blue};
|
|
228
|
+
--oui-color-picker-green: ${green};
|
|
229
|
+
--oui-color-picker-foreground: #${color.foreground};
|
|
230
|
+
--oui-color-picker-hex: #${hex};
|
|
231
|
+
--oui-color-picker-hue: ${hue};
|
|
232
|
+
--oui-color-picker-lightness: ${lightness};
|
|
233
|
+
--oui-color-picker-red: ${red};
|
|
234
|
+
--oui-color-picker-saturation: ${saturation};
|
|
235
|
+
}`;
|
|
236
|
+
updateColorPickerForm(state, isHexColor(state.value.current, state.alpha));
|
|
237
|
+
updateColorPickerOutputInputs(state);
|
|
238
|
+
updateColorPickerWell(state);
|
|
239
|
+
if (focus) content.well.knob.focus();
|
|
240
|
+
}
|
|
241
|
+
function updateColorPickerLabels(state) {
|
|
242
|
+
const { anchor, content, host, localizations } = state;
|
|
243
|
+
const { component, global } = localizations;
|
|
244
|
+
if (anchor.toggle != null) setAria$1(anchor.toggle, "label", localize(getLocalization(global, host, "toggle", component), {}, []));
|
|
245
|
+
content.hue.label.textContent = localize(getLocalization(global, host, "hue", component), {}, []);
|
|
246
|
+
content.well.label.textContent = localize(getLocalization(global, host, "wellLabel", component), {}, []);
|
|
247
|
+
updateColorPickerOutputLabels(state);
|
|
248
|
+
updateColorPickerWell(state);
|
|
249
|
+
if (content.opacity != null) content.opacity.label.textContent = localize(getLocalization(global, host, "opacity", component), {}, []);
|
|
250
|
+
}
|
|
251
|
+
function updateColorPickerLocalizations(instance, destination, first, second) {
|
|
252
|
+
updateLocalizations(instance, typeof first === "string" ? { [first]: second } : first, destination, () => {
|
|
253
|
+
for (const state of colorPickerSet) updateColorPickerLabels(state);
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
function updateColorPickerWell(state) {
|
|
257
|
+
const { color, content, host, localizations } = state;
|
|
258
|
+
const { component, global } = localizations;
|
|
259
|
+
const { lightness, saturation } = color.value.hsl;
|
|
260
|
+
setAria$1(content.well.knob, "valuetext", localize(getLocalization(global, host, "wellValue", component), {
|
|
261
|
+
lightness,
|
|
262
|
+
saturation
|
|
263
|
+
}, [lightness, saturation]));
|
|
264
|
+
}
|
|
265
|
+
let index = 0;
|
|
266
|
+
//#endregion
|
|
267
|
+
//#region src/js/color-picker/event.color-picker.ts
|
|
268
|
+
function cancelMove(parameters) {
|
|
269
|
+
parameters.state.color.value.hexa = parameters.value;
|
|
270
|
+
setColorPickerValues(parameters.state, true);
|
|
271
|
+
colorPickerMovement.parameters = void 0;
|
|
272
|
+
styleToggler.remove();
|
|
273
|
+
}
|
|
274
|
+
function onClick(event) {
|
|
275
|
+
const button = findAncestor(event, COLOR_PICKER_SELECTOR_COPY);
|
|
276
|
+
if (!(button instanceof HTMLButtonElement)) return;
|
|
277
|
+
setAttributes(button, {
|
|
278
|
+
[COLOR_PICKER_ATTRIBUTE_COPY_ERROR]: void 0,
|
|
279
|
+
[COLOR_PICKER_ATTRIBUTE_COPY_SUCCESS]: void 0
|
|
280
|
+
});
|
|
281
|
+
const state = colorPickerMap.get(findAncestor(event, COLOR_PICKER_TAGNAME));
|
|
282
|
+
if (state == null || state.disabled) return;
|
|
283
|
+
const copy = button.dataset.color == null ? state.content.output?.copy : state.anchor.copy;
|
|
284
|
+
if (copy == null) return;
|
|
285
|
+
if (copy.timer != null) {
|
|
286
|
+
clearTimeout(copy.timer);
|
|
287
|
+
copy.timer = void 0;
|
|
288
|
+
}
|
|
289
|
+
const color = button.dataset.color ?? getColorPickerOutputFormat(state);
|
|
290
|
+
if (color == null) return;
|
|
291
|
+
let value;
|
|
292
|
+
switch (color) {
|
|
293
|
+
case "hex":
|
|
294
|
+
value = state.color.value.toHexString(state.alpha);
|
|
295
|
+
break;
|
|
296
|
+
case "hsl":
|
|
297
|
+
value = state.color.value.toHslString(state.alpha);
|
|
298
|
+
break;
|
|
299
|
+
case "hwb":
|
|
300
|
+
value = state.color.value.toHwbString(state.alpha);
|
|
301
|
+
break;
|
|
302
|
+
case "rgb": value = state.color.value.toRgbString(state.alpha);
|
|
303
|
+
}
|
|
304
|
+
if (value != null) copyValue(value, () => {
|
|
305
|
+
console.log("Copied value to clipboard:", value);
|
|
306
|
+
updateColorPickerCopy(copy, COLOR_PICKER_ATTRIBUTE_COPY_SUCCESS);
|
|
307
|
+
}, () => {
|
|
308
|
+
console.warn("Failed to copy value to clipboard:", value);
|
|
309
|
+
updateColorPickerCopy(copy, COLOR_PICKER_ATTRIBUTE_COPY_ERROR);
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
function onColorPickerHue(state) {
|
|
313
|
+
const hue = state.content.hue.input.valueAsNumber;
|
|
314
|
+
state.color.value.hsla = {
|
|
315
|
+
...state.color.value.hsla,
|
|
316
|
+
hue
|
|
317
|
+
};
|
|
318
|
+
setColorPickerValues(state, false);
|
|
319
|
+
}
|
|
320
|
+
function onColorPickerInput(state) {
|
|
321
|
+
const { alpha, anchor, color, host } = state;
|
|
322
|
+
const value = anchor.input.value.replace(COLOR_PICKER_EXPRESSION_HEX_PREFIX, "");
|
|
323
|
+
if (value.toLowerCase() === (alpha ? color.value.hexa : color.value.hex).toLowerCase()) return;
|
|
324
|
+
state.value.current = anchor.input.value;
|
|
325
|
+
const { length } = value;
|
|
326
|
+
let valid;
|
|
327
|
+
if (alpha) valid = isHexColor(value, true) && (length === 4 || length === 8);
|
|
328
|
+
else valid = isHexColor(value) && (length === 3 || length === 6);
|
|
329
|
+
if (valid) {
|
|
330
|
+
if (length === 3 || length === 6) color.value.hex = value;
|
|
331
|
+
else color.value.hexa = value;
|
|
332
|
+
}
|
|
333
|
+
setColorPickerValues(state, false, anchor.input.value);
|
|
334
|
+
dispatch(host, new OuiColorPickerEvent("oui:input", color.value, valid));
|
|
335
|
+
}
|
|
336
|
+
function onColorPickerOpacity(state) {
|
|
337
|
+
const opacity = state.content.opacity?.input.valueAsNumber;
|
|
338
|
+
if (opacity == null) return;
|
|
339
|
+
state.color.value.alpha = opacity;
|
|
340
|
+
setColorPickerValues(state, false);
|
|
341
|
+
}
|
|
342
|
+
function onColorPickerOutputFormat(state) {
|
|
343
|
+
const { items, toggle } = state.content.output ?? {};
|
|
344
|
+
if (items == null || toggle == null) return;
|
|
345
|
+
const attribute = `${COLOR_PICKER_TAGNAME}-output-${toggle.value}`;
|
|
346
|
+
for (const item of items) item.hidden = !item.hasAttribute(attribute);
|
|
347
|
+
if (state.content.output?.copy != null) updateColorPickerOutputCopyLabel(state, state.content.output.copy.button);
|
|
348
|
+
}
|
|
349
|
+
function onColorPickerOutputValue(event, state) {
|
|
350
|
+
const input = findAncestor(event, COLOR_PICKER_SELECTOR_OUTPUT_INPUT);
|
|
351
|
+
if (!(input instanceof HTMLInputElement)) return;
|
|
352
|
+
const color = input.dataset.color;
|
|
353
|
+
const property = input.dataset.property;
|
|
354
|
+
if (color == null || property == null) return;
|
|
355
|
+
if (outputTimer != null) clearTimeout(outputTimer);
|
|
356
|
+
outputTimer = setTimeout(() => {
|
|
357
|
+
outputTimer = void 0;
|
|
358
|
+
state.color.value[color] = {
|
|
359
|
+
...state.color.value[color],
|
|
360
|
+
[property]: input.valueAsNumber
|
|
361
|
+
};
|
|
362
|
+
setColorPickerValues(state, false);
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
function onEnter(state) {
|
|
366
|
+
const { alpha, anchor, color, internals } = state;
|
|
367
|
+
const input = anchor.input.value.replace(COLOR_PICKER_EXPRESSION_HEX_PREFIX, "");
|
|
368
|
+
const short = alpha ? input.length === 4 : input.length === 3;
|
|
369
|
+
if (isHexColor(input, alpha) && short) anchor.input.value = color.value.toHexString(alpha);
|
|
370
|
+
internals.form?.requestSubmit();
|
|
371
|
+
}
|
|
372
|
+
function onKeydown(event) {
|
|
373
|
+
if (colorPickerMovement.parameters != null && event.key === "Escape") {
|
|
374
|
+
cancelMove(colorPickerMovement.parameters);
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
const knob = findAncestor(event, COLOR_PICKER_SELECTOR_WELL_KNOB);
|
|
378
|
+
if (!(event.key === "Enter" && findAncestor(event, COLOR_PICKER_SELECTOR_INPUT) != null || COLOR_PICKER_KEYS.has(event.key) && knob != null)) return;
|
|
379
|
+
const state = colorPickerMap.get(findAncestor(event, COLOR_PICKER_TAGNAME));
|
|
380
|
+
if (state == null || state.disabled || state.readonly) return;
|
|
381
|
+
event.preventDefault();
|
|
382
|
+
if (event.key === "Enter") {
|
|
383
|
+
onEnter(state);
|
|
384
|
+
return;
|
|
385
|
+
}
|
|
386
|
+
if (knob == null) return;
|
|
387
|
+
const modifier = event.shiftKey ? 10 : 1;
|
|
388
|
+
let { lightness, saturation } = state.color.value.hsl;
|
|
389
|
+
switch (event.key) {
|
|
390
|
+
case "ArrowDown":
|
|
391
|
+
lightness -= 1 * modifier;
|
|
392
|
+
break;
|
|
393
|
+
case "ArrowLeft":
|
|
394
|
+
saturation -= 1 * modifier;
|
|
395
|
+
break;
|
|
396
|
+
case "ArrowRight":
|
|
397
|
+
saturation += 1 * modifier;
|
|
398
|
+
break;
|
|
399
|
+
case "ArrowUp":
|
|
400
|
+
lightness += 1 * modifier;
|
|
401
|
+
break;
|
|
402
|
+
case "End":
|
|
403
|
+
lightness = 0;
|
|
404
|
+
break;
|
|
405
|
+
case "Home":
|
|
406
|
+
lightness = 100;
|
|
407
|
+
break;
|
|
408
|
+
case "PageDown":
|
|
409
|
+
lightness -= 10;
|
|
410
|
+
break;
|
|
411
|
+
case "PageUp": lightness += 10;
|
|
412
|
+
}
|
|
413
|
+
state.color.value.hsl = {
|
|
414
|
+
...state.color.value.hsl,
|
|
415
|
+
lightness: clamp(lightness, 0, 100),
|
|
416
|
+
saturation: clamp(saturation, 0, 100)
|
|
417
|
+
};
|
|
418
|
+
setColorPickerValues(state, false);
|
|
419
|
+
}
|
|
420
|
+
function onPointerdown(event) {
|
|
421
|
+
if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey || (supportsTouch.value ? event.type === "mousedown" : event.type === "touchstart" || event.button !== 0)) return;
|
|
422
|
+
const well = findAncestor(event, COLOR_PICKER_SELECTOR_WELL);
|
|
423
|
+
if (well == null) return;
|
|
424
|
+
const element = findAncestor(event, COLOR_PICKER_TAGNAME);
|
|
425
|
+
if (element == null) return;
|
|
426
|
+
if (supportsTouch.value) event.preventDefault();
|
|
427
|
+
if (getEventPosition(event) == null) return;
|
|
428
|
+
const state = colorPickerMap.get(element);
|
|
429
|
+
if (state == null || state.disabled || state.readonly) return;
|
|
430
|
+
colorPickerMovement.parameters = {
|
|
431
|
+
state,
|
|
432
|
+
rectangle: well.getBoundingClientRect(),
|
|
433
|
+
value: state.color.value.hexa
|
|
434
|
+
};
|
|
435
|
+
styleToggler.set();
|
|
436
|
+
}
|
|
437
|
+
function onPointermove(event) {
|
|
438
|
+
if (colorPickerMovement.parameters == null) return;
|
|
439
|
+
const position = getEventPosition(event);
|
|
440
|
+
if (position != null) updateColorPickerValues(colorPickerMovement.parameters, position);
|
|
441
|
+
}
|
|
442
|
+
function onPointerup(event) {
|
|
443
|
+
if (colorPickerMovement.parameters == null) return;
|
|
444
|
+
const position = getEventPosition(event);
|
|
445
|
+
if (position != null) updateColorPickerValues(colorPickerMovement.parameters, position);
|
|
446
|
+
colorPickerMovement.parameters = void 0;
|
|
447
|
+
styleToggler.remove();
|
|
448
|
+
}
|
|
449
|
+
function updateColorPickerCopy(copy, attribute) {
|
|
450
|
+
const { button } = copy;
|
|
451
|
+
setAttribute(button, attribute, "");
|
|
452
|
+
copy.timer = setTimeout(() => {
|
|
453
|
+
copy.timer = void 0;
|
|
454
|
+
setAttribute(button, attribute, void 0);
|
|
455
|
+
}, styleTime);
|
|
456
|
+
}
|
|
457
|
+
function updateColorPickerValues(parameters, position) {
|
|
458
|
+
const { rectangle, state } = parameters;
|
|
459
|
+
const { x, y } = position;
|
|
460
|
+
const top = clamp((y - rectangle.top) / rectangle.height, 0, 1);
|
|
461
|
+
const left = clamp((x - rectangle.left) / rectangle.width, 0, 1);
|
|
462
|
+
state.color.value.hsl = {
|
|
463
|
+
...state.color.value.hsl,
|
|
464
|
+
lightness: (1 - top) * 100,
|
|
465
|
+
saturation: left * 100
|
|
466
|
+
};
|
|
467
|
+
setColorPickerValues(state, true);
|
|
468
|
+
}
|
|
469
|
+
const styleToggler = toggleStyles(document.body, {
|
|
470
|
+
touchAction: "none",
|
|
471
|
+
userSelect: "none",
|
|
472
|
+
webkitUserSelect: "none"
|
|
473
|
+
});
|
|
474
|
+
const colorPickerMovement = {};
|
|
475
|
+
const styleTime = 2500;
|
|
476
|
+
let outputTimer;
|
|
477
|
+
on(document, "click", onClick);
|
|
478
|
+
on(document, "keydown", onKeydown, { passive: false });
|
|
479
|
+
on(document, "mousedown", onPointerdown);
|
|
480
|
+
on(document, "pointermove", onPointermove);
|
|
481
|
+
on(document, "pointerup", onPointerup);
|
|
482
|
+
on(document, "touchcancel", onPointerup);
|
|
483
|
+
on(document, "touchstart", onPointerdown, { passive: false });
|
|
484
|
+
//#endregion
|
|
485
|
+
export { attachColorPicker as _, onColorPickerOutputFormat as a, detachColorPicker 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, colorPickerMap as v, initializeColorPicker as x, colorPickerSet as y };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as OuiFloatablePosition, c as getOnBeforeToggleListener, i as OuiFloatableOptions, l as removeFloatable, n as CreateOuiFloatableOptions, o as createEmbeddedFloatable, r as OuiFloatable, s as createFloatable, t as ATTRIBUTE_FLOATABLE } from "../floatable.embedded-
|
|
1
|
+
import { a as OuiFloatablePosition, c as getOnBeforeToggleListener, i as OuiFloatableOptions, l as removeFloatable, n as CreateOuiFloatableOptions, o as createEmbeddedFloatable, r as OuiFloatable, s as createFloatable, t as ATTRIBUTE_FLOATABLE } from "../floatable.embedded-DQYkXt8X.mjs";
|
|
2
2
|
export { ATTRIBUTE_FLOATABLE, CreateOuiFloatableOptions, OuiFloatable, OuiFloatableOptions, OuiFloatablePosition, createEmbeddedFloatable, createFloatable, getOnBeforeToggleListener, removeFloatable };
|
|
@@ -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,2 +1,2 @@
|
|
|
1
|
-
import { a as OuiFloatablePosition, n as CreateOuiFloatableOptions, r as OuiFloatable, s as createFloatable } from "../floatable.embedded-
|
|
1
|
+
import { a as OuiFloatablePosition, n as CreateOuiFloatableOptions, r as OuiFloatable, s as createFloatable } from "../floatable.embedded-DQYkXt8X.mjs";
|
|
2
2
|
export { type CreateOuiFloatableOptions, type OuiFloatable, type OuiFloatablePosition, createFloatable };
|
|
@@ -45,7 +45,7 @@ type OuiFloatableOptions = {
|
|
|
45
45
|
position: OuiFloatablePosition;
|
|
46
46
|
reusable: boolean;
|
|
47
47
|
};
|
|
48
|
-
type OuiFloatablePosition =
|
|
48
|
+
type OuiFloatablePosition = "above" | "above-end" | "above-start" | "below" | "below-end" | "below-start" | "end" | "end-bottom" | "end-top" | "start" | "start-bottom" | "start-top";
|
|
49
49
|
type OuiFloatableState = {
|
|
50
50
|
anchor: HTMLElement;
|
|
51
51
|
content: HTMLElement;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as OuiFocusTrapOptions, i as OuiFocusTrap, n as ATTRIBUTE_FOCUSTRAP_CONTAIN, o as createFocusTrap, r as ATTRIBUTE_FOCUSTRAP_NOESCAPE, s as removeFocusTrap, t as ATTRIBUTE_FOCUSTRAP } from "../focus-trap.embedded-
|
|
1
|
+
import { a as OuiFocusTrapOptions, i as OuiFocusTrap, n as ATTRIBUTE_FOCUSTRAP_CONTAIN, o as createFocusTrap, r as ATTRIBUTE_FOCUSTRAP_NOESCAPE, s as removeFocusTrap, t as ATTRIBUTE_FOCUSTRAP } from "../focus-trap.embedded-CjyFQYow.mjs";
|
|
2
2
|
export { ATTRIBUTE_FOCUSTRAP, ATTRIBUTE_FOCUSTRAP_CONTAIN, ATTRIBUTE_FOCUSTRAP_NOESCAPE, OuiFocusTrap, OuiFocusTrapOptions, createFocusTrap, removeFocusTrap };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as OuiFocusTrapOptions, i as OuiFocusTrap, o as createFocusTrap } from "../focus-trap.embedded-
|
|
1
|
+
import { a as OuiFocusTrapOptions, i as OuiFocusTrap, o as createFocusTrap } from "../focus-trap.embedded-CjyFQYow.mjs";
|
|
2
2
|
export { type OuiFocusTrap, type OuiFocusTrapOptions, createFocusTrap };
|
|
@@ -70,7 +70,7 @@ type OuiFocusTrapState = {
|
|
|
70
70
|
declare function createFocusTrap(element: HTMLElement, options?: OuiFocusTrapOptions): OuiFocusTrap;
|
|
71
71
|
declare function removeFocusTrap(element: HTMLElement): void;
|
|
72
72
|
declare const ATTRIBUTE_FOCUSTRAP = "oui-focus-trap";
|
|
73
|
-
declare const ATTRIBUTE_FOCUSTRAP_CONTAIN
|
|
74
|
-
declare const ATTRIBUTE_FOCUSTRAP_NOESCAPE
|
|
73
|
+
declare const ATTRIBUTE_FOCUSTRAP_CONTAIN: string;
|
|
74
|
+
declare const ATTRIBUTE_FOCUSTRAP_NOESCAPE: string;
|
|
75
75
|
//#endregion
|
|
76
76
|
export { OuiFocusTrapOptions as a, OuiFocusTrap as i, ATTRIBUTE_FOCUSTRAP_CONTAIN as n, createFocusTrap as o, ATTRIBUTE_FOCUSTRAP_NOESCAPE as r, removeFocusTrap as s, ATTRIBUTE_FOCUSTRAP as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as OuiLocalizations } from "./l10n-Bn-7RcwR.mjs";
|
|
2
|
-
import { d as OuiListboxType, n as OuiListboxAutoComplete, o as OuiListboxLocalizations } from "./listbox.model-
|
|
3
|
-
import { c as COMBOBOX_TAGNAME } from "./constants.combobox-
|
|
2
|
+
import { d as OuiListboxType, n as OuiListboxAutoComplete, o as OuiListboxLocalizations } from "./listbox.model-BHPA7GM4.mjs";
|
|
3
|
+
import { c as COMBOBOX_TAGNAME } from "./constants.combobox-8EMRmv09.mjs";
|
|
4
4
|
//#region src/js/combobox/misc.combobox.d.ts
|
|
5
5
|
declare function getComboboxAutoComplete(element: OuiComboboxElement, select: boolean): OuiListboxAutoComplete;
|
|
6
6
|
declare function getComboboxId(): string;
|
|
@@ -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,17 +1,18 @@
|
|
|
1
|
-
import { a as OuiFloatablePosition, n as CreateOuiFloatableOptions, r as OuiFloatable, s as createFloatable } from "./floatable.embedded-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { a as OuiFloatablePosition, n as CreateOuiFloatableOptions, r as OuiFloatable, s as createFloatable } from "./floatable.embedded-DQYkXt8X.mjs";
|
|
2
|
+
import { A as OuiColorPickerEvent, B as OuiColorPickerElement, G as setColorPickerLocalizations } from "./constants.color-picker-B-gFjL8m.mjs";
|
|
3
|
+
import { a as setComboboxLocalizations, t as OuiComboboxElement } from "./index-C5D3-oiI.mjs";
|
|
4
|
+
import { d as OuiSortable, f as createSortable, g as createMovable, h as OuiMovable, t as CreateOuiDraggableOptions } from "./draggable-B5-70SZm.mjs";
|
|
4
5
|
import "./movable/movable.standalone.mjs";
|
|
5
|
-
import { a as createResizable, n as OuiResizable, t as CreateOuiResizableOptions } from "./resizable.embedded-
|
|
6
|
+
import { a as createResizable, n as OuiResizable, t as CreateOuiResizableOptions } from "./resizable.embedded-dvhdfQgt.mjs";
|
|
6
7
|
import "./resizable/resizable.standalone.mjs";
|
|
7
8
|
import { OuiDialog, getDialog } from "./dialog.mjs";
|
|
8
9
|
import "./floatable/floatable.standalone.mjs";
|
|
9
|
-
import { a as OuiFocusTrapOptions, i as OuiFocusTrap, o as createFocusTrap } from "./focus-trap.embedded-
|
|
10
|
-
import { n as setListboxLocalizations } from "./misc.listbox-
|
|
10
|
+
import { a as OuiFocusTrapOptions, i as OuiFocusTrap, o as createFocusTrap } from "./focus-trap.embedded-CjyFQYow.mjs";
|
|
11
|
+
import { n as setListboxLocalizations } from "./misc.listbox-mZMuYOxg.mjs";
|
|
11
12
|
import { OuiListboxElement } from "./listbox/index.mjs";
|
|
12
13
|
import { OuiPopover, getPopover } from "./popover.mjs";
|
|
13
14
|
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 };
|