@sprawlify/primitives 0.0.112 → 0.0.114
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/{date-utils-Dz9DZPcZ.cjs → date-utils-B-dqorZV.cjs} +48 -13
- package/dist/{date-utils-BqOQP2-U.mjs → date-utils-BdeeOQRI.mjs} +43 -14
- package/dist/date-utils.cjs +2 -1
- package/dist/date-utils.d.cts +6 -5
- package/dist/date-utils.d.mts +2 -2
- package/dist/date-utils.mjs +2 -2
- package/dist/{index-6cEVkXqi.d.mts → index-BfUngXif.d.mts} +6 -5
- package/dist/machines/accordion/index.d.cts +1 -1
- package/dist/machines/accordion/index.d.mts +1 -1
- package/dist/machines/angle-slider/index.cjs +64 -24
- package/dist/machines/angle-slider/index.d.cts +1 -1
- package/dist/machines/angle-slider/index.d.mts +1 -1
- package/dist/machines/angle-slider/index.mjs +65 -25
- package/dist/machines/carousel/index.d.cts +1 -1
- package/dist/machines/carousel/index.d.mts +1 -1
- package/dist/machines/cascade-select/index.cjs +44 -19
- package/dist/machines/cascade-select/index.d.cts +13 -10
- package/dist/machines/cascade-select/index.d.mts +13 -10
- package/dist/machines/cascade-select/index.mjs +45 -20
- package/dist/machines/checkbox/index.cjs +0 -5
- package/dist/machines/checkbox/index.mjs +0 -5
- package/dist/machines/clipboard/index.d.cts +1 -1
- package/dist/machines/clipboard/index.d.mts +1 -1
- package/dist/machines/collapsible/index.d.cts +1 -1
- package/dist/machines/collapsible/index.d.mts +1 -1
- package/dist/machines/color-picker/index.d.cts +1 -1
- package/dist/machines/color-picker/index.d.mts +1 -1
- package/dist/machines/combobox/index.cjs +13 -11
- package/dist/machines/combobox/index.d.cts +1 -1
- package/dist/machines/combobox/index.d.mts +1 -1
- package/dist/machines/combobox/index.mjs +14 -12
- package/dist/machines/date-picker/index.cjs +46 -25
- package/dist/machines/date-picker/index.d.cts +3 -2
- package/dist/machines/date-picker/index.d.mts +4 -3
- package/dist/machines/date-picker/index.mjs +47 -26
- package/dist/machines/dialog/index.d.cts +1 -1
- package/dist/machines/dialog/index.d.mts +1 -1
- package/dist/machines/drawer/index.d.cts +1 -1
- package/dist/machines/drawer/index.d.mts +1 -1
- package/dist/machines/dropdown-menu/index.d.cts +1 -1
- package/dist/machines/dropdown-menu/index.d.mts +1 -1
- package/dist/machines/editable/index.d.cts +1 -1
- package/dist/machines/editable/index.d.mts +1 -1
- package/dist/machines/file-upload/index.d.cts +1 -1
- package/dist/machines/file-upload/index.d.mts +1 -1
- package/dist/machines/floating-panel/index.d.cts +1 -1
- package/dist/machines/floating-panel/index.d.mts +1 -1
- package/dist/machines/hover-card/index.d.cts +1 -1
- package/dist/machines/hover-card/index.d.mts +1 -1
- package/dist/machines/image-cropper/index.d.cts +1 -1
- package/dist/machines/image-cropper/index.d.mts +1 -1
- package/dist/machines/listbox/index.d.cts +1 -1
- package/dist/machines/listbox/index.d.mts +1 -1
- package/dist/machines/marquee/index.d.cts +3 -3
- package/dist/machines/marquee/index.d.mts +3 -3
- package/dist/machines/navigation-menu/index.d.cts +1 -1
- package/dist/machines/navigation-menu/index.d.mts +1 -1
- package/dist/machines/number-input/index.d.cts +1 -1
- package/dist/machines/number-input/index.d.mts +1 -1
- package/dist/machines/pagination/index.d.cts +1 -1
- package/dist/machines/pagination/index.d.mts +1 -1
- package/dist/machines/password-input/index.d.cts +1 -1
- package/dist/machines/password-input/index.d.mts +1 -1
- package/dist/machines/pin-input/index.d.cts +1 -1
- package/dist/machines/pin-input/index.d.mts +1 -1
- package/dist/machines/popover/index.d.cts +1 -1
- package/dist/machines/popover/index.d.mts +1 -1
- package/dist/machines/progress/index.d.cts +1 -1
- package/dist/machines/progress/index.d.mts +1 -1
- package/dist/machines/scroll-area/index.d.cts +1 -1
- package/dist/machines/scroll-area/index.d.mts +1 -1
- package/dist/machines/select/index.d.cts +1 -1
- package/dist/machines/select/index.d.mts +1 -1
- package/dist/machines/slider/index.d.cts +1 -1
- package/dist/machines/slider/index.d.mts +1 -1
- package/dist/machines/splitter/index.d.cts +1 -1
- package/dist/machines/splitter/index.d.mts +1 -1
- package/dist/machines/steps/index.d.cts +1 -1
- package/dist/machines/steps/index.d.mts +1 -1
- package/dist/machines/tabs/index.d.cts +1 -1
- package/dist/machines/tabs/index.d.mts +1 -1
- package/dist/machines/tags-input/index.d.cts +1 -1
- package/dist/machines/tags-input/index.d.mts +1 -1
- package/dist/machines/timer/index.d.cts +1 -1
- package/dist/machines/timer/index.d.mts +1 -1
- package/dist/machines/toast/index.d.cts +1 -1
- package/dist/machines/toast/index.d.mts +1 -1
- package/dist/machines/tooltip/index.d.cts +1 -1
- package/dist/machines/tooltip/index.d.mts +1 -1
- package/dist/machines/tour/index.d.cts +1 -1
- package/dist/machines/tour/index.d.mts +1 -1
- package/dist/machines/tree-view/index.d.cts +1 -1
- package/dist/machines/tree-view/index.d.mts +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as createAnatomy } from "../../create-anatomy-Dr0evdYy.mjs";
|
|
2
|
-
import { E as trackPointerMove, St as isLeftClick, W as raf, ct as setElementValue, gt as getNativeEvent, mt as getEventStep, pt as getEventPoint, xn as dataAttr } from "../../dom-query-BFuRs3l4.mjs";
|
|
2
|
+
import { E as trackPointerMove, St as isLeftClick, W as raf, ct as setElementValue, ft as getEventKey, gt as getNativeEvent, mt as getEventStep, pt as getEventPoint, xn as dataAttr } from "../../dom-query-BFuRs3l4.mjs";
|
|
3
3
|
import { B as snapValueToStep, u as createSplitProps } from "../../utils-VVoZ_v29.mjs";
|
|
4
4
|
import { a as createMachine } from "../../core-Ci9Yu6QI.mjs";
|
|
5
5
|
import { R as createRect, q as getPointAngle } from "../../rect-utils-B5xqFvKC.mjs";
|
|
@@ -18,11 +18,24 @@ const getLabelId = (ctx) => ctx.ids?.label ?? `angle-slider:${ctx.id}:label`;
|
|
|
18
18
|
const getHiddenInputEl = (ctx) => ctx.getById(getHiddenInputId(ctx));
|
|
19
19
|
const getControlEl = (ctx) => ctx.getById(getControlId(ctx));
|
|
20
20
|
const getThumbEl = (ctx) => ctx.getById(getThumbId(ctx));
|
|
21
|
-
function
|
|
22
|
-
|
|
21
|
+
function mirrorAngle(angle) {
|
|
22
|
+
return (360 - angle) % 360;
|
|
23
|
+
}
|
|
24
|
+
function getAngle(controlEl, point, angularOffset, dir) {
|
|
25
|
+
let angle = getPointAngle(createRect(controlEl.getBoundingClientRect()), point);
|
|
23
26
|
if (angularOffset != null) return angle - angularOffset;
|
|
27
|
+
if (dir === "rtl") angle = mirrorAngle(angle);
|
|
24
28
|
return angle;
|
|
25
29
|
}
|
|
30
|
+
function getPointerValue(controlEl, point, angularOffset, value, dir) {
|
|
31
|
+
if (angularOffset == null) return getAngle(controlEl, point, null, dir);
|
|
32
|
+
const angle = getAngle(controlEl, point);
|
|
33
|
+
const clickAngle = value + angularOffset;
|
|
34
|
+
return dir === "rtl" ? value + clickAngle - angle : angle - angularOffset;
|
|
35
|
+
}
|
|
36
|
+
function getDisplayAngle(value, dir) {
|
|
37
|
+
return dir === "rtl" ? mirrorAngle(value) : value;
|
|
38
|
+
}
|
|
26
39
|
function clampAngle(degree) {
|
|
27
40
|
return Math.min(Math.max(degree, 0), 359);
|
|
28
41
|
}
|
|
@@ -42,6 +55,8 @@ function connect(service, normalize) {
|
|
|
42
55
|
const dragging = state.matches("dragging");
|
|
43
56
|
const value = context.get("value");
|
|
44
57
|
const valueAsDegree = computed("valueAsDegree");
|
|
58
|
+
const dir = prop("dir");
|
|
59
|
+
const displayAngle = getDisplayAngle(value, dir);
|
|
45
60
|
const disabled = prop("disabled");
|
|
46
61
|
const invalid = prop("invalid");
|
|
47
62
|
const readOnly = prop("readOnly");
|
|
@@ -62,12 +77,13 @@ function connect(service, normalize) {
|
|
|
62
77
|
return normalize.element({
|
|
63
78
|
...parts.root.attrs,
|
|
64
79
|
id: getRootId(scope),
|
|
80
|
+
dir: prop("dir"),
|
|
65
81
|
"data-disabled": dataAttr(disabled),
|
|
66
82
|
"data-invalid": dataAttr(invalid),
|
|
67
83
|
"data-readonly": dataAttr(readOnly),
|
|
68
84
|
style: {
|
|
69
85
|
"--value": value,
|
|
70
|
-
"--angle":
|
|
86
|
+
"--angle": `${displayAngle}deg`
|
|
71
87
|
}
|
|
72
88
|
});
|
|
73
89
|
},
|
|
@@ -76,6 +92,7 @@ function connect(service, normalize) {
|
|
|
76
92
|
...parts.label.attrs,
|
|
77
93
|
id: getLabelId(scope),
|
|
78
94
|
htmlFor: getHiddenInputId(scope),
|
|
95
|
+
dir: prop("dir"),
|
|
79
96
|
"data-disabled": dataAttr(disabled),
|
|
80
97
|
"data-invalid": dataAttr(invalid),
|
|
81
98
|
"data-readonly": dataAttr(readOnly),
|
|
@@ -91,7 +108,8 @@ function connect(service, normalize) {
|
|
|
91
108
|
type: "hidden",
|
|
92
109
|
value,
|
|
93
110
|
name: prop("name"),
|
|
94
|
-
id: getHiddenInputId(scope)
|
|
111
|
+
id: getHiddenInputId(scope),
|
|
112
|
+
dir: prop("dir")
|
|
95
113
|
});
|
|
96
114
|
},
|
|
97
115
|
getControlProps() {
|
|
@@ -99,6 +117,7 @@ function connect(service, normalize) {
|
|
|
99
117
|
...parts.control.attrs,
|
|
100
118
|
role: "presentation",
|
|
101
119
|
id: getControlId(scope),
|
|
120
|
+
dir: prop("dir"),
|
|
102
121
|
"data-disabled": dataAttr(disabled),
|
|
103
122
|
"data-invalid": dataAttr(invalid),
|
|
104
123
|
"data-readonly": dataAttr(readOnly),
|
|
@@ -131,6 +150,7 @@ function connect(service, normalize) {
|
|
|
131
150
|
...parts.thumb.attrs,
|
|
132
151
|
id: getThumbId(scope),
|
|
133
152
|
role: "slider",
|
|
153
|
+
dir: prop("dir"),
|
|
134
154
|
"aria-label": ariaLabel,
|
|
135
155
|
"aria-labelledby": ariaLabelledBy ?? getLabelId(scope),
|
|
136
156
|
"aria-valuemax": 360,
|
|
@@ -149,32 +169,44 @@ function connect(service, normalize) {
|
|
|
149
169
|
onKeyDown(event) {
|
|
150
170
|
if (!interactive) return;
|
|
151
171
|
const step = getEventStep(event) * prop("step");
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
172
|
+
const exec = {
|
|
173
|
+
ArrowLeft() {
|
|
174
|
+
send({
|
|
175
|
+
type: "THUMB.ARROW_DEC",
|
|
176
|
+
step
|
|
177
|
+
});
|
|
178
|
+
},
|
|
179
|
+
ArrowUp() {
|
|
156
180
|
send({
|
|
157
181
|
type: "THUMB.ARROW_DEC",
|
|
158
182
|
step
|
|
159
183
|
});
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
case "ArrowDown":
|
|
163
|
-
event.preventDefault();
|
|
184
|
+
},
|
|
185
|
+
ArrowRight() {
|
|
164
186
|
send({
|
|
165
187
|
type: "THUMB.ARROW_INC",
|
|
166
188
|
step
|
|
167
189
|
});
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
190
|
+
},
|
|
191
|
+
ArrowDown() {
|
|
192
|
+
send({
|
|
193
|
+
type: "THUMB.ARROW_INC",
|
|
194
|
+
step
|
|
195
|
+
});
|
|
196
|
+
},
|
|
197
|
+
Home() {
|
|
171
198
|
send({ type: "THUMB.HOME" });
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
event.preventDefault();
|
|
199
|
+
},
|
|
200
|
+
End() {
|
|
175
201
|
send({ type: "THUMB.END" });
|
|
176
|
-
|
|
177
|
-
|
|
202
|
+
}
|
|
203
|
+
}[getEventKey(event, {
|
|
204
|
+
dir: prop("dir"),
|
|
205
|
+
orientation: "horizontal"
|
|
206
|
+
})];
|
|
207
|
+
if (exec) {
|
|
208
|
+
exec(event);
|
|
209
|
+
event.preventDefault();
|
|
178
210
|
}
|
|
179
211
|
},
|
|
180
212
|
style: { rotate: `var(--angle)` }
|
|
@@ -183,25 +215,32 @@ function connect(service, normalize) {
|
|
|
183
215
|
getValueTextProps() {
|
|
184
216
|
return normalize.element({
|
|
185
217
|
...parts.valueText.attrs,
|
|
186
|
-
id: getValueTextId(scope)
|
|
218
|
+
id: getValueTextId(scope),
|
|
219
|
+
dir: prop("dir")
|
|
187
220
|
});
|
|
188
221
|
},
|
|
189
222
|
getMarkerGroupProps() {
|
|
190
|
-
return normalize.element({
|
|
223
|
+
return normalize.element({
|
|
224
|
+
...parts.markerGroup.attrs,
|
|
225
|
+
dir: prop("dir")
|
|
226
|
+
});
|
|
191
227
|
},
|
|
192
228
|
getMarkerProps(props) {
|
|
193
229
|
let markerState;
|
|
194
230
|
if (props.value < value) markerState = "under-value";
|
|
195
231
|
else if (props.value > value) markerState = "over-value";
|
|
196
232
|
else markerState = "at-value";
|
|
233
|
+
const markerDisplayAngle = getDisplayAngle(props.value, dir);
|
|
197
234
|
return normalize.element({
|
|
198
235
|
...parts.marker.attrs,
|
|
236
|
+
dir: prop("dir"),
|
|
199
237
|
"data-value": props.value,
|
|
200
238
|
"data-state": markerState,
|
|
201
239
|
"data-disabled": dataAttr(disabled),
|
|
202
240
|
style: {
|
|
203
241
|
"--marker-value": props.value,
|
|
204
|
-
|
|
242
|
+
"--marker-display-value": markerDisplayAngle,
|
|
243
|
+
rotate: `calc(var(--marker-display-value) * 1deg)`
|
|
205
244
|
}
|
|
206
245
|
});
|
|
207
246
|
}
|
|
@@ -312,7 +351,8 @@ const machine = createMachine({
|
|
|
312
351
|
const controlEl = getControlEl(scope);
|
|
313
352
|
if (!controlEl) return;
|
|
314
353
|
const angularOffset = refs.get("thumbDragOffset");
|
|
315
|
-
const
|
|
354
|
+
const value = context.get("value");
|
|
355
|
+
const deg = getPointerValue(controlEl, event.point, angularOffset, value, prop("dir"));
|
|
316
356
|
context.set("value", constrainAngle(deg, prop("step")));
|
|
317
357
|
},
|
|
318
358
|
setValueToMin({ context }) {
|
|
@@ -3,7 +3,7 @@ import { p as Machine, u as EventObject, y as Service } from "../../types-B24gMT
|
|
|
3
3
|
import { b as NormalizeProps, d as Orientation, f as OrientationProperty, g as RequiredBy, r as DirectionProperty, t as CommonProperties, x as PropTypes } from "../../index-CLRsezW5.cjs";
|
|
4
4
|
|
|
5
5
|
//#region src/machines/carousel/carousel.anatomy.d.ts
|
|
6
|
-
declare const anatomy: AnatomyInstance<"root" | "indicator" | "control" | "item" | "
|
|
6
|
+
declare const anatomy: AnatomyInstance<"root" | "indicator" | "control" | "item" | "itemGroup" | "nextTrigger" | "prevTrigger" | "indicatorGroup" | "autoplayTrigger" | "progressText">;
|
|
7
7
|
//#endregion
|
|
8
8
|
//#region src/machines/carousel/carousel.types.d.ts
|
|
9
9
|
interface PageChangeDetails {
|
|
@@ -3,7 +3,7 @@ import { p as Machine, u as EventObject, y as Service } from "../../types-DUM9rz
|
|
|
3
3
|
import { b as NormalizeProps, d as Orientation, f as OrientationProperty, g as RequiredBy, r as DirectionProperty, t as CommonProperties, x as PropTypes } from "../../index-BVFlU3b9.mjs";
|
|
4
4
|
|
|
5
5
|
//#region src/machines/carousel/carousel.anatomy.d.ts
|
|
6
|
-
declare const anatomy: AnatomyInstance<"root" | "indicator" | "control" | "item" | "
|
|
6
|
+
declare const anatomy: AnatomyInstance<"root" | "indicator" | "control" | "item" | "itemGroup" | "nextTrigger" | "prevTrigger" | "indicatorGroup" | "autoplayTrigger" | "progressText">;
|
|
7
7
|
//#endregion
|
|
8
8
|
//#region src/machines/carousel/carousel.types.d.ts
|
|
9
9
|
interface PageChangeDetails {
|
|
@@ -70,7 +70,7 @@ function connect(service, normalize) {
|
|
|
70
70
|
const disabled = prop("disabled") || context.get("fieldsetDisabled");
|
|
71
71
|
const interactive = computed("isInteractive");
|
|
72
72
|
const valueAsString = computed("valueAsString");
|
|
73
|
-
const
|
|
73
|
+
const highlightedItems = context.get("highlightedItems");
|
|
74
74
|
const selectedItems = context.get("selectedItems");
|
|
75
75
|
const popperStyles = require_popper.getPlacementStyles({
|
|
76
76
|
...prop("positioning"),
|
|
@@ -95,6 +95,7 @@ function connect(service, normalize) {
|
|
|
95
95
|
};
|
|
96
96
|
};
|
|
97
97
|
const hasSelectedItems = value.length > 0;
|
|
98
|
+
const empty = value.length === 0;
|
|
98
99
|
return {
|
|
99
100
|
collection,
|
|
100
101
|
open,
|
|
@@ -103,9 +104,10 @@ function connect(service, normalize) {
|
|
|
103
104
|
disabled,
|
|
104
105
|
value,
|
|
105
106
|
highlightedValue,
|
|
106
|
-
|
|
107
|
+
highlightedItems,
|
|
107
108
|
selectedItems,
|
|
108
109
|
hasSelectedItems,
|
|
110
|
+
empty,
|
|
109
111
|
valueAsString,
|
|
110
112
|
reposition(options = {}) {
|
|
111
113
|
send({
|
|
@@ -120,12 +122,15 @@ function connect(service, normalize) {
|
|
|
120
122
|
if (nextOpen === open) return;
|
|
121
123
|
send({ type: nextOpen ? "OPEN" : "CLOSE" });
|
|
122
124
|
},
|
|
123
|
-
|
|
125
|
+
setHighlightValue(value) {
|
|
124
126
|
send({
|
|
125
127
|
type: "HIGHLIGHTED_VALUE.SET",
|
|
126
128
|
value
|
|
127
129
|
});
|
|
128
130
|
},
|
|
131
|
+
clearHighlightValue() {
|
|
132
|
+
send({ type: "HIGHLIGHTED_VALUE.CLEAR" });
|
|
133
|
+
},
|
|
129
134
|
setValue(value) {
|
|
130
135
|
send({
|
|
131
136
|
type: "VALUE.SET",
|
|
@@ -179,7 +184,7 @@ function connect(service, normalize) {
|
|
|
179
184
|
dir: prop("dir"),
|
|
180
185
|
id: dom.getControlId(scope),
|
|
181
186
|
"data-disabled": require_dom_query.dataAttr(disabled),
|
|
182
|
-
"data-
|
|
187
|
+
"data-focus": require_dom_query.dataAttr(focused),
|
|
183
188
|
"data-readonly": require_dom_query.dataAttr(prop("readOnly")),
|
|
184
189
|
"data-invalid": require_dom_query.dataAttr(prop("invalid")),
|
|
185
190
|
"data-state": open ? "open" : "closed"
|
|
@@ -200,8 +205,9 @@ function connect(service, normalize) {
|
|
|
200
205
|
"data-disabled": require_dom_query.dataAttr(disabled),
|
|
201
206
|
"data-readonly": require_dom_query.dataAttr(prop("readOnly")),
|
|
202
207
|
"data-invalid": require_dom_query.dataAttr(prop("invalid")),
|
|
203
|
-
"data-
|
|
208
|
+
"data-focus": require_dom_query.dataAttr(focused),
|
|
204
209
|
"data-placement": currentPlacement,
|
|
210
|
+
"data-placeholder-shown": require_dom_query.dataAttr(!hasSelectedItems),
|
|
205
211
|
disabled,
|
|
206
212
|
onClick(event) {
|
|
207
213
|
if (event.defaultPrevented) return;
|
|
@@ -449,6 +455,15 @@ function connect(service, normalize) {
|
|
|
449
455
|
hidden: !itemState.selected
|
|
450
456
|
});
|
|
451
457
|
},
|
|
458
|
+
getValueTextProps() {
|
|
459
|
+
return normalize.element({
|
|
460
|
+
...parts.valueText.attrs,
|
|
461
|
+
dir: prop("dir"),
|
|
462
|
+
"data-disabled": require_dom_query.dataAttr(disabled),
|
|
463
|
+
"data-invalid": require_dom_query.dataAttr(prop("invalid")),
|
|
464
|
+
"data-focus": require_dom_query.dataAttr(focused)
|
|
465
|
+
});
|
|
466
|
+
},
|
|
452
467
|
getHiddenInputProps() {
|
|
453
468
|
const defaultValue = context.hash("value");
|
|
454
469
|
return normalize.input({
|
|
@@ -576,7 +591,7 @@ const machine = require_core.createMachine({
|
|
|
576
591
|
const value = prop("highlightedValue") ?? prop("defaultHighlightedValue") ?? null;
|
|
577
592
|
return { defaultValue: value ? prop("collection").getIndexPath(value) : [] };
|
|
578
593
|
}),
|
|
579
|
-
|
|
594
|
+
highlightedItems: bindable(() => ({ defaultValue: [] })),
|
|
580
595
|
selectedItems: bindable(() => ({ defaultValue: [] })),
|
|
581
596
|
currentPlacement: bindable(() => ({ defaultValue: void 0 })),
|
|
582
597
|
fieldsetDisabled: bindable(() => ({ defaultValue: false })),
|
|
@@ -616,6 +631,7 @@ const machine = require_core.createMachine({
|
|
|
616
631
|
"VALUE.CLEAR": { actions: ["clearValue"] },
|
|
617
632
|
"CLEAR_TRIGGER.CLICK": { actions: ["clearValue", "focusTriggerEl"] },
|
|
618
633
|
"HIGHLIGHTED_VALUE.SET": { actions: ["setHighlightedValue"] },
|
|
634
|
+
"HIGHLIGHTED_VALUE.CLEAR": { actions: ["clearHighlightedValue"] },
|
|
619
635
|
"ITEM.SELECT": { actions: ["selectItem"] },
|
|
620
636
|
"ITEM.CLEAR": { actions: ["clearItem"] }
|
|
621
637
|
},
|
|
@@ -902,8 +918,8 @@ const machine = require_core.createMachine({
|
|
|
902
918
|
},
|
|
903
919
|
shouldCloseOnSelectHighlighted: ({ prop, context }) => {
|
|
904
920
|
const collection = prop("collection");
|
|
905
|
-
const node = context.get("
|
|
906
|
-
return prop("closeOnSelect") && !collection.isBranchNode(node);
|
|
921
|
+
const node = require_utils.last(context.get("highlightedItems"));
|
|
922
|
+
return prop("closeOnSelect") && node != null && !collection.isBranchNode(node);
|
|
907
923
|
},
|
|
908
924
|
canSelectItem: ({ prop, event }) => {
|
|
909
925
|
const collection = prop("collection");
|
|
@@ -1015,7 +1031,7 @@ const machine = require_core.createMachine({
|
|
|
1015
1031
|
const highlightedValue = context.get("highlightedValue");
|
|
1016
1032
|
const highlightedIndexPath = context.get("highlightedIndexPath");
|
|
1017
1033
|
if (!highlightedIndexPath.length) return;
|
|
1018
|
-
if (require_focus_visible.getInteractionModality()
|
|
1034
|
+
if (require_focus_visible.getInteractionModality() === "pointer") return;
|
|
1019
1035
|
dom.getListEls(scope).forEach((listEl, index) => {
|
|
1020
1036
|
const itemPath = highlightedIndexPath.slice(0, index + 1);
|
|
1021
1037
|
const itemEl = dom.getItemEl(scope, highlightedValue.toString());
|
|
@@ -1038,7 +1054,10 @@ const machine = require_core.createMachine({
|
|
|
1038
1054
|
cleanups.push(raf_cleanup);
|
|
1039
1055
|
});
|
|
1040
1056
|
};
|
|
1041
|
-
require_dom_query.raf(() =>
|
|
1057
|
+
require_dom_query.raf(() => {
|
|
1058
|
+
require_focus_visible.setInteractionModality("virtual");
|
|
1059
|
+
exec(true);
|
|
1060
|
+
});
|
|
1042
1061
|
const rafCleanup = require_dom_query.raf(() => exec(true));
|
|
1043
1062
|
cleanups.push(rafCleanup);
|
|
1044
1063
|
const observerCleanup = require_dom_query.observeAttributes(dom.getContentEl(scope), {
|
|
@@ -1219,11 +1238,17 @@ const machine = require_core.createMachine({
|
|
|
1219
1238
|
dom.getTriggerEl(scope)?.focus({ preventScroll: true });
|
|
1220
1239
|
});
|
|
1221
1240
|
},
|
|
1222
|
-
invokeOnOpen({ prop }) {
|
|
1223
|
-
prop("onOpenChange")?.({
|
|
1241
|
+
invokeOnOpen({ prop, context }) {
|
|
1242
|
+
prop("onOpenChange")?.({
|
|
1243
|
+
open: true,
|
|
1244
|
+
value: context.get("value")
|
|
1245
|
+
});
|
|
1224
1246
|
},
|
|
1225
|
-
invokeOnClose({ prop }) {
|
|
1226
|
-
prop("onOpenChange")?.({
|
|
1247
|
+
invokeOnClose({ prop, context }) {
|
|
1248
|
+
prop("onOpenChange")?.({
|
|
1249
|
+
open: false,
|
|
1250
|
+
value: context.get("value")
|
|
1251
|
+
});
|
|
1227
1252
|
},
|
|
1228
1253
|
toggleVisibility({ send, prop }) {
|
|
1229
1254
|
if (prop("open") != null) send({ type: prop("open") ? "CONTROLLED.OPEN" : "CONTROLLED.CLOSE" });
|
|
@@ -1309,16 +1334,16 @@ const set = {
|
|
|
1309
1334
|
highlightedValue({ context, prop }, value) {
|
|
1310
1335
|
const collection = prop("collection");
|
|
1311
1336
|
context.set("highlightedValue", value);
|
|
1312
|
-
const highlightedIndexPath = value == null ? [] : collection.getIndexPath(value);
|
|
1337
|
+
const highlightedIndexPath = (value == null ? [] : collection.getIndexPath(value)) ?? [];
|
|
1313
1338
|
context.set("highlightedIndexPath", highlightedIndexPath);
|
|
1314
|
-
const
|
|
1339
|
+
const highlightedItems = highlightedIndexPath.map((_, index) => {
|
|
1315
1340
|
const partialPath = highlightedIndexPath.slice(0, index + 1);
|
|
1316
1341
|
return collection.at(partialPath);
|
|
1317
1342
|
});
|
|
1318
|
-
context.set("
|
|
1343
|
+
context.set("highlightedItems", highlightedItems);
|
|
1319
1344
|
prop("onHighlightChange")?.({
|
|
1320
|
-
value,
|
|
1321
|
-
|
|
1345
|
+
highlightedValue: value,
|
|
1346
|
+
highlightedItems
|
|
1322
1347
|
});
|
|
1323
1348
|
}
|
|
1324
1349
|
};
|
|
@@ -8,8 +8,8 @@ import { c as Placement, d as PositioningOptions } from "../../types-CZAtqGqH.cj
|
|
|
8
8
|
import { a as Point } from "../../types-CLXYEgfm.cjs";
|
|
9
9
|
|
|
10
10
|
//#region src/machines/cascade-select/cascade-select.anatomy.d.ts
|
|
11
|
-
declare const anatomy: AnatomyInstance<"root" | "
|
|
12
|
-
declare const parts: Record<"root" | "
|
|
11
|
+
declare const anatomy: AnatomyInstance<"root" | "trigger" | "content" | "indicator" | "label" | "control" | "item" | "itemIndicator" | "positioner" | "clearTrigger" | "itemText" | "list" | "valueText">;
|
|
12
|
+
declare const parts: Record<"root" | "trigger" | "content" | "indicator" | "label" | "control" | "item" | "itemIndicator" | "positioner" | "clearTrigger" | "itemText" | "list" | "valueText", AnatomyPart>;
|
|
13
13
|
//#endregion
|
|
14
14
|
//#region src/machines/cascade-select/cascade-select.collection.d.ts
|
|
15
15
|
declare const collection: {
|
|
@@ -23,11 +23,12 @@ interface ValueChangeDetails<T = TreeNode> {
|
|
|
23
23
|
items: T[][];
|
|
24
24
|
}
|
|
25
25
|
interface HighlightChangeDetails<T = TreeNode> {
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
highlightedValue: string[];
|
|
27
|
+
highlightedItems: T[];
|
|
28
28
|
}
|
|
29
29
|
interface OpenChangeDetails {
|
|
30
30
|
open: boolean;
|
|
31
|
+
value: string[][];
|
|
31
32
|
}
|
|
32
33
|
interface ScrollToIndexDetails {
|
|
33
34
|
index: number;
|
|
@@ -44,8 +45,8 @@ type ElementIds = Partial<{
|
|
|
44
45
|
positioner: string;
|
|
45
46
|
content: string;
|
|
46
47
|
hiddenInput: string;
|
|
47
|
-
list(
|
|
48
|
-
item(
|
|
48
|
+
list(valuePath: string): string;
|
|
49
|
+
item(valuePath: string): string;
|
|
49
50
|
}>;
|
|
50
51
|
interface CascadeSelectProps<T = any> extends DirectionProperty, CommonProperties, InteractOutsideHandlers {
|
|
51
52
|
collection?: TreeCollection<T> | undefined;
|
|
@@ -86,7 +87,7 @@ interface CascadeSelectSchema<T extends TreeNode = TreeNode> {
|
|
|
86
87
|
graceArea: Point[] | null;
|
|
87
88
|
valueIndexPath: IndexPath[];
|
|
88
89
|
highlightedIndexPath: IndexPath;
|
|
89
|
-
|
|
90
|
+
highlightedItems: T[];
|
|
90
91
|
selectedItems: T[][];
|
|
91
92
|
};
|
|
92
93
|
computed: {
|
|
@@ -122,16 +123,17 @@ interface CascadeSelectApi<T extends PropTypes = PropTypes, V = TreeNode> {
|
|
|
122
123
|
multiple: boolean;
|
|
123
124
|
disabled: boolean;
|
|
124
125
|
highlightedValue: string[];
|
|
125
|
-
|
|
126
|
+
highlightedItems: V[];
|
|
126
127
|
selectedItems: V[][];
|
|
127
128
|
hasSelectedItems: boolean;
|
|
129
|
+
empty: boolean;
|
|
128
130
|
value: string[][];
|
|
129
131
|
valueAsString: string;
|
|
130
132
|
focus(): void;
|
|
131
|
-
focus(): void;
|
|
132
133
|
reposition(options?: Partial<PositioningOptions>): void;
|
|
133
134
|
setOpen(open: boolean): void;
|
|
134
|
-
|
|
135
|
+
setHighlightValue(value: string | string[]): void;
|
|
136
|
+
clearHighlightValue(): void;
|
|
135
137
|
selectValue(value: string[]): void;
|
|
136
138
|
setValue(value: string[][]): void;
|
|
137
139
|
clearValue(value?: string[]): void;
|
|
@@ -148,6 +150,7 @@ interface CascadeSelectApi<T extends PropTypes = PropTypes, V = TreeNode> {
|
|
|
148
150
|
getItemProps(props: ItemProps<V>): T["element"];
|
|
149
151
|
getItemTextProps(props: ItemProps<V>): T["element"];
|
|
150
152
|
getItemIndicatorProps(props: ItemProps<V>): T["element"];
|
|
153
|
+
getValueTextProps(): T["element"];
|
|
151
154
|
getHiddenInputProps(): T["input"];
|
|
152
155
|
}
|
|
153
156
|
//#endregion
|
|
@@ -8,8 +8,8 @@ import { p as PositioningOptions, u as Placement } from "../../index-fMh0VDkR.mj
|
|
|
8
8
|
import { a as Point } from "../../types-DU764tY_.mjs";
|
|
9
9
|
|
|
10
10
|
//#region src/machines/cascade-select/cascade-select.anatomy.d.ts
|
|
11
|
-
declare const anatomy: AnatomyInstance<"root" | "
|
|
12
|
-
declare const parts: Record<"root" | "
|
|
11
|
+
declare const anatomy: AnatomyInstance<"root" | "trigger" | "content" | "indicator" | "label" | "control" | "item" | "itemIndicator" | "positioner" | "clearTrigger" | "itemText" | "list" | "valueText">;
|
|
12
|
+
declare const parts: Record<"root" | "trigger" | "content" | "indicator" | "label" | "control" | "item" | "itemIndicator" | "positioner" | "clearTrigger" | "itemText" | "list" | "valueText", AnatomyPart>;
|
|
13
13
|
//#endregion
|
|
14
14
|
//#region src/machines/cascade-select/cascade-select.collection.d.ts
|
|
15
15
|
declare const collection: {
|
|
@@ -23,11 +23,12 @@ interface ValueChangeDetails<T = TreeNode> {
|
|
|
23
23
|
items: T[][];
|
|
24
24
|
}
|
|
25
25
|
interface HighlightChangeDetails<T = TreeNode> {
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
highlightedValue: string[];
|
|
27
|
+
highlightedItems: T[];
|
|
28
28
|
}
|
|
29
29
|
interface OpenChangeDetails {
|
|
30
30
|
open: boolean;
|
|
31
|
+
value: string[][];
|
|
31
32
|
}
|
|
32
33
|
interface ScrollToIndexDetails {
|
|
33
34
|
index: number;
|
|
@@ -44,8 +45,8 @@ type ElementIds = Partial<{
|
|
|
44
45
|
positioner: string;
|
|
45
46
|
content: string;
|
|
46
47
|
hiddenInput: string;
|
|
47
|
-
list(
|
|
48
|
-
item(
|
|
48
|
+
list(valuePath: string): string;
|
|
49
|
+
item(valuePath: string): string;
|
|
49
50
|
}>;
|
|
50
51
|
interface CascadeSelectProps<T = any> extends DirectionProperty, CommonProperties, InteractOutsideHandlers {
|
|
51
52
|
collection?: TreeCollection<T> | undefined;
|
|
@@ -86,7 +87,7 @@ interface CascadeSelectSchema<T extends TreeNode = TreeNode> {
|
|
|
86
87
|
graceArea: Point[] | null;
|
|
87
88
|
valueIndexPath: IndexPath[];
|
|
88
89
|
highlightedIndexPath: IndexPath;
|
|
89
|
-
|
|
90
|
+
highlightedItems: T[];
|
|
90
91
|
selectedItems: T[][];
|
|
91
92
|
};
|
|
92
93
|
computed: {
|
|
@@ -122,16 +123,17 @@ interface CascadeSelectApi<T extends PropTypes = PropTypes, V = TreeNode> {
|
|
|
122
123
|
multiple: boolean;
|
|
123
124
|
disabled: boolean;
|
|
124
125
|
highlightedValue: string[];
|
|
125
|
-
|
|
126
|
+
highlightedItems: V[];
|
|
126
127
|
selectedItems: V[][];
|
|
127
128
|
hasSelectedItems: boolean;
|
|
129
|
+
empty: boolean;
|
|
128
130
|
value: string[][];
|
|
129
131
|
valueAsString: string;
|
|
130
132
|
focus(): void;
|
|
131
|
-
focus(): void;
|
|
132
133
|
reposition(options?: Partial<PositioningOptions>): void;
|
|
133
134
|
setOpen(open: boolean): void;
|
|
134
|
-
|
|
135
|
+
setHighlightValue(value: string | string[]): void;
|
|
136
|
+
clearHighlightValue(): void;
|
|
135
137
|
selectValue(value: string[]): void;
|
|
136
138
|
setValue(value: string[][]): void;
|
|
137
139
|
clearValue(value?: string[]): void;
|
|
@@ -148,6 +150,7 @@ interface CascadeSelectApi<T extends PropTypes = PropTypes, V = TreeNode> {
|
|
|
148
150
|
getItemProps(props: ItemProps<V>): T["element"];
|
|
149
151
|
getItemTextProps(props: ItemProps<V>): T["element"];
|
|
150
152
|
getItemIndicatorProps(props: ItemProps<V>): T["element"];
|
|
153
|
+
getValueTextProps(): T["element"];
|
|
151
154
|
getHiddenInputProps(): T["input"];
|
|
152
155
|
}
|
|
153
156
|
//#endregion
|