@serendie/ui 2.1.3 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.js +79 -74
- package/dist/components/Accordion/Accordion.d.ts +1 -1
- package/dist/components/Avatar/Avatar.d.ts +1 -1
- package/dist/components/Banner/Banner.d.ts +1 -1
- package/dist/components/BottomNavigation/BottomNavigationItem.d.ts +1 -1
- package/dist/components/Button/Button.d.ts +2 -2
- package/dist/components/Button/Button.js +22 -21
- package/dist/components/DatePicker/DatePicker.d.ts +13 -0
- package/dist/components/DatePicker/DatePicker.js +203 -0
- package/dist/components/DatePicker/index.d.ts +2 -0
- package/dist/components/DatePicker/index.js +6 -0
- package/dist/components/DatePicker/parseDate.d.ts +1 -0
- package/dist/components/DatePicker/styles.d.ts +1 -0
- package/dist/components/DatePicker/styles.js +224 -0
- package/dist/components/IconButton/IconButton.d.ts +3 -3
- package/dist/components/List/ListItem.d.ts +1 -1
- package/dist/components/ModalDialog/ModalDialog.d.ts +1 -1
- package/dist/components/NotificationBadge/NotificationBadge.d.ts +1 -1
- package/dist/components/Pagination/Pagination.d.ts +1 -1
- package/dist/components/ProgressIndicator/AnimatedArc.d.ts +6 -0
- package/dist/components/ProgressIndicator/AnimatedArc.js +46 -0
- package/dist/components/ProgressIndicator/ProgressIndicator.d.ts +11 -29
- package/dist/components/ProgressIndicator/ProgressIndicator.js +201 -43
- package/dist/components/ProgressIndicator/ProgressIndicatorIndeterminate.d.ts +10 -0
- package/dist/components/ProgressIndicator/ProgressIndicatorIndeterminate.js +215 -0
- package/dist/components/ProgressIndicator/index.d.ts +4 -1
- package/dist/components/ProgressIndicator/index.js +3 -2
- package/dist/components/ProgressIndicator/util.d.ts +1 -0
- package/dist/components/ProgressIndicator/util.js +13 -0
- package/dist/components/Search/Search.d.ts +1 -1
- package/dist/components/Select/Select.d.ts +1 -1
- package/dist/components/Switch/Switch.d.ts +1 -1
- package/dist/components/Tabs/Tabs.d.ts +1 -1
- package/dist/components/TextField/TextField.js +59 -156
- package/dist/components/Toast/Toast.d.ts +1 -1
- package/dist/components/TopAppBar/TopAppBar.d.ts +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +80 -75
- package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-content.js +15 -0
- package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-context.js +5 -0
- package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-control.js +13 -0
- package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-input.js +14 -0
- package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-label.js +13 -0
- package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-month-select.js +13 -0
- package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-next-trigger.js +14 -0
- package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-positioner.js +14 -0
- package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-prev-trigger.js +14 -0
- package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-root.js +55 -0
- package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-table-body.js +14 -0
- package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-table-cell-trigger.js +19 -0
- package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-table-cell.js +26 -0
- package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-table-head.js +14 -0
- package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-table-header.js +14 -0
- package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-table-row.js +14 -0
- package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-table.js +16 -0
- package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-trigger.js +13 -0
- package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-view-control.js +14 -0
- package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-view.js +23 -0
- package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker-year-select.js +13 -0
- package/dist/node_modules/@ark-ui/react/dist/components/date-picker/date-picker.anatomy.js +5 -0
- package/dist/node_modules/@ark-ui/react/dist/components/date-picker/use-date-picker-context.js +10 -0
- package/dist/node_modules/@ark-ui/react/dist/components/date-picker/use-date-picker-table-cell-props-context.js +10 -0
- package/dist/node_modules/@ark-ui/react/dist/components/date-picker/use-date-picker-table-props-context.js +10 -0
- package/dist/node_modules/@ark-ui/react/dist/components/date-picker/use-date-picker-view-props-context.js +12 -0
- package/dist/node_modules/@ark-ui/react/dist/components/date-picker/use-date-picker.js +18 -0
- package/dist/node_modules/@ark-ui/react/dist/components/factory.js +11 -12
- package/dist/node_modules/@ark-ui/react/dist/components/menu/menu-root.js +5 -4
- package/dist/node_modules/@ark-ui/react/dist/utils/use-event.js +0 -1
- package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +36 -36
- package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +238 -235
- package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +88 -83
- package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +68 -67
- package/dist/node_modules/@internationalized/date/dist/CalendarDate.js +178 -0
- package/dist/node_modules/@internationalized/date/dist/DateFormatter.js +99 -0
- package/dist/node_modules/@internationalized/date/dist/GregorianCalendar.js +98 -0
- package/dist/node_modules/@internationalized/date/dist/conversion.js +135 -0
- package/dist/node_modules/@internationalized/date/dist/manipulation.js +205 -0
- package/dist/node_modules/@internationalized/date/dist/queries.js +202 -0
- package/dist/node_modules/@internationalized/date/dist/string.js +41 -0
- package/dist/node_modules/@internationalized/date/dist/utils.js +6 -0
- package/dist/node_modules/@internationalized/date/dist/weekStartData.js +100 -0
- package/dist/node_modules/@swc/helpers/esm/_check_private_redeclaration.js +7 -0
- package/dist/node_modules/@swc/helpers/esm/_class_private_field_init.js +7 -0
- package/dist/node_modules/@zag-js/anatomy/dist/index.js +15 -14
- package/dist/node_modules/@zag-js/aria-hidden/dist/index.js +23 -23
- package/dist/node_modules/@zag-js/collection/dist/index.js +102 -71
- package/dist/node_modules/@zag-js/combobox/dist/index.js +482 -426
- package/dist/node_modules/@zag-js/date-picker/dist/index.js +1826 -0
- package/dist/node_modules/@zag-js/date-utils/dist/index.js +366 -0
- package/dist/node_modules/@zag-js/dialog/dist/index.js +66 -64
- package/dist/node_modules/@zag-js/dismissable/dist/index.js +94 -69
- package/dist/node_modules/@zag-js/dom-query/dist/index.js +359 -300
- package/dist/node_modules/@zag-js/live-region/dist/index.js +39 -0
- package/dist/node_modules/@zag-js/menu/dist/index.js +357 -340
- package/dist/node_modules/@zag-js/popper/dist/index.js +123 -120
- package/dist/node_modules/@zag-js/presence/dist/index.js +17 -17
- package/dist/node_modules/@zag-js/radio-group/dist/index.js +118 -117
- package/dist/node_modules/@zag-js/react/dist/index.js +124 -121
- package/dist/node_modules/@zag-js/select/dist/index.js +211 -197
- package/dist/node_modules/@zag-js/toast/dist/index.js +73 -71
- package/dist/node_modules/@zag-js/tooltip/dist/index.js +31 -30
- package/dist/node_modules/@zag-js/utils/dist/index.js +150 -104
- package/dist/preset.d.ts +11 -1
- package/dist/recipes/index.d.ts +3 -2
- package/dist/recipes/index.js +5 -2
- package/dist/recipes/textFieldRecipe.d.ts +6 -0
- package/dist/recipes/textFieldRecipe.js +107 -0
- package/dist/styled-system/css/cva.js +43 -38
- package/dist/styled-system/recipes/create-recipe.js +37 -0
- package/dist/styled-system/recipes/text-field-recipe.js +61 -0
- package/dist/styles.css +1 -1
- package/dist/tokens/keyframes/index.d.ts +8 -0
- package/dist/tokens/keyframes/index.js +6 -2
- package/package.json +3 -3
- package/styled-system/recipes/create-recipe.js +82 -0
- package/styled-system/recipes/index.d.ts +2 -0
- package/styled-system/recipes/index.js +1 -0
- package/styled-system/recipes/text-field-recipe.d.ts +28 -0
- package/styled-system/recipes/text-field-recipe.js +72 -0
- package/styled-system/types/prop-type.d.ts +1 -1
- package/dist/node_modules/@zag-js/store/dist/index.js +0 -131
- package/dist/node_modules/proxy-compare/dist/index.js +0 -7
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { createAnatomy as
|
|
2
|
-
import { ListCollection as
|
|
3
|
-
import { raf as
|
|
4
|
-
import { getPlacement as
|
|
5
|
-
import { match as
|
|
6
|
-
import { ariaHidden as
|
|
7
|
-
import { setup as
|
|
8
|
-
import { trackDismissableElement as
|
|
1
|
+
import { createAnatomy as ge } from "../../anatomy/dist/index.js";
|
|
2
|
+
import { ListCollection as ie } from "../../collection/dist/index.js";
|
|
3
|
+
import { raf as V, setCaretToEnd as de, nextTick as he, observeAttributes as pe, clickIfLink as me, dataAttr as c, ariaAttr as K, isDownloadingEvent as Ie, isOpeningInNewTab as Ce, isContextMenuEvent as ve, isLeftClick as D, getEventKey as $, isComposingEvent as fe, query as Oe, isAnchorElement as Ve, scrollIntoView as q } from "../../dom-query/dist/index.js";
|
|
4
|
+
import { getPlacement as Y, getPlacementStyles as Ee } from "../../popper/dist/index.js";
|
|
5
|
+
import { match as P, remove as Te, addOrRemove as j, isBoolean as ye, isEqual as Pe, ensure as ke } from "../../utils/dist/index.js";
|
|
6
|
+
import { ariaHidden as Le } from "../../aria-hidden/dist/index.js";
|
|
7
|
+
import { setup as Se } from "../../core/dist/index.js";
|
|
8
|
+
import { trackDismissableElement as be } from "../../dismissable/dist/index.js";
|
|
9
9
|
import { createProps as G } from "../../types/dist/index.js";
|
|
10
|
-
var
|
|
10
|
+
var Ne = ge("combobox").parts(
|
|
11
11
|
"root",
|
|
12
12
|
"clearTrigger",
|
|
13
13
|
"content",
|
|
@@ -22,15 +22,15 @@ var Le = ce("combobox").parts(
|
|
|
22
22
|
"list",
|
|
23
23
|
"positioner",
|
|
24
24
|
"trigger"
|
|
25
|
-
),
|
|
26
|
-
|
|
25
|
+
), C = Ne.build(), le = (e) => new ie(e);
|
|
26
|
+
le.empty = () => new ie({ items: [] });
|
|
27
27
|
var Fe = (e) => {
|
|
28
28
|
var t;
|
|
29
29
|
return ((t = e.ids) == null ? void 0 : t.root) ?? `combobox:${e.id}`;
|
|
30
30
|
}, B = (e) => {
|
|
31
31
|
var t;
|
|
32
32
|
return ((t = e.ids) == null ? void 0 : t.label) ?? `combobox:${e.id}:label`;
|
|
33
|
-
},
|
|
33
|
+
}, ne = (e) => {
|
|
34
34
|
var t;
|
|
35
35
|
return ((t = e.ids) == null ? void 0 : t.control) ?? `combobox:${e.id}:control`;
|
|
36
36
|
}, M = (e) => {
|
|
@@ -39,364 +39,367 @@ var Fe = (e) => {
|
|
|
39
39
|
}, w = (e) => {
|
|
40
40
|
var t;
|
|
41
41
|
return ((t = e.ids) == null ? void 0 : t.content) ?? `combobox:${e.id}:content`;
|
|
42
|
-
},
|
|
42
|
+
}, oe = (e) => {
|
|
43
43
|
var t;
|
|
44
44
|
return ((t = e.ids) == null ? void 0 : t.positioner) ?? `combobox:${e.id}:popper`;
|
|
45
|
-
},
|
|
45
|
+
}, ae = (e) => {
|
|
46
46
|
var t;
|
|
47
47
|
return ((t = e.ids) == null ? void 0 : t.trigger) ?? `combobox:${e.id}:toggle-btn`;
|
|
48
|
-
},
|
|
48
|
+
}, se = (e) => {
|
|
49
49
|
var t;
|
|
50
50
|
return ((t = e.ids) == null ? void 0 : t.clearTrigger) ?? `combobox:${e.id}:clear-btn`;
|
|
51
|
-
},
|
|
52
|
-
var i,
|
|
53
|
-
return ((
|
|
54
|
-
}, j = (e, t) => {
|
|
55
|
-
var i, n;
|
|
56
|
-
return ((n = (i = e.ids) == null ? void 0 : i.itemGroupLabel) == null ? void 0 : n.call(i, t)) ?? `combobox:${e.id}:optgroup-label:${t}`;
|
|
51
|
+
}, He = (e, t) => {
|
|
52
|
+
var i, l;
|
|
53
|
+
return ((l = (i = e.ids) == null ? void 0 : i.itemGroup) == null ? void 0 : l.call(i, t)) ?? `combobox:${e.id}:optgroup:${t}`;
|
|
57
54
|
}, J = (e, t) => {
|
|
58
|
-
var i,
|
|
59
|
-
return ((
|
|
60
|
-
},
|
|
61
|
-
|
|
55
|
+
var i, l;
|
|
56
|
+
return ((l = (i = e.ids) == null ? void 0 : i.itemGroupLabel) == null ? void 0 : l.call(i, t)) ?? `combobox:${e.id}:optgroup-label:${t}`;
|
|
57
|
+
}, Q = (e, t) => {
|
|
58
|
+
var i, l;
|
|
59
|
+
return ((l = (i = e.ids) == null ? void 0 : i.item) == null ? void 0 : l.call(i, t)) ?? `combobox:${e.id}:option:${t}`;
|
|
60
|
+
}, k = (e) => e.getById(w(e)), L = (e) => e.getById(M(e)), X = (e) => e.getById(oe(e)), Z = (e) => e.getById(ne(e)), H = (e) => e.getById(ae(e)), z = (e) => e.getById(se(e)), F = (e, t) => {
|
|
61
|
+
if (t == null) return null;
|
|
62
62
|
const i = `[role=option][data-value="${CSS.escape(t)}"]`;
|
|
63
|
-
return
|
|
64
|
-
},
|
|
65
|
-
const t =
|
|
63
|
+
return Oe(k(e), i);
|
|
64
|
+
}, ee = (e) => {
|
|
65
|
+
const t = L(e);
|
|
66
66
|
e.isActiveElement(t) || t == null || t.focus({ preventScroll: !0 });
|
|
67
67
|
}, Re = (e) => {
|
|
68
|
-
const t =
|
|
68
|
+
const t = H(e);
|
|
69
69
|
e.isActiveElement(t) || t == null || t.focus({ preventScroll: !0 });
|
|
70
70
|
};
|
|
71
|
-
function
|
|
72
|
-
const { context: i, prop:
|
|
73
|
-
...
|
|
71
|
+
function qe(e, t) {
|
|
72
|
+
const { context: i, prop: l, state: n, send: o, scope: s, computed: u, event: E } = e, I = l("translations"), f = l("collection"), m = l("disabled"), T = u("isInteractive"), O = l("invalid"), N = l("readOnly"), h = n.hasTag("open"), R = n.hasTag("focused"), S = l("composite"), b = i.get("highlightedValue"), re = Ee({
|
|
73
|
+
...l("positioning"),
|
|
74
74
|
placement: i.get("currentPlacement")
|
|
75
75
|
});
|
|
76
|
-
function
|
|
77
|
-
const
|
|
78
|
-
return
|
|
76
|
+
function U(a) {
|
|
77
|
+
const r = f.getItemDisabled(a.item), g = f.getItemValue(a.item);
|
|
78
|
+
return ke(g, () => `[zag-js] No value found for item ${JSON.stringify(a.item)}`), {
|
|
79
79
|
value: g,
|
|
80
|
-
disabled: !!(
|
|
80
|
+
disabled: !!(r || r),
|
|
81
81
|
highlighted: b === g,
|
|
82
82
|
selected: i.get("value").includes(g)
|
|
83
83
|
};
|
|
84
84
|
}
|
|
85
85
|
return {
|
|
86
|
-
focused:
|
|
87
|
-
open:
|
|
86
|
+
focused: R,
|
|
87
|
+
open: h,
|
|
88
88
|
inputValue: i.get("inputValue"),
|
|
89
89
|
highlightedValue: b,
|
|
90
90
|
highlightedItem: i.get("highlightedItem"),
|
|
91
91
|
value: i.get("value"),
|
|
92
|
-
valueAsString:
|
|
93
|
-
hasSelectedItems:
|
|
92
|
+
valueAsString: u("valueAsString"),
|
|
93
|
+
hasSelectedItems: u("hasSelectedItems"),
|
|
94
94
|
selectedItems: i.get("selectedItems"),
|
|
95
|
-
collection:
|
|
96
|
-
multiple: !!
|
|
97
|
-
disabled: !!
|
|
95
|
+
collection: l("collection"),
|
|
96
|
+
multiple: !!l("multiple"),
|
|
97
|
+
disabled: !!m,
|
|
98
98
|
syncSelectedItems() {
|
|
99
|
-
|
|
99
|
+
o({ type: "SELECTED_ITEMS.SYNC" });
|
|
100
|
+
},
|
|
101
|
+
reposition(a = {}) {
|
|
102
|
+
o({ type: "POSITIONING.SET", options: a });
|
|
100
103
|
},
|
|
101
|
-
|
|
102
|
-
|
|
104
|
+
setHighlightValue(a) {
|
|
105
|
+
o({ type: "HIGHLIGHTED_VALUE.SET", value: a });
|
|
103
106
|
},
|
|
104
|
-
|
|
105
|
-
|
|
107
|
+
clearHighlightValue() {
|
|
108
|
+
o({ type: "HIGHLIGHTED_VALUE.CLEAR" });
|
|
106
109
|
},
|
|
107
|
-
selectValue(
|
|
108
|
-
|
|
110
|
+
selectValue(a) {
|
|
111
|
+
o({ type: "ITEM.SELECT", value: a });
|
|
109
112
|
},
|
|
110
|
-
setValue(
|
|
111
|
-
|
|
113
|
+
setValue(a) {
|
|
114
|
+
o({ type: "VALUE.SET", value: a });
|
|
112
115
|
},
|
|
113
|
-
setInputValue(
|
|
114
|
-
|
|
116
|
+
setInputValue(a, r = "script") {
|
|
117
|
+
o({ type: "INPUT_VALUE.SET", value: a, src: r });
|
|
115
118
|
},
|
|
116
|
-
clearValue(
|
|
117
|
-
|
|
119
|
+
clearValue(a) {
|
|
120
|
+
a != null ? o({ type: "ITEM.CLEAR", value: a }) : o({ type: "VALUE.CLEAR" });
|
|
118
121
|
},
|
|
119
122
|
focus() {
|
|
120
|
-
var
|
|
121
|
-
(
|
|
123
|
+
var a;
|
|
124
|
+
(a = L(s)) == null || a.focus();
|
|
122
125
|
},
|
|
123
|
-
setOpen(
|
|
124
|
-
|
|
126
|
+
setOpen(a, r = "script") {
|
|
127
|
+
n.hasTag("open") !== a && o({ type: a ? "OPEN" : "CLOSE", src: r });
|
|
125
128
|
},
|
|
126
129
|
getRootProps() {
|
|
127
130
|
return t.element({
|
|
128
|
-
...
|
|
129
|
-
dir:
|
|
130
|
-
id: Fe(
|
|
131
|
-
"data-invalid":
|
|
132
|
-
"data-readonly":
|
|
131
|
+
...C.root.attrs,
|
|
132
|
+
dir: l("dir"),
|
|
133
|
+
id: Fe(s),
|
|
134
|
+
"data-invalid": c(O),
|
|
135
|
+
"data-readonly": c(N)
|
|
133
136
|
});
|
|
134
137
|
},
|
|
135
138
|
getLabelProps() {
|
|
136
139
|
return t.label({
|
|
137
|
-
...
|
|
138
|
-
dir:
|
|
139
|
-
htmlFor: M(
|
|
140
|
-
id: B(
|
|
141
|
-
"data-readonly":
|
|
142
|
-
"data-disabled":
|
|
143
|
-
"data-invalid":
|
|
144
|
-
"data-focus":
|
|
145
|
-
onClick(
|
|
146
|
-
var
|
|
147
|
-
|
|
140
|
+
...C.label.attrs,
|
|
141
|
+
dir: l("dir"),
|
|
142
|
+
htmlFor: M(s),
|
|
143
|
+
id: B(s),
|
|
144
|
+
"data-readonly": c(N),
|
|
145
|
+
"data-disabled": c(m),
|
|
146
|
+
"data-invalid": c(O),
|
|
147
|
+
"data-focus": c(R),
|
|
148
|
+
onClick(a) {
|
|
149
|
+
var r;
|
|
150
|
+
S || (a.preventDefault(), (r = H(s)) == null || r.focus({ preventScroll: !0 }));
|
|
148
151
|
}
|
|
149
152
|
});
|
|
150
153
|
},
|
|
151
154
|
getControlProps() {
|
|
152
155
|
return t.element({
|
|
153
|
-
...
|
|
154
|
-
dir:
|
|
155
|
-
id:
|
|
156
|
-
"data-state":
|
|
157
|
-
"data-focus":
|
|
158
|
-
"data-disabled":
|
|
159
|
-
"data-invalid":
|
|
156
|
+
...C.control.attrs,
|
|
157
|
+
dir: l("dir"),
|
|
158
|
+
id: ne(s),
|
|
159
|
+
"data-state": h ? "open" : "closed",
|
|
160
|
+
"data-focus": c(R),
|
|
161
|
+
"data-disabled": c(m),
|
|
162
|
+
"data-invalid": c(O)
|
|
160
163
|
});
|
|
161
164
|
},
|
|
162
165
|
getPositionerProps() {
|
|
163
166
|
return t.element({
|
|
164
|
-
...
|
|
165
|
-
dir:
|
|
166
|
-
id:
|
|
167
|
-
style:
|
|
167
|
+
...C.positioner.attrs,
|
|
168
|
+
dir: l("dir"),
|
|
169
|
+
id: oe(s),
|
|
170
|
+
style: re.floating
|
|
168
171
|
});
|
|
169
172
|
},
|
|
170
173
|
getInputProps() {
|
|
171
174
|
return t.input({
|
|
172
|
-
...
|
|
173
|
-
dir:
|
|
174
|
-
"aria-invalid": K(
|
|
175
|
-
"data-invalid":
|
|
176
|
-
"data-autofocus":
|
|
177
|
-
name:
|
|
178
|
-
form:
|
|
179
|
-
disabled:
|
|
180
|
-
required:
|
|
175
|
+
...C.input.attrs,
|
|
176
|
+
dir: l("dir"),
|
|
177
|
+
"aria-invalid": K(O),
|
|
178
|
+
"data-invalid": c(O),
|
|
179
|
+
"data-autofocus": c(l("autoFocus")),
|
|
180
|
+
name: l("name"),
|
|
181
|
+
form: l("form"),
|
|
182
|
+
disabled: m,
|
|
183
|
+
required: l("required"),
|
|
181
184
|
autoComplete: "off",
|
|
182
185
|
autoCorrect: "off",
|
|
183
186
|
autoCapitalize: "none",
|
|
184
187
|
spellCheck: "false",
|
|
185
|
-
readOnly:
|
|
186
|
-
placeholder:
|
|
187
|
-
id: M(
|
|
188
|
+
readOnly: N,
|
|
189
|
+
placeholder: l("placeholder"),
|
|
190
|
+
id: M(s),
|
|
188
191
|
type: "text",
|
|
189
192
|
role: "combobox",
|
|
190
193
|
defaultValue: i.get("inputValue"),
|
|
191
|
-
"aria-autocomplete":
|
|
192
|
-
"aria-controls": w(
|
|
193
|
-
"aria-expanded":
|
|
194
|
-
"data-state":
|
|
195
|
-
"aria-activedescendant": b ?
|
|
196
|
-
onClick(
|
|
197
|
-
|
|
194
|
+
"aria-autocomplete": u("autoComplete") ? "both" : "list",
|
|
195
|
+
"aria-controls": w(s),
|
|
196
|
+
"aria-expanded": h,
|
|
197
|
+
"data-state": h ? "open" : "closed",
|
|
198
|
+
"aria-activedescendant": b ? Q(s, b) : void 0,
|
|
199
|
+
onClick(a) {
|
|
200
|
+
a.defaultPrevented || l("openOnClick") && T && o({ type: "INPUT.CLICK", src: "input-click" });
|
|
198
201
|
},
|
|
199
202
|
onFocus() {
|
|
200
|
-
|
|
203
|
+
m || o({ type: "INPUT.FOCUS" });
|
|
201
204
|
},
|
|
202
205
|
onBlur() {
|
|
203
|
-
|
|
206
|
+
m || o({ type: "INPUT.BLUR" });
|
|
204
207
|
},
|
|
205
|
-
onChange(
|
|
206
|
-
|
|
208
|
+
onChange(a) {
|
|
209
|
+
o({ type: "INPUT.CHANGE", value: a.currentTarget.value, src: "input-change" });
|
|
207
210
|
},
|
|
208
|
-
onKeyDown(
|
|
209
|
-
if (
|
|
210
|
-
const
|
|
211
|
-
ArrowDown(
|
|
212
|
-
!
|
|
211
|
+
onKeyDown(a) {
|
|
212
|
+
if (a.defaultPrevented || !T || a.ctrlKey || a.shiftKey || fe(a)) return;
|
|
213
|
+
const r = l("openOnKeyPress"), g = a.ctrlKey || a.metaKey || a.shiftKey, p = !0, A = {
|
|
214
|
+
ArrowDown(y) {
|
|
215
|
+
!r && !h || (o({ type: y.altKey ? "OPEN" : "INPUT.ARROW_DOWN", keypress: p, src: "arrow-key" }), y.preventDefault());
|
|
213
216
|
},
|
|
214
217
|
ArrowUp() {
|
|
215
|
-
!
|
|
218
|
+
!r && !h || (o({ type: a.altKey ? "CLOSE" : "INPUT.ARROW_UP", keypress: p, src: "arrow-key" }), a.preventDefault());
|
|
216
219
|
},
|
|
217
|
-
Home(
|
|
218
|
-
g || (
|
|
220
|
+
Home(y) {
|
|
221
|
+
g || (o({ type: "INPUT.HOME", keypress: p }), h && y.preventDefault());
|
|
219
222
|
},
|
|
220
|
-
End(
|
|
221
|
-
g || (
|
|
223
|
+
End(y) {
|
|
224
|
+
g || (o({ type: "INPUT.END", keypress: p }), h && y.preventDefault());
|
|
222
225
|
},
|
|
223
|
-
Enter(
|
|
226
|
+
Enter(y) {
|
|
224
227
|
var W;
|
|
225
|
-
|
|
226
|
-
const
|
|
227
|
-
if (
|
|
228
|
-
const _ =
|
|
229
|
-
|
|
228
|
+
o({ type: "INPUT.ENTER", keypress: p, src: "item-select" });
|
|
229
|
+
const ce = u("isCustomValue") && l("allowCustomValue");
|
|
230
|
+
if (h && !ce && y.preventDefault(), b == null) return;
|
|
231
|
+
const _ = F(s, b);
|
|
232
|
+
Ve(_) && ((W = l("navigate")) == null || W({ value: b, node: _, href: _.href }));
|
|
230
233
|
},
|
|
231
234
|
Escape() {
|
|
232
|
-
|
|
235
|
+
o({ type: "INPUT.ESCAPE", keypress: p, src: "escape-key" }), a.preventDefault();
|
|
233
236
|
}
|
|
234
|
-
},
|
|
235
|
-
x == null || x(
|
|
237
|
+
}, ue = $(a, { dir: l("dir") }), x = A[ue];
|
|
238
|
+
x == null || x(a);
|
|
236
239
|
}
|
|
237
240
|
});
|
|
238
241
|
},
|
|
239
|
-
getTriggerProps(
|
|
242
|
+
getTriggerProps(a = {}) {
|
|
240
243
|
return t.button({
|
|
241
|
-
...
|
|
242
|
-
dir:
|
|
243
|
-
id:
|
|
244
|
-
"aria-haspopup":
|
|
244
|
+
...C.trigger.attrs,
|
|
245
|
+
dir: l("dir"),
|
|
246
|
+
id: ae(s),
|
|
247
|
+
"aria-haspopup": S ? "listbox" : "dialog",
|
|
245
248
|
type: "button",
|
|
246
|
-
tabIndex:
|
|
247
|
-
"aria-label":
|
|
248
|
-
"aria-expanded":
|
|
249
|
-
"data-state":
|
|
250
|
-
"aria-controls":
|
|
251
|
-
disabled:
|
|
252
|
-
"data-invalid":
|
|
253
|
-
"data-focusable":
|
|
254
|
-
"data-readonly":
|
|
255
|
-
"data-disabled":
|
|
249
|
+
tabIndex: a.focusable ? void 0 : -1,
|
|
250
|
+
"aria-label": I.triggerLabel,
|
|
251
|
+
"aria-expanded": h,
|
|
252
|
+
"data-state": h ? "open" : "closed",
|
|
253
|
+
"aria-controls": h ? w(s) : void 0,
|
|
254
|
+
disabled: m,
|
|
255
|
+
"data-invalid": c(O),
|
|
256
|
+
"data-focusable": c(a.focusable),
|
|
257
|
+
"data-readonly": c(N),
|
|
258
|
+
"data-disabled": c(m),
|
|
256
259
|
onFocus() {
|
|
257
|
-
|
|
260
|
+
a.focusable && o({ type: "INPUT.FOCUS", src: "trigger" });
|
|
258
261
|
},
|
|
259
|
-
onClick(
|
|
260
|
-
|
|
262
|
+
onClick(r) {
|
|
263
|
+
r.defaultPrevented || T && D(r) && o({ type: "TRIGGER.CLICK", src: "trigger-click" });
|
|
261
264
|
},
|
|
262
|
-
onPointerDown(
|
|
263
|
-
|
|
265
|
+
onPointerDown(r) {
|
|
266
|
+
T && r.pointerType !== "touch" && D(r) && (r.preventDefault(), queueMicrotask(() => {
|
|
264
267
|
var g;
|
|
265
|
-
(g =
|
|
268
|
+
(g = L(s)) == null || g.focus({ preventScroll: !0 });
|
|
266
269
|
}));
|
|
267
270
|
},
|
|
268
|
-
onKeyDown(
|
|
269
|
-
if (
|
|
271
|
+
onKeyDown(r) {
|
|
272
|
+
if (r.defaultPrevented || S) return;
|
|
270
273
|
const g = {
|
|
271
274
|
ArrowDown() {
|
|
272
|
-
|
|
275
|
+
o({ type: "INPUT.ARROW_DOWN", src: "arrow-key" });
|
|
273
276
|
},
|
|
274
277
|
ArrowUp() {
|
|
275
|
-
|
|
278
|
+
o({ type: "INPUT.ARROW_UP", src: "arrow-key" });
|
|
276
279
|
}
|
|
277
|
-
},
|
|
278
|
-
A && (A(
|
|
280
|
+
}, p = $(r, { dir: l("dir") }), A = g[p];
|
|
281
|
+
A && (A(r), r.preventDefault());
|
|
279
282
|
}
|
|
280
283
|
});
|
|
281
284
|
},
|
|
282
285
|
getContentProps() {
|
|
283
286
|
return t.element({
|
|
284
|
-
...
|
|
285
|
-
dir:
|
|
286
|
-
id: w(
|
|
287
|
-
role:
|
|
287
|
+
...C.content.attrs,
|
|
288
|
+
dir: l("dir"),
|
|
289
|
+
id: w(s),
|
|
290
|
+
role: S ? "listbox" : "dialog",
|
|
288
291
|
tabIndex: -1,
|
|
289
|
-
hidden: !
|
|
290
|
-
"data-state":
|
|
292
|
+
hidden: !h,
|
|
293
|
+
"data-state": h ? "open" : "closed",
|
|
291
294
|
"data-placement": i.get("currentPlacement"),
|
|
292
|
-
"aria-labelledby": B(
|
|
293
|
-
"aria-multiselectable":
|
|
294
|
-
"data-empty":
|
|
295
|
-
onPointerDown(
|
|
296
|
-
|
|
295
|
+
"aria-labelledby": B(s),
|
|
296
|
+
"aria-multiselectable": l("multiple") && S ? !0 : void 0,
|
|
297
|
+
"data-empty": c(f.size === 0),
|
|
298
|
+
onPointerDown(a) {
|
|
299
|
+
D(a) && a.preventDefault();
|
|
297
300
|
}
|
|
298
301
|
});
|
|
299
302
|
},
|
|
300
303
|
getListProps() {
|
|
301
304
|
return t.element({
|
|
302
|
-
...
|
|
303
|
-
role:
|
|
304
|
-
"data-empty":
|
|
305
|
-
"aria-labelledby": B(
|
|
306
|
-
"aria-multiselectable":
|
|
305
|
+
...C.list.attrs,
|
|
306
|
+
role: S ? void 0 : "listbox",
|
|
307
|
+
"data-empty": c(f.size === 0),
|
|
308
|
+
"aria-labelledby": B(s),
|
|
309
|
+
"aria-multiselectable": l("multiple") && !S ? !0 : void 0
|
|
307
310
|
});
|
|
308
311
|
},
|
|
309
312
|
getClearTriggerProps() {
|
|
310
313
|
return t.button({
|
|
311
|
-
...
|
|
312
|
-
dir:
|
|
313
|
-
id:
|
|
314
|
+
...C.clearTrigger.attrs,
|
|
315
|
+
dir: l("dir"),
|
|
316
|
+
id: se(s),
|
|
314
317
|
type: "button",
|
|
315
318
|
tabIndex: -1,
|
|
316
|
-
disabled:
|
|
317
|
-
"data-invalid":
|
|
318
|
-
"aria-label":
|
|
319
|
-
"aria-controls": M(
|
|
319
|
+
disabled: m,
|
|
320
|
+
"data-invalid": c(O),
|
|
321
|
+
"aria-label": I.clearTriggerLabel,
|
|
322
|
+
"aria-controls": M(s),
|
|
320
323
|
hidden: !i.get("value").length,
|
|
321
|
-
onPointerDown(
|
|
322
|
-
|
|
324
|
+
onPointerDown(a) {
|
|
325
|
+
D(a) && a.preventDefault();
|
|
323
326
|
},
|
|
324
|
-
onClick(
|
|
325
|
-
|
|
327
|
+
onClick(a) {
|
|
328
|
+
a.defaultPrevented || T && o({ type: "VALUE.CLEAR", src: "clear-trigger" });
|
|
326
329
|
}
|
|
327
330
|
});
|
|
328
331
|
},
|
|
329
|
-
getItemState:
|
|
330
|
-
getItemProps(
|
|
331
|
-
const
|
|
332
|
+
getItemState: U,
|
|
333
|
+
getItemProps(a) {
|
|
334
|
+
const r = U(a), g = r.value;
|
|
332
335
|
return t.element({
|
|
333
|
-
...
|
|
334
|
-
dir:
|
|
335
|
-
id:
|
|
336
|
+
...C.item.attrs,
|
|
337
|
+
dir: l("dir"),
|
|
338
|
+
id: Q(s, g),
|
|
336
339
|
role: "option",
|
|
337
340
|
tabIndex: -1,
|
|
338
|
-
"data-highlighted":
|
|
339
|
-
"data-state":
|
|
340
|
-
"aria-selected": K(
|
|
341
|
-
"aria-disabled": K(
|
|
342
|
-
"data-disabled":
|
|
343
|
-
"data-value":
|
|
341
|
+
"data-highlighted": c(r.highlighted),
|
|
342
|
+
"data-state": r.selected ? "checked" : "unchecked",
|
|
343
|
+
"aria-selected": K(r.highlighted),
|
|
344
|
+
"aria-disabled": K(r.disabled),
|
|
345
|
+
"data-disabled": c(r.disabled),
|
|
346
|
+
"data-value": r.value,
|
|
344
347
|
onPointerMove() {
|
|
345
|
-
|
|
348
|
+
r.disabled || r.highlighted || o({ type: "ITEM.POINTER_MOVE", value: g });
|
|
346
349
|
},
|
|
347
350
|
onPointerLeave() {
|
|
348
|
-
if (
|
|
349
|
-
const
|
|
350
|
-
|
|
351
|
+
if (a.persistFocus || r.disabled) return;
|
|
352
|
+
const p = E.previous();
|
|
353
|
+
p != null && p.type.includes("POINTER") && o({ type: "ITEM.POINTER_LEAVE", value: g });
|
|
351
354
|
},
|
|
352
|
-
onClick(
|
|
353
|
-
|
|
355
|
+
onClick(p) {
|
|
356
|
+
Ie(p) || Ce(p) || ve(p) || r.disabled || o({ type: "ITEM.CLICK", src: "item-select", value: g });
|
|
354
357
|
}
|
|
355
358
|
});
|
|
356
359
|
},
|
|
357
|
-
getItemTextProps(
|
|
358
|
-
const
|
|
360
|
+
getItemTextProps(a) {
|
|
361
|
+
const r = U(a);
|
|
359
362
|
return t.element({
|
|
360
|
-
...
|
|
361
|
-
dir:
|
|
362
|
-
"data-state":
|
|
363
|
-
"data-disabled":
|
|
364
|
-
"data-highlighted":
|
|
363
|
+
...C.itemText.attrs,
|
|
364
|
+
dir: l("dir"),
|
|
365
|
+
"data-state": r.selected ? "checked" : "unchecked",
|
|
366
|
+
"data-disabled": c(r.disabled),
|
|
367
|
+
"data-highlighted": c(r.highlighted)
|
|
365
368
|
});
|
|
366
369
|
},
|
|
367
|
-
getItemIndicatorProps(
|
|
368
|
-
const
|
|
370
|
+
getItemIndicatorProps(a) {
|
|
371
|
+
const r = U(a);
|
|
369
372
|
return t.element({
|
|
370
373
|
"aria-hidden": !0,
|
|
371
|
-
...
|
|
372
|
-
dir:
|
|
373
|
-
"data-state":
|
|
374
|
-
hidden: !
|
|
374
|
+
...C.itemIndicator.attrs,
|
|
375
|
+
dir: l("dir"),
|
|
376
|
+
"data-state": r.selected ? "checked" : "unchecked",
|
|
377
|
+
hidden: !r.selected
|
|
375
378
|
});
|
|
376
379
|
},
|
|
377
|
-
getItemGroupProps(
|
|
378
|
-
const { id:
|
|
380
|
+
getItemGroupProps(a) {
|
|
381
|
+
const { id: r } = a;
|
|
379
382
|
return t.element({
|
|
380
|
-
...
|
|
381
|
-
dir:
|
|
382
|
-
id:
|
|
383
|
-
"aria-labelledby":
|
|
384
|
-
"data-empty":
|
|
383
|
+
...C.itemGroup.attrs,
|
|
384
|
+
dir: l("dir"),
|
|
385
|
+
id: He(s, r),
|
|
386
|
+
"aria-labelledby": J(s, r),
|
|
387
|
+
"data-empty": c(f.size === 0),
|
|
385
388
|
role: "group"
|
|
386
389
|
});
|
|
387
390
|
},
|
|
388
|
-
getItemGroupLabelProps(
|
|
389
|
-
const { htmlFor:
|
|
391
|
+
getItemGroupLabelProps(a) {
|
|
392
|
+
const { htmlFor: r } = a;
|
|
390
393
|
return t.element({
|
|
391
|
-
...
|
|
392
|
-
dir:
|
|
393
|
-
id:
|
|
394
|
+
...C.itemGroupLabel.attrs,
|
|
395
|
+
dir: l("dir"),
|
|
396
|
+
id: J(s, r),
|
|
394
397
|
role: "presentation"
|
|
395
398
|
});
|
|
396
399
|
}
|
|
397
400
|
};
|
|
398
401
|
}
|
|
399
|
-
var { guards:
|
|
402
|
+
var { guards: Ae, createMachine: Ue, choose: De } = Se(), { and: d, not: v } = Ae, Ye = Ue({
|
|
400
403
|
props({ props: e }) {
|
|
401
404
|
return {
|
|
402
405
|
loopFocus: !0,
|
|
@@ -410,9 +413,9 @@ var { guards: He, createMachine: Ue, choose: De } = be(), { and: c, not: m } = H
|
|
|
410
413
|
openOnChange: !0,
|
|
411
414
|
composite: !0,
|
|
412
415
|
navigate({ node: t }) {
|
|
413
|
-
|
|
416
|
+
me(t);
|
|
414
417
|
},
|
|
415
|
-
collection:
|
|
418
|
+
collection: le.empty(),
|
|
416
419
|
...e,
|
|
417
420
|
positioning: {
|
|
418
421
|
placement: "bottom",
|
|
@@ -429,7 +432,7 @@ var { guards: He, createMachine: Ue, choose: De } = be(), { and: c, not: m } = H
|
|
|
429
432
|
initialState({ prop: e }) {
|
|
430
433
|
return e("open") || e("defaultOpen") ? "suggesting" : "idle";
|
|
431
434
|
},
|
|
432
|
-
context({ prop: e, bindable: t, getContext: i }) {
|
|
435
|
+
context({ prop: e, bindable: t, getContext: i, getEvent: l }) {
|
|
433
436
|
return {
|
|
434
437
|
currentPlacement: t(() => ({
|
|
435
438
|
defaultValue: void 0
|
|
@@ -442,37 +445,38 @@ var { guards: He, createMachine: Ue, choose: De } = be(), { and: c, not: m } = H
|
|
|
442
445
|
return n.join(",");
|
|
443
446
|
},
|
|
444
447
|
onChange(n) {
|
|
445
|
-
var
|
|
446
|
-
const o = i(),
|
|
447
|
-
o.set("selectedItems",
|
|
448
|
+
var I;
|
|
449
|
+
const o = i(), s = o.get("selectedItems"), u = e("collection"), E = n.map((f) => s.find((T) => u.getItemValue(T) === f) || u.find(f));
|
|
450
|
+
o.set("selectedItems", E), (I = e("onValueChange")) == null || I({ value: n, items: E });
|
|
448
451
|
}
|
|
449
452
|
})),
|
|
450
453
|
highlightedValue: t(() => ({
|
|
451
454
|
defaultValue: e("defaultHighlightedValue") || null,
|
|
452
455
|
value: e("highlightedValue"),
|
|
453
456
|
onChange(n) {
|
|
454
|
-
var
|
|
457
|
+
var s;
|
|
455
458
|
const o = e("collection").find(n);
|
|
456
|
-
(
|
|
459
|
+
(s = e("onHighlightChange")) == null || s({ highlightedValue: n, highlightedItem: o });
|
|
457
460
|
}
|
|
458
461
|
})),
|
|
459
462
|
inputValue: t(() => {
|
|
460
463
|
let n = e("inputValue") || e("defaultInputValue") || "";
|
|
461
464
|
const o = e("defaultValue") || e("value") || [];
|
|
462
465
|
if (!n.trim() && !e("multiple")) {
|
|
463
|
-
const
|
|
464
|
-
n =
|
|
465
|
-
preserve: n ||
|
|
466
|
-
replace:
|
|
466
|
+
const s = e("collection").stringifyMany(o);
|
|
467
|
+
n = P(e("selectionBehavior"), {
|
|
468
|
+
preserve: n || s,
|
|
469
|
+
replace: s,
|
|
467
470
|
clear: ""
|
|
468
471
|
});
|
|
469
472
|
}
|
|
470
473
|
return {
|
|
471
474
|
defaultValue: n,
|
|
472
475
|
value: e("inputValue"),
|
|
473
|
-
onChange(
|
|
474
|
-
var
|
|
475
|
-
|
|
476
|
+
onChange(s) {
|
|
477
|
+
var I;
|
|
478
|
+
const u = l(), E = (u.previousEvent || u).src;
|
|
479
|
+
(I = e("onInputValueChange")) == null || I({ inputValue: s, reason: E });
|
|
476
480
|
}
|
|
477
481
|
};
|
|
478
482
|
}),
|
|
@@ -483,10 +487,6 @@ var { guards: He, createMachine: Ue, choose: De } = be(), { and: c, not: m } = H
|
|
|
483
487
|
selectedItems: t(() => {
|
|
484
488
|
const n = e("value") || e("defaultValue") || [];
|
|
485
489
|
return { defaultValue: e("collection").findMany(n) };
|
|
486
|
-
}),
|
|
487
|
-
valueAsString: t(() => {
|
|
488
|
-
const n = e("value") || e("defaultValue") || [];
|
|
489
|
-
return { sync: !0, defaultValue: e("collection").stringifyMany(n) };
|
|
490
490
|
})
|
|
491
491
|
};
|
|
492
492
|
},
|
|
@@ -496,17 +496,20 @@ var { guards: He, createMachine: Ue, choose: De } = be(), { and: c, not: m } = H
|
|
|
496
496
|
autoComplete: ({ prop: e }) => e("inputBehavior") === "autocomplete",
|
|
497
497
|
autoHighlight: ({ prop: e }) => e("inputBehavior") === "autohighlight",
|
|
498
498
|
hasSelectedItems: ({ context: e }) => e.get("value").length > 0,
|
|
499
|
-
|
|
499
|
+
valueAsString: ({ context: e, prop: t }) => t("collection").stringifyItems(e.get("selectedItems")),
|
|
500
|
+
isCustomValue: ({ context: e, computed: t }) => e.get("inputValue") !== t("valueAsString")
|
|
500
501
|
},
|
|
501
|
-
watch({ context: e, prop: t, track: i, action: n }) {
|
|
502
|
+
watch({ context: e, prop: t, track: i, action: l, send: n }) {
|
|
502
503
|
i([() => e.hash("value")], () => {
|
|
503
|
-
|
|
504
|
+
l(["syncSelectedItems"]);
|
|
504
505
|
}), i([() => e.get("inputValue")], () => {
|
|
505
|
-
|
|
506
|
+
l(["syncInputValue"]);
|
|
506
507
|
}), i([() => e.get("highlightedValue")], () => {
|
|
507
|
-
|
|
508
|
+
l(["syncHighlightedItem", "autofillInputValue"]);
|
|
508
509
|
}), i([() => t("open")], () => {
|
|
509
|
-
|
|
510
|
+
l(["toggleVisibility"]);
|
|
511
|
+
}), i([() => t("collection").toString()], () => {
|
|
512
|
+
n({ type: "CHILDREN_CHANGE" });
|
|
510
513
|
});
|
|
511
514
|
},
|
|
512
515
|
on: {
|
|
@@ -514,7 +517,10 @@ var { guards: He, createMachine: Ue, choose: De } = be(), { and: c, not: m } = H
|
|
|
514
517
|
actions: ["syncSelectedItems"]
|
|
515
518
|
},
|
|
516
519
|
"HIGHLIGHTED_VALUE.SET": {
|
|
517
|
-
actions: ["
|
|
520
|
+
actions: ["setHighlightedValue"]
|
|
521
|
+
},
|
|
522
|
+
"HIGHLIGHTED_VALUE.CLEAR": {
|
|
523
|
+
actions: ["clearHighlightedValue"]
|
|
518
524
|
},
|
|
519
525
|
"ITEM.SELECT": {
|
|
520
526
|
actions: ["selectItem"]
|
|
@@ -541,7 +547,7 @@ var { guards: He, createMachine: Ue, choose: De } = be(), { and: c, not: m } = H
|
|
|
541
547
|
states: {
|
|
542
548
|
idle: {
|
|
543
549
|
tags: ["idle", "closed"],
|
|
544
|
-
entry: ["scrollContentToTop", "
|
|
550
|
+
entry: ["scrollContentToTop", "clearHighlightedValue"],
|
|
545
551
|
on: {
|
|
546
552
|
"CONTROLLED.OPEN": {
|
|
547
553
|
target: "interacting"
|
|
@@ -587,7 +593,7 @@ var { guards: He, createMachine: Ue, choose: De } = be(), { and: c, not: m } = H
|
|
|
587
593
|
},
|
|
588
594
|
focused: {
|
|
589
595
|
tags: ["focused", "closed"],
|
|
590
|
-
entry: ["scrollContentToTop", "
|
|
596
|
+
entry: ["scrollContentToTop", "clearHighlightedValue"],
|
|
591
597
|
on: {
|
|
592
598
|
"CONTROLLED.OPEN": [
|
|
593
599
|
{
|
|
@@ -600,7 +606,7 @@ var { guards: He, createMachine: Ue, choose: De } = be(), { and: c, not: m } = H
|
|
|
600
606
|
],
|
|
601
607
|
"INPUT.CHANGE": [
|
|
602
608
|
{
|
|
603
|
-
guard:
|
|
609
|
+
guard: d("isOpenControlled", "openOnChange"),
|
|
604
610
|
actions: ["setInputValue", "invokeOnOpen", "highlightFirstItemIfNeeded"]
|
|
605
611
|
},
|
|
606
612
|
{
|
|
@@ -616,7 +622,7 @@ var { guards: He, createMachine: Ue, choose: De } = be(), { and: c, not: m } = H
|
|
|
616
622
|
target: "idle"
|
|
617
623
|
},
|
|
618
624
|
"INPUT.ESCAPE": {
|
|
619
|
-
guard:
|
|
625
|
+
guard: d("isCustomValue", v("allowCustomValue")),
|
|
620
626
|
actions: ["revertInputValue"]
|
|
621
627
|
},
|
|
622
628
|
"INPUT.BLUR": {
|
|
@@ -645,7 +651,7 @@ var { guards: He, createMachine: Ue, choose: De } = be(), { and: c, not: m } = H
|
|
|
645
651
|
"INPUT.ARROW_DOWN": [
|
|
646
652
|
// == group 1 ==
|
|
647
653
|
{
|
|
648
|
-
guard:
|
|
654
|
+
guard: d("isOpenControlled", "autoComplete"),
|
|
649
655
|
actions: ["invokeOnOpen"]
|
|
650
656
|
},
|
|
651
657
|
{
|
|
@@ -715,6 +721,15 @@ var { guards: He, createMachine: Ue, choose: De } = be(), { and: c, not: m } = H
|
|
|
715
721
|
target: "idle"
|
|
716
722
|
}
|
|
717
723
|
],
|
|
724
|
+
CHILDREN_CHANGE: [
|
|
725
|
+
{
|
|
726
|
+
guard: "isHighlightedItemRemoved",
|
|
727
|
+
actions: ["clearHighlightedValue"]
|
|
728
|
+
},
|
|
729
|
+
{
|
|
730
|
+
actions: ["scrollToHighlightedItem"]
|
|
731
|
+
}
|
|
732
|
+
],
|
|
718
733
|
"INPUT.HOME": {
|
|
719
734
|
actions: ["highlightFirstItem"]
|
|
720
735
|
},
|
|
@@ -723,8 +738,8 @@ var { guards: He, createMachine: Ue, choose: De } = be(), { and: c, not: m } = H
|
|
|
723
738
|
},
|
|
724
739
|
"INPUT.ARROW_DOWN": [
|
|
725
740
|
{
|
|
726
|
-
guard:
|
|
727
|
-
actions: ["
|
|
741
|
+
guard: d("autoComplete", "isLastItemHighlighted"),
|
|
742
|
+
actions: ["clearHighlightedValue", "scrollContentToTop"]
|
|
728
743
|
},
|
|
729
744
|
{
|
|
730
745
|
actions: ["highlightNextItem"]
|
|
@@ -732,8 +747,8 @@ var { guards: He, createMachine: Ue, choose: De } = be(), { and: c, not: m } = H
|
|
|
732
747
|
],
|
|
733
748
|
"INPUT.ARROW_UP": [
|
|
734
749
|
{
|
|
735
|
-
guard:
|
|
736
|
-
actions: ["
|
|
750
|
+
guard: d("autoComplete", "isFirstItemHighlighted"),
|
|
751
|
+
actions: ["clearHighlightedValue"]
|
|
737
752
|
},
|
|
738
753
|
{
|
|
739
754
|
actions: ["highlightPrevItem"]
|
|
@@ -742,17 +757,17 @@ var { guards: He, createMachine: Ue, choose: De } = be(), { and: c, not: m } = H
|
|
|
742
757
|
"INPUT.ENTER": [
|
|
743
758
|
// == group 1 ==
|
|
744
759
|
{
|
|
745
|
-
guard:
|
|
760
|
+
guard: d("isOpenControlled", "isCustomValue", v("hasHighlightedItem"), v("allowCustomValue")),
|
|
746
761
|
actions: ["revertInputValue", "invokeOnClose"]
|
|
747
762
|
},
|
|
748
763
|
{
|
|
749
|
-
guard:
|
|
764
|
+
guard: d("isCustomValue", v("hasHighlightedItem"), v("allowCustomValue")),
|
|
750
765
|
target: "focused",
|
|
751
766
|
actions: ["revertInputValue", "invokeOnClose"]
|
|
752
767
|
},
|
|
753
768
|
// == group 2 ==
|
|
754
769
|
{
|
|
755
|
-
guard:
|
|
770
|
+
guard: d("isOpenControlled", "closeOnSelect"),
|
|
756
771
|
actions: ["selectHighlightedItem", "invokeOnClose"]
|
|
757
772
|
},
|
|
758
773
|
{
|
|
@@ -772,18 +787,18 @@ var { guards: He, createMachine: Ue, choose: De } = be(), { and: c, not: m } = H
|
|
|
772
787
|
},
|
|
773
788
|
{
|
|
774
789
|
target: "suggesting",
|
|
775
|
-
actions: ["
|
|
790
|
+
actions: ["clearHighlightedValue", "setInputValue"]
|
|
776
791
|
}
|
|
777
792
|
],
|
|
778
793
|
"ITEM.POINTER_MOVE": {
|
|
779
|
-
actions: ["
|
|
794
|
+
actions: ["setHighlightedValue"]
|
|
780
795
|
},
|
|
781
796
|
"ITEM.POINTER_LEAVE": {
|
|
782
|
-
actions: ["
|
|
797
|
+
actions: ["clearHighlightedValue"]
|
|
783
798
|
},
|
|
784
799
|
"ITEM.CLICK": [
|
|
785
800
|
{
|
|
786
|
-
guard:
|
|
801
|
+
guard: d("isOpenControlled", "closeOnSelect"),
|
|
787
802
|
actions: ["selectItem", "invokeOnClose"]
|
|
788
803
|
},
|
|
789
804
|
{
|
|
@@ -797,7 +812,7 @@ var { guards: He, createMachine: Ue, choose: De } = be(), { and: c, not: m } = H
|
|
|
797
812
|
],
|
|
798
813
|
"LAYER.ESCAPE": [
|
|
799
814
|
{
|
|
800
|
-
guard:
|
|
815
|
+
guard: d("isOpenControlled", "autoComplete"),
|
|
801
816
|
actions: ["syncInputValue", "invokeOnClose"]
|
|
802
817
|
},
|
|
803
818
|
{
|
|
@@ -827,11 +842,11 @@ var { guards: He, createMachine: Ue, choose: De } = be(), { and: c, not: m } = H
|
|
|
827
842
|
"LAYER.INTERACT_OUTSIDE": [
|
|
828
843
|
// == group 1 ==
|
|
829
844
|
{
|
|
830
|
-
guard:
|
|
845
|
+
guard: d("isOpenControlled", "isCustomValue", v("allowCustomValue")),
|
|
831
846
|
actions: ["revertInputValue", "invokeOnClose"]
|
|
832
847
|
},
|
|
833
848
|
{
|
|
834
|
-
guard:
|
|
849
|
+
guard: d("isCustomValue", v("allowCustomValue")),
|
|
835
850
|
target: "idle",
|
|
836
851
|
actions: ["revertInputValue", "invokeOnClose"]
|
|
837
852
|
},
|
|
@@ -869,13 +884,7 @@ var { guards: He, createMachine: Ue, choose: De } = be(), { and: c, not: m } = H
|
|
|
869
884
|
},
|
|
870
885
|
suggesting: {
|
|
871
886
|
tags: ["open", "focused"],
|
|
872
|
-
effects: [
|
|
873
|
-
"trackDismissableLayer",
|
|
874
|
-
"scrollToHighlightedItem",
|
|
875
|
-
"trackPlacement",
|
|
876
|
-
"trackChildNodes",
|
|
877
|
-
"hideOtherElements"
|
|
878
|
-
],
|
|
887
|
+
effects: ["trackDismissableLayer", "scrollToHighlightedItem", "trackPlacement", "hideOtherElements"],
|
|
879
888
|
entry: ["setInitialFocus"],
|
|
880
889
|
on: {
|
|
881
890
|
"CONTROLLED.CLOSE": [
|
|
@@ -888,10 +897,16 @@ var { guards: He, createMachine: Ue, choose: De } = be(), { and: c, not: m } = H
|
|
|
888
897
|
target: "idle"
|
|
889
898
|
}
|
|
890
899
|
],
|
|
891
|
-
CHILDREN_CHANGE:
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
900
|
+
CHILDREN_CHANGE: [
|
|
901
|
+
{
|
|
902
|
+
guard: "autoHighlight",
|
|
903
|
+
actions: ["highlightFirstItem"]
|
|
904
|
+
},
|
|
905
|
+
{
|
|
906
|
+
guard: "isHighlightedItemRemoved",
|
|
907
|
+
actions: ["clearHighlightedValue"]
|
|
908
|
+
}
|
|
909
|
+
],
|
|
895
910
|
"INPUT.ARROW_DOWN": {
|
|
896
911
|
target: "interacting",
|
|
897
912
|
actions: ["highlightNextItem"]
|
|
@@ -911,17 +926,17 @@ var { guards: He, createMachine: Ue, choose: De } = be(), { and: c, not: m } = H
|
|
|
911
926
|
"INPUT.ENTER": [
|
|
912
927
|
// == group 1 ==
|
|
913
928
|
{
|
|
914
|
-
guard:
|
|
929
|
+
guard: d("isOpenControlled", "isCustomValue", v("hasHighlightedItem"), v("allowCustomValue")),
|
|
915
930
|
actions: ["revertInputValue", "invokeOnClose"]
|
|
916
931
|
},
|
|
917
932
|
{
|
|
918
|
-
guard:
|
|
933
|
+
guard: d("isCustomValue", v("hasHighlightedItem"), v("allowCustomValue")),
|
|
919
934
|
target: "focused",
|
|
920
935
|
actions: ["revertInputValue", "invokeOnClose"]
|
|
921
936
|
},
|
|
922
937
|
// == group 2 ==
|
|
923
938
|
{
|
|
924
|
-
guard:
|
|
939
|
+
guard: d("isOpenControlled", "closeOnSelect"),
|
|
925
940
|
actions: ["selectHighlightedItem", "invokeOnClose"]
|
|
926
941
|
},
|
|
927
942
|
{
|
|
@@ -948,19 +963,19 @@ var { guards: He, createMachine: Ue, choose: De } = be(), { and: c, not: m } = H
|
|
|
948
963
|
],
|
|
949
964
|
"ITEM.POINTER_MOVE": {
|
|
950
965
|
target: "interacting",
|
|
951
|
-
actions: ["
|
|
966
|
+
actions: ["setHighlightedValue"]
|
|
952
967
|
},
|
|
953
968
|
"ITEM.POINTER_LEAVE": {
|
|
954
|
-
actions: ["
|
|
969
|
+
actions: ["clearHighlightedValue"]
|
|
955
970
|
},
|
|
956
971
|
"LAYER.INTERACT_OUTSIDE": [
|
|
957
972
|
// == group 1 ==
|
|
958
973
|
{
|
|
959
|
-
guard:
|
|
974
|
+
guard: d("isOpenControlled", "isCustomValue", v("allowCustomValue")),
|
|
960
975
|
actions: ["revertInputValue", "invokeOnClose"]
|
|
961
976
|
},
|
|
962
977
|
{
|
|
963
|
-
guard:
|
|
978
|
+
guard: d("isCustomValue", v("allowCustomValue")),
|
|
964
979
|
target: "idle",
|
|
965
980
|
actions: ["revertInputValue", "invokeOnClose"]
|
|
966
981
|
},
|
|
@@ -986,7 +1001,7 @@ var { guards: He, createMachine: Ue, choose: De } = be(), { and: c, not: m } = H
|
|
|
986
1001
|
],
|
|
987
1002
|
"ITEM.CLICK": [
|
|
988
1003
|
{
|
|
989
|
-
guard:
|
|
1004
|
+
guard: d("isOpenControlled", "closeOnSelect"),
|
|
990
1005
|
actions: ["selectItem", "invokeOnClose"]
|
|
991
1006
|
},
|
|
992
1007
|
{
|
|
@@ -1042,133 +1057,164 @@ var { guards: He, createMachine: Ue, choose: De } = be(), { and: c, not: m } = H
|
|
|
1042
1057
|
var t;
|
|
1043
1058
|
return ((t = e.previousEvent) == null ? void 0 : t.type) === "INPUT.CHANGE";
|
|
1044
1059
|
},
|
|
1045
|
-
autoFocus: ({ prop: e }) => !!e("autoFocus")
|
|
1060
|
+
autoFocus: ({ prop: e }) => !!e("autoFocus"),
|
|
1061
|
+
isHighlightedItemRemoved: ({ prop: e, context: t }) => !e("collection").has(t.get("highlightedValue"))
|
|
1046
1062
|
},
|
|
1047
1063
|
effects: {
|
|
1048
1064
|
trackDismissableLayer({ send: e, prop: t, scope: i }) {
|
|
1049
|
-
return t("disableLayer") ? void 0 :
|
|
1065
|
+
return t("disableLayer") ? void 0 : be(() => k(i), {
|
|
1050
1066
|
defer: !0,
|
|
1051
|
-
exclude: () => [
|
|
1067
|
+
exclude: () => [L(i), H(i), z(i)],
|
|
1052
1068
|
onFocusOutside: t("onFocusOutside"),
|
|
1053
1069
|
onPointerDownOutside: t("onPointerDownOutside"),
|
|
1054
1070
|
onInteractOutside: t("onInteractOutside"),
|
|
1055
|
-
onEscapeKeyDown(
|
|
1056
|
-
|
|
1071
|
+
onEscapeKeyDown(n) {
|
|
1072
|
+
n.preventDefault(), n.stopPropagation(), e({ type: "LAYER.ESCAPE", src: "escape-key" });
|
|
1057
1073
|
},
|
|
1058
1074
|
onDismiss() {
|
|
1059
|
-
e({ type: "LAYER.INTERACT_OUTSIDE", restoreFocus: !1 });
|
|
1075
|
+
e({ type: "LAYER.INTERACT_OUTSIDE", src: "interact-outside", restoreFocus: !1 });
|
|
1060
1076
|
}
|
|
1061
1077
|
});
|
|
1062
1078
|
},
|
|
1063
1079
|
hideOtherElements({ scope: e }) {
|
|
1064
|
-
return
|
|
1065
|
-
y(e),
|
|
1066
|
-
T(e),
|
|
1080
|
+
return Le([
|
|
1067
1081
|
L(e),
|
|
1068
|
-
|
|
1082
|
+
k(e),
|
|
1083
|
+
H(e),
|
|
1084
|
+
z(e)
|
|
1069
1085
|
]);
|
|
1070
1086
|
},
|
|
1071
1087
|
trackPlacement({ context: e, prop: t, scope: i }) {
|
|
1072
|
-
const
|
|
1073
|
-
return e.set("currentPlacement", t("positioning").placement),
|
|
1088
|
+
const l = () => Z(i) || H(i), n = () => X(i);
|
|
1089
|
+
return e.set("currentPlacement", t("positioning").placement), Y(l, n, {
|
|
1074
1090
|
...t("positioning"),
|
|
1075
1091
|
defer: !0,
|
|
1076
|
-
onComplete(
|
|
1077
|
-
e.set("currentPlacement",
|
|
1092
|
+
onComplete(o) {
|
|
1093
|
+
e.set("currentPlacement", o.placement);
|
|
1078
1094
|
}
|
|
1079
1095
|
});
|
|
1080
1096
|
},
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
if (S) {
|
|
1096
|
-
const F = t("collection").indexOf(I);
|
|
1097
|
-
S({ index: F, immediate: O });
|
|
1097
|
+
scrollToHighlightedItem({ context: e, prop: t, scope: i, event: l }) {
|
|
1098
|
+
const n = L(i);
|
|
1099
|
+
let o = [];
|
|
1100
|
+
const s = (I) => {
|
|
1101
|
+
const f = l.current().type.includes("POINTER"), m = e.get("highlightedValue");
|
|
1102
|
+
if (f || !m) return;
|
|
1103
|
+
const T = k(i), O = t("scrollToIndexFn");
|
|
1104
|
+
if (O) {
|
|
1105
|
+
const R = t("collection").indexOf(m);
|
|
1106
|
+
O({
|
|
1107
|
+
index: R,
|
|
1108
|
+
immediate: I,
|
|
1109
|
+
getElement: () => F(i, m)
|
|
1110
|
+
});
|
|
1098
1111
|
return;
|
|
1099
1112
|
}
|
|
1100
|
-
const
|
|
1101
|
-
|
|
1113
|
+
const N = F(i, m), h = V(() => {
|
|
1114
|
+
q(N, { rootEl: T, block: "nearest" });
|
|
1102
1115
|
});
|
|
1103
|
-
|
|
1104
|
-
},
|
|
1105
|
-
|
|
1106
|
-
const
|
|
1116
|
+
o.push(h);
|
|
1117
|
+
}, u = V(() => s(!0));
|
|
1118
|
+
o.push(u);
|
|
1119
|
+
const E = pe(n, {
|
|
1107
1120
|
attributes: ["aria-activedescendant"],
|
|
1108
|
-
callback: () =>
|
|
1121
|
+
callback: () => s(!1)
|
|
1109
1122
|
});
|
|
1110
|
-
return
|
|
1111
|
-
|
|
1123
|
+
return o.push(E), () => {
|
|
1124
|
+
o.forEach((I) => I());
|
|
1112
1125
|
};
|
|
1113
1126
|
}
|
|
1114
1127
|
},
|
|
1115
1128
|
actions: {
|
|
1116
|
-
reposition({ context: e, prop: t, scope: i, event:
|
|
1117
|
-
|
|
1129
|
+
reposition({ context: e, prop: t, scope: i, event: l }) {
|
|
1130
|
+
Y(() => Z(i), () => X(i), {
|
|
1118
1131
|
...t("positioning"),
|
|
1119
|
-
...
|
|
1132
|
+
...l.options,
|
|
1120
1133
|
defer: !0,
|
|
1121
1134
|
listeners: !1,
|
|
1122
|
-
onComplete(
|
|
1123
|
-
e.set("currentPlacement",
|
|
1135
|
+
onComplete(s) {
|
|
1136
|
+
e.set("currentPlacement", s.placement);
|
|
1124
1137
|
}
|
|
1125
1138
|
});
|
|
1126
1139
|
},
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
i.value != null && t.set("highlightedValue", i.value);
|
|
1140
|
+
setHighlightedValue({ context: e, event: t }) {
|
|
1141
|
+
t.value != null && e.set("highlightedValue", t.value);
|
|
1130
1142
|
},
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
t.set("highlightedValue", null);
|
|
1143
|
+
clearHighlightedValue({ context: e }) {
|
|
1144
|
+
e.set("highlightedValue", null);
|
|
1134
1145
|
},
|
|
1135
1146
|
selectHighlightedItem(e) {
|
|
1136
|
-
var
|
|
1137
|
-
const { context: t, prop: i } = e, n = t.get("highlightedValue");
|
|
1138
|
-
if (!n) return;
|
|
1139
|
-
const o = i("multiple") ?
|
|
1140
|
-
(
|
|
1147
|
+
var u;
|
|
1148
|
+
const { context: t, prop: i } = e, l = i("collection"), n = t.get("highlightedValue");
|
|
1149
|
+
if (!n || !l.has(n)) return;
|
|
1150
|
+
const o = i("multiple") ? j(t.get("value"), n) : [n];
|
|
1151
|
+
(u = i("onSelect")) == null || u({ value: o, itemValue: n }), t.set("value", o);
|
|
1152
|
+
const s = P(i("selectionBehavior"), {
|
|
1153
|
+
preserve: t.get("inputValue"),
|
|
1154
|
+
replace: l.stringifyMany(o),
|
|
1155
|
+
clear: ""
|
|
1156
|
+
});
|
|
1157
|
+
t.set("inputValue", s);
|
|
1158
|
+
},
|
|
1159
|
+
scrollToHighlightedItem({ context: e, prop: t, scope: i }) {
|
|
1160
|
+
he(() => {
|
|
1161
|
+
const l = e.get("highlightedValue");
|
|
1162
|
+
if (l == null) return;
|
|
1163
|
+
const n = F(i, l), o = k(i), s = t("scrollToIndexFn");
|
|
1164
|
+
if (s) {
|
|
1165
|
+
const u = t("collection").indexOf(l);
|
|
1166
|
+
s({
|
|
1167
|
+
index: u,
|
|
1168
|
+
immediate: !0,
|
|
1169
|
+
getElement: () => F(i, l)
|
|
1170
|
+
});
|
|
1171
|
+
return;
|
|
1172
|
+
}
|
|
1173
|
+
q(n, { rootEl: o, block: "nearest" });
|
|
1174
|
+
});
|
|
1141
1175
|
},
|
|
1142
1176
|
selectItem(e) {
|
|
1143
|
-
const { context: t, event: i, flush:
|
|
1144
|
-
i.value != null &&
|
|
1145
|
-
var
|
|
1146
|
-
const
|
|
1147
|
-
(
|
|
1177
|
+
const { context: t, event: i, flush: l, prop: n } = e;
|
|
1178
|
+
i.value != null && l(() => {
|
|
1179
|
+
var u;
|
|
1180
|
+
const o = n("multiple") ? j(t.get("value"), i.value) : [i.value];
|
|
1181
|
+
(u = n("onSelect")) == null || u({ value: o, itemValue: i.value }), t.set("value", o);
|
|
1182
|
+
const s = P(n("selectionBehavior"), {
|
|
1183
|
+
preserve: t.get("inputValue"),
|
|
1184
|
+
replace: n("collection").stringifyMany(o),
|
|
1185
|
+
clear: ""
|
|
1186
|
+
});
|
|
1187
|
+
t.set("inputValue", s);
|
|
1148
1188
|
});
|
|
1149
1189
|
},
|
|
1150
1190
|
clearItem(e) {
|
|
1151
|
-
const { context: t, event: i, flush: n } = e;
|
|
1152
|
-
i.value != null &&
|
|
1191
|
+
const { context: t, event: i, flush: l, prop: n } = e;
|
|
1192
|
+
i.value != null && l(() => {
|
|
1153
1193
|
const o = Te(t.get("value"), i.value);
|
|
1154
|
-
t.set("value", o)
|
|
1194
|
+
t.set("value", o);
|
|
1195
|
+
const s = P(n("selectionBehavior"), {
|
|
1196
|
+
preserve: t.get("inputValue"),
|
|
1197
|
+
replace: n("collection").stringifyMany(o),
|
|
1198
|
+
clear: ""
|
|
1199
|
+
});
|
|
1200
|
+
t.set("inputValue", s);
|
|
1155
1201
|
});
|
|
1156
1202
|
},
|
|
1157
1203
|
setInitialFocus({ scope: e }) {
|
|
1158
|
-
|
|
1159
|
-
|
|
1204
|
+
V(() => {
|
|
1205
|
+
ee(e);
|
|
1160
1206
|
});
|
|
1161
1207
|
},
|
|
1162
1208
|
setFinalFocus({ scope: e }) {
|
|
1163
|
-
|
|
1164
|
-
const t =
|
|
1165
|
-
(t == null ? void 0 : t.dataset.focusable) == null ?
|
|
1209
|
+
V(() => {
|
|
1210
|
+
const t = H(e);
|
|
1211
|
+
(t == null ? void 0 : t.dataset.focusable) == null ? ee(e) : Re(e);
|
|
1166
1212
|
});
|
|
1167
1213
|
},
|
|
1168
1214
|
syncInputValue({ context: e, scope: t, event: i }) {
|
|
1169
|
-
const
|
|
1170
|
-
|
|
1171
|
-
i.current().type !== "INPUT.CHANGE" &&
|
|
1215
|
+
const l = L(t);
|
|
1216
|
+
l && (l.value = e.get("inputValue"), queueMicrotask(() => {
|
|
1217
|
+
i.current().type !== "INPUT.CHANGE" && de(l);
|
|
1172
1218
|
}));
|
|
1173
1219
|
},
|
|
1174
1220
|
setInputValue({ context: e, event: t }) {
|
|
@@ -1178,103 +1224,124 @@ var { guards: He, createMachine: Ue, choose: De } = be(), { and: c, not: m } = H
|
|
|
1178
1224
|
e.set("inputValue", "");
|
|
1179
1225
|
},
|
|
1180
1226
|
revertInputValue({ context: e, prop: t, computed: i }) {
|
|
1181
|
-
const
|
|
1182
|
-
replace: i("hasSelectedItems") ?
|
|
1227
|
+
const l = t("selectionBehavior"), n = P(l, {
|
|
1228
|
+
replace: i("hasSelectedItems") ? i("valueAsString") : "",
|
|
1183
1229
|
preserve: e.get("inputValue"),
|
|
1184
1230
|
clear: ""
|
|
1185
1231
|
});
|
|
1186
|
-
e.set("inputValue",
|
|
1232
|
+
e.set("inputValue", n);
|
|
1187
1233
|
},
|
|
1188
1234
|
setValue(e) {
|
|
1189
|
-
const { context: t, flush: i, event: n } = e;
|
|
1235
|
+
const { context: t, flush: i, event: l, prop: n } = e;
|
|
1190
1236
|
i(() => {
|
|
1191
|
-
t.set("value",
|
|
1237
|
+
t.set("value", l.value);
|
|
1238
|
+
const o = P(n("selectionBehavior"), {
|
|
1239
|
+
preserve: t.get("inputValue"),
|
|
1240
|
+
replace: n("collection").stringifyMany(l.value),
|
|
1241
|
+
clear: ""
|
|
1242
|
+
});
|
|
1243
|
+
t.set("inputValue", o);
|
|
1192
1244
|
});
|
|
1193
1245
|
},
|
|
1194
1246
|
clearSelectedItems(e) {
|
|
1195
|
-
const { context: t, flush: i } = e;
|
|
1247
|
+
const { context: t, flush: i, prop: l } = e;
|
|
1196
1248
|
i(() => {
|
|
1197
|
-
t.set("value", [])
|
|
1249
|
+
t.set("value", []);
|
|
1250
|
+
const n = P(l("selectionBehavior"), {
|
|
1251
|
+
preserve: t.get("inputValue"),
|
|
1252
|
+
replace: l("collection").stringifyMany([]),
|
|
1253
|
+
clear: ""
|
|
1254
|
+
});
|
|
1255
|
+
t.set("inputValue", n);
|
|
1198
1256
|
});
|
|
1199
1257
|
},
|
|
1200
1258
|
scrollContentToTop({ prop: e, scope: t }) {
|
|
1201
1259
|
const i = e("scrollToIndexFn");
|
|
1202
|
-
if (i)
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1260
|
+
if (i) {
|
|
1261
|
+
const l = e("collection").firstValue;
|
|
1262
|
+
i({
|
|
1263
|
+
index: 0,
|
|
1264
|
+
immediate: !0,
|
|
1265
|
+
getElement: () => F(t, l)
|
|
1266
|
+
});
|
|
1267
|
+
} else {
|
|
1268
|
+
const l = k(t);
|
|
1269
|
+
if (!l) return;
|
|
1270
|
+
l.scrollTop = 0;
|
|
1208
1271
|
}
|
|
1209
1272
|
},
|
|
1210
|
-
invokeOnOpen({ prop: e }) {
|
|
1211
|
-
var
|
|
1212
|
-
|
|
1273
|
+
invokeOnOpen({ prop: e, event: t }) {
|
|
1274
|
+
var l;
|
|
1275
|
+
const i = te(t);
|
|
1276
|
+
(l = e("onOpenChange")) == null || l({ open: !0, reason: i });
|
|
1213
1277
|
},
|
|
1214
|
-
invokeOnClose({ prop: e }) {
|
|
1215
|
-
var
|
|
1216
|
-
|
|
1278
|
+
invokeOnClose({ prop: e, event: t }) {
|
|
1279
|
+
var l;
|
|
1280
|
+
const i = te(t);
|
|
1281
|
+
(l = e("onOpenChange")) == null || l({ open: !1, reason: i });
|
|
1217
1282
|
},
|
|
1218
1283
|
highlightFirstItem({ context: e, prop: t, scope: i }) {
|
|
1219
|
-
(
|
|
1220
|
-
const
|
|
1221
|
-
|
|
1284
|
+
(k(i) ? queueMicrotask : V)(() => {
|
|
1285
|
+
const n = t("collection").firstValue;
|
|
1286
|
+
n && e.set("highlightedValue", n);
|
|
1222
1287
|
});
|
|
1223
1288
|
},
|
|
1224
1289
|
highlightFirstItemIfNeeded({ computed: e, action: t }) {
|
|
1225
1290
|
e("autoHighlight") && t(["highlightFirstItem"]);
|
|
1226
1291
|
},
|
|
1227
1292
|
highlightLastItem({ context: e, prop: t, scope: i }) {
|
|
1228
|
-
(
|
|
1229
|
-
const
|
|
1230
|
-
|
|
1293
|
+
(k(i) ? queueMicrotask : V)(() => {
|
|
1294
|
+
const n = t("collection").lastValue;
|
|
1295
|
+
n && e.set("highlightedValue", n);
|
|
1231
1296
|
});
|
|
1232
1297
|
},
|
|
1233
1298
|
highlightNextItem({ context: e, prop: t }) {
|
|
1234
1299
|
let i = null;
|
|
1235
|
-
const
|
|
1236
|
-
|
|
1300
|
+
const l = e.get("highlightedValue"), n = t("collection");
|
|
1301
|
+
l ? (i = n.getNextValue(l), !i && t("loopFocus") && (i = n.firstValue)) : i = n.firstValue, i && e.set("highlightedValue", i);
|
|
1237
1302
|
},
|
|
1238
1303
|
highlightPrevItem({ context: e, prop: t }) {
|
|
1239
1304
|
let i = null;
|
|
1240
|
-
const
|
|
1241
|
-
|
|
1305
|
+
const l = e.get("highlightedValue"), n = t("collection");
|
|
1306
|
+
l ? (i = n.getPreviousValue(l), !i && t("loopFocus") && (i = n.lastValue)) : i = n.lastValue, i && e.set("highlightedValue", i);
|
|
1242
1307
|
},
|
|
1243
1308
|
highlightFirstSelectedItem({ context: e, prop: t }) {
|
|
1244
|
-
|
|
1309
|
+
V(() => {
|
|
1245
1310
|
const [i] = t("collection").sort(e.get("value"));
|
|
1246
1311
|
i && e.set("highlightedValue", i);
|
|
1247
1312
|
});
|
|
1248
1313
|
},
|
|
1249
1314
|
highlightFirstOrSelectedItem({ context: e, prop: t, computed: i }) {
|
|
1250
|
-
|
|
1251
|
-
let
|
|
1252
|
-
i("hasSelectedItems") ?
|
|
1315
|
+
V(() => {
|
|
1316
|
+
let l = null;
|
|
1317
|
+
i("hasSelectedItems") ? l = t("collection").sort(e.get("value"))[0] : l = t("collection").firstValue, l && e.set("highlightedValue", l);
|
|
1253
1318
|
});
|
|
1254
1319
|
},
|
|
1255
1320
|
highlightLastOrSelectedItem({ context: e, prop: t, computed: i }) {
|
|
1256
|
-
|
|
1257
|
-
const
|
|
1258
|
-
let
|
|
1259
|
-
i("hasSelectedItems") ?
|
|
1321
|
+
V(() => {
|
|
1322
|
+
const l = t("collection");
|
|
1323
|
+
let n = null;
|
|
1324
|
+
i("hasSelectedItems") ? n = l.sort(e.get("value"))[0] : n = l.lastValue, n && e.set("highlightedValue", n);
|
|
1260
1325
|
});
|
|
1261
1326
|
},
|
|
1262
|
-
autofillInputValue({ context: e, computed: t, prop: i, event:
|
|
1263
|
-
const
|
|
1264
|
-
if (!t("autoComplete") || !
|
|
1265
|
-
const
|
|
1266
|
-
|
|
1267
|
-
|
|
1327
|
+
autofillInputValue({ context: e, computed: t, prop: i, event: l, scope: n }) {
|
|
1328
|
+
const o = L(n), s = i("collection");
|
|
1329
|
+
if (!t("autoComplete") || !o || !l.keypress) return;
|
|
1330
|
+
const u = s.stringify(e.get("highlightedValue"));
|
|
1331
|
+
V(() => {
|
|
1332
|
+
o.value = u || e.get("inputValue");
|
|
1268
1333
|
});
|
|
1269
1334
|
},
|
|
1270
1335
|
syncSelectedItems(e) {
|
|
1271
1336
|
queueMicrotask(() => {
|
|
1272
|
-
const { context: t, prop: i } = e,
|
|
1337
|
+
const { context: t, prop: i } = e, l = i("collection"), n = t.get("value"), o = n.map((u) => t.get("selectedItems").find((I) => l.getItemValue(I) === u) || l.find(u));
|
|
1338
|
+
t.set("selectedItems", o);
|
|
1339
|
+
const s = P(i("selectionBehavior"), {
|
|
1273
1340
|
preserve: t.get("inputValue"),
|
|
1274
|
-
replace:
|
|
1341
|
+
replace: l.stringifyMany(n),
|
|
1275
1342
|
clear: ""
|
|
1276
1343
|
});
|
|
1277
|
-
t.set("
|
|
1344
|
+
t.set("inputValue", s);
|
|
1278
1345
|
});
|
|
1279
1346
|
},
|
|
1280
1347
|
syncHighlightedItem({ context: e, prop: t }) {
|
|
@@ -1287,19 +1354,8 @@ var { guards: He, createMachine: Ue, choose: De } = be(), { and: c, not: m } = H
|
|
|
1287
1354
|
}
|
|
1288
1355
|
}
|
|
1289
1356
|
});
|
|
1290
|
-
function
|
|
1291
|
-
return
|
|
1292
|
-
preserve: e.get("inputValue"),
|
|
1293
|
-
replace: e.get("valueAsString"),
|
|
1294
|
-
clear: ""
|
|
1295
|
-
});
|
|
1296
|
-
}
|
|
1297
|
-
function Me({ context: e, prop: t }) {
|
|
1298
|
-
const i = t("collection");
|
|
1299
|
-
return e.get("value").map((n) => {
|
|
1300
|
-
const o = e.get("selectedItems").find((a) => i.getItemValue(a) === n);
|
|
1301
|
-
return o || i.find(n);
|
|
1302
|
-
});
|
|
1357
|
+
function te(e) {
|
|
1358
|
+
return (e.previousEvent || e).src;
|
|
1303
1359
|
}
|
|
1304
1360
|
G()([
|
|
1305
1361
|
"allowCustomValue",
|
|
@@ -1352,8 +1408,8 @@ G()(["htmlFor"]);
|
|
|
1352
1408
|
G()(["id"]);
|
|
1353
1409
|
G()(["item", "persistFocus"]);
|
|
1354
1410
|
export {
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1411
|
+
Ne as anatomy,
|
|
1412
|
+
le as collection,
|
|
1413
|
+
qe as connect,
|
|
1414
|
+
Ye as machine
|
|
1359
1415
|
};
|