@ark-ui/solid 5.17.0 → 5.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk/5FRMO4AQ.jsx +237 -0
- package/dist/chunk/{AQUEJK4Z.jsx → DZGDAEOH.jsx} +106 -1
- package/dist/chunk/{P7WR6WX5.js → HJFJPRY5.js} +1 -1
- package/dist/chunk/{FQGMWBGA.js → HSBJVWHB.js} +1 -1
- package/dist/chunk/{KAYDBHSW.jsx → IDNDLSEV.jsx} +4 -4
- package/dist/chunk/{JEPST7BN.jsx → LBI4ZRKN.jsx} +5 -3
- package/dist/chunk/{XL4VFEPW.js → O5UHP4CA.js} +103 -3
- package/dist/chunk/{AKYIM67Z.jsx → UYFUB47A.jsx} +5 -3
- package/dist/chunk/{NCRPFSNO.jsx → VR5BNKL7.jsx} +4 -4
- package/dist/chunk/ZUWL6SV5.js +321 -0
- package/dist/components/accordion/index.jsx +3 -3
- package/dist/components/angle-slider/index.jsx +2 -2
- package/dist/components/avatar/index.jsx +2 -2
- package/dist/components/carousel/index.jsx +2 -2
- package/dist/components/checkbox/index.d.ts +1 -1
- package/dist/components/checkbox/index.jsx +2 -2
- package/dist/components/clipboard/index.jsx +1 -1
- package/dist/components/collapsible/index.jsx +2 -2
- package/dist/components/collection/index.d.ts +93 -3
- package/dist/components/collection/index.js +1 -1
- package/dist/components/collection/index.jsx +5 -3
- package/dist/components/color-picker/index.d.ts +1 -1
- package/dist/components/color-picker/index.jsx +2 -2
- package/dist/components/combobox/index.js +1 -1
- package/dist/components/combobox/index.jsx +5 -5
- package/dist/components/date-picker/index.d.ts +1 -1
- package/dist/components/date-picker/index.jsx +2 -2
- package/dist/components/dialog/index.jsx +2 -2
- package/dist/components/download-trigger/index.jsx +1 -1
- package/dist/components/editable/index.jsx +2 -2
- package/dist/components/field/index.d.ts +1 -1
- package/dist/components/field/index.jsx +1 -1
- package/dist/components/fieldset/index.d.ts +1 -1
- package/dist/components/fieldset/index.jsx +1 -1
- package/dist/components/file-upload/index.js +1 -1
- package/dist/components/file-upload/index.jsx +2 -2
- package/dist/components/floating-panel/index.jsx +2 -2
- package/dist/components/format/index.jsx +1 -1
- package/dist/components/frame/index.jsx +1 -1
- package/dist/components/hover-card/index.jsx +2 -2
- package/dist/components/index.d.ts +4 -1
- package/dist/components/index.js +24 -23
- package/dist/components/index.jsx +502 -490
- package/dist/components/json-tree-view/index.d.ts +69 -0
- package/dist/components/json-tree-view/index.js +1 -0
- package/dist/components/json-tree-view/index.jsx +26 -0
- package/dist/components/listbox/index.js +1 -1
- package/dist/components/listbox/index.jsx +3 -3
- package/dist/components/menu/index.jsx +2 -2
- package/dist/components/number-input/index.jsx +2 -2
- package/dist/components/pagination/index.jsx +2 -2
- package/dist/components/password-input/index.jsx +2 -2
- package/dist/components/pin-input/index.jsx +2 -2
- package/dist/components/popover/index.jsx +2 -2
- package/dist/components/progress/index.jsx +2 -2
- package/dist/components/qr-code/index.jsx +2 -2
- package/dist/components/radio-group/index.jsx +2 -2
- package/dist/components/rating-group/index.jsx +2 -2
- package/dist/components/segment-group/index.jsx +2 -2
- package/dist/components/select/index.js +1 -1
- package/dist/components/select/index.jsx +5 -5
- package/dist/components/signature-pad/index.js +1 -1
- package/dist/components/signature-pad/index.jsx +2 -2
- package/dist/components/slider/index.jsx +2 -2
- package/dist/components/splitter/index.jsx +2 -2
- package/dist/components/steps/index.jsx +2 -2
- package/dist/components/switch/index.jsx +2 -2
- package/dist/components/tabs/index.jsx +2 -2
- package/dist/components/tags-input/index.jsx +2 -2
- package/dist/components/time-picker/index.jsx +2 -2
- package/dist/components/timer/index.jsx +1 -1
- package/dist/components/toast/index.jsx +2 -2
- package/dist/components/toggle-group/index.jsx +2 -2
- package/dist/components/tooltip/index.jsx +2 -2
- package/dist/components/tour/index.jsx +2 -2
- package/dist/components/tree-view/index.d.ts +9 -39
- package/dist/components/tree-view/index.js +1 -1
- package/dist/components/tree-view/index.jsx +4 -4
- package/dist/index.d.ts +5 -2
- package/dist/index.js +24 -23
- package/dist/index.jsx +487 -475
- package/dist/providers/index.jsx +4 -4
- package/dist/tree-view-tree-CbBeWSwi.d.ts +41 -0
- package/package.json +63 -62
- package/dist/chunk/{XUH2TAUG.jsx → 4L4266PL.jsx} +3 -3
- package/dist/chunk/{2WR5J3OZ.jsx → 6XAZQVOY.jsx} +3 -3
- package/dist/chunk/{HP3ZGMDZ.jsx → 7FASJWDK.jsx} +3 -3
- package/dist/chunk/{ZTNABPZL.jsx → 7OXBQSIZ.jsx} +3 -3
- package/dist/chunk/{YAOPG62Z.jsx → 7RYPC5LL.jsx} +3 -3
- package/dist/chunk/{4FUKCXPR.jsx → 7UNWOGPT.jsx} +3 -3
- package/dist/chunk/{35XSFKD5.jsx → CINP4S7J.jsx} +3 -3
- package/dist/chunk/{ZSMY7WCA.jsx → D2MI7N5P.jsx} +3 -3
- package/dist/chunk/{PPQSRJ6X.jsx → DLZTFD37.jsx} +3 -3
- package/dist/chunk/{4UNGYCFT.jsx → FG427CLW.jsx} +3 -3
- package/dist/chunk/{2UVDYZIY.jsx → FOIEK72O.jsx} +3 -3
- package/dist/chunk/{HDKSS6KE.jsx → GLN6WFQR.jsx} +3 -3
- package/dist/chunk/{WOUVNHGI.jsx → H4MJ4254.jsx} +3 -3
- package/dist/chunk/{BJ3QT4LE.jsx → H7TJLB3R.jsx} +0 -0
- package/dist/chunk/{CBGZAFEX.jsx → I7VQFKYT.jsx} +3 -3
- package/dist/chunk/{3DOPQCHJ.jsx → JK6QXH6B.jsx} +3 -3
- package/dist/chunk/{UW5WJ2LL.jsx → JKM73NGJ.jsx} +3 -3
- package/dist/chunk/{3WT7Q753.jsx → L22RABDV.jsx} +3 -3
- package/dist/chunk/{U5CBLW6U.jsx → L5XYJCAK.jsx} +3 -3
- package/dist/chunk/{NPHS6PVV.jsx → MJTOTU2A.jsx} +3 -3
- package/dist/chunk/{QBN5FEQF.js → NWXJCBMN.js} +0 -0
- package/dist/chunk/{OKNWZYMH.jsx → OM7DNJ6L.jsx} +3 -3
- package/dist/chunk/{JUBTXT4B.jsx → OM7V7VVC.jsx} +3 -3
- package/dist/chunk/{5U4KEVIU.jsx → PRA2XFQE.jsx} +3 -3
- package/dist/chunk/{MM6NNI6M.jsx → QXYWHKF7.jsx} +3 -3
- package/dist/chunk/{QC5C6JJA.jsx → V6S3C3U7.jsx} +3 -3
- package/dist/chunk/{LKPEYZZO.jsx → V75EMOIC.jsx} +3 -3
- package/dist/chunk/{S4OS4UYL.jsx → VXQNQSLM.jsx} +3 -3
- package/dist/chunk/{ZNBZTQ46.jsx → WBLWV2L4.jsx} +3 -3
- package/dist/chunk/{POJRD725.jsx → X5GWQYGE.jsx} +3 -3
- package/dist/chunk/{WG67YHCV.jsx → XENPQFEN.jsx} +3 -3
- package/dist/chunk/{AHH5Z3VJ.jsx → XOIHVYJ7.jsx} +3 -3
- package/dist/chunk/{N3H47LNB.jsx → XSGHIZ6Q.jsx} +3 -3
- package/dist/chunk/{L64MXP66.jsx → Y2LC36B4.jsx} +3 -3
- package/dist/chunk/{XKBIT7L5.jsx → YJX4W6VT.jsx} +3 -3
- package/dist/chunk/{RC4UV6HP.jsx → YM35RFYG.jsx} +3 -3
- package/dist/chunk/{WHXDBQDP.jsx → Z2BXVXSV.jsx} +3 -3
- package/dist/chunk/{3B7I46SI.jsx → ZHLQWQXX.jsx} +3 -3
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import {
|
|
2
|
+
tree_view_exports,
|
|
3
|
+
useTreeView,
|
|
4
|
+
useTreeViewContext
|
|
5
|
+
} from "./VR5BNKL7.jsx";
|
|
6
|
+
import {
|
|
7
|
+
createTreeCollection
|
|
8
|
+
} from "./DZGDAEOH.jsx";
|
|
9
|
+
import {
|
|
10
|
+
createSplitProps
|
|
11
|
+
} from "./6WEDGJKQ.jsx";
|
|
12
|
+
import {
|
|
13
|
+
createContext
|
|
14
|
+
} from "./TVCIHLER.jsx";
|
|
15
|
+
import {
|
|
16
|
+
__export
|
|
17
|
+
} from "./7IUG3E2V.jsx";
|
|
18
|
+
|
|
19
|
+
// src/components/json-tree-view/json-tree-view-root.tsx
|
|
20
|
+
import { getRootNode, nodeToString, nodeToValue } from "@zag-js/json-tree-utils";
|
|
21
|
+
import { createMemo, splitProps } from "solid-js";
|
|
22
|
+
|
|
23
|
+
// src/components/json-tree-view/get-branch-value.ts
|
|
24
|
+
function getBranchValues(tree, depth) {
|
|
25
|
+
let values = [];
|
|
26
|
+
tree.visit({
|
|
27
|
+
onEnter: (node, indexPath) => {
|
|
28
|
+
if (indexPath.length === 0) return;
|
|
29
|
+
if (tree.isBranchNode(node) && indexPath.length <= depth) {
|
|
30
|
+
values.push(tree.getNodeValue(node));
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
return values;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// src/components/json-tree-view/json-tree-view-props-context.ts
|
|
38
|
+
var [JsonTreeViewPropsProvider, useJsonTreeViewPropsContext] = createContext({
|
|
39
|
+
hookName: "useJsonTreeViewPropsContext",
|
|
40
|
+
providerName: "<JsonTreeViewPropsProvider />"
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
// src/components/json-tree-view/json-tree-view-root.tsx
|
|
44
|
+
var splitJsonTreeViewProps = createSplitProps();
|
|
45
|
+
var JsonTreeViewRoot = (props) => {
|
|
46
|
+
const [jsonTreeProps, localProps] = splitJsonTreeViewProps(props, [
|
|
47
|
+
"maxPreviewItems",
|
|
48
|
+
"collapseStringsAfterLength",
|
|
49
|
+
"quotesOnKeys",
|
|
50
|
+
"groupArraysAfterLength",
|
|
51
|
+
"showNonenumerable"
|
|
52
|
+
]);
|
|
53
|
+
const [jsonProps, restProps] = splitProps(localProps, ["data", "defaultExpandedDepth"]);
|
|
54
|
+
const collection = createMemo(() => {
|
|
55
|
+
return createTreeCollection({
|
|
56
|
+
nodeToValue,
|
|
57
|
+
nodeToString,
|
|
58
|
+
rootNode: getRootNode(jsonProps.data)
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
const defaultExpandedValue = createMemo(() => {
|
|
62
|
+
return jsonProps.defaultExpandedDepth != null ? getBranchValues(collection(), jsonProps.defaultExpandedDepth) : void 0;
|
|
63
|
+
});
|
|
64
|
+
return <JsonTreeViewPropsProvider value={jsonTreeProps}>
|
|
65
|
+
<tree_view_exports.Root
|
|
66
|
+
data-scope="json-tree-view"
|
|
67
|
+
collection={collection()}
|
|
68
|
+
defaultExpandedValue={defaultExpandedValue()}
|
|
69
|
+
{...restProps}
|
|
70
|
+
>
|
|
71
|
+
{props.children}
|
|
72
|
+
</tree_view_exports.Root>
|
|
73
|
+
</JsonTreeViewPropsProvider>;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
// src/components/json-tree-view/json-tree-view-root-provider.tsx
|
|
77
|
+
var JsonTreeViewRootProvider = (props) => {
|
|
78
|
+
return <tree_view_exports.RootProvider data-scope="json-tree-view" {...props} />;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
// src/components/json-tree-view/json-tree-view-tree.tsx
|
|
82
|
+
import { Index as Index2 } from "solid-js";
|
|
83
|
+
|
|
84
|
+
// src/components/json-tree-view/json-tree-view-node.tsx
|
|
85
|
+
import {
|
|
86
|
+
getAccessibleDescription,
|
|
87
|
+
jsonNodeToElement,
|
|
88
|
+
keyPathToKey as keyPathToKey2
|
|
89
|
+
} from "@zag-js/json-tree-utils";
|
|
90
|
+
import { createMemo as createMemo3 } from "solid-js";
|
|
91
|
+
import { Index, Show } from "solid-js/web";
|
|
92
|
+
|
|
93
|
+
// src/components/json-tree-view/json-tree-view-key-node.tsx
|
|
94
|
+
import { keyPathToKey } from "@zag-js/json-tree-utils";
|
|
95
|
+
import { createMemo as createMemo2 } from "solid-js";
|
|
96
|
+
var JsonTreeViewKeyNode = (props) => {
|
|
97
|
+
const key = createMemo2(() => keyPathToKey(props.node.keyPath));
|
|
98
|
+
return <>
|
|
99
|
+
<span data-kind="key" data-non-enumerable={props.node.isNonEnumerable ? "" : void 0}>
|
|
100
|
+
{props.showQuotes ? `"${key()}"` : key()}
|
|
101
|
+
</span>
|
|
102
|
+
<span data-kind="colon">: </span>
|
|
103
|
+
</>;
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
// src/components/json-tree-view/json-tree-view-value-node.tsx
|
|
107
|
+
import { For } from "solid-js";
|
|
108
|
+
import { Dynamic } from "solid-js/web";
|
|
109
|
+
var JsonTreeViewValueNode = (props) => {
|
|
110
|
+
if (props.node.type === "text") {
|
|
111
|
+
return <>{props.renderValue?.(props.node) ?? props.node.value}</>;
|
|
112
|
+
}
|
|
113
|
+
return <Dynamic
|
|
114
|
+
component={props.node.tagName}
|
|
115
|
+
data-root={props.node.properties.root ? "" : void 0}
|
|
116
|
+
data-type={props.node.properties.nodeType}
|
|
117
|
+
data-kind={props.node.properties.kind}
|
|
118
|
+
>
|
|
119
|
+
<For each={props.node.children}>
|
|
120
|
+
{(child) => <JsonTreeViewValueNode node={child} renderValue={props.renderValue} />}
|
|
121
|
+
</For>
|
|
122
|
+
</Dynamic>;
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
// src/components/json-tree-view/json-tree-view-node.tsx
|
|
126
|
+
var scopeProps = {
|
|
127
|
+
"data-scope": "json-tree-view"
|
|
128
|
+
};
|
|
129
|
+
function JsonTreeViewNode(props) {
|
|
130
|
+
const tree = useTreeViewContext();
|
|
131
|
+
const nodeState = createMemo3(() => tree().getNodeState({ node: props.node, indexPath: props.indexPath }));
|
|
132
|
+
const options = useJsonTreeViewPropsContext();
|
|
133
|
+
const key = createMemo3(() => keyPathToKey2(props.node.keyPath, { excludeRoot: true }));
|
|
134
|
+
const valueNode = createMemo3(() => jsonNodeToElement(props.node, options));
|
|
135
|
+
const nodeProps = createMemo3(() => {
|
|
136
|
+
const desc = getAccessibleDescription(props.node);
|
|
137
|
+
const line = props.indexPath.reduce((acc, curr) => acc + curr, 1);
|
|
138
|
+
const lineLength = props.indexPath.length - 1;
|
|
139
|
+
return {
|
|
140
|
+
...scopeProps,
|
|
141
|
+
"aria-label": desc,
|
|
142
|
+
"data-line": line,
|
|
143
|
+
style: { ["--line-length"]: lineLength }
|
|
144
|
+
};
|
|
145
|
+
});
|
|
146
|
+
return <tree_view_exports.NodeProvider node={props.node} indexPath={props.indexPath}>
|
|
147
|
+
<Show
|
|
148
|
+
when={nodeState().isBranch}
|
|
149
|
+
fallback={<tree_view_exports.Item {...nodeProps()}>
|
|
150
|
+
<tree_view_exports.ItemText {...scopeProps}>
|
|
151
|
+
<Show when={key()}>
|
|
152
|
+
<JsonTreeViewKeyNode node={props.node} showQuotes={options.quotesOnKeys} />
|
|
153
|
+
</Show>
|
|
154
|
+
<JsonTreeViewValueNode node={valueNode()} renderValue={props.renderValue} />
|
|
155
|
+
</tree_view_exports.ItemText>
|
|
156
|
+
</tree_view_exports.Item>}
|
|
157
|
+
>
|
|
158
|
+
<tree_view_exports.Branch {...scopeProps}>
|
|
159
|
+
<tree_view_exports.BranchControl {...nodeProps()}>
|
|
160
|
+
<Show when={props.arrow}>
|
|
161
|
+
<tree_view_exports.BranchIndicator {...scopeProps}>{props.arrow}</tree_view_exports.BranchIndicator>
|
|
162
|
+
</Show>
|
|
163
|
+
<tree_view_exports.BranchText {...scopeProps}>
|
|
164
|
+
<Show when={key()}>
|
|
165
|
+
<JsonTreeViewKeyNode node={props.node} showQuotes={options.quotesOnKeys} />
|
|
166
|
+
</Show>
|
|
167
|
+
<JsonTreeViewValueNode node={valueNode()} renderValue={props.renderValue} />
|
|
168
|
+
</tree_view_exports.BranchText>
|
|
169
|
+
</tree_view_exports.BranchControl>
|
|
170
|
+
<tree_view_exports.BranchContent {...scopeProps}>
|
|
171
|
+
<Show when={typeof props.indentGuide === "boolean"} fallback={props.indentGuide}>
|
|
172
|
+
<tree_view_exports.BranchIndentGuide />
|
|
173
|
+
</Show>
|
|
174
|
+
<Index each={props.node.children}>
|
|
175
|
+
{(child, index) => <JsonTreeViewNode {...props} node={child()} indexPath={[...props.indexPath, index]} />}
|
|
176
|
+
</Index>
|
|
177
|
+
</tree_view_exports.BranchContent>
|
|
178
|
+
</tree_view_exports.Branch>
|
|
179
|
+
</Show>
|
|
180
|
+
</tree_view_exports.NodeProvider>;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// src/components/json-tree-view/json-tree-view-tree.tsx
|
|
184
|
+
var splitTreeNodeProps = createSplitProps();
|
|
185
|
+
var JsonTreeViewTree = (props) => {
|
|
186
|
+
const [nodeProps, treeProps] = splitTreeNodeProps(props, ["arrow", "indentGuide", "renderValue"]);
|
|
187
|
+
const tree = useTreeViewContext();
|
|
188
|
+
const children = () => tree().collection.getNodeChildren(tree().collection.rootNode);
|
|
189
|
+
return <tree_view_exports.Tree data-scope="json-tree-view" {...treeProps}>
|
|
190
|
+
<Index2 each={children()}>
|
|
191
|
+
{(child, index) => <JsonTreeViewNode node={child()} indexPath={[index]} {...nodeProps} />}
|
|
192
|
+
</Index2>
|
|
193
|
+
</tree_view_exports.Tree>;
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
// src/components/json-tree-view/use-json-tree-view.ts
|
|
197
|
+
import { getRootNode as getRootNode2, nodeToString as nodeToString2, nodeToValue as nodeToValue2 } from "@zag-js/json-tree-utils";
|
|
198
|
+
import { createMemo as createMemo4, splitProps as splitProps2 } from "solid-js";
|
|
199
|
+
import { untrack } from "solid-js/web";
|
|
200
|
+
var useJsonTreeView = (props) => {
|
|
201
|
+
const [jsonProps, restProps] = splitProps2(props, ["data", "defaultExpandedDepth"]);
|
|
202
|
+
const collection = createMemo4(() => {
|
|
203
|
+
return createTreeCollection({
|
|
204
|
+
nodeToValue: nodeToValue2,
|
|
205
|
+
nodeToString: nodeToString2,
|
|
206
|
+
rootNode: getRootNode2(jsonProps.data)
|
|
207
|
+
});
|
|
208
|
+
});
|
|
209
|
+
const defaultExpandedValue = createMemo4(() => {
|
|
210
|
+
return jsonProps.defaultExpandedDepth != null ? getBranchValues(collection(), jsonProps.defaultExpandedDepth) : void 0;
|
|
211
|
+
});
|
|
212
|
+
const machineProps = createMemo4(() => {
|
|
213
|
+
return {
|
|
214
|
+
defaultExpandedValue: untrack(defaultExpandedValue),
|
|
215
|
+
...restProps,
|
|
216
|
+
collection: collection(),
|
|
217
|
+
typeahead: false
|
|
218
|
+
};
|
|
219
|
+
});
|
|
220
|
+
return useTreeView(machineProps);
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
// src/components/json-tree-view/json-tree-view.tsx
|
|
224
|
+
var json_tree_view_exports = {};
|
|
225
|
+
__export(json_tree_view_exports, {
|
|
226
|
+
Root: () => JsonTreeViewRoot,
|
|
227
|
+
RootProvider: () => JsonTreeViewRootProvider,
|
|
228
|
+
Tree: () => JsonTreeViewTree
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
export {
|
|
232
|
+
JsonTreeViewRoot,
|
|
233
|
+
JsonTreeViewRootProvider,
|
|
234
|
+
JsonTreeViewTree,
|
|
235
|
+
useJsonTreeView,
|
|
236
|
+
json_tree_view_exports
|
|
237
|
+
};
|
|
@@ -113,10 +113,115 @@ function useListCollection(props) {
|
|
|
113
113
|
};
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
+
// src/components/collection/use-list-selection.ts
|
|
117
|
+
import { Selection } from "@zag-js/collection";
|
|
118
|
+
import { createEffect, createMemo as createMemo2, createSignal as createSignal2, on, splitProps as splitProps2 } from "solid-js";
|
|
119
|
+
function useListSelection(props) {
|
|
120
|
+
const splittedProps = createMemo2(() => {
|
|
121
|
+
const rawProps = typeof props === "function" ? props() : props;
|
|
122
|
+
return splitProps2(rawProps, [
|
|
123
|
+
"collection",
|
|
124
|
+
"selectionMode",
|
|
125
|
+
"deselectable",
|
|
126
|
+
"initialSelectedValues",
|
|
127
|
+
"resetOnCollectionChange"
|
|
128
|
+
]);
|
|
129
|
+
});
|
|
130
|
+
const createSelection = (values = []) => {
|
|
131
|
+
const [localProps] = splittedProps();
|
|
132
|
+
const selection2 = new Selection(values);
|
|
133
|
+
selection2.selectionMode = localProps.selectionMode ?? "single";
|
|
134
|
+
selection2.deselectable = localProps.deselectable ?? true;
|
|
135
|
+
return selection2;
|
|
136
|
+
};
|
|
137
|
+
const init = () => {
|
|
138
|
+
const [localProps] = splittedProps();
|
|
139
|
+
return createSelection(localProps.initialSelectedValues ?? []);
|
|
140
|
+
};
|
|
141
|
+
const [selection, setSelection] = createSignal2(init());
|
|
142
|
+
const watchDeps = () => {
|
|
143
|
+
const [{ collection, resetOnCollectionChange }] = splittedProps();
|
|
144
|
+
return [collection.getValues(), resetOnCollectionChange];
|
|
145
|
+
};
|
|
146
|
+
createEffect(
|
|
147
|
+
on(
|
|
148
|
+
watchDeps,
|
|
149
|
+
([, resetOnCollectionChange]) => {
|
|
150
|
+
if (resetOnCollectionChange) {
|
|
151
|
+
setSelection(createSelection());
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
{ defer: true }
|
|
155
|
+
)
|
|
156
|
+
);
|
|
157
|
+
const selectedValues = createMemo2(() => Array.from(selection()));
|
|
158
|
+
const isEmpty = createMemo2(() => selection().isEmpty());
|
|
159
|
+
const firstSelectedValue = createMemo2(() => {
|
|
160
|
+
const [localProps] = splittedProps();
|
|
161
|
+
return selection().firstSelectedValue(localProps.collection);
|
|
162
|
+
});
|
|
163
|
+
const lastSelectedValue = createMemo2(() => {
|
|
164
|
+
const [localProps] = splittedProps();
|
|
165
|
+
return selection().lastSelectedValue(localProps.collection);
|
|
166
|
+
});
|
|
167
|
+
return {
|
|
168
|
+
selectedValues,
|
|
169
|
+
isEmpty,
|
|
170
|
+
firstSelectedValue,
|
|
171
|
+
lastSelectedValue,
|
|
172
|
+
isSelected: (value) => {
|
|
173
|
+
return selection().isSelected(value);
|
|
174
|
+
},
|
|
175
|
+
isAllSelected: () => {
|
|
176
|
+
const [localProps] = splittedProps();
|
|
177
|
+
const allValues = localProps.collection.getValues();
|
|
178
|
+
return allValues.length > 0 && allValues.every((value) => selection().isSelected(value));
|
|
179
|
+
},
|
|
180
|
+
isSomeSelected: () => {
|
|
181
|
+
const [localProps] = splittedProps();
|
|
182
|
+
const allValues = localProps.collection.getValues();
|
|
183
|
+
return allValues.some((value) => selection().isSelected(value));
|
|
184
|
+
},
|
|
185
|
+
canSelect: (value) => {
|
|
186
|
+
const [localProps] = splittedProps();
|
|
187
|
+
return selection().canSelect(localProps.collection, value);
|
|
188
|
+
},
|
|
189
|
+
select: (value, forceToggle) => {
|
|
190
|
+
const [localProps] = splittedProps();
|
|
191
|
+
setSelection(selection().select(localProps.collection, value, forceToggle));
|
|
192
|
+
},
|
|
193
|
+
deselect: (value) => {
|
|
194
|
+
setSelection(selection().deselect(value));
|
|
195
|
+
},
|
|
196
|
+
toggle: (value) => {
|
|
197
|
+
const [localProps] = splittedProps();
|
|
198
|
+
setSelection(selection().toggleSelection(localProps.collection, value));
|
|
199
|
+
},
|
|
200
|
+
replace: (value) => {
|
|
201
|
+
const [localProps] = splittedProps();
|
|
202
|
+
setSelection(selection().replaceSelection(localProps.collection, value));
|
|
203
|
+
},
|
|
204
|
+
extend: (anchorValue, targetValue) => {
|
|
205
|
+
const [localProps] = splittedProps();
|
|
206
|
+
setSelection(selection().extendSelection(localProps.collection, anchorValue, targetValue));
|
|
207
|
+
},
|
|
208
|
+
setSelectedValues: (values) => {
|
|
209
|
+
setSelection(selection().setSelection(values));
|
|
210
|
+
},
|
|
211
|
+
clear: () => {
|
|
212
|
+
setSelection(selection().clearSelection());
|
|
213
|
+
},
|
|
214
|
+
resetSelection: () => {
|
|
215
|
+
setSelection(createSelection());
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
|
|
116
220
|
export {
|
|
117
221
|
createGridCollection,
|
|
118
222
|
createListCollection,
|
|
119
223
|
createTreeCollection,
|
|
120
224
|
createFileTreeCollection,
|
|
121
|
-
useListCollection
|
|
225
|
+
useListCollection,
|
|
226
|
+
useListSelection
|
|
122
227
|
};
|
|
@@ -77,7 +77,7 @@ var useSignaturePad = (props) => {
|
|
|
77
77
|
|
|
78
78
|
// src/components/signature-pad/signature-pad-root.tsx
|
|
79
79
|
var SignaturePadRoot = (props) => {
|
|
80
|
-
const [useSignaturePadProps, localProps] = createSplitProps()(props, ["id", "ids", "drawing", "disabled", "readOnly", "name", "onDraw", "onDrawEnd", "readOnly", "required", "translations"]);
|
|
80
|
+
const [useSignaturePadProps, localProps] = createSplitProps()(props, ["id", "ids", "defaultPaths", "drawing", "disabled", "readOnly", "name", "onDraw", "onDrawEnd", "paths", "readOnly", "required", "translations"]);
|
|
81
81
|
const signaturePad2 = useSignaturePad(useSignaturePadProps);
|
|
82
82
|
const mergedProps = mergeProps(() => signaturePad2().getRootProps(), localProps);
|
|
83
83
|
return createComponent(SignaturePadProvider, {
|
|
@@ -151,7 +151,7 @@ var useFileUpload = (props) => {
|
|
|
151
151
|
|
|
152
152
|
// src/components/file-upload/file-upload-root.tsx
|
|
153
153
|
var FileUploadRoot = (props) => {
|
|
154
|
-
const [fileUploadProps, localProps] = createSplitProps()(props, ["accept", "allowDrop", "capture", "directory", "disabled", "id", "ids", "invalid", "locale", "maxFiles", "maxFileSize", "minFileSize", "name", "onFileAccept", "onFileChange", "onFileReject", "preventDocumentDrop", "required", "translations", "transformFiles", "validate"]);
|
|
154
|
+
const [fileUploadProps, localProps] = createSplitProps()(props, ["accept", "acceptedFiles", "allowDrop", "capture", "defaultAcceptedFiles", "directory", "disabled", "id", "ids", "invalid", "locale", "maxFiles", "maxFileSize", "minFileSize", "name", "onFileAccept", "onFileChange", "onFileReject", "preventDocumentDrop", "required", "translations", "transformFiles", "validate"]);
|
|
155
155
|
const fileUpload2 = useFileUpload(fileUploadProps);
|
|
156
156
|
const mergedProps = mergeProps(() => fileUpload2().getRootProps(), localProps);
|
|
157
157
|
return createComponent(FileUploadProvider, {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
collapsible_exports,
|
|
3
3
|
useCollapsibleContext
|
|
4
|
-
} from "./
|
|
4
|
+
} from "./Z2BXVXSV.jsx";
|
|
5
5
|
import {
|
|
6
6
|
RenderStrategyProvider,
|
|
7
7
|
splitRenderStrategyProps,
|
|
@@ -13,12 +13,12 @@ import {
|
|
|
13
13
|
import {
|
|
14
14
|
ark
|
|
15
15
|
} from "./UFYZ7HLU.jsx";
|
|
16
|
-
import {
|
|
17
|
-
useEnvironmentContext
|
|
18
|
-
} from "./E2L62MKC.jsx";
|
|
19
16
|
import {
|
|
20
17
|
useLocaleContext
|
|
21
18
|
} from "./YUC6JE7K.jsx";
|
|
19
|
+
import {
|
|
20
|
+
useEnvironmentContext
|
|
21
|
+
} from "./E2L62MKC.jsx";
|
|
22
22
|
import {
|
|
23
23
|
createContext
|
|
24
24
|
} from "./TVCIHLER.jsx";
|
|
@@ -7,12 +7,12 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
ark
|
|
9
9
|
} from "./UFYZ7HLU.jsx";
|
|
10
|
-
import {
|
|
11
|
-
useEnvironmentContext
|
|
12
|
-
} from "./E2L62MKC.jsx";
|
|
13
10
|
import {
|
|
14
11
|
useLocaleContext
|
|
15
12
|
} from "./YUC6JE7K.jsx";
|
|
13
|
+
import {
|
|
14
|
+
useEnvironmentContext
|
|
15
|
+
} from "./E2L62MKC.jsx";
|
|
16
16
|
import {
|
|
17
17
|
createContext
|
|
18
18
|
} from "./TVCIHLER.jsx";
|
|
@@ -110,12 +110,14 @@ var SignaturePadRoot = (props) => {
|
|
|
110
110
|
const [useSignaturePadProps, localProps] = createSplitProps()(props, [
|
|
111
111
|
"id",
|
|
112
112
|
"ids",
|
|
113
|
+
"defaultPaths",
|
|
113
114
|
"drawing",
|
|
114
115
|
"disabled",
|
|
115
116
|
"readOnly",
|
|
116
117
|
"name",
|
|
117
118
|
"onDraw",
|
|
118
119
|
"onDrawEnd",
|
|
120
|
+
"paths",
|
|
119
121
|
"readOnly",
|
|
120
122
|
"required",
|
|
121
123
|
"translations"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { GridCollection, ListCollection, TreeCollection, filePathToTree } from '@zag-js/collection';
|
|
2
|
-
import { createMemo, splitProps, createSignal } from 'solid-js';
|
|
1
|
+
import { GridCollection, ListCollection, TreeCollection, filePathToTree, Selection } from '@zag-js/collection';
|
|
2
|
+
import { createMemo, splitProps, createSignal, createEffect, on } from 'solid-js';
|
|
3
3
|
|
|
4
4
|
// src/components/collection/grid-collection.ts
|
|
5
5
|
var createGridCollection = (options) => new GridCollection(options);
|
|
@@ -100,5 +100,105 @@ function useListCollection(props) {
|
|
|
100
100
|
}
|
|
101
101
|
};
|
|
102
102
|
}
|
|
103
|
+
function useListSelection(props) {
|
|
104
|
+
const splittedProps = createMemo(() => {
|
|
105
|
+
const rawProps = typeof props === "function" ? props() : props;
|
|
106
|
+
return splitProps(rawProps, [
|
|
107
|
+
"collection",
|
|
108
|
+
"selectionMode",
|
|
109
|
+
"deselectable",
|
|
110
|
+
"initialSelectedValues",
|
|
111
|
+
"resetOnCollectionChange"
|
|
112
|
+
]);
|
|
113
|
+
});
|
|
114
|
+
const createSelection = (values = []) => {
|
|
115
|
+
const [localProps] = splittedProps();
|
|
116
|
+
const selection2 = new Selection(values);
|
|
117
|
+
selection2.selectionMode = localProps.selectionMode ?? "single";
|
|
118
|
+
selection2.deselectable = localProps.deselectable ?? true;
|
|
119
|
+
return selection2;
|
|
120
|
+
};
|
|
121
|
+
const init = () => {
|
|
122
|
+
const [localProps] = splittedProps();
|
|
123
|
+
return createSelection(localProps.initialSelectedValues ?? []);
|
|
124
|
+
};
|
|
125
|
+
const [selection, setSelection] = createSignal(init());
|
|
126
|
+
const watchDeps = () => {
|
|
127
|
+
const [{ collection, resetOnCollectionChange }] = splittedProps();
|
|
128
|
+
return [collection.getValues(), resetOnCollectionChange];
|
|
129
|
+
};
|
|
130
|
+
createEffect(
|
|
131
|
+
on(
|
|
132
|
+
watchDeps,
|
|
133
|
+
([, resetOnCollectionChange]) => {
|
|
134
|
+
if (resetOnCollectionChange) {
|
|
135
|
+
setSelection(createSelection());
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
{ defer: true }
|
|
139
|
+
)
|
|
140
|
+
);
|
|
141
|
+
const selectedValues = createMemo(() => Array.from(selection()));
|
|
142
|
+
const isEmpty = createMemo(() => selection().isEmpty());
|
|
143
|
+
const firstSelectedValue = createMemo(() => {
|
|
144
|
+
const [localProps] = splittedProps();
|
|
145
|
+
return selection().firstSelectedValue(localProps.collection);
|
|
146
|
+
});
|
|
147
|
+
const lastSelectedValue = createMemo(() => {
|
|
148
|
+
const [localProps] = splittedProps();
|
|
149
|
+
return selection().lastSelectedValue(localProps.collection);
|
|
150
|
+
});
|
|
151
|
+
return {
|
|
152
|
+
selectedValues,
|
|
153
|
+
isEmpty,
|
|
154
|
+
firstSelectedValue,
|
|
155
|
+
lastSelectedValue,
|
|
156
|
+
isSelected: (value) => {
|
|
157
|
+
return selection().isSelected(value);
|
|
158
|
+
},
|
|
159
|
+
isAllSelected: () => {
|
|
160
|
+
const [localProps] = splittedProps();
|
|
161
|
+
const allValues = localProps.collection.getValues();
|
|
162
|
+
return allValues.length > 0 && allValues.every((value) => selection().isSelected(value));
|
|
163
|
+
},
|
|
164
|
+
isSomeSelected: () => {
|
|
165
|
+
const [localProps] = splittedProps();
|
|
166
|
+
const allValues = localProps.collection.getValues();
|
|
167
|
+
return allValues.some((value) => selection().isSelected(value));
|
|
168
|
+
},
|
|
169
|
+
canSelect: (value) => {
|
|
170
|
+
const [localProps] = splittedProps();
|
|
171
|
+
return selection().canSelect(localProps.collection, value);
|
|
172
|
+
},
|
|
173
|
+
select: (value, forceToggle) => {
|
|
174
|
+
const [localProps] = splittedProps();
|
|
175
|
+
setSelection(selection().select(localProps.collection, value, forceToggle));
|
|
176
|
+
},
|
|
177
|
+
deselect: (value) => {
|
|
178
|
+
setSelection(selection().deselect(value));
|
|
179
|
+
},
|
|
180
|
+
toggle: (value) => {
|
|
181
|
+
const [localProps] = splittedProps();
|
|
182
|
+
setSelection(selection().toggleSelection(localProps.collection, value));
|
|
183
|
+
},
|
|
184
|
+
replace: (value) => {
|
|
185
|
+
const [localProps] = splittedProps();
|
|
186
|
+
setSelection(selection().replaceSelection(localProps.collection, value));
|
|
187
|
+
},
|
|
188
|
+
extend: (anchorValue, targetValue) => {
|
|
189
|
+
const [localProps] = splittedProps();
|
|
190
|
+
setSelection(selection().extendSelection(localProps.collection, anchorValue, targetValue));
|
|
191
|
+
},
|
|
192
|
+
setSelectedValues: (values) => {
|
|
193
|
+
setSelection(selection().setSelection(values));
|
|
194
|
+
},
|
|
195
|
+
clear: () => {
|
|
196
|
+
setSelection(selection().clearSelection());
|
|
197
|
+
},
|
|
198
|
+
resetSelection: () => {
|
|
199
|
+
setSelection(createSelection());
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
}
|
|
103
203
|
|
|
104
|
-
export { createFileTreeCollection, createGridCollection, createListCollection, createTreeCollection, useListCollection };
|
|
204
|
+
export { createFileTreeCollection, createGridCollection, createListCollection, createTreeCollection, useListCollection, useListSelection };
|
|
@@ -7,12 +7,12 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
ark
|
|
9
9
|
} from "./UFYZ7HLU.jsx";
|
|
10
|
-
import {
|
|
11
|
-
useEnvironmentContext
|
|
12
|
-
} from "./E2L62MKC.jsx";
|
|
13
10
|
import {
|
|
14
11
|
useLocaleContext
|
|
15
12
|
} from "./YUC6JE7K.jsx";
|
|
13
|
+
import {
|
|
14
|
+
useEnvironmentContext
|
|
15
|
+
} from "./E2L62MKC.jsx";
|
|
16
16
|
import {
|
|
17
17
|
createContext
|
|
18
18
|
} from "./TVCIHLER.jsx";
|
|
@@ -183,8 +183,10 @@ var useFileUpload = (props) => {
|
|
|
183
183
|
var FileUploadRoot = (props) => {
|
|
184
184
|
const [fileUploadProps, localProps] = createSplitProps()(props, [
|
|
185
185
|
"accept",
|
|
186
|
+
"acceptedFiles",
|
|
186
187
|
"allowDrop",
|
|
187
188
|
"capture",
|
|
189
|
+
"defaultAcceptedFiles",
|
|
188
190
|
"directory",
|
|
189
191
|
"disabled",
|
|
190
192
|
"id",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
collapsible_exports
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./Z2BXVXSV.jsx";
|
|
4
4
|
import {
|
|
5
5
|
RenderStrategyProvider,
|
|
6
6
|
splitRenderStrategyProps,
|
|
@@ -12,12 +12,12 @@ import {
|
|
|
12
12
|
import {
|
|
13
13
|
ark
|
|
14
14
|
} from "./UFYZ7HLU.jsx";
|
|
15
|
-
import {
|
|
16
|
-
useEnvironmentContext
|
|
17
|
-
} from "./E2L62MKC.jsx";
|
|
18
15
|
import {
|
|
19
16
|
useLocaleContext
|
|
20
17
|
} from "./YUC6JE7K.jsx";
|
|
18
|
+
import {
|
|
19
|
+
useEnvironmentContext
|
|
20
|
+
} from "./E2L62MKC.jsx";
|
|
21
21
|
import {
|
|
22
22
|
createContext
|
|
23
23
|
} from "./TVCIHLER.jsx";
|