@glimstone/vue 4.1.0 → 4.1.2
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/Button.vue.d.ts +23 -2
- package/dist/Card.vue.d.ts +2 -0
- package/dist/Combobox.js +32 -31
- package/dist/Combobox.vue.d.ts +1 -1
- package/dist/ContextMenu.vue.d.ts +2 -0
- package/dist/CopyField.vue.d.ts +4 -2
- package/dist/FieldRow.vue.d.ts +32 -0
- package/dist/FieldRowGroup.vue.d.ts +19 -0
- package/dist/GlyphField.vue.d.ts +35 -0
- package/dist/GlyphTile.vue.d.ts +13 -0
- package/dist/IconButton.vue.d.ts +18 -0
- package/dist/IconTipButton.vue.d.ts +2 -0
- package/dist/ListRow.vue.d.ts +26 -0
- package/dist/ListSelect.vue.d.ts +4 -1
- package/dist/MenuChoice.vue.d.ts +2 -1
- package/dist/MenuSelect.vue.d.ts +4 -1
- package/dist/MenuSubmenu.vue.d.ts +2 -1
- package/dist/Meter.vue.d.ts +1 -1
- package/dist/PasswordField.vue.d.ts +7 -1
- package/dist/PathField.vue.d.ts +40 -0
- package/dist/RowMark.vue.d.ts +6 -0
- package/dist/Select.js +241 -218
- package/dist/Select.vue.d.ts +10 -4
- package/dist/Selector.vue.d.ts +48 -50
- package/dist/SelectorSegment.vue.d.ts +1 -1
- package/dist/SidebarRow.vue.d.ts +19 -2
- package/dist/SidebarRowLink.vue.d.ts +17 -0
- package/dist/Slider.js +19 -18
- package/dist/Slider.vue.d.ts +1 -1
- package/dist/SubCard.vue.d.ts +1 -1
- package/dist/Table.vue.d.ts +32 -0
- package/dist/TextArea.vue.d.ts +21 -0
- package/dist/TextField.vue.d.ts +21 -0
- package/dist/ToastViewport.vue.d.ts +2 -1
- package/dist/Toggle.vue.d.ts +2 -1
- package/dist/Tree.vue.d.ts +23 -0
- package/dist/Window.vue.d.ts +5 -1
- package/dist/fieldName-DBygJJfe.js +8 -0
- package/dist/fieldName.d.ts +5 -0
- package/dist/{glyphs-Cgknt-k1.js → glyphs-CYhs4mrY.js} +2 -2
- package/dist/glyphs.d.ts +1 -0
- package/dist/index.d.ts +15 -2
- package/dist/index.js +1238 -657
- package/dist/selectorItem.d.ts +5 -3
- package/dist/windowParts.d.ts +6 -1
- package/package.json +2 -2
package/dist/Select.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
1
|
+
import { r as e } from "./fieldName-DBygJJfe.js";
|
|
2
|
+
import { a as t, n } from "./glyphs-CYhs4mrY.js";
|
|
3
|
+
import { n as r, r as i, t as a } from "./TipWrap-rNAEgvb0.js";
|
|
4
|
+
import { Fragment as o, Teleport as s, computed as c, createBlock as l, createCommentVNode as u, createElementBlock as d, createElementVNode as f, createVNode as p, defineComponent as m, guardReactiveProps as h, mergeModels as g, mergeProps as _, normalizeClass as v, normalizeProps as y, onMounted as b, onScopeDispose as x, openBlock as S, renderList as C, resolveDynamicComponent as w, shallowRef as T, toDisplayString as E, unref as D, useId as O, useModel as k, watch as A, withCtx as j } from "vue";
|
|
5
|
+
import { SELECT_POSITIONING as M, closeOnPageMove as N, defaultWidth as P, enableWheelStep as F, faceLabels as I, flattenRuns as L, hasSubmenu as R, homeRow as z, isSubmenu as B, pageDir as V, readPortalHue as H, selectRootClass as U, selectRowParts as W, selectTriggerClass as G, shake as K, wheelValue as q } from "@glimstone/core";
|
|
6
|
+
import * as J from "@zag-js/select";
|
|
7
|
+
import { normalizeProps as Y, useMachine as X } from "@zag-js/vue";
|
|
8
|
+
import * as Z from "@zag-js/menu";
|
|
8
9
|
// src/SelectFace.vue?vue&type=script&setup=true&lang.ts
|
|
9
10
|
var ee = {
|
|
10
11
|
key: 0,
|
|
11
12
|
class: "glim-select-glyph"
|
|
12
|
-
}, te = { class: "glim-select-value" }, ne = ["aria-hidden"],
|
|
13
|
+
}, te = { class: "glim-select-value" }, ne = ["aria-hidden"], Q = /* @__PURE__ */ m({
|
|
13
14
|
__name: "SelectFace",
|
|
14
15
|
props: {
|
|
15
16
|
all: {},
|
|
@@ -19,39 +20,36 @@ var ee = {
|
|
|
19
20
|
glyphs: { type: Boolean }
|
|
20
21
|
},
|
|
21
22
|
setup(e) {
|
|
22
|
-
let t = e, n =
|
|
23
|
-
return (t, i) => (
|
|
23
|
+
let t = e, n = c(() => I(t.all, t.value, t.placeholder, t.width)), r = c(() => t.all.find((e) => e.value === t.value)?.glyph);
|
|
24
|
+
return (t, i) => (S(), d(o, null, [e.glyphs ? (S(), d("span", ee, [r.value ? (S(), l(w(r.value), { key: 0 })) : u("", !0)])) : u("", !0), f("span", te, [(S(!0), d(o, null, C(n.value.labels, (e) => (S(), d("span", {
|
|
24
25
|
key: e,
|
|
25
26
|
"aria-hidden": e !== n.value.text || void 0,
|
|
26
|
-
class:
|
|
27
|
-
},
|
|
27
|
+
class: v(e === n.value.text ? void 0 : "glim-select-ghost")
|
|
28
|
+
}, E(e), 11, ne))), 128))])], 64));
|
|
28
29
|
}
|
|
29
30
|
});
|
|
30
31
|
// src/selectParts.ts
|
|
31
|
-
function
|
|
32
|
-
let n =
|
|
33
|
-
return
|
|
34
|
-
style:
|
|
35
|
-
className:
|
|
32
|
+
function $(e, t) {
|
|
33
|
+
let n = T(null);
|
|
34
|
+
return A(e, (e) => n.value = e && t.value ? H(t.value) : null, { flush: "sync" }), {
|
|
35
|
+
style: c(() => n.value ?? void 0),
|
|
36
|
+
className: c(() => n.value ? "glim-hue" : "")
|
|
36
37
|
};
|
|
37
38
|
}
|
|
38
|
-
function
|
|
39
|
+
function re(e, t) {
|
|
39
40
|
let n;
|
|
40
|
-
|
|
41
|
-
n?.(), n = e ?
|
|
41
|
+
A(e, (e) => {
|
|
42
|
+
n?.(), n = e ? F(e, (e) => {
|
|
42
43
|
if (t.inert()) return;
|
|
43
|
-
let n =
|
|
44
|
+
let n = q(t.all(), t.value(), e);
|
|
44
45
|
n !== void 0 && t.onChange(n);
|
|
45
46
|
}) : void 0;
|
|
46
|
-
}, { immediate: !0 }),
|
|
47
|
-
e.value && t > 0 && r(
|
|
48
|
-
}),
|
|
47
|
+
}, { immediate: !0 }), A(t.shakeCount, (t, n, r) => {
|
|
48
|
+
e.value && t > 0 && r(K(e.value));
|
|
49
|
+
}), x(() => n?.());
|
|
49
50
|
}
|
|
50
51
|
// src/ListSelect.vue?vue&type=script&setup=true&lang.ts
|
|
51
|
-
var
|
|
52
|
-
key: 0,
|
|
53
|
-
class: "glim-select-glyph"
|
|
54
|
-
}, ae = /* @__PURE__ */ p({
|
|
52
|
+
var ie = ["aria-busy", "aria-describedby"], ae = /* @__PURE__ */ m({
|
|
55
53
|
__name: "ListSelect",
|
|
56
54
|
props: {
|
|
57
55
|
label: {},
|
|
@@ -60,114 +58,123 @@ var re = ["aria-busy", "aria-describedby"], ie = {
|
|
|
60
58
|
value: {},
|
|
61
59
|
placeholder: {},
|
|
62
60
|
width: {},
|
|
61
|
+
rows: {},
|
|
63
62
|
triggerClass: {},
|
|
64
63
|
id: {},
|
|
64
|
+
triggerAttrs: {},
|
|
65
|
+
listId: {},
|
|
65
66
|
disabled: { type: Boolean },
|
|
66
67
|
busy: { type: Boolean },
|
|
67
68
|
tip: {},
|
|
68
69
|
shake: {}
|
|
69
70
|
},
|
|
70
71
|
emits: ["change"],
|
|
71
|
-
setup(
|
|
72
|
-
let
|
|
73
|
-
items:
|
|
72
|
+
setup(e, { expose: m, emit: g }) {
|
|
73
|
+
let b = e, x = g, k = O(), P = c(() => L(b.groups)), F = c(() => P.value.some((e) => e.glyph)), I = c(() => W(b.rows, F.value)), R = c(() => J.collection({
|
|
74
|
+
items: P.value,
|
|
74
75
|
itemToValue: (e) => e.value,
|
|
75
76
|
itemToString: (e) => e.label,
|
|
76
77
|
isItemDisabled: (e) => !!e.disabled
|
|
77
|
-
})),
|
|
78
|
-
id:
|
|
79
|
-
ids:
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
78
|
+
})), z = X(J.machine, c(() => ({
|
|
79
|
+
id: k,
|
|
80
|
+
ids: {
|
|
81
|
+
trigger: b.id,
|
|
82
|
+
content: b.listId
|
|
83
|
+
},
|
|
84
|
+
dir: V(),
|
|
85
|
+
collection: R.value,
|
|
86
|
+
value: b.value === null ? [] : [b.value],
|
|
87
|
+
disabled: b.disabled,
|
|
88
|
+
readOnly: b.busy,
|
|
85
89
|
onValueChange: (e) => {
|
|
86
90
|
let t = e.value[0];
|
|
87
|
-
t !== void 0 && t !==
|
|
91
|
+
t !== void 0 && t !== b.value && x("change", t);
|
|
88
92
|
},
|
|
89
|
-
positioning:
|
|
90
|
-
}))),
|
|
91
|
-
|
|
92
|
-
all: () =>
|
|
93
|
-
value: () =>
|
|
94
|
-
inert: () => !!(
|
|
95
|
-
onChange: (e) =>
|
|
96
|
-
shakeCount: () =>
|
|
97
|
-
}),
|
|
98
|
-
e && n(
|
|
93
|
+
positioning: M
|
|
94
|
+
}))), B = c(() => J.connect(z, Y)), H = T(null), G = i(() => b.tip, () => !!b.disabled);
|
|
95
|
+
re(H, {
|
|
96
|
+
all: () => P.value,
|
|
97
|
+
value: () => b.value,
|
|
98
|
+
inert: () => !!(b.disabled || b.busy),
|
|
99
|
+
onChange: (e) => x("change", e),
|
|
100
|
+
shakeCount: () => b.shake ?? 0
|
|
101
|
+
}), A(() => B.value.open, (e, t, n) => {
|
|
102
|
+
e && n(N(() => B.value.setOpen(!1)));
|
|
99
103
|
});
|
|
100
|
-
let
|
|
101
|
-
function
|
|
102
|
-
|
|
104
|
+
let K = $(() => B.value.open, H);
|
|
105
|
+
function q(e) {
|
|
106
|
+
H.value = e, G.trigger.value = H.value;
|
|
103
107
|
}
|
|
104
|
-
return
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
on: !!
|
|
108
|
-
show:
|
|
109
|
-
hide:
|
|
108
|
+
return m({ trigger: H }), (i, c) => (S(), d("div", _(B.value.getRootProps(), { class: D(U)(e.width) }), [
|
|
109
|
+
f("label", _(B.value.getLabelProps(), { class: e.hideLabel ? "glim-sr-only" : "glim-field-label" }), E(e.label), 17),
|
|
110
|
+
f("div", y(h(B.value.getControlProps())), [p(D(a), {
|
|
111
|
+
on: !!e.disabled && !!e.tip,
|
|
112
|
+
show: D(G).show,
|
|
113
|
+
hide: D(G).hide
|
|
110
114
|
}, {
|
|
111
|
-
default:
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
115
|
+
default: j(() => [f("button", _({
|
|
116
|
+
...e.triggerAttrs,
|
|
117
|
+
...B.value.getTriggerProps()
|
|
118
|
+
}, {
|
|
119
|
+
ref: q,
|
|
120
|
+
"aria-busy": e.busy || void 0,
|
|
121
|
+
"aria-describedby": D(G).describedBy.value,
|
|
122
|
+
class: e.triggerClass,
|
|
123
|
+
onMouseenter: c[0] ||= (...e) => D(G).show && D(G).show(...e),
|
|
124
|
+
onMouseleave: c[1] ||= (...e) => D(G).hide && D(G).hide(...e),
|
|
125
|
+
onFocus: c[2] ||= (...e) => D(G).showOnFocus && D(G).showOnFocus(...e),
|
|
126
|
+
onBlur: c[3] ||= (...e) => D(G).hide && D(G).hide(...e)
|
|
127
|
+
}), [p(Q, {
|
|
128
|
+
all: P.value,
|
|
129
|
+
value: e.value,
|
|
130
|
+
placeholder: e.placeholder,
|
|
131
|
+
width: e.width,
|
|
132
|
+
glyphs: F.value
|
|
126
133
|
}, null, 8, [
|
|
127
134
|
"all",
|
|
128
135
|
"value",
|
|
129
136
|
"placeholder",
|
|
130
137
|
"width",
|
|
131
138
|
"glyphs"
|
|
132
|
-
]),
|
|
139
|
+
]), f("span", _(B.value.getIndicatorProps(), { class: "glim-select-indicator" }), [p(D(t))], 16)], 16, ie)]),
|
|
133
140
|
_: 1
|
|
134
141
|
}, 8, [
|
|
135
142
|
"on",
|
|
136
143
|
"show",
|
|
137
144
|
"hide"
|
|
138
145
|
])], 16),
|
|
139
|
-
|
|
140
|
-
(
|
|
141
|
-
style:
|
|
142
|
-
class: ["glim-select-positioner",
|
|
143
|
-
}), [
|
|
146
|
+
p(r, { state: D(G) }, null, 8, ["state"]),
|
|
147
|
+
(S(), l(s, { to: "body" }, [f("div", _(B.value.getPositionerProps(), {
|
|
148
|
+
style: D(K).style.value,
|
|
149
|
+
class: ["glim-select-positioner", D(K).className.value]
|
|
150
|
+
}), [f("div", _(B.value.getContentProps(), { class: I.value.content }), [(S(!0), d(o, null, C(e.groups, (e, t) => (S(), d(o, { key: t }, [e.entries.length > 0 ? (S(), d("div", _({
|
|
144
151
|
key: 0,
|
|
145
152
|
ref_for: !0
|
|
146
|
-
}, e.heading ?
|
|
153
|
+
}, e.heading ? B.value.getItemGroupProps({ id: `${D(k)}-g${t}` }) : {}, { class: "glim-select-group" }), [e.heading ? (S(), d("div", _({
|
|
147
154
|
key: 0,
|
|
148
155
|
ref_for: !0
|
|
149
|
-
},
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
156
|
+
}, B.value.getItemGroupLabelProps({ htmlFor: `${D(k)}-g${t}` }), { class: I.value.heading }), E(e.heading), 17)) : u("", !0), (S(!0), d(o, null, C(e.entries, (e) => (S(), d("div", _({ key: e.value }, { ref_for: !0 }, B.value.getItemProps({ item: e }), { class: I.value.item }), [
|
|
157
|
+
I.value.glyph ? (S(), d("span", {
|
|
158
|
+
key: 0,
|
|
159
|
+
class: v(I.value.glyph)
|
|
160
|
+
}, [e.glyph ? (S(), l(w(e.glyph), { key: 0 })) : u("", !0)], 2)) : u("", !0),
|
|
161
|
+
f("span", _({ ref_for: !0 }, B.value.getItemTextProps({ item: e }), { class: I.value.label }), E(e.label), 17),
|
|
162
|
+
f("span", _({ ref_for: !0 }, B.value.getItemIndicatorProps({ item: e }), { class: I.value.check }), [p(D(n))], 16)
|
|
163
|
+
], 16))), 128))], 16)) : u("", !0)], 64))), 128))], 16)], 16)])),
|
|
164
|
+
f("select", y(h(B.value.getHiddenSelectProps())), null, 16)
|
|
155
165
|
], 16));
|
|
156
166
|
}
|
|
157
|
-
}), oe = {
|
|
158
|
-
key: 0,
|
|
159
|
-
class: "glim-select-glyph"
|
|
160
|
-
}, se = ["data-state"], ce = /* @__PURE__ */ p({
|
|
167
|
+
}), oe = ["data-state"], se = /* @__PURE__ */ m({
|
|
161
168
|
__name: "MenuChoice",
|
|
162
169
|
props: {
|
|
163
170
|
api: {},
|
|
164
171
|
option: {},
|
|
165
172
|
value: {},
|
|
166
|
-
|
|
173
|
+
parts: {}
|
|
167
174
|
},
|
|
168
175
|
emits: ["change"],
|
|
169
|
-
setup(e, { emit:
|
|
170
|
-
let r = e, i =
|
|
176
|
+
setup(e, { emit: t }) {
|
|
177
|
+
let r = e, i = t, a = c(() => r.option.value === r.value), o = c(() => ({
|
|
171
178
|
type: "radio",
|
|
172
179
|
value: r.option.value,
|
|
173
180
|
valueText: r.option.label,
|
|
@@ -177,23 +184,20 @@ var re = ["aria-busy", "aria-describedby"], ie = {
|
|
|
177
184
|
a.value || i("change", r.option.value);
|
|
178
185
|
}
|
|
179
186
|
}));
|
|
180
|
-
return (
|
|
181
|
-
e.
|
|
182
|
-
|
|
183
|
-
|
|
187
|
+
return (t, r) => (S(), d("div", _(e.api.getOptionItemProps(o.value), { class: e.parts.item }), [
|
|
188
|
+
e.parts.glyph ? (S(), d("span", {
|
|
189
|
+
key: 0,
|
|
190
|
+
class: v(e.parts.glyph)
|
|
191
|
+
}, [e.option.glyph ? (S(), l(w(e.option.glyph), { key: 0 })) : u("", !0)], 2)) : u("", !0),
|
|
192
|
+
f("span", _(e.api.getItemTextProps(o.value), { class: e.parts.label }), E(e.option.label), 17),
|
|
193
|
+
f("span", {
|
|
184
194
|
"aria-hidden": "true",
|
|
185
195
|
"data-state": a.value ? "checked" : "unchecked",
|
|
186
|
-
class:
|
|
187
|
-
}, [
|
|
196
|
+
class: v(e.parts.check)
|
|
197
|
+
}, [p(D(n))], 10, oe)
|
|
188
198
|
], 16));
|
|
189
199
|
}
|
|
190
|
-
}),
|
|
191
|
-
key: 0,
|
|
192
|
-
class: "glim-select-glyph"
|
|
193
|
-
}, ue = { class: "glim-select-label" }, de = {
|
|
194
|
-
"aria-hidden": "true",
|
|
195
|
-
class: "glim-select-caret"
|
|
196
|
-
}, fe = /* @__PURE__ */ p({
|
|
200
|
+
}), ce = /* @__PURE__ */ m({
|
|
197
201
|
__name: "MenuSubmenu",
|
|
198
202
|
props: {
|
|
199
203
|
parent: {},
|
|
@@ -201,53 +205,59 @@ var re = ["aria-busy", "aria-describedby"], ie = {
|
|
|
201
205
|
triggerId: {},
|
|
202
206
|
entry: {},
|
|
203
207
|
value: {},
|
|
204
|
-
|
|
208
|
+
parts: {},
|
|
205
209
|
hueStyle: {},
|
|
206
210
|
hueClass: {}
|
|
207
211
|
},
|
|
208
212
|
emits: ["change"],
|
|
209
|
-
setup(
|
|
210
|
-
let r =
|
|
211
|
-
id:
|
|
213
|
+
setup(e, { emit: n }) {
|
|
214
|
+
let r = e, i = n, a = X(Z.machine, {
|
|
215
|
+
id: O(),
|
|
212
216
|
ids: { trigger: r.triggerId },
|
|
213
|
-
dir:
|
|
217
|
+
dir: V(),
|
|
214
218
|
"aria-label": r.entry.label
|
|
215
|
-
}), m =
|
|
216
|
-
return
|
|
217
|
-
r.parentApi.setChild(
|
|
218
|
-
}), (n, r) => (
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
219
|
+
}), m = c(() => Z.connect(a, Y));
|
|
220
|
+
return b(() => {
|
|
221
|
+
r.parentApi.setChild(a), m.value.setParent(r.parent);
|
|
222
|
+
}), (n, r) => (S(), d(o, null, [f("div", _(e.parentApi.getTriggerItemProps(m.value), { class: e.parts.item }), [
|
|
223
|
+
e.parts.glyph ? (S(), d("span", {
|
|
224
|
+
key: 0,
|
|
225
|
+
class: v(e.parts.glyph)
|
|
226
|
+
}, [e.entry.glyph ? (S(), l(w(e.entry.glyph), { key: 0 })) : u("", !0)], 2)) : u("", !0),
|
|
227
|
+
f("span", { class: v(e.parts.label) }, E(e.entry.label), 3),
|
|
228
|
+
f("span", {
|
|
229
|
+
"aria-hidden": "true",
|
|
230
|
+
class: v(e.parts.caret)
|
|
231
|
+
}, [p(D(t))], 2)
|
|
232
|
+
], 16), (S(), l(s, { to: "body" }, [f("div", _(m.value.getPositionerProps(), {
|
|
233
|
+
style: e.hueStyle,
|
|
234
|
+
class: ["glim-select-positioner", e.hueClass]
|
|
235
|
+
}), [f("div", _(m.value.getContentProps(), { class: e.parts.content }), [(S(!0), d(o, null, C(e.entry.options, (t) => (S(), l(se, {
|
|
236
|
+
key: t.value,
|
|
227
237
|
api: m.value,
|
|
228
|
-
option:
|
|
229
|
-
value:
|
|
230
|
-
|
|
238
|
+
option: t,
|
|
239
|
+
value: e.value,
|
|
240
|
+
parts: e.parts,
|
|
231
241
|
onChange: r[0] ||= (e) => i("change", e)
|
|
232
242
|
}, null, 8, [
|
|
233
243
|
"api",
|
|
234
244
|
"option",
|
|
235
245
|
"value",
|
|
236
|
-
"
|
|
246
|
+
"parts"
|
|
237
247
|
]))), 128))], 16)], 16)]))], 64));
|
|
238
248
|
}
|
|
239
|
-
}),
|
|
249
|
+
}), le = {
|
|
240
250
|
key: 0,
|
|
241
251
|
"aria-hidden": "true",
|
|
242
252
|
class: "glim-field-label"
|
|
243
|
-
},
|
|
253
|
+
}, ue = [
|
|
244
254
|
"disabled",
|
|
245
255
|
"data-disabled",
|
|
246
256
|
"data-readonly",
|
|
247
257
|
"aria-busy",
|
|
248
258
|
"aria-label",
|
|
249
259
|
"aria-describedby"
|
|
250
|
-
],
|
|
260
|
+
], de = /* @__PURE__ */ m({
|
|
251
261
|
__name: "MenuSelect",
|
|
252
262
|
props: {
|
|
253
263
|
label: {},
|
|
@@ -256,143 +266,150 @@ var re = ["aria-busy", "aria-describedby"], ie = {
|
|
|
256
266
|
value: {},
|
|
257
267
|
placeholder: {},
|
|
258
268
|
width: {},
|
|
269
|
+
rows: {},
|
|
259
270
|
triggerClass: {},
|
|
260
271
|
id: {},
|
|
272
|
+
triggerAttrs: {},
|
|
273
|
+
listId: {},
|
|
261
274
|
disabled: { type: Boolean },
|
|
262
275
|
busy: { type: Boolean },
|
|
263
276
|
tip: {},
|
|
264
277
|
shake: {}
|
|
265
278
|
},
|
|
266
279
|
emits: ["change"],
|
|
267
|
-
setup(
|
|
268
|
-
let h =
|
|
280
|
+
setup(e, { expose: n, emit: m }) {
|
|
281
|
+
let h = e, g = m, y = O(), b = X(Z.machine, c(() => ({
|
|
269
282
|
id: y,
|
|
270
|
-
ids:
|
|
271
|
-
|
|
283
|
+
ids: {
|
|
284
|
+
trigger: h.id,
|
|
285
|
+
content: h.listId
|
|
286
|
+
},
|
|
287
|
+
dir: V(),
|
|
272
288
|
"aria-label": h.label,
|
|
273
|
-
positioning:
|
|
274
|
-
}))),
|
|
275
|
-
|
|
276
|
-
all: () =>
|
|
289
|
+
positioning: M
|
|
290
|
+
}))), x = c(() => Z.connect(b, Y)), w = c(() => L(h.groups)), k = c(() => w.value.some((e) => e.glyph)), P = c(() => W(h.rows, k.value)), F = c(() => I(w.value, h.value, h.placeholder, h.width).text), R = (e, t) => `${y}-sub-${e}-${t}`, H = T(null), G = i(() => h.tip, () => !!h.disabled);
|
|
291
|
+
re(H, {
|
|
292
|
+
all: () => w.value,
|
|
277
293
|
value: () => h.value,
|
|
278
294
|
inert: () => !!(h.disabled || h.busy),
|
|
279
|
-
onChange: (e) =>
|
|
295
|
+
onChange: (e) => g("change", e),
|
|
280
296
|
shakeCount: () => h.shake ?? 0
|
|
281
297
|
});
|
|
282
|
-
let
|
|
283
|
-
|
|
298
|
+
let K = $(() => x.value.open, H);
|
|
299
|
+
A(() => x.value.open, (e, t, n) => {
|
|
284
300
|
if (!e) return;
|
|
285
|
-
n(
|
|
286
|
-
let r =
|
|
301
|
+
n(N(() => x.value.setOpen(!1)));
|
|
302
|
+
let r = z(h.groups, h.value, R);
|
|
287
303
|
if (r === null) return;
|
|
288
304
|
let i = 0, a = requestAnimationFrame(() => {
|
|
289
|
-
i = requestAnimationFrame(() =>
|
|
305
|
+
i = requestAnimationFrame(() => x.value.setHighlightedValue(r));
|
|
290
306
|
});
|
|
291
307
|
n(() => {
|
|
292
308
|
cancelAnimationFrame(a), cancelAnimationFrame(i);
|
|
293
309
|
});
|
|
294
310
|
});
|
|
295
|
-
let
|
|
296
|
-
let e =
|
|
311
|
+
let q = c(() => {
|
|
312
|
+
let e = x.value.getTriggerProps(), t = (t) => (n) => {
|
|
297
313
|
h.busy ? n.preventDefault() : e[t]?.(n);
|
|
298
314
|
};
|
|
299
315
|
return {
|
|
316
|
+
...h.triggerAttrs,
|
|
300
317
|
...e,
|
|
301
318
|
onPointerdown: t("onPointerdown"),
|
|
302
319
|
onClick: t("onClick"),
|
|
303
320
|
onKeydown: t("onKeydown")
|
|
304
321
|
};
|
|
305
322
|
});
|
|
306
|
-
function
|
|
307
|
-
|
|
323
|
+
function J(e) {
|
|
324
|
+
H.value = e, G.trigger.value = H.value;
|
|
308
325
|
}
|
|
309
|
-
return
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
on: !!
|
|
313
|
-
show:
|
|
314
|
-
hide:
|
|
326
|
+
return n({ trigger: H }), (n, i) => (S(), d("div", { class: v(D(U)(e.width)) }, [
|
|
327
|
+
e.hideLabel ? u("", !0) : (S(), d("span", le, E(e.label), 1)),
|
|
328
|
+
f("div", null, [p(D(a), {
|
|
329
|
+
on: !!e.disabled && !!e.tip,
|
|
330
|
+
show: D(G).show,
|
|
331
|
+
hide: D(G).hide
|
|
315
332
|
}, {
|
|
316
|
-
default:
|
|
317
|
-
ref:
|
|
318
|
-
disabled:
|
|
319
|
-
"data-disabled":
|
|
320
|
-
"data-readonly":
|
|
321
|
-
"aria-busy":
|
|
322
|
-
"aria-label": `${
|
|
323
|
-
"aria-describedby":
|
|
324
|
-
class:
|
|
325
|
-
onMouseenter:
|
|
326
|
-
onMouseleave:
|
|
327
|
-
onFocus:
|
|
328
|
-
onBlur:
|
|
329
|
-
}), [
|
|
330
|
-
all:
|
|
331
|
-
value:
|
|
332
|
-
placeholder:
|
|
333
|
-
width:
|
|
334
|
-
glyphs:
|
|
333
|
+
default: j(() => [f("button", _(q.value, {
|
|
334
|
+
ref: J,
|
|
335
|
+
disabled: e.disabled,
|
|
336
|
+
"data-disabled": e.disabled ? "" : void 0,
|
|
337
|
+
"data-readonly": e.busy ? "" : void 0,
|
|
338
|
+
"aria-busy": e.busy || void 0,
|
|
339
|
+
"aria-label": `${e.label}: ${F.value}`,
|
|
340
|
+
"aria-describedby": D(G).describedBy.value,
|
|
341
|
+
class: e.triggerClass,
|
|
342
|
+
onMouseenter: i[0] ||= (...e) => D(G).show && D(G).show(...e),
|
|
343
|
+
onMouseleave: i[1] ||= (...e) => D(G).hide && D(G).hide(...e),
|
|
344
|
+
onFocus: i[2] ||= (...e) => D(G).showOnFocus && D(G).showOnFocus(...e),
|
|
345
|
+
onBlur: i[3] ||= (...e) => D(G).hide && D(G).hide(...e)
|
|
346
|
+
}), [p(Q, {
|
|
347
|
+
all: w.value,
|
|
348
|
+
value: e.value,
|
|
349
|
+
placeholder: e.placeholder,
|
|
350
|
+
width: e.width,
|
|
351
|
+
glyphs: k.value
|
|
335
352
|
}, null, 8, [
|
|
336
353
|
"all",
|
|
337
354
|
"value",
|
|
338
355
|
"placeholder",
|
|
339
356
|
"width",
|
|
340
357
|
"glyphs"
|
|
341
|
-
]),
|
|
358
|
+
]), f("span", _(x.value.getIndicatorProps(), { class: "glim-select-indicator" }), [p(D(t))], 16)], 16, ue)]),
|
|
342
359
|
_: 1
|
|
343
360
|
}, 8, [
|
|
344
361
|
"on",
|
|
345
362
|
"show",
|
|
346
363
|
"hide"
|
|
347
364
|
])]),
|
|
348
|
-
|
|
349
|
-
(
|
|
350
|
-
style:
|
|
351
|
-
class: ["glim-select-positioner",
|
|
352
|
-
}), [
|
|
365
|
+
p(r, { state: D(G) }, null, 8, ["state"]),
|
|
366
|
+
(S(), l(s, { to: "body" }, [f("div", _(x.value.getPositionerProps(), {
|
|
367
|
+
style: D(K).style.value,
|
|
368
|
+
class: ["glim-select-positioner", D(K).className.value]
|
|
369
|
+
}), [f("div", _(x.value.getContentProps(), { class: P.value.content }), [(S(!0), d(o, null, C(e.groups, (t, n) => (S(), d(o, { key: n }, [t.entries.length > 0 ? (S(), d("div", _({
|
|
353
370
|
key: 0,
|
|
354
371
|
ref_for: !0
|
|
355
|
-
},
|
|
372
|
+
}, t.heading ? x.value.getItemGroupProps({ id: `g${n}` }) : {}, { class: "glim-select-group" }), [t.heading ? (S(), d("div", _({
|
|
356
373
|
key: 0,
|
|
357
374
|
ref_for: !0
|
|
358
|
-
},
|
|
375
|
+
}, x.value.getItemGroupLabelProps({ htmlFor: `g${n}` }), { class: P.value.heading }), E(t.heading), 17)) : u("", !0), (S(!0), d(o, null, C(t.entries, (t, r) => (S(), d(o, { key: D(B)(t) ? `s${r}` : t.value }, [D(B)(t) ? (S(), l(ce, {
|
|
359
376
|
key: 0,
|
|
360
|
-
parent:
|
|
361
|
-
"parent-api":
|
|
362
|
-
"trigger-id":
|
|
363
|
-
entry:
|
|
364
|
-
value:
|
|
365
|
-
|
|
366
|
-
"hue-style":
|
|
367
|
-
"hue-class":
|
|
368
|
-
onChange:
|
|
377
|
+
parent: D(b),
|
|
378
|
+
"parent-api": x.value,
|
|
379
|
+
"trigger-id": R(n, r),
|
|
380
|
+
entry: t,
|
|
381
|
+
value: e.value,
|
|
382
|
+
parts: P.value,
|
|
383
|
+
"hue-style": D(K).style.value,
|
|
384
|
+
"hue-class": D(K).className.value,
|
|
385
|
+
onChange: i[4] ||= (e) => g("change", e)
|
|
369
386
|
}, null, 8, [
|
|
370
387
|
"parent",
|
|
371
388
|
"parent-api",
|
|
372
389
|
"trigger-id",
|
|
373
390
|
"entry",
|
|
374
391
|
"value",
|
|
375
|
-
"
|
|
392
|
+
"parts",
|
|
376
393
|
"hue-style",
|
|
377
394
|
"hue-class"
|
|
378
|
-
])) : (
|
|
395
|
+
])) : (S(), l(se, {
|
|
379
396
|
key: 1,
|
|
380
|
-
api:
|
|
381
|
-
option:
|
|
382
|
-
value:
|
|
383
|
-
|
|
384
|
-
onChange:
|
|
397
|
+
api: x.value,
|
|
398
|
+
option: t,
|
|
399
|
+
value: e.value,
|
|
400
|
+
parts: P.value,
|
|
401
|
+
onChange: i[5] ||= (e) => g("change", e)
|
|
385
402
|
}, null, 8, [
|
|
386
403
|
"api",
|
|
387
404
|
"option",
|
|
388
405
|
"value",
|
|
389
|
-
"
|
|
390
|
-
]))], 64))), 128))], 16)) :
|
|
406
|
+
"parts"
|
|
407
|
+
]))], 64))), 128))], 16)) : u("", !0)], 64))), 128))], 16)], 16)]))
|
|
391
408
|
], 2));
|
|
392
409
|
}
|
|
393
|
-
}),
|
|
410
|
+
}), fe = /* @__PURE__ */ m({
|
|
394
411
|
__name: "Select",
|
|
395
|
-
props: /*@__PURE__*/
|
|
412
|
+
props: /*@__PURE__*/ g({
|
|
396
413
|
label: {},
|
|
397
414
|
hideLabel: {
|
|
398
415
|
type: Boolean,
|
|
@@ -403,11 +420,14 @@ var re = ["aria-busy", "aria-describedby"], ie = {
|
|
|
403
420
|
placeholder: {},
|
|
404
421
|
width: {},
|
|
405
422
|
size: { default: "field" },
|
|
423
|
+
rows: { default: "list" },
|
|
406
424
|
wrap: {
|
|
407
425
|
type: Boolean,
|
|
408
426
|
default: !1
|
|
409
427
|
},
|
|
410
428
|
id: {},
|
|
429
|
+
triggerAttrs: {},
|
|
430
|
+
listId: {},
|
|
411
431
|
disabled: {
|
|
412
432
|
type: Boolean,
|
|
413
433
|
default: !1
|
|
@@ -423,22 +443,25 @@ var re = ["aria-busy", "aria-describedby"], ie = {
|
|
|
423
443
|
modelModifiers: {}
|
|
424
444
|
}),
|
|
425
445
|
emits: ["update:modelValue"],
|
|
426
|
-
setup(
|
|
427
|
-
let
|
|
428
|
-
label:
|
|
429
|
-
hideLabel:
|
|
430
|
-
groups:
|
|
431
|
-
value:
|
|
432
|
-
placeholder:
|
|
433
|
-
width:
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
446
|
+
setup(t) {
|
|
447
|
+
let n = t, r = k(t, "modelValue"), i = c(() => n.groups ?? [{ entries: n.options ?? [] }]), a = e(() => n.label), o = c(() => n.label === void 0), s = c(() => ({
|
|
448
|
+
label: a.value ?? "",
|
|
449
|
+
hideLabel: n.hideLabel || o.value,
|
|
450
|
+
groups: i.value,
|
|
451
|
+
value: r.value,
|
|
452
|
+
placeholder: n.placeholder,
|
|
453
|
+
width: n.width ?? (o.value ? "steady" : P(n.size)),
|
|
454
|
+
rows: n.rows,
|
|
455
|
+
triggerClass: G(n.size, n.wrap),
|
|
456
|
+
id: n.id,
|
|
457
|
+
triggerAttrs: n.triggerAttrs,
|
|
458
|
+
listId: n.listId,
|
|
459
|
+
disabled: n.disabled,
|
|
460
|
+
busy: n.busy,
|
|
461
|
+
tip: n.tip,
|
|
462
|
+
shake: n.shake
|
|
440
463
|
}));
|
|
441
|
-
return (e, t) =>
|
|
464
|
+
return (e, t) => D(R)(i.value) ? (S(), l(de, _({ key: 0 }, s.value, { onChange: t[0] ||= (e) => r.value = e }), null, 16)) : (S(), l(ae, _({ key: 1 }, s.value, { onChange: t[1] ||= (e) => r.value = e }), null, 16));
|
|
442
465
|
}
|
|
443
466
|
});
|
|
444
|
-
export {
|
|
467
|
+
export { fe as Select };
|