@drfed/web 0.0.0-stage → 0.1.0-dev.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/.output/nitro.json +17 -0
- package/.output/public/.vite/manifest.json +493 -0
- package/.output/public/_build/assets/ActorDetailQuery.graphql-D96mwq1k.js +60 -0
- package/.output/public/_build/assets/ActorDetailQuery.graphql-DrxSNh1X.js +60 -0
- package/.output/public/_build/assets/CompleteLoginChallenge.graphql-C5Zq3wNh.js +10 -0
- package/.output/public/_build/assets/CopyButton-B2l484wE.js +1 -0
- package/.output/public/_build/assets/CopyButton-Bi-ZR8x9.css +1 -0
- package/.output/public/_build/assets/CreateInstanceMutation.graphql-B4CRy6cl.js +19 -0
- package/.output/public/_build/assets/CreateObjectMutation.graphql-B4A01dgV.js +23 -0
- package/.output/public/_build/assets/GenerateActorsMutation.graphql-mlHJNIbe.js +23 -0
- package/.output/public/_build/assets/GetHostQuery.graphql-CuzDdOdW.js +17 -0
- package/.output/public/_build/assets/GetHostQuery.graphql-o9K0Qkg0.js +17 -0
- package/.output/public/_build/assets/HomeViewerQuery.graphql-B903WWKs.js +8 -0
- package/.output/public/_build/assets/HttpStatusCode-bgaVzuLy.js +1 -0
- package/.output/public/_build/assets/InstanceActorListQuery.graphql-DmNwiEhM.js +24 -0
- package/.output/public/_build/assets/InstanceActorListQuery.graphql-paa7teUO.js +24 -0
- package/.output/public/_build/assets/InstanceDetailQuery.graphql-B52nR132.js +66 -0
- package/.output/public/_build/assets/InstanceDetailQuery.graphql-DSA2BcAV.js +66 -0
- package/.output/public/_build/assets/InstanceSummary_instance.graphql-BoQAa5Od.js +1 -0
- package/.output/public/_build/assets/JNCCF6MP-CNMywyiC.js +1 -0
- package/.output/public/_build/assets/LP6E37CW-Cwv6G3n1.js +1 -0
- package/.output/public/_build/assets/SignInMutation.graphql-BalZYNFu.js +9 -0
- package/.output/public/_build/assets/TSB6MOZK-CpiH97G1.js +1 -0
- package/.output/public/_build/assets/Toast-3-eXCAKc.css +1 -0
- package/.output/public/_build/assets/Toast-C1zr9crB.js +1 -0
- package/.output/public/_build/assets/WorkspaceQuery.graphql-UoI7QDs4.js +23 -0
- package/.output/public/_build/assets/_...404_-WZ8kAljY.js +1 -0
- package/.output/public/_build/assets/_challengeId_-BgL-Berz.js +1 -0
- package/.output/public/_build/assets/_id_-YcZZShAv.css +1 -0
- package/.output/public/_build/assets/_id_-bpxdclBj.js +1 -0
- package/.output/public/_build/assets/_slug_-CyTA2aW7.css +1 -0
- package/.output/public/_build/assets/_slug_-DXfRknzJ.js +200 -0
- package/.output/public/_build/assets/about-DIrbzRsi.js +1 -0
- package/.output/public/_build/assets/actors-HfZh_afh.js +24 -0
- package/.output/public/_build/assets/client-CGFoRcqH.js +3 -0
- package/.output/public/_build/assets/components-5MVu7IcD.js +1 -0
- package/.output/public/_build/assets/dist-BrJ_B8nU.js +1 -0
- package/.output/public/_build/assets/dist-DVo0HS5G.js +1 -0
- package/.output/public/_build/assets/dist-WrlGlK67.js +1 -0
- package/.output/public/_build/assets/entry-client-BurSTYr9.css +1 -0
- package/.output/public/_build/assets/entry-client-RIC5nXxX.js +8 -0
- package/.output/public/_build/assets/form-BxigYd7J.css +1 -0
- package/.output/public/_build/assets/form.module-BecmEfV_.js +1 -0
- package/.output/public/_build/assets/index-BHn6sAgH.js +23 -0
- package/.output/public/_build/assets/index-BSLqnqN7.js +8 -0
- package/.output/public/_build/assets/index-B_xLBDOo.css +1 -0
- package/.output/public/_build/assets/instance-tpMrvJNZ.js +35 -0
- package/.output/public/_build/assets/label-Mv8GZ4jc.js +1 -0
- package/.output/public/_build/assets/objects-DPb8DI8A.css +1 -0
- package/.output/public/_build/assets/objects-DR9TfL-V.js +25 -0
- package/.output/public/_build/assets/relay-runtime-BX3uubtA.js +7 -0
- package/.output/public/_build/assets/routing-DMN2NHu6.js +1 -0
- package/.output/public/_build/assets/sign-in-B67sv7z8.js +10 -0
- package/.output/public/_build/assets/web-DB_Nkq2D.js +1 -0
- package/.output/public/apple-touch-icon.png +0 -0
- package/.output/public/favicon.ico +0 -0
- package/.output/public/icon-192.png +0 -0
- package/.output/public/icon-512.png +0 -0
- package/.output/public/icon-mask.png +0 -0
- package/.output/public/icon.svg +395 -0
- package/.output/public/manifest.webmanifest +13 -0
- package/.output/server/_...404_-DDEH5apf.mjs +16 -0
- package/.output/server/_challengeId_-C7BBdG0r.mjs +100 -0
- package/.output/server/_chunks/ssr-renderer.mjs +26 -0
- package/.output/server/_id_-DqytvZEf.mjs +505 -0
- package/.output/server/_libs/@shikijs/core+[...].mjs +7173 -0
- package/.output/server/_libs/@shikijs/engine-javascript+[...].mjs +3110 -0
- package/.output/server/_libs/babel__runtime.mjs +243 -0
- package/.output/server/_libs/dequal.mjs +25 -0
- package/.output/server/_libs/faker-js__faker.mjs +13150 -0
- package/.output/server/_libs/fbjs.mjs +115 -0
- package/.output/server/_libs/h3+rou3+srvx.mjs +650 -0
- package/.output/server/_libs/hookable.mjs +41 -0
- package/.output/server/_libs/invariant.mjs +36 -0
- package/.output/server/_libs/relay-runtime.mjs +9704 -0
- package/.output/server/_libs/seroval-plugins.mjs +563 -0
- package/.output/server/_libs/seroval.mjs +2956 -0
- package/.output/server/_libs/shikijs__langs.mjs +3 -0
- package/.output/server/_libs/shikijs__themes.mjs +7 -0
- package/.output/server/_libs/solid-js.mjs +1248 -0
- package/.output/server/_libs/solid-relay+tiny-invariant.mjs +1029 -0
- package/.output/server/_libs/ufo.mjs +64 -0
- package/.output/server/_libs/valibot.mjs +711 -0
- package/.output/server/_runtime.mjs +33 -0
- package/.output/server/_slug_-CBOaSqoF.mjs +978 -0
- package/.output/server/_ssr/ActorDetailQuery.graphql-C1mWRP1B.mjs +283 -0
- package/.output/server/_ssr/CompleteLoginChallenge.graphql-CM7o_Md1.mjs +78 -0
- package/.output/server/_ssr/CopyButton-CQNR5D1y.mjs +43 -0
- package/.output/server/_ssr/CreateInstanceMutation.graphql-C-h2lGxz.mjs +116 -0
- package/.output/server/_ssr/CreateObjectMutation.graphql-C393Hp7q.mjs +166 -0
- package/.output/server/_ssr/GenerateActorsMutation.graphql-D2ADtn1j.mjs +163 -0
- package/.output/server/_ssr/GetHostQuery.graphql-C45XQo1i.mjs +127 -0
- package/.output/server/_ssr/HomeViewerQuery.graphql-Dote4Pkz.mjs +81 -0
- package/.output/server/_ssr/InstanceActorListQuery.graphql-DgItgN5t.mjs +167 -0
- package/.output/server/_ssr/InstanceDetailQuery.graphql-DP5wWWjX.mjs +367 -0
- package/.output/server/_ssr/InstanceSummary_instance.graphql-10tilF-Z.mjs +34 -0
- package/.output/server/_ssr/JNCCF6MP-BAZlBnvx.mjs +419 -0
- package/.output/server/_ssr/LP6E37CW-D2Ih_b_K.mjs +163 -0
- package/.output/server/_ssr/SignInMutation.graphql-BBXmiay6.mjs +72 -0
- package/.output/server/_ssr/TSB6MOZK-D06WZb6o.mjs +166 -0
- package/.output/server/_ssr/Toast-Bb1gcxED.mjs +947 -0
- package/.output/server/_ssr/WorkspaceQuery.graphql-DnCO8t-4.mjs +153 -0
- package/.output/server/_ssr/about-CD3QIgf_.mjs +14 -0
- package/.output/server/_ssr/actors-CMWf-xQU.mjs +1160 -0
- package/.output/server/_ssr/dist-D6rgyh-L.mjs +81 -0
- package/.output/server/_ssr/dist-I7KRMRbA.mjs +432 -0
- package/.output/server/_ssr/form.module-CTvIl1lm.mjs +192 -0
- package/.output/server/_ssr/index-C4crD6q-.mjs +347 -0
- package/.output/server/_ssr/index-yuhuc6-X.mjs +111 -0
- package/.output/server/_ssr/instance-ZYWGeWd3.mjs +280 -0
- package/.output/server/_ssr/label-DAXzanI9.mjs +9 -0
- package/.output/server/_ssr/objects-D5MVukzB.mjs +4316 -0
- package/.output/server/_ssr/routing-DKTLkkbY.mjs +620 -0
- package/.output/server/_ssr/sign-in-CNHZb_zL.mjs +264 -0
- package/.output/server/_ssr/ssr.mjs +6138 -0
- package/.output/server/index.mjs +691 -0
- package/LICENSE +661 -0
- package/README.md +143 -2
- package/dist/bridge.d.mts +39 -0
- package/dist/bridge.mjs +104 -0
- package/dist/bridge.mjs.map +1 -0
- package/dist/request-policy.d.mts +8 -0
- package/dist/request-policy.mjs +94 -0
- package/dist/request-policy.mjs.map +1 -0
- package/dist/runtime.d.mts +14 -0
- package/dist/runtime.mjs +44 -0
- package/dist/runtime.mjs.map +1 -0
- package/package.json +111 -3
|
@@ -0,0 +1,4316 @@
|
|
|
1
|
+
import { r as __toESM } from "../_runtime.mjs";
|
|
2
|
+
import { n as require_relay_runtime } from "../_libs/relay-runtime.mjs";
|
|
3
|
+
import { $ as splitProps, D as Show, E as Match, F as createContext, H as createUniqueId, I as createEffect, J as onCleanup, K as mergeProps, L as createMemo, M as children, N as createComponent, P as createComputed, V as createSignal, Y as onMount, _ as ssrElement, b as ssrStyleProperty, g as ssrAttribute, h as ssr, k as Switch, l as Portal, nt as useContext, q as on, u as escape, v as ssrHydrationKey, w as For, y as ssrStyle } from "../_libs/solid-js.mjs";
|
|
4
|
+
import { n as Title } from "./dist-D6rgyh-L.mjs";
|
|
5
|
+
import { a as index_default$1, c as node$1, i as combineStyle, o as layerStack, r as access, t as DATA_TOP_LAYER_ATTR } from "./Toast-Bb1gcxED.mjs";
|
|
6
|
+
import { A as scrollIntoView, C as isMac, D as mergeDefaultProps, E as isWebKit$1, M as visuallyHiddenStyles, S as isFunction, T as isString, a as __export, f as focusWithoutScrolling, g as getFocusableTreeWalker, h as getDocument, i as Polymorphic, l as createGenerateId, n as ButtonRoot, o as callHandler, s as composeEventHandlers, u as createRegisterId, v as getWindow$1, w as isNumber, y as isAppleDevice } from "./JNCCF6MP-BAZlBnvx.mjs";
|
|
7
|
+
import { S as url, b as string, d as object, f as optional, h as pipe, l as nonEmpty, m as picklist, n as check, t as array, y as strictObject } from "../_libs/valibot.mjs";
|
|
8
|
+
import { i as createMutation, o as createPreloadedQuery } from "../_libs/solid-relay+tiny-invariant.mjs";
|
|
9
|
+
import { t as actorLabel } from "./label-DAXzanI9.mjs";
|
|
10
|
+
import { a as FormControlErrorMessage, d as createFormControl, f as createFormControlField, g as useFormControlContext, i as FormControlDescription, l as createControllableBooleanSignal, m as form_module_default, n as FORM_CONTROL_PROP_NAMES, o as FormControlLabel, p as createFormResetListener, r as FormControlContext, s as access$1, t as FORM_CONTROL_FIELD_PROP_NAMES, u as createControllableSignal } from "./form.module-CTvIl1lm.mjs";
|
|
11
|
+
import { a as useLocale, i as createCollator, t as DATA_LIVE_ANNOUNCER_ATTR } from "./LP6E37CW-D2Ih_b_K.mjs";
|
|
12
|
+
import { t as TextField } from "./TSB6MOZK-D06WZb6o.mjs";
|
|
13
|
+
//#region node_modules/.nitro/vite/services/ssr/_build/assets/objects-D5MVukzB.js
|
|
14
|
+
var import_relay_runtime = /* @__PURE__ */ __toESM(require_relay_runtime());
|
|
15
|
+
/**
|
|
16
|
+
* Reactively maps an array by specified key with a callback function - underlying helper for the `<Key>` control flow.
|
|
17
|
+
* @param list input list of values to map
|
|
18
|
+
* @param keyFn key getter, items will be identified by it's value. changing the value is changing the item.
|
|
19
|
+
* @param mapFn reactive function used to create mapped output item. Similar to `Array.prototype.map` but both item and index are signals, that could change over time.
|
|
20
|
+
* @param options a fallback for when the input list is empty or missing
|
|
21
|
+
* @returns mapped input array signal
|
|
22
|
+
* @see https://github.com/solidjs-community/solid-primitives/tree/main/packages/keyed#keyArray
|
|
23
|
+
*/
|
|
24
|
+
function keyArray(items, keyFn, mapFn, options = {}) {
|
|
25
|
+
{
|
|
26
|
+
const itemsRef = items();
|
|
27
|
+
let s = [];
|
|
28
|
+
if (itemsRef && itemsRef.length) for (let i = 0, len = itemsRef.length; i < len; i++) s.push(mapFn(() => itemsRef[i], () => i));
|
|
29
|
+
else if (options.fallback) s = [options.fallback()];
|
|
30
|
+
return () => s;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* creates a list of elements from the input `each` list
|
|
35
|
+
*
|
|
36
|
+
* it receives a map function as its child that receives a **list item signal** and **index signal** and returns a JSX-Element; if the list is empty, an optional fallback is returned:
|
|
37
|
+
* ```tsx
|
|
38
|
+
* <Key each={items()} by={item => item.id} fallback={<div>No items</div>}>
|
|
39
|
+
* {(item, index) => <div data-index={index()}>{item()}</div>}
|
|
40
|
+
* </Key>
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* prop `by` can also be an object key:
|
|
44
|
+
* ```tsx
|
|
45
|
+
* <Key each={items()} by="id">
|
|
46
|
+
* ```
|
|
47
|
+
*
|
|
48
|
+
* @see https://github.com/solidjs-community/solid-primitives/tree/main/packages/keyed#Key
|
|
49
|
+
*/
|
|
50
|
+
function Key(props) {
|
|
51
|
+
const { by } = props;
|
|
52
|
+
return createMemo(keyArray(() => props.each, typeof by === "function" ? by : (v) => v[by], props.children, "fallback" in props ? { fallback: () => props.fallback } : void 0));
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* @generated SignedSource<<e05ec657e33e63011ef458f6e7b387d2>>
|
|
56
|
+
* @lightSyntaxTransform
|
|
57
|
+
*/
|
|
58
|
+
var { ConcreteRequest } = import_relay_runtime?.default?.default?.__esModule ? import_relay_runtime.default.default : import_relay_runtime?.default?.__esModule ? import_relay_runtime.default : import_relay_runtime;
|
|
59
|
+
var node = function() {
|
|
60
|
+
var v0 = {
|
|
61
|
+
"defaultValue": null,
|
|
62
|
+
"kind": "LocalArgument",
|
|
63
|
+
"name": "actor"
|
|
64
|
+
}, v1 = {
|
|
65
|
+
"defaultValue": null,
|
|
66
|
+
"kind": "LocalArgument",
|
|
67
|
+
"name": "addressing"
|
|
68
|
+
}, v2 = {
|
|
69
|
+
"defaultValue": null,
|
|
70
|
+
"kind": "LocalArgument",
|
|
71
|
+
"name": "contentHtml"
|
|
72
|
+
}, v3 = {
|
|
73
|
+
"defaultValue": null,
|
|
74
|
+
"kind": "LocalArgument",
|
|
75
|
+
"name": "name"
|
|
76
|
+
}, v4 = {
|
|
77
|
+
"defaultValue": null,
|
|
78
|
+
"kind": "LocalArgument",
|
|
79
|
+
"name": "type"
|
|
80
|
+
}, v5 = [
|
|
81
|
+
{
|
|
82
|
+
"kind": "Variable",
|
|
83
|
+
"name": "actor",
|
|
84
|
+
"variableName": "actor"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"kind": "Variable",
|
|
88
|
+
"name": "addressing",
|
|
89
|
+
"variableName": "addressing"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"kind": "Variable",
|
|
93
|
+
"name": "contentHtml",
|
|
94
|
+
"variableName": "contentHtml"
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"kind": "Variable",
|
|
98
|
+
"name": "name",
|
|
99
|
+
"variableName": "name"
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"kind": "Variable",
|
|
103
|
+
"name": "type",
|
|
104
|
+
"variableName": "type"
|
|
105
|
+
}
|
|
106
|
+
], v6 = {
|
|
107
|
+
"alias": "resultType",
|
|
108
|
+
"args": null,
|
|
109
|
+
"kind": "ScalarField",
|
|
110
|
+
"name": "__typename",
|
|
111
|
+
"storageKey": null
|
|
112
|
+
}, v7 = [{
|
|
113
|
+
"alias": null,
|
|
114
|
+
"args": null,
|
|
115
|
+
"kind": "ScalarField",
|
|
116
|
+
"name": "id",
|
|
117
|
+
"storageKey": null
|
|
118
|
+
}], v8 = {
|
|
119
|
+
"kind": "InlineFragment",
|
|
120
|
+
"selections": v7,
|
|
121
|
+
"type": "Object",
|
|
122
|
+
"abstractKey": null
|
|
123
|
+
}, v9 = {
|
|
124
|
+
"kind": "InlineFragment",
|
|
125
|
+
"selections": [{
|
|
126
|
+
"alias": null,
|
|
127
|
+
"args": null,
|
|
128
|
+
"kind": "ScalarField",
|
|
129
|
+
"name": "message",
|
|
130
|
+
"storageKey": null
|
|
131
|
+
}],
|
|
132
|
+
"type": "CreateObjectError",
|
|
133
|
+
"abstractKey": null
|
|
134
|
+
};
|
|
135
|
+
return {
|
|
136
|
+
"fragment": {
|
|
137
|
+
"argumentDefinitions": [
|
|
138
|
+
v0,
|
|
139
|
+
v1,
|
|
140
|
+
v2,
|
|
141
|
+
v3,
|
|
142
|
+
v4
|
|
143
|
+
],
|
|
144
|
+
"kind": "Fragment",
|
|
145
|
+
"metadata": null,
|
|
146
|
+
"name": "CreateObjectMutation",
|
|
147
|
+
"selections": [{
|
|
148
|
+
"alias": null,
|
|
149
|
+
"args": v5,
|
|
150
|
+
"concreteType": null,
|
|
151
|
+
"kind": "LinkedField",
|
|
152
|
+
"name": "createObject",
|
|
153
|
+
"plural": false,
|
|
154
|
+
"selections": [
|
|
155
|
+
v6,
|
|
156
|
+
v8,
|
|
157
|
+
v9
|
|
158
|
+
],
|
|
159
|
+
"storageKey": null
|
|
160
|
+
}],
|
|
161
|
+
"type": "Mutation",
|
|
162
|
+
"abstractKey": null
|
|
163
|
+
},
|
|
164
|
+
"kind": "Request",
|
|
165
|
+
"operation": {
|
|
166
|
+
"argumentDefinitions": [
|
|
167
|
+
v0,
|
|
168
|
+
v2,
|
|
169
|
+
v4,
|
|
170
|
+
v1,
|
|
171
|
+
v3
|
|
172
|
+
],
|
|
173
|
+
"kind": "Operation",
|
|
174
|
+
"name": "CreateObjectMutation",
|
|
175
|
+
"selections": [{
|
|
176
|
+
"alias": null,
|
|
177
|
+
"args": v5,
|
|
178
|
+
"concreteType": null,
|
|
179
|
+
"kind": "LinkedField",
|
|
180
|
+
"name": "createObject",
|
|
181
|
+
"plural": false,
|
|
182
|
+
"selections": [
|
|
183
|
+
{
|
|
184
|
+
"alias": null,
|
|
185
|
+
"args": null,
|
|
186
|
+
"kind": "ScalarField",
|
|
187
|
+
"name": "__typename",
|
|
188
|
+
"storageKey": null
|
|
189
|
+
},
|
|
190
|
+
v6,
|
|
191
|
+
v8,
|
|
192
|
+
v9,
|
|
193
|
+
{
|
|
194
|
+
"kind": "InlineFragment",
|
|
195
|
+
"selections": v7,
|
|
196
|
+
"type": "Node",
|
|
197
|
+
"abstractKey": "__isNode"
|
|
198
|
+
}
|
|
199
|
+
],
|
|
200
|
+
"storageKey": null
|
|
201
|
+
}]
|
|
202
|
+
},
|
|
203
|
+
"params": {
|
|
204
|
+
"cacheID": "ea6485713aef56c573e1b58d3c22a203",
|
|
205
|
+
"id": null,
|
|
206
|
+
"metadata": {},
|
|
207
|
+
"name": "CreateObjectMutation",
|
|
208
|
+
"operationKind": "mutation",
|
|
209
|
+
"text": "mutation CreateObjectMutation(\n $actor: ID!\n $contentHtml: String!\n $type: ObjectType!\n $addressing: AddressingInput!\n $name: String\n) {\n createObject(actor: $actor, contentHtml: $contentHtml, type: $type, addressing: $addressing, name: $name) {\n __typename\n resultType: __typename\n ... on Object {\n id\n }\n ... on CreateObjectError {\n message\n }\n ... on Node {\n __isNode: __typename\n id\n }\n }\n}\n"
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
}();
|
|
213
|
+
node.hash = "4011e826ce87d1ac9818445a6ad503d4";
|
|
214
|
+
function buildNodes(params) {
|
|
215
|
+
let index = params.startIndex ?? 0;
|
|
216
|
+
const level = params.startLevel ?? 0;
|
|
217
|
+
const nodes = [];
|
|
218
|
+
const getKey = (data) => {
|
|
219
|
+
if (data == null) return "";
|
|
220
|
+
const _getKey = params.getKey ?? "key";
|
|
221
|
+
const dataKey = isString(_getKey) ? data[_getKey] : _getKey(data);
|
|
222
|
+
return dataKey != null ? String(dataKey) : "";
|
|
223
|
+
};
|
|
224
|
+
const getTextValue = (data) => {
|
|
225
|
+
if (data == null) return "";
|
|
226
|
+
const _getTextValue = params.getTextValue ?? "textValue";
|
|
227
|
+
const dataTextValue = isString(_getTextValue) ? data[_getTextValue] : _getTextValue(data);
|
|
228
|
+
return dataTextValue != null ? String(dataTextValue) : "";
|
|
229
|
+
};
|
|
230
|
+
const getDisabled = (data) => {
|
|
231
|
+
if (data == null) return false;
|
|
232
|
+
const _getDisabled = params.getDisabled ?? "disabled";
|
|
233
|
+
return (isString(_getDisabled) ? data[_getDisabled] : _getDisabled(data)) ?? false;
|
|
234
|
+
};
|
|
235
|
+
const getSectionChildren = (data) => {
|
|
236
|
+
if (data == null) return;
|
|
237
|
+
if (isString(params.getSectionChildren)) return data[params.getSectionChildren];
|
|
238
|
+
return params.getSectionChildren?.(data);
|
|
239
|
+
};
|
|
240
|
+
for (const data of params.dataSource) {
|
|
241
|
+
if (isString(data) || isNumber(data)) {
|
|
242
|
+
nodes.push({
|
|
243
|
+
type: "item",
|
|
244
|
+
rawValue: data,
|
|
245
|
+
key: String(data),
|
|
246
|
+
textValue: String(data),
|
|
247
|
+
disabled: getDisabled(data),
|
|
248
|
+
level,
|
|
249
|
+
index
|
|
250
|
+
});
|
|
251
|
+
index++;
|
|
252
|
+
continue;
|
|
253
|
+
}
|
|
254
|
+
if (getSectionChildren(data) != null) {
|
|
255
|
+
nodes.push({
|
|
256
|
+
type: "section",
|
|
257
|
+
rawValue: data,
|
|
258
|
+
key: "",
|
|
259
|
+
textValue: "",
|
|
260
|
+
disabled: false,
|
|
261
|
+
level,
|
|
262
|
+
index
|
|
263
|
+
});
|
|
264
|
+
index++;
|
|
265
|
+
const sectionChildren = getSectionChildren(data) ?? [];
|
|
266
|
+
if (sectionChildren.length > 0) {
|
|
267
|
+
const childNodes = buildNodes({
|
|
268
|
+
dataSource: sectionChildren,
|
|
269
|
+
getKey: params.getKey,
|
|
270
|
+
getTextValue: params.getTextValue,
|
|
271
|
+
getDisabled: params.getDisabled,
|
|
272
|
+
getSectionChildren: params.getSectionChildren,
|
|
273
|
+
startIndex: index,
|
|
274
|
+
startLevel: level + 1
|
|
275
|
+
});
|
|
276
|
+
nodes.push(...childNodes);
|
|
277
|
+
index += childNodes.length;
|
|
278
|
+
}
|
|
279
|
+
} else {
|
|
280
|
+
nodes.push({
|
|
281
|
+
type: "item",
|
|
282
|
+
rawValue: data,
|
|
283
|
+
key: getKey(data),
|
|
284
|
+
textValue: getTextValue(data),
|
|
285
|
+
disabled: getDisabled(data),
|
|
286
|
+
level,
|
|
287
|
+
index
|
|
288
|
+
});
|
|
289
|
+
index++;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
return nodes;
|
|
293
|
+
}
|
|
294
|
+
function createCollection(props, deps = []) {
|
|
295
|
+
return createMemo(() => {
|
|
296
|
+
const nodes = buildNodes({
|
|
297
|
+
dataSource: access$1(props.dataSource),
|
|
298
|
+
getKey: access$1(props.getKey),
|
|
299
|
+
getTextValue: access$1(props.getTextValue),
|
|
300
|
+
getDisabled: access$1(props.getDisabled),
|
|
301
|
+
getSectionChildren: access$1(props.getSectionChildren)
|
|
302
|
+
});
|
|
303
|
+
for (let i = 0; i < deps.length; i++) deps[i]();
|
|
304
|
+
return props.factory(nodes);
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
var Selection = class _Selection extends Set {
|
|
308
|
+
anchorKey;
|
|
309
|
+
currentKey;
|
|
310
|
+
constructor(keys, anchorKey, currentKey) {
|
|
311
|
+
super(keys);
|
|
312
|
+
if (keys instanceof _Selection) {
|
|
313
|
+
this.anchorKey = anchorKey || keys.anchorKey;
|
|
314
|
+
this.currentKey = currentKey || keys.currentKey;
|
|
315
|
+
} else {
|
|
316
|
+
this.anchorKey = anchorKey;
|
|
317
|
+
this.currentKey = currentKey;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
};
|
|
321
|
+
function createControllableSelectionSignal(props) {
|
|
322
|
+
const [_value, setValue] = createControllableSignal(props);
|
|
323
|
+
const value = () => _value() ?? new Selection();
|
|
324
|
+
return [value, setValue];
|
|
325
|
+
}
|
|
326
|
+
function isNonContiguousSelectionModifier(e) {
|
|
327
|
+
return isAppleDevice() ? e.altKey : e.ctrlKey;
|
|
328
|
+
}
|
|
329
|
+
function isCtrlKeyPressed(e) {
|
|
330
|
+
if (isMac()) return e.metaKey;
|
|
331
|
+
return e.ctrlKey;
|
|
332
|
+
}
|
|
333
|
+
function convertSelection(selection) {
|
|
334
|
+
return new Selection(selection);
|
|
335
|
+
}
|
|
336
|
+
function isSameSelection(setA, setB) {
|
|
337
|
+
if (setA.size !== setB.size) return false;
|
|
338
|
+
for (const item of setA) if (!setB.has(item)) return false;
|
|
339
|
+
return true;
|
|
340
|
+
}
|
|
341
|
+
function createMultipleSelectionState(props) {
|
|
342
|
+
const mergedProps = mergeDefaultProps({
|
|
343
|
+
selectionMode: "none",
|
|
344
|
+
selectionBehavior: "toggle"
|
|
345
|
+
}, props);
|
|
346
|
+
const [isFocused, setFocused] = createSignal(false);
|
|
347
|
+
const [focusedKey, setFocusedKey] = createSignal();
|
|
348
|
+
const [selectedKeys, _setSelectedKeys] = createControllableSelectionSignal({
|
|
349
|
+
value: createMemo(() => {
|
|
350
|
+
const selection = access$1(mergedProps.selectedKeys);
|
|
351
|
+
if (selection != null) return convertSelection(selection);
|
|
352
|
+
return selection;
|
|
353
|
+
}),
|
|
354
|
+
defaultValue: createMemo(() => {
|
|
355
|
+
const defaultSelection = access$1(mergedProps.defaultSelectedKeys);
|
|
356
|
+
if (defaultSelection != null) return convertSelection(defaultSelection);
|
|
357
|
+
return new Selection();
|
|
358
|
+
}),
|
|
359
|
+
onChange: (value) => mergedProps.onSelectionChange?.(value)
|
|
360
|
+
});
|
|
361
|
+
const [selectionBehavior, setSelectionBehavior] = createSignal(access$1(mergedProps.selectionBehavior));
|
|
362
|
+
const selectionMode = () => access$1(mergedProps.selectionMode);
|
|
363
|
+
const disallowEmptySelection = () => access$1(mergedProps.disallowEmptySelection) ?? false;
|
|
364
|
+
const setSelectedKeys = (keys) => {
|
|
365
|
+
if (access$1(mergedProps.allowDuplicateSelectionEvents) || !isSameSelection(keys, selectedKeys())) _setSelectedKeys(keys);
|
|
366
|
+
};
|
|
367
|
+
createEffect(() => {
|
|
368
|
+
const selection = selectedKeys();
|
|
369
|
+
if (access$1(mergedProps.selectionBehavior) === "replace" && selectionBehavior() === "toggle" && typeof selection === "object" && selection.size === 0) setSelectionBehavior("replace");
|
|
370
|
+
});
|
|
371
|
+
createEffect(() => {
|
|
372
|
+
setSelectionBehavior(access$1(mergedProps.selectionBehavior) ?? "toggle");
|
|
373
|
+
});
|
|
374
|
+
return {
|
|
375
|
+
selectionMode,
|
|
376
|
+
disallowEmptySelection,
|
|
377
|
+
selectionBehavior,
|
|
378
|
+
setSelectionBehavior,
|
|
379
|
+
isFocused,
|
|
380
|
+
setFocused,
|
|
381
|
+
focusedKey,
|
|
382
|
+
setFocusedKey,
|
|
383
|
+
selectedKeys,
|
|
384
|
+
setSelectedKeys
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
function createTypeSelect(props) {
|
|
388
|
+
const [search, setSearch] = createSignal("");
|
|
389
|
+
const [timeoutId, setTimeoutId] = createSignal(-1);
|
|
390
|
+
const onKeyDown = (e) => {
|
|
391
|
+
if (access$1(props.isDisabled)) return;
|
|
392
|
+
const delegate = access$1(props.keyboardDelegate);
|
|
393
|
+
const manager = access$1(props.selectionManager);
|
|
394
|
+
if (!delegate.getKeyForSearch) return;
|
|
395
|
+
const character = getStringForKey(e.key);
|
|
396
|
+
if (!character || e.ctrlKey || e.metaKey) return;
|
|
397
|
+
if (character === " " && search().trim().length > 0) {
|
|
398
|
+
e.preventDefault();
|
|
399
|
+
e.stopPropagation();
|
|
400
|
+
}
|
|
401
|
+
let newSearch = setSearch((prev) => prev + character);
|
|
402
|
+
let key = delegate.getKeyForSearch(newSearch, manager.focusedKey()) ?? delegate.getKeyForSearch(newSearch);
|
|
403
|
+
if (key == null && isAllSameLetter(newSearch)) {
|
|
404
|
+
newSearch = newSearch[0];
|
|
405
|
+
key = delegate.getKeyForSearch(newSearch, manager.focusedKey()) ?? delegate.getKeyForSearch(newSearch);
|
|
406
|
+
}
|
|
407
|
+
if (key != null) {
|
|
408
|
+
manager.setFocusedKey(key);
|
|
409
|
+
props.onTypeSelect?.(key);
|
|
410
|
+
}
|
|
411
|
+
clearTimeout(timeoutId());
|
|
412
|
+
setTimeoutId(window.setTimeout(() => setSearch(""), 500));
|
|
413
|
+
};
|
|
414
|
+
return { typeSelectHandlers: { onKeyDown } };
|
|
415
|
+
}
|
|
416
|
+
function getStringForKey(key) {
|
|
417
|
+
if (key.length === 1 || !/^[A-Z]/i.test(key)) return key;
|
|
418
|
+
return "";
|
|
419
|
+
}
|
|
420
|
+
function isAllSameLetter(search) {
|
|
421
|
+
return search.split("").every((letter) => letter === search[0]);
|
|
422
|
+
}
|
|
423
|
+
function createSelectableCollection(props, ref, scrollRef) {
|
|
424
|
+
const mergedProps = mergeProps({ selectOnFocus: () => access$1(props.selectionManager).selectionBehavior() === "replace" }, props);
|
|
425
|
+
const finalScrollRef = () => scrollRef?.() ?? ref();
|
|
426
|
+
const { direction } = useLocale();
|
|
427
|
+
let scrollPos = {
|
|
428
|
+
top: 0,
|
|
429
|
+
left: 0
|
|
430
|
+
};
|
|
431
|
+
const { typeSelectHandlers } = createTypeSelect({
|
|
432
|
+
isDisabled: () => access$1(mergedProps.disallowTypeAhead),
|
|
433
|
+
keyboardDelegate: () => access$1(mergedProps.keyboardDelegate),
|
|
434
|
+
selectionManager: () => access$1(mergedProps.selectionManager)
|
|
435
|
+
});
|
|
436
|
+
const orientation = () => access$1(mergedProps.orientation) ?? "vertical";
|
|
437
|
+
const onKeyDown = (e) => {
|
|
438
|
+
callHandler(e, typeSelectHandlers.onKeyDown);
|
|
439
|
+
if (e.altKey && e.key === "Tab") e.preventDefault();
|
|
440
|
+
const refEl = ref();
|
|
441
|
+
if (!refEl?.contains(e.target)) return;
|
|
442
|
+
const manager = access$1(mergedProps.selectionManager);
|
|
443
|
+
const selectOnFocus = access$1(mergedProps.selectOnFocus);
|
|
444
|
+
const navigateToKey = (key) => {
|
|
445
|
+
if (key != null) {
|
|
446
|
+
manager.setFocusedKey(key);
|
|
447
|
+
if (e.shiftKey && manager.selectionMode() === "multiple") manager.extendSelection(key);
|
|
448
|
+
else if (selectOnFocus && !isNonContiguousSelectionModifier(e)) manager.replaceSelection(key);
|
|
449
|
+
}
|
|
450
|
+
};
|
|
451
|
+
const delegate = access$1(mergedProps.keyboardDelegate);
|
|
452
|
+
const shouldFocusWrap = access$1(mergedProps.shouldFocusWrap);
|
|
453
|
+
const focusedKey = manager.focusedKey();
|
|
454
|
+
switch (e.key) {
|
|
455
|
+
case orientation() === "vertical" ? "ArrowDown" : "ArrowRight":
|
|
456
|
+
if (delegate.getKeyBelow) {
|
|
457
|
+
e.preventDefault();
|
|
458
|
+
let nextKey;
|
|
459
|
+
if (focusedKey != null) nextKey = delegate.getKeyBelow(focusedKey);
|
|
460
|
+
else nextKey = delegate.getFirstKey?.();
|
|
461
|
+
if (nextKey == null && shouldFocusWrap) nextKey = delegate.getFirstKey?.(focusedKey);
|
|
462
|
+
navigateToKey(nextKey);
|
|
463
|
+
}
|
|
464
|
+
break;
|
|
465
|
+
case orientation() === "vertical" ? "ArrowUp" : "ArrowLeft":
|
|
466
|
+
if (delegate.getKeyAbove) {
|
|
467
|
+
e.preventDefault();
|
|
468
|
+
let nextKey;
|
|
469
|
+
if (focusedKey != null) nextKey = delegate.getKeyAbove(focusedKey);
|
|
470
|
+
else nextKey = delegate.getLastKey?.();
|
|
471
|
+
if (nextKey == null && shouldFocusWrap) nextKey = delegate.getLastKey?.(focusedKey);
|
|
472
|
+
navigateToKey(nextKey);
|
|
473
|
+
}
|
|
474
|
+
break;
|
|
475
|
+
case orientation() === "vertical" ? "ArrowLeft" : "ArrowUp":
|
|
476
|
+
if (delegate.getKeyLeftOf) {
|
|
477
|
+
e.preventDefault();
|
|
478
|
+
const isRTL = direction() === "rtl";
|
|
479
|
+
let nextKey;
|
|
480
|
+
if (focusedKey != null) nextKey = delegate.getKeyLeftOf(focusedKey);
|
|
481
|
+
else nextKey = isRTL ? delegate.getFirstKey?.() : delegate.getLastKey?.();
|
|
482
|
+
navigateToKey(nextKey);
|
|
483
|
+
}
|
|
484
|
+
break;
|
|
485
|
+
case orientation() === "vertical" ? "ArrowRight" : "ArrowDown":
|
|
486
|
+
if (delegate.getKeyRightOf) {
|
|
487
|
+
e.preventDefault();
|
|
488
|
+
const isRTL = direction() === "rtl";
|
|
489
|
+
let nextKey;
|
|
490
|
+
if (focusedKey != null) nextKey = delegate.getKeyRightOf(focusedKey);
|
|
491
|
+
else nextKey = isRTL ? delegate.getLastKey?.() : delegate.getFirstKey?.();
|
|
492
|
+
navigateToKey(nextKey);
|
|
493
|
+
}
|
|
494
|
+
break;
|
|
495
|
+
case "Home":
|
|
496
|
+
if (delegate.getFirstKey) {
|
|
497
|
+
e.preventDefault();
|
|
498
|
+
const firstKey = delegate.getFirstKey(focusedKey, isCtrlKeyPressed(e));
|
|
499
|
+
if (firstKey != null) {
|
|
500
|
+
manager.setFocusedKey(firstKey);
|
|
501
|
+
if (isCtrlKeyPressed(e) && e.shiftKey && manager.selectionMode() === "multiple") manager.extendSelection(firstKey);
|
|
502
|
+
else if (selectOnFocus) manager.replaceSelection(firstKey);
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
break;
|
|
506
|
+
case "End":
|
|
507
|
+
if (delegate.getLastKey) {
|
|
508
|
+
e.preventDefault();
|
|
509
|
+
const lastKey = delegate.getLastKey(focusedKey, isCtrlKeyPressed(e));
|
|
510
|
+
if (lastKey != null) {
|
|
511
|
+
manager.setFocusedKey(lastKey);
|
|
512
|
+
if (isCtrlKeyPressed(e) && e.shiftKey && manager.selectionMode() === "multiple") manager.extendSelection(lastKey);
|
|
513
|
+
else if (selectOnFocus) manager.replaceSelection(lastKey);
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
break;
|
|
517
|
+
case "PageDown":
|
|
518
|
+
if (delegate.getKeyPageBelow && focusedKey != null) {
|
|
519
|
+
e.preventDefault();
|
|
520
|
+
navigateToKey(delegate.getKeyPageBelow(focusedKey));
|
|
521
|
+
}
|
|
522
|
+
break;
|
|
523
|
+
case "PageUp":
|
|
524
|
+
if (delegate.getKeyPageAbove && focusedKey != null) {
|
|
525
|
+
e.preventDefault();
|
|
526
|
+
navigateToKey(delegate.getKeyPageAbove(focusedKey));
|
|
527
|
+
}
|
|
528
|
+
break;
|
|
529
|
+
case "a":
|
|
530
|
+
if (isCtrlKeyPressed(e) && manager.selectionMode() === "multiple" && access$1(mergedProps.disallowSelectAll) !== true) {
|
|
531
|
+
e.preventDefault();
|
|
532
|
+
manager.selectAll();
|
|
533
|
+
}
|
|
534
|
+
break;
|
|
535
|
+
case "Escape":
|
|
536
|
+
if (!e.defaultPrevented && !access$1(mergedProps.disallowEmptySelection)) {
|
|
537
|
+
e.preventDefault();
|
|
538
|
+
manager.clearSelection();
|
|
539
|
+
}
|
|
540
|
+
break;
|
|
541
|
+
case "Tab": if (!access$1(mergedProps.allowsTabNavigation)) {
|
|
542
|
+
if (e.shiftKey) refEl.focus();
|
|
543
|
+
else {
|
|
544
|
+
const walker = getFocusableTreeWalker(refEl, { tabbable: true });
|
|
545
|
+
let next;
|
|
546
|
+
let last;
|
|
547
|
+
do {
|
|
548
|
+
last = walker.lastChild();
|
|
549
|
+
if (last) next = last;
|
|
550
|
+
} while (last);
|
|
551
|
+
if (next && !next.contains(document.activeElement)) focusWithoutScrolling(next);
|
|
552
|
+
}
|
|
553
|
+
break;
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
};
|
|
557
|
+
const onFocusIn = (e) => {
|
|
558
|
+
const manager = access$1(mergedProps.selectionManager);
|
|
559
|
+
const delegate = access$1(mergedProps.keyboardDelegate);
|
|
560
|
+
const selectOnFocus = access$1(mergedProps.selectOnFocus);
|
|
561
|
+
if (manager.isFocused()) {
|
|
562
|
+
if (!e.currentTarget.contains(e.target)) manager.setFocused(false);
|
|
563
|
+
return;
|
|
564
|
+
}
|
|
565
|
+
if (!e.currentTarget.contains(e.target)) return;
|
|
566
|
+
manager.setFocused(true);
|
|
567
|
+
if (manager.focusedKey() == null) {
|
|
568
|
+
const navigateToFirstKey = (key) => {
|
|
569
|
+
if (key == null) return;
|
|
570
|
+
manager.setFocusedKey(key);
|
|
571
|
+
if (selectOnFocus) manager.replaceSelection(key);
|
|
572
|
+
};
|
|
573
|
+
const relatedTarget = e.relatedTarget;
|
|
574
|
+
if (relatedTarget && e.currentTarget.compareDocumentPosition(relatedTarget) & Node.DOCUMENT_POSITION_FOLLOWING) navigateToFirstKey(manager.lastSelectedKey() ?? delegate.getLastKey?.());
|
|
575
|
+
else navigateToFirstKey(manager.firstSelectedKey() ?? delegate.getFirstKey?.());
|
|
576
|
+
} else if (!access$1(mergedProps.isVirtualized)) {
|
|
577
|
+
const scrollEl = finalScrollRef();
|
|
578
|
+
if (scrollEl) {
|
|
579
|
+
scrollEl.scrollTop = scrollPos.top;
|
|
580
|
+
scrollEl.scrollLeft = scrollPos.left;
|
|
581
|
+
const element = scrollEl.querySelector(`[data-key="${manager.focusedKey()}"]`);
|
|
582
|
+
if (element) {
|
|
583
|
+
focusWithoutScrolling(element);
|
|
584
|
+
scrollIntoView(scrollEl, element);
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
};
|
|
589
|
+
const onFocusOut = (e) => {
|
|
590
|
+
const manager = access$1(mergedProps.selectionManager);
|
|
591
|
+
if (!e.currentTarget.contains(e.relatedTarget)) manager.setFocused(false);
|
|
592
|
+
};
|
|
593
|
+
const onMouseDown = (e) => {
|
|
594
|
+
if (finalScrollRef() === e.target) e.preventDefault();
|
|
595
|
+
};
|
|
596
|
+
const tryAutoFocus = () => {
|
|
597
|
+
const autoFocus = access$1(mergedProps.autoFocus);
|
|
598
|
+
if (!autoFocus) return;
|
|
599
|
+
const manager = access$1(mergedProps.selectionManager);
|
|
600
|
+
const delegate = access$1(mergedProps.keyboardDelegate);
|
|
601
|
+
let focusedKey;
|
|
602
|
+
if (autoFocus === "first") focusedKey = delegate.getFirstKey?.();
|
|
603
|
+
if (autoFocus === "last") focusedKey = delegate.getLastKey?.();
|
|
604
|
+
const selectedKeys = manager.selectedKeys();
|
|
605
|
+
if (selectedKeys.size) focusedKey = selectedKeys.values().next().value;
|
|
606
|
+
manager.setFocused(true);
|
|
607
|
+
manager.setFocusedKey(focusedKey);
|
|
608
|
+
const refEl = ref();
|
|
609
|
+
if (refEl && focusedKey == null && !access$1(mergedProps.shouldUseVirtualFocus)) focusWithoutScrolling(refEl);
|
|
610
|
+
};
|
|
611
|
+
onMount(() => {
|
|
612
|
+
if (mergedProps.deferAutoFocus) setTimeout(tryAutoFocus, 0);
|
|
613
|
+
else tryAutoFocus();
|
|
614
|
+
});
|
|
615
|
+
createEffect(on([
|
|
616
|
+
finalScrollRef,
|
|
617
|
+
() => access$1(mergedProps.isVirtualized),
|
|
618
|
+
() => access$1(mergedProps.selectionManager).focusedKey()
|
|
619
|
+
], (newValue) => {
|
|
620
|
+
const [scrollEl, isVirtualized, focusedKey] = newValue;
|
|
621
|
+
if (isVirtualized) focusedKey && mergedProps.scrollToKey?.(focusedKey);
|
|
622
|
+
else if (focusedKey && scrollEl) {
|
|
623
|
+
const element = scrollEl.querySelector(`[data-key="${focusedKey}"]`);
|
|
624
|
+
if (element) scrollIntoView(scrollEl, element);
|
|
625
|
+
}
|
|
626
|
+
}));
|
|
627
|
+
return {
|
|
628
|
+
tabIndex: createMemo(() => {
|
|
629
|
+
if (access$1(mergedProps.shouldUseVirtualFocus)) return;
|
|
630
|
+
return access$1(mergedProps.selectionManager).focusedKey() == null ? 0 : -1;
|
|
631
|
+
}),
|
|
632
|
+
onKeyDown,
|
|
633
|
+
onMouseDown,
|
|
634
|
+
onFocusIn,
|
|
635
|
+
onFocusOut
|
|
636
|
+
};
|
|
637
|
+
}
|
|
638
|
+
function createSelectableItem(props, ref) {
|
|
639
|
+
const manager = () => access$1(props.selectionManager);
|
|
640
|
+
const key = () => access$1(props.key);
|
|
641
|
+
const shouldUseVirtualFocus = () => access$1(props.shouldUseVirtualFocus);
|
|
642
|
+
const onSelect = (e) => {
|
|
643
|
+
if (manager().selectionMode() === "none") return;
|
|
644
|
+
if (manager().selectionMode() === "single") if (manager().isSelected(key()) && !manager().disallowEmptySelection()) manager().toggleSelection(key());
|
|
645
|
+
else manager().replaceSelection(key());
|
|
646
|
+
else if (e?.shiftKey) manager().extendSelection(key());
|
|
647
|
+
else if (manager().selectionBehavior() === "toggle" || isCtrlKeyPressed(e) || "pointerType" in e && e.pointerType === "touch") manager().toggleSelection(key());
|
|
648
|
+
else manager().replaceSelection(key());
|
|
649
|
+
};
|
|
650
|
+
const isSelected = () => manager().isSelected(key());
|
|
651
|
+
const isDisabled = () => access$1(props.disabled) || manager().isDisabled(key());
|
|
652
|
+
const allowsSelection = () => !isDisabled() && manager().canSelectItem(key());
|
|
653
|
+
let pointerDownType = null;
|
|
654
|
+
const onPointerDown = (e) => {
|
|
655
|
+
if (!allowsSelection()) return;
|
|
656
|
+
pointerDownType = e.pointerType;
|
|
657
|
+
if (e.pointerType === "mouse" && e.button === 0 && !access$1(props.shouldSelectOnPressUp)) onSelect(e);
|
|
658
|
+
};
|
|
659
|
+
const onPointerUp = (e) => {
|
|
660
|
+
if (!allowsSelection()) return;
|
|
661
|
+
if (e.pointerType === "mouse" && e.button === 0 && access$1(props.shouldSelectOnPressUp) && access$1(props.allowsDifferentPressOrigin)) onSelect(e);
|
|
662
|
+
};
|
|
663
|
+
const onClick = (e) => {
|
|
664
|
+
if (!allowsSelection()) return;
|
|
665
|
+
if (access$1(props.shouldSelectOnPressUp) && !access$1(props.allowsDifferentPressOrigin) || pointerDownType !== "mouse") onSelect(e);
|
|
666
|
+
};
|
|
667
|
+
const onKeyDown = (e) => {
|
|
668
|
+
if (!allowsSelection() || !["Enter", " "].includes(e.key)) return;
|
|
669
|
+
if (isNonContiguousSelectionModifier(e)) manager().toggleSelection(key());
|
|
670
|
+
else onSelect(e);
|
|
671
|
+
};
|
|
672
|
+
const onMouseDown = (e) => {
|
|
673
|
+
if (isDisabled()) e.preventDefault();
|
|
674
|
+
};
|
|
675
|
+
const onFocus = (e) => {
|
|
676
|
+
const refEl = ref();
|
|
677
|
+
if (shouldUseVirtualFocus() || isDisabled() || !refEl) return;
|
|
678
|
+
if (e.target === refEl) manager().setFocusedKey(key());
|
|
679
|
+
};
|
|
680
|
+
const tabIndex = createMemo(() => {
|
|
681
|
+
if (shouldUseVirtualFocus() || isDisabled()) return;
|
|
682
|
+
return key() === manager().focusedKey() ? 0 : -1;
|
|
683
|
+
});
|
|
684
|
+
const dataKey = createMemo(() => {
|
|
685
|
+
return access$1(props.virtualized) ? void 0 : key();
|
|
686
|
+
});
|
|
687
|
+
createEffect(on([
|
|
688
|
+
ref,
|
|
689
|
+
key,
|
|
690
|
+
shouldUseVirtualFocus,
|
|
691
|
+
() => manager().focusedKey(),
|
|
692
|
+
() => manager().isFocused()
|
|
693
|
+
], ([refEl, key2, shouldUseVirtualFocus2, focusedKey, isFocused]) => {
|
|
694
|
+
if (refEl && key2 === focusedKey && isFocused && !shouldUseVirtualFocus2 && document.activeElement !== refEl) if (props.focus) props.focus();
|
|
695
|
+
else focusWithoutScrolling(refEl);
|
|
696
|
+
}));
|
|
697
|
+
return {
|
|
698
|
+
isSelected,
|
|
699
|
+
isDisabled,
|
|
700
|
+
allowsSelection,
|
|
701
|
+
tabIndex,
|
|
702
|
+
dataKey,
|
|
703
|
+
onPointerDown,
|
|
704
|
+
onPointerUp,
|
|
705
|
+
onClick,
|
|
706
|
+
onKeyDown,
|
|
707
|
+
onMouseDown,
|
|
708
|
+
onFocus
|
|
709
|
+
};
|
|
710
|
+
}
|
|
711
|
+
var SelectionManager = class {
|
|
712
|
+
collection;
|
|
713
|
+
state;
|
|
714
|
+
constructor(collection, state) {
|
|
715
|
+
this.collection = collection;
|
|
716
|
+
this.state = state;
|
|
717
|
+
}
|
|
718
|
+
/** The type of selection that is allowed in the collection. */
|
|
719
|
+
selectionMode() {
|
|
720
|
+
return this.state.selectionMode();
|
|
721
|
+
}
|
|
722
|
+
/** Whether the collection allows empty selection. */
|
|
723
|
+
disallowEmptySelection() {
|
|
724
|
+
return this.state.disallowEmptySelection();
|
|
725
|
+
}
|
|
726
|
+
/** The selection behavior for the collection. */
|
|
727
|
+
selectionBehavior() {
|
|
728
|
+
return this.state.selectionBehavior();
|
|
729
|
+
}
|
|
730
|
+
/** Sets the selection behavior for the collection. */
|
|
731
|
+
setSelectionBehavior(selectionBehavior) {
|
|
732
|
+
this.state.setSelectionBehavior(selectionBehavior);
|
|
733
|
+
}
|
|
734
|
+
/** Whether the collection is currently focused. */
|
|
735
|
+
isFocused() {
|
|
736
|
+
return this.state.isFocused();
|
|
737
|
+
}
|
|
738
|
+
/** Sets whether the collection is focused. */
|
|
739
|
+
setFocused(isFocused) {
|
|
740
|
+
this.state.setFocused(isFocused);
|
|
741
|
+
}
|
|
742
|
+
/** The current focused key in the collection. */
|
|
743
|
+
focusedKey() {
|
|
744
|
+
return this.state.focusedKey();
|
|
745
|
+
}
|
|
746
|
+
/** Sets the focused key. */
|
|
747
|
+
setFocusedKey(key) {
|
|
748
|
+
if (key == null || this.collection().getItem(key)) this.state.setFocusedKey(key);
|
|
749
|
+
}
|
|
750
|
+
/** The currently selected keys in the collection. */
|
|
751
|
+
selectedKeys() {
|
|
752
|
+
return this.state.selectedKeys();
|
|
753
|
+
}
|
|
754
|
+
/** Returns whether a key is selected. */
|
|
755
|
+
isSelected(key) {
|
|
756
|
+
if (this.state.selectionMode() === "none") return false;
|
|
757
|
+
const retrievedKey = this.getKey(key);
|
|
758
|
+
if (retrievedKey == null) return false;
|
|
759
|
+
return this.state.selectedKeys().has(retrievedKey);
|
|
760
|
+
}
|
|
761
|
+
/** Whether the selection is empty. */
|
|
762
|
+
isEmpty() {
|
|
763
|
+
return this.state.selectedKeys().size === 0;
|
|
764
|
+
}
|
|
765
|
+
/** Whether all items in the collection are selected. */
|
|
766
|
+
isSelectAll() {
|
|
767
|
+
if (this.isEmpty()) return false;
|
|
768
|
+
const selectedKeys = this.state.selectedKeys();
|
|
769
|
+
return this.getAllSelectableKeys().every((k) => selectedKeys.has(k));
|
|
770
|
+
}
|
|
771
|
+
firstSelectedKey() {
|
|
772
|
+
let first;
|
|
773
|
+
for (const key of this.state.selectedKeys()) {
|
|
774
|
+
const item = this.collection().getItem(key);
|
|
775
|
+
const isItemBeforeFirst = item?.index != null && first?.index != null && item.index < first.index;
|
|
776
|
+
if (!first || isItemBeforeFirst) first = item;
|
|
777
|
+
}
|
|
778
|
+
return first?.key;
|
|
779
|
+
}
|
|
780
|
+
lastSelectedKey() {
|
|
781
|
+
let last;
|
|
782
|
+
for (const key of this.state.selectedKeys()) {
|
|
783
|
+
const item = this.collection().getItem(key);
|
|
784
|
+
const isItemAfterLast = item?.index != null && last?.index != null && item.index > last.index;
|
|
785
|
+
if (!last || isItemAfterLast) last = item;
|
|
786
|
+
}
|
|
787
|
+
return last?.key;
|
|
788
|
+
}
|
|
789
|
+
/** Extends the selection to the given key. */
|
|
790
|
+
extendSelection(toKey) {
|
|
791
|
+
if (this.selectionMode() === "none") return;
|
|
792
|
+
if (this.selectionMode() === "single") {
|
|
793
|
+
this.replaceSelection(toKey);
|
|
794
|
+
return;
|
|
795
|
+
}
|
|
796
|
+
const retrievedToKey = this.getKey(toKey);
|
|
797
|
+
if (retrievedToKey == null) return;
|
|
798
|
+
const selectedKeys = this.state.selectedKeys();
|
|
799
|
+
const anchorKey = selectedKeys.anchorKey || retrievedToKey;
|
|
800
|
+
const selection = new Selection(selectedKeys, anchorKey, retrievedToKey);
|
|
801
|
+
for (const key of this.getKeyRange(anchorKey, selectedKeys.currentKey || retrievedToKey)) selection.delete(key);
|
|
802
|
+
for (const key of this.getKeyRange(retrievedToKey, anchorKey)) if (this.canSelectItem(key)) selection.add(key);
|
|
803
|
+
this.state.setSelectedKeys(selection);
|
|
804
|
+
}
|
|
805
|
+
getKeyRange(from, to) {
|
|
806
|
+
const fromItem = this.collection().getItem(from);
|
|
807
|
+
const toItem = this.collection().getItem(to);
|
|
808
|
+
if (fromItem && toItem) {
|
|
809
|
+
if (fromItem.index != null && toItem.index != null && fromItem.index <= toItem.index) return this.getKeyRangeInternal(from, to);
|
|
810
|
+
return this.getKeyRangeInternal(to, from);
|
|
811
|
+
}
|
|
812
|
+
return [];
|
|
813
|
+
}
|
|
814
|
+
getKeyRangeInternal(from, to) {
|
|
815
|
+
const keys = [];
|
|
816
|
+
let key = from;
|
|
817
|
+
while (key != null) {
|
|
818
|
+
const item = this.collection().getItem(key);
|
|
819
|
+
if (item && item.type === "item") keys.push(key);
|
|
820
|
+
if (key === to) return keys;
|
|
821
|
+
key = this.collection().getKeyAfter(key);
|
|
822
|
+
}
|
|
823
|
+
return [];
|
|
824
|
+
}
|
|
825
|
+
getKey(key) {
|
|
826
|
+
const item = this.collection().getItem(key);
|
|
827
|
+
if (!item) return key;
|
|
828
|
+
if (!item || item.type !== "item") return null;
|
|
829
|
+
return item.key;
|
|
830
|
+
}
|
|
831
|
+
/** Toggles whether the given key is selected. */
|
|
832
|
+
toggleSelection(key) {
|
|
833
|
+
if (this.selectionMode() === "none") return;
|
|
834
|
+
if (this.selectionMode() === "single" && !this.isSelected(key)) {
|
|
835
|
+
this.replaceSelection(key);
|
|
836
|
+
return;
|
|
837
|
+
}
|
|
838
|
+
const retrievedKey = this.getKey(key);
|
|
839
|
+
if (retrievedKey == null) return;
|
|
840
|
+
const keys = new Selection(this.state.selectedKeys());
|
|
841
|
+
if (keys.has(retrievedKey)) keys.delete(retrievedKey);
|
|
842
|
+
else if (this.canSelectItem(retrievedKey)) {
|
|
843
|
+
keys.add(retrievedKey);
|
|
844
|
+
keys.anchorKey = retrievedKey;
|
|
845
|
+
keys.currentKey = retrievedKey;
|
|
846
|
+
}
|
|
847
|
+
if (this.disallowEmptySelection() && keys.size === 0) return;
|
|
848
|
+
this.state.setSelectedKeys(keys);
|
|
849
|
+
}
|
|
850
|
+
/** Replaces the selection with only the given key. */
|
|
851
|
+
replaceSelection(key) {
|
|
852
|
+
if (this.selectionMode() === "none") return;
|
|
853
|
+
const retrievedKey = this.getKey(key);
|
|
854
|
+
if (retrievedKey == null) return;
|
|
855
|
+
const selection = this.canSelectItem(retrievedKey) ? new Selection([retrievedKey], retrievedKey, retrievedKey) : new Selection();
|
|
856
|
+
this.state.setSelectedKeys(selection);
|
|
857
|
+
}
|
|
858
|
+
/** Replaces the selection with the given keys. */
|
|
859
|
+
setSelectedKeys(keys) {
|
|
860
|
+
if (this.selectionMode() === "none") return;
|
|
861
|
+
const selection = new Selection();
|
|
862
|
+
for (const key of keys) {
|
|
863
|
+
const retrievedKey = this.getKey(key);
|
|
864
|
+
if (retrievedKey != null) {
|
|
865
|
+
selection.add(retrievedKey);
|
|
866
|
+
if (this.selectionMode() === "single") break;
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
this.state.setSelectedKeys(selection);
|
|
870
|
+
}
|
|
871
|
+
/** Selects all items in the collection. */
|
|
872
|
+
selectAll() {
|
|
873
|
+
if (this.selectionMode() === "multiple") this.state.setSelectedKeys(new Set(this.getAllSelectableKeys()));
|
|
874
|
+
}
|
|
875
|
+
/**
|
|
876
|
+
* Removes all keys from the selection.
|
|
877
|
+
*/
|
|
878
|
+
clearSelection() {
|
|
879
|
+
const selectedKeys = this.state.selectedKeys();
|
|
880
|
+
if (!this.disallowEmptySelection() && selectedKeys.size > 0) this.state.setSelectedKeys(new Selection());
|
|
881
|
+
}
|
|
882
|
+
/**
|
|
883
|
+
* Toggles between select all and an empty selection.
|
|
884
|
+
*/
|
|
885
|
+
toggleSelectAll() {
|
|
886
|
+
if (this.isSelectAll()) this.clearSelection();
|
|
887
|
+
else this.selectAll();
|
|
888
|
+
}
|
|
889
|
+
select(key, e) {
|
|
890
|
+
if (this.selectionMode() === "none") return;
|
|
891
|
+
if (this.selectionMode() === "single") if (this.isSelected(key) && !this.disallowEmptySelection()) this.toggleSelection(key);
|
|
892
|
+
else this.replaceSelection(key);
|
|
893
|
+
else if (this.selectionBehavior() === "toggle" || e && e.pointerType === "touch") this.toggleSelection(key);
|
|
894
|
+
else this.replaceSelection(key);
|
|
895
|
+
}
|
|
896
|
+
/** Returns whether the current selection is equal to the given selection. */
|
|
897
|
+
isSelectionEqual(selection) {
|
|
898
|
+
if (selection === this.state.selectedKeys()) return true;
|
|
899
|
+
const selectedKeys = this.selectedKeys();
|
|
900
|
+
if (selection.size !== selectedKeys.size) return false;
|
|
901
|
+
for (const key of selection) if (!selectedKeys.has(key)) return false;
|
|
902
|
+
for (const key of selectedKeys) if (!selection.has(key)) return false;
|
|
903
|
+
return true;
|
|
904
|
+
}
|
|
905
|
+
canSelectItem(key) {
|
|
906
|
+
if (this.state.selectionMode() === "none") return false;
|
|
907
|
+
const item = this.collection().getItem(key);
|
|
908
|
+
return item != null && !item.disabled;
|
|
909
|
+
}
|
|
910
|
+
isDisabled(key) {
|
|
911
|
+
const item = this.collection().getItem(key);
|
|
912
|
+
return !item || item.disabled;
|
|
913
|
+
}
|
|
914
|
+
getAllSelectableKeys() {
|
|
915
|
+
const keys = [];
|
|
916
|
+
const addKeys = (key) => {
|
|
917
|
+
while (key != null) {
|
|
918
|
+
if (this.canSelectItem(key)) {
|
|
919
|
+
const item = this.collection().getItem(key);
|
|
920
|
+
if (!item) continue;
|
|
921
|
+
if (item.type === "item") keys.push(key);
|
|
922
|
+
}
|
|
923
|
+
key = this.collection().getKeyAfter(key);
|
|
924
|
+
}
|
|
925
|
+
};
|
|
926
|
+
addKeys(this.collection().getFirstKey());
|
|
927
|
+
return keys;
|
|
928
|
+
}
|
|
929
|
+
};
|
|
930
|
+
var ListCollection = class {
|
|
931
|
+
keyMap = /* @__PURE__ */ new Map();
|
|
932
|
+
iterable;
|
|
933
|
+
firstKey;
|
|
934
|
+
lastKey;
|
|
935
|
+
constructor(nodes) {
|
|
936
|
+
this.iterable = nodes;
|
|
937
|
+
for (const node of nodes) this.keyMap.set(node.key, node);
|
|
938
|
+
if (this.keyMap.size === 0) return;
|
|
939
|
+
let last;
|
|
940
|
+
let index = 0;
|
|
941
|
+
for (const [key, node] of this.keyMap) {
|
|
942
|
+
if (last) {
|
|
943
|
+
last.nextKey = key;
|
|
944
|
+
node.prevKey = last.key;
|
|
945
|
+
} else {
|
|
946
|
+
this.firstKey = key;
|
|
947
|
+
node.prevKey = void 0;
|
|
948
|
+
}
|
|
949
|
+
if (node.type === "item") node.index = index++;
|
|
950
|
+
last = node;
|
|
951
|
+
last.nextKey = void 0;
|
|
952
|
+
}
|
|
953
|
+
this.lastKey = last.key;
|
|
954
|
+
}
|
|
955
|
+
*[Symbol.iterator]() {
|
|
956
|
+
yield* this.iterable;
|
|
957
|
+
}
|
|
958
|
+
getSize() {
|
|
959
|
+
return this.keyMap.size;
|
|
960
|
+
}
|
|
961
|
+
getKeys() {
|
|
962
|
+
return this.keyMap.keys();
|
|
963
|
+
}
|
|
964
|
+
getKeyBefore(key) {
|
|
965
|
+
return this.keyMap.get(key)?.prevKey;
|
|
966
|
+
}
|
|
967
|
+
getKeyAfter(key) {
|
|
968
|
+
return this.keyMap.get(key)?.nextKey;
|
|
969
|
+
}
|
|
970
|
+
getFirstKey() {
|
|
971
|
+
return this.firstKey;
|
|
972
|
+
}
|
|
973
|
+
getLastKey() {
|
|
974
|
+
return this.lastKey;
|
|
975
|
+
}
|
|
976
|
+
getItem(key) {
|
|
977
|
+
return this.keyMap.get(key);
|
|
978
|
+
}
|
|
979
|
+
at(idx) {
|
|
980
|
+
const keys = [...this.getKeys()];
|
|
981
|
+
return this.getItem(keys[idx]);
|
|
982
|
+
}
|
|
983
|
+
};
|
|
984
|
+
function createListState(props) {
|
|
985
|
+
const selectionState = createMultipleSelectionState(props);
|
|
986
|
+
const factory = (nodes) => {
|
|
987
|
+
return props.filter ? new ListCollection(props.filter(nodes)) : new ListCollection(nodes);
|
|
988
|
+
};
|
|
989
|
+
const collection = createCollection({
|
|
990
|
+
dataSource: () => access$1(props.dataSource),
|
|
991
|
+
getKey: () => access$1(props.getKey),
|
|
992
|
+
getTextValue: () => access$1(props.getTextValue),
|
|
993
|
+
getDisabled: () => access$1(props.getDisabled),
|
|
994
|
+
getSectionChildren: () => access$1(props.getSectionChildren),
|
|
995
|
+
factory
|
|
996
|
+
}, [() => props.filter]);
|
|
997
|
+
const selectionManager = new SelectionManager(collection, selectionState);
|
|
998
|
+
createComputed(() => {
|
|
999
|
+
const focusedKey = selectionState.focusedKey();
|
|
1000
|
+
if (focusedKey != null && !collection().getItem(focusedKey)) selectionState.setFocusedKey(void 0);
|
|
1001
|
+
});
|
|
1002
|
+
return {
|
|
1003
|
+
collection,
|
|
1004
|
+
selectionManager: () => selectionManager
|
|
1005
|
+
};
|
|
1006
|
+
}
|
|
1007
|
+
var _tmpl$$2 = [
|
|
1008
|
+
"<option",
|
|
1009
|
+
"",
|
|
1010
|
+
">",
|
|
1011
|
+
"</option>"
|
|
1012
|
+
];
|
|
1013
|
+
var _tmpl$2$1 = "<option></option>";
|
|
1014
|
+
var _tmpl$3$1 = [
|
|
1015
|
+
"<div",
|
|
1016
|
+
" style=\"",
|
|
1017
|
+
"\" aria-hidden=\"true\"><input type=\"text\"",
|
|
1018
|
+
" style=\"",
|
|
1019
|
+
"\"",
|
|
1020
|
+
"",
|
|
1021
|
+
">",
|
|
1022
|
+
"</div>"
|
|
1023
|
+
];
|
|
1024
|
+
function HiddenSelectBase(props) {
|
|
1025
|
+
const [local, others] = splitProps(props, [
|
|
1026
|
+
"ref",
|
|
1027
|
+
"onChange",
|
|
1028
|
+
"collection",
|
|
1029
|
+
"selectionManager",
|
|
1030
|
+
"isOpen",
|
|
1031
|
+
"isMultiple",
|
|
1032
|
+
"isVirtualized",
|
|
1033
|
+
"focusTrigger"
|
|
1034
|
+
]);
|
|
1035
|
+
const formControlContext = useFormControlContext();
|
|
1036
|
+
const [isInternalChangeEvent, setIsInternalChangeEvent] = createSignal(false);
|
|
1037
|
+
const renderOption = (key) => {
|
|
1038
|
+
const item = local.collection.getItem(key);
|
|
1039
|
+
return createComponent(Show, {
|
|
1040
|
+
get when() {
|
|
1041
|
+
return item?.type === "item";
|
|
1042
|
+
},
|
|
1043
|
+
get children() {
|
|
1044
|
+
return ssr(_tmpl$$2, ssrHydrationKey() + ssrAttribute("value", escape(key, true), false), ssrAttribute("selected", local.selectionManager.isSelected(key), true), escape(item?.textValue));
|
|
1045
|
+
}
|
|
1046
|
+
});
|
|
1047
|
+
};
|
|
1048
|
+
createEffect(on(() => local.selectionManager.selectedKeys(), (keys, prevKeys) => {
|
|
1049
|
+
if (prevKeys && isSameSelection(keys, prevKeys)) return;
|
|
1050
|
+
setIsInternalChangeEvent(true);
|
|
1051
|
+
}, { defer: true }));
|
|
1052
|
+
return ssr(_tmpl$3$1, ssrHydrationKey(), ssrStyle(visuallyHiddenStyles), ssrAttribute("tabindex", local.selectionManager.isFocused() || local.isOpen ? -1 : 0, false), ssrStyleProperty("font-size:", "16px"), ssrAttribute("required", formControlContext.isRequired(), true), ssrAttribute("disabled", formControlContext.isDisabled(), true) + ssrAttribute("readonly", escape(formControlContext.isReadOnly(), true), false), ssrElement("select", mergeProps({
|
|
1053
|
+
tabIndex: -1,
|
|
1054
|
+
get multiple() {
|
|
1055
|
+
return local.isMultiple;
|
|
1056
|
+
},
|
|
1057
|
+
get name() {
|
|
1058
|
+
return formControlContext.name();
|
|
1059
|
+
},
|
|
1060
|
+
get required() {
|
|
1061
|
+
return formControlContext.isRequired();
|
|
1062
|
+
},
|
|
1063
|
+
get disabled() {
|
|
1064
|
+
return formControlContext.isDisabled();
|
|
1065
|
+
},
|
|
1066
|
+
get size() {
|
|
1067
|
+
return local.collection.getSize();
|
|
1068
|
+
},
|
|
1069
|
+
get value() {
|
|
1070
|
+
return local.selectionManager.firstSelectedKey() ?? "";
|
|
1071
|
+
}
|
|
1072
|
+
}, others), () => [
|
|
1073
|
+
ssr(_tmpl$2$1),
|
|
1074
|
+
"<!--$-->",
|
|
1075
|
+
escape(createComponent(Show, {
|
|
1076
|
+
get when() {
|
|
1077
|
+
return local.isVirtualized;
|
|
1078
|
+
},
|
|
1079
|
+
get fallback() {
|
|
1080
|
+
return createComponent(For, {
|
|
1081
|
+
get each() {
|
|
1082
|
+
return [...local.collection.getKeys()];
|
|
1083
|
+
},
|
|
1084
|
+
children: renderOption
|
|
1085
|
+
});
|
|
1086
|
+
},
|
|
1087
|
+
get children() {
|
|
1088
|
+
return createComponent(For, {
|
|
1089
|
+
get each() {
|
|
1090
|
+
return [...local.selectionManager.selectedKeys()];
|
|
1091
|
+
},
|
|
1092
|
+
children: renderOption
|
|
1093
|
+
});
|
|
1094
|
+
}
|
|
1095
|
+
})),
|
|
1096
|
+
"<!--/-->"
|
|
1097
|
+
], false));
|
|
1098
|
+
}
|
|
1099
|
+
var cache = /* @__PURE__ */ new WeakMap();
|
|
1100
|
+
function getItemCount(collection) {
|
|
1101
|
+
let count = cache.get(collection);
|
|
1102
|
+
if (count != null) return count;
|
|
1103
|
+
count = 0;
|
|
1104
|
+
for (const item of collection) if (item.type === "item") count++;
|
|
1105
|
+
cache.set(collection, count);
|
|
1106
|
+
return count;
|
|
1107
|
+
}
|
|
1108
|
+
var ListKeyboardDelegate = class {
|
|
1109
|
+
collection;
|
|
1110
|
+
ref;
|
|
1111
|
+
collator;
|
|
1112
|
+
constructor(collection, ref, collator) {
|
|
1113
|
+
this.collection = collection;
|
|
1114
|
+
this.ref = ref;
|
|
1115
|
+
this.collator = collator;
|
|
1116
|
+
}
|
|
1117
|
+
getKeyBelow(key) {
|
|
1118
|
+
let keyAfter = this.collection().getKeyAfter(key);
|
|
1119
|
+
while (keyAfter != null) {
|
|
1120
|
+
const item = this.collection().getItem(keyAfter);
|
|
1121
|
+
if (item && item.type === "item" && !item.disabled) return keyAfter;
|
|
1122
|
+
keyAfter = this.collection().getKeyAfter(keyAfter);
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
getKeyAbove(key) {
|
|
1126
|
+
let keyBefore = this.collection().getKeyBefore(key);
|
|
1127
|
+
while (keyBefore != null) {
|
|
1128
|
+
const item = this.collection().getItem(keyBefore);
|
|
1129
|
+
if (item && item.type === "item" && !item.disabled) return keyBefore;
|
|
1130
|
+
keyBefore = this.collection().getKeyBefore(keyBefore);
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
getFirstKey() {
|
|
1134
|
+
let key = this.collection().getFirstKey();
|
|
1135
|
+
while (key != null) {
|
|
1136
|
+
const item = this.collection().getItem(key);
|
|
1137
|
+
if (item && item.type === "item" && !item.disabled) return key;
|
|
1138
|
+
key = this.collection().getKeyAfter(key);
|
|
1139
|
+
}
|
|
1140
|
+
}
|
|
1141
|
+
getLastKey() {
|
|
1142
|
+
let key = this.collection().getLastKey();
|
|
1143
|
+
while (key != null) {
|
|
1144
|
+
const item = this.collection().getItem(key);
|
|
1145
|
+
if (item && item.type === "item" && !item.disabled) return key;
|
|
1146
|
+
key = this.collection().getKeyBefore(key);
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
1149
|
+
getItem(key) {
|
|
1150
|
+
return this.ref?.()?.querySelector(`[data-key="${key}"]`) ?? null;
|
|
1151
|
+
}
|
|
1152
|
+
getKeyPageAbove(key) {
|
|
1153
|
+
const menu = this.ref?.();
|
|
1154
|
+
let item = this.getItem(key);
|
|
1155
|
+
if (!menu || !item) return;
|
|
1156
|
+
const pageY = Math.max(0, item.offsetTop + item.offsetHeight - menu.offsetHeight);
|
|
1157
|
+
let keyAbove = key;
|
|
1158
|
+
while (keyAbove && item && item.offsetTop > pageY) {
|
|
1159
|
+
keyAbove = this.getKeyAbove(keyAbove);
|
|
1160
|
+
item = keyAbove != null ? this.getItem(keyAbove) : null;
|
|
1161
|
+
}
|
|
1162
|
+
return keyAbove;
|
|
1163
|
+
}
|
|
1164
|
+
getKeyPageBelow(key) {
|
|
1165
|
+
const menu = this.ref?.();
|
|
1166
|
+
let item = this.getItem(key);
|
|
1167
|
+
if (!menu || !item) return;
|
|
1168
|
+
const pageY = Math.min(menu.scrollHeight, item.offsetTop - item.offsetHeight + menu.offsetHeight);
|
|
1169
|
+
let keyBelow = key;
|
|
1170
|
+
while (keyBelow && item && item.offsetTop < pageY) {
|
|
1171
|
+
keyBelow = this.getKeyBelow(keyBelow);
|
|
1172
|
+
item = keyBelow != null ? this.getItem(keyBelow) : null;
|
|
1173
|
+
}
|
|
1174
|
+
return keyBelow;
|
|
1175
|
+
}
|
|
1176
|
+
getKeyForSearch(search, fromKey) {
|
|
1177
|
+
const collator = this.collator?.();
|
|
1178
|
+
if (!collator) return;
|
|
1179
|
+
let key = fromKey != null ? this.getKeyBelow(fromKey) : this.getFirstKey();
|
|
1180
|
+
while (key != null) {
|
|
1181
|
+
const item = this.collection().getItem(key);
|
|
1182
|
+
if (item) {
|
|
1183
|
+
const substring = item.textValue.slice(0, search.length);
|
|
1184
|
+
if (item.textValue && collator.compare(substring, search) === 0) return key;
|
|
1185
|
+
}
|
|
1186
|
+
key = this.getKeyBelow(key);
|
|
1187
|
+
}
|
|
1188
|
+
}
|
|
1189
|
+
};
|
|
1190
|
+
function createSelectableList(props, ref, scrollRef) {
|
|
1191
|
+
const collator = createCollator({
|
|
1192
|
+
usage: "search",
|
|
1193
|
+
sensitivity: "base"
|
|
1194
|
+
});
|
|
1195
|
+
return createSelectableCollection({
|
|
1196
|
+
selectionManager: () => access$1(props.selectionManager),
|
|
1197
|
+
keyboardDelegate: createMemo(() => {
|
|
1198
|
+
const keyboardDelegate = access$1(props.keyboardDelegate);
|
|
1199
|
+
if (keyboardDelegate) return keyboardDelegate;
|
|
1200
|
+
return new ListKeyboardDelegate(props.collection, ref, collator);
|
|
1201
|
+
}),
|
|
1202
|
+
autoFocus: () => access$1(props.autoFocus),
|
|
1203
|
+
deferAutoFocus: () => access$1(props.deferAutoFocus),
|
|
1204
|
+
shouldFocusWrap: () => access$1(props.shouldFocusWrap),
|
|
1205
|
+
disallowEmptySelection: () => access$1(props.disallowEmptySelection),
|
|
1206
|
+
selectOnFocus: () => access$1(props.selectOnFocus),
|
|
1207
|
+
disallowTypeAhead: () => access$1(props.disallowTypeAhead),
|
|
1208
|
+
shouldUseVirtualFocus: () => access$1(props.shouldUseVirtualFocus),
|
|
1209
|
+
allowsTabNavigation: () => access$1(props.allowsTabNavigation),
|
|
1210
|
+
isVirtualized: () => access$1(props.isVirtualized),
|
|
1211
|
+
scrollToKey: (key) => access$1(props.scrollToKey)?.(key),
|
|
1212
|
+
orientation: () => access$1(props.orientation)
|
|
1213
|
+
}, ref, scrollRef);
|
|
1214
|
+
}
|
|
1215
|
+
__export({}, {
|
|
1216
|
+
Item: () => ListboxItem,
|
|
1217
|
+
ItemDescription: () => ListboxItemDescription,
|
|
1218
|
+
ItemIndicator: () => ListboxItemIndicator,
|
|
1219
|
+
ItemLabel: () => ListboxItemLabel,
|
|
1220
|
+
Listbox: () => Listbox,
|
|
1221
|
+
Root: () => ListboxRoot,
|
|
1222
|
+
Section: () => ListboxSection,
|
|
1223
|
+
useListboxContext: () => useListboxContext
|
|
1224
|
+
});
|
|
1225
|
+
var ListboxContext = createContext();
|
|
1226
|
+
function useListboxContext() {
|
|
1227
|
+
const context = useContext(ListboxContext);
|
|
1228
|
+
if (context === void 0) throw new Error("[kobalte]: `useListboxContext` must be used within a `Listbox` component");
|
|
1229
|
+
return context;
|
|
1230
|
+
}
|
|
1231
|
+
var ListboxItemContext = createContext();
|
|
1232
|
+
function useListboxItemContext() {
|
|
1233
|
+
const context = useContext(ListboxItemContext);
|
|
1234
|
+
if (context === void 0) throw new Error("[kobalte]: `useListboxItemContext` must be used within a `Listbox.Item` component");
|
|
1235
|
+
return context;
|
|
1236
|
+
}
|
|
1237
|
+
function ListboxItem(props) {
|
|
1238
|
+
let ref;
|
|
1239
|
+
const listBoxContext = useListboxContext();
|
|
1240
|
+
const [local, others] = splitProps(mergeDefaultProps({ id: `${listBoxContext.generateId("item")}-${createUniqueId()}` }, props), [
|
|
1241
|
+
"ref",
|
|
1242
|
+
"item",
|
|
1243
|
+
"aria-label",
|
|
1244
|
+
"aria-labelledby",
|
|
1245
|
+
"aria-describedby",
|
|
1246
|
+
"onPointerMove",
|
|
1247
|
+
"onPointerDown",
|
|
1248
|
+
"onPointerUp",
|
|
1249
|
+
"onClick",
|
|
1250
|
+
"onKeyDown",
|
|
1251
|
+
"onMouseDown",
|
|
1252
|
+
"onFocus"
|
|
1253
|
+
]);
|
|
1254
|
+
const [labelId, setLabelId] = createSignal();
|
|
1255
|
+
const [descriptionId, setDescriptionId] = createSignal();
|
|
1256
|
+
const selectionManager = () => listBoxContext.listState().selectionManager();
|
|
1257
|
+
const isHighlighted = () => selectionManager().focusedKey() === local.item.key;
|
|
1258
|
+
const selectableItem = createSelectableItem({
|
|
1259
|
+
key: () => local.item.key,
|
|
1260
|
+
selectionManager,
|
|
1261
|
+
shouldSelectOnPressUp: listBoxContext.shouldSelectOnPressUp,
|
|
1262
|
+
allowsDifferentPressOrigin: () => {
|
|
1263
|
+
return listBoxContext.shouldSelectOnPressUp() && listBoxContext.shouldFocusOnHover();
|
|
1264
|
+
},
|
|
1265
|
+
shouldUseVirtualFocus: listBoxContext.shouldUseVirtualFocus,
|
|
1266
|
+
disabled: () => local.item.disabled
|
|
1267
|
+
}, () => ref);
|
|
1268
|
+
const ariaSelected = () => {
|
|
1269
|
+
if (selectionManager().selectionMode() === "none") return;
|
|
1270
|
+
return selectableItem.isSelected();
|
|
1271
|
+
};
|
|
1272
|
+
const isNotSafariMacOS = createMemo(() => !(isMac() && isWebKit$1()));
|
|
1273
|
+
const ariaLabel = () => isNotSafariMacOS() ? local["aria-label"] : void 0;
|
|
1274
|
+
const ariaLabelledBy = () => isNotSafariMacOS() ? labelId() : void 0;
|
|
1275
|
+
const ariaDescribedBy = () => isNotSafariMacOS() ? descriptionId() : void 0;
|
|
1276
|
+
const ariaPosInSet = () => {
|
|
1277
|
+
if (!listBoxContext.isVirtualized()) return;
|
|
1278
|
+
const index = listBoxContext.listState().collection().getItem(local.item.key)?.index;
|
|
1279
|
+
return index != null ? index + 1 : void 0;
|
|
1280
|
+
};
|
|
1281
|
+
const ariaSetSize = () => {
|
|
1282
|
+
if (!listBoxContext.isVirtualized()) return;
|
|
1283
|
+
return getItemCount(listBoxContext.listState().collection());
|
|
1284
|
+
};
|
|
1285
|
+
const onPointerMove = (e) => {
|
|
1286
|
+
callHandler(e, local.onPointerMove);
|
|
1287
|
+
if (e.pointerType !== "mouse") return;
|
|
1288
|
+
if (!selectableItem.isDisabled() && listBoxContext.shouldFocusOnHover()) {
|
|
1289
|
+
focusWithoutScrolling(e.currentTarget);
|
|
1290
|
+
selectionManager().setFocused(true);
|
|
1291
|
+
selectionManager().setFocusedKey(local.item.key);
|
|
1292
|
+
}
|
|
1293
|
+
};
|
|
1294
|
+
const dataset = createMemo(() => ({
|
|
1295
|
+
"data-disabled": selectableItem.isDisabled() ? "" : void 0,
|
|
1296
|
+
"data-selected": selectableItem.isSelected() ? "" : void 0,
|
|
1297
|
+
"data-highlighted": isHighlighted() ? "" : void 0
|
|
1298
|
+
}));
|
|
1299
|
+
const context = {
|
|
1300
|
+
isSelected: selectableItem.isSelected,
|
|
1301
|
+
dataset,
|
|
1302
|
+
generateId: createGenerateId(() => others.id),
|
|
1303
|
+
registerLabelId: createRegisterId(setLabelId),
|
|
1304
|
+
registerDescriptionId: createRegisterId(setDescriptionId)
|
|
1305
|
+
};
|
|
1306
|
+
return createComponent(ListboxItemContext.Provider, {
|
|
1307
|
+
value: context,
|
|
1308
|
+
get children() {
|
|
1309
|
+
return createComponent(Polymorphic, mergeProps({
|
|
1310
|
+
as: "li",
|
|
1311
|
+
role: "option",
|
|
1312
|
+
get tabIndex() {
|
|
1313
|
+
return selectableItem.tabIndex();
|
|
1314
|
+
},
|
|
1315
|
+
get ["aria-disabled"]() {
|
|
1316
|
+
return selectableItem.isDisabled();
|
|
1317
|
+
},
|
|
1318
|
+
get ["aria-selected"]() {
|
|
1319
|
+
return ariaSelected();
|
|
1320
|
+
},
|
|
1321
|
+
get ["aria-label"]() {
|
|
1322
|
+
return ariaLabel();
|
|
1323
|
+
},
|
|
1324
|
+
get ["aria-labelledby"]() {
|
|
1325
|
+
return ariaLabelledBy();
|
|
1326
|
+
},
|
|
1327
|
+
get ["aria-describedby"]() {
|
|
1328
|
+
return ariaDescribedBy();
|
|
1329
|
+
},
|
|
1330
|
+
get ["aria-posinset"]() {
|
|
1331
|
+
return ariaPosInSet();
|
|
1332
|
+
},
|
|
1333
|
+
get ["aria-setsize"]() {
|
|
1334
|
+
return ariaSetSize();
|
|
1335
|
+
},
|
|
1336
|
+
get ["data-key"]() {
|
|
1337
|
+
return selectableItem.dataKey();
|
|
1338
|
+
},
|
|
1339
|
+
get onPointerDown() {
|
|
1340
|
+
return composeEventHandlers([local.onPointerDown, selectableItem.onPointerDown]);
|
|
1341
|
+
},
|
|
1342
|
+
get onPointerUp() {
|
|
1343
|
+
return composeEventHandlers([local.onPointerUp, selectableItem.onPointerUp]);
|
|
1344
|
+
},
|
|
1345
|
+
get onClick() {
|
|
1346
|
+
return composeEventHandlers([local.onClick, selectableItem.onClick]);
|
|
1347
|
+
},
|
|
1348
|
+
get onKeyDown() {
|
|
1349
|
+
return composeEventHandlers([local.onKeyDown, selectableItem.onKeyDown]);
|
|
1350
|
+
},
|
|
1351
|
+
get onMouseDown() {
|
|
1352
|
+
return composeEventHandlers([local.onMouseDown, selectableItem.onMouseDown]);
|
|
1353
|
+
},
|
|
1354
|
+
get onFocus() {
|
|
1355
|
+
return composeEventHandlers([local.onFocus, selectableItem.onFocus]);
|
|
1356
|
+
},
|
|
1357
|
+
onPointerMove
|
|
1358
|
+
}, dataset, others));
|
|
1359
|
+
}
|
|
1360
|
+
});
|
|
1361
|
+
}
|
|
1362
|
+
function ListboxItemDescription(props) {
|
|
1363
|
+
const context = useListboxItemContext();
|
|
1364
|
+
const mergedProps = mergeDefaultProps({ id: context.generateId("description") }, props);
|
|
1365
|
+
createEffect(() => onCleanup(context.registerDescriptionId(mergedProps.id)));
|
|
1366
|
+
return createComponent(Polymorphic, mergeProps({ as: "div" }, () => context.dataset(), mergedProps));
|
|
1367
|
+
}
|
|
1368
|
+
function ListboxItemIndicator(props) {
|
|
1369
|
+
const context = useListboxItemContext();
|
|
1370
|
+
const [local, others] = splitProps(mergeDefaultProps({ id: context.generateId("indicator") }, props), ["forceMount"]);
|
|
1371
|
+
return createComponent(Show, {
|
|
1372
|
+
get when() {
|
|
1373
|
+
return local.forceMount || context.isSelected();
|
|
1374
|
+
},
|
|
1375
|
+
get children() {
|
|
1376
|
+
return createComponent(Polymorphic, mergeProps({
|
|
1377
|
+
as: "div",
|
|
1378
|
+
"aria-hidden": "true"
|
|
1379
|
+
}, () => context.dataset(), others));
|
|
1380
|
+
}
|
|
1381
|
+
});
|
|
1382
|
+
}
|
|
1383
|
+
function ListboxItemLabel(props) {
|
|
1384
|
+
const context = useListboxItemContext();
|
|
1385
|
+
const mergedProps = mergeDefaultProps({ id: context.generateId("label") }, props);
|
|
1386
|
+
createEffect(() => onCleanup(context.registerLabelId(mergedProps.id)));
|
|
1387
|
+
return createComponent(Polymorphic, mergeProps({ as: "div" }, () => context.dataset(), mergedProps));
|
|
1388
|
+
}
|
|
1389
|
+
function ListboxRoot(props) {
|
|
1390
|
+
let ref;
|
|
1391
|
+
const mergedProps = mergeDefaultProps({
|
|
1392
|
+
id: `listbox-${createUniqueId()}`,
|
|
1393
|
+
selectionMode: "single",
|
|
1394
|
+
virtualized: false
|
|
1395
|
+
}, props);
|
|
1396
|
+
const [local, others] = splitProps(mergedProps, [
|
|
1397
|
+
"ref",
|
|
1398
|
+
"children",
|
|
1399
|
+
"renderItem",
|
|
1400
|
+
"renderSection",
|
|
1401
|
+
"value",
|
|
1402
|
+
"defaultValue",
|
|
1403
|
+
"onChange",
|
|
1404
|
+
"options",
|
|
1405
|
+
"optionValue",
|
|
1406
|
+
"optionTextValue",
|
|
1407
|
+
"optionDisabled",
|
|
1408
|
+
"optionGroupChildren",
|
|
1409
|
+
"state",
|
|
1410
|
+
"keyboardDelegate",
|
|
1411
|
+
"autoFocus",
|
|
1412
|
+
"selectionMode",
|
|
1413
|
+
"shouldFocusWrap",
|
|
1414
|
+
"shouldUseVirtualFocus",
|
|
1415
|
+
"shouldSelectOnPressUp",
|
|
1416
|
+
"shouldFocusOnHover",
|
|
1417
|
+
"allowDuplicateSelectionEvents",
|
|
1418
|
+
"disallowEmptySelection",
|
|
1419
|
+
"selectionBehavior",
|
|
1420
|
+
"selectOnFocus",
|
|
1421
|
+
"disallowTypeAhead",
|
|
1422
|
+
"allowsTabNavigation",
|
|
1423
|
+
"virtualized",
|
|
1424
|
+
"scrollToItem",
|
|
1425
|
+
"scrollRef",
|
|
1426
|
+
"onKeyDown",
|
|
1427
|
+
"onMouseDown",
|
|
1428
|
+
"onFocusIn",
|
|
1429
|
+
"onFocusOut"
|
|
1430
|
+
]);
|
|
1431
|
+
const listState = createMemo(() => {
|
|
1432
|
+
if (local.state) return local.state;
|
|
1433
|
+
return createListState({
|
|
1434
|
+
selectedKeys: () => local.value,
|
|
1435
|
+
defaultSelectedKeys: () => local.defaultValue,
|
|
1436
|
+
onSelectionChange: local.onChange,
|
|
1437
|
+
allowDuplicateSelectionEvents: () => access$1(local.allowDuplicateSelectionEvents),
|
|
1438
|
+
disallowEmptySelection: () => access$1(local.disallowEmptySelection),
|
|
1439
|
+
selectionBehavior: () => access$1(local.selectionBehavior),
|
|
1440
|
+
selectionMode: () => access$1(local.selectionMode),
|
|
1441
|
+
dataSource: () => local.options ?? [],
|
|
1442
|
+
getKey: () => local.optionValue,
|
|
1443
|
+
getTextValue: () => local.optionTextValue,
|
|
1444
|
+
getDisabled: () => local.optionDisabled,
|
|
1445
|
+
getSectionChildren: () => local.optionGroupChildren
|
|
1446
|
+
});
|
|
1447
|
+
});
|
|
1448
|
+
const selectableList = createSelectableList({
|
|
1449
|
+
selectionManager: () => listState().selectionManager(),
|
|
1450
|
+
collection: () => listState().collection(),
|
|
1451
|
+
autoFocus: () => access$1(local.autoFocus),
|
|
1452
|
+
shouldFocusWrap: () => access$1(local.shouldFocusWrap),
|
|
1453
|
+
keyboardDelegate: () => local.keyboardDelegate,
|
|
1454
|
+
disallowEmptySelection: () => access$1(local.disallowEmptySelection),
|
|
1455
|
+
selectOnFocus: () => access$1(local.selectOnFocus),
|
|
1456
|
+
disallowTypeAhead: () => access$1(local.disallowTypeAhead),
|
|
1457
|
+
shouldUseVirtualFocus: () => access$1(local.shouldUseVirtualFocus),
|
|
1458
|
+
allowsTabNavigation: () => access$1(local.allowsTabNavigation),
|
|
1459
|
+
isVirtualized: () => local.virtualized,
|
|
1460
|
+
scrollToKey: () => local.scrollToItem
|
|
1461
|
+
}, () => ref, () => local.scrollRef?.());
|
|
1462
|
+
const context = {
|
|
1463
|
+
listState,
|
|
1464
|
+
generateId: createGenerateId(() => others.id),
|
|
1465
|
+
shouldUseVirtualFocus: () => mergedProps.shouldUseVirtualFocus,
|
|
1466
|
+
shouldSelectOnPressUp: () => mergedProps.shouldSelectOnPressUp,
|
|
1467
|
+
shouldFocusOnHover: () => mergedProps.shouldFocusOnHover,
|
|
1468
|
+
isVirtualized: () => local.virtualized
|
|
1469
|
+
};
|
|
1470
|
+
return createComponent(ListboxContext.Provider, {
|
|
1471
|
+
value: context,
|
|
1472
|
+
get children() {
|
|
1473
|
+
return createComponent(Polymorphic, mergeProps({
|
|
1474
|
+
as: "ul",
|
|
1475
|
+
role: "listbox",
|
|
1476
|
+
get tabIndex() {
|
|
1477
|
+
return selectableList.tabIndex();
|
|
1478
|
+
},
|
|
1479
|
+
get ["aria-multiselectable"]() {
|
|
1480
|
+
return listState().selectionManager().selectionMode() === "multiple" ? true : void 0;
|
|
1481
|
+
},
|
|
1482
|
+
get onKeyDown() {
|
|
1483
|
+
return composeEventHandlers([local.onKeyDown, selectableList.onKeyDown]);
|
|
1484
|
+
},
|
|
1485
|
+
get onMouseDown() {
|
|
1486
|
+
return composeEventHandlers([local.onMouseDown, selectableList.onMouseDown]);
|
|
1487
|
+
},
|
|
1488
|
+
get onFocusIn() {
|
|
1489
|
+
return composeEventHandlers([local.onFocusIn, selectableList.onFocusIn]);
|
|
1490
|
+
},
|
|
1491
|
+
get onFocusOut() {
|
|
1492
|
+
return composeEventHandlers([local.onFocusOut, selectableList.onFocusOut]);
|
|
1493
|
+
}
|
|
1494
|
+
}, others, { get children() {
|
|
1495
|
+
return createComponent(Show, {
|
|
1496
|
+
get when() {
|
|
1497
|
+
return !local.virtualized;
|
|
1498
|
+
},
|
|
1499
|
+
get fallback() {
|
|
1500
|
+
return local.children?.(listState().collection);
|
|
1501
|
+
},
|
|
1502
|
+
get children() {
|
|
1503
|
+
return createComponent(Key, {
|
|
1504
|
+
get each() {
|
|
1505
|
+
return [...listState().collection()];
|
|
1506
|
+
},
|
|
1507
|
+
by: "key",
|
|
1508
|
+
children: (item) => createComponent(Switch, { get children() {
|
|
1509
|
+
return [createComponent(Match, {
|
|
1510
|
+
get when() {
|
|
1511
|
+
return item().type === "section";
|
|
1512
|
+
},
|
|
1513
|
+
get children() {
|
|
1514
|
+
return local.renderSection?.(item());
|
|
1515
|
+
}
|
|
1516
|
+
}), createComponent(Match, {
|
|
1517
|
+
get when() {
|
|
1518
|
+
return item().type === "item";
|
|
1519
|
+
},
|
|
1520
|
+
get children() {
|
|
1521
|
+
return local.renderItem?.(item());
|
|
1522
|
+
}
|
|
1523
|
+
})];
|
|
1524
|
+
} })
|
|
1525
|
+
});
|
|
1526
|
+
}
|
|
1527
|
+
});
|
|
1528
|
+
} }));
|
|
1529
|
+
}
|
|
1530
|
+
});
|
|
1531
|
+
}
|
|
1532
|
+
function ListboxSection(props) {
|
|
1533
|
+
return createComponent(Polymorphic, mergeProps({
|
|
1534
|
+
as: "li",
|
|
1535
|
+
role: "presentation"
|
|
1536
|
+
}, props));
|
|
1537
|
+
}
|
|
1538
|
+
var Listbox = Object.assign(ListboxRoot, {
|
|
1539
|
+
Item: ListboxItem,
|
|
1540
|
+
ItemDescription: ListboxItemDescription,
|
|
1541
|
+
ItemIndicator: ListboxItemIndicator,
|
|
1542
|
+
ItemLabel: ListboxItemLabel,
|
|
1543
|
+
Section: ListboxSection
|
|
1544
|
+
});
|
|
1545
|
+
/**
|
|
1546
|
+
* Custom positioning reference element.
|
|
1547
|
+
* @see https://floating-ui.com/docs/virtual-elements
|
|
1548
|
+
*/
|
|
1549
|
+
var sides = [
|
|
1550
|
+
"top",
|
|
1551
|
+
"right",
|
|
1552
|
+
"bottom",
|
|
1553
|
+
"left"
|
|
1554
|
+
];
|
|
1555
|
+
var min = Math.min;
|
|
1556
|
+
var max = Math.max;
|
|
1557
|
+
var round = Math.round;
|
|
1558
|
+
var floor = Math.floor;
|
|
1559
|
+
var createCoords = (v) => ({
|
|
1560
|
+
x: v,
|
|
1561
|
+
y: v
|
|
1562
|
+
});
|
|
1563
|
+
var oppositeSideMap = {
|
|
1564
|
+
left: "right",
|
|
1565
|
+
right: "left",
|
|
1566
|
+
bottom: "top",
|
|
1567
|
+
top: "bottom"
|
|
1568
|
+
};
|
|
1569
|
+
function clamp(start, value, end) {
|
|
1570
|
+
return max(start, min(value, end));
|
|
1571
|
+
}
|
|
1572
|
+
function evaluate(value, param) {
|
|
1573
|
+
return typeof value === "function" ? value(param) : value;
|
|
1574
|
+
}
|
|
1575
|
+
function getSide(placement) {
|
|
1576
|
+
return placement.split("-")[0];
|
|
1577
|
+
}
|
|
1578
|
+
function getAlignment(placement) {
|
|
1579
|
+
return placement.split("-")[1];
|
|
1580
|
+
}
|
|
1581
|
+
function getOppositeAxis(axis) {
|
|
1582
|
+
return axis === "x" ? "y" : "x";
|
|
1583
|
+
}
|
|
1584
|
+
function getAxisLength(axis) {
|
|
1585
|
+
return axis === "y" ? "height" : "width";
|
|
1586
|
+
}
|
|
1587
|
+
function getSideAxis(placement) {
|
|
1588
|
+
const firstChar = placement[0];
|
|
1589
|
+
return firstChar === "t" || firstChar === "b" ? "y" : "x";
|
|
1590
|
+
}
|
|
1591
|
+
function getAlignmentAxis(placement) {
|
|
1592
|
+
return getOppositeAxis(getSideAxis(placement));
|
|
1593
|
+
}
|
|
1594
|
+
function getAlignmentSides(placement, rects, rtl) {
|
|
1595
|
+
if (rtl === void 0) rtl = false;
|
|
1596
|
+
const alignment = getAlignment(placement);
|
|
1597
|
+
const alignmentAxis = getAlignmentAxis(placement);
|
|
1598
|
+
const length = getAxisLength(alignmentAxis);
|
|
1599
|
+
let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top";
|
|
1600
|
+
if (rects.reference[length] > rects.floating[length]) mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
|
|
1601
|
+
return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
|
|
1602
|
+
}
|
|
1603
|
+
function getExpandedPlacements(placement) {
|
|
1604
|
+
const oppositePlacement = getOppositePlacement(placement);
|
|
1605
|
+
return [
|
|
1606
|
+
getOppositeAlignmentPlacement(placement),
|
|
1607
|
+
oppositePlacement,
|
|
1608
|
+
getOppositeAlignmentPlacement(oppositePlacement)
|
|
1609
|
+
];
|
|
1610
|
+
}
|
|
1611
|
+
function getOppositeAlignmentPlacement(placement) {
|
|
1612
|
+
return placement.includes("start") ? placement.replace("start", "end") : placement.replace("end", "start");
|
|
1613
|
+
}
|
|
1614
|
+
var lrPlacement = ["left", "right"];
|
|
1615
|
+
var rlPlacement = ["right", "left"];
|
|
1616
|
+
var tbPlacement = ["top", "bottom"];
|
|
1617
|
+
var btPlacement = ["bottom", "top"];
|
|
1618
|
+
function getSideList(side, isStart, rtl) {
|
|
1619
|
+
switch (side) {
|
|
1620
|
+
case "top":
|
|
1621
|
+
case "bottom":
|
|
1622
|
+
if (rtl) return isStart ? rlPlacement : lrPlacement;
|
|
1623
|
+
return isStart ? lrPlacement : rlPlacement;
|
|
1624
|
+
case "left":
|
|
1625
|
+
case "right": return isStart ? tbPlacement : btPlacement;
|
|
1626
|
+
default: return [];
|
|
1627
|
+
}
|
|
1628
|
+
}
|
|
1629
|
+
function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
|
|
1630
|
+
const alignment = getAlignment(placement);
|
|
1631
|
+
let list = getSideList(getSide(placement), direction === "start", rtl);
|
|
1632
|
+
if (alignment) {
|
|
1633
|
+
list = list.map((side) => side + "-" + alignment);
|
|
1634
|
+
if (flipAlignment) list = list.concat(list.map(getOppositeAlignmentPlacement));
|
|
1635
|
+
}
|
|
1636
|
+
return list;
|
|
1637
|
+
}
|
|
1638
|
+
function getOppositePlacement(placement) {
|
|
1639
|
+
const side = getSide(placement);
|
|
1640
|
+
return oppositeSideMap[side] + placement.slice(side.length);
|
|
1641
|
+
}
|
|
1642
|
+
function expandPaddingObject(padding) {
|
|
1643
|
+
var _padding$top, _padding$right, _padding$bottom, _padding$left;
|
|
1644
|
+
return {
|
|
1645
|
+
top: (_padding$top = padding.top) != null ? _padding$top : 0,
|
|
1646
|
+
right: (_padding$right = padding.right) != null ? _padding$right : 0,
|
|
1647
|
+
bottom: (_padding$bottom = padding.bottom) != null ? _padding$bottom : 0,
|
|
1648
|
+
left: (_padding$left = padding.left) != null ? _padding$left : 0
|
|
1649
|
+
};
|
|
1650
|
+
}
|
|
1651
|
+
function getPaddingObject(padding) {
|
|
1652
|
+
return typeof padding !== "number" ? expandPaddingObject(padding) : {
|
|
1653
|
+
top: padding,
|
|
1654
|
+
right: padding,
|
|
1655
|
+
bottom: padding,
|
|
1656
|
+
left: padding
|
|
1657
|
+
};
|
|
1658
|
+
}
|
|
1659
|
+
function rectToClientRect(rect) {
|
|
1660
|
+
const { x, y, width, height } = rect;
|
|
1661
|
+
return {
|
|
1662
|
+
width,
|
|
1663
|
+
height,
|
|
1664
|
+
top: y,
|
|
1665
|
+
left: x,
|
|
1666
|
+
right: x + width,
|
|
1667
|
+
bottom: y + height,
|
|
1668
|
+
x,
|
|
1669
|
+
y
|
|
1670
|
+
};
|
|
1671
|
+
}
|
|
1672
|
+
function computeCoordsFromPlacement(_ref, placement, rtl) {
|
|
1673
|
+
let { reference, floating } = _ref;
|
|
1674
|
+
const sideAxis = getSideAxis(placement);
|
|
1675
|
+
const alignmentAxis = getAlignmentAxis(placement);
|
|
1676
|
+
const alignLength = getAxisLength(alignmentAxis);
|
|
1677
|
+
const side = getSide(placement);
|
|
1678
|
+
const isVertical = sideAxis === "y";
|
|
1679
|
+
const commonX = reference.x + reference.width / 2 - floating.width / 2;
|
|
1680
|
+
const commonY = reference.y + reference.height / 2 - floating.height / 2;
|
|
1681
|
+
const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
|
|
1682
|
+
let coords;
|
|
1683
|
+
switch (side) {
|
|
1684
|
+
case "top":
|
|
1685
|
+
coords = {
|
|
1686
|
+
x: commonX,
|
|
1687
|
+
y: reference.y - floating.height
|
|
1688
|
+
};
|
|
1689
|
+
break;
|
|
1690
|
+
case "bottom":
|
|
1691
|
+
coords = {
|
|
1692
|
+
x: commonX,
|
|
1693
|
+
y: reference.y + reference.height
|
|
1694
|
+
};
|
|
1695
|
+
break;
|
|
1696
|
+
case "right":
|
|
1697
|
+
coords = {
|
|
1698
|
+
x: reference.x + reference.width,
|
|
1699
|
+
y: commonY
|
|
1700
|
+
};
|
|
1701
|
+
break;
|
|
1702
|
+
case "left":
|
|
1703
|
+
coords = {
|
|
1704
|
+
x: reference.x - floating.width,
|
|
1705
|
+
y: commonY
|
|
1706
|
+
};
|
|
1707
|
+
break;
|
|
1708
|
+
default: coords = {
|
|
1709
|
+
x: reference.x,
|
|
1710
|
+
y: reference.y
|
|
1711
|
+
};
|
|
1712
|
+
}
|
|
1713
|
+
const alignment = getAlignment(placement);
|
|
1714
|
+
if (alignment) coords[alignmentAxis] += commonAlign * (alignment === "end" ? 1 : -1) * (rtl && isVertical ? -1 : 1);
|
|
1715
|
+
return coords;
|
|
1716
|
+
}
|
|
1717
|
+
/**
|
|
1718
|
+
* Resolves with an object of overflow side offsets that determine how much the
|
|
1719
|
+
* element is overflowing a given clipping boundary on each side.
|
|
1720
|
+
* - positive = overflowing the boundary by that number of pixels
|
|
1721
|
+
* - negative = how many pixels left before it will overflow
|
|
1722
|
+
* - 0 = lies flush with the boundary
|
|
1723
|
+
* @see https://floating-ui.com/docs/detectOverflow
|
|
1724
|
+
*/
|
|
1725
|
+
async function detectOverflow(state, options) {
|
|
1726
|
+
var _await$platform$isEle;
|
|
1727
|
+
if (options === void 0) options = {};
|
|
1728
|
+
const { x, y, platform, rects, elements, strategy } = state;
|
|
1729
|
+
const { boundary = "clippingAncestors", rootBoundary = "viewport", elementContext = "floating", altBoundary = false, padding = 0 } = evaluate(options, state);
|
|
1730
|
+
const paddingObject = getPaddingObject(padding);
|
|
1731
|
+
const element = elements[altBoundary ? elementContext === "floating" ? "reference" : "floating" : elementContext];
|
|
1732
|
+
const clippingClientRect = rectToClientRect(await platform.getClippingRect({
|
|
1733
|
+
element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating)),
|
|
1734
|
+
boundary,
|
|
1735
|
+
rootBoundary,
|
|
1736
|
+
strategy
|
|
1737
|
+
}));
|
|
1738
|
+
const rect = elementContext === "floating" ? {
|
|
1739
|
+
x,
|
|
1740
|
+
y,
|
|
1741
|
+
width: rects.floating.width,
|
|
1742
|
+
height: rects.floating.height
|
|
1743
|
+
} : rects.reference;
|
|
1744
|
+
const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
|
|
1745
|
+
const offsetScale = await (platform.isElement == null ? void 0 : platform.isElement(offsetParent)) && await (platform.getScale == null ? void 0 : platform.getScale(offsetParent)) || {
|
|
1746
|
+
x: 1,
|
|
1747
|
+
y: 1
|
|
1748
|
+
};
|
|
1749
|
+
const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
1750
|
+
elements,
|
|
1751
|
+
rect,
|
|
1752
|
+
offsetParent,
|
|
1753
|
+
strategy
|
|
1754
|
+
}) : rect);
|
|
1755
|
+
return {
|
|
1756
|
+
top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
|
|
1757
|
+
bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
|
|
1758
|
+
left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
|
|
1759
|
+
right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
|
|
1760
|
+
};
|
|
1761
|
+
}
|
|
1762
|
+
var MAX_RESET_COUNT = 50;
|
|
1763
|
+
/**
|
|
1764
|
+
* Computes the `x` and `y` coordinates that will place the floating element
|
|
1765
|
+
* next to a given reference element.
|
|
1766
|
+
*
|
|
1767
|
+
* This export does not have any `platform` interface logic. You will need to
|
|
1768
|
+
* write one for the platform you are using Floating UI with.
|
|
1769
|
+
*/
|
|
1770
|
+
var computePosition$1 = async (reference, floating, config) => {
|
|
1771
|
+
const { placement = "bottom", strategy = "absolute", middleware = [], platform } = config;
|
|
1772
|
+
const platformWithDetectOverflow = platform.detectOverflow ? platform : {
|
|
1773
|
+
...platform,
|
|
1774
|
+
detectOverflow
|
|
1775
|
+
};
|
|
1776
|
+
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
|
|
1777
|
+
let rects = await platform.getElementRects({
|
|
1778
|
+
reference,
|
|
1779
|
+
floating,
|
|
1780
|
+
strategy
|
|
1781
|
+
});
|
|
1782
|
+
let { x, y } = computeCoordsFromPlacement(rects, placement, rtl);
|
|
1783
|
+
let statefulPlacement = placement;
|
|
1784
|
+
let resetCount = 0;
|
|
1785
|
+
const middlewareData = {};
|
|
1786
|
+
for (let i = 0; i < middleware.length; i++) {
|
|
1787
|
+
const currentMiddleware = middleware[i];
|
|
1788
|
+
if (!currentMiddleware) continue;
|
|
1789
|
+
const { name, fn } = currentMiddleware;
|
|
1790
|
+
const { x: nextX, y: nextY, data, reset } = await fn({
|
|
1791
|
+
x,
|
|
1792
|
+
y,
|
|
1793
|
+
initialPlacement: placement,
|
|
1794
|
+
placement: statefulPlacement,
|
|
1795
|
+
strategy,
|
|
1796
|
+
middlewareData,
|
|
1797
|
+
rects,
|
|
1798
|
+
platform: platformWithDetectOverflow,
|
|
1799
|
+
elements: {
|
|
1800
|
+
reference,
|
|
1801
|
+
floating
|
|
1802
|
+
}
|
|
1803
|
+
});
|
|
1804
|
+
x = nextX != null ? nextX : x;
|
|
1805
|
+
y = nextY != null ? nextY : y;
|
|
1806
|
+
middlewareData[name] = {
|
|
1807
|
+
...middlewareData[name],
|
|
1808
|
+
...data
|
|
1809
|
+
};
|
|
1810
|
+
if (reset && resetCount < MAX_RESET_COUNT) {
|
|
1811
|
+
resetCount++;
|
|
1812
|
+
if (typeof reset === "object") {
|
|
1813
|
+
if (reset.placement) statefulPlacement = reset.placement;
|
|
1814
|
+
if (reset.rects) rects = reset.rects === true ? await platform.getElementRects({
|
|
1815
|
+
reference,
|
|
1816
|
+
floating,
|
|
1817
|
+
strategy
|
|
1818
|
+
}) : reset.rects;
|
|
1819
|
+
({x, y} = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
|
|
1820
|
+
}
|
|
1821
|
+
i = -1;
|
|
1822
|
+
}
|
|
1823
|
+
}
|
|
1824
|
+
return {
|
|
1825
|
+
x,
|
|
1826
|
+
y,
|
|
1827
|
+
placement: statefulPlacement,
|
|
1828
|
+
strategy,
|
|
1829
|
+
middlewareData
|
|
1830
|
+
};
|
|
1831
|
+
};
|
|
1832
|
+
/**
|
|
1833
|
+
* Provides data to position an inner element of the floating element so that it
|
|
1834
|
+
* appears centered to the reference element.
|
|
1835
|
+
* @see https://floating-ui.com/docs/arrow
|
|
1836
|
+
*/
|
|
1837
|
+
var arrow$1 = (options) => ({
|
|
1838
|
+
name: "arrow",
|
|
1839
|
+
options,
|
|
1840
|
+
async fn(state) {
|
|
1841
|
+
const { x, y, placement, rects, platform, elements, middlewareData } = state;
|
|
1842
|
+
const { element, padding = 0 } = evaluate(options, state) || {};
|
|
1843
|
+
if (element == null) return {};
|
|
1844
|
+
const paddingObject = getPaddingObject(padding);
|
|
1845
|
+
const coords = {
|
|
1846
|
+
x,
|
|
1847
|
+
y
|
|
1848
|
+
};
|
|
1849
|
+
const axis = getAlignmentAxis(placement);
|
|
1850
|
+
const length = getAxisLength(axis);
|
|
1851
|
+
const arrowDimensions = await platform.getDimensions(element);
|
|
1852
|
+
const isYAxis = axis === "y";
|
|
1853
|
+
const minProp = isYAxis ? "top" : "left";
|
|
1854
|
+
const maxProp = isYAxis ? "bottom" : "right";
|
|
1855
|
+
const clientProp = isYAxis ? "clientHeight" : "clientWidth";
|
|
1856
|
+
const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
|
|
1857
|
+
const startDiff = coords[axis] - rects.reference[axis];
|
|
1858
|
+
const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
|
|
1859
|
+
let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
|
|
1860
|
+
if (!clientSize || !await (platform.isElement == null ? void 0 : platform.isElement(arrowOffsetParent))) clientSize = elements.floating[clientProp] || rects.floating[length];
|
|
1861
|
+
const centerToReference = endDiff / 2 - startDiff / 2;
|
|
1862
|
+
const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
|
|
1863
|
+
const minPadding = min(paddingObject[minProp], largestPossiblePadding);
|
|
1864
|
+
const maxPadding = min(paddingObject[maxProp], largestPossiblePadding);
|
|
1865
|
+
const max = clientSize - arrowDimensions[length] - maxPadding;
|
|
1866
|
+
const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
|
|
1867
|
+
const offset = clamp(minPadding, center, max);
|
|
1868
|
+
const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset && rects.reference[length] / 2 - (center < minPadding ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
|
|
1869
|
+
const alignmentOffset = shouldAddOffset ? center < minPadding ? center - minPadding : center - max : 0;
|
|
1870
|
+
return {
|
|
1871
|
+
[axis]: coords[axis] + alignmentOffset,
|
|
1872
|
+
data: {
|
|
1873
|
+
[axis]: offset,
|
|
1874
|
+
centerOffset: center - offset - alignmentOffset,
|
|
1875
|
+
...shouldAddOffset && { alignmentOffset }
|
|
1876
|
+
},
|
|
1877
|
+
reset: shouldAddOffset
|
|
1878
|
+
};
|
|
1879
|
+
}
|
|
1880
|
+
});
|
|
1881
|
+
/**
|
|
1882
|
+
* Optimizes the visibility of the floating element by flipping the `placement`
|
|
1883
|
+
* in order to keep it in view when the preferred placement(s) will overflow the
|
|
1884
|
+
* clipping boundary. Alternative to `autoPlacement`.
|
|
1885
|
+
* @see https://floating-ui.com/docs/flip
|
|
1886
|
+
*/
|
|
1887
|
+
var flip$1 = function(options) {
|
|
1888
|
+
if (options === void 0) options = {};
|
|
1889
|
+
return {
|
|
1890
|
+
name: "flip",
|
|
1891
|
+
options,
|
|
1892
|
+
async fn(state) {
|
|
1893
|
+
var _middlewareData$arrow, _middlewareData$flip;
|
|
1894
|
+
const { placement, middlewareData, rects, initialPlacement, platform, elements } = state;
|
|
1895
|
+
const { mainAxis: checkMainAxis = true, crossAxis: checkCrossAxis = true, fallbackPlacements: specifiedFallbackPlacements, fallbackStrategy = "bestFit", fallbackAxisSideDirection = "none", flipAlignment = true, ...detectOverflowOptions } = evaluate(options, state);
|
|
1896
|
+
if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) return {};
|
|
1897
|
+
const side = getSide(placement);
|
|
1898
|
+
const initialSideAxis = getSideAxis(initialPlacement);
|
|
1899
|
+
const isBasePlacement = getSide(initialPlacement) === initialPlacement;
|
|
1900
|
+
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
|
|
1901
|
+
const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
|
|
1902
|
+
const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none";
|
|
1903
|
+
if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
|
|
1904
|
+
const placements = [initialPlacement, ...fallbackPlacements];
|
|
1905
|
+
const overflow = await platform.detectOverflow(state, detectOverflowOptions);
|
|
1906
|
+
const overflows = [];
|
|
1907
|
+
let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
|
|
1908
|
+
if (checkMainAxis) overflows.push(overflow[side]);
|
|
1909
|
+
if (checkCrossAxis) {
|
|
1910
|
+
const sides = getAlignmentSides(placement, rects, rtl);
|
|
1911
|
+
overflows.push(overflow[sides[0]], overflow[sides[1]]);
|
|
1912
|
+
}
|
|
1913
|
+
overflowsData = [...overflowsData, {
|
|
1914
|
+
placement,
|
|
1915
|
+
overflows
|
|
1916
|
+
}];
|
|
1917
|
+
if (!overflows.every((side) => side <= 0)) {
|
|
1918
|
+
var _middlewareData$flip2, _overflowsData$filter;
|
|
1919
|
+
const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
|
|
1920
|
+
const nextPlacement = placements[nextIndex];
|
|
1921
|
+
if (nextPlacement) {
|
|
1922
|
+
if (!(checkCrossAxis === "alignment" ? initialSideAxis !== getSideAxis(nextPlacement) : false) || overflowsData.every((d) => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) return {
|
|
1923
|
+
data: {
|
|
1924
|
+
index: nextIndex,
|
|
1925
|
+
overflows: overflowsData
|
|
1926
|
+
},
|
|
1927
|
+
reset: { placement: nextPlacement }
|
|
1928
|
+
};
|
|
1929
|
+
}
|
|
1930
|
+
let resetPlacement = (_overflowsData$filter = overflowsData.filter((d) => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
|
|
1931
|
+
if (!resetPlacement) switch (fallbackStrategy) {
|
|
1932
|
+
case "bestFit": {
|
|
1933
|
+
var _overflowsData$filter2;
|
|
1934
|
+
const placement = (_overflowsData$filter2 = overflowsData.filter((d) => {
|
|
1935
|
+
if (hasFallbackAxisSideDirection) {
|
|
1936
|
+
const currentSideAxis = getSideAxis(d.placement);
|
|
1937
|
+
return currentSideAxis === initialSideAxis || currentSideAxis === "y";
|
|
1938
|
+
}
|
|
1939
|
+
return true;
|
|
1940
|
+
}).map((d) => [d.placement, d.overflows.filter((overflow) => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0];
|
|
1941
|
+
if (placement) resetPlacement = placement;
|
|
1942
|
+
break;
|
|
1943
|
+
}
|
|
1944
|
+
case "initialPlacement":
|
|
1945
|
+
resetPlacement = initialPlacement;
|
|
1946
|
+
break;
|
|
1947
|
+
}
|
|
1948
|
+
if (placement !== resetPlacement) return { reset: { placement: resetPlacement } };
|
|
1949
|
+
}
|
|
1950
|
+
return {};
|
|
1951
|
+
}
|
|
1952
|
+
};
|
|
1953
|
+
};
|
|
1954
|
+
function getSideOffsets(overflow, rect) {
|
|
1955
|
+
return {
|
|
1956
|
+
top: overflow.top - rect.height,
|
|
1957
|
+
right: overflow.right - rect.width,
|
|
1958
|
+
bottom: overflow.bottom - rect.height,
|
|
1959
|
+
left: overflow.left - rect.width
|
|
1960
|
+
};
|
|
1961
|
+
}
|
|
1962
|
+
function isAnySideFullyClipped(overflow) {
|
|
1963
|
+
return sides.some((side) => overflow[side] >= 0);
|
|
1964
|
+
}
|
|
1965
|
+
/**
|
|
1966
|
+
* Provides data to hide the floating element in applicable situations, such as
|
|
1967
|
+
* when it is not in the same clipping context as the reference element.
|
|
1968
|
+
* @see https://floating-ui.com/docs/hide
|
|
1969
|
+
*/
|
|
1970
|
+
var hide$1 = function(options) {
|
|
1971
|
+
if (options === void 0) options = {};
|
|
1972
|
+
return {
|
|
1973
|
+
name: "hide",
|
|
1974
|
+
options,
|
|
1975
|
+
async fn(state) {
|
|
1976
|
+
const { rects, platform } = state;
|
|
1977
|
+
const { strategy = "referenceHidden", ...detectOverflowOptions } = evaluate(options, state);
|
|
1978
|
+
switch (strategy) {
|
|
1979
|
+
case "referenceHidden": {
|
|
1980
|
+
const offsets = getSideOffsets(await platform.detectOverflow(state, {
|
|
1981
|
+
...detectOverflowOptions,
|
|
1982
|
+
elementContext: "reference"
|
|
1983
|
+
}), rects.reference);
|
|
1984
|
+
return { data: {
|
|
1985
|
+
referenceHiddenOffsets: offsets,
|
|
1986
|
+
referenceHidden: isAnySideFullyClipped(offsets)
|
|
1987
|
+
} };
|
|
1988
|
+
}
|
|
1989
|
+
case "escaped": {
|
|
1990
|
+
const offsets = getSideOffsets(await platform.detectOverflow(state, {
|
|
1991
|
+
...detectOverflowOptions,
|
|
1992
|
+
altBoundary: true
|
|
1993
|
+
}), rects.floating);
|
|
1994
|
+
return { data: {
|
|
1995
|
+
escapedOffsets: offsets,
|
|
1996
|
+
escaped: isAnySideFullyClipped(offsets)
|
|
1997
|
+
} };
|
|
1998
|
+
}
|
|
1999
|
+
default: return {};
|
|
2000
|
+
}
|
|
2001
|
+
}
|
|
2002
|
+
};
|
|
2003
|
+
};
|
|
2004
|
+
var originSides = /*#__PURE__*/ new Set(["left", "top"]);
|
|
2005
|
+
async function convertValueToCoords(state, options) {
|
|
2006
|
+
const { placement, platform, elements } = state;
|
|
2007
|
+
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
|
|
2008
|
+
const side = getSide(placement);
|
|
2009
|
+
const alignment = getAlignment(placement);
|
|
2010
|
+
const isVertical = getSideAxis(placement) === "y";
|
|
2011
|
+
const mainAxisMulti = originSides.has(side) ? -1 : 1;
|
|
2012
|
+
const crossAxisMulti = rtl && isVertical ? -1 : 1;
|
|
2013
|
+
const rawValue = evaluate(options, state);
|
|
2014
|
+
let { mainAxis, crossAxis, alignmentAxis } = typeof rawValue === "number" ? {
|
|
2015
|
+
mainAxis: rawValue,
|
|
2016
|
+
crossAxis: 0,
|
|
2017
|
+
alignmentAxis: null
|
|
2018
|
+
} : {
|
|
2019
|
+
mainAxis: rawValue.mainAxis || 0,
|
|
2020
|
+
crossAxis: rawValue.crossAxis || 0,
|
|
2021
|
+
alignmentAxis: rawValue.alignmentAxis
|
|
2022
|
+
};
|
|
2023
|
+
if (alignment && typeof alignmentAxis === "number") crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis;
|
|
2024
|
+
return isVertical ? {
|
|
2025
|
+
x: crossAxis * crossAxisMulti,
|
|
2026
|
+
y: mainAxis * mainAxisMulti
|
|
2027
|
+
} : {
|
|
2028
|
+
x: mainAxis * mainAxisMulti,
|
|
2029
|
+
y: crossAxis * crossAxisMulti
|
|
2030
|
+
};
|
|
2031
|
+
}
|
|
2032
|
+
/**
|
|
2033
|
+
* Modifies the placement by translating the floating element along the
|
|
2034
|
+
* specified axes.
|
|
2035
|
+
* A number (shorthand for `mainAxis` or distance), or an axes configuration
|
|
2036
|
+
* object may be passed.
|
|
2037
|
+
* @see https://floating-ui.com/docs/offset
|
|
2038
|
+
*/
|
|
2039
|
+
var offset$1 = function(options) {
|
|
2040
|
+
if (options === void 0) options = 0;
|
|
2041
|
+
return {
|
|
2042
|
+
name: "offset",
|
|
2043
|
+
options,
|
|
2044
|
+
async fn(state) {
|
|
2045
|
+
var _middlewareData$offse, _middlewareData$arrow;
|
|
2046
|
+
const { x, y, placement, middlewareData } = state;
|
|
2047
|
+
const diffCoords = await convertValueToCoords(state, options);
|
|
2048
|
+
if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) return {};
|
|
2049
|
+
return {
|
|
2050
|
+
x: x + diffCoords.x,
|
|
2051
|
+
y: y + diffCoords.y,
|
|
2052
|
+
data: {
|
|
2053
|
+
...diffCoords,
|
|
2054
|
+
placement
|
|
2055
|
+
}
|
|
2056
|
+
};
|
|
2057
|
+
}
|
|
2058
|
+
};
|
|
2059
|
+
};
|
|
2060
|
+
/**
|
|
2061
|
+
* Optimizes the visibility of the floating element by shifting it in order to
|
|
2062
|
+
* keep it in view when it will overflow the clipping boundary.
|
|
2063
|
+
* @see https://floating-ui.com/docs/shift
|
|
2064
|
+
*/
|
|
2065
|
+
var shift$1 = function(options) {
|
|
2066
|
+
if (options === void 0) options = {};
|
|
2067
|
+
return {
|
|
2068
|
+
name: "shift",
|
|
2069
|
+
options,
|
|
2070
|
+
async fn(state) {
|
|
2071
|
+
const { x, y, placement, platform } = state;
|
|
2072
|
+
const { mainAxis: checkMainAxis = true, crossAxis: checkCrossAxis = false, limiter = { fn: (_ref) => {
|
|
2073
|
+
let { x, y } = _ref;
|
|
2074
|
+
return {
|
|
2075
|
+
x,
|
|
2076
|
+
y
|
|
2077
|
+
};
|
|
2078
|
+
} }, ...detectOverflowOptions } = evaluate(options, state);
|
|
2079
|
+
const coords = {
|
|
2080
|
+
x,
|
|
2081
|
+
y
|
|
2082
|
+
};
|
|
2083
|
+
const overflow = await platform.detectOverflow(state, detectOverflowOptions);
|
|
2084
|
+
const crossAxis = getSideAxis(placement);
|
|
2085
|
+
const mainAxis = getOppositeAxis(crossAxis);
|
|
2086
|
+
let mainAxisCoord = coords[mainAxis];
|
|
2087
|
+
let crossAxisCoord = coords[crossAxis];
|
|
2088
|
+
const clampCoord = (axis, coord) => clamp(coord + overflow[axis === "y" ? "top" : "left"], coord, coord - overflow[axis === "y" ? "bottom" : "right"]);
|
|
2089
|
+
if (checkMainAxis) mainAxisCoord = clampCoord(mainAxis, mainAxisCoord);
|
|
2090
|
+
if (checkCrossAxis) crossAxisCoord = clampCoord(crossAxis, crossAxisCoord);
|
|
2091
|
+
const limitedCoords = limiter.fn({
|
|
2092
|
+
...state,
|
|
2093
|
+
[mainAxis]: mainAxisCoord,
|
|
2094
|
+
[crossAxis]: crossAxisCoord
|
|
2095
|
+
});
|
|
2096
|
+
return {
|
|
2097
|
+
...limitedCoords,
|
|
2098
|
+
data: {
|
|
2099
|
+
x: limitedCoords.x - x,
|
|
2100
|
+
y: limitedCoords.y - y,
|
|
2101
|
+
enabled: {
|
|
2102
|
+
[mainAxis]: checkMainAxis,
|
|
2103
|
+
[crossAxis]: checkCrossAxis
|
|
2104
|
+
}
|
|
2105
|
+
}
|
|
2106
|
+
};
|
|
2107
|
+
}
|
|
2108
|
+
};
|
|
2109
|
+
};
|
|
2110
|
+
/**
|
|
2111
|
+
* Provides data that allows you to change the size of the floating element —
|
|
2112
|
+
* for instance, prevent it from overflowing the clipping boundary or match the
|
|
2113
|
+
* width of the reference element.
|
|
2114
|
+
* @see https://floating-ui.com/docs/size
|
|
2115
|
+
*/
|
|
2116
|
+
var size$1 = function(options) {
|
|
2117
|
+
if (options === void 0) options = {};
|
|
2118
|
+
return {
|
|
2119
|
+
name: "size",
|
|
2120
|
+
options,
|
|
2121
|
+
async fn(state) {
|
|
2122
|
+
const { placement, rects, platform, elements } = state;
|
|
2123
|
+
const { apply = () => {}, ...detectOverflowOptions } = evaluate(options, state);
|
|
2124
|
+
const overflow = await platform.detectOverflow(state, detectOverflowOptions);
|
|
2125
|
+
const side = getSide(placement);
|
|
2126
|
+
const alignment = getAlignment(placement);
|
|
2127
|
+
const isYAxis = getSideAxis(placement) === "y";
|
|
2128
|
+
const { width, height } = rects.floating;
|
|
2129
|
+
let heightSide;
|
|
2130
|
+
let widthSide;
|
|
2131
|
+
if (side === "top" || side === "bottom") {
|
|
2132
|
+
heightSide = side;
|
|
2133
|
+
widthSide = alignment === (await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)) ? "start" : "end") ? "left" : "right";
|
|
2134
|
+
} else {
|
|
2135
|
+
widthSide = side;
|
|
2136
|
+
heightSide = alignment === "end" ? "top" : "bottom";
|
|
2137
|
+
}
|
|
2138
|
+
const maximumClippingHeight = height - overflow.top - overflow.bottom;
|
|
2139
|
+
const maximumClippingWidth = width - overflow.left - overflow.right;
|
|
2140
|
+
const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);
|
|
2141
|
+
const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);
|
|
2142
|
+
const shiftData = state.middlewareData.shift;
|
|
2143
|
+
const noShift = !shiftData;
|
|
2144
|
+
let availableHeight = overflowAvailableHeight;
|
|
2145
|
+
let availableWidth = overflowAvailableWidth;
|
|
2146
|
+
if (shiftData != null && shiftData.enabled.x) availableWidth = maximumClippingWidth;
|
|
2147
|
+
if (shiftData != null && shiftData.enabled.y) availableHeight = maximumClippingHeight;
|
|
2148
|
+
if (noShift && !alignment) if (isYAxis) availableWidth = width - 2 * max(overflow.left, overflow.right);
|
|
2149
|
+
else availableHeight = height - 2 * max(overflow.top, overflow.bottom);
|
|
2150
|
+
await apply({
|
|
2151
|
+
...state,
|
|
2152
|
+
availableWidth,
|
|
2153
|
+
availableHeight
|
|
2154
|
+
});
|
|
2155
|
+
const nextDimensions = await platform.getDimensions(elements.floating);
|
|
2156
|
+
if (width !== nextDimensions.width || height !== nextDimensions.height) return { reset: { rects: true } };
|
|
2157
|
+
return {};
|
|
2158
|
+
}
|
|
2159
|
+
};
|
|
2160
|
+
};
|
|
2161
|
+
function hasWindow() {
|
|
2162
|
+
return typeof window !== "undefined";
|
|
2163
|
+
}
|
|
2164
|
+
function getNodeName(node) {
|
|
2165
|
+
if (isNode(node)) return (node.nodeName || "").toLowerCase();
|
|
2166
|
+
return "#document";
|
|
2167
|
+
}
|
|
2168
|
+
function getWindow(node) {
|
|
2169
|
+
var _node$ownerDocument;
|
|
2170
|
+
return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
|
|
2171
|
+
}
|
|
2172
|
+
function getDocumentElement(node) {
|
|
2173
|
+
var _ref;
|
|
2174
|
+
return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
|
|
2175
|
+
}
|
|
2176
|
+
function isNode(value) {
|
|
2177
|
+
if (!hasWindow()) return false;
|
|
2178
|
+
return value instanceof Node || value instanceof getWindow(value).Node;
|
|
2179
|
+
}
|
|
2180
|
+
function isElement(value) {
|
|
2181
|
+
if (!hasWindow()) return false;
|
|
2182
|
+
return value instanceof Element || value instanceof getWindow(value).Element;
|
|
2183
|
+
}
|
|
2184
|
+
function isHTMLElement(value) {
|
|
2185
|
+
if (!hasWindow()) return false;
|
|
2186
|
+
return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
|
|
2187
|
+
}
|
|
2188
|
+
function isShadowRoot(value) {
|
|
2189
|
+
if (!hasWindow() || typeof ShadowRoot === "undefined") return false;
|
|
2190
|
+
return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
|
|
2191
|
+
}
|
|
2192
|
+
function isOverflowElement(element) {
|
|
2193
|
+
const { overflow, overflowX, overflowY, display } = getComputedStyle$1(element);
|
|
2194
|
+
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== "inline" && display !== "contents";
|
|
2195
|
+
}
|
|
2196
|
+
function isTableElement(element) {
|
|
2197
|
+
return /^(table|td|th)$/.test(getNodeName(element));
|
|
2198
|
+
}
|
|
2199
|
+
function isTopLayer(element) {
|
|
2200
|
+
try {
|
|
2201
|
+
if (element.matches(":popover-open")) return true;
|
|
2202
|
+
} catch (_e) {}
|
|
2203
|
+
try {
|
|
2204
|
+
return element.matches(":modal");
|
|
2205
|
+
} catch (_e) {
|
|
2206
|
+
return false;
|
|
2207
|
+
}
|
|
2208
|
+
}
|
|
2209
|
+
var willChangeRe = /transform|translate|scale|rotate|perspective|filter/;
|
|
2210
|
+
var containRe = /paint|layout|strict|content/;
|
|
2211
|
+
var isNotNone = (value) => !!value && value !== "none";
|
|
2212
|
+
var isWebKitValue;
|
|
2213
|
+
function isContainingBlock(elementOrCss) {
|
|
2214
|
+
const css = isElement(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
|
|
2215
|
+
return isNotNone(css.transform) || isNotNone(css.translate) || isNotNone(css.scale) || isNotNone(css.rotate) || isNotNone(css.perspective) || !isWebKit() && (isNotNone(css.backdropFilter) || isNotNone(css.filter)) || willChangeRe.test(css.willChange || "") || containRe.test(css.contain || "");
|
|
2216
|
+
}
|
|
2217
|
+
function getContainingBlock(element) {
|
|
2218
|
+
let currentNode = getParentNode(element);
|
|
2219
|
+
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
2220
|
+
if (isContainingBlock(currentNode)) return currentNode;
|
|
2221
|
+
else if (isTopLayer(currentNode)) return null;
|
|
2222
|
+
currentNode = getParentNode(currentNode);
|
|
2223
|
+
}
|
|
2224
|
+
return null;
|
|
2225
|
+
}
|
|
2226
|
+
function isWebKit() {
|
|
2227
|
+
if (isWebKitValue == null) isWebKitValue = typeof CSS !== "undefined" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none");
|
|
2228
|
+
return isWebKitValue;
|
|
2229
|
+
}
|
|
2230
|
+
function isLastTraversableNode(node) {
|
|
2231
|
+
return /^(html|body|#document)$/.test(getNodeName(node));
|
|
2232
|
+
}
|
|
2233
|
+
function getComputedStyle$1(element) {
|
|
2234
|
+
return getWindow(element).getComputedStyle(element);
|
|
2235
|
+
}
|
|
2236
|
+
function getNodeScroll(element) {
|
|
2237
|
+
if (isElement(element)) return {
|
|
2238
|
+
scrollLeft: element.scrollLeft,
|
|
2239
|
+
scrollTop: element.scrollTop
|
|
2240
|
+
};
|
|
2241
|
+
return {
|
|
2242
|
+
scrollLeft: element.scrollX,
|
|
2243
|
+
scrollTop: element.scrollY
|
|
2244
|
+
};
|
|
2245
|
+
}
|
|
2246
|
+
function getParentNode(node) {
|
|
2247
|
+
if (getNodeName(node) === "html") return node;
|
|
2248
|
+
const result = node.assignedSlot || node.parentNode || isShadowRoot(node) && node.host || getDocumentElement(node);
|
|
2249
|
+
return isShadowRoot(result) ? result.host : result;
|
|
2250
|
+
}
|
|
2251
|
+
function getNearestOverflowAncestor(node) {
|
|
2252
|
+
const parentNode = getParentNode(node);
|
|
2253
|
+
if (isLastTraversableNode(parentNode)) return (node.ownerDocument || node).body;
|
|
2254
|
+
if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) return parentNode;
|
|
2255
|
+
return getNearestOverflowAncestor(parentNode);
|
|
2256
|
+
}
|
|
2257
|
+
function getOverflowAncestors(node, list, traverseIframes) {
|
|
2258
|
+
var _node$ownerDocument2;
|
|
2259
|
+
if (list === void 0) list = [];
|
|
2260
|
+
if (traverseIframes === void 0) traverseIframes = true;
|
|
2261
|
+
const scrollableAncestor = getNearestOverflowAncestor(node);
|
|
2262
|
+
const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
|
|
2263
|
+
const win = getWindow(scrollableAncestor);
|
|
2264
|
+
if (isBody) {
|
|
2265
|
+
const frameElement = getFrameElement(win);
|
|
2266
|
+
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
|
|
2267
|
+
} else return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
|
|
2268
|
+
}
|
|
2269
|
+
function getFrameElement(win) {
|
|
2270
|
+
return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
|
|
2271
|
+
}
|
|
2272
|
+
function getCssDimensions(element) {
|
|
2273
|
+
const css = getComputedStyle$1(element);
|
|
2274
|
+
let width = parseFloat(css.width) || 0;
|
|
2275
|
+
let height = parseFloat(css.height) || 0;
|
|
2276
|
+
const hasOffset = isHTMLElement(element);
|
|
2277
|
+
const offsetWidth = hasOffset ? element.offsetWidth : width;
|
|
2278
|
+
const offsetHeight = hasOffset ? element.offsetHeight : height;
|
|
2279
|
+
const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
|
|
2280
|
+
if (shouldFallback) {
|
|
2281
|
+
width = offsetWidth;
|
|
2282
|
+
height = offsetHeight;
|
|
2283
|
+
}
|
|
2284
|
+
return {
|
|
2285
|
+
width,
|
|
2286
|
+
height,
|
|
2287
|
+
$: shouldFallback
|
|
2288
|
+
};
|
|
2289
|
+
}
|
|
2290
|
+
function unwrapElement(element) {
|
|
2291
|
+
return !isElement(element) ? element.contextElement : element;
|
|
2292
|
+
}
|
|
2293
|
+
function getScale(element) {
|
|
2294
|
+
const domElement = unwrapElement(element);
|
|
2295
|
+
if (!isHTMLElement(domElement)) return createCoords(1);
|
|
2296
|
+
const rect = domElement.getBoundingClientRect();
|
|
2297
|
+
const { width, height, $ } = getCssDimensions(domElement);
|
|
2298
|
+
let x = ($ ? round(rect.width) : rect.width) / width;
|
|
2299
|
+
let y = ($ ? round(rect.height) : rect.height) / height;
|
|
2300
|
+
if (!x || !Number.isFinite(x)) x = 1;
|
|
2301
|
+
if (!y || !Number.isFinite(y)) y = 1;
|
|
2302
|
+
return {
|
|
2303
|
+
x,
|
|
2304
|
+
y
|
|
2305
|
+
};
|
|
2306
|
+
}
|
|
2307
|
+
var noOffsets = /*#__PURE__*/ createCoords(0);
|
|
2308
|
+
function getVisualOffsets(element) {
|
|
2309
|
+
const win = getWindow(element);
|
|
2310
|
+
if (!isWebKit() || !win.visualViewport) return noOffsets;
|
|
2311
|
+
return {
|
|
2312
|
+
x: win.visualViewport.offsetLeft,
|
|
2313
|
+
y: win.visualViewport.offsetTop
|
|
2314
|
+
};
|
|
2315
|
+
}
|
|
2316
|
+
function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
|
|
2317
|
+
if (isFixed === void 0) isFixed = false;
|
|
2318
|
+
return !!floatingOffsetParent && isFixed && floatingOffsetParent === getWindow(element);
|
|
2319
|
+
}
|
|
2320
|
+
function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
|
|
2321
|
+
if (includeScale === void 0) includeScale = false;
|
|
2322
|
+
if (isFixedStrategy === void 0) isFixedStrategy = false;
|
|
2323
|
+
const clientRect = element.getBoundingClientRect();
|
|
2324
|
+
const domElement = unwrapElement(element);
|
|
2325
|
+
let scale = createCoords(1);
|
|
2326
|
+
if (includeScale) if (offsetParent) {
|
|
2327
|
+
if (isElement(offsetParent)) scale = getScale(offsetParent);
|
|
2328
|
+
} else scale = getScale(element);
|
|
2329
|
+
const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
|
|
2330
|
+
let x = (clientRect.left + visualOffsets.x) / scale.x;
|
|
2331
|
+
let y = (clientRect.top + visualOffsets.y) / scale.y;
|
|
2332
|
+
let width = clientRect.width / scale.x;
|
|
2333
|
+
let height = clientRect.height / scale.y;
|
|
2334
|
+
if (domElement && offsetParent) {
|
|
2335
|
+
const win = getWindow(domElement);
|
|
2336
|
+
const offsetWin = isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
|
|
2337
|
+
let currentWin = win;
|
|
2338
|
+
let currentIFrame = getFrameElement(currentWin);
|
|
2339
|
+
while (currentIFrame && offsetWin !== currentWin) {
|
|
2340
|
+
const iframeScale = getScale(currentIFrame);
|
|
2341
|
+
const iframeRect = currentIFrame.getBoundingClientRect();
|
|
2342
|
+
const css = getComputedStyle$1(currentIFrame);
|
|
2343
|
+
const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
|
|
2344
|
+
const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
|
|
2345
|
+
x *= iframeScale.x;
|
|
2346
|
+
y *= iframeScale.y;
|
|
2347
|
+
width *= iframeScale.x;
|
|
2348
|
+
height *= iframeScale.y;
|
|
2349
|
+
x += left;
|
|
2350
|
+
y += top;
|
|
2351
|
+
currentWin = getWindow(currentIFrame);
|
|
2352
|
+
currentIFrame = getFrameElement(currentWin);
|
|
2353
|
+
}
|
|
2354
|
+
}
|
|
2355
|
+
return rectToClientRect({
|
|
2356
|
+
width,
|
|
2357
|
+
height,
|
|
2358
|
+
x,
|
|
2359
|
+
y
|
|
2360
|
+
});
|
|
2361
|
+
}
|
|
2362
|
+
function getWindowScrollBarX(element, rect) {
|
|
2363
|
+
const leftScroll = getNodeScroll(element).scrollLeft;
|
|
2364
|
+
if (!rect) return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
|
|
2365
|
+
return rect.left + leftScroll;
|
|
2366
|
+
}
|
|
2367
|
+
function getHTMLOffset(documentElement, scroll) {
|
|
2368
|
+
const htmlRect = documentElement.getBoundingClientRect();
|
|
2369
|
+
return {
|
|
2370
|
+
x: htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect),
|
|
2371
|
+
y: htmlRect.top + scroll.scrollTop
|
|
2372
|
+
};
|
|
2373
|
+
}
|
|
2374
|
+
function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
2375
|
+
let { elements, rect, offsetParent, strategy } = _ref;
|
|
2376
|
+
const isFixed = strategy === "fixed";
|
|
2377
|
+
const documentElement = getDocumentElement(offsetParent);
|
|
2378
|
+
const topLayer = elements ? isTopLayer(elements.floating) : false;
|
|
2379
|
+
if (offsetParent === documentElement || topLayer && isFixed) return rect;
|
|
2380
|
+
let scroll = {
|
|
2381
|
+
scrollLeft: 0,
|
|
2382
|
+
scrollTop: 0
|
|
2383
|
+
};
|
|
2384
|
+
let scale = createCoords(1);
|
|
2385
|
+
const offsets = createCoords(0);
|
|
2386
|
+
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
2387
|
+
if (isOffsetParentAnElement || !isFixed) {
|
|
2388
|
+
if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) scroll = getNodeScroll(offsetParent);
|
|
2389
|
+
if (isOffsetParentAnElement) {
|
|
2390
|
+
const offsetRect = getBoundingClientRect(offsetParent);
|
|
2391
|
+
scale = getScale(offsetParent);
|
|
2392
|
+
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
2393
|
+
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
2394
|
+
}
|
|
2395
|
+
}
|
|
2396
|
+
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
|
|
2397
|
+
return {
|
|
2398
|
+
width: rect.width * scale.x,
|
|
2399
|
+
height: rect.height * scale.y,
|
|
2400
|
+
x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
|
|
2401
|
+
y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
|
|
2402
|
+
};
|
|
2403
|
+
}
|
|
2404
|
+
function getClientRects(element) {
|
|
2405
|
+
return element.getClientRects ? Array.from(element.getClientRects()) : [];
|
|
2406
|
+
}
|
|
2407
|
+
function getDocumentRect(html) {
|
|
2408
|
+
const scroll = getNodeScroll(html);
|
|
2409
|
+
const body = html.ownerDocument.body;
|
|
2410
|
+
const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
|
|
2411
|
+
const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
|
|
2412
|
+
let x = -scroll.scrollLeft + getWindowScrollBarX(html);
|
|
2413
|
+
const y = -scroll.scrollTop;
|
|
2414
|
+
if (getComputedStyle$1(body).direction === "rtl") x += max(html.clientWidth, body.clientWidth) - width;
|
|
2415
|
+
return {
|
|
2416
|
+
width,
|
|
2417
|
+
height,
|
|
2418
|
+
x,
|
|
2419
|
+
y
|
|
2420
|
+
};
|
|
2421
|
+
}
|
|
2422
|
+
var SCROLLBAR_MAX = 25;
|
|
2423
|
+
function getViewportRect(element, strategy, rootBoundary) {
|
|
2424
|
+
if (rootBoundary === void 0) rootBoundary = "viewport";
|
|
2425
|
+
const isLayoutViewport = rootBoundary === "layoutViewport";
|
|
2426
|
+
const win = getWindow(element);
|
|
2427
|
+
const html = getDocumentElement(element);
|
|
2428
|
+
const visualViewport = win.visualViewport;
|
|
2429
|
+
let width = html.clientWidth;
|
|
2430
|
+
let height = html.clientHeight;
|
|
2431
|
+
let x = 0;
|
|
2432
|
+
let y = 0;
|
|
2433
|
+
if (visualViewport) {
|
|
2434
|
+
const layoutRelativeClientCoords = !isWebKit() || strategy === "fixed";
|
|
2435
|
+
if (isLayoutViewport) {
|
|
2436
|
+
if (!layoutRelativeClientCoords) {
|
|
2437
|
+
x = -visualViewport.offsetLeft;
|
|
2438
|
+
y = -visualViewport.offsetTop;
|
|
2439
|
+
}
|
|
2440
|
+
} else {
|
|
2441
|
+
width = visualViewport.width;
|
|
2442
|
+
height = visualViewport.height;
|
|
2443
|
+
if (layoutRelativeClientCoords) {
|
|
2444
|
+
x = visualViewport.offsetLeft;
|
|
2445
|
+
y = visualViewport.offsetTop;
|
|
2446
|
+
}
|
|
2447
|
+
}
|
|
2448
|
+
}
|
|
2449
|
+
if (getWindowScrollBarX(html) <= 0) {
|
|
2450
|
+
const doc = html.ownerDocument;
|
|
2451
|
+
const body = doc.body;
|
|
2452
|
+
const bodyStyles = getComputedStyle(body);
|
|
2453
|
+
const bodyMarginInline = doc.compatMode === "CSS1Compat" ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
|
|
2454
|
+
const reservedWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
|
|
2455
|
+
const gutter = getComputedStyle(html).scrollbarGutter === "stable both-edges" ? reservedWidth / 2 : reservedWidth;
|
|
2456
|
+
if (gutter <= SCROLLBAR_MAX) width -= gutter;
|
|
2457
|
+
}
|
|
2458
|
+
return {
|
|
2459
|
+
width,
|
|
2460
|
+
height,
|
|
2461
|
+
x,
|
|
2462
|
+
y
|
|
2463
|
+
};
|
|
2464
|
+
}
|
|
2465
|
+
function getInnerBoundingClientRect(element, strategy) {
|
|
2466
|
+
const clientRect = getBoundingClientRect(element, true, strategy === "fixed");
|
|
2467
|
+
const top = clientRect.top + element.clientTop;
|
|
2468
|
+
const left = clientRect.left + element.clientLeft;
|
|
2469
|
+
const scale = getScale(element);
|
|
2470
|
+
return {
|
|
2471
|
+
width: element.clientWidth * scale.x,
|
|
2472
|
+
height: element.clientHeight * scale.y,
|
|
2473
|
+
x: left * scale.x,
|
|
2474
|
+
y: top * scale.y
|
|
2475
|
+
};
|
|
2476
|
+
}
|
|
2477
|
+
function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
|
|
2478
|
+
let rect;
|
|
2479
|
+
if (clippingAncestor === "viewport" || clippingAncestor === "layoutViewport") rect = getViewportRect(element, strategy, clippingAncestor);
|
|
2480
|
+
else if (clippingAncestor === "document") rect = getDocumentRect(getDocumentElement(element));
|
|
2481
|
+
else if (isElement(clippingAncestor)) rect = getInnerBoundingClientRect(clippingAncestor, strategy);
|
|
2482
|
+
else {
|
|
2483
|
+
const visualOffsets = getVisualOffsets(element);
|
|
2484
|
+
rect = {
|
|
2485
|
+
x: clippingAncestor.x - visualOffsets.x,
|
|
2486
|
+
y: clippingAncestor.y - visualOffsets.y,
|
|
2487
|
+
width: clippingAncestor.width,
|
|
2488
|
+
height: clippingAncestor.height
|
|
2489
|
+
};
|
|
2490
|
+
}
|
|
2491
|
+
return rectToClientRect(rect);
|
|
2492
|
+
}
|
|
2493
|
+
function getClippingElementAncestors(element, cache) {
|
|
2494
|
+
const cachedResult = cache.get(element);
|
|
2495
|
+
if (cachedResult) return cachedResult;
|
|
2496
|
+
let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body");
|
|
2497
|
+
let lastKeptComputedStyle = null;
|
|
2498
|
+
const elementIsFixed = getComputedStyle$1(element).position === "fixed";
|
|
2499
|
+
let currentNode = elementIsFixed ? getParentNode(element) : element;
|
|
2500
|
+
while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
2501
|
+
const computedStyle = getComputedStyle$1(currentNode);
|
|
2502
|
+
const currentNodeIsContaining = isContainingBlock(currentNode);
|
|
2503
|
+
const lastPosition = lastKeptComputedStyle ? lastKeptComputedStyle.position : elementIsFixed ? "fixed" : "";
|
|
2504
|
+
if (!currentNodeIsContaining && (lastPosition === "fixed" || lastPosition === "absolute" && computedStyle.position === "static")) result = result.filter((ancestor) => ancestor !== currentNode);
|
|
2505
|
+
else lastKeptComputedStyle = computedStyle;
|
|
2506
|
+
currentNode = getParentNode(currentNode);
|
|
2507
|
+
}
|
|
2508
|
+
cache.set(element, result);
|
|
2509
|
+
return result;
|
|
2510
|
+
}
|
|
2511
|
+
function getClippingRect(_ref) {
|
|
2512
|
+
let { element, boundary, rootBoundary, strategy } = _ref;
|
|
2513
|
+
const clippingAncestors = [...boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary), rootBoundary];
|
|
2514
|
+
const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy);
|
|
2515
|
+
let top = firstRect.top;
|
|
2516
|
+
let right = firstRect.right;
|
|
2517
|
+
let bottom = firstRect.bottom;
|
|
2518
|
+
let left = firstRect.left;
|
|
2519
|
+
for (let i = 1; i < clippingAncestors.length; i++) {
|
|
2520
|
+
const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy);
|
|
2521
|
+
top = max(rect.top, top);
|
|
2522
|
+
right = min(rect.right, right);
|
|
2523
|
+
bottom = min(rect.bottom, bottom);
|
|
2524
|
+
left = max(rect.left, left);
|
|
2525
|
+
}
|
|
2526
|
+
return {
|
|
2527
|
+
width: right - left,
|
|
2528
|
+
height: bottom - top,
|
|
2529
|
+
x: left,
|
|
2530
|
+
y: top
|
|
2531
|
+
};
|
|
2532
|
+
}
|
|
2533
|
+
function getDimensions(element) {
|
|
2534
|
+
const { width, height } = getCssDimensions(element);
|
|
2535
|
+
return {
|
|
2536
|
+
width,
|
|
2537
|
+
height
|
|
2538
|
+
};
|
|
2539
|
+
}
|
|
2540
|
+
function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
|
2541
|
+
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
2542
|
+
const documentElement = getDocumentElement(offsetParent);
|
|
2543
|
+
const isFixed = strategy === "fixed";
|
|
2544
|
+
const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
|
|
2545
|
+
let scroll = {
|
|
2546
|
+
scrollLeft: 0,
|
|
2547
|
+
scrollTop: 0
|
|
2548
|
+
};
|
|
2549
|
+
const offsets = createCoords(0);
|
|
2550
|
+
if (isOffsetParentAnElement || !isFixed) {
|
|
2551
|
+
if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) scroll = getNodeScroll(offsetParent);
|
|
2552
|
+
if (isOffsetParentAnElement) {
|
|
2553
|
+
const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
|
|
2554
|
+
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
2555
|
+
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
2556
|
+
}
|
|
2557
|
+
}
|
|
2558
|
+
if (!isOffsetParentAnElement && documentElement) offsets.x = getWindowScrollBarX(documentElement);
|
|
2559
|
+
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
|
|
2560
|
+
return {
|
|
2561
|
+
x: rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x,
|
|
2562
|
+
y: rect.top + scroll.scrollTop - offsets.y - htmlOffset.y,
|
|
2563
|
+
width: rect.width,
|
|
2564
|
+
height: rect.height
|
|
2565
|
+
};
|
|
2566
|
+
}
|
|
2567
|
+
function isStaticPositioned(element) {
|
|
2568
|
+
return getComputedStyle$1(element).position === "static";
|
|
2569
|
+
}
|
|
2570
|
+
function getTrueOffsetParent(element, polyfill) {
|
|
2571
|
+
if (!isHTMLElement(element) || getComputedStyle$1(element).position === "fixed") return null;
|
|
2572
|
+
if (polyfill) return polyfill(element);
|
|
2573
|
+
let rawOffsetParent = element.offsetParent;
|
|
2574
|
+
if (getDocumentElement(element) === rawOffsetParent) rawOffsetParent = rawOffsetParent.ownerDocument.body;
|
|
2575
|
+
return rawOffsetParent;
|
|
2576
|
+
}
|
|
2577
|
+
function getOffsetParent(element, polyfill) {
|
|
2578
|
+
const win = getWindow(element);
|
|
2579
|
+
if (isTopLayer(element)) return win;
|
|
2580
|
+
if (!isHTMLElement(element)) {
|
|
2581
|
+
let svgOffsetParent = getParentNode(element);
|
|
2582
|
+
while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
|
|
2583
|
+
if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) return svgOffsetParent;
|
|
2584
|
+
svgOffsetParent = getParentNode(svgOffsetParent);
|
|
2585
|
+
}
|
|
2586
|
+
return win;
|
|
2587
|
+
}
|
|
2588
|
+
let offsetParent = getTrueOffsetParent(element, polyfill);
|
|
2589
|
+
while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) offsetParent = getTrueOffsetParent(offsetParent, polyfill);
|
|
2590
|
+
if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) return win;
|
|
2591
|
+
return offsetParent || getContainingBlock(element) || win;
|
|
2592
|
+
}
|
|
2593
|
+
var getElementRects = async function(data) {
|
|
2594
|
+
const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
|
|
2595
|
+
const getDimensionsFn = this.getDimensions;
|
|
2596
|
+
const floatingDimensions = await getDimensionsFn(data.floating);
|
|
2597
|
+
return {
|
|
2598
|
+
reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
|
|
2599
|
+
floating: {
|
|
2600
|
+
x: 0,
|
|
2601
|
+
y: 0,
|
|
2602
|
+
width: floatingDimensions.width,
|
|
2603
|
+
height: floatingDimensions.height
|
|
2604
|
+
}
|
|
2605
|
+
};
|
|
2606
|
+
};
|
|
2607
|
+
function isRTL(element) {
|
|
2608
|
+
return getComputedStyle$1(element).direction === "rtl";
|
|
2609
|
+
}
|
|
2610
|
+
var platform = {
|
|
2611
|
+
convertOffsetParentRelativeRectToViewportRelativeRect,
|
|
2612
|
+
getDocumentElement,
|
|
2613
|
+
getClippingRect,
|
|
2614
|
+
getOffsetParent,
|
|
2615
|
+
getElementRects,
|
|
2616
|
+
getClientRects,
|
|
2617
|
+
getDimensions,
|
|
2618
|
+
getScale,
|
|
2619
|
+
isElement,
|
|
2620
|
+
isRTL
|
|
2621
|
+
};
|
|
2622
|
+
function rectsAreEqual(a, b) {
|
|
2623
|
+
return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
|
|
2624
|
+
}
|
|
2625
|
+
function observeMove(element, onMove, ancestorResize) {
|
|
2626
|
+
let io = null;
|
|
2627
|
+
let timeoutId;
|
|
2628
|
+
const root = getDocumentElement(element);
|
|
2629
|
+
function cleanup() {
|
|
2630
|
+
var _io;
|
|
2631
|
+
clearTimeout(timeoutId);
|
|
2632
|
+
(_io = io) == null || _io.disconnect();
|
|
2633
|
+
io = null;
|
|
2634
|
+
}
|
|
2635
|
+
function refresh(skip, threshold) {
|
|
2636
|
+
if (skip === void 0) skip = false;
|
|
2637
|
+
if (threshold === void 0) threshold = 1;
|
|
2638
|
+
cleanup();
|
|
2639
|
+
const elementRectForRootMargin = element.getBoundingClientRect();
|
|
2640
|
+
const { left, top, width, height } = elementRectForRootMargin;
|
|
2641
|
+
if (!skip) onMove();
|
|
2642
|
+
if (!width || !height) return;
|
|
2643
|
+
const insetTop = floor(top);
|
|
2644
|
+
const insetRight = floor(root.clientWidth - (left + width));
|
|
2645
|
+
const insetBottom = floor(root.clientHeight - (top + height));
|
|
2646
|
+
const insetLeft = floor(left);
|
|
2647
|
+
const options = {
|
|
2648
|
+
rootMargin: -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px",
|
|
2649
|
+
threshold: max(0, min(1, threshold)) || 1
|
|
2650
|
+
};
|
|
2651
|
+
let isFirstUpdate = true;
|
|
2652
|
+
function handleObserve(entries) {
|
|
2653
|
+
const ratio = entries[0].intersectionRatio;
|
|
2654
|
+
if (!rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) return refresh();
|
|
2655
|
+
if (ratio !== threshold) {
|
|
2656
|
+
if (!isFirstUpdate) return refresh();
|
|
2657
|
+
if (!ratio) timeoutId = setTimeout(() => {
|
|
2658
|
+
refresh(false, 1e-7);
|
|
2659
|
+
}, 1e3);
|
|
2660
|
+
else refresh(false, ratio);
|
|
2661
|
+
}
|
|
2662
|
+
isFirstUpdate = false;
|
|
2663
|
+
}
|
|
2664
|
+
try {
|
|
2665
|
+
io = new IntersectionObserver(handleObserve, {
|
|
2666
|
+
...options,
|
|
2667
|
+
root: root.ownerDocument
|
|
2668
|
+
});
|
|
2669
|
+
} catch (_e) {
|
|
2670
|
+
io = new IntersectionObserver(handleObserve, options);
|
|
2671
|
+
}
|
|
2672
|
+
io.observe(element);
|
|
2673
|
+
}
|
|
2674
|
+
const win = getWindow(element);
|
|
2675
|
+
const handleResize = () => refresh(ancestorResize);
|
|
2676
|
+
win.addEventListener("resize", handleResize);
|
|
2677
|
+
refresh(true);
|
|
2678
|
+
return () => {
|
|
2679
|
+
win.removeEventListener("resize", handleResize);
|
|
2680
|
+
cleanup();
|
|
2681
|
+
};
|
|
2682
|
+
}
|
|
2683
|
+
/**
|
|
2684
|
+
* Automatically updates the position of the floating element when necessary.
|
|
2685
|
+
* Should only be called when the floating element is mounted on the DOM or
|
|
2686
|
+
* visible on the screen.
|
|
2687
|
+
* @returns cleanup function that should be invoked when the floating element is
|
|
2688
|
+
* removed from the DOM or hidden from the screen.
|
|
2689
|
+
* @see https://floating-ui.com/docs/autoUpdate
|
|
2690
|
+
*/
|
|
2691
|
+
function autoUpdate(reference, floating, update, options) {
|
|
2692
|
+
if (options === void 0) options = {};
|
|
2693
|
+
const { ancestorScroll = true, ancestorResize = true, elementResize = typeof ResizeObserver === "function", layoutShift = typeof IntersectionObserver === "function", animationFrame = false } = options;
|
|
2694
|
+
const referenceEl = unwrapElement(reference);
|
|
2695
|
+
const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...floating ? getOverflowAncestors(floating) : []] : [];
|
|
2696
|
+
ancestors.forEach((ancestor) => {
|
|
2697
|
+
ancestorScroll && ancestor.addEventListener("scroll", update);
|
|
2698
|
+
ancestorResize && ancestor.addEventListener("resize", update);
|
|
2699
|
+
});
|
|
2700
|
+
const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update, ancestorResize) : null;
|
|
2701
|
+
let reobserveFrame = -1;
|
|
2702
|
+
let resizeObserver = null;
|
|
2703
|
+
if (elementResize) {
|
|
2704
|
+
resizeObserver = new ResizeObserver((_ref) => {
|
|
2705
|
+
let [firstEntry] = _ref;
|
|
2706
|
+
if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) {
|
|
2707
|
+
resizeObserver.unobserve(floating);
|
|
2708
|
+
cancelAnimationFrame(reobserveFrame);
|
|
2709
|
+
reobserveFrame = requestAnimationFrame(() => {
|
|
2710
|
+
var _resizeObserver;
|
|
2711
|
+
(_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
|
|
2712
|
+
});
|
|
2713
|
+
}
|
|
2714
|
+
update();
|
|
2715
|
+
});
|
|
2716
|
+
if (referenceEl && !animationFrame) resizeObserver.observe(referenceEl);
|
|
2717
|
+
if (floating) resizeObserver.observe(floating);
|
|
2718
|
+
}
|
|
2719
|
+
let frameId;
|
|
2720
|
+
let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
|
|
2721
|
+
if (animationFrame) frameLoop();
|
|
2722
|
+
function frameLoop() {
|
|
2723
|
+
const nextRefRect = getBoundingClientRect(reference);
|
|
2724
|
+
if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) update();
|
|
2725
|
+
prevRefRect = nextRefRect;
|
|
2726
|
+
frameId = requestAnimationFrame(frameLoop);
|
|
2727
|
+
}
|
|
2728
|
+
update();
|
|
2729
|
+
return () => {
|
|
2730
|
+
var _resizeObserver2;
|
|
2731
|
+
ancestors.forEach((ancestor) => {
|
|
2732
|
+
ancestorScroll && ancestor.removeEventListener("scroll", update);
|
|
2733
|
+
ancestorResize && ancestor.removeEventListener("resize", update);
|
|
2734
|
+
});
|
|
2735
|
+
cleanupIo?.();
|
|
2736
|
+
(_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
|
|
2737
|
+
resizeObserver = null;
|
|
2738
|
+
if (animationFrame) cancelAnimationFrame(frameId);
|
|
2739
|
+
};
|
|
2740
|
+
}
|
|
2741
|
+
/**
|
|
2742
|
+
* Modifies the placement by translating the floating element along the
|
|
2743
|
+
* specified axes.
|
|
2744
|
+
* A number (shorthand for `mainAxis` or distance), or an axes configuration
|
|
2745
|
+
* object may be passed.
|
|
2746
|
+
* @see https://floating-ui.com/docs/offset
|
|
2747
|
+
*/
|
|
2748
|
+
var offset = offset$1;
|
|
2749
|
+
/**
|
|
2750
|
+
* Optimizes the visibility of the floating element by shifting it in order to
|
|
2751
|
+
* keep it in view when it will overflow the clipping boundary.
|
|
2752
|
+
* @see https://floating-ui.com/docs/shift
|
|
2753
|
+
*/
|
|
2754
|
+
var shift = shift$1;
|
|
2755
|
+
/**
|
|
2756
|
+
* Optimizes the visibility of the floating element by flipping the `placement`
|
|
2757
|
+
* in order to keep it in view when the preferred placement(s) will overflow the
|
|
2758
|
+
* clipping boundary. Alternative to `autoPlacement`.
|
|
2759
|
+
* @see https://floating-ui.com/docs/flip
|
|
2760
|
+
*/
|
|
2761
|
+
var flip = flip$1;
|
|
2762
|
+
/**
|
|
2763
|
+
* Provides data that allows you to change the size of the floating element —
|
|
2764
|
+
* for instance, prevent it from overflowing the clipping boundary or match the
|
|
2765
|
+
* width of the reference element.
|
|
2766
|
+
* @see https://floating-ui.com/docs/size
|
|
2767
|
+
*/
|
|
2768
|
+
var size = size$1;
|
|
2769
|
+
/**
|
|
2770
|
+
* Provides data to hide the floating element in applicable situations, such as
|
|
2771
|
+
* when it is not in the same clipping context as the reference element.
|
|
2772
|
+
* @see https://floating-ui.com/docs/hide
|
|
2773
|
+
*/
|
|
2774
|
+
var hide = hide$1;
|
|
2775
|
+
/**
|
|
2776
|
+
* Provides data to position an inner element of the floating element so that it
|
|
2777
|
+
* appears centered to the reference element.
|
|
2778
|
+
* @see https://floating-ui.com/docs/arrow
|
|
2779
|
+
*/
|
|
2780
|
+
var arrow = arrow$1;
|
|
2781
|
+
/**
|
|
2782
|
+
* Computes the `x` and `y` coordinates that will place the floating element
|
|
2783
|
+
* next to a given reference element.
|
|
2784
|
+
*/
|
|
2785
|
+
var computePosition = (reference, floating, options) => {
|
|
2786
|
+
const cache = /* @__PURE__ */ new Map();
|
|
2787
|
+
const mergedOptions = options != null ? options : {};
|
|
2788
|
+
const platformWithCache = {
|
|
2789
|
+
...platform,
|
|
2790
|
+
...mergedOptions.platform,
|
|
2791
|
+
_c: cache
|
|
2792
|
+
};
|
|
2793
|
+
return computePosition$1(reference, floating, {
|
|
2794
|
+
...mergedOptions,
|
|
2795
|
+
platform: platformWithCache
|
|
2796
|
+
});
|
|
2797
|
+
};
|
|
2798
|
+
var _tmpl$$1 = [
|
|
2799
|
+
"<svg",
|
|
2800
|
+
" display=\"block\" viewBox=\"0 0 30 30\" style=\"transform:scale(1.02)\"><g",
|
|
2801
|
+
"><path fill=\"none\" d=\"M23,27.8c1.1,1.2,3.4,2.2,5,2.2h2H0h2c1.7,0,3.9-1,5-2.2l6.6-7.2c0.7-0.8,2-0.8,2.7,0L23,27.8L23,27.8z\"></path><path stroke=\"none\" d=\"M23,27.8c1.1,1.2,3.4,2.2,5,2.2h2H0h2c1.7,0,3.9-1,5-2.2l6.6-7.2c0.7-0.8,2-0.8,2.7,0L23,27.8L23,27.8z\"></path></g></svg>"
|
|
2802
|
+
];
|
|
2803
|
+
var PopperContext = createContext();
|
|
2804
|
+
function usePopperContext() {
|
|
2805
|
+
const context = useContext(PopperContext);
|
|
2806
|
+
if (context === void 0) throw new Error("[kobalte]: `usePopperContext` must be used within a `Popper` component");
|
|
2807
|
+
return context;
|
|
2808
|
+
}
|
|
2809
|
+
var DEFAULT_SIZE = 30;
|
|
2810
|
+
var HALF_DEFAULT_SIZE = DEFAULT_SIZE / 2;
|
|
2811
|
+
var ROTATION_DEG = {
|
|
2812
|
+
top: 180,
|
|
2813
|
+
right: -90,
|
|
2814
|
+
bottom: 0,
|
|
2815
|
+
left: 90
|
|
2816
|
+
};
|
|
2817
|
+
function PopperArrow(props) {
|
|
2818
|
+
const context = usePopperContext();
|
|
2819
|
+
const [local, others] = splitProps(mergeDefaultProps({ size: DEFAULT_SIZE }, props), [
|
|
2820
|
+
"ref",
|
|
2821
|
+
"style",
|
|
2822
|
+
"size"
|
|
2823
|
+
]);
|
|
2824
|
+
const dir = () => context.currentPlacement().split("-")[0];
|
|
2825
|
+
const contentStyle = createComputedStyle(context.contentRef);
|
|
2826
|
+
const fill = () => contentStyle()?.getPropertyValue("background-color") || "none";
|
|
2827
|
+
const stroke = () => contentStyle()?.getPropertyValue(`border-${dir()}-color`) || "none";
|
|
2828
|
+
const borderWidth = () => contentStyle()?.getPropertyValue(`border-${dir()}-width`) || "0px";
|
|
2829
|
+
const strokeWidth = () => {
|
|
2830
|
+
return Number.parseInt(borderWidth()) * 2 * (DEFAULT_SIZE / local.size);
|
|
2831
|
+
};
|
|
2832
|
+
const rotate = () => {
|
|
2833
|
+
return `rotate(${ROTATION_DEG[dir()]} ${HALF_DEFAULT_SIZE} ${HALF_DEFAULT_SIZE}) translate(0 2)`;
|
|
2834
|
+
};
|
|
2835
|
+
return createComponent(Polymorphic, mergeProps({
|
|
2836
|
+
as: "div",
|
|
2837
|
+
"aria-hidden": "true",
|
|
2838
|
+
get style() {
|
|
2839
|
+
return combineStyle({
|
|
2840
|
+
position: "absolute",
|
|
2841
|
+
"font-size": `${local.size}px`,
|
|
2842
|
+
width: "1em",
|
|
2843
|
+
height: "1em",
|
|
2844
|
+
"pointer-events": "none",
|
|
2845
|
+
fill: fill(),
|
|
2846
|
+
stroke: stroke(),
|
|
2847
|
+
"stroke-width": strokeWidth()
|
|
2848
|
+
}, local.style);
|
|
2849
|
+
}
|
|
2850
|
+
}, others, { get children() {
|
|
2851
|
+
return ssr(_tmpl$$1, ssrHydrationKey(), ssrAttribute("transform", escape(rotate(), true), false));
|
|
2852
|
+
} }));
|
|
2853
|
+
}
|
|
2854
|
+
function createComputedStyle(element) {
|
|
2855
|
+
const [style, setStyle] = createSignal();
|
|
2856
|
+
createEffect(() => {
|
|
2857
|
+
const el = element();
|
|
2858
|
+
el && setStyle(getWindow$1(el).getComputedStyle(el));
|
|
2859
|
+
});
|
|
2860
|
+
return style;
|
|
2861
|
+
}
|
|
2862
|
+
function PopperPositioner(props) {
|
|
2863
|
+
usePopperContext();
|
|
2864
|
+
const [local, others] = splitProps(props, ["ref", "style"]);
|
|
2865
|
+
return createComponent(Polymorphic, mergeProps({
|
|
2866
|
+
as: "div",
|
|
2867
|
+
"data-popper-positioner": "",
|
|
2868
|
+
get style() {
|
|
2869
|
+
return combineStyle({
|
|
2870
|
+
position: "absolute",
|
|
2871
|
+
top: 0,
|
|
2872
|
+
left: 0,
|
|
2873
|
+
"min-width": "max-content"
|
|
2874
|
+
}, local.style);
|
|
2875
|
+
}
|
|
2876
|
+
}, others));
|
|
2877
|
+
}
|
|
2878
|
+
function createDOMRect(anchorRect) {
|
|
2879
|
+
const { x = 0, y = 0, width = 0, height = 0 } = anchorRect ?? {};
|
|
2880
|
+
if (typeof DOMRect === "function") return new DOMRect(x, y, width, height);
|
|
2881
|
+
const rect = {
|
|
2882
|
+
x,
|
|
2883
|
+
y,
|
|
2884
|
+
width,
|
|
2885
|
+
height,
|
|
2886
|
+
top: y,
|
|
2887
|
+
right: x + width,
|
|
2888
|
+
bottom: y + height,
|
|
2889
|
+
left: x
|
|
2890
|
+
};
|
|
2891
|
+
return {
|
|
2892
|
+
...rect,
|
|
2893
|
+
toJSON: () => rect
|
|
2894
|
+
};
|
|
2895
|
+
}
|
|
2896
|
+
function getAnchorElement(anchor, getAnchorRect) {
|
|
2897
|
+
return {
|
|
2898
|
+
contextElement: anchor,
|
|
2899
|
+
getBoundingClientRect: () => {
|
|
2900
|
+
const anchorRect = getAnchorRect(anchor);
|
|
2901
|
+
if (anchorRect) return createDOMRect(anchorRect);
|
|
2902
|
+
if (anchor) return anchor.getBoundingClientRect();
|
|
2903
|
+
return createDOMRect();
|
|
2904
|
+
}
|
|
2905
|
+
};
|
|
2906
|
+
}
|
|
2907
|
+
function isValidPlacement(flip2) {
|
|
2908
|
+
return /^(?:top|bottom|left|right)(?:-(?:start|end))?$/.test(flip2);
|
|
2909
|
+
}
|
|
2910
|
+
var REVERSE_BASE_PLACEMENT = {
|
|
2911
|
+
top: "bottom",
|
|
2912
|
+
right: "left",
|
|
2913
|
+
bottom: "top",
|
|
2914
|
+
left: "right"
|
|
2915
|
+
};
|
|
2916
|
+
function getTransformOrigin(placement, readingDirection) {
|
|
2917
|
+
const [basePlacement, alignment] = placement.split("-");
|
|
2918
|
+
const reversePlacement = REVERSE_BASE_PLACEMENT[basePlacement];
|
|
2919
|
+
if (!alignment) return `${reversePlacement} center`;
|
|
2920
|
+
if (basePlacement === "left" || basePlacement === "right") return `${reversePlacement} ${alignment === "start" ? "top" : "bottom"}`;
|
|
2921
|
+
if (alignment === "start") return `${reversePlacement} ${readingDirection === "rtl" ? "right" : "left"}`;
|
|
2922
|
+
return `${reversePlacement} ${readingDirection === "rtl" ? "left" : "right"}`;
|
|
2923
|
+
}
|
|
2924
|
+
function PopperRoot(props) {
|
|
2925
|
+
const mergedProps = mergeDefaultProps({
|
|
2926
|
+
getAnchorRect: (anchor) => anchor?.getBoundingClientRect(),
|
|
2927
|
+
placement: "bottom",
|
|
2928
|
+
gutter: 0,
|
|
2929
|
+
shift: 0,
|
|
2930
|
+
flip: true,
|
|
2931
|
+
slide: true,
|
|
2932
|
+
overlap: false,
|
|
2933
|
+
sameWidth: false,
|
|
2934
|
+
fitViewport: false,
|
|
2935
|
+
hideWhenDetached: false,
|
|
2936
|
+
detachedPadding: 0,
|
|
2937
|
+
arrowPadding: 4,
|
|
2938
|
+
overflowPadding: 8
|
|
2939
|
+
}, props);
|
|
2940
|
+
const [positionerRef, setPositionerRef] = createSignal();
|
|
2941
|
+
const [arrowRef, setArrowRef] = createSignal();
|
|
2942
|
+
const [currentPlacement, setCurrentPlacement] = createSignal(mergedProps.placement);
|
|
2943
|
+
const anchorRef = () => getAnchorElement(mergedProps.anchorRef?.(), mergedProps.getAnchorRect);
|
|
2944
|
+
const { direction } = useLocale();
|
|
2945
|
+
async function updatePosition() {
|
|
2946
|
+
const referenceEl = anchorRef();
|
|
2947
|
+
const floatingEl = positionerRef();
|
|
2948
|
+
const arrowEl = arrowRef();
|
|
2949
|
+
if (!referenceEl || !floatingEl) return;
|
|
2950
|
+
const arrowOffset = (arrowEl?.clientHeight || 0) / 2;
|
|
2951
|
+
const finalGutter = typeof mergedProps.gutter === "number" ? mergedProps.gutter + arrowOffset : mergedProps.gutter ?? arrowOffset;
|
|
2952
|
+
floatingEl.style.setProperty("--kb-popper-content-overflow-padding", `${mergedProps.overflowPadding}px`);
|
|
2953
|
+
referenceEl.getBoundingClientRect();
|
|
2954
|
+
const middleware = [offset(({ placement }) => {
|
|
2955
|
+
const hasAlignment = !!placement.split("-")[1];
|
|
2956
|
+
return {
|
|
2957
|
+
mainAxis: finalGutter,
|
|
2958
|
+
crossAxis: !hasAlignment ? mergedProps.shift : void 0,
|
|
2959
|
+
alignmentAxis: mergedProps.shift
|
|
2960
|
+
};
|
|
2961
|
+
})];
|
|
2962
|
+
if (mergedProps.flip !== false) {
|
|
2963
|
+
const fallbackPlacements = typeof mergedProps.flip === "string" ? mergedProps.flip.split(" ") : void 0;
|
|
2964
|
+
if (fallbackPlacements !== void 0 && !fallbackPlacements.every(isValidPlacement)) throw new Error("`flip` expects a spaced-delimited list of placements");
|
|
2965
|
+
middleware.push(flip({
|
|
2966
|
+
padding: mergedProps.overflowPadding,
|
|
2967
|
+
fallbackPlacements
|
|
2968
|
+
}));
|
|
2969
|
+
}
|
|
2970
|
+
if (mergedProps.slide || mergedProps.overlap) middleware.push(shift({
|
|
2971
|
+
mainAxis: mergedProps.slide,
|
|
2972
|
+
crossAxis: mergedProps.overlap,
|
|
2973
|
+
padding: mergedProps.overflowPadding
|
|
2974
|
+
}));
|
|
2975
|
+
middleware.push(size({
|
|
2976
|
+
padding: mergedProps.overflowPadding,
|
|
2977
|
+
apply({ availableWidth, availableHeight, rects }) {
|
|
2978
|
+
const referenceWidth = Math.round(rects.reference.width);
|
|
2979
|
+
availableWidth = Math.floor(availableWidth);
|
|
2980
|
+
availableHeight = Math.floor(availableHeight);
|
|
2981
|
+
floatingEl.style.setProperty("--kb-popper-anchor-width", `${referenceWidth}px`);
|
|
2982
|
+
floatingEl.style.setProperty("--kb-popper-content-available-width", `${availableWidth}px`);
|
|
2983
|
+
floatingEl.style.setProperty("--kb-popper-content-available-height", `${availableHeight}px`);
|
|
2984
|
+
if (mergedProps.sameWidth) floatingEl.style.width = `${referenceWidth}px`;
|
|
2985
|
+
if (mergedProps.fitViewport) {
|
|
2986
|
+
floatingEl.style.maxWidth = `${availableWidth}px`;
|
|
2987
|
+
floatingEl.style.maxHeight = `${availableHeight}px`;
|
|
2988
|
+
}
|
|
2989
|
+
}
|
|
2990
|
+
}));
|
|
2991
|
+
if (mergedProps.hideWhenDetached) middleware.push(hide({ padding: mergedProps.detachedPadding }));
|
|
2992
|
+
if (arrowEl) middleware.push(arrow({
|
|
2993
|
+
element: arrowEl,
|
|
2994
|
+
padding: mergedProps.arrowPadding
|
|
2995
|
+
}));
|
|
2996
|
+
const pos = await computePosition(referenceEl, floatingEl, {
|
|
2997
|
+
placement: mergedProps.placement,
|
|
2998
|
+
strategy: "absolute",
|
|
2999
|
+
middleware,
|
|
3000
|
+
platform: {
|
|
3001
|
+
...platform,
|
|
3002
|
+
isRTL: () => direction() === "rtl"
|
|
3003
|
+
}
|
|
3004
|
+
});
|
|
3005
|
+
setCurrentPlacement(pos.placement);
|
|
3006
|
+
mergedProps.onCurrentPlacementChange?.(pos.placement);
|
|
3007
|
+
if (!floatingEl) return;
|
|
3008
|
+
floatingEl.style.setProperty("--kb-popper-content-transform-origin", getTransformOrigin(pos.placement, direction()));
|
|
3009
|
+
const x = Math.round(pos.x);
|
|
3010
|
+
const y = Math.round(pos.y);
|
|
3011
|
+
let visibility;
|
|
3012
|
+
if (mergedProps.hideWhenDetached) visibility = pos.middlewareData.hide?.referenceHidden ? "hidden" : "visible";
|
|
3013
|
+
Object.assign(floatingEl.style, {
|
|
3014
|
+
top: "0",
|
|
3015
|
+
left: "0",
|
|
3016
|
+
transform: `translate3d(${x}px, ${y}px, 0)`,
|
|
3017
|
+
visibility
|
|
3018
|
+
});
|
|
3019
|
+
if (arrowEl && pos.middlewareData.arrow) {
|
|
3020
|
+
const { x: arrowX, y: arrowY } = pos.middlewareData.arrow;
|
|
3021
|
+
const dir = pos.placement.split("-")[0];
|
|
3022
|
+
Object.assign(arrowEl.style, {
|
|
3023
|
+
left: arrowX != null ? `${arrowX}px` : "",
|
|
3024
|
+
top: arrowY != null ? `${arrowY}px` : "",
|
|
3025
|
+
[dir]: "100%"
|
|
3026
|
+
});
|
|
3027
|
+
}
|
|
3028
|
+
}
|
|
3029
|
+
createEffect(() => {
|
|
3030
|
+
const referenceEl = anchorRef();
|
|
3031
|
+
const floatingEl = positionerRef();
|
|
3032
|
+
if (!referenceEl || !floatingEl) return;
|
|
3033
|
+
onCleanup(autoUpdate(referenceEl, floatingEl, updatePosition, { elementResize: typeof ResizeObserver === "function" }));
|
|
3034
|
+
});
|
|
3035
|
+
createEffect(() => {
|
|
3036
|
+
const positioner = positionerRef();
|
|
3037
|
+
const content = mergedProps.contentRef?.();
|
|
3038
|
+
if (!positioner || !content) return;
|
|
3039
|
+
queueMicrotask(() => {
|
|
3040
|
+
positioner.style.zIndex = getComputedStyle(content).zIndex;
|
|
3041
|
+
});
|
|
3042
|
+
});
|
|
3043
|
+
const context = {
|
|
3044
|
+
currentPlacement,
|
|
3045
|
+
contentRef: () => mergedProps.contentRef?.(),
|
|
3046
|
+
setPositionerRef,
|
|
3047
|
+
setArrowRef
|
|
3048
|
+
};
|
|
3049
|
+
return createComponent(PopperContext.Provider, {
|
|
3050
|
+
value: context,
|
|
3051
|
+
get children() {
|
|
3052
|
+
return mergedProps.children;
|
|
3053
|
+
}
|
|
3054
|
+
});
|
|
3055
|
+
}
|
|
3056
|
+
var Popper = Object.assign(PopperRoot, {
|
|
3057
|
+
Arrow: PopperArrow,
|
|
3058
|
+
Context: PopperContext,
|
|
3059
|
+
usePopperContext,
|
|
3060
|
+
Positioner: PopperPositioner
|
|
3061
|
+
});
|
|
3062
|
+
function createFocusScope(props, ref) {
|
|
3063
|
+
const [isPaused, setIsPaused] = createSignal(false);
|
|
3064
|
+
createEffect(() => {});
|
|
3065
|
+
createEffect(() => {});
|
|
3066
|
+
createEffect(() => {});
|
|
3067
|
+
}
|
|
3068
|
+
function createHideOutside(props) {
|
|
3069
|
+
createEffect(() => {
|
|
3070
|
+
if (access$1(props.isDisabled)) return;
|
|
3071
|
+
onCleanup(ariaHideOutside(access$1(props.targets), access$1(props.root)));
|
|
3072
|
+
});
|
|
3073
|
+
}
|
|
3074
|
+
var refCountMap = /* @__PURE__ */ new WeakMap();
|
|
3075
|
+
var observerStack = [];
|
|
3076
|
+
function ariaHideOutside(targets, root = document.body) {
|
|
3077
|
+
const visibleNodes = new Set(targets);
|
|
3078
|
+
const hiddenNodes = /* @__PURE__ */ new Set();
|
|
3079
|
+
const walk = (root2) => {
|
|
3080
|
+
for (const element of root2.querySelectorAll(`[${DATA_LIVE_ANNOUNCER_ATTR}], [${DATA_TOP_LAYER_ATTR}]`)) visibleNodes.add(element);
|
|
3081
|
+
const acceptNode = (node) => {
|
|
3082
|
+
if (visibleNodes.has(node) || node.parentElement && hiddenNodes.has(node.parentElement) && node.parentElement.getAttribute("role") !== "row") return NodeFilter.FILTER_REJECT;
|
|
3083
|
+
for (const target of visibleNodes) if (node.contains(target)) return NodeFilter.FILTER_SKIP;
|
|
3084
|
+
return NodeFilter.FILTER_ACCEPT;
|
|
3085
|
+
};
|
|
3086
|
+
const walker = document.createTreeWalker(root2, NodeFilter.SHOW_ELEMENT, { acceptNode });
|
|
3087
|
+
const acceptRoot = acceptNode(root2);
|
|
3088
|
+
if (acceptRoot === NodeFilter.FILTER_ACCEPT) hide(root2);
|
|
3089
|
+
if (acceptRoot !== NodeFilter.FILTER_REJECT) {
|
|
3090
|
+
let node = walker.nextNode();
|
|
3091
|
+
while (node != null) {
|
|
3092
|
+
hide(node);
|
|
3093
|
+
node = walker.nextNode();
|
|
3094
|
+
}
|
|
3095
|
+
}
|
|
3096
|
+
};
|
|
3097
|
+
const hide = (node) => {
|
|
3098
|
+
const refCount = refCountMap.get(node) ?? 0;
|
|
3099
|
+
if (node.getAttribute("aria-hidden") === "true" && refCount === 0) return;
|
|
3100
|
+
if (refCount === 0) setTimeout(() => requestAnimationFrame(() => node.setAttribute("aria-hidden", "true")));
|
|
3101
|
+
hiddenNodes.add(node);
|
|
3102
|
+
refCountMap.set(node, refCount + 1);
|
|
3103
|
+
};
|
|
3104
|
+
if (observerStack.length) observerStack[observerStack.length - 1].disconnect();
|
|
3105
|
+
walk(root);
|
|
3106
|
+
const observer = new MutationObserver((changes) => {
|
|
3107
|
+
for (const change of changes) {
|
|
3108
|
+
if (change.type !== "childList" || change.addedNodes.length === 0) continue;
|
|
3109
|
+
if (![...visibleNodes, ...hiddenNodes].some((node) => node.contains(change.target))) {
|
|
3110
|
+
for (const node of change.removedNodes) if (node instanceof Element) {
|
|
3111
|
+
visibleNodes.delete(node);
|
|
3112
|
+
hiddenNodes.delete(node);
|
|
3113
|
+
}
|
|
3114
|
+
for (const node of change.addedNodes) if ((node instanceof HTMLElement || node instanceof SVGElement) && (node.dataset.liveAnnouncer === "true" || node.dataset.reactAriaTopLayer === "true")) visibleNodes.add(node);
|
|
3115
|
+
else if (node instanceof Element) walk(node);
|
|
3116
|
+
}
|
|
3117
|
+
}
|
|
3118
|
+
});
|
|
3119
|
+
observer.observe(root, {
|
|
3120
|
+
childList: true,
|
|
3121
|
+
subtree: true
|
|
3122
|
+
});
|
|
3123
|
+
const observerWrapper = {
|
|
3124
|
+
observe() {
|
|
3125
|
+
observer.observe(root, {
|
|
3126
|
+
childList: true,
|
|
3127
|
+
subtree: true
|
|
3128
|
+
});
|
|
3129
|
+
},
|
|
3130
|
+
disconnect() {
|
|
3131
|
+
observer.disconnect();
|
|
3132
|
+
}
|
|
3133
|
+
};
|
|
3134
|
+
observerStack.push(observerWrapper);
|
|
3135
|
+
return () => {
|
|
3136
|
+
observer.disconnect();
|
|
3137
|
+
for (const node of hiddenNodes) {
|
|
3138
|
+
const count = refCountMap.get(node);
|
|
3139
|
+
if (count == null) return;
|
|
3140
|
+
if (count === 1) {
|
|
3141
|
+
setTimeout(() => requestAnimationFrame(() => node.removeAttribute("aria-hidden")));
|
|
3142
|
+
refCountMap.delete(node);
|
|
3143
|
+
} else refCountMap.set(node, count - 1);
|
|
3144
|
+
}
|
|
3145
|
+
if (observerWrapper === observerStack[observerStack.length - 1]) {
|
|
3146
|
+
observerStack.pop();
|
|
3147
|
+
if (observerStack.length) observerStack[observerStack.length - 1].observe();
|
|
3148
|
+
} else observerStack.splice(observerStack.indexOf(observerWrapper), 1);
|
|
3149
|
+
};
|
|
3150
|
+
}
|
|
3151
|
+
function createEscapeKeyDown(props) {
|
|
3152
|
+
createEffect(() => {});
|
|
3153
|
+
}
|
|
3154
|
+
function createInteractOutside(props, ref) {
|
|
3155
|
+
createEffect(() => {});
|
|
3156
|
+
}
|
|
3157
|
+
var DismissableLayerContext = createContext();
|
|
3158
|
+
function useOptionalDismissableLayerContext() {
|
|
3159
|
+
return useContext(DismissableLayerContext);
|
|
3160
|
+
}
|
|
3161
|
+
function DismissableLayer(props) {
|
|
3162
|
+
let ref;
|
|
3163
|
+
const parentContext = useOptionalDismissableLayerContext();
|
|
3164
|
+
const [local, others] = splitProps(props, [
|
|
3165
|
+
"ref",
|
|
3166
|
+
"disableOutsidePointerEvents",
|
|
3167
|
+
"excludedElements",
|
|
3168
|
+
"onEscapeKeyDown",
|
|
3169
|
+
"onPointerDownOutside",
|
|
3170
|
+
"onFocusOutside",
|
|
3171
|
+
"onInteractOutside",
|
|
3172
|
+
"onDismiss",
|
|
3173
|
+
"bypassTopMostLayerCheck"
|
|
3174
|
+
]);
|
|
3175
|
+
const nestedLayers = /* @__PURE__ */ new Set([]);
|
|
3176
|
+
const registerNestedLayer = (element) => {
|
|
3177
|
+
nestedLayers.add(element);
|
|
3178
|
+
const parentUnregister = parentContext?.registerNestedLayer(element);
|
|
3179
|
+
return () => {
|
|
3180
|
+
nestedLayers.delete(element);
|
|
3181
|
+
parentUnregister?.();
|
|
3182
|
+
};
|
|
3183
|
+
};
|
|
3184
|
+
const shouldExcludeElement = (element) => {
|
|
3185
|
+
return false;
|
|
3186
|
+
};
|
|
3187
|
+
const onPointerDownOutside = (e) => {};
|
|
3188
|
+
const onFocusOutside = (e) => {
|
|
3189
|
+
local.onFocusOutside?.(e);
|
|
3190
|
+
local.onInteractOutside?.(e);
|
|
3191
|
+
if (!e.defaultPrevented) local.onDismiss?.();
|
|
3192
|
+
};
|
|
3193
|
+
createInteractOutside({
|
|
3194
|
+
shouldExcludeElement,
|
|
3195
|
+
onPointerDownOutside,
|
|
3196
|
+
onFocusOutside
|
|
3197
|
+
}, () => ref);
|
|
3198
|
+
createEscapeKeyDown({
|
|
3199
|
+
ownerDocument: () => getDocument(ref),
|
|
3200
|
+
onEscapeKeyDown: (e) => {}
|
|
3201
|
+
});
|
|
3202
|
+
onMount(() => {});
|
|
3203
|
+
createEffect(on([() => ref, () => local.disableOutsidePointerEvents], ([ref2, disableOutsidePointerEvents]) => {
|
|
3204
|
+
if (!ref2) return;
|
|
3205
|
+
const layer = layerStack.find(ref2);
|
|
3206
|
+
if (layer && layer.isPointerBlocking !== disableOutsidePointerEvents) {
|
|
3207
|
+
layer.isPointerBlocking = disableOutsidePointerEvents;
|
|
3208
|
+
layerStack.assignPointerEventToLayers();
|
|
3209
|
+
}
|
|
3210
|
+
if (disableOutsidePointerEvents) layerStack.disableBodyPointerEvents(ref2);
|
|
3211
|
+
onCleanup(() => {
|
|
3212
|
+
layerStack.restoreBodyPointerEvents(ref2);
|
|
3213
|
+
});
|
|
3214
|
+
}, { defer: true }));
|
|
3215
|
+
const context = { registerNestedLayer };
|
|
3216
|
+
return createComponent(DismissableLayerContext.Provider, {
|
|
3217
|
+
value: context,
|
|
3218
|
+
get children() {
|
|
3219
|
+
return createComponent(Polymorphic, mergeProps({ as: "div" }, others));
|
|
3220
|
+
}
|
|
3221
|
+
});
|
|
3222
|
+
}
|
|
3223
|
+
function createDisclosureState(props = {}) {
|
|
3224
|
+
const [isOpen, setIsOpen] = createControllableBooleanSignal({
|
|
3225
|
+
value: () => access$1(props.open),
|
|
3226
|
+
defaultValue: () => !!access$1(props.defaultOpen),
|
|
3227
|
+
onChange: (value) => props.onOpenChange?.(value)
|
|
3228
|
+
});
|
|
3229
|
+
const open = () => {
|
|
3230
|
+
setIsOpen(true);
|
|
3231
|
+
};
|
|
3232
|
+
const close = () => {
|
|
3233
|
+
setIsOpen(false);
|
|
3234
|
+
};
|
|
3235
|
+
const toggle = () => {
|
|
3236
|
+
isOpen() ? close() : open();
|
|
3237
|
+
};
|
|
3238
|
+
return {
|
|
3239
|
+
isOpen,
|
|
3240
|
+
setIsOpen,
|
|
3241
|
+
open,
|
|
3242
|
+
close,
|
|
3243
|
+
toggle
|
|
3244
|
+
};
|
|
3245
|
+
}
|
|
3246
|
+
var contains = (wrapper, target) => {
|
|
3247
|
+
if (wrapper.contains(target)) return true;
|
|
3248
|
+
let currentElement = target;
|
|
3249
|
+
while (currentElement) {
|
|
3250
|
+
if (currentElement === wrapper) return true;
|
|
3251
|
+
currentElement = currentElement._$host ?? currentElement.parentElement;
|
|
3252
|
+
}
|
|
3253
|
+
return false;
|
|
3254
|
+
};
|
|
3255
|
+
var activeStyles = /* @__PURE__ */ new Map();
|
|
3256
|
+
var createStyle = (props) => {
|
|
3257
|
+
createEffect(() => {
|
|
3258
|
+
const style = access(props.style) ?? {};
|
|
3259
|
+
const properties = access(props.properties) ?? [];
|
|
3260
|
+
const originalStyles = {};
|
|
3261
|
+
for (const key in style) originalStyles[key] = props.element.style[key];
|
|
3262
|
+
const activeStyle = activeStyles.get(props.key);
|
|
3263
|
+
if (activeStyle) activeStyle.activeCount++;
|
|
3264
|
+
else activeStyles.set(props.key, {
|
|
3265
|
+
activeCount: 1,
|
|
3266
|
+
originalStyles,
|
|
3267
|
+
properties: properties.map((property) => property.key)
|
|
3268
|
+
});
|
|
3269
|
+
Object.assign(props.element.style, props.style);
|
|
3270
|
+
for (const property of properties) props.element.style.setProperty(property.key, property.value);
|
|
3271
|
+
onCleanup(() => {
|
|
3272
|
+
const activeStyle2 = activeStyles.get(props.key);
|
|
3273
|
+
if (!activeStyle2) return;
|
|
3274
|
+
if (activeStyle2.activeCount !== 1) {
|
|
3275
|
+
activeStyle2.activeCount--;
|
|
3276
|
+
return;
|
|
3277
|
+
}
|
|
3278
|
+
activeStyles.delete(props.key);
|
|
3279
|
+
for (const [key, value] of Object.entries(activeStyle2.originalStyles)) props.element.style[key] = value;
|
|
3280
|
+
for (const property of activeStyle2.properties) props.element.style.removeProperty(property);
|
|
3281
|
+
if (props.element.style.length === 0) props.element.removeAttribute("style");
|
|
3282
|
+
props.cleanup?.();
|
|
3283
|
+
});
|
|
3284
|
+
});
|
|
3285
|
+
};
|
|
3286
|
+
var style_default = createStyle;
|
|
3287
|
+
var getScrollDimensions = (element, axis) => {
|
|
3288
|
+
switch (axis) {
|
|
3289
|
+
case "x": return [
|
|
3290
|
+
element.clientWidth,
|
|
3291
|
+
element.scrollLeft,
|
|
3292
|
+
element.scrollWidth
|
|
3293
|
+
];
|
|
3294
|
+
case "y": return [
|
|
3295
|
+
element.clientHeight,
|
|
3296
|
+
element.scrollTop,
|
|
3297
|
+
element.scrollHeight
|
|
3298
|
+
];
|
|
3299
|
+
}
|
|
3300
|
+
};
|
|
3301
|
+
var isScrollContainer = (element, axis) => {
|
|
3302
|
+
const styles = getComputedStyle(element);
|
|
3303
|
+
const overflow = axis === "x" ? styles.overflowX : styles.overflowY;
|
|
3304
|
+
return overflow === "auto" || overflow === "scroll" || element.tagName === "HTML" && overflow === "visible";
|
|
3305
|
+
};
|
|
3306
|
+
var getScrollAtLocation = (location, axis, stopAt) => {
|
|
3307
|
+
const directionFactor = axis === "x" && window.getComputedStyle(location).direction === "rtl" ? -1 : 1;
|
|
3308
|
+
let currentElement = location;
|
|
3309
|
+
let availableScroll = 0;
|
|
3310
|
+
let availableScrollTop = 0;
|
|
3311
|
+
let wrapperReached = false;
|
|
3312
|
+
do {
|
|
3313
|
+
const [clientSize, scrollOffset, scrollSize] = getScrollDimensions(currentElement, axis);
|
|
3314
|
+
const scrolled = scrollSize - clientSize - directionFactor * scrollOffset;
|
|
3315
|
+
if ((scrollOffset !== 0 || scrolled !== 0) && isScrollContainer(currentElement, axis)) {
|
|
3316
|
+
availableScroll += scrolled;
|
|
3317
|
+
availableScrollTop += scrollOffset;
|
|
3318
|
+
}
|
|
3319
|
+
if (currentElement === (stopAt ?? document.documentElement)) wrapperReached = true;
|
|
3320
|
+
else currentElement = currentElement._$host ?? currentElement.parentElement;
|
|
3321
|
+
} while (currentElement && !wrapperReached);
|
|
3322
|
+
return [availableScroll, availableScrollTop];
|
|
3323
|
+
};
|
|
3324
|
+
var [preventScrollStack, setPreventScrollStack] = createSignal([]);
|
|
3325
|
+
var isActive = (id) => preventScrollStack().indexOf(id) === preventScrollStack().length - 1;
|
|
3326
|
+
var createPreventScroll = (props) => {
|
|
3327
|
+
const defaultedProps = mergeProps({
|
|
3328
|
+
element: null,
|
|
3329
|
+
enabled: true,
|
|
3330
|
+
hideScrollbar: true,
|
|
3331
|
+
preventScrollbarShift: true,
|
|
3332
|
+
preventScrollbarShiftMode: "padding",
|
|
3333
|
+
restoreScrollPosition: true,
|
|
3334
|
+
allowPinchZoom: false
|
|
3335
|
+
}, props);
|
|
3336
|
+
const preventScrollId = createUniqueId();
|
|
3337
|
+
let currentTouchStart = [0, 0];
|
|
3338
|
+
let currentTouchStartAxis = null;
|
|
3339
|
+
let currentTouchStartDelta = null;
|
|
3340
|
+
createEffect(() => {
|
|
3341
|
+
if (!access(defaultedProps.enabled)) return;
|
|
3342
|
+
setPreventScrollStack((stack) => [...stack, preventScrollId]);
|
|
3343
|
+
onCleanup(() => {
|
|
3344
|
+
setPreventScrollStack((stack) => stack.filter((id) => id !== preventScrollId));
|
|
3345
|
+
});
|
|
3346
|
+
});
|
|
3347
|
+
createEffect(() => {
|
|
3348
|
+
if (!access(defaultedProps.enabled) || !access(defaultedProps.hideScrollbar)) return;
|
|
3349
|
+
const { documentElement } = document;
|
|
3350
|
+
const scrollbarWidth = window.innerWidth - documentElement.clientWidth;
|
|
3351
|
+
if (access(defaultedProps.preventScrollbarShift)) {
|
|
3352
|
+
const style = { overflow: "hidden" };
|
|
3353
|
+
const properties = [];
|
|
3354
|
+
if (scrollbarWidth > 0) {
|
|
3355
|
+
if (access(defaultedProps.preventScrollbarShiftMode) === "padding") style.paddingRight = `calc(${window.getComputedStyle(documentElement).paddingRight} + ${scrollbarWidth}px)`;
|
|
3356
|
+
else style.marginRight = `calc(${window.getComputedStyle(documentElement).marginRight} + ${scrollbarWidth}px)`;
|
|
3357
|
+
properties.push({
|
|
3358
|
+
key: "--scrollbar-width",
|
|
3359
|
+
value: `${scrollbarWidth}px`
|
|
3360
|
+
});
|
|
3361
|
+
}
|
|
3362
|
+
const offsetTop = window.scrollY;
|
|
3363
|
+
const offsetLeft = window.scrollX;
|
|
3364
|
+
style_default({
|
|
3365
|
+
key: "prevent-scroll",
|
|
3366
|
+
element: documentElement,
|
|
3367
|
+
style,
|
|
3368
|
+
properties,
|
|
3369
|
+
cleanup: () => {
|
|
3370
|
+
if (access(defaultedProps.restoreScrollPosition) && scrollbarWidth > 0) window.scrollTo(offsetLeft, offsetTop);
|
|
3371
|
+
}
|
|
3372
|
+
});
|
|
3373
|
+
} else style_default({
|
|
3374
|
+
key: "prevent-scroll",
|
|
3375
|
+
element: documentElement,
|
|
3376
|
+
style: { overflow: "hidden" }
|
|
3377
|
+
});
|
|
3378
|
+
});
|
|
3379
|
+
createEffect(() => {
|
|
3380
|
+
if (!isActive(preventScrollId) || !access(defaultedProps.enabled)) return;
|
|
3381
|
+
document.addEventListener("wheel", maybePreventWheel, { passive: false });
|
|
3382
|
+
document.addEventListener("touchstart", logTouchStart, { passive: false });
|
|
3383
|
+
document.addEventListener("touchmove", maybePreventTouch, { passive: false });
|
|
3384
|
+
onCleanup(() => {
|
|
3385
|
+
document.removeEventListener("wheel", maybePreventWheel);
|
|
3386
|
+
document.removeEventListener("touchstart", logTouchStart);
|
|
3387
|
+
document.removeEventListener("touchmove", maybePreventTouch);
|
|
3388
|
+
});
|
|
3389
|
+
});
|
|
3390
|
+
const logTouchStart = (event) => {
|
|
3391
|
+
currentTouchStart = getTouchXY(event);
|
|
3392
|
+
currentTouchStartAxis = null;
|
|
3393
|
+
currentTouchStartDelta = null;
|
|
3394
|
+
};
|
|
3395
|
+
const maybePreventWheel = (event) => {
|
|
3396
|
+
const target = event.target;
|
|
3397
|
+
const wrapper = access(defaultedProps.element);
|
|
3398
|
+
const delta = getDeltaXY(event);
|
|
3399
|
+
const axis = Math.abs(delta[0]) > Math.abs(delta[1]) ? "x" : "y";
|
|
3400
|
+
const resultsInScroll = wouldScroll(target, axis, axis === "x" ? delta[0] : delta[1], wrapper);
|
|
3401
|
+
let shouldCancel;
|
|
3402
|
+
if (wrapper && contains(wrapper, target)) shouldCancel = !resultsInScroll;
|
|
3403
|
+
else shouldCancel = true;
|
|
3404
|
+
if (shouldCancel && event.cancelable) event.preventDefault();
|
|
3405
|
+
};
|
|
3406
|
+
const maybePreventTouch = (event) => {
|
|
3407
|
+
const wrapper = access(defaultedProps.element);
|
|
3408
|
+
const target = event.target;
|
|
3409
|
+
let shouldCancel;
|
|
3410
|
+
if (event.touches.length === 2) shouldCancel = !access(defaultedProps.allowPinchZoom);
|
|
3411
|
+
else {
|
|
3412
|
+
if (currentTouchStartAxis == null || currentTouchStartDelta === null) {
|
|
3413
|
+
const delta = getTouchXY(event).map((touch, i) => currentTouchStart[i] - touch);
|
|
3414
|
+
const axis = Math.abs(delta[0]) > Math.abs(delta[1]) ? "x" : "y";
|
|
3415
|
+
currentTouchStartAxis = axis;
|
|
3416
|
+
currentTouchStartDelta = axis === "x" ? delta[0] : delta[1];
|
|
3417
|
+
}
|
|
3418
|
+
if (target.type === "range") shouldCancel = false;
|
|
3419
|
+
else {
|
|
3420
|
+
const wouldResultInScroll = wouldScroll(target, currentTouchStartAxis, currentTouchStartDelta, wrapper);
|
|
3421
|
+
if (wrapper && contains(wrapper, target)) shouldCancel = !wouldResultInScroll;
|
|
3422
|
+
else shouldCancel = true;
|
|
3423
|
+
}
|
|
3424
|
+
}
|
|
3425
|
+
if (shouldCancel && event.cancelable) event.preventDefault();
|
|
3426
|
+
};
|
|
3427
|
+
};
|
|
3428
|
+
var getDeltaXY = (event) => [event.deltaX, event.deltaY];
|
|
3429
|
+
var getTouchXY = (event) => event.changedTouches[0] ? [event.changedTouches[0].clientX, event.changedTouches[0].clientY] : [0, 0];
|
|
3430
|
+
var wouldScroll = (target, axis, delta, wrapper) => {
|
|
3431
|
+
const [availableScroll, availableScrollTop] = getScrollAtLocation(target, axis, wrapper !== null && contains(wrapper, target) ? wrapper : void 0);
|
|
3432
|
+
if (delta > 0 && Math.abs(availableScroll) <= 1) return false;
|
|
3433
|
+
if (delta < 0 && Math.abs(availableScrollTop) < 1) return false;
|
|
3434
|
+
return true;
|
|
3435
|
+
};
|
|
3436
|
+
var index_default = createPreventScroll;
|
|
3437
|
+
__export({}, {
|
|
3438
|
+
Arrow: () => PopperArrow,
|
|
3439
|
+
Content: () => SelectContent,
|
|
3440
|
+
Description: () => FormControlDescription,
|
|
3441
|
+
ErrorMessage: () => FormControlErrorMessage,
|
|
3442
|
+
HiddenSelect: () => SelectHiddenSelect,
|
|
3443
|
+
Icon: () => SelectIcon,
|
|
3444
|
+
Item: () => ListboxItem,
|
|
3445
|
+
ItemDescription: () => ListboxItemDescription,
|
|
3446
|
+
ItemIndicator: () => ListboxItemIndicator,
|
|
3447
|
+
ItemLabel: () => ListboxItemLabel,
|
|
3448
|
+
Label: () => SelectLabel,
|
|
3449
|
+
Listbox: () => SelectListbox,
|
|
3450
|
+
Portal: () => SelectPortal,
|
|
3451
|
+
Root: () => SelectRoot,
|
|
3452
|
+
Section: () => ListboxSection,
|
|
3453
|
+
Select: () => Select,
|
|
3454
|
+
Trigger: () => SelectTrigger,
|
|
3455
|
+
Value: () => SelectValue,
|
|
3456
|
+
useSelectContext: () => useSelectContext
|
|
3457
|
+
});
|
|
3458
|
+
var SelectContext = createContext();
|
|
3459
|
+
function useSelectContext() {
|
|
3460
|
+
const context = useContext(SelectContext);
|
|
3461
|
+
if (context === void 0) throw new Error("[kobalte]: `useSelectContext` must be used within a `Select` component");
|
|
3462
|
+
return context;
|
|
3463
|
+
}
|
|
3464
|
+
function SelectContent(props) {
|
|
3465
|
+
let ref;
|
|
3466
|
+
const context = useSelectContext();
|
|
3467
|
+
const [local, others] = splitProps(props, [
|
|
3468
|
+
"ref",
|
|
3469
|
+
"style",
|
|
3470
|
+
"onCloseAutoFocus",
|
|
3471
|
+
"onFocusOutside"
|
|
3472
|
+
]);
|
|
3473
|
+
const onEscapeKeyDown = (e) => {
|
|
3474
|
+
context.close();
|
|
3475
|
+
};
|
|
3476
|
+
const onFocusOutside = (e) => {
|
|
3477
|
+
local.onFocusOutside?.(e);
|
|
3478
|
+
if (context.isOpen() && context.isModal()) e.preventDefault();
|
|
3479
|
+
};
|
|
3480
|
+
createHideOutside({
|
|
3481
|
+
isDisabled: () => !(context.isOpen() && context.isModal()),
|
|
3482
|
+
targets: () => []
|
|
3483
|
+
});
|
|
3484
|
+
index_default({
|
|
3485
|
+
element: () => null,
|
|
3486
|
+
enabled: () => context.contentPresent() && context.preventScroll()
|
|
3487
|
+
});
|
|
3488
|
+
createFocusScope({
|
|
3489
|
+
trapFocus: () => context.isOpen() && context.isModal(),
|
|
3490
|
+
onMountAutoFocus: (e) => {
|
|
3491
|
+
e.preventDefault();
|
|
3492
|
+
},
|
|
3493
|
+
onUnmountAutoFocus: (e) => {
|
|
3494
|
+
local.onCloseAutoFocus?.(e);
|
|
3495
|
+
if (!e.defaultPrevented) {
|
|
3496
|
+
focusWithoutScrolling(context.triggerRef());
|
|
3497
|
+
e.preventDefault();
|
|
3498
|
+
}
|
|
3499
|
+
}
|
|
3500
|
+
}, () => ref);
|
|
3501
|
+
return createComponent(Show, {
|
|
3502
|
+
get when() {
|
|
3503
|
+
return context.contentPresent();
|
|
3504
|
+
},
|
|
3505
|
+
get children() {
|
|
3506
|
+
return createComponent(Popper.Positioner, { get children() {
|
|
3507
|
+
return createComponent(DismissableLayer, mergeProps({
|
|
3508
|
+
get disableOutsidePointerEvents() {
|
|
3509
|
+
return context.isModal() && context.isOpen();
|
|
3510
|
+
},
|
|
3511
|
+
get excludedElements() {
|
|
3512
|
+
return [context.triggerRef];
|
|
3513
|
+
},
|
|
3514
|
+
get style() {
|
|
3515
|
+
return combineStyle({
|
|
3516
|
+
"--kb-select-content-transform-origin": "var(--kb-popper-content-transform-origin)",
|
|
3517
|
+
position: "relative"
|
|
3518
|
+
}, local.style);
|
|
3519
|
+
},
|
|
3520
|
+
onEscapeKeyDown,
|
|
3521
|
+
onFocusOutside,
|
|
3522
|
+
get onDismiss() {
|
|
3523
|
+
return context.close;
|
|
3524
|
+
}
|
|
3525
|
+
}, () => context.dataset(), others));
|
|
3526
|
+
} });
|
|
3527
|
+
}
|
|
3528
|
+
});
|
|
3529
|
+
}
|
|
3530
|
+
function SelectHiddenSelect(props) {
|
|
3531
|
+
const context = useSelectContext();
|
|
3532
|
+
return createComponent(HiddenSelectBase, mergeProps({
|
|
3533
|
+
get collection() {
|
|
3534
|
+
return context.listState().collection();
|
|
3535
|
+
},
|
|
3536
|
+
get selectionManager() {
|
|
3537
|
+
return context.listState().selectionManager();
|
|
3538
|
+
},
|
|
3539
|
+
get isOpen() {
|
|
3540
|
+
return context.isOpen();
|
|
3541
|
+
},
|
|
3542
|
+
get isMultiple() {
|
|
3543
|
+
return context.isMultiple();
|
|
3544
|
+
},
|
|
3545
|
+
get isVirtualized() {
|
|
3546
|
+
return context.isVirtualized();
|
|
3547
|
+
},
|
|
3548
|
+
focusTrigger: () => context.triggerRef()?.focus()
|
|
3549
|
+
}, props));
|
|
3550
|
+
}
|
|
3551
|
+
function SelectIcon(props) {
|
|
3552
|
+
const context = useSelectContext();
|
|
3553
|
+
return createComponent(Polymorphic, mergeProps({
|
|
3554
|
+
as: "span",
|
|
3555
|
+
"aria-hidden": "true"
|
|
3556
|
+
}, () => context.dataset(), mergeDefaultProps({ children: "▼" }, props)));
|
|
3557
|
+
}
|
|
3558
|
+
function SelectLabel(props) {
|
|
3559
|
+
const context = useSelectContext();
|
|
3560
|
+
const [local, others] = splitProps(props, ["onClick"]);
|
|
3561
|
+
const onClick = (e) => {
|
|
3562
|
+
callHandler(e, local.onClick);
|
|
3563
|
+
if (!context.isDisabled()) context.triggerRef()?.focus();
|
|
3564
|
+
};
|
|
3565
|
+
return createComponent(FormControlLabel, mergeProps({
|
|
3566
|
+
as: "span",
|
|
3567
|
+
onClick
|
|
3568
|
+
}, others));
|
|
3569
|
+
}
|
|
3570
|
+
function SelectListbox(props) {
|
|
3571
|
+
const context = useSelectContext();
|
|
3572
|
+
const [local, others] = splitProps(mergeDefaultProps({ id: context.generateId("listbox") }, props), [
|
|
3573
|
+
"ref",
|
|
3574
|
+
"id",
|
|
3575
|
+
"onKeyDown"
|
|
3576
|
+
]);
|
|
3577
|
+
createEffect(() => onCleanup(context.registerListboxId(local.id)));
|
|
3578
|
+
const onKeyDown = (e) => {
|
|
3579
|
+
callHandler(e, local.onKeyDown);
|
|
3580
|
+
if (e.key === "Escape") e.preventDefault();
|
|
3581
|
+
};
|
|
3582
|
+
return createComponent(ListboxRoot, mergeProps({
|
|
3583
|
+
get id() {
|
|
3584
|
+
return local.id;
|
|
3585
|
+
},
|
|
3586
|
+
get state() {
|
|
3587
|
+
return context.listState();
|
|
3588
|
+
},
|
|
3589
|
+
get virtualized() {
|
|
3590
|
+
return context.isVirtualized();
|
|
3591
|
+
},
|
|
3592
|
+
get autoFocus() {
|
|
3593
|
+
return context.autoFocus();
|
|
3594
|
+
},
|
|
3595
|
+
shouldSelectOnPressUp: true,
|
|
3596
|
+
shouldFocusOnHover: true,
|
|
3597
|
+
get shouldFocusWrap() {
|
|
3598
|
+
return context.shouldFocusWrap();
|
|
3599
|
+
},
|
|
3600
|
+
get disallowTypeAhead() {
|
|
3601
|
+
return context.disallowTypeAhead();
|
|
3602
|
+
},
|
|
3603
|
+
get ["aria-labelledby"]() {
|
|
3604
|
+
return context.listboxAriaLabelledBy();
|
|
3605
|
+
},
|
|
3606
|
+
get renderItem() {
|
|
3607
|
+
return context.renderItem;
|
|
3608
|
+
},
|
|
3609
|
+
get renderSection() {
|
|
3610
|
+
return context.renderSection;
|
|
3611
|
+
},
|
|
3612
|
+
onKeyDown
|
|
3613
|
+
}, others));
|
|
3614
|
+
}
|
|
3615
|
+
function SelectPortal(props) {
|
|
3616
|
+
const context = useSelectContext();
|
|
3617
|
+
return createComponent(Show, {
|
|
3618
|
+
get when() {
|
|
3619
|
+
return context.contentPresent();
|
|
3620
|
+
},
|
|
3621
|
+
get children() {
|
|
3622
|
+
return createComponent(Portal, props);
|
|
3623
|
+
}
|
|
3624
|
+
});
|
|
3625
|
+
}
|
|
3626
|
+
function SelectBase(props) {
|
|
3627
|
+
const [local, popperProps, formControlProps, others] = splitProps(mergeDefaultProps({
|
|
3628
|
+
id: `select-${createUniqueId()}`,
|
|
3629
|
+
selectionMode: "single",
|
|
3630
|
+
disallowEmptySelection: false,
|
|
3631
|
+
closeOnSelection: props.selectionMode === "single",
|
|
3632
|
+
allowDuplicateSelectionEvents: true,
|
|
3633
|
+
gutter: 8,
|
|
3634
|
+
sameWidth: true,
|
|
3635
|
+
modal: false
|
|
3636
|
+
}, props), [
|
|
3637
|
+
"itemComponent",
|
|
3638
|
+
"sectionComponent",
|
|
3639
|
+
"open",
|
|
3640
|
+
"defaultOpen",
|
|
3641
|
+
"onOpenChange",
|
|
3642
|
+
"value",
|
|
3643
|
+
"defaultValue",
|
|
3644
|
+
"onChange",
|
|
3645
|
+
"placeholder",
|
|
3646
|
+
"options",
|
|
3647
|
+
"optionValue",
|
|
3648
|
+
"optionTextValue",
|
|
3649
|
+
"optionDisabled",
|
|
3650
|
+
"optionGroupChildren",
|
|
3651
|
+
"keyboardDelegate",
|
|
3652
|
+
"allowDuplicateSelectionEvents",
|
|
3653
|
+
"disallowEmptySelection",
|
|
3654
|
+
"closeOnSelection",
|
|
3655
|
+
"disallowTypeAhead",
|
|
3656
|
+
"shouldFocusWrap",
|
|
3657
|
+
"selectionBehavior",
|
|
3658
|
+
"selectionMode",
|
|
3659
|
+
"virtualized",
|
|
3660
|
+
"modal",
|
|
3661
|
+
"preventScroll",
|
|
3662
|
+
"forceMount"
|
|
3663
|
+
], [
|
|
3664
|
+
"getAnchorRect",
|
|
3665
|
+
"placement",
|
|
3666
|
+
"gutter",
|
|
3667
|
+
"shift",
|
|
3668
|
+
"flip",
|
|
3669
|
+
"slide",
|
|
3670
|
+
"overlap",
|
|
3671
|
+
"sameWidth",
|
|
3672
|
+
"fitViewport",
|
|
3673
|
+
"hideWhenDetached",
|
|
3674
|
+
"detachedPadding",
|
|
3675
|
+
"arrowPadding",
|
|
3676
|
+
"overflowPadding"
|
|
3677
|
+
], FORM_CONTROL_PROP_NAMES);
|
|
3678
|
+
const [triggerId, setTriggerId] = createSignal();
|
|
3679
|
+
const [valueId, setValueId] = createSignal();
|
|
3680
|
+
const [listboxId, setListboxId] = createSignal();
|
|
3681
|
+
const [triggerRef, setTriggerRef] = createSignal();
|
|
3682
|
+
const [contentRef, setContentRef] = createSignal();
|
|
3683
|
+
const [listboxRef, setListboxRef] = createSignal();
|
|
3684
|
+
const [listboxAriaLabelledBy, setListboxAriaLabelledBy] = createSignal();
|
|
3685
|
+
const [focusStrategy, setFocusStrategy] = createSignal(true);
|
|
3686
|
+
const getOptionValue = (option) => {
|
|
3687
|
+
const optionValue = local.optionValue;
|
|
3688
|
+
if (optionValue == null) return String(option);
|
|
3689
|
+
return String(isFunction(optionValue) ? optionValue(option) : option[optionValue]);
|
|
3690
|
+
};
|
|
3691
|
+
const flattenOptions = createMemo(() => {
|
|
3692
|
+
const optionGroupChildren = local.optionGroupChildren;
|
|
3693
|
+
if (optionGroupChildren == null) return local.options;
|
|
3694
|
+
return local.options.flatMap((item) => item[optionGroupChildren] ?? item);
|
|
3695
|
+
});
|
|
3696
|
+
const flattenOptionKeys = createMemo(() => {
|
|
3697
|
+
return flattenOptions().map((option) => getOptionValue(option));
|
|
3698
|
+
});
|
|
3699
|
+
const getOptionsFromValues = (values) => {
|
|
3700
|
+
return [...values].map((value) => flattenOptions().find((option) => getOptionValue(option) === value)).filter((option) => option != null);
|
|
3701
|
+
};
|
|
3702
|
+
const disclosureState = createDisclosureState({
|
|
3703
|
+
open: () => local.open,
|
|
3704
|
+
defaultOpen: () => local.defaultOpen,
|
|
3705
|
+
onOpenChange: (isOpen) => local.onOpenChange?.(isOpen)
|
|
3706
|
+
});
|
|
3707
|
+
const listState = createListState({
|
|
3708
|
+
selectedKeys: () => {
|
|
3709
|
+
if (local.value != null) return local.value.map(getOptionValue);
|
|
3710
|
+
return local.value;
|
|
3711
|
+
},
|
|
3712
|
+
defaultSelectedKeys: () => {
|
|
3713
|
+
if (local.defaultValue != null) return local.defaultValue.map(getOptionValue);
|
|
3714
|
+
return local.defaultValue;
|
|
3715
|
+
},
|
|
3716
|
+
onSelectionChange: (selectedKeys) => {
|
|
3717
|
+
local.onChange?.(getOptionsFromValues(selectedKeys));
|
|
3718
|
+
if (local.closeOnSelection) close();
|
|
3719
|
+
},
|
|
3720
|
+
allowDuplicateSelectionEvents: () => access$1(local.allowDuplicateSelectionEvents),
|
|
3721
|
+
disallowEmptySelection: () => access$1(local.disallowEmptySelection),
|
|
3722
|
+
selectionBehavior: () => access$1(local.selectionBehavior),
|
|
3723
|
+
selectionMode: () => local.selectionMode,
|
|
3724
|
+
dataSource: () => local.options ?? [],
|
|
3725
|
+
getKey: () => local.optionValue,
|
|
3726
|
+
getTextValue: () => local.optionTextValue,
|
|
3727
|
+
getDisabled: () => local.optionDisabled,
|
|
3728
|
+
getSectionChildren: () => local.optionGroupChildren
|
|
3729
|
+
});
|
|
3730
|
+
const selectedOptions = createMemo(() => {
|
|
3731
|
+
return getOptionsFromValues(listState.selectionManager().selectedKeys());
|
|
3732
|
+
});
|
|
3733
|
+
const removeOptionFromSelection = (option) => {
|
|
3734
|
+
listState.selectionManager().toggleSelection(getOptionValue(option));
|
|
3735
|
+
};
|
|
3736
|
+
const { present: contentPresent } = index_default$1({
|
|
3737
|
+
show: () => local.forceMount || disclosureState.isOpen(),
|
|
3738
|
+
element: () => contentRef() ?? null
|
|
3739
|
+
});
|
|
3740
|
+
const focusListbox = () => {
|
|
3741
|
+
const listboxEl = listboxRef();
|
|
3742
|
+
if (listboxEl) focusWithoutScrolling(listboxEl);
|
|
3743
|
+
};
|
|
3744
|
+
const open = (focusStrategy2) => {
|
|
3745
|
+
if (local.options.length <= 0) return;
|
|
3746
|
+
setFocusStrategy(focusStrategy2);
|
|
3747
|
+
disclosureState.open();
|
|
3748
|
+
let focusedKey = listState.selectionManager().firstSelectedKey();
|
|
3749
|
+
if (focusedKey == null) {
|
|
3750
|
+
if (focusStrategy2 === "first") focusedKey = listState.collection().getFirstKey();
|
|
3751
|
+
else if (focusStrategy2 === "last") focusedKey = listState.collection().getLastKey();
|
|
3752
|
+
}
|
|
3753
|
+
focusListbox();
|
|
3754
|
+
listState.selectionManager().setFocused(true);
|
|
3755
|
+
listState.selectionManager().setFocusedKey(focusedKey);
|
|
3756
|
+
};
|
|
3757
|
+
const close = () => {
|
|
3758
|
+
disclosureState.close();
|
|
3759
|
+
listState.selectionManager().setFocused(false);
|
|
3760
|
+
listState.selectionManager().setFocusedKey(void 0);
|
|
3761
|
+
};
|
|
3762
|
+
const toggle = (focusStrategy2) => {
|
|
3763
|
+
if (disclosureState.isOpen()) close();
|
|
3764
|
+
else open(focusStrategy2);
|
|
3765
|
+
};
|
|
3766
|
+
const { formControlContext } = createFormControl(formControlProps);
|
|
3767
|
+
createFormResetListener(triggerRef, () => {
|
|
3768
|
+
const defaultSelectedKeys = local.defaultValue ? [...local.defaultValue].map(getOptionValue) : new Selection();
|
|
3769
|
+
listState.selectionManager().setSelectedKeys(defaultSelectedKeys);
|
|
3770
|
+
});
|
|
3771
|
+
const collator = createCollator({
|
|
3772
|
+
usage: "search",
|
|
3773
|
+
sensitivity: "base"
|
|
3774
|
+
});
|
|
3775
|
+
const delegate = createMemo(() => {
|
|
3776
|
+
const keyboardDelegate = access$1(local.keyboardDelegate);
|
|
3777
|
+
if (keyboardDelegate) return keyboardDelegate;
|
|
3778
|
+
return new ListKeyboardDelegate(listState.collection, void 0, collator);
|
|
3779
|
+
});
|
|
3780
|
+
const renderItem = (item) => {
|
|
3781
|
+
return local.itemComponent?.({ item });
|
|
3782
|
+
};
|
|
3783
|
+
const renderSection = (section) => {
|
|
3784
|
+
return local.sectionComponent?.({ section });
|
|
3785
|
+
};
|
|
3786
|
+
createEffect(on([flattenOptionKeys], ([flattenOptionKeys2]) => {
|
|
3787
|
+
const keysToKeep = [...listState.selectionManager().selectedKeys()].filter((key) => flattenOptionKeys2.includes(key));
|
|
3788
|
+
listState.selectionManager().setSelectedKeys(keysToKeep);
|
|
3789
|
+
}, { defer: true }));
|
|
3790
|
+
const dataset = createMemo(() => ({
|
|
3791
|
+
"data-expanded": disclosureState.isOpen() ? "" : void 0,
|
|
3792
|
+
"data-closed": !disclosureState.isOpen() ? "" : void 0
|
|
3793
|
+
}));
|
|
3794
|
+
const context = {
|
|
3795
|
+
dataset,
|
|
3796
|
+
isOpen: disclosureState.isOpen,
|
|
3797
|
+
isDisabled: () => formControlContext.isDisabled() ?? false,
|
|
3798
|
+
isMultiple: () => access$1(local.selectionMode) === "multiple",
|
|
3799
|
+
isVirtualized: () => local.virtualized ?? false,
|
|
3800
|
+
isModal: () => local.modal ?? false,
|
|
3801
|
+
preventScroll: () => local.preventScroll ?? context.isModal(),
|
|
3802
|
+
disallowTypeAhead: () => local.disallowTypeAhead ?? false,
|
|
3803
|
+
shouldFocusWrap: () => local.shouldFocusWrap ?? false,
|
|
3804
|
+
selectedOptions,
|
|
3805
|
+
contentPresent,
|
|
3806
|
+
autoFocus: focusStrategy,
|
|
3807
|
+
triggerRef,
|
|
3808
|
+
listState: () => listState,
|
|
3809
|
+
keyboardDelegate: delegate,
|
|
3810
|
+
triggerId,
|
|
3811
|
+
valueId,
|
|
3812
|
+
listboxId,
|
|
3813
|
+
listboxAriaLabelledBy,
|
|
3814
|
+
setListboxAriaLabelledBy,
|
|
3815
|
+
setTriggerRef,
|
|
3816
|
+
setContentRef,
|
|
3817
|
+
setListboxRef,
|
|
3818
|
+
open,
|
|
3819
|
+
close,
|
|
3820
|
+
toggle,
|
|
3821
|
+
placeholder: () => local.placeholder,
|
|
3822
|
+
renderItem,
|
|
3823
|
+
renderSection,
|
|
3824
|
+
removeOptionFromSelection,
|
|
3825
|
+
generateId: createGenerateId(() => access$1(formControlProps.id)),
|
|
3826
|
+
registerTriggerId: createRegisterId(setTriggerId),
|
|
3827
|
+
registerValueId: createRegisterId(setValueId),
|
|
3828
|
+
registerListboxId: createRegisterId(setListboxId)
|
|
3829
|
+
};
|
|
3830
|
+
return createComponent(FormControlContext.Provider, {
|
|
3831
|
+
value: formControlContext,
|
|
3832
|
+
get children() {
|
|
3833
|
+
return createComponent(SelectContext.Provider, {
|
|
3834
|
+
value: context,
|
|
3835
|
+
get children() {
|
|
3836
|
+
return createComponent(Popper, mergeProps({
|
|
3837
|
+
anchorRef: triggerRef,
|
|
3838
|
+
contentRef
|
|
3839
|
+
}, popperProps, { get children() {
|
|
3840
|
+
return createComponent(Polymorphic, mergeProps({
|
|
3841
|
+
as: "div",
|
|
3842
|
+
role: "group",
|
|
3843
|
+
get id() {
|
|
3844
|
+
return access$1(formControlProps.id);
|
|
3845
|
+
}
|
|
3846
|
+
}, () => formControlContext.dataset(), dataset, others));
|
|
3847
|
+
} }));
|
|
3848
|
+
}
|
|
3849
|
+
});
|
|
3850
|
+
}
|
|
3851
|
+
});
|
|
3852
|
+
}
|
|
3853
|
+
function SelectRoot(props) {
|
|
3854
|
+
const [local, others] = splitProps(props, [
|
|
3855
|
+
"value",
|
|
3856
|
+
"defaultValue",
|
|
3857
|
+
"onChange",
|
|
3858
|
+
"multiple"
|
|
3859
|
+
]);
|
|
3860
|
+
const value = createMemo(() => {
|
|
3861
|
+
if (local.value != null) return local.multiple ? local.value : [local.value];
|
|
3862
|
+
return local.value;
|
|
3863
|
+
});
|
|
3864
|
+
const defaultValue = createMemo(() => {
|
|
3865
|
+
if (local.defaultValue != null) return local.multiple ? local.defaultValue : [local.defaultValue];
|
|
3866
|
+
return local.defaultValue;
|
|
3867
|
+
});
|
|
3868
|
+
const onChange = (val) => {
|
|
3869
|
+
if (val === value()) return;
|
|
3870
|
+
if (local.multiple) local.onChange?.(val ?? []);
|
|
3871
|
+
else local.onChange?.(val[0] ?? null);
|
|
3872
|
+
};
|
|
3873
|
+
return createComponent(SelectBase, mergeProps({
|
|
3874
|
+
get value() {
|
|
3875
|
+
return value();
|
|
3876
|
+
},
|
|
3877
|
+
get defaultValue() {
|
|
3878
|
+
return defaultValue();
|
|
3879
|
+
},
|
|
3880
|
+
onChange,
|
|
3881
|
+
get selectionMode() {
|
|
3882
|
+
return local.multiple ? "multiple" : "single";
|
|
3883
|
+
}
|
|
3884
|
+
}, others));
|
|
3885
|
+
}
|
|
3886
|
+
function SelectTrigger(props) {
|
|
3887
|
+
const formControlContext = useFormControlContext();
|
|
3888
|
+
const context = useSelectContext();
|
|
3889
|
+
const [local, formControlFieldProps, others] = splitProps(mergeDefaultProps({ id: context.generateId("trigger") }, props), [
|
|
3890
|
+
"ref",
|
|
3891
|
+
"disabled",
|
|
3892
|
+
"onPointerDown",
|
|
3893
|
+
"onClick",
|
|
3894
|
+
"onKeyDown",
|
|
3895
|
+
"onFocus",
|
|
3896
|
+
"onBlur"
|
|
3897
|
+
], FORM_CONTROL_FIELD_PROP_NAMES);
|
|
3898
|
+
const selectionManager = () => context.listState().selectionManager();
|
|
3899
|
+
const keyboardDelegate = () => context.keyboardDelegate();
|
|
3900
|
+
const isDisabled = () => local.disabled || context.isDisabled();
|
|
3901
|
+
const { fieldProps } = createFormControlField(formControlFieldProps);
|
|
3902
|
+
const { typeSelectHandlers } = createTypeSelect({
|
|
3903
|
+
keyboardDelegate,
|
|
3904
|
+
selectionManager,
|
|
3905
|
+
onTypeSelect: (key) => selectionManager().select(key)
|
|
3906
|
+
});
|
|
3907
|
+
const ariaLabelledBy = () => {
|
|
3908
|
+
return [context.listboxAriaLabelledBy(), context.valueId()].filter(Boolean).join(" ") || void 0;
|
|
3909
|
+
};
|
|
3910
|
+
const onPointerDown = (e) => {
|
|
3911
|
+
callHandler(e, local.onPointerDown);
|
|
3912
|
+
e.currentTarget.dataset.pointerType = e.pointerType;
|
|
3913
|
+
if (!isDisabled() && e.pointerType !== "touch" && e.button === 0) {
|
|
3914
|
+
e.preventDefault();
|
|
3915
|
+
context.toggle(true);
|
|
3916
|
+
}
|
|
3917
|
+
};
|
|
3918
|
+
const onClick = (e) => {
|
|
3919
|
+
callHandler(e, local.onClick);
|
|
3920
|
+
if (!isDisabled() && e.currentTarget.dataset.pointerType === "touch") context.toggle(true);
|
|
3921
|
+
};
|
|
3922
|
+
const onKeyDown = (e) => {
|
|
3923
|
+
callHandler(e, local.onKeyDown);
|
|
3924
|
+
if (isDisabled()) return;
|
|
3925
|
+
callHandler(e, typeSelectHandlers.onKeyDown);
|
|
3926
|
+
switch (e.key) {
|
|
3927
|
+
case "Enter":
|
|
3928
|
+
case " ":
|
|
3929
|
+
case "ArrowDown":
|
|
3930
|
+
e.stopPropagation();
|
|
3931
|
+
e.preventDefault();
|
|
3932
|
+
context.toggle("first");
|
|
3933
|
+
break;
|
|
3934
|
+
case "ArrowUp":
|
|
3935
|
+
e.stopPropagation();
|
|
3936
|
+
e.preventDefault();
|
|
3937
|
+
context.toggle("last");
|
|
3938
|
+
break;
|
|
3939
|
+
case "ArrowLeft": {
|
|
3940
|
+
e.preventDefault();
|
|
3941
|
+
if (context.isMultiple()) return;
|
|
3942
|
+
const firstSelectedKey = selectionManager().firstSelectedKey();
|
|
3943
|
+
const key = firstSelectedKey != null ? keyboardDelegate().getKeyAbove?.(firstSelectedKey) : keyboardDelegate().getFirstKey?.();
|
|
3944
|
+
if (key != null) selectionManager().select(key);
|
|
3945
|
+
break;
|
|
3946
|
+
}
|
|
3947
|
+
case "ArrowRight": {
|
|
3948
|
+
e.preventDefault();
|
|
3949
|
+
if (context.isMultiple()) return;
|
|
3950
|
+
const firstSelectedKey = selectionManager().firstSelectedKey();
|
|
3951
|
+
const key = firstSelectedKey != null ? keyboardDelegate().getKeyBelow?.(firstSelectedKey) : keyboardDelegate().getFirstKey?.();
|
|
3952
|
+
if (key != null) selectionManager().select(key);
|
|
3953
|
+
break;
|
|
3954
|
+
}
|
|
3955
|
+
}
|
|
3956
|
+
};
|
|
3957
|
+
const onFocus = (e) => {
|
|
3958
|
+
callHandler(e, local.onFocus);
|
|
3959
|
+
if (selectionManager().isFocused()) return;
|
|
3960
|
+
selectionManager().setFocused(true);
|
|
3961
|
+
};
|
|
3962
|
+
const onBlur = (e) => {
|
|
3963
|
+
callHandler(e, local.onBlur);
|
|
3964
|
+
if (context.isOpen()) return;
|
|
3965
|
+
selectionManager().setFocused(false);
|
|
3966
|
+
};
|
|
3967
|
+
createEffect(() => onCleanup(context.registerTriggerId(fieldProps.id())));
|
|
3968
|
+
createEffect(() => {
|
|
3969
|
+
context.setListboxAriaLabelledBy([fieldProps.ariaLabelledBy(), fieldProps.ariaLabel() && !fieldProps.ariaLabelledBy() ? fieldProps.id() : null].filter(Boolean).join(" ") || void 0);
|
|
3970
|
+
});
|
|
3971
|
+
return createComponent(ButtonRoot, mergeProps({
|
|
3972
|
+
get id() {
|
|
3973
|
+
return fieldProps.id();
|
|
3974
|
+
},
|
|
3975
|
+
get disabled() {
|
|
3976
|
+
return isDisabled();
|
|
3977
|
+
},
|
|
3978
|
+
"aria-haspopup": "listbox",
|
|
3979
|
+
get ["aria-expanded"]() {
|
|
3980
|
+
return context.isOpen();
|
|
3981
|
+
},
|
|
3982
|
+
get ["aria-controls"]() {
|
|
3983
|
+
return context.isOpen() ? context.listboxId() : void 0;
|
|
3984
|
+
},
|
|
3985
|
+
get ["aria-label"]() {
|
|
3986
|
+
return fieldProps.ariaLabel();
|
|
3987
|
+
},
|
|
3988
|
+
get ["aria-labelledby"]() {
|
|
3989
|
+
return ariaLabelledBy();
|
|
3990
|
+
},
|
|
3991
|
+
get ["aria-describedby"]() {
|
|
3992
|
+
return fieldProps.ariaDescribedBy();
|
|
3993
|
+
},
|
|
3994
|
+
onPointerDown,
|
|
3995
|
+
onClick,
|
|
3996
|
+
onKeyDown,
|
|
3997
|
+
onFocus,
|
|
3998
|
+
onBlur
|
|
3999
|
+
}, () => context.dataset(), () => formControlContext.dataset(), others));
|
|
4000
|
+
}
|
|
4001
|
+
function SelectValue(props) {
|
|
4002
|
+
const formControlContext = useFormControlContext();
|
|
4003
|
+
const context = useSelectContext();
|
|
4004
|
+
const [local, others] = splitProps(mergeDefaultProps({ id: context.generateId("value") }, props), ["id", "children"]);
|
|
4005
|
+
const selectionManager = () => context.listState().selectionManager();
|
|
4006
|
+
const isSelectionEmpty = () => {
|
|
4007
|
+
const selectedKeys = selectionManager().selectedKeys();
|
|
4008
|
+
if (selectedKeys.size === 1 && selectedKeys.has("")) return true;
|
|
4009
|
+
return selectionManager().isEmpty();
|
|
4010
|
+
};
|
|
4011
|
+
createEffect(() => onCleanup(context.registerValueId(local.id)));
|
|
4012
|
+
return createComponent(Polymorphic, mergeProps({
|
|
4013
|
+
as: "span",
|
|
4014
|
+
get id() {
|
|
4015
|
+
return local.id;
|
|
4016
|
+
},
|
|
4017
|
+
get ["data-placeholder-shown"]() {
|
|
4018
|
+
return isSelectionEmpty() ? "" : void 0;
|
|
4019
|
+
}
|
|
4020
|
+
}, () => formControlContext.dataset(), others, { get children() {
|
|
4021
|
+
return createComponent(Show, {
|
|
4022
|
+
get when() {
|
|
4023
|
+
return !isSelectionEmpty();
|
|
4024
|
+
},
|
|
4025
|
+
get fallback() {
|
|
4026
|
+
return context.placeholder();
|
|
4027
|
+
},
|
|
4028
|
+
get children() {
|
|
4029
|
+
return createComponent(SelectValueChild, {
|
|
4030
|
+
state: {
|
|
4031
|
+
selectedOption: () => context.selectedOptions()[0],
|
|
4032
|
+
selectedOptions: () => context.selectedOptions(),
|
|
4033
|
+
remove: (option) => context.removeOptionFromSelection(option),
|
|
4034
|
+
clear: () => selectionManager().clearSelection()
|
|
4035
|
+
},
|
|
4036
|
+
get children() {
|
|
4037
|
+
return local.children;
|
|
4038
|
+
}
|
|
4039
|
+
});
|
|
4040
|
+
}
|
|
4041
|
+
});
|
|
4042
|
+
} }));
|
|
4043
|
+
}
|
|
4044
|
+
function SelectValueChild(props) {
|
|
4045
|
+
return children(() => {
|
|
4046
|
+
const body = props.children;
|
|
4047
|
+
return isFunction(body) ? body(props.state) : body;
|
|
4048
|
+
})();
|
|
4049
|
+
}
|
|
4050
|
+
var Select = Object.assign(SelectRoot, {
|
|
4051
|
+
Arrow: PopperArrow,
|
|
4052
|
+
Content: SelectContent,
|
|
4053
|
+
Description: FormControlDescription,
|
|
4054
|
+
ErrorMessage: FormControlErrorMessage,
|
|
4055
|
+
HiddenSelect: SelectHiddenSelect,
|
|
4056
|
+
Icon: SelectIcon,
|
|
4057
|
+
Item: ListboxItem,
|
|
4058
|
+
ItemDescription: ListboxItemDescription,
|
|
4059
|
+
ItemIndicator: ListboxItemIndicator,
|
|
4060
|
+
ItemLabel: ListboxItemLabel,
|
|
4061
|
+
Label: SelectLabel,
|
|
4062
|
+
Listbox: SelectListbox,
|
|
4063
|
+
Portal: SelectPortal,
|
|
4064
|
+
Section: ListboxSection,
|
|
4065
|
+
Trigger: SelectTrigger,
|
|
4066
|
+
Value: SelectValue
|
|
4067
|
+
});
|
|
4068
|
+
var object_module_default = {
|
|
4069
|
+
panel: "_panel_t1ok6_19",
|
|
4070
|
+
fields: "_fields_t1ok6_23",
|
|
4071
|
+
identity: "_identity_t1ok6_32",
|
|
4072
|
+
label: "_label_t1ok6_38",
|
|
4073
|
+
control: "_control_t1ok6_43",
|
|
4074
|
+
trigger: "_trigger_t1ok6_50",
|
|
4075
|
+
selectContent: "_selectContent_t1ok6_65",
|
|
4076
|
+
listbox: "_listbox_t1ok6_75",
|
|
4077
|
+
option: "_option_t1ok6_83",
|
|
4078
|
+
content: "_content_t1ok6_101",
|
|
4079
|
+
addressing: "_addressing_t1ok6_102",
|
|
4080
|
+
actions: "_actions_t1ok6_118",
|
|
4081
|
+
reset: "_reset_t1ok6_126",
|
|
4082
|
+
message: "_message_t1ok6_151"
|
|
4083
|
+
};
|
|
4084
|
+
var { graphql } = import_relay_runtime?.default?.default?.__esModule ? import_relay_runtime.default.default : import_relay_runtime?.default?.__esModule ? import_relay_runtime.default : import_relay_runtime;
|
|
4085
|
+
var _tmpl$ = ["<main", "><p role=\"alert\">Instance not found.</p></main>"];
|
|
4086
|
+
var _tmpl$2 = ["<span", ">Optional</span>"];
|
|
4087
|
+
var _tmpl$3 = ["<span", ">Required</span>"];
|
|
4088
|
+
var _tmpl$4 = ["<span", ">JSON</span>"];
|
|
4089
|
+
var _tmpl$5 = ["<p", ">Create an actor in this instance before creating an object.</p>"];
|
|
4090
|
+
var _tmpl$6 = [
|
|
4091
|
+
"<main",
|
|
4092
|
+
"><!--$-->",
|
|
4093
|
+
"<!--/--><section class=\"",
|
|
4094
|
+
"\" aria-labelledby=\"create-object-title\"><header",
|
|
4095
|
+
"><h1 id=\"create-object-title\">Create Object</h1><p>Selected Instance: <!--$-->",
|
|
4096
|
+
"<!--/--></p></header><form",
|
|
4097
|
+
"><fieldset",
|
|
4098
|
+
"",
|
|
4099
|
+
"><div",
|
|
4100
|
+
"><!--$-->",
|
|
4101
|
+
"<!--/--><label",
|
|
4102
|
+
"><span",
|
|
4103
|
+
">Type</span><select class=\"",
|
|
4104
|
+
"\" name=\"type\"><option value=\"Note\" selected>Note</option><option value=\"Article\">Article</option></select></label></div><!--$-->",
|
|
4105
|
+
"<!--/--><!--$-->",
|
|
4106
|
+
"<!--/--><!--$-->",
|
|
4107
|
+
"<!--/--><!--$-->",
|
|
4108
|
+
"<!--/--><div",
|
|
4109
|
+
"><button",
|
|
4110
|
+
" type=\"reset\">Reset</button><button",
|
|
4111
|
+
" type=\"submit\"",
|
|
4112
|
+
">",
|
|
4113
|
+
"</button></div></fieldset></form></section></main>"
|
|
4114
|
+
];
|
|
4115
|
+
var id$$ = "src/routes/workspace/create/[instance_id]/objects.tsx?pick=default&pick=$css&lang.tsx";
|
|
4116
|
+
var instanceActorListQuery = node$1;
|
|
4117
|
+
var createObjectMutation = node;
|
|
4118
|
+
var recipientsSchema = optional(array(pipe(string(), url())), []);
|
|
4119
|
+
object({
|
|
4120
|
+
actor: pipe(string("Select an actor."), nonEmpty("Select an actor.")),
|
|
4121
|
+
name: string(),
|
|
4122
|
+
contentHtml: pipe(string(), check((content) => content.trim() !== "", "Enter content.")),
|
|
4123
|
+
type: picklist(["Note", "Article"]),
|
|
4124
|
+
addressing: strictObject({
|
|
4125
|
+
to: recipientsSchema,
|
|
4126
|
+
cc: recipientsSchema,
|
|
4127
|
+
bto: recipientsSchema,
|
|
4128
|
+
bcc: recipientsSchema,
|
|
4129
|
+
audience: recipientsSchema
|
|
4130
|
+
})
|
|
4131
|
+
});
|
|
4132
|
+
var actorOptions = (edges) => edges.map(({ node }) => ({
|
|
4133
|
+
id: node.id,
|
|
4134
|
+
label: actorLabel(node)
|
|
4135
|
+
}));
|
|
4136
|
+
function CreateObjectsPage(props) {
|
|
4137
|
+
const data = createPreloadedQuery(instanceActorListQuery, () => props.data);
|
|
4138
|
+
const actors = () => data()?.instance?.actors?.edges;
|
|
4139
|
+
const [currentActor, setCurrentActor] = createSignal(null);
|
|
4140
|
+
const [commitCreateObject, isCreating] = createMutation(createObjectMutation);
|
|
4141
|
+
const [message, setMessage] = createSignal("");
|
|
4142
|
+
return createComponent(Show, {
|
|
4143
|
+
get when() {
|
|
4144
|
+
return actors();
|
|
4145
|
+
},
|
|
4146
|
+
get fallback() {
|
|
4147
|
+
return ssr(_tmpl$, ssrHydrationKey() + ssrAttribute("class", escape(form_module_default.page, true), false));
|
|
4148
|
+
},
|
|
4149
|
+
children: (actorList) => ssr(_tmpl$6, ssrHydrationKey() + ssrAttribute("class", escape(form_module_default.page, true), false), escape(createComponent(Title, { children: "Create Object" })), `${escape(form_module_default.panel, true)} ${escape(object_module_default.panel, true)}`, ssrAttribute("class", escape(form_module_default.header, true), false), escape(data()?.instance?.host), ssrAttribute("class", escape(form_module_default.form, true), false) + ssrAttribute("aria-busy", escape(isCreating(), true), false), ssrAttribute("class", escape(object_module_default.fields, true), false), ssrAttribute("disabled", isCreating(), true), ssrAttribute("class", escape(object_module_default.identity, true), false), escape(createComponent(Select, {
|
|
4150
|
+
get ["class"]() {
|
|
4151
|
+
return form_module_default.field;
|
|
4152
|
+
},
|
|
4153
|
+
get disabled() {
|
|
4154
|
+
return isCreating();
|
|
4155
|
+
},
|
|
4156
|
+
get value() {
|
|
4157
|
+
return currentActor() ?? actorOptions(actorList())[0] ?? null;
|
|
4158
|
+
},
|
|
4159
|
+
onChange: setCurrentActor,
|
|
4160
|
+
optionValue: "id",
|
|
4161
|
+
optionTextValue: "label",
|
|
4162
|
+
placeholder: "Select Handle",
|
|
4163
|
+
get options() {
|
|
4164
|
+
return actorOptions(actorList());
|
|
4165
|
+
},
|
|
4166
|
+
itemComponent: (itemProps) => createComponent(Select.Item, {
|
|
4167
|
+
get ["class"]() {
|
|
4168
|
+
return object_module_default.option;
|
|
4169
|
+
},
|
|
4170
|
+
get item() {
|
|
4171
|
+
return itemProps.item;
|
|
4172
|
+
},
|
|
4173
|
+
get children() {
|
|
4174
|
+
return [createComponent(Select.ItemLabel, { get children() {
|
|
4175
|
+
return itemProps.item.rawValue.label;
|
|
4176
|
+
} }), createComponent(Select.ItemIndicator, {
|
|
4177
|
+
"aria-hidden": "true",
|
|
4178
|
+
children: "✓"
|
|
4179
|
+
})];
|
|
4180
|
+
}
|
|
4181
|
+
}),
|
|
4182
|
+
get children() {
|
|
4183
|
+
return [
|
|
4184
|
+
createComponent(Select.Label, {
|
|
4185
|
+
get ["class"]() {
|
|
4186
|
+
return object_module_default.label;
|
|
4187
|
+
},
|
|
4188
|
+
children: "Actor"
|
|
4189
|
+
}),
|
|
4190
|
+
createComponent(Select.Trigger, {
|
|
4191
|
+
get ["class"]() {
|
|
4192
|
+
return `${form_module_default.input} ${object_module_default.control} ${object_module_default.trigger}`;
|
|
4193
|
+
},
|
|
4194
|
+
type: "button",
|
|
4195
|
+
get children() {
|
|
4196
|
+
return [createComponent(Select.Value, { children: (state) => state.selectedOption().label }), createComponent(Select.Icon, {
|
|
4197
|
+
"aria-hidden": "true",
|
|
4198
|
+
children: "▾"
|
|
4199
|
+
})];
|
|
4200
|
+
}
|
|
4201
|
+
}),
|
|
4202
|
+
createComponent(Select.Portal, { get children() {
|
|
4203
|
+
return createComponent(Select.Content, {
|
|
4204
|
+
get ["class"]() {
|
|
4205
|
+
return object_module_default.selectContent;
|
|
4206
|
+
},
|
|
4207
|
+
get children() {
|
|
4208
|
+
return createComponent(Select.Listbox, { get ["class"]() {
|
|
4209
|
+
return object_module_default.listbox;
|
|
4210
|
+
} });
|
|
4211
|
+
}
|
|
4212
|
+
});
|
|
4213
|
+
} })
|
|
4214
|
+
];
|
|
4215
|
+
}
|
|
4216
|
+
})), ssrAttribute("class", escape(form_module_default.field, true), false), ssrAttribute("class", escape(object_module_default.label, true), false), `${escape(form_module_default.input, true)} ${escape(object_module_default.control, true)}`, escape(createComponent(TextField, {
|
|
4217
|
+
get ["class"]() {
|
|
4218
|
+
return form_module_default.field;
|
|
4219
|
+
},
|
|
4220
|
+
name: "name",
|
|
4221
|
+
defaultValue: "",
|
|
4222
|
+
get children() {
|
|
4223
|
+
return [createComponent(TextField.Label, {
|
|
4224
|
+
get ["class"]() {
|
|
4225
|
+
return form_module_default.fieldHeading;
|
|
4226
|
+
},
|
|
4227
|
+
get children() {
|
|
4228
|
+
return ["Name ", ssr(_tmpl$2, ssrHydrationKey() + ssrAttribute("class", escape(form_module_default.fieldStatus, true), false))];
|
|
4229
|
+
}
|
|
4230
|
+
}), createComponent(TextField.Input, {
|
|
4231
|
+
get ["class"]() {
|
|
4232
|
+
return form_module_default.input;
|
|
4233
|
+
},
|
|
4234
|
+
placeholder: "Object title"
|
|
4235
|
+
})];
|
|
4236
|
+
}
|
|
4237
|
+
})), escape(createComponent(TextField, {
|
|
4238
|
+
get ["class"]() {
|
|
4239
|
+
return form_module_default.field;
|
|
4240
|
+
},
|
|
4241
|
+
name: "content",
|
|
4242
|
+
required: true,
|
|
4243
|
+
get children() {
|
|
4244
|
+
return [
|
|
4245
|
+
createComponent(TextField.Label, {
|
|
4246
|
+
get ["class"]() {
|
|
4247
|
+
return form_module_default.fieldHeading;
|
|
4248
|
+
},
|
|
4249
|
+
get children() {
|
|
4250
|
+
return ["Content ", ssr(_tmpl$3, ssrHydrationKey() + ssrAttribute("class", escape(form_module_default.required, true), false))];
|
|
4251
|
+
}
|
|
4252
|
+
}),
|
|
4253
|
+
createComponent(TextField.TextArea, {
|
|
4254
|
+
get ["class"]() {
|
|
4255
|
+
return `${form_module_default.input} ${object_module_default.content}`;
|
|
4256
|
+
},
|
|
4257
|
+
rows: 8,
|
|
4258
|
+
placeholder: "<p>Write your content here.</p>"
|
|
4259
|
+
}),
|
|
4260
|
+
createComponent(TextField.Description, {
|
|
4261
|
+
get ["class"]() {
|
|
4262
|
+
return form_module_default.hint;
|
|
4263
|
+
},
|
|
4264
|
+
children: "HTML content is stored as entered. This object will not be delivered to remote servers."
|
|
4265
|
+
})
|
|
4266
|
+
];
|
|
4267
|
+
}
|
|
4268
|
+
})), escape(createComponent(TextField, {
|
|
4269
|
+
get ["class"]() {
|
|
4270
|
+
return form_module_default.field;
|
|
4271
|
+
},
|
|
4272
|
+
name: "addressing",
|
|
4273
|
+
defaultValue: "{}",
|
|
4274
|
+
get children() {
|
|
4275
|
+
return [
|
|
4276
|
+
createComponent(TextField.Label, {
|
|
4277
|
+
get ["class"]() {
|
|
4278
|
+
return form_module_default.fieldHeading;
|
|
4279
|
+
},
|
|
4280
|
+
get children() {
|
|
4281
|
+
return ["Addressing ", ssr(_tmpl$4, ssrHydrationKey() + ssrAttribute("class", escape(form_module_default.fieldStatus, true), false))];
|
|
4282
|
+
}
|
|
4283
|
+
}),
|
|
4284
|
+
createComponent(TextField.TextArea, {
|
|
4285
|
+
get ["class"]() {
|
|
4286
|
+
return `${form_module_default.input} ${object_module_default.addressing}`;
|
|
4287
|
+
},
|
|
4288
|
+
rows: 4,
|
|
4289
|
+
spellcheck: false
|
|
4290
|
+
}),
|
|
4291
|
+
createComponent(TextField.Description, {
|
|
4292
|
+
get ["class"]() {
|
|
4293
|
+
return form_module_default.hint;
|
|
4294
|
+
},
|
|
4295
|
+
get children() {
|
|
4296
|
+
return [
|
|
4297
|
+
"Use to, cc, bto, bcc, or audience with arrays of recipient URLs. Leave ",
|
|
4298
|
+
"{}",
|
|
4299
|
+
" for no recipients."
|
|
4300
|
+
];
|
|
4301
|
+
}
|
|
4302
|
+
})
|
|
4303
|
+
];
|
|
4304
|
+
}
|
|
4305
|
+
})), escape(createComponent(Show, {
|
|
4306
|
+
get when() {
|
|
4307
|
+
return actorList().length === 0;
|
|
4308
|
+
},
|
|
4309
|
+
get children() {
|
|
4310
|
+
return ssr(_tmpl$5, ssrHydrationKey() + ssrAttribute("class", escape(form_module_default.hint, true), false));
|
|
4311
|
+
}
|
|
4312
|
+
})), ssrAttribute("class", escape(object_module_default.actions, true), false), ssrAttribute("class", escape(object_module_default.reset, true), false), ssrAttribute("class", escape(form_module_default.button, true), false), ssrAttribute("disabled", isCreating() || (actors()?.length ?? 0) === 0, true), isCreating() ? "Creating…" : "Create Object")
|
|
4313
|
+
});
|
|
4314
|
+
}
|
|
4315
|
+
//#endregion
|
|
4316
|
+
export { CreateObjectsPage as default, id$$ };
|