@sprawlify/primitives 0.0.111 → 0.0.113
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/collection.d.cts +2 -2
- package/dist/collection.d.mts +2 -2
- 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/{focus-visible-GXKbbuiq.mjs → focus-visible-BuLf8M9F.mjs} +10 -9
- package/dist/{focus-visible-JdJXqMic.cjs → focus-visible-Co_9bW09.cjs} +14 -7
- package/dist/focus-visible.cjs +2 -1
- package/dist/focus-visible.d.cts +2 -1
- package/dist/focus-visible.d.mts +2 -1
- package/dist/focus-visible.mjs +2 -2
- package/dist/{index-6cEVkXqi.d.mts → index-BfUngXif.d.mts} +6 -5
- package/dist/{list-collection-Cjgbx_9l.d.cts → list-collection-B_8BN0XB.d.cts} +1 -1
- package/dist/{list-collection-IF510iNl.d.mts → list-collection-DkRA5LOq.d.mts} +1 -1
- 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 +50 -20
- 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 +50 -20
- package/dist/machines/checkbox/index.cjs +1 -1
- package/dist/machines/checkbox/index.mjs +1 -1
- 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 +21 -13
- package/dist/machines/combobox/index.d.cts +2 -2
- package/dist/machines/combobox/index.d.mts +2 -2
- package/dist/machines/combobox/index.mjs +21 -13
- 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.cjs +7 -2
- package/dist/machines/dropdown-menu/index.d.cts +1 -1
- package/dist/machines/dropdown-menu/index.d.mts +1 -1
- package/dist/machines/dropdown-menu/index.mjs +7 -2
- 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/listbox/index.cjs +1 -1
- package/dist/machines/listbox/index.d.cts +3 -3
- package/dist/machines/listbox/index.d.mts +3 -3
- package/dist/machines/listbox/index.mjs +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/password-input/index.d.cts +1 -1
- package/dist/machines/password-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/radio-group/index.cjs +1 -1
- package/dist/machines/radio-group/index.d.cts +1 -1
- package/dist/machines/radio-group/index.d.mts +1 -1
- package/dist/machines/radio-group/index.mjs +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.cjs +7 -2
- package/dist/machines/select/index.d.cts +2 -2
- package/dist/machines/select/index.d.mts +2 -2
- package/dist/machines/select/index.mjs +7 -2
- package/dist/machines/slider/index.d.cts +1 -1
- package/dist/machines/slider/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/switch/index.cjs +1 -1
- package/dist/machines/switch/index.d.cts +1 -1
- package/dist/machines/switch/index.d.mts +1 -1
- package/dist/machines/switch/index.mjs +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 +3 -3
- package/dist/machines/toast/index.d.mts +3 -3
- package/dist/machines/tooltip/index.cjs +6 -6
- package/dist/machines/tooltip/index.d.cts +1 -1
- package/dist/machines/tooltip/index.d.mts +1 -1
- package/dist/machines/tooltip/index.mjs +7 -7
- 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/dist/{selection-BmS2RDMq.d.cts → selection-Bb_ZSVxe.d.cts} +1 -1
- package/dist/{selection-6urf-c8j.d.mts → selection-DdNvrKbj.d.mts} +1 -1
- package/package.json +1 -1
|
@@ -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" | "label" | "
|
|
12
|
-
declare const parts: Record<"root" | "label" | "
|
|
11
|
+
declare const anatomy: AnatomyInstance<"root" | "label" | "valueText" | "control" | "clearTrigger" | "content" | "item" | "indicator" | "itemText" | "trigger" | "positioner" | "list" | "itemIndicator">;
|
|
12
|
+
declare const parts: Record<"root" | "label" | "valueText" | "control" | "clearTrigger" | "content" | "item" | "indicator" | "itemText" | "trigger" | "positioner" | "list" | "itemIndicator", 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" | "label" | "
|
|
12
|
-
declare const parts: Record<"root" | "label" | "
|
|
11
|
+
declare const anatomy: AnatomyInstance<"root" | "label" | "valueText" | "control" | "clearTrigger" | "content" | "item" | "indicator" | "itemText" | "trigger" | "positioner" | "list" | "itemIndicator">;
|
|
12
|
+
declare const parts: Record<"root" | "label" | "valueText" | "control" | "clearTrigger" | "content" | "item" | "indicator" | "itemText" | "trigger" | "positioner" | "list" | "itemIndicator", 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
|
|
@@ -5,6 +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 { a as setInteractionModality, o as trackFocusVisible, t as getInteractionModality } from "../../focus-visible-BuLf8M9F.mjs";
|
|
8
9
|
import { n as getPlacement, t as getPlacementStyles } from "../../popper-BlgbmdAn.mjs";
|
|
9
10
|
import { B as getRectCorners, D as closestSideToPoint, L as createPoint, R as createRect, i as isPointInPolygon } from "../../rect-utils-B5xqFvKC.mjs";
|
|
10
11
|
import { t as createProps } from "../../create-props-DFW8DUsC.mjs";
|
|
@@ -68,7 +69,7 @@ function connect(service, normalize) {
|
|
|
68
69
|
const disabled = prop("disabled") || context.get("fieldsetDisabled");
|
|
69
70
|
const interactive = computed("isInteractive");
|
|
70
71
|
const valueAsString = computed("valueAsString");
|
|
71
|
-
const
|
|
72
|
+
const highlightedItems = context.get("highlightedItems");
|
|
72
73
|
const selectedItems = context.get("selectedItems");
|
|
73
74
|
const popperStyles = getPlacementStyles({
|
|
74
75
|
...prop("positioning"),
|
|
@@ -93,6 +94,7 @@ function connect(service, normalize) {
|
|
|
93
94
|
};
|
|
94
95
|
};
|
|
95
96
|
const hasSelectedItems = value.length > 0;
|
|
97
|
+
const empty = value.length === 0;
|
|
96
98
|
return {
|
|
97
99
|
collection,
|
|
98
100
|
open,
|
|
@@ -101,9 +103,10 @@ function connect(service, normalize) {
|
|
|
101
103
|
disabled,
|
|
102
104
|
value,
|
|
103
105
|
highlightedValue,
|
|
104
|
-
|
|
106
|
+
highlightedItems,
|
|
105
107
|
selectedItems,
|
|
106
108
|
hasSelectedItems,
|
|
109
|
+
empty,
|
|
107
110
|
valueAsString,
|
|
108
111
|
reposition(options = {}) {
|
|
109
112
|
send({
|
|
@@ -118,12 +121,15 @@ function connect(service, normalize) {
|
|
|
118
121
|
if (nextOpen === open) return;
|
|
119
122
|
send({ type: nextOpen ? "OPEN" : "CLOSE" });
|
|
120
123
|
},
|
|
121
|
-
|
|
124
|
+
setHighlightValue(value) {
|
|
122
125
|
send({
|
|
123
126
|
type: "HIGHLIGHTED_VALUE.SET",
|
|
124
127
|
value
|
|
125
128
|
});
|
|
126
129
|
},
|
|
130
|
+
clearHighlightValue() {
|
|
131
|
+
send({ type: "HIGHLIGHTED_VALUE.CLEAR" });
|
|
132
|
+
},
|
|
127
133
|
setValue(value) {
|
|
128
134
|
send({
|
|
129
135
|
type: "VALUE.SET",
|
|
@@ -177,7 +183,7 @@ function connect(service, normalize) {
|
|
|
177
183
|
dir: prop("dir"),
|
|
178
184
|
id: dom.getControlId(scope),
|
|
179
185
|
"data-disabled": dataAttr(disabled),
|
|
180
|
-
"data-
|
|
186
|
+
"data-focus": dataAttr(focused),
|
|
181
187
|
"data-readonly": dataAttr(prop("readOnly")),
|
|
182
188
|
"data-invalid": dataAttr(prop("invalid")),
|
|
183
189
|
"data-state": open ? "open" : "closed"
|
|
@@ -198,8 +204,9 @@ function connect(service, normalize) {
|
|
|
198
204
|
"data-disabled": dataAttr(disabled),
|
|
199
205
|
"data-readonly": dataAttr(prop("readOnly")),
|
|
200
206
|
"data-invalid": dataAttr(prop("invalid")),
|
|
201
|
-
"data-
|
|
207
|
+
"data-focus": dataAttr(focused),
|
|
202
208
|
"data-placement": currentPlacement,
|
|
209
|
+
"data-placeholder-shown": dataAttr(!hasSelectedItems),
|
|
203
210
|
disabled,
|
|
204
211
|
onClick(event) {
|
|
205
212
|
if (event.defaultPrevented) return;
|
|
@@ -447,6 +454,15 @@ function connect(service, normalize) {
|
|
|
447
454
|
hidden: !itemState.selected
|
|
448
455
|
});
|
|
449
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
|
+
},
|
|
450
466
|
getHiddenInputProps() {
|
|
451
467
|
const defaultValue = context.hash("value");
|
|
452
468
|
return normalize.input({
|
|
@@ -574,7 +590,7 @@ const machine = createMachine({
|
|
|
574
590
|
const value = prop("highlightedValue") ?? prop("defaultHighlightedValue") ?? null;
|
|
575
591
|
return { defaultValue: value ? prop("collection").getIndexPath(value) : [] };
|
|
576
592
|
}),
|
|
577
|
-
|
|
593
|
+
highlightedItems: bindable(() => ({ defaultValue: [] })),
|
|
578
594
|
selectedItems: bindable(() => ({ defaultValue: [] })),
|
|
579
595
|
currentPlacement: bindable(() => ({ defaultValue: void 0 })),
|
|
580
596
|
fieldsetDisabled: bindable(() => ({ defaultValue: false })),
|
|
@@ -614,6 +630,7 @@ const machine = createMachine({
|
|
|
614
630
|
"VALUE.CLEAR": { actions: ["clearValue"] },
|
|
615
631
|
"CLEAR_TRIGGER.CLICK": { actions: ["clearValue", "focusTriggerEl"] },
|
|
616
632
|
"HIGHLIGHTED_VALUE.SET": { actions: ["setHighlightedValue"] },
|
|
633
|
+
"HIGHLIGHTED_VALUE.CLEAR": { actions: ["clearHighlightedValue"] },
|
|
617
634
|
"ITEM.SELECT": { actions: ["selectItem"] },
|
|
618
635
|
"ITEM.CLEAR": { actions: ["clearItem"] }
|
|
619
636
|
},
|
|
@@ -748,6 +765,7 @@ const machine = createMachine({
|
|
|
748
765
|
exit: ["clearHighlightedValue", "scrollContentToTop"],
|
|
749
766
|
effects: [
|
|
750
767
|
"trackDismissableElement",
|
|
768
|
+
"trackFocusVisible",
|
|
751
769
|
"computePlacement",
|
|
752
770
|
"scrollToHighlightedItems"
|
|
753
771
|
],
|
|
@@ -899,8 +917,8 @@ const machine = createMachine({
|
|
|
899
917
|
},
|
|
900
918
|
shouldCloseOnSelectHighlighted: ({ prop, context }) => {
|
|
901
919
|
const collection = prop("collection");
|
|
902
|
-
const node = context.get("
|
|
903
|
-
return prop("closeOnSelect") && !collection.isBranchNode(node);
|
|
920
|
+
const node = last(context.get("highlightedItems"));
|
|
921
|
+
return prop("closeOnSelect") && node != null && !collection.isBranchNode(node);
|
|
904
922
|
},
|
|
905
923
|
canSelectItem: ({ prop, event }) => {
|
|
906
924
|
const collection = prop("collection");
|
|
@@ -972,6 +990,9 @@ const machine = createMachine({
|
|
|
972
990
|
}
|
|
973
991
|
});
|
|
974
992
|
},
|
|
993
|
+
trackFocusVisible({ scope }) {
|
|
994
|
+
return trackFocusVisible({ root: scope.getRootNode?.() });
|
|
995
|
+
},
|
|
975
996
|
trackDismissableElement({ scope, send, prop }) {
|
|
976
997
|
const contentEl = () => dom.getContentEl(scope);
|
|
977
998
|
let restoreFocus = true;
|
|
@@ -1003,13 +1024,13 @@ const machine = createMachine({
|
|
|
1003
1024
|
}
|
|
1004
1025
|
});
|
|
1005
1026
|
},
|
|
1006
|
-
scrollToHighlightedItems({ context, prop, scope
|
|
1027
|
+
scrollToHighlightedItems({ context, prop, scope }) {
|
|
1007
1028
|
let cleanups = [];
|
|
1008
1029
|
const exec = (immediate) => {
|
|
1009
1030
|
const highlightedValue = context.get("highlightedValue");
|
|
1010
1031
|
const highlightedIndexPath = context.get("highlightedIndexPath");
|
|
1011
1032
|
if (!highlightedIndexPath.length) return;
|
|
1012
|
-
if (
|
|
1033
|
+
if (getInteractionModality() === "pointer") return;
|
|
1013
1034
|
dom.getListEls(scope).forEach((listEl, index) => {
|
|
1014
1035
|
const itemPath = highlightedIndexPath.slice(0, index + 1);
|
|
1015
1036
|
const itemEl = dom.getItemEl(scope, highlightedValue.toString());
|
|
@@ -1032,7 +1053,10 @@ const machine = createMachine({
|
|
|
1032
1053
|
cleanups.push(raf_cleanup);
|
|
1033
1054
|
});
|
|
1034
1055
|
};
|
|
1035
|
-
raf(() =>
|
|
1056
|
+
raf(() => {
|
|
1057
|
+
setInteractionModality("virtual");
|
|
1058
|
+
exec(true);
|
|
1059
|
+
});
|
|
1036
1060
|
const rafCleanup = raf(() => exec(true));
|
|
1037
1061
|
cleanups.push(rafCleanup);
|
|
1038
1062
|
const observerCleanup = observeAttributes(dom.getContentEl(scope), {
|
|
@@ -1213,11 +1237,17 @@ const machine = createMachine({
|
|
|
1213
1237
|
dom.getTriggerEl(scope)?.focus({ preventScroll: true });
|
|
1214
1238
|
});
|
|
1215
1239
|
},
|
|
1216
|
-
invokeOnOpen({ prop }) {
|
|
1217
|
-
prop("onOpenChange")?.({
|
|
1240
|
+
invokeOnOpen({ prop, context }) {
|
|
1241
|
+
prop("onOpenChange")?.({
|
|
1242
|
+
open: true,
|
|
1243
|
+
value: context.get("value")
|
|
1244
|
+
});
|
|
1218
1245
|
},
|
|
1219
|
-
invokeOnClose({ prop }) {
|
|
1220
|
-
prop("onOpenChange")?.({
|
|
1246
|
+
invokeOnClose({ prop, context }) {
|
|
1247
|
+
prop("onOpenChange")?.({
|
|
1248
|
+
open: false,
|
|
1249
|
+
value: context.get("value")
|
|
1250
|
+
});
|
|
1221
1251
|
},
|
|
1222
1252
|
toggleVisibility({ send, prop }) {
|
|
1223
1253
|
if (prop("open") != null) send({ type: prop("open") ? "CONTROLLED.OPEN" : "CONTROLLED.CLOSE" });
|
|
@@ -1303,16 +1333,16 @@ const set = {
|
|
|
1303
1333
|
highlightedValue({ context, prop }, value) {
|
|
1304
1334
|
const collection = prop("collection");
|
|
1305
1335
|
context.set("highlightedValue", value);
|
|
1306
|
-
const highlightedIndexPath = value == null ? [] : collection.getIndexPath(value);
|
|
1336
|
+
const highlightedIndexPath = (value == null ? [] : collection.getIndexPath(value)) ?? [];
|
|
1307
1337
|
context.set("highlightedIndexPath", highlightedIndexPath);
|
|
1308
|
-
const
|
|
1338
|
+
const highlightedItems = highlightedIndexPath.map((_, index) => {
|
|
1309
1339
|
const partialPath = highlightedIndexPath.slice(0, index + 1);
|
|
1310
1340
|
return collection.at(partialPath);
|
|
1311
1341
|
});
|
|
1312
|
-
context.set("
|
|
1342
|
+
context.set("highlightedItems", highlightedItems);
|
|
1313
1343
|
prop("onHighlightChange")?.({
|
|
1314
|
-
value,
|
|
1315
|
-
|
|
1344
|
+
highlightedValue: value,
|
|
1345
|
+
highlightedItems
|
|
1316
1346
|
});
|
|
1317
1347
|
}
|
|
1318
1348
|
};
|
|
@@ -3,7 +3,7 @@ const require_create_anatomy = require("../../create-anatomy-BnwEmNnc.cjs");
|
|
|
3
3
|
const require_dom_query = require("../../dom-query-BUO7rGsg.cjs");
|
|
4
4
|
const require_utils = require("../../utils-ByNiZU8f.cjs");
|
|
5
5
|
const require_core = require("../../core-DwdPztGA.cjs");
|
|
6
|
-
const require_focus_visible = require("../../focus-visible-
|
|
6
|
+
const require_focus_visible = require("../../focus-visible-Co_9bW09.cjs");
|
|
7
7
|
const require_create_props = require("../../create-props-DP39rHnH.cjs");
|
|
8
8
|
//#region src/machines/checkbox/checkbox.anatomy.ts
|
|
9
9
|
const anatomy = require_create_anatomy.createAnatomy("checkbox").parts("root", "label", "control", "indicator");
|
|
@@ -2,7 +2,7 @@ import { t as createAnatomy } from "../../create-anatomy-Dr0evdYy.mjs";
|
|
|
2
2
|
import { T as trackPress, a as visuallyHiddenStyle, ht as getEventTarget, lt as trackFormControl, rt as dispatchInputCheckedEvent, st as setElementChecked, xn as dataAttr } from "../../dom-query-BFuRs3l4.mjs";
|
|
3
3
|
import { u as createSplitProps } from "../../utils-VVoZ_v29.mjs";
|
|
4
4
|
import { a as createMachine, i as createGuards } from "../../core-Ci9Yu6QI.mjs";
|
|
5
|
-
import {
|
|
5
|
+
import { o as trackFocusVisible, r as isFocusVisible } from "../../focus-visible-BuLf8M9F.mjs";
|
|
6
6
|
import { t as createProps } from "../../create-props-DFW8DUsC.mjs";
|
|
7
7
|
//#region src/machines/checkbox/checkbox.anatomy.ts
|
|
8
8
|
const anatomy = createAnatomy("checkbox").parts("root", "label", "control", "indicator");
|
|
@@ -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" | "label" | "control" | "
|
|
6
|
+
declare const anatomy: AnatomyInstance<"root" | "label" | "control" | "input" | "indicator" | "trigger">;
|
|
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" | "label" | "control" | "
|
|
6
|
+
declare const anatomy: AnatomyInstance<"root" | "label" | "control" | "input" | "indicator" | "trigger">;
|
|
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" | "content" | "indicator" | "trigger">;
|
|
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" | "content" | "indicator" | "trigger">;
|
|
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" | "label" | "
|
|
9
|
+
declare const anatomy: Anatomy<"root" | "label" | "valueText" | "control" | "area" | "content" | "trigger" | "positioner" | "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" | "label" | "
|
|
9
|
+
declare const anatomy: Anatomy<"root" | "label" | "valueText" | "control" | "area" | "content" | "trigger" | "positioner" | "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,6 +6,7 @@ const require_collection = require("../../collection-BBgC8xCb.cjs");
|
|
|
6
6
|
const require_core = require("../../core-DwdPztGA.cjs");
|
|
7
7
|
require("../../interact-outside-Bg-QSXqp.cjs");
|
|
8
8
|
const require_dismissable = require("../../dismissable-DxjbwsOf.cjs");
|
|
9
|
+
const require_focus_visible = require("../../focus-visible-Co_9bW09.cjs");
|
|
9
10
|
const require_popper = require("../../popper-viCrafLC.cjs");
|
|
10
11
|
const require_create_props = require("../../create-props-DP39rHnH.cjs");
|
|
11
12
|
//#region src/machines/combobox/combobox.anatomy.ts
|
|
@@ -45,8 +46,8 @@ const getItemEl = (ctx, value) => {
|
|
|
45
46
|
};
|
|
46
47
|
const focusInputEl = (ctx) => {
|
|
47
48
|
const inputEl = getInputEl(ctx);
|
|
48
|
-
if (ctx.isActiveElement(inputEl))
|
|
49
|
-
inputEl
|
|
49
|
+
if (!ctx.isActiveElement(inputEl)) inputEl?.focus({ preventScroll: true });
|
|
50
|
+
require_dom_query.setCaretToEnd(inputEl);
|
|
50
51
|
};
|
|
51
52
|
const focusTriggerEl = (ctx) => {
|
|
52
53
|
const triggerEl = getTriggerEl(ctx);
|
|
@@ -73,12 +74,12 @@ function connect(service, normalize) {
|
|
|
73
74
|
placement: context.get("currentPlacement")
|
|
74
75
|
});
|
|
75
76
|
function getItemState(props) {
|
|
76
|
-
const
|
|
77
|
+
const itemDisabled = collection.getItemDisabled(props.item);
|
|
77
78
|
const value = collection.getItemValue(props.item);
|
|
78
79
|
require_utils.ensure(value, () => `[sprawlify-js] No value found for item ${JSON.stringify(props.item)}`);
|
|
79
80
|
return {
|
|
80
81
|
value,
|
|
81
|
-
disabled: Boolean(disabled ||
|
|
82
|
+
disabled: Boolean(disabled || itemDisabled),
|
|
82
83
|
highlighted: highlightedValue === value,
|
|
83
84
|
selected: context.get("value").includes(value)
|
|
84
85
|
};
|
|
@@ -358,7 +359,7 @@ function connect(service, normalize) {
|
|
|
358
359
|
if (!require_dom_query.isLeftClick(event)) return;
|
|
359
360
|
event.preventDefault();
|
|
360
361
|
queueMicrotask(() => {
|
|
361
|
-
|
|
362
|
+
focusInputEl(scope);
|
|
362
363
|
});
|
|
363
364
|
},
|
|
364
365
|
onKeyDown(event) {
|
|
@@ -580,7 +581,7 @@ const machine = createMachine({
|
|
|
580
581
|
const context = getContext();
|
|
581
582
|
const prevSelectedItems = context.get("selectedItems");
|
|
582
583
|
const collection = prop("collection");
|
|
583
|
-
const nextItems = value.map((v) => {
|
|
584
|
+
const nextItems = (prop("value") || value).map((v) => {
|
|
584
585
|
return prevSelectedItems.find((item) => collection.getItemValue(item) === v) || collection.find(v);
|
|
585
586
|
});
|
|
586
587
|
context.set("selectedItems", nextItems);
|
|
@@ -798,8 +799,7 @@ const machine = createMachine({
|
|
|
798
799
|
],
|
|
799
800
|
"INPUT.ARROW_UP": [
|
|
800
801
|
{
|
|
801
|
-
guard: "autoComplete",
|
|
802
|
-
target: "interacting",
|
|
802
|
+
guard: and("isOpenControlled", "autoComplete"),
|
|
803
803
|
actions: ["invokeOnOpen"]
|
|
804
804
|
},
|
|
805
805
|
{
|
|
@@ -808,7 +808,7 @@ const machine = createMachine({
|
|
|
808
808
|
actions: ["invokeOnOpen"]
|
|
809
809
|
},
|
|
810
810
|
{
|
|
811
|
-
|
|
811
|
+
guard: "isOpenControlled",
|
|
812
812
|
actions: ["highlightLastOrSelectedItem", "invokeOnOpen"]
|
|
813
813
|
},
|
|
814
814
|
{
|
|
@@ -830,6 +830,7 @@ const machine = createMachine({
|
|
|
830
830
|
tags: ["open", "focused"],
|
|
831
831
|
entry: ["setInitialFocus"],
|
|
832
832
|
effects: [
|
|
833
|
+
"trackFocusVisible",
|
|
833
834
|
"scrollToHighlightedItem",
|
|
834
835
|
"trackDismissableLayer",
|
|
835
836
|
"trackPlacement"
|
|
@@ -978,6 +979,7 @@ const machine = createMachine({
|
|
|
978
979
|
suggesting: {
|
|
979
980
|
tags: ["open", "focused"],
|
|
980
981
|
effects: [
|
|
982
|
+
"trackFocusVisible",
|
|
981
983
|
"trackDismissableLayer",
|
|
982
984
|
"scrollToHighlightedItem",
|
|
983
985
|
"trackPlacement"
|
|
@@ -1152,6 +1154,9 @@ const machine = createMachine({
|
|
|
1152
1154
|
hasCollectionItems: ({ prop }) => prop("collection").size > 0
|
|
1153
1155
|
},
|
|
1154
1156
|
effects: {
|
|
1157
|
+
trackFocusVisible({ scope }) {
|
|
1158
|
+
return require_focus_visible.trackFocusVisible({ root: scope.getRootNode?.() });
|
|
1159
|
+
},
|
|
1155
1160
|
trackDismissableLayer({ send, prop, scope }) {
|
|
1156
1161
|
if (prop("disableLayer")) return;
|
|
1157
1162
|
const contentEl = () => getContentEl(scope);
|
|
@@ -1195,13 +1200,13 @@ const machine = createMachine({
|
|
|
1195
1200
|
}
|
|
1196
1201
|
});
|
|
1197
1202
|
},
|
|
1198
|
-
scrollToHighlightedItem({ context, prop, scope
|
|
1203
|
+
scrollToHighlightedItem({ context, prop, scope }) {
|
|
1199
1204
|
const inputEl = getInputEl(scope);
|
|
1200
1205
|
let cleanups = [];
|
|
1201
1206
|
const exec = (immediate) => {
|
|
1202
|
-
|
|
1207
|
+
if (require_focus_visible.getInteractionModality() === "pointer") return;
|
|
1203
1208
|
const highlightedValue = context.get("highlightedValue");
|
|
1204
|
-
if (
|
|
1209
|
+
if (!highlightedValue) return;
|
|
1205
1210
|
const contentEl = getContentEl(scope);
|
|
1206
1211
|
const scrollToIndexFn = prop("scrollToIndexFn");
|
|
1207
1212
|
if (scrollToIndexFn) {
|
|
@@ -1221,7 +1226,10 @@ const machine = createMachine({
|
|
|
1221
1226
|
});
|
|
1222
1227
|
cleanups.push(raf_cleanup);
|
|
1223
1228
|
};
|
|
1224
|
-
const rafCleanup = require_dom_query.raf(() =>
|
|
1229
|
+
const rafCleanup = require_dom_query.raf(() => {
|
|
1230
|
+
require_focus_visible.setInteractionModality("virtual");
|
|
1231
|
+
exec(true);
|
|
1232
|
+
});
|
|
1225
1233
|
cleanups.push(rafCleanup);
|
|
1226
1234
|
const observerCleanup = require_dom_query.observeAttributes(inputEl, {
|
|
1227
1235
|
attributes: ["aria-activedescendant"],
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { n as AnatomyInstance } from "../../create-anatomy-9eFQs7lO.cjs";
|
|
2
2
|
import { r as CollectionOptions, t as CollectionItem } from "../../types-D-7AMgSE.cjs";
|
|
3
|
-
import { t as ListCollection } from "../../list-collection-
|
|
3
|
+
import { t as ListCollection } from "../../list-collection-B_8BN0XB.cjs";
|
|
4
4
|
import { p as Machine, u as EventObject, y as Service } from "../../types-B24gMTKq.cjs";
|
|
5
5
|
import { b as NormalizeProps, g as RequiredBy, r as DirectionProperty, t as CommonProperties, x as PropTypes } from "../../index-CLRsezW5.cjs";
|
|
6
6
|
import { c as PointerDownOutsideEvent, i as InteractOutsideHandlers, n as FocusOutsideEvent, r as InteractOutsideEvent } from "../../index-DzWGFhcS.cjs";
|
|
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" | "label" | "control" | "
|
|
10
|
+
declare const anatomy: AnatomyInstance<"root" | "label" | "control" | "input" | "clearTrigger" | "content" | "item" | "itemText" | "trigger" | "positioner" | "list" | "itemIndicator" | "itemGroup" | "itemGroupLabel">;
|
|
11
11
|
//#endregion
|
|
12
12
|
//#region src/machines/combobox/combobox.collection.d.ts
|
|
13
13
|
declare const collection: {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { n as AnatomyInstance } from "../../create-anatomy-BedZVdg0.mjs";
|
|
2
2
|
import { r as CollectionOptions, t as CollectionItem } from "../../types-9uw8LHpE.mjs";
|
|
3
|
-
import { t as ListCollection } from "../../list-collection-
|
|
3
|
+
import { t as ListCollection } from "../../list-collection-DkRA5LOq.mjs";
|
|
4
4
|
import { p as Machine, u as EventObject, y as Service } from "../../types-DUM9rzfD.mjs";
|
|
5
5
|
import { b as NormalizeProps, g as RequiredBy, r as DirectionProperty, t as CommonProperties, x as PropTypes } from "../../index-BVFlU3b9.mjs";
|
|
6
6
|
import { c as PointerDownOutsideEvent, i as InteractOutsideHandlers, n as FocusOutsideEvent, r as InteractOutsideEvent } from "../../index-CGNNiDyE.mjs";
|
|
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" | "label" | "control" | "
|
|
10
|
+
declare const anatomy: AnatomyInstance<"root" | "label" | "control" | "input" | "clearTrigger" | "content" | "item" | "itemText" | "trigger" | "positioner" | "list" | "itemIndicator" | "itemGroup" | "itemGroupLabel">;
|
|
11
11
|
//#endregion
|
|
12
12
|
//#region src/machines/combobox/combobox.collection.d.ts
|
|
13
13
|
declare const collection: {
|