@sprawlify/solid 0.0.17 → 0.0.19
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/{collapsible-Dp3pmOz6.js → collapsible-ACshHp__.js} +8 -8
- package/dist/{collapsible-oWvTRylz.jsx → collapsible-CKkCMXuJ.jsx} +8 -8
- package/dist/{collection-DOjgejiS.js → collection-CJLbf7-L.js} +2 -2
- package/dist/{collection-gIC58P6c.jsx → collection-DpPs7_vA.jsx} +2 -2
- package/dist/components/accordion/index.d.ts +11 -11
- package/dist/components/accordion/index.js +9 -9
- package/dist/components/accordion/index.jsx +9 -9
- package/dist/components/angle-slider/index.d.ts +13 -13
- package/dist/components/angle-slider/index.js +7 -7
- package/dist/components/angle-slider/index.jsx +7 -7
- package/dist/components/avatar/index.d.ts +8 -8
- package/dist/components/avatar/index.js +7 -7
- package/dist/components/avatar/index.jsx +7 -7
- package/dist/components/bottom-sheet/index.d.ts +13 -13
- package/dist/components/bottom-sheet/index.js +10 -10
- package/dist/components/bottom-sheet/index.jsx +10 -10
- package/dist/components/carousel/index.d.ts +17 -17
- package/dist/components/carousel/index.js +7 -7
- package/dist/components/carousel/index.jsx +7 -7
- package/dist/components/checkbox/index.d.ts +14 -14
- package/dist/components/checkbox/index.js +10 -10
- package/dist/components/checkbox/index.jsx +10 -10
- package/dist/components/clipboard/index.d.ts +11 -11
- package/dist/components/clipboard/index.js +7 -7
- package/dist/components/clipboard/index.jsx +7 -7
- package/dist/components/collapsible/index.d.ts +10 -10
- package/dist/components/collapsible/index.js +7 -7
- package/dist/components/collapsible/index.jsx +7 -7
- package/dist/components/collection/index.d.ts +2 -2
- package/dist/components/collection/index.js +2 -2
- package/dist/components/collection/index.jsx +2 -2
- package/dist/components/color-picker/index.d.ts +36 -36
- package/dist/components/color-picker/index.js +12 -12
- package/dist/components/color-picker/index.jsx +12 -12
- package/dist/components/combobox/index.d.ts +23 -23
- package/dist/components/combobox/index.js +13 -13
- package/dist/components/combobox/index.jsx +13 -13
- package/dist/components/date-picker/index.d.ts +33 -33
- package/dist/components/date-picker/index.js +10 -10
- package/dist/components/date-picker/index.jsx +10 -10
- package/dist/components/dialog/index.d.ts +13 -13
- package/dist/components/dialog/index.js +10 -10
- package/dist/components/dialog/index.jsx +10 -10
- package/dist/components/download-trigger/index.d.ts +2 -2
- package/dist/components/download-trigger/index.js +4 -4
- package/dist/components/download-trigger/index.jsx +4 -4
- package/dist/components/editable/index.d.ts +14 -14
- package/dist/components/editable/index.js +10 -10
- package/dist/components/editable/index.jsx +10 -10
- package/dist/components/field/index.d.ts +15 -15
- package/dist/components/field/index.js +8 -8
- package/dist/components/field/index.jsx +8 -8
- package/dist/components/fieldset/index.d.ts +12 -12
- package/dist/components/fieldset/index.js +7 -7
- package/dist/components/fieldset/index.jsx +7 -7
- package/dist/components/file-upload/index.d.ts +18 -18
- package/dist/components/file-upload/index.js +10 -10
- package/dist/components/file-upload/index.jsx +10 -10
- package/dist/components/floating-panel/index.d.ts +17 -17
- package/dist/components/floating-panel/index.js +10 -10
- package/dist/components/floating-panel/index.jsx +10 -10
- package/dist/components/focus-trap/index.d.ts +4 -4
- package/dist/components/focus-trap/index.js +4 -4
- package/dist/components/focus-trap/index.jsx +4 -4
- package/dist/components/format/index.d.ts +4 -4
- package/dist/components/format/index.js +3 -3
- package/dist/components/format/index.jsx +3 -3
- package/dist/components/frame/index.d.ts +1 -1
- package/dist/components/frame/index.js +3 -3
- package/dist/components/frame/index.jsx +3 -3
- package/dist/components/highlight/index.d.ts +3 -3
- package/dist/components/highlight/index.js +2 -2
- package/dist/components/highlight/index.jsx +2 -2
- package/dist/components/hover-card/index.d.ts +70 -0
- package/dist/components/hover-card/index.js +168 -0
- package/dist/components/hover-card/index.jsx +136 -0
- package/dist/components/image-cropper/index.d.ts +64 -0
- package/dist/components/image-cropper/index.js +151 -0
- package/dist/components/image-cropper/index.jsx +144 -0
- package/dist/components/json-tree-view/index.d.ts +56 -0
- package/dist/components/json-tree-view/index.js +330 -0
- package/dist/components/json-tree-view/index.jsx +204 -0
- package/dist/components/listbox/index.d.ts +114 -0
- package/dist/components/listbox/index.js +261 -0
- package/dist/components/listbox/index.jsx +236 -0
- package/dist/components/marquee/index.d.ts +59 -0
- package/dist/components/marquee/index.js +138 -0
- package/dist/components/marquee/index.jsx +126 -0
- package/dist/components/menu/index.d.ts +161 -0
- package/dist/components/menu/index.js +471 -0
- package/dist/components/menu/index.jsx +392 -0
- package/dist/components/navigation-menu/index.d.ts +90 -0
- package/dist/components/navigation-menu/index.js +304 -0
- package/dist/components/navigation-menu/index.jsx +237 -0
- package/dist/components/number-input/index.d.ts +74 -0
- package/dist/components/number-input/index.js +182 -0
- package/dist/components/number-input/index.jsx +173 -0
- package/dist/components/pagination/index.d.ts +69 -0
- package/dist/components/pagination/index.js +146 -0
- package/dist/components/pagination/index.jsx +139 -0
- package/dist/components/password-input/index.d.ts +66 -0
- package/dist/components/password-input/index.js +159 -0
- package/dist/components/password-input/index.jsx +140 -0
- package/dist/components/pin-input/index.d.ts +59 -0
- package/dist/components/pin-input/index.js +151 -0
- package/dist/components/pin-input/index.jsx +142 -0
- package/dist/components/popover/index.d.ts +95 -0
- package/dist/components/popover/index.js +220 -0
- package/dist/components/popover/index.jsx +188 -0
- package/dist/components/presence/index.d.ts +4 -4
- package/dist/components/presence/index.js +7 -7
- package/dist/components/presence/index.jsx +7 -7
- package/dist/components/progress/index.d.ts +79 -0
- package/dist/components/progress/index.js +163 -0
- package/dist/components/progress/index.jsx +154 -0
- package/dist/components/qr-code/index.d.ts +59 -0
- package/dist/components/qr-code/index.js +124 -0
- package/dist/components/qr-code/index.jsx +117 -0
- package/dist/components/radio-group/index.d.ts +78 -0
- package/dist/components/radio-group/index.js +189 -0
- package/dist/components/radio-group/index.jsx +176 -0
- package/dist/components/rating-group/index.d.ts +68 -0
- package/dist/components/rating-group/index.js +159 -0
- package/dist/components/rating-group/index.jsx +148 -0
- package/dist/components/scroll-area/index.d.ts +63 -0
- package/dist/components/scroll-area/index.js +134 -0
- package/dist/components/scroll-area/index.jsx +124 -0
- package/dist/components/segment-group/index.d.ts +82 -0
- package/dist/components/segment-group/index.js +185 -0
- package/dist/components/segment-group/index.jsx +172 -0
- package/dist/components/select/index.d.ts +22 -22
- package/dist/components/select/index.js +13 -13
- package/dist/components/select/index.jsx +13 -13
- package/dist/components/tree-view/index.d.ts +7 -0
- package/dist/components/tree-view/index.js +11 -0
- package/dist/components/tree-view/index.jsx +11 -0
- package/dist/{factory-OCDy1fEv.jsx → factory-CaQWQo9S.jsx} +1 -1
- package/dist/{factory-Ci1LUSWg.js → factory-Cw0jOohn.js} +1 -1
- package/dist/{factory-C7CCEqYp.d.ts → factory-JAbO6zq9.d.ts} +6 -1
- package/dist/{field-D5bG5XXV.js → field-CF9yh37t.js} +8 -8
- package/dist/{field-DQLYAOgJ.jsx → field-HJX3--SZ.jsx} +8 -8
- package/dist/{fieldset-DT2nCjE0.jsx → fieldset-GRdimTgu.jsx} +8 -8
- package/dist/{fieldset-Def05D5r.js → fieldset-QCHS-iMi.js} +8 -8
- package/dist/index-BGVwqZq5.d.ts +143 -0
- package/dist/index-BIlfNQle.d.ts +41 -0
- package/dist/index-BRkEGZOE.d.ts +41 -0
- package/dist/{index-Bf3vaCUa.d.ts → index-CWs-F296.d.ts} +8 -8
- package/dist/{index-4WaIBGi6.d.ts → index-CXTRMyIJ.d.ts} +1 -1
- package/dist/{index-CsB3A61w.d.ts → index-DD3lUYha.d.ts} +8 -8
- package/dist/index-PYTR4Rcx.d.ts +143 -0
- package/dist/index.d.ts +6 -44
- package/dist/index.js +6 -5
- package/dist/index.jsx +6 -5
- package/dist/{presence-CAkwk5S4.js → presence-DghVNXji.js} +7 -7
- package/dist/{presence-vlL8hWT8.jsx → presence-w97672yk.jsx} +7 -7
- package/dist/{providers-BRmk_hzA.jsx → providers--4jSRiKF.jsx} +2 -2
- package/dist/{providers-D1hKjv0s.js → providers-DU0gn4Pj.js} +2 -2
- package/dist/{render-strategy-BA_kLuwR.jsx → render-strategy-Bv1Mb0YK.jsx} +2 -2
- package/dist/{render-strategy-CqWA1-xU.js → render-strategy-CDrX5Nbw.js} +2 -2
- package/dist/tree-view-DdWaaT-E.js +318 -0
- package/dist/tree-view-Z565ZOf5.jsx +291 -0
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +2 -2
- package/dist/utils/index.jsx +2 -2
- package/package.json +97 -2
- /package/dist/{chunk-Wl6TQfsu.js → chunk-D5dGY5zD.jsx} +0 -0
- /package/dist/{chunk-dNcSV51B.jsx → chunk-Dcpub2IO.js} +0 -0
- /package/dist/{compose-refs-CDTdkuP1.jsx → compose-refs-D9EoLzZW.js} +0 -0
- /package/dist/{compose-refs-DbJoODKO.js → compose-refs-DhhUBbcq.jsx} +0 -0
- /package/dist/{core-CWSDVCoi.jsx → core-7JOW6ue9.jsx} +0 -0
- /package/dist/{core-Cl2xcDm5.js → core-D7Nb-duK.js} +0 -0
- /package/dist/{create-context-BBDU3kF1.js → create-context-BxYEOGb8.js} +0 -0
- /package/dist/{create-context-CpcL7CiV.jsx → create-context-CnA1wNMK.jsx} +0 -0
- /package/dist/{create-split-props-CHlLW_X_.js → create-split-props-CdETNVwB.jsx} +0 -0
- /package/dist/{create-split-props-DrfYep1t.jsx → create-split-props-u4BuKc2i.js} +0 -0
- /package/dist/{index-5DzQGTeT.d.ts → index-BF_h-dhb.d.ts} +0 -0
- /package/dist/{index-BLKwiHM7.d.ts → index-tbMcVIMv.d.ts} +0 -0
- /package/dist/{render-strategy-DfQ78EfE.d.ts → render-strategy-BYpcY4CF.d.ts} +0 -0
- /package/dist/{run-if-fn-Ct4sSuFV.js → run-if-fn-B-2chXMn.js} +0 -0
- /package/dist/{run-if-fn-iVu0r8rO.jsx → run-if-fn-D59uI-12.jsx} +0 -0
- /package/dist/{types-M3kll1K0.d.ts → types-DPhuMU2R.d.ts} +0 -0
- /package/dist/{utils-DK-8VxTv.jsx → utils-CM1Hmr0J.js} +0 -0
- /package/dist/{utils-xOi5tXWN.js → utils-DWEfyavN.jsx} +0 -0
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { t as __export } from "../../chunk-D5dGY5zD.jsx";
|
|
2
|
+
import "../../core-7JOW6ue9.jsx";
|
|
3
|
+
import { t as createContext$1 } from "../../create-context-CnA1wNMK.jsx";
|
|
4
|
+
import "../../providers--4jSRiKF.jsx";
|
|
5
|
+
import "../../factory-CaQWQo9S.jsx";
|
|
6
|
+
import { t as createSplitProps } from "../../create-split-props-CdETNVwB.jsx";
|
|
7
|
+
import "../../render-strategy-Bv1Mb0YK.jsx";
|
|
8
|
+
import "../../collapsible-CKkCMXuJ.jsx";
|
|
9
|
+
import { a as createTreeCollection } from "../../collection-DpPs7_vA.jsx";
|
|
10
|
+
import { T as useTreeViewContext, o as useTreeView, t as tree_view_exports } from "../../tree-view-Z565ZOf5.jsx";
|
|
11
|
+
import { For, Index, Show, createMemo, splitProps } from "solid-js";
|
|
12
|
+
import { Dynamic, untrack as untrack$1 } from "solid-js/web";
|
|
13
|
+
import { getAccessibleDescription, getRootNode, jsonNodeToElement, keyPathToKey, nodeToString, nodeToValue } from "@sprawlify/primitives/json-tree-utils";
|
|
14
|
+
|
|
15
|
+
//#region src/components/json-tree-view/get-branch-value.ts
|
|
16
|
+
function getBranchValues(tree, depth) {
|
|
17
|
+
let values = [];
|
|
18
|
+
tree.visit({ onEnter: (node, indexPath) => {
|
|
19
|
+
if (indexPath.length === 0) return;
|
|
20
|
+
if (tree.isBranchNode(node) && indexPath.length <= depth) values.push(tree.getNodeValue(node));
|
|
21
|
+
} });
|
|
22
|
+
return values;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region src/components/json-tree-view/json-tree-view-props-context.ts
|
|
27
|
+
const [JsonTreeViewPropsProvider, useJsonTreeViewPropsContext] = createContext$1({
|
|
28
|
+
hookName: "useJsonTreeViewPropsContext",
|
|
29
|
+
providerName: "<JsonTreeViewPropsProvider />"
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region src/components/json-tree-view/json-tree-view-root.tsx
|
|
34
|
+
const splitJsonTreeViewProps = createSplitProps();
|
|
35
|
+
const JsonTreeViewRoot = (props) => {
|
|
36
|
+
const [jsonTreeProps, localProps] = splitJsonTreeViewProps(props, [
|
|
37
|
+
"maxPreviewItems",
|
|
38
|
+
"collapseStringsAfterLength",
|
|
39
|
+
"quotesOnKeys",
|
|
40
|
+
"groupArraysAfterLength",
|
|
41
|
+
"showNonenumerable"
|
|
42
|
+
]);
|
|
43
|
+
const [jsonProps, restProps] = splitProps(localProps, ["data", "defaultExpandedDepth"]);
|
|
44
|
+
const collection = createMemo(() => {
|
|
45
|
+
return createTreeCollection({
|
|
46
|
+
nodeToValue,
|
|
47
|
+
nodeToString,
|
|
48
|
+
rootNode: getRootNode(jsonProps.data)
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
const defaultExpandedValue = createMemo(() => {
|
|
52
|
+
return jsonProps.defaultExpandedDepth != null ? getBranchValues(collection(), jsonProps.defaultExpandedDepth) : void 0;
|
|
53
|
+
});
|
|
54
|
+
return <JsonTreeViewPropsProvider value={jsonTreeProps}>
|
|
55
|
+
<tree_view_exports.Root data-scope="json-tree-view" collection={collection()} defaultExpandedValue={defaultExpandedValue()} {...restProps}>
|
|
56
|
+
{props.children}
|
|
57
|
+
</tree_view_exports.Root>
|
|
58
|
+
</JsonTreeViewPropsProvider>;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
//#endregion
|
|
62
|
+
//#region src/components/json-tree-view/json-tree-view-root-provider.tsx
|
|
63
|
+
const JsonTreeViewRootProvider = (props) => {
|
|
64
|
+
return <tree_view_exports.RootProvider data-scope="json-tree-view" {...props} />;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
//#endregion
|
|
68
|
+
//#region src/components/json-tree-view/json-tree-view-key-node.tsx
|
|
69
|
+
const JsonTreeViewKeyNode = (props) => {
|
|
70
|
+
const key = createMemo(() => keyPathToKey(props.node.keyPath));
|
|
71
|
+
return <>
|
|
72
|
+
<span data-kind="key" data-non-enumerable={props.node.isNonEnumerable ? "" : void 0}>
|
|
73
|
+
{props.showQuotes ? `"${key()}"` : key()}
|
|
74
|
+
</span>
|
|
75
|
+
<span data-kind="colon">: </span>
|
|
76
|
+
</>;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
//#endregion
|
|
80
|
+
//#region src/components/json-tree-view/json-tree-view-value-node.tsx
|
|
81
|
+
const JsonTreeViewValueNode = (props) => {
|
|
82
|
+
return <>
|
|
83
|
+
<Show when={props.node.type === "text"}>
|
|
84
|
+
{props.renderValue?.(props.node) ?? props.node.value}
|
|
85
|
+
</Show>
|
|
86
|
+
<Show when={props.node.type !== "text"}>
|
|
87
|
+
<Dynamic component={props.node.tagName} data-root={props.node.properties.root ? "" : void 0} data-type={props.node.properties.nodeType} data-kind={props.node.properties.kind}>
|
|
88
|
+
<For each={props.node.children}>
|
|
89
|
+
{(child) => <JsonTreeViewValueNode node={child} renderValue={props.renderValue} />}
|
|
90
|
+
</For>
|
|
91
|
+
</Dynamic>
|
|
92
|
+
</Show>
|
|
93
|
+
</>;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
//#endregion
|
|
97
|
+
//#region src/components/json-tree-view/json-tree-view-node.tsx
|
|
98
|
+
const scopeProps = { "data-scope": "json-tree-view" };
|
|
99
|
+
function JsonTreeViewNode(props) {
|
|
100
|
+
const tree = useTreeViewContext();
|
|
101
|
+
const nodeState = createMemo(() => tree().getNodeState({
|
|
102
|
+
node: props.node,
|
|
103
|
+
indexPath: props.indexPath
|
|
104
|
+
}));
|
|
105
|
+
const options = useJsonTreeViewPropsContext();
|
|
106
|
+
const key = createMemo(() => keyPathToKey(props.node.keyPath, { excludeRoot: true }));
|
|
107
|
+
const valueNode = createMemo(() => jsonNodeToElement(props.node, options));
|
|
108
|
+
const nodeProps = createMemo(() => {
|
|
109
|
+
const desc = getAccessibleDescription(props.node);
|
|
110
|
+
const line = props.indexPath.reduce((acc, curr) => acc + curr, 1);
|
|
111
|
+
const lineLength = props.indexPath.length - 1;
|
|
112
|
+
return {
|
|
113
|
+
...scopeProps,
|
|
114
|
+
"aria-label": desc,
|
|
115
|
+
"data-line": line,
|
|
116
|
+
style: { ["--line-length"]: lineLength }
|
|
117
|
+
};
|
|
118
|
+
});
|
|
119
|
+
return <tree_view_exports.NodeProvider node={props.node} indexPath={props.indexPath}>
|
|
120
|
+
<Show when={nodeState().isBranch} fallback={<tree_view_exports.Item {...nodeProps()}>
|
|
121
|
+
<tree_view_exports.ItemText {...scopeProps}>
|
|
122
|
+
<Show when={key()}>
|
|
123
|
+
<JsonTreeViewKeyNode node={props.node} showQuotes={options.quotesOnKeys} />
|
|
124
|
+
</Show>
|
|
125
|
+
<JsonTreeViewValueNode node={valueNode()} renderValue={props.renderValue} />
|
|
126
|
+
</tree_view_exports.ItemText>
|
|
127
|
+
</tree_view_exports.Item>}>
|
|
128
|
+
<tree_view_exports.Branch {...scopeProps}>
|
|
129
|
+
<tree_view_exports.BranchControl {...nodeProps()}>
|
|
130
|
+
<Show when={props.arrow}>
|
|
131
|
+
<tree_view_exports.BranchIndicator {...scopeProps}>{props.arrow}</tree_view_exports.BranchIndicator>
|
|
132
|
+
</Show>
|
|
133
|
+
<tree_view_exports.BranchText {...scopeProps}>
|
|
134
|
+
<Show when={key()}>
|
|
135
|
+
<JsonTreeViewKeyNode node={props.node} showQuotes={options.quotesOnKeys} />
|
|
136
|
+
</Show>
|
|
137
|
+
<JsonTreeViewValueNode node={valueNode()} renderValue={props.renderValue} />
|
|
138
|
+
</tree_view_exports.BranchText>
|
|
139
|
+
</tree_view_exports.BranchControl>
|
|
140
|
+
<tree_view_exports.BranchContent {...scopeProps}>
|
|
141
|
+
<Show when={typeof props.indentGuide === "boolean"} fallback={props.indentGuide}>
|
|
142
|
+
<tree_view_exports.BranchIndentGuide />
|
|
143
|
+
</Show>
|
|
144
|
+
<Index each={props.node.children}>
|
|
145
|
+
{(child, index) => <JsonTreeViewNode {...props} node={child()} indexPath={[...props.indexPath, index]} />}
|
|
146
|
+
</Index>
|
|
147
|
+
</tree_view_exports.BranchContent>
|
|
148
|
+
</tree_view_exports.Branch>
|
|
149
|
+
</Show>
|
|
150
|
+
</tree_view_exports.NodeProvider>;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
//#endregion
|
|
154
|
+
//#region src/components/json-tree-view/json-tree-view-tree.tsx
|
|
155
|
+
const splitTreeNodeProps = createSplitProps();
|
|
156
|
+
const JsonTreeViewTree = (props) => {
|
|
157
|
+
const [nodeProps, treeProps] = splitTreeNodeProps(props, [
|
|
158
|
+
"arrow",
|
|
159
|
+
"indentGuide",
|
|
160
|
+
"renderValue"
|
|
161
|
+
]);
|
|
162
|
+
const tree = useTreeViewContext();
|
|
163
|
+
const children$1 = () => tree().collection.getNodeChildren(tree().collection.rootNode);
|
|
164
|
+
return <tree_view_exports.Tree data-scope="json-tree-view" {...treeProps}>
|
|
165
|
+
<Index each={children$1()}>
|
|
166
|
+
{(child, index) => <JsonTreeViewNode node={child()} indexPath={[index]} {...nodeProps} />}
|
|
167
|
+
</Index>
|
|
168
|
+
</tree_view_exports.Tree>;
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
//#endregion
|
|
172
|
+
//#region src/components/json-tree-view/use-json-tree-view.ts
|
|
173
|
+
const useJsonTreeView = (props) => {
|
|
174
|
+
const [jsonProps, restProps] = splitProps(props, ["data", "defaultExpandedDepth"]);
|
|
175
|
+
const collection = createMemo(() => {
|
|
176
|
+
return createTreeCollection({
|
|
177
|
+
nodeToValue,
|
|
178
|
+
nodeToString,
|
|
179
|
+
rootNode: getRootNode(jsonProps.data)
|
|
180
|
+
});
|
|
181
|
+
});
|
|
182
|
+
const defaultExpandedValue = createMemo(() => {
|
|
183
|
+
return jsonProps.defaultExpandedDepth != null ? getBranchValues(collection(), jsonProps.defaultExpandedDepth) : void 0;
|
|
184
|
+
});
|
|
185
|
+
return useTreeView(createMemo(() => {
|
|
186
|
+
return {
|
|
187
|
+
defaultExpandedValue: untrack$1(defaultExpandedValue),
|
|
188
|
+
...restProps,
|
|
189
|
+
collection: collection(),
|
|
190
|
+
typeahead: false
|
|
191
|
+
};
|
|
192
|
+
}));
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
//#endregion
|
|
196
|
+
//#region src/components/json-tree-view/json-tree-view.tsx
|
|
197
|
+
var json_tree_view_exports = /* @__PURE__ */ __export({
|
|
198
|
+
Root: () => JsonTreeViewRoot,
|
|
199
|
+
RootProvider: () => JsonTreeViewRootProvider,
|
|
200
|
+
Tree: () => JsonTreeViewTree
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
//#endregion
|
|
204
|
+
export { json_tree_view_exports as JsonTreeView, JsonTreeViewRoot, JsonTreeViewRootProvider, JsonTreeViewTree, useJsonTreeView };
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { n as PropTypes } from "../../index-tbMcVIMv.js";
|
|
2
|
+
import { i as Optional, n as MaybeAccessor, t as Assign } from "../../types-DPhuMU2R.js";
|
|
3
|
+
import { r as PolymorphicProps, t as HTMLProps } from "../../factory-JAbO6zq9.js";
|
|
4
|
+
import { _ as CollectionItem, b as createListCollection, y as ListCollection } from "../../index-CXTRMyIJ.js";
|
|
5
|
+
import * as solid_js75 from "solid-js";
|
|
6
|
+
import { Accessor, JSX } from "solid-js";
|
|
7
|
+
import * as _sprawlify_primitives_anatomy0 from "@sprawlify/primitives/anatomy";
|
|
8
|
+
import * as listbox from "@sprawlify/primitives/machines/listbox";
|
|
9
|
+
import { HighlightChangeDetails, HighlightChangeDetails as ListboxHighlightChangeDetails, InputProps, ItemProps, ItemState, ScrollToIndexDetails, ScrollToIndexDetails as ListboxScrollToIndexDetails, SelectionDetails, SelectionDetails as ListboxSelectionDetails, SelectionMode, SelectionMode as ListboxSelectionMode, ValueChangeDetails, ValueChangeDetails as ListboxValueChangeDetails } from "@sprawlify/primitives/machines/listbox";
|
|
10
|
+
import { JSX as JSX$1 } from "solid-js/jsx-runtime";
|
|
11
|
+
|
|
12
|
+
//#region src/components/listbox/use-listbox.d.ts
|
|
13
|
+
interface UseListboxProps<T extends CollectionItem> extends Optional<Omit<listbox.Props<T>, 'dir' | 'getRootNode' | 'collection'>, 'id'> {
|
|
14
|
+
collection: ListCollection<T>;
|
|
15
|
+
}
|
|
16
|
+
interface UseListboxReturn<T extends CollectionItem> extends Accessor<listbox.Api<PropTypes, T>> {}
|
|
17
|
+
declare const useListbox: <T extends CollectionItem>(props: MaybeAccessor<UseListboxProps<T>>) => UseListboxReturn<T>;
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/components/listbox/use-listbox-context.d.ts
|
|
20
|
+
interface UseListboxContext<T extends CollectionItem> extends UseListboxReturn<T> {}
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region src/components/listbox/listbox-context.d.ts
|
|
23
|
+
interface ListboxContextProps<T extends CollectionItem> {
|
|
24
|
+
children: (context: UseListboxContext<T>) => JSX.Element;
|
|
25
|
+
}
|
|
26
|
+
declare function ListboxContext<T extends CollectionItem>(props: ListboxContextProps<T>): JSX.Element;
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region src/components/listbox/listbox-content.d.ts
|
|
29
|
+
interface ListboxContentBaseProps extends PolymorphicProps<'div'> {}
|
|
30
|
+
interface ListboxContentProps extends HTMLProps<'div'>, ListboxContentBaseProps {}
|
|
31
|
+
declare const ListboxContent: (props: ListboxContentProps) => solid_js75.JSX.Element;
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region src/components/listbox/listbox-empty.d.ts
|
|
34
|
+
interface ListboxEmptyBaseProps extends PolymorphicProps<'div'> {}
|
|
35
|
+
interface ListboxEmptyProps extends HTMLProps<'div'>, ListboxEmptyBaseProps {}
|
|
36
|
+
declare const ListboxEmpty: (props: ListboxEmptyProps) => solid_js75.JSX.Element;
|
|
37
|
+
//#endregion
|
|
38
|
+
//#region src/components/listbox/listbox-input.d.ts
|
|
39
|
+
interface ListboxInputBaseProps extends InputProps, PolymorphicProps<'input'> {}
|
|
40
|
+
interface ListboxInputProps extends HTMLProps<'input'>, ListboxInputBaseProps {}
|
|
41
|
+
declare const ListboxInput: (props: ListboxInputProps) => solid_js75.JSX.Element;
|
|
42
|
+
//#endregion
|
|
43
|
+
//#region src/components/listbox/listbox-item.d.ts
|
|
44
|
+
interface ListboxItemBaseProps extends ItemProps, PolymorphicProps<'div'> {}
|
|
45
|
+
interface ListboxItemProps extends HTMLProps<'div'>, ListboxItemBaseProps {}
|
|
46
|
+
declare const ListboxItem: (props: ListboxItemProps) => solid_js75.JSX.Element;
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region src/components/listbox/use-listbox-item-context.d.ts
|
|
49
|
+
interface UseListboxItemContext extends ItemState {}
|
|
50
|
+
//#endregion
|
|
51
|
+
//#region src/components/listbox/listbox-item-context.d.ts
|
|
52
|
+
interface ListboxItemContextProps {
|
|
53
|
+
children: (context: UseListboxItemContext) => JSX.Element;
|
|
54
|
+
}
|
|
55
|
+
declare function ListboxItemContext(props: ListboxItemContextProps): JSX.Element;
|
|
56
|
+
//#endregion
|
|
57
|
+
//#region src/components/listbox/listbox-item-group.d.ts
|
|
58
|
+
interface ListboxItemGroupBaseProps extends PolymorphicProps<'div'> {}
|
|
59
|
+
interface ListboxItemGroupProps extends HTMLProps<'div'>, ListboxItemGroupBaseProps {}
|
|
60
|
+
declare const ListboxItemGroup: (props: ListboxItemGroupProps) => solid_js75.JSX.Element;
|
|
61
|
+
//#endregion
|
|
62
|
+
//#region src/components/listbox/listbox-item-group-label.d.ts
|
|
63
|
+
interface ListboxItemGroupLabelBaseProps extends PolymorphicProps<'div'> {}
|
|
64
|
+
interface ListboxItemGroupLabelProps extends HTMLProps<'div'>, ListboxItemGroupLabelBaseProps {}
|
|
65
|
+
declare const ListboxItemGroupLabel: (props: ListboxItemGroupLabelProps) => solid_js75.JSX.Element;
|
|
66
|
+
//#endregion
|
|
67
|
+
//#region src/components/listbox/listbox-item-indicator.d.ts
|
|
68
|
+
interface ListboxItemIndicatorBaseProps extends PolymorphicProps<'div'> {}
|
|
69
|
+
interface ListboxItemIndicatorProps extends HTMLProps<'div'>, ListboxItemIndicatorBaseProps {}
|
|
70
|
+
declare const ListboxItemIndicator: (props: ListboxItemIndicatorProps) => solid_js75.JSX.Element;
|
|
71
|
+
//#endregion
|
|
72
|
+
//#region src/components/listbox/listbox-item-text.d.ts
|
|
73
|
+
interface ListboxItemTextBaseProps extends PolymorphicProps<'div'> {}
|
|
74
|
+
interface ListboxItemTextProps extends HTMLProps<'div'>, ListboxItemTextBaseProps {}
|
|
75
|
+
declare const ListboxItemText: (props: ListboxItemTextProps) => solid_js75.JSX.Element;
|
|
76
|
+
//#endregion
|
|
77
|
+
//#region src/components/listbox/listbox-label.d.ts
|
|
78
|
+
interface ListboxLabelBaseProps extends PolymorphicProps<'label'> {}
|
|
79
|
+
interface ListboxLabelProps extends HTMLProps<'label'>, ListboxLabelBaseProps {}
|
|
80
|
+
declare const ListboxLabel: (props: ListboxLabelProps) => solid_js75.JSX.Element;
|
|
81
|
+
//#endregion
|
|
82
|
+
//#region src/components/listbox/listbox-root.d.ts
|
|
83
|
+
interface ListboxRootBaseProps<T extends CollectionItem> extends UseListboxProps<T>, PolymorphicProps<'div'> {}
|
|
84
|
+
interface ListboxRootProps<T extends CollectionItem> extends Assign<HTMLProps<'div'>, ListboxRootBaseProps<T>> {}
|
|
85
|
+
declare const ListboxRoot: <T extends CollectionItem>(props: ListboxRootProps<T>) => solid_js75.JSX.Element;
|
|
86
|
+
type ListboxRootComponentProps<T extends CollectionItem = CollectionItem, P = {}> = Assign<ListboxRootProps<T>, P>;
|
|
87
|
+
type ListboxRootComponent<P = {}> = <T extends CollectionItem>(props: ListboxRootComponentProps<T, P>) => any;
|
|
88
|
+
//#endregion
|
|
89
|
+
//#region src/components/listbox/listbox-root-provider.d.ts
|
|
90
|
+
interface RootProviderProps<T extends CollectionItem> {
|
|
91
|
+
value: UseListboxReturn<T>;
|
|
92
|
+
}
|
|
93
|
+
interface ListboxRootProviderBaseProps<T extends CollectionItem> extends RootProviderProps<T>, PolymorphicProps<'div'> {}
|
|
94
|
+
interface ListboxRootProviderProps<T extends CollectionItem> extends HTMLProps<'div'>, ListboxRootProviderBaseProps<T> {}
|
|
95
|
+
declare const ListboxRootProvider: <T extends CollectionItem>(props: ListboxRootProviderProps<T>) => JSX$1.Element;
|
|
96
|
+
type ListboxRootProviderComponent<P = {}> = <T extends CollectionItem>(props: Assign<ListboxRootProviderProps<T>, P>) => JSX$1.Element;
|
|
97
|
+
//#endregion
|
|
98
|
+
//#region src/components/listbox/listbox-value-text.d.ts
|
|
99
|
+
interface ListboxValueTextBaseProps extends PolymorphicProps<'span'> {
|
|
100
|
+
/**
|
|
101
|
+
* Text to display when no value is selected.
|
|
102
|
+
*/
|
|
103
|
+
placeholder?: string;
|
|
104
|
+
}
|
|
105
|
+
interface ListboxValueTextProps extends HTMLProps<'span'>, ListboxValueTextBaseProps {}
|
|
106
|
+
declare const ListboxValueText: (props: ListboxValueTextProps) => solid_js75.JSX.Element;
|
|
107
|
+
//#endregion
|
|
108
|
+
//#region src/components/listbox/listbox-anatomy.d.ts
|
|
109
|
+
declare const listboxAnatomy: _sprawlify_primitives_anatomy0.AnatomyInstance<"root" | "item" | "itemGroup" | "label" | "itemText" | "input" | "itemIndicator" | "content" | "itemGroupLabel" | "empty" | "valueText">;
|
|
110
|
+
declare namespace listbox_d_exports {
|
|
111
|
+
export { ListboxContent as Content, ListboxContentBaseProps as ContentBaseProps, ListboxContentProps as ContentProps, ListboxContext as Context, ListboxContextProps as ContextProps, ListboxEmpty as Empty, ListboxEmptyBaseProps as EmptyBaseProps, ListboxEmptyProps as EmptyProps, HighlightChangeDetails, ListboxInput as Input, ListboxInputBaseProps as InputBaseProps, ListboxInputProps as InputProps, ListboxItem as Item, ListboxItemBaseProps as ItemBaseProps, ListboxItemContext as ItemContext, ListboxItemContextProps as ItemContextProps, ListboxItemGroup as ItemGroup, ListboxItemGroupBaseProps as ItemGroupBaseProps, ListboxItemGroupLabel as ItemGroupLabel, ListboxItemGroupLabelBaseProps as ItemGroupLabelBaseProps, ListboxItemGroupLabelProps as ItemGroupLabelProps, ListboxItemGroupProps as ItemGroupProps, ListboxItemIndicator as ItemIndicator, ListboxItemIndicatorBaseProps as ItemIndicatorBaseProps, ListboxItemIndicatorProps as ItemIndicatorProps, ListboxItemProps as ItemProps, ListboxItemText as ItemText, ListboxItemTextBaseProps as ItemTextBaseProps, ListboxItemTextProps as ItemTextProps, ListboxLabel as Label, ListboxLabelBaseProps as LabelBaseProps, ListboxLabelProps as LabelProps, ListboxRoot as Root, ListboxRootBaseProps as RootBaseProps, ListboxRootComponent as RootComponent, ListboxRootComponentProps as RootComponentProps, ListboxRootProps as RootProps, ListboxRootProvider as RootProvider, ListboxRootProviderBaseProps as RootProviderBaseProps, ListboxRootProviderComponent as RootProviderComponent, ListboxRootProviderProps as RootProviderProps, ScrollToIndexDetails, SelectionDetails, SelectionMode, ValueChangeDetails, ListboxValueText as ValueText, ListboxValueTextBaseProps as ValueTextBaseProps, ListboxValueTextProps as ValueTextProps };
|
|
112
|
+
}
|
|
113
|
+
//#endregion
|
|
114
|
+
export { type CollectionItem, type ListCollection, listbox_d_exports as Listbox, ListboxContent, type ListboxContentBaseProps, type ListboxContentProps, ListboxContext, type ListboxContextProps, ListboxEmpty, type ListboxEmptyBaseProps, type ListboxEmptyProps, type ListboxHighlightChangeDetails, ListboxInput, type ListboxInputBaseProps, type ListboxInputProps, ListboxItem, type ListboxItemBaseProps, ListboxItemContext, type ListboxItemContextProps, ListboxItemGroup, type ListboxItemGroupBaseProps, ListboxItemGroupLabel, type ListboxItemGroupLabelBaseProps, type ListboxItemGroupLabelProps, type ListboxItemGroupProps, ListboxItemIndicator, type ListboxItemIndicatorBaseProps, type ListboxItemIndicatorProps, type ListboxItemProps, ListboxItemText, type ListboxItemTextBaseProps, type ListboxItemTextProps, ListboxLabel, type ListboxLabelBaseProps, type ListboxLabelProps, ListboxRoot, type ListboxRootBaseProps, type ListboxRootComponent, type ListboxRootComponentProps, type ListboxRootProps, ListboxRootProvider, type ListboxRootProviderBaseProps, type ListboxRootProviderComponent, type ListboxRootProviderProps, type ListboxScrollToIndexDetails, type ListboxSelectionDetails, type ListboxSelectionMode, type ListboxValueChangeDetails, ListboxValueText, type ListboxValueTextBaseProps, type ListboxValueTextProps, type UseListboxContext, type UseListboxItemContext, type UseListboxProps, type UseListboxReturn, createListCollection, listboxAnatomy, useListbox, useListboxContext, useListboxItemContext };
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
import { t as __export } from "../../chunk-Dcpub2IO.js";
|
|
2
|
+
import { i as useMachine, n as normalizeProps, r as mergeProps$2 } from "../../core-D7Nb-duK.js";
|
|
3
|
+
import { t as runIfFn } from "../../run-if-fn-B-2chXMn.js";
|
|
4
|
+
import { t as createContext$1 } from "../../create-context-BxYEOGb8.js";
|
|
5
|
+
import { i as useLocaleContext, o as useEnvironmentContext } from "../../providers-DU0gn4Pj.js";
|
|
6
|
+
import { t as sprawlify } from "../../factory-Cw0jOohn.js";
|
|
7
|
+
import { t as createSplitProps } from "../../create-split-props-u4BuKc2i.js";
|
|
8
|
+
import { o as createListCollection } from "../../collection-CJLbf7-L.js";
|
|
9
|
+
import { Show, children, createMemo, createUniqueId } from "solid-js";
|
|
10
|
+
import { createComponent, mergeProps as mergeProps$1 } from "solid-js/web";
|
|
11
|
+
import * as listbox from "@sprawlify/primitives/machines/listbox";
|
|
12
|
+
import { anatomy } from "@sprawlify/primitives/machines/listbox";
|
|
13
|
+
|
|
14
|
+
//#region src/components/listbox/use-listbox-context.ts
|
|
15
|
+
const [ListboxProvider, useListboxContext] = createContext$1({
|
|
16
|
+
hookName: "useListboxContext",
|
|
17
|
+
providerName: "<ListboxProvider />"
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/components/listbox/listbox-context.tsx
|
|
22
|
+
function ListboxContext(props) {
|
|
23
|
+
return props.children(useListboxContext());
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/components/listbox/listbox-content.tsx
|
|
28
|
+
const ListboxContent = (props) => {
|
|
29
|
+
const listbox$1 = useListboxContext();
|
|
30
|
+
const mergedProps = mergeProps$2(() => listbox$1().getContentProps(), props);
|
|
31
|
+
return createComponent(sprawlify.div, mergedProps);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/components/listbox/listbox-anatomy.ts
|
|
36
|
+
const listboxAnatomy = anatomy.extendWith("empty");
|
|
37
|
+
|
|
38
|
+
//#endregion
|
|
39
|
+
//#region src/components/listbox/listbox-empty.tsx
|
|
40
|
+
const parts = listboxAnatomy.build();
|
|
41
|
+
const ListboxEmpty = (props) => {
|
|
42
|
+
const listbox$1 = useListboxContext();
|
|
43
|
+
const size = createMemo(() => listbox$1().collection.size);
|
|
44
|
+
return createComponent(Show, {
|
|
45
|
+
get when() {
|
|
46
|
+
return size() === 0;
|
|
47
|
+
},
|
|
48
|
+
get children() {
|
|
49
|
+
return createComponent(sprawlify.div, mergeProps$1(() => parts.empty.attrs, props, { role: "presentation" }));
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
//#endregion
|
|
55
|
+
//#region src/components/listbox/listbox-input.tsx
|
|
56
|
+
const ListboxInput = (props) => {
|
|
57
|
+
const [inputProps, localProps] = createSplitProps()(props, ["autoHighlight"]);
|
|
58
|
+
const listbox$1 = useListboxContext();
|
|
59
|
+
const mergedProps = mergeProps$2(() => listbox$1().getInputProps(inputProps), localProps);
|
|
60
|
+
return createComponent(sprawlify.input, mergedProps);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
//#endregion
|
|
64
|
+
//#region src/components/listbox/use-listbox-item-context.ts
|
|
65
|
+
const [ListboxItemProvider, useListboxItemContext] = createContext$1({
|
|
66
|
+
hookName: "useListboxItemContext",
|
|
67
|
+
providerName: "<ListboxItemProvider />"
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
//#endregion
|
|
71
|
+
//#region src/components/listbox/use-listbox-item-props-context.ts
|
|
72
|
+
const [ListboxItemPropsProvider, useListboxItemPropsContext] = createContext$1({
|
|
73
|
+
hookName: "useListboxItemPropsContext",
|
|
74
|
+
providerName: "<ListboxItemPropsProvider />"
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
//#endregion
|
|
78
|
+
//#region src/components/listbox/listbox-item.tsx
|
|
79
|
+
const ListboxItem = (props) => {
|
|
80
|
+
const [itemProps, localProps] = createSplitProps()(props, ["item", "highlightOnHover"]);
|
|
81
|
+
const listbox$1 = useListboxContext();
|
|
82
|
+
const mergedProps = mergeProps$2(() => listbox$1().getItemProps(itemProps), localProps);
|
|
83
|
+
const itemState = () => listbox$1().getItemState(itemProps);
|
|
84
|
+
return createComponent(ListboxItemPropsProvider, {
|
|
85
|
+
value: itemProps,
|
|
86
|
+
get children() {
|
|
87
|
+
return createComponent(ListboxItemProvider, {
|
|
88
|
+
get value() {
|
|
89
|
+
return itemState();
|
|
90
|
+
},
|
|
91
|
+
get children() {
|
|
92
|
+
return createComponent(sprawlify.div, mergedProps);
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
//#endregion
|
|
100
|
+
//#region src/components/listbox/listbox-item-context.tsx
|
|
101
|
+
function ListboxItemContext(props) {
|
|
102
|
+
return props.children(useListboxItemContext());
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
//#endregion
|
|
106
|
+
//#region src/components/listbox/use-listbox-item-group-props-context.ts
|
|
107
|
+
const [ListboxItemGroupPropsProvider, useListboxItemGroupPropsContext] = createContext$1({
|
|
108
|
+
hookName: "useListboxItemGroupPropsContext",
|
|
109
|
+
providerName: "<ListboxItemGroupPropsProvider />"
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
//#endregion
|
|
113
|
+
//#region src/components/listbox/listbox-item-group.tsx
|
|
114
|
+
const ListboxItemGroup = (props) => {
|
|
115
|
+
const id = createUniqueId();
|
|
116
|
+
const [_itemGroupProps, localProps] = createSplitProps()(props, ["id"]);
|
|
117
|
+
const itemGroupProps = {
|
|
118
|
+
id,
|
|
119
|
+
..._itemGroupProps
|
|
120
|
+
};
|
|
121
|
+
const listbox$1 = useListboxContext();
|
|
122
|
+
const mergedProps = mergeProps$2(() => listbox$1().getItemGroupProps(itemGroupProps), localProps);
|
|
123
|
+
return createComponent(ListboxItemGroupPropsProvider, {
|
|
124
|
+
value: itemGroupProps,
|
|
125
|
+
get children() {
|
|
126
|
+
return createComponent(sprawlify.div, mergedProps);
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
//#endregion
|
|
132
|
+
//#region src/components/listbox/listbox-item-group-label.tsx
|
|
133
|
+
const ListboxItemGroupLabel = (props) => {
|
|
134
|
+
const listbox$1 = useListboxContext();
|
|
135
|
+
const itemGroupProps = useListboxItemGroupPropsContext();
|
|
136
|
+
const mergedProps = mergeProps$2(() => listbox$1().getItemGroupLabelProps({ htmlFor: itemGroupProps.id }), props);
|
|
137
|
+
return createComponent(sprawlify.div, mergedProps);
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
//#endregion
|
|
141
|
+
//#region src/components/listbox/listbox-item-indicator.tsx
|
|
142
|
+
const ListboxItemIndicator = (props) => {
|
|
143
|
+
const listbox$1 = useListboxContext();
|
|
144
|
+
const itemProps = useListboxItemPropsContext();
|
|
145
|
+
const mergedProps = mergeProps$2(() => listbox$1().getItemIndicatorProps(itemProps), props);
|
|
146
|
+
return createComponent(sprawlify.div, mergedProps);
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
//#endregion
|
|
150
|
+
//#region src/components/listbox/listbox-item-text.tsx
|
|
151
|
+
const ListboxItemText = (props) => {
|
|
152
|
+
const listbox$1 = useListboxContext();
|
|
153
|
+
const itemProps = useListboxItemPropsContext();
|
|
154
|
+
const mergedProps = mergeProps$2(() => listbox$1().getItemTextProps(itemProps), props);
|
|
155
|
+
return createComponent(sprawlify.div, mergedProps);
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
//#endregion
|
|
159
|
+
//#region src/components/listbox/listbox-label.tsx
|
|
160
|
+
const ListboxLabel = (props) => {
|
|
161
|
+
const listbox$1 = useListboxContext();
|
|
162
|
+
const mergedProps = mergeProps$2(() => listbox$1().getLabelProps(), props);
|
|
163
|
+
return createComponent(sprawlify.label, mergedProps);
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
//#endregion
|
|
167
|
+
//#region src/components/listbox/use-listbox.ts
|
|
168
|
+
const useListbox = (props) => {
|
|
169
|
+
const id = createUniqueId();
|
|
170
|
+
const locale = useLocaleContext();
|
|
171
|
+
const environment = useEnvironmentContext();
|
|
172
|
+
const machineProps = createMemo(() => ({
|
|
173
|
+
id,
|
|
174
|
+
dir: locale().dir,
|
|
175
|
+
getRootNode: environment().getRootNode,
|
|
176
|
+
...runIfFn(props)
|
|
177
|
+
}));
|
|
178
|
+
const service = useMachine(listbox.machine, machineProps);
|
|
179
|
+
return createMemo(() => listbox.connect(service, normalizeProps));
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
//#endregion
|
|
183
|
+
//#region src/components/listbox/listbox-root.tsx
|
|
184
|
+
const ListboxRoot = (props) => {
|
|
185
|
+
const [useListboxProps, localProps] = createSplitProps()(props, [
|
|
186
|
+
"collection",
|
|
187
|
+
"defaultHighlightedValue",
|
|
188
|
+
"defaultValue",
|
|
189
|
+
"deselectable",
|
|
190
|
+
"disabled",
|
|
191
|
+
"disallowSelectAll",
|
|
192
|
+
"highlightedValue",
|
|
193
|
+
"id",
|
|
194
|
+
"ids",
|
|
195
|
+
"loopFocus",
|
|
196
|
+
"onHighlightChange",
|
|
197
|
+
"onSelect",
|
|
198
|
+
"onValueChange",
|
|
199
|
+
"orientation",
|
|
200
|
+
"scrollToIndexFn",
|
|
201
|
+
"selectionMode",
|
|
202
|
+
"selectOnHighlight",
|
|
203
|
+
"typeahead",
|
|
204
|
+
"value"
|
|
205
|
+
]);
|
|
206
|
+
const listbox$1 = useListbox(useListboxProps);
|
|
207
|
+
const mergedProps = mergeProps$2(() => listbox$1().getRootProps(), localProps);
|
|
208
|
+
return createComponent(ListboxProvider, {
|
|
209
|
+
value: listbox$1,
|
|
210
|
+
get children() {
|
|
211
|
+
return createComponent(sprawlify.div, mergedProps);
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
//#endregion
|
|
217
|
+
//#region src/components/listbox/listbox-root-provider.tsx
|
|
218
|
+
const ListboxRootProvider = (props) => {
|
|
219
|
+
const [{ value: listbox$1 }, localProps] = createSplitProps()(props, ["value"]);
|
|
220
|
+
const mergedProps = mergeProps$2(() => listbox$1().getRootProps(), localProps);
|
|
221
|
+
return createComponent(ListboxProvider, {
|
|
222
|
+
value: listbox$1,
|
|
223
|
+
get children() {
|
|
224
|
+
return createComponent(sprawlify.div, mergedProps);
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
//#endregion
|
|
230
|
+
//#region src/components/listbox/listbox-value-text.tsx
|
|
231
|
+
const ListboxValueText = (props) => {
|
|
232
|
+
const { placeholder, ...localprops } = props;
|
|
233
|
+
const listbox$1 = useListboxContext();
|
|
234
|
+
const mergedProps = mergeProps$2(() => listbox$1().getValueTextProps(), localprops);
|
|
235
|
+
const resolved = children(() => props.children);
|
|
236
|
+
return createComponent(sprawlify.span, mergeProps$1(mergedProps, { get children() {
|
|
237
|
+
return resolved() || listbox$1().valueAsString || placeholder;
|
|
238
|
+
} }));
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
//#endregion
|
|
242
|
+
//#region src/components/listbox/listbox.ts
|
|
243
|
+
var listbox_exports = /* @__PURE__ */ __export({
|
|
244
|
+
Content: () => ListboxContent,
|
|
245
|
+
Context: () => ListboxContext,
|
|
246
|
+
Empty: () => ListboxEmpty,
|
|
247
|
+
Input: () => ListboxInput,
|
|
248
|
+
Item: () => ListboxItem,
|
|
249
|
+
ItemContext: () => ListboxItemContext,
|
|
250
|
+
ItemGroup: () => ListboxItemGroup,
|
|
251
|
+
ItemGroupLabel: () => ListboxItemGroupLabel,
|
|
252
|
+
ItemIndicator: () => ListboxItemIndicator,
|
|
253
|
+
ItemText: () => ListboxItemText,
|
|
254
|
+
Label: () => ListboxLabel,
|
|
255
|
+
Root: () => ListboxRoot,
|
|
256
|
+
RootProvider: () => ListboxRootProvider,
|
|
257
|
+
ValueText: () => ListboxValueText
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
//#endregion
|
|
261
|
+
export { listbox_exports as Listbox, ListboxContent, ListboxContext, ListboxEmpty, ListboxInput, ListboxItem, ListboxItemContext, ListboxItemGroup, ListboxItemGroupLabel, ListboxItemIndicator, ListboxItemText, ListboxLabel, ListboxRoot, ListboxRootProvider, ListboxValueText, createListCollection, listboxAnatomy, useListbox, useListboxContext, useListboxItemContext };
|