@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
|
@@ -5,7 +5,7 @@ import { t as TreeCollection } from "../../collection-DgzidRvr.mjs";
|
|
|
5
5
|
import { a as createMachine, i as createGuards } from "../../core-Ci9Yu6QI.mjs";
|
|
6
6
|
import "../../interact-outside-Ba50N1a5.mjs";
|
|
7
7
|
import { n as trackDismissableElement } from "../../dismissable-B9k5K6f9.mjs";
|
|
8
|
-
import { o as trackFocusVisible, t as getInteractionModality } from "../../focus-visible-BuLf8M9F.mjs";
|
|
8
|
+
import { a as setInteractionModality, o as trackFocusVisible, t as getInteractionModality } from "../../focus-visible-BuLf8M9F.mjs";
|
|
9
9
|
import { n as getPlacement, t as getPlacementStyles } from "../../popper-BlgbmdAn.mjs";
|
|
10
10
|
import { B as getRectCorners, D as closestSideToPoint, L as createPoint, R as createRect, i as isPointInPolygon } from "../../rect-utils-B5xqFvKC.mjs";
|
|
11
11
|
import { t as createProps } from "../../create-props-DFW8DUsC.mjs";
|
|
@@ -69,7 +69,7 @@ function connect(service, normalize) {
|
|
|
69
69
|
const disabled = prop("disabled") || context.get("fieldsetDisabled");
|
|
70
70
|
const interactive = computed("isInteractive");
|
|
71
71
|
const valueAsString = computed("valueAsString");
|
|
72
|
-
const
|
|
72
|
+
const highlightedItems = context.get("highlightedItems");
|
|
73
73
|
const selectedItems = context.get("selectedItems");
|
|
74
74
|
const popperStyles = getPlacementStyles({
|
|
75
75
|
...prop("positioning"),
|
|
@@ -94,6 +94,7 @@ function connect(service, normalize) {
|
|
|
94
94
|
};
|
|
95
95
|
};
|
|
96
96
|
const hasSelectedItems = value.length > 0;
|
|
97
|
+
const empty = value.length === 0;
|
|
97
98
|
return {
|
|
98
99
|
collection,
|
|
99
100
|
open,
|
|
@@ -102,9 +103,10 @@ function connect(service, normalize) {
|
|
|
102
103
|
disabled,
|
|
103
104
|
value,
|
|
104
105
|
highlightedValue,
|
|
105
|
-
|
|
106
|
+
highlightedItems,
|
|
106
107
|
selectedItems,
|
|
107
108
|
hasSelectedItems,
|
|
109
|
+
empty,
|
|
108
110
|
valueAsString,
|
|
109
111
|
reposition(options = {}) {
|
|
110
112
|
send({
|
|
@@ -119,12 +121,15 @@ function connect(service, normalize) {
|
|
|
119
121
|
if (nextOpen === open) return;
|
|
120
122
|
send({ type: nextOpen ? "OPEN" : "CLOSE" });
|
|
121
123
|
},
|
|
122
|
-
|
|
124
|
+
setHighlightValue(value) {
|
|
123
125
|
send({
|
|
124
126
|
type: "HIGHLIGHTED_VALUE.SET",
|
|
125
127
|
value
|
|
126
128
|
});
|
|
127
129
|
},
|
|
130
|
+
clearHighlightValue() {
|
|
131
|
+
send({ type: "HIGHLIGHTED_VALUE.CLEAR" });
|
|
132
|
+
},
|
|
128
133
|
setValue(value) {
|
|
129
134
|
send({
|
|
130
135
|
type: "VALUE.SET",
|
|
@@ -178,7 +183,7 @@ function connect(service, normalize) {
|
|
|
178
183
|
dir: prop("dir"),
|
|
179
184
|
id: dom.getControlId(scope),
|
|
180
185
|
"data-disabled": dataAttr(disabled),
|
|
181
|
-
"data-
|
|
186
|
+
"data-focus": dataAttr(focused),
|
|
182
187
|
"data-readonly": dataAttr(prop("readOnly")),
|
|
183
188
|
"data-invalid": dataAttr(prop("invalid")),
|
|
184
189
|
"data-state": open ? "open" : "closed"
|
|
@@ -199,8 +204,9 @@ function connect(service, normalize) {
|
|
|
199
204
|
"data-disabled": dataAttr(disabled),
|
|
200
205
|
"data-readonly": dataAttr(prop("readOnly")),
|
|
201
206
|
"data-invalid": dataAttr(prop("invalid")),
|
|
202
|
-
"data-
|
|
207
|
+
"data-focus": dataAttr(focused),
|
|
203
208
|
"data-placement": currentPlacement,
|
|
209
|
+
"data-placeholder-shown": dataAttr(!hasSelectedItems),
|
|
204
210
|
disabled,
|
|
205
211
|
onClick(event) {
|
|
206
212
|
if (event.defaultPrevented) return;
|
|
@@ -448,6 +454,15 @@ function connect(service, normalize) {
|
|
|
448
454
|
hidden: !itemState.selected
|
|
449
455
|
});
|
|
450
456
|
},
|
|
457
|
+
getValueTextProps() {
|
|
458
|
+
return normalize.element({
|
|
459
|
+
...parts.valueText.attrs,
|
|
460
|
+
dir: prop("dir"),
|
|
461
|
+
"data-disabled": dataAttr(disabled),
|
|
462
|
+
"data-invalid": dataAttr(prop("invalid")),
|
|
463
|
+
"data-focus": dataAttr(focused)
|
|
464
|
+
});
|
|
465
|
+
},
|
|
451
466
|
getHiddenInputProps() {
|
|
452
467
|
const defaultValue = context.hash("value");
|
|
453
468
|
return normalize.input({
|
|
@@ -575,7 +590,7 @@ const machine = createMachine({
|
|
|
575
590
|
const value = prop("highlightedValue") ?? prop("defaultHighlightedValue") ?? null;
|
|
576
591
|
return { defaultValue: value ? prop("collection").getIndexPath(value) : [] };
|
|
577
592
|
}),
|
|
578
|
-
|
|
593
|
+
highlightedItems: bindable(() => ({ defaultValue: [] })),
|
|
579
594
|
selectedItems: bindable(() => ({ defaultValue: [] })),
|
|
580
595
|
currentPlacement: bindable(() => ({ defaultValue: void 0 })),
|
|
581
596
|
fieldsetDisabled: bindable(() => ({ defaultValue: false })),
|
|
@@ -615,6 +630,7 @@ const machine = createMachine({
|
|
|
615
630
|
"VALUE.CLEAR": { actions: ["clearValue"] },
|
|
616
631
|
"CLEAR_TRIGGER.CLICK": { actions: ["clearValue", "focusTriggerEl"] },
|
|
617
632
|
"HIGHLIGHTED_VALUE.SET": { actions: ["setHighlightedValue"] },
|
|
633
|
+
"HIGHLIGHTED_VALUE.CLEAR": { actions: ["clearHighlightedValue"] },
|
|
618
634
|
"ITEM.SELECT": { actions: ["selectItem"] },
|
|
619
635
|
"ITEM.CLEAR": { actions: ["clearItem"] }
|
|
620
636
|
},
|
|
@@ -901,8 +917,8 @@ const machine = createMachine({
|
|
|
901
917
|
},
|
|
902
918
|
shouldCloseOnSelectHighlighted: ({ prop, context }) => {
|
|
903
919
|
const collection = prop("collection");
|
|
904
|
-
const node = context.get("
|
|
905
|
-
return prop("closeOnSelect") && !collection.isBranchNode(node);
|
|
920
|
+
const node = last(context.get("highlightedItems"));
|
|
921
|
+
return prop("closeOnSelect") && node != null && !collection.isBranchNode(node);
|
|
906
922
|
},
|
|
907
923
|
canSelectItem: ({ prop, event }) => {
|
|
908
924
|
const collection = prop("collection");
|
|
@@ -1014,7 +1030,7 @@ const machine = createMachine({
|
|
|
1014
1030
|
const highlightedValue = context.get("highlightedValue");
|
|
1015
1031
|
const highlightedIndexPath = context.get("highlightedIndexPath");
|
|
1016
1032
|
if (!highlightedIndexPath.length) return;
|
|
1017
|
-
if (getInteractionModality()
|
|
1033
|
+
if (getInteractionModality() === "pointer") return;
|
|
1018
1034
|
dom.getListEls(scope).forEach((listEl, index) => {
|
|
1019
1035
|
const itemPath = highlightedIndexPath.slice(0, index + 1);
|
|
1020
1036
|
const itemEl = dom.getItemEl(scope, highlightedValue.toString());
|
|
@@ -1037,7 +1053,10 @@ const machine = createMachine({
|
|
|
1037
1053
|
cleanups.push(raf_cleanup);
|
|
1038
1054
|
});
|
|
1039
1055
|
};
|
|
1040
|
-
raf(() =>
|
|
1056
|
+
raf(() => {
|
|
1057
|
+
setInteractionModality("virtual");
|
|
1058
|
+
exec(true);
|
|
1059
|
+
});
|
|
1041
1060
|
const rafCleanup = raf(() => exec(true));
|
|
1042
1061
|
cleanups.push(rafCleanup);
|
|
1043
1062
|
const observerCleanup = observeAttributes(dom.getContentEl(scope), {
|
|
@@ -1218,11 +1237,17 @@ const machine = createMachine({
|
|
|
1218
1237
|
dom.getTriggerEl(scope)?.focus({ preventScroll: true });
|
|
1219
1238
|
});
|
|
1220
1239
|
},
|
|
1221
|
-
invokeOnOpen({ prop }) {
|
|
1222
|
-
prop("onOpenChange")?.({
|
|
1240
|
+
invokeOnOpen({ prop, context }) {
|
|
1241
|
+
prop("onOpenChange")?.({
|
|
1242
|
+
open: true,
|
|
1243
|
+
value: context.get("value")
|
|
1244
|
+
});
|
|
1223
1245
|
},
|
|
1224
|
-
invokeOnClose({ prop }) {
|
|
1225
|
-
prop("onOpenChange")?.({
|
|
1246
|
+
invokeOnClose({ prop, context }) {
|
|
1247
|
+
prop("onOpenChange")?.({
|
|
1248
|
+
open: false,
|
|
1249
|
+
value: context.get("value")
|
|
1250
|
+
});
|
|
1226
1251
|
},
|
|
1227
1252
|
toggleVisibility({ send, prop }) {
|
|
1228
1253
|
if (prop("open") != null) send({ type: prop("open") ? "CONTROLLED.OPEN" : "CONTROLLED.CLOSE" });
|
|
@@ -1308,16 +1333,16 @@ const set = {
|
|
|
1308
1333
|
highlightedValue({ context, prop }, value) {
|
|
1309
1334
|
const collection = prop("collection");
|
|
1310
1335
|
context.set("highlightedValue", value);
|
|
1311
|
-
const highlightedIndexPath = value == null ? [] : collection.getIndexPath(value);
|
|
1336
|
+
const highlightedIndexPath = (value == null ? [] : collection.getIndexPath(value)) ?? [];
|
|
1312
1337
|
context.set("highlightedIndexPath", highlightedIndexPath);
|
|
1313
|
-
const
|
|
1338
|
+
const highlightedItems = highlightedIndexPath.map((_, index) => {
|
|
1314
1339
|
const partialPath = highlightedIndexPath.slice(0, index + 1);
|
|
1315
1340
|
return collection.at(partialPath);
|
|
1316
1341
|
});
|
|
1317
|
-
context.set("
|
|
1342
|
+
context.set("highlightedItems", highlightedItems);
|
|
1318
1343
|
prop("onHighlightChange")?.({
|
|
1319
|
-
value,
|
|
1320
|
-
|
|
1344
|
+
highlightedValue: value,
|
|
1345
|
+
highlightedItems
|
|
1321
1346
|
});
|
|
1322
1347
|
}
|
|
1323
1348
|
};
|
|
@@ -40,7 +40,6 @@ function connect(service, normalize) {
|
|
|
40
40
|
"data-invalid": require_dom_query.dataAttr(invalid),
|
|
41
41
|
"data-required": require_dom_query.dataAttr(required)
|
|
42
42
|
};
|
|
43
|
-
const ariaAttrs = { "aria-checked": indeterminate ? "mixed" : checked };
|
|
44
43
|
return {
|
|
45
44
|
checked,
|
|
46
45
|
disabled,
|
|
@@ -65,7 +64,6 @@ function connect(service, normalize) {
|
|
|
65
64
|
return normalize.label({
|
|
66
65
|
...parts.root.attrs,
|
|
67
66
|
...dataAttrs,
|
|
68
|
-
...ariaAttrs,
|
|
69
67
|
dir: prop("dir"),
|
|
70
68
|
id: getRootId(scope),
|
|
71
69
|
htmlFor: getHiddenInputId(scope),
|
|
@@ -92,7 +90,6 @@ function connect(service, normalize) {
|
|
|
92
90
|
return normalize.element({
|
|
93
91
|
...parts.label.attrs,
|
|
94
92
|
...dataAttrs,
|
|
95
|
-
...ariaAttrs,
|
|
96
93
|
dir: prop("dir"),
|
|
97
94
|
id: getLabelId(scope)
|
|
98
95
|
});
|
|
@@ -101,7 +98,6 @@ function connect(service, normalize) {
|
|
|
101
98
|
return normalize.element({
|
|
102
99
|
...parts.control.attrs,
|
|
103
100
|
...dataAttrs,
|
|
104
|
-
...ariaAttrs,
|
|
105
101
|
dir: prop("dir"),
|
|
106
102
|
id: getControlId(scope),
|
|
107
103
|
"aria-hidden": true
|
|
@@ -111,7 +107,6 @@ function connect(service, normalize) {
|
|
|
111
107
|
return normalize.element({
|
|
112
108
|
...parts.indicator.attrs,
|
|
113
109
|
...dataAttrs,
|
|
114
|
-
...ariaAttrs,
|
|
115
110
|
dir: prop("dir"),
|
|
116
111
|
hidden: !indeterminate && !checked
|
|
117
112
|
});
|
|
@@ -39,7 +39,6 @@ function connect(service, normalize) {
|
|
|
39
39
|
"data-invalid": dataAttr(invalid),
|
|
40
40
|
"data-required": dataAttr(required)
|
|
41
41
|
};
|
|
42
|
-
const ariaAttrs = { "aria-checked": indeterminate ? "mixed" : checked };
|
|
43
42
|
return {
|
|
44
43
|
checked,
|
|
45
44
|
disabled,
|
|
@@ -64,7 +63,6 @@ function connect(service, normalize) {
|
|
|
64
63
|
return normalize.label({
|
|
65
64
|
...parts.root.attrs,
|
|
66
65
|
...dataAttrs,
|
|
67
|
-
...ariaAttrs,
|
|
68
66
|
dir: prop("dir"),
|
|
69
67
|
id: getRootId(scope),
|
|
70
68
|
htmlFor: getHiddenInputId(scope),
|
|
@@ -91,7 +89,6 @@ function connect(service, normalize) {
|
|
|
91
89
|
return normalize.element({
|
|
92
90
|
...parts.label.attrs,
|
|
93
91
|
...dataAttrs,
|
|
94
|
-
...ariaAttrs,
|
|
95
92
|
dir: prop("dir"),
|
|
96
93
|
id: getLabelId(scope)
|
|
97
94
|
});
|
|
@@ -100,7 +97,6 @@ function connect(service, normalize) {
|
|
|
100
97
|
return normalize.element({
|
|
101
98
|
...parts.control.attrs,
|
|
102
99
|
...dataAttrs,
|
|
103
|
-
...ariaAttrs,
|
|
104
100
|
dir: prop("dir"),
|
|
105
101
|
id: getControlId(scope),
|
|
106
102
|
"aria-hidden": true
|
|
@@ -110,7 +106,6 @@ function connect(service, normalize) {
|
|
|
110
106
|
return normalize.element({
|
|
111
107
|
...parts.indicator.attrs,
|
|
112
108
|
...dataAttrs,
|
|
113
|
-
...ariaAttrs,
|
|
114
109
|
dir: prop("dir"),
|
|
115
110
|
hidden: !indeterminate && !checked
|
|
116
111
|
});
|
|
@@ -3,7 +3,7 @@ import { p as Machine, y as Service } from "../../types-B24gMTKq.cjs";
|
|
|
3
3
|
import { b as NormalizeProps, g as RequiredBy, t as CommonProperties, x as PropTypes } from "../../index-CLRsezW5.cjs";
|
|
4
4
|
|
|
5
5
|
//#region src/machines/clipboard/clipboard.anatomy.d.ts
|
|
6
|
-
declare const anatomy: AnatomyInstance<"root" | "
|
|
6
|
+
declare const anatomy: AnatomyInstance<"root" | "trigger" | "indicator" | "input" | "label" | "control">;
|
|
7
7
|
//#endregion
|
|
8
8
|
//#region src/machines/clipboard/clipboard.types.d.ts
|
|
9
9
|
interface CopyStatusDetails {
|
|
@@ -3,7 +3,7 @@ import { p as Machine, y as Service } from "../../types-DUM9rzfD.mjs";
|
|
|
3
3
|
import { b as NormalizeProps, g as RequiredBy, t as CommonProperties, x as PropTypes } from "../../index-BVFlU3b9.mjs";
|
|
4
4
|
|
|
5
5
|
//#region src/machines/clipboard/clipboard.anatomy.d.ts
|
|
6
|
-
declare const anatomy: AnatomyInstance<"root" | "
|
|
6
|
+
declare const anatomy: AnatomyInstance<"root" | "trigger" | "indicator" | "input" | "label" | "control">;
|
|
7
7
|
//#endregion
|
|
8
8
|
//#region src/machines/clipboard/clipboard.types.d.ts
|
|
9
9
|
interface CopyStatusDetails {
|
|
@@ -3,7 +3,7 @@ import { p as Machine, y as Service } from "../../types-B24gMTKq.cjs";
|
|
|
3
3
|
import { b as NormalizeProps, r as DirectionProperty, t as CommonProperties, x as PropTypes } from "../../index-CLRsezW5.cjs";
|
|
4
4
|
|
|
5
5
|
//#region src/machines/collapsible/collapsible.anatomy.d.ts
|
|
6
|
-
declare const anatomy: AnatomyInstance<"root" | "
|
|
6
|
+
declare const anatomy: AnatomyInstance<"root" | "trigger" | "content" | "indicator">;
|
|
7
7
|
//#endregion
|
|
8
8
|
//#region src/machines/collapsible/collapsible.types.d.ts
|
|
9
9
|
interface OpenChangeDetails {
|
|
@@ -3,7 +3,7 @@ import { p as Machine, y as Service } from "../../types-DUM9rzfD.mjs";
|
|
|
3
3
|
import { b as NormalizeProps, r as DirectionProperty, t as CommonProperties, x as PropTypes } from "../../index-BVFlU3b9.mjs";
|
|
4
4
|
|
|
5
5
|
//#region src/machines/collapsible/collapsible.anatomy.d.ts
|
|
6
|
-
declare const anatomy: AnatomyInstance<"root" | "
|
|
6
|
+
declare const anatomy: AnatomyInstance<"root" | "trigger" | "content" | "indicator">;
|
|
7
7
|
//#endregion
|
|
8
8
|
//#region src/machines/collapsible/collapsible.types.d.ts
|
|
9
9
|
interface OpenChangeDetails {
|
|
@@ -6,7 +6,7 @@ import { c as PointerDownOutsideEvent, i as InteractOutsideHandlers, n as FocusO
|
|
|
6
6
|
import { d as PositioningOptions } from "../../types-CZAtqGqH.cjs";
|
|
7
7
|
|
|
8
8
|
//#region src/machines/color-picker/color-picker.anatomy.d.ts
|
|
9
|
-
declare const anatomy: Anatomy<"root" | "
|
|
9
|
+
declare const anatomy: Anatomy<"root" | "trigger" | "content" | "label" | "control" | "area" | "positioner" | "valueText" | "areaThumb" | "areaBackground" | "channelSlider" | "channelSliderLabel" | "channelSliderTrack" | "channelSliderThumb" | "channelSliderValueText" | "channelInput" | "transparencyGrid" | "swatchGroup" | "swatchTrigger" | "swatchIndicator" | "swatch" | "eyeDropperTrigger" | "formatTrigger" | "formatSelect">;
|
|
10
10
|
//#endregion
|
|
11
11
|
//#region src/machines/color-picker/color-picker.types.d.ts
|
|
12
12
|
type ExtendedColorChannel = ColorChannel | "hex" | "css";
|
|
@@ -6,7 +6,7 @@ import { c as PointerDownOutsideEvent, i as InteractOutsideHandlers, n as FocusO
|
|
|
6
6
|
import { p as PositioningOptions } from "../../index-fMh0VDkR.mjs";
|
|
7
7
|
|
|
8
8
|
//#region src/machines/color-picker/color-picker.anatomy.d.ts
|
|
9
|
-
declare const anatomy: Anatomy<"root" | "
|
|
9
|
+
declare const anatomy: Anatomy<"root" | "trigger" | "content" | "label" | "control" | "area" | "positioner" | "valueText" | "areaThumb" | "areaBackground" | "channelSlider" | "channelSliderLabel" | "channelSliderTrack" | "channelSliderThumb" | "channelSliderValueText" | "channelInput" | "transparencyGrid" | "swatchGroup" | "swatchTrigger" | "swatchIndicator" | "swatch" | "eyeDropperTrigger" | "formatTrigger" | "formatSelect">;
|
|
10
10
|
//#endregion
|
|
11
11
|
//#region src/machines/color-picker/color-picker.types.d.ts
|
|
12
12
|
type ExtendedColorChannel = ColorChannel | "hex" | "css";
|
|
@@ -46,8 +46,8 @@ const getItemEl = (ctx, value) => {
|
|
|
46
46
|
};
|
|
47
47
|
const focusInputEl = (ctx) => {
|
|
48
48
|
const inputEl = getInputEl(ctx);
|
|
49
|
-
if (ctx.isActiveElement(inputEl))
|
|
50
|
-
inputEl
|
|
49
|
+
if (!ctx.isActiveElement(inputEl)) inputEl?.focus({ preventScroll: true });
|
|
50
|
+
require_dom_query.setCaretToEnd(inputEl);
|
|
51
51
|
};
|
|
52
52
|
const focusTriggerEl = (ctx) => {
|
|
53
53
|
const triggerEl = getTriggerEl(ctx);
|
|
@@ -74,12 +74,12 @@ function connect(service, normalize) {
|
|
|
74
74
|
placement: context.get("currentPlacement")
|
|
75
75
|
});
|
|
76
76
|
function getItemState(props) {
|
|
77
|
-
const
|
|
77
|
+
const itemDisabled = collection.getItemDisabled(props.item);
|
|
78
78
|
const value = collection.getItemValue(props.item);
|
|
79
79
|
require_utils.ensure(value, () => `[sprawlify-js] No value found for item ${JSON.stringify(props.item)}`);
|
|
80
80
|
return {
|
|
81
81
|
value,
|
|
82
|
-
disabled: Boolean(disabled ||
|
|
82
|
+
disabled: Boolean(disabled || itemDisabled),
|
|
83
83
|
highlighted: highlightedValue === value,
|
|
84
84
|
selected: context.get("value").includes(value)
|
|
85
85
|
};
|
|
@@ -359,7 +359,7 @@ function connect(service, normalize) {
|
|
|
359
359
|
if (!require_dom_query.isLeftClick(event)) return;
|
|
360
360
|
event.preventDefault();
|
|
361
361
|
queueMicrotask(() => {
|
|
362
|
-
|
|
362
|
+
focusInputEl(scope);
|
|
363
363
|
});
|
|
364
364
|
},
|
|
365
365
|
onKeyDown(event) {
|
|
@@ -581,7 +581,7 @@ const machine = createMachine({
|
|
|
581
581
|
const context = getContext();
|
|
582
582
|
const prevSelectedItems = context.get("selectedItems");
|
|
583
583
|
const collection = prop("collection");
|
|
584
|
-
const nextItems = value.map((v) => {
|
|
584
|
+
const nextItems = (prop("value") || value).map((v) => {
|
|
585
585
|
return prevSelectedItems.find((item) => collection.getItemValue(item) === v) || collection.find(v);
|
|
586
586
|
});
|
|
587
587
|
context.set("selectedItems", nextItems);
|
|
@@ -799,8 +799,7 @@ const machine = createMachine({
|
|
|
799
799
|
],
|
|
800
800
|
"INPUT.ARROW_UP": [
|
|
801
801
|
{
|
|
802
|
-
guard: "autoComplete",
|
|
803
|
-
target: "interacting",
|
|
802
|
+
guard: and("isOpenControlled", "autoComplete"),
|
|
804
803
|
actions: ["invokeOnOpen"]
|
|
805
804
|
},
|
|
806
805
|
{
|
|
@@ -809,7 +808,7 @@ const machine = createMachine({
|
|
|
809
808
|
actions: ["invokeOnOpen"]
|
|
810
809
|
},
|
|
811
810
|
{
|
|
812
|
-
|
|
811
|
+
guard: "isOpenControlled",
|
|
813
812
|
actions: ["highlightLastOrSelectedItem", "invokeOnOpen"]
|
|
814
813
|
},
|
|
815
814
|
{
|
|
@@ -1205,7 +1204,7 @@ const machine = createMachine({
|
|
|
1205
1204
|
const inputEl = getInputEl(scope);
|
|
1206
1205
|
let cleanups = [];
|
|
1207
1206
|
const exec = (immediate) => {
|
|
1208
|
-
if (require_focus_visible.getInteractionModality()
|
|
1207
|
+
if (require_focus_visible.getInteractionModality() === "pointer") return;
|
|
1209
1208
|
const highlightedValue = context.get("highlightedValue");
|
|
1210
1209
|
if (!highlightedValue) return;
|
|
1211
1210
|
const contentEl = getContentEl(scope);
|
|
@@ -1227,7 +1226,10 @@ const machine = createMachine({
|
|
|
1227
1226
|
});
|
|
1228
1227
|
cleanups.push(raf_cleanup);
|
|
1229
1228
|
};
|
|
1230
|
-
const rafCleanup = require_dom_query.raf(() =>
|
|
1229
|
+
const rafCleanup = require_dom_query.raf(() => {
|
|
1230
|
+
require_focus_visible.setInteractionModality("virtual");
|
|
1231
|
+
exec(true);
|
|
1232
|
+
});
|
|
1231
1233
|
cleanups.push(rafCleanup);
|
|
1232
1234
|
const observerCleanup = require_dom_query.observeAttributes(inputEl, {
|
|
1233
1235
|
attributes: ["aria-activedescendant"],
|
|
@@ -7,7 +7,7 @@ import { c as PointerDownOutsideEvent, i as InteractOutsideHandlers, n as FocusO
|
|
|
7
7
|
import { c as Placement, d as PositioningOptions } from "../../types-CZAtqGqH.cjs";
|
|
8
8
|
|
|
9
9
|
//#region src/machines/combobox/combobox.anatomy.d.ts
|
|
10
|
-
declare const anatomy: AnatomyInstance<"root" | "
|
|
10
|
+
declare const anatomy: AnatomyInstance<"root" | "trigger" | "content" | "input" | "label" | "control" | "item" | "itemIndicator" | "itemGroup" | "positioner" | "clearTrigger" | "itemText" | "list" | "itemGroupLabel">;
|
|
11
11
|
//#endregion
|
|
12
12
|
//#region src/machines/combobox/combobox.collection.d.ts
|
|
13
13
|
declare const collection: {
|
|
@@ -7,7 +7,7 @@ import { c as PointerDownOutsideEvent, i as InteractOutsideHandlers, n as FocusO
|
|
|
7
7
|
import { p as PositioningOptions, u as Placement } from "../../index-fMh0VDkR.mjs";
|
|
8
8
|
|
|
9
9
|
//#region src/machines/combobox/combobox.anatomy.d.ts
|
|
10
|
-
declare const anatomy: AnatomyInstance<"root" | "
|
|
10
|
+
declare const anatomy: AnatomyInstance<"root" | "trigger" | "content" | "input" | "label" | "control" | "item" | "itemIndicator" | "itemGroup" | "positioner" | "clearTrigger" | "itemText" | "list" | "itemGroupLabel">;
|
|
11
11
|
//#endregion
|
|
12
12
|
//#region src/machines/combobox/combobox.collection.d.ts
|
|
13
13
|
declare const collection: {
|
|
@@ -5,7 +5,7 @@ import { s as ListCollection } from "../../collection-DgzidRvr.mjs";
|
|
|
5
5
|
import { o as setup } from "../../core-Ci9Yu6QI.mjs";
|
|
6
6
|
import "../../interact-outside-Ba50N1a5.mjs";
|
|
7
7
|
import { n as trackDismissableElement } from "../../dismissable-B9k5K6f9.mjs";
|
|
8
|
-
import { o as trackFocusVisible, t as getInteractionModality } from "../../focus-visible-BuLf8M9F.mjs";
|
|
8
|
+
import { a as setInteractionModality, o as trackFocusVisible, t as getInteractionModality } from "../../focus-visible-BuLf8M9F.mjs";
|
|
9
9
|
import { n as getPlacement, t as getPlacementStyles } from "../../popper-BlgbmdAn.mjs";
|
|
10
10
|
import { t as createProps } from "../../create-props-DFW8DUsC.mjs";
|
|
11
11
|
//#region src/machines/combobox/combobox.anatomy.ts
|
|
@@ -45,8 +45,8 @@ const getItemEl = (ctx, value) => {
|
|
|
45
45
|
};
|
|
46
46
|
const focusInputEl = (ctx) => {
|
|
47
47
|
const inputEl = getInputEl(ctx);
|
|
48
|
-
if (ctx.isActiveElement(inputEl))
|
|
49
|
-
inputEl
|
|
48
|
+
if (!ctx.isActiveElement(inputEl)) inputEl?.focus({ preventScroll: true });
|
|
49
|
+
setCaretToEnd(inputEl);
|
|
50
50
|
};
|
|
51
51
|
const focusTriggerEl = (ctx) => {
|
|
52
52
|
const triggerEl = getTriggerEl(ctx);
|
|
@@ -73,12 +73,12 @@ function connect(service, normalize) {
|
|
|
73
73
|
placement: context.get("currentPlacement")
|
|
74
74
|
});
|
|
75
75
|
function getItemState(props) {
|
|
76
|
-
const
|
|
76
|
+
const itemDisabled = collection.getItemDisabled(props.item);
|
|
77
77
|
const value = collection.getItemValue(props.item);
|
|
78
78
|
ensure(value, () => `[sprawlify-js] No value found for item ${JSON.stringify(props.item)}`);
|
|
79
79
|
return {
|
|
80
80
|
value,
|
|
81
|
-
disabled: Boolean(disabled ||
|
|
81
|
+
disabled: Boolean(disabled || itemDisabled),
|
|
82
82
|
highlighted: highlightedValue === value,
|
|
83
83
|
selected: context.get("value").includes(value)
|
|
84
84
|
};
|
|
@@ -358,7 +358,7 @@ function connect(service, normalize) {
|
|
|
358
358
|
if (!isLeftClick(event)) return;
|
|
359
359
|
event.preventDefault();
|
|
360
360
|
queueMicrotask(() => {
|
|
361
|
-
|
|
361
|
+
focusInputEl(scope);
|
|
362
362
|
});
|
|
363
363
|
},
|
|
364
364
|
onKeyDown(event) {
|
|
@@ -580,7 +580,7 @@ const machine = createMachine({
|
|
|
580
580
|
const context = getContext();
|
|
581
581
|
const prevSelectedItems = context.get("selectedItems");
|
|
582
582
|
const collection = prop("collection");
|
|
583
|
-
const nextItems = value.map((v) => {
|
|
583
|
+
const nextItems = (prop("value") || value).map((v) => {
|
|
584
584
|
return prevSelectedItems.find((item) => collection.getItemValue(item) === v) || collection.find(v);
|
|
585
585
|
});
|
|
586
586
|
context.set("selectedItems", nextItems);
|
|
@@ -798,8 +798,7 @@ const machine = createMachine({
|
|
|
798
798
|
],
|
|
799
799
|
"INPUT.ARROW_UP": [
|
|
800
800
|
{
|
|
801
|
-
guard: "autoComplete",
|
|
802
|
-
target: "interacting",
|
|
801
|
+
guard: and("isOpenControlled", "autoComplete"),
|
|
803
802
|
actions: ["invokeOnOpen"]
|
|
804
803
|
},
|
|
805
804
|
{
|
|
@@ -808,7 +807,7 @@ const machine = createMachine({
|
|
|
808
807
|
actions: ["invokeOnOpen"]
|
|
809
808
|
},
|
|
810
809
|
{
|
|
811
|
-
|
|
810
|
+
guard: "isOpenControlled",
|
|
812
811
|
actions: ["highlightLastOrSelectedItem", "invokeOnOpen"]
|
|
813
812
|
},
|
|
814
813
|
{
|
|
@@ -1204,7 +1203,7 @@ const machine = createMachine({
|
|
|
1204
1203
|
const inputEl = getInputEl(scope);
|
|
1205
1204
|
let cleanups = [];
|
|
1206
1205
|
const exec = (immediate) => {
|
|
1207
|
-
if (getInteractionModality()
|
|
1206
|
+
if (getInteractionModality() === "pointer") return;
|
|
1208
1207
|
const highlightedValue = context.get("highlightedValue");
|
|
1209
1208
|
if (!highlightedValue) return;
|
|
1210
1209
|
const contentEl = getContentEl(scope);
|
|
@@ -1226,7 +1225,10 @@ const machine = createMachine({
|
|
|
1226
1225
|
});
|
|
1227
1226
|
cleanups.push(raf_cleanup);
|
|
1228
1227
|
};
|
|
1229
|
-
const rafCleanup = raf(() =>
|
|
1228
|
+
const rafCleanup = raf(() => {
|
|
1229
|
+
setInteractionModality("virtual");
|
|
1230
|
+
exec(true);
|
|
1231
|
+
});
|
|
1230
1232
|
cleanups.push(rafCleanup);
|
|
1231
1233
|
const observerCleanup = observeAttributes(inputEl, {
|
|
1232
1234
|
attributes: ["aria-activedescendant"],
|