@sprawlify/vue 0.0.65 → 0.0.67
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/clean-props-BDv2zb5M.js +9 -0
- package/dist/collapsible-DQfAISmg.js +259 -0
- package/dist/collection-Ba0Aeh5P.js +218 -0
- package/dist/components/accordion/index.d.ts +195 -0
- package/dist/components/accordion/index.js +361 -0
- package/dist/components/angle-slider/index.d.ts +230 -0
- package/dist/components/angle-slider/index.js +371 -0
- package/dist/components/avatar/index.d.ts +116 -0
- package/dist/components/avatar/index.js +177 -0
- package/dist/components/bottom-sheet/index.d.ts +241 -0
- package/dist/components/bottom-sheet/index.js +429 -0
- package/dist/components/carousel/index.d.ts +306 -0
- package/dist/components/carousel/index.js +500 -0
- package/dist/components/checkbox/index.d.ts +273 -0
- package/dist/components/checkbox/index.js +500 -0
- package/dist/components/client-only/index.d.ts +20 -0
- package/dist/components/client-only/index.js +22 -0
- package/dist/components/clipboard/index.d.ts +204 -0
- package/dist/components/clipboard/index.js +297 -0
- package/dist/components/collapsible/index.d.ts +15 -23
- package/dist/components/collapsible/index.js +5 -325
- package/dist/components/collection/index.d.ts +2 -0
- package/dist/components/collection/index.js +4 -0
- package/dist/components/color-picker/index.d.ts +610 -0
- package/dist/components/color-picker/index.js +1127 -0
- package/dist/components/combobox/index.d.ts +618 -0
- package/dist/components/combobox/index.js +802 -0
- package/dist/components/date-picker/index.d.ts +597 -0
- package/dist/components/date-picker/index.js +1110 -0
- package/dist/components/dialog/index.d.ts +270 -0
- package/dist/components/dialog/index.js +433 -0
- package/dist/components/download-trigger/index.d.ts +29 -0
- package/dist/components/download-trigger/index.js +68 -0
- package/dist/components/editable/index.d.ts +288 -0
- package/dist/components/editable/index.js +459 -0
- package/dist/components/field/index.d.ts +326 -0
- package/dist/components/field/index.js +7 -0
- package/dist/components/fieldset/index.d.ts +161 -0
- package/dist/components/fieldset/index.js +7 -0
- package/dist/components/highlight/index.d.ts +35 -0
- package/dist/components/highlight/index.js +57 -0
- package/dist/components/menu/index.d.ts +498 -0
- package/dist/components/menu/index.js +885 -0
- package/dist/components/presence/index.d.ts +3 -0
- package/dist/components/presence/index.js +6 -0
- package/dist/components/select/index.d.ts +430 -0
- package/dist/components/select/index.js +769 -0
- package/dist/{use-forward-expose-BIk4OI3R.js → core-DNndr38p.js} +2 -170
- package/dist/create-split-props-YZ3qgXe_.js +11 -0
- package/dist/factory-BH3WrWd2.js +68 -0
- package/dist/factory-D_ge_w76.d.ts +8 -0
- package/dist/field-DnHnX3Tf.js +501 -0
- package/dist/fieldset-DzhN7Zrg.js +278 -0
- package/dist/{types-BQfkZGpL.d.ts → index-B66Om_3U.d.ts} +1 -9
- package/dist/index-BBHms9-0.d.ts +91 -0
- package/dist/index-CDQghZtv.d.ts +57 -0
- package/dist/index-DqRk-Yea.d.ts +199 -0
- package/dist/index.d.ts +4 -92
- package/dist/index.js +4 -50
- package/dist/presence-CvUnYMZQ.js +105 -0
- package/dist/presence-types-Bv1E60Cw.d.ts +13 -0
- package/dist/providers-B2CNPFg1.js +108 -0
- package/dist/types-Bj-dS2Hc.d.ts +9 -0
- package/dist/use-forward-expose-4p5AGAI3.js +67 -0
- package/dist/use-render-strategy-BkxoN6ll.js +7 -0
- package/dist/use-render-strategy-CHj_pCfT.d.ts +9 -0
- package/dist/utils-B4FuOOE-.js +51 -0
- package/package.json +86 -2
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import { t as __exportAll } from "./chunk-BN_g-Awi.js";
|
|
2
|
+
import { n as useMachine, r as normalizeProps$1 } from "./core-DNndr38p.js";
|
|
3
|
+
import { a as useLocaleContext, c as useEnvironmentContext, i as DEFAULT_LOCALE, s as DEFAULT_ENVIRONMENT } from "./providers-B2CNPFg1.js";
|
|
4
|
+
import { r as createContext, t as useForwardExpose } from "./use-forward-expose-4p5AGAI3.js";
|
|
5
|
+
import { t as sprawlify } from "./factory-BH3WrWd2.js";
|
|
6
|
+
import { t as cleanProps } from "./clean-props-BDv2zb5M.js";
|
|
7
|
+
import { computed, createBlock, createCommentVNode, defineComponent, guardReactiveProps, mergeDefaults, mergeProps, normalizeProps, openBlock, ref, renderSlot, toValue, unref, useId, watch, withCtx } from "vue";
|
|
8
|
+
import * as collapsible from "@sprawlify/primitives/machines/collapsible";
|
|
9
|
+
import { anatomy as collapsibleAnatomy } from "@sprawlify/primitives/machines/collapsible";
|
|
10
|
+
|
|
11
|
+
//#region src/components/collapsible/use-collapsible-context.ts
|
|
12
|
+
const [CollapsibleProvider, useCollapsibleContext] = createContext("CollapsibleContext");
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/components/collapsible/collapsible-content.vue?vue&type=script&setup=true&lang.ts
|
|
16
|
+
var collapsible_content_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
17
|
+
__name: "collapsible-content",
|
|
18
|
+
props: { asChild: {
|
|
19
|
+
type: Boolean,
|
|
20
|
+
required: false
|
|
21
|
+
} },
|
|
22
|
+
setup(__props) {
|
|
23
|
+
const collapsible = useCollapsibleContext();
|
|
24
|
+
useForwardExpose();
|
|
25
|
+
return (_ctx, _cache) => {
|
|
26
|
+
return !unref(collapsible).unmounted ? (openBlock(), createBlock(unref(sprawlify).div, mergeProps({ key: 0 }, unref(collapsible).getContentProps(), { "as-child": __props.asChild }), {
|
|
27
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
28
|
+
_: 3
|
|
29
|
+
}, 16, ["as-child"])) : createCommentVNode("v-if", true);
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/components/collapsible/collapsible-content.vue
|
|
36
|
+
var collapsible_content_default = collapsible_content_vue_vue_type_script_setup_true_lang_default;
|
|
37
|
+
|
|
38
|
+
//#endregion
|
|
39
|
+
//#region src/components/collapsible/collapsible-context.vue?vue&type=script&setup=true&lang.ts
|
|
40
|
+
var collapsible_context_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
41
|
+
__name: "collapsible-context",
|
|
42
|
+
setup(__props) {
|
|
43
|
+
const collapsible = useCollapsibleContext();
|
|
44
|
+
return (_ctx, _cache) => {
|
|
45
|
+
return renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(unref(collapsible))));
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
//#endregion
|
|
51
|
+
//#region src/components/collapsible/collapsible-context.vue
|
|
52
|
+
var collapsible_context_default = collapsible_context_vue_vue_type_script_setup_true_lang_default;
|
|
53
|
+
|
|
54
|
+
//#endregion
|
|
55
|
+
//#region src/components/collapsible/collapsible-root-provider.vue?vue&type=script&setup=true&lang.ts
|
|
56
|
+
var collapsible_root_provider_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
57
|
+
__name: "collapsible-root-provider",
|
|
58
|
+
props: {
|
|
59
|
+
value: {
|
|
60
|
+
type: null,
|
|
61
|
+
required: true
|
|
62
|
+
},
|
|
63
|
+
asChild: {
|
|
64
|
+
type: Boolean,
|
|
65
|
+
required: false
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
setup(__props) {
|
|
69
|
+
const props = __props;
|
|
70
|
+
const collapsible = computed(() => props.value);
|
|
71
|
+
CollapsibleProvider(collapsible);
|
|
72
|
+
useForwardExpose();
|
|
73
|
+
return (_ctx, _cache) => {
|
|
74
|
+
return openBlock(), createBlock(unref(sprawlify).div, mergeProps(collapsible.value.getRootProps(), { "as-child": __props.asChild }), {
|
|
75
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
76
|
+
_: 3
|
|
77
|
+
}, 16, ["as-child"]);
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
//#endregion
|
|
83
|
+
//#region src/components/collapsible/collapsible-root-provider.vue
|
|
84
|
+
var collapsible_root_provider_default = collapsible_root_provider_vue_vue_type_script_setup_true_lang_default;
|
|
85
|
+
|
|
86
|
+
//#endregion
|
|
87
|
+
//#region src/components/collapsible/use-collapsible.ts
|
|
88
|
+
const useCollapsible = (props = {}, emits) => {
|
|
89
|
+
const id = useId();
|
|
90
|
+
const env = useEnvironmentContext(DEFAULT_ENVIRONMENT);
|
|
91
|
+
const locale = useLocaleContext(DEFAULT_LOCALE);
|
|
92
|
+
const context = computed(() => {
|
|
93
|
+
const localeProps = toValue(props);
|
|
94
|
+
return {
|
|
95
|
+
id,
|
|
96
|
+
dir: locale.value.dir,
|
|
97
|
+
getRootNode: env?.value.getRootNode,
|
|
98
|
+
...cleanProps(localeProps),
|
|
99
|
+
onExitComplete: () => {
|
|
100
|
+
emits?.("exitComplete");
|
|
101
|
+
localeProps.onExitComplete?.();
|
|
102
|
+
},
|
|
103
|
+
onOpenChange: (details) => {
|
|
104
|
+
emits?.("openChange", details);
|
|
105
|
+
emits?.("update:open", details.open);
|
|
106
|
+
localeProps.onOpenChange?.(details);
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
});
|
|
110
|
+
const service = useMachine(collapsible.machine, context);
|
|
111
|
+
const api = computed(() => collapsible.connect(service, normalizeProps$1));
|
|
112
|
+
const wasVisible = ref(false);
|
|
113
|
+
watch(() => api.value.visible, () => {
|
|
114
|
+
if (api.value.visible) wasVisible.value = true;
|
|
115
|
+
});
|
|
116
|
+
return computed(() => {
|
|
117
|
+
const localeProps = toValue(props);
|
|
118
|
+
return {
|
|
119
|
+
...api.value,
|
|
120
|
+
unmounted: !api.value.visible && !wasVisible.value && localeProps.lazyMount || localeProps.unmountOnExit && !api.value.visible && wasVisible.value
|
|
121
|
+
};
|
|
122
|
+
});
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
//#endregion
|
|
126
|
+
//#region src/components/collapsible/collapsible-root.vue?vue&type=script&setup=true&lang.ts
|
|
127
|
+
var collapsible_root_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
128
|
+
__name: "collapsible-root",
|
|
129
|
+
props: /* @__PURE__ */ mergeDefaults({
|
|
130
|
+
collapsedHeight: {
|
|
131
|
+
type: [Number, String],
|
|
132
|
+
required: false
|
|
133
|
+
},
|
|
134
|
+
collapsedWidth: {
|
|
135
|
+
type: [Number, String],
|
|
136
|
+
required: false
|
|
137
|
+
},
|
|
138
|
+
defaultOpen: {
|
|
139
|
+
type: Boolean,
|
|
140
|
+
required: false
|
|
141
|
+
},
|
|
142
|
+
disabled: {
|
|
143
|
+
type: Boolean,
|
|
144
|
+
required: false
|
|
145
|
+
},
|
|
146
|
+
id: {
|
|
147
|
+
type: String,
|
|
148
|
+
required: false
|
|
149
|
+
},
|
|
150
|
+
ids: {
|
|
151
|
+
type: Object,
|
|
152
|
+
required: false
|
|
153
|
+
},
|
|
154
|
+
lazyMount: {
|
|
155
|
+
type: Boolean,
|
|
156
|
+
required: false
|
|
157
|
+
},
|
|
158
|
+
open: {
|
|
159
|
+
type: Boolean,
|
|
160
|
+
required: false
|
|
161
|
+
},
|
|
162
|
+
unmountOnExit: {
|
|
163
|
+
type: Boolean,
|
|
164
|
+
required: false
|
|
165
|
+
},
|
|
166
|
+
asChild: {
|
|
167
|
+
type: Boolean,
|
|
168
|
+
required: false
|
|
169
|
+
}
|
|
170
|
+
}, {
|
|
171
|
+
defaultOpen: void 0,
|
|
172
|
+
disabled: void 0,
|
|
173
|
+
lazyMount: void 0,
|
|
174
|
+
open: void 0,
|
|
175
|
+
unmountOnExit: void 0
|
|
176
|
+
}),
|
|
177
|
+
emits: [
|
|
178
|
+
"exitComplete",
|
|
179
|
+
"openChange",
|
|
180
|
+
"update:open"
|
|
181
|
+
],
|
|
182
|
+
setup(__props, { emit: __emit }) {
|
|
183
|
+
const collapsible = useCollapsible(__props, __emit);
|
|
184
|
+
CollapsibleProvider(collapsible);
|
|
185
|
+
useForwardExpose();
|
|
186
|
+
return (_ctx, _cache) => {
|
|
187
|
+
return openBlock(), createBlock(unref(sprawlify).div, mergeProps(unref(collapsible).getRootProps(), { "as-child": __props.asChild }), {
|
|
188
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
189
|
+
_: 3
|
|
190
|
+
}, 16, ["as-child"]);
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
//#endregion
|
|
196
|
+
//#region src/components/collapsible/collapsible-root.vue
|
|
197
|
+
var collapsible_root_default = collapsible_root_vue_vue_type_script_setup_true_lang_default;
|
|
198
|
+
|
|
199
|
+
//#endregion
|
|
200
|
+
//#region src/components/collapsible/collapsible-trigger.vue?vue&type=script&setup=true&lang.ts
|
|
201
|
+
var collapsible_trigger_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
202
|
+
__name: "collapsible-trigger",
|
|
203
|
+
props: { asChild: {
|
|
204
|
+
type: Boolean,
|
|
205
|
+
required: false
|
|
206
|
+
} },
|
|
207
|
+
setup(__props) {
|
|
208
|
+
const collapsible = useCollapsibleContext();
|
|
209
|
+
useForwardExpose();
|
|
210
|
+
return (_ctx, _cache) => {
|
|
211
|
+
return openBlock(), createBlock(unref(sprawlify).button, mergeProps(unref(collapsible).getTriggerProps(), { "as-child": __props.asChild }), {
|
|
212
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
213
|
+
_: 3
|
|
214
|
+
}, 16, ["as-child"]);
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
//#endregion
|
|
220
|
+
//#region src/components/collapsible/collapsible-trigger.vue
|
|
221
|
+
var collapsible_trigger_default = collapsible_trigger_vue_vue_type_script_setup_true_lang_default;
|
|
222
|
+
|
|
223
|
+
//#endregion
|
|
224
|
+
//#region src/components/collapsible/collapsible-indicator.vue?vue&type=script&setup=true&lang.ts
|
|
225
|
+
var collapsible_indicator_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
226
|
+
__name: "collapsible-indicator",
|
|
227
|
+
props: { asChild: {
|
|
228
|
+
type: Boolean,
|
|
229
|
+
required: false
|
|
230
|
+
} },
|
|
231
|
+
setup(__props) {
|
|
232
|
+
const collapsible = useCollapsibleContext();
|
|
233
|
+
useForwardExpose();
|
|
234
|
+
return (_ctx, _cache) => {
|
|
235
|
+
return openBlock(), createBlock(unref(sprawlify).div, mergeProps(unref(collapsible).getIndicatorProps(), { "as-child": __props.asChild }), {
|
|
236
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
237
|
+
_: 3
|
|
238
|
+
}, 16, ["as-child"]);
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
//#endregion
|
|
244
|
+
//#region src/components/collapsible/collapsible-indicator.vue
|
|
245
|
+
var collapsible_indicator_default = collapsible_indicator_vue_vue_type_script_setup_true_lang_default;
|
|
246
|
+
|
|
247
|
+
//#endregion
|
|
248
|
+
//#region src/components/collapsible/collapsible.ts
|
|
249
|
+
var collapsible_exports = /* @__PURE__ */ __exportAll({
|
|
250
|
+
Content: () => collapsible_content_default,
|
|
251
|
+
Context: () => collapsible_context_default,
|
|
252
|
+
Indicator: () => collapsible_indicator_default,
|
|
253
|
+
Root: () => collapsible_root_default,
|
|
254
|
+
RootProvider: () => collapsible_root_provider_default,
|
|
255
|
+
Trigger: () => collapsible_trigger_default
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
//#endregion
|
|
259
|
+
export { collapsible_root_default as a, collapsible_context_default as c, collapsible_trigger_default as i, collapsible_content_default as l, collapsibleAnatomy as n, useCollapsible as o, collapsible_indicator_default as r, collapsible_root_provider_default as s, collapsible_exports as t, useCollapsibleContext as u };
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { n as useMachine } from "./core-DNndr38p.js";
|
|
2
|
+
import { t as cleanProps } from "./clean-props-BDv2zb5M.js";
|
|
3
|
+
import { computed, ref, shallowRef, toValue, watch } from "vue";
|
|
4
|
+
import { GridCollection, ListCollection, Selection, TreeCollection, filePathToTree } from "@sprawlify/primitives/collection";
|
|
5
|
+
import * as asyncList from "@sprawlify/primitives/machines/async-list";
|
|
6
|
+
|
|
7
|
+
//#region src/components/collection/grid-collection.ts
|
|
8
|
+
const createGridCollection = (options) => new GridCollection(options);
|
|
9
|
+
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region src/components/collection/list-collection.ts
|
|
12
|
+
const createListCollection = (options) => new ListCollection(options);
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/components/collection/tree-collection.ts
|
|
16
|
+
const createTreeCollection = (options) => new TreeCollection(options);
|
|
17
|
+
const createFileTreeCollection = (paths) => filePathToTree(paths);
|
|
18
|
+
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region src/components/collection/use-async-list.ts
|
|
21
|
+
const useAsyncList = (props = {}) => {
|
|
22
|
+
const context = computed(() => cleanProps(toValue(props)));
|
|
23
|
+
const service = useMachine(asyncList.machine, context);
|
|
24
|
+
return computed(() => asyncList.connect(service));
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region src/components/collection/use-list-collection.ts
|
|
29
|
+
function useListCollection(props) {
|
|
30
|
+
const resolvedProps = computed(() => {
|
|
31
|
+
const { initialItems = [], filter, limit, ...collectionOptions } = toValue(props);
|
|
32
|
+
return [{
|
|
33
|
+
initialItems,
|
|
34
|
+
filter,
|
|
35
|
+
limit
|
|
36
|
+
}, collectionOptions];
|
|
37
|
+
});
|
|
38
|
+
const init = () => {
|
|
39
|
+
const { initialItems } = resolvedProps.value[0];
|
|
40
|
+
return initialItems;
|
|
41
|
+
};
|
|
42
|
+
const items = ref(init());
|
|
43
|
+
const filterText = ref("");
|
|
44
|
+
const setItems = (newItems) => {
|
|
45
|
+
items.value = newItems;
|
|
46
|
+
filterText.value = "";
|
|
47
|
+
};
|
|
48
|
+
const create = (itemsToCreate) => {
|
|
49
|
+
const [, collectionOptions] = resolvedProps.value;
|
|
50
|
+
return createListCollection({
|
|
51
|
+
...collectionOptions,
|
|
52
|
+
items: itemsToCreate
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
return {
|
|
56
|
+
collection: computed(() => {
|
|
57
|
+
const [localProps, collectionOptions] = resolvedProps.value;
|
|
58
|
+
let activeItems = items.value;
|
|
59
|
+
const filter = localProps.filter;
|
|
60
|
+
if (filterText.value && filter) activeItems = create(items.value).filter((itemString, _index, item) => filter(itemString, filterText.value, item)).items;
|
|
61
|
+
const limitedItems = localProps.limit == null ? activeItems : activeItems.slice(0, localProps.limit);
|
|
62
|
+
return createListCollection({
|
|
63
|
+
...collectionOptions,
|
|
64
|
+
items: limitedItems
|
|
65
|
+
});
|
|
66
|
+
}),
|
|
67
|
+
filter: (inputValue = "") => {
|
|
68
|
+
filterText.value = inputValue;
|
|
69
|
+
},
|
|
70
|
+
set: (newItems) => {
|
|
71
|
+
setItems(newItems);
|
|
72
|
+
},
|
|
73
|
+
reset: () => {
|
|
74
|
+
const [localProps] = resolvedProps.value;
|
|
75
|
+
setItems(localProps.initialItems);
|
|
76
|
+
},
|
|
77
|
+
clear: () => {
|
|
78
|
+
setItems([]);
|
|
79
|
+
},
|
|
80
|
+
insert: (index, ...itemsToInsert) => {
|
|
81
|
+
const newItems = create(items.value).insert(index, ...itemsToInsert).items;
|
|
82
|
+
setItems(newItems);
|
|
83
|
+
},
|
|
84
|
+
insertBefore: (value, ...itemsToInsert) => {
|
|
85
|
+
const newItems = create(items.value).insertBefore(value, ...itemsToInsert).items;
|
|
86
|
+
setItems(newItems);
|
|
87
|
+
},
|
|
88
|
+
insertAfter: (value, ...itemsToInsert) => {
|
|
89
|
+
const newItems = create(items.value).insertAfter(value, ...itemsToInsert).items;
|
|
90
|
+
setItems(newItems);
|
|
91
|
+
},
|
|
92
|
+
remove: (...itemOrValues) => {
|
|
93
|
+
const newItems = create(items.value).remove(...itemOrValues).items;
|
|
94
|
+
setItems(newItems);
|
|
95
|
+
},
|
|
96
|
+
move: (value, to) => {
|
|
97
|
+
const newItems = create(items.value).move(value, to).items;
|
|
98
|
+
setItems(newItems);
|
|
99
|
+
},
|
|
100
|
+
moveBefore: (value, ...values) => {
|
|
101
|
+
const newItems = create(items.value).moveBefore(value, ...values).items;
|
|
102
|
+
setItems(newItems);
|
|
103
|
+
},
|
|
104
|
+
moveAfter: (value, ...values) => {
|
|
105
|
+
const newItems = create(items.value).moveAfter(value, ...values).items;
|
|
106
|
+
setItems(newItems);
|
|
107
|
+
},
|
|
108
|
+
reorder: (from, to) => {
|
|
109
|
+
const newItems = create(items.value).reorder(from, to).items;
|
|
110
|
+
setItems(newItems);
|
|
111
|
+
},
|
|
112
|
+
append: (...itemsToAppend) => {
|
|
113
|
+
const newItems = create(items.value).append(...itemsToAppend).items;
|
|
114
|
+
setItems(newItems);
|
|
115
|
+
},
|
|
116
|
+
upsert: (value, item, mode = "append") => {
|
|
117
|
+
const newItems = create(items.value).upsert(value, item, mode).items;
|
|
118
|
+
setItems(newItems);
|
|
119
|
+
},
|
|
120
|
+
prepend: (...itemsToPrepend) => {
|
|
121
|
+
const newItems = create(items.value).prepend(...itemsToPrepend).items;
|
|
122
|
+
setItems(newItems);
|
|
123
|
+
},
|
|
124
|
+
update: (value, item) => {
|
|
125
|
+
const newItems = create(items.value).update(value, item).items;
|
|
126
|
+
setItems(newItems);
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
//#endregion
|
|
132
|
+
//#region src/components/collection/use-list-selection.ts
|
|
133
|
+
function useListSelection(props) {
|
|
134
|
+
const resolvedProps = computed(() => {
|
|
135
|
+
const { collection, selectionMode = "single", deselectable = true, initialSelectedValues = [], resetOnCollectionChange = false } = toValue(props);
|
|
136
|
+
return {
|
|
137
|
+
collection,
|
|
138
|
+
selectionMode,
|
|
139
|
+
deselectable,
|
|
140
|
+
initialSelectedValues,
|
|
141
|
+
resetOnCollectionChange
|
|
142
|
+
};
|
|
143
|
+
});
|
|
144
|
+
const createSelection = (values = []) => {
|
|
145
|
+
const { selectionMode, deselectable } = resolvedProps.value;
|
|
146
|
+
const selection = new Selection(values);
|
|
147
|
+
selection.selectionMode = selectionMode;
|
|
148
|
+
selection.deselectable = deselectable;
|
|
149
|
+
return selection;
|
|
150
|
+
};
|
|
151
|
+
const init = () => {
|
|
152
|
+
const { initialSelectedValues } = resolvedProps.value;
|
|
153
|
+
return createSelection(initialSelectedValues);
|
|
154
|
+
};
|
|
155
|
+
const selection = shallowRef(init());
|
|
156
|
+
watch([() => resolvedProps.value.collection.getValues(), () => resolvedProps.value.resetOnCollectionChange], ([, resetOnCollectionChange]) => {
|
|
157
|
+
if (resetOnCollectionChange) selection.value = createSelection();
|
|
158
|
+
});
|
|
159
|
+
return {
|
|
160
|
+
selectedValues: computed(() => Array.from(selection.value)),
|
|
161
|
+
isEmpty: computed(() => selection.value.isEmpty()),
|
|
162
|
+
firstSelectedValue: computed(() => {
|
|
163
|
+
const { collection } = resolvedProps.value;
|
|
164
|
+
return selection.value.firstSelectedValue(collection);
|
|
165
|
+
}),
|
|
166
|
+
lastSelectedValue: computed(() => {
|
|
167
|
+
const { collection } = resolvedProps.value;
|
|
168
|
+
return selection.value.lastSelectedValue(collection);
|
|
169
|
+
}),
|
|
170
|
+
isSelected: (value) => {
|
|
171
|
+
return selection.value.isSelected(value);
|
|
172
|
+
},
|
|
173
|
+
isAllSelected: () => {
|
|
174
|
+
const { collection } = resolvedProps.value;
|
|
175
|
+
const allValues = collection.getValues();
|
|
176
|
+
return allValues.length > 0 && allValues.every((value) => selection.value.isSelected(value));
|
|
177
|
+
},
|
|
178
|
+
isSomeSelected: () => {
|
|
179
|
+
const { collection } = resolvedProps.value;
|
|
180
|
+
return collection.getValues().some((value) => selection.value.isSelected(value));
|
|
181
|
+
},
|
|
182
|
+
canSelect: (value) => {
|
|
183
|
+
const { collection } = resolvedProps.value;
|
|
184
|
+
return selection.value.canSelect(collection, value);
|
|
185
|
+
},
|
|
186
|
+
select: (value, forceToggle) => {
|
|
187
|
+
const { collection } = resolvedProps.value;
|
|
188
|
+
selection.value = selection.value.select(collection, value, forceToggle);
|
|
189
|
+
},
|
|
190
|
+
deselect: (value) => {
|
|
191
|
+
selection.value = selection.value.deselect(value);
|
|
192
|
+
},
|
|
193
|
+
toggle: (value) => {
|
|
194
|
+
const { collection } = resolvedProps.value;
|
|
195
|
+
selection.value = selection.value.toggleSelection(collection, value);
|
|
196
|
+
},
|
|
197
|
+
replace: (value) => {
|
|
198
|
+
const { collection } = resolvedProps.value;
|
|
199
|
+
selection.value = selection.value.replaceSelection(collection, value);
|
|
200
|
+
},
|
|
201
|
+
extend: (anchorValue, targetValue) => {
|
|
202
|
+
const { collection } = resolvedProps.value;
|
|
203
|
+
selection.value = selection.value.extendSelection(collection, anchorValue, targetValue);
|
|
204
|
+
},
|
|
205
|
+
setSelectedValues: (values) => {
|
|
206
|
+
selection.value = selection.value.setSelection(values);
|
|
207
|
+
},
|
|
208
|
+
clear: () => {
|
|
209
|
+
selection.value = selection.value.clearSelection();
|
|
210
|
+
},
|
|
211
|
+
resetSelection: () => {
|
|
212
|
+
selection.value = createSelection();
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
//#endregion
|
|
218
|
+
export { createTreeCollection as a, createFileTreeCollection as i, useListCollection as n, createListCollection as o, useAsyncList as r, createGridCollection as s, useListSelection as t };
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import { t as PolymorphicProps } from "../../factory-D_ge_w76.js";
|
|
2
|
+
import { i as UsePresenceProps } from "../../index-CDQghZtv.js";
|
|
3
|
+
import { a as Optional, r as EmitFn$1 } from "../../types-Bj-dS2Hc.js";
|
|
4
|
+
import { r as PropTypes } from "../../index-B66Om_3U.js";
|
|
5
|
+
import { t as RenderStrategyProps } from "../../use-render-strategy-CHj_pCfT.js";
|
|
6
|
+
import * as vue954 from "vue";
|
|
7
|
+
import { ButtonHTMLAttributes, ComputedRef, HTMLAttributes, MaybeRef, SlotsType, UnwrapRef } from "vue";
|
|
8
|
+
import * as accordion from "@sprawlify/primitives/machines/accordion";
|
|
9
|
+
import { FocusChangeDetails, FocusChangeDetails as AccordionFocusChangeDetails, ItemProps, ItemState, ValueChangeDetails, ValueChangeDetails as AccordionValueChangeDetails, anatomy as accordionAnatomy } from "@sprawlify/primitives/machines/accordion";
|
|
10
|
+
|
|
11
|
+
//#region src/components/accordion/accordion-types.d.ts
|
|
12
|
+
interface RootProps {
|
|
13
|
+
collapsible?: boolean;
|
|
14
|
+
defaultValue?: string[];
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
id?: string;
|
|
17
|
+
ids?: Partial<{
|
|
18
|
+
root: string;
|
|
19
|
+
item(value: string): string;
|
|
20
|
+
itemContent(value: string): string;
|
|
21
|
+
itemTrigger(value: string): string;
|
|
22
|
+
}>;
|
|
23
|
+
modelValue?: string[];
|
|
24
|
+
multiple?: boolean;
|
|
25
|
+
orientation?: 'horizontal' | 'vertical';
|
|
26
|
+
}
|
|
27
|
+
type RootEmits = {
|
|
28
|
+
focusChange: [details: accordion.FocusChangeDetails];
|
|
29
|
+
valueChange: [details: accordion.ValueChangeDetails];
|
|
30
|
+
'update:modelValue': [value: string[]];
|
|
31
|
+
};
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region src/components/accordion/use-accordion.d.ts
|
|
34
|
+
interface UseAccordionProps extends Optional<Omit<accordion.Props, 'dir' | 'getRootNode'>, 'id'> {
|
|
35
|
+
modelValue?: accordion.Props['value'];
|
|
36
|
+
}
|
|
37
|
+
interface UseAccordionReturn extends ComputedRef<accordion.Api<PropTypes>> {}
|
|
38
|
+
declare const useAccordion: (props?: MaybeRef<UseAccordionProps>, emit?: EmitFn$1<RootEmits>) => UseAccordionReturn;
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region src/components/accordion/use-accordion-context.d.ts
|
|
41
|
+
interface UseAccordionContext extends UseAccordionReturn, UsePresenceProps {}
|
|
42
|
+
//#endregion
|
|
43
|
+
//#region src/components/accordion/accordion-context.vue.d.ts
|
|
44
|
+
interface AccordionContextProps extends SlotsType<{
|
|
45
|
+
default: UnwrapRef<UseAccordionContext>;
|
|
46
|
+
}> {}
|
|
47
|
+
declare const _default: typeof __VLS_export$7;
|
|
48
|
+
declare const __VLS_export$7: __VLS_WithSlots$7<vue954.DefineComponent<{}, {}, {}, {}, {}, vue954.ComponentOptionsMixin, vue954.ComponentOptionsMixin, {}, string, vue954.PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, vue954.ComponentProvideOptions, true, {}, any>, {
|
|
49
|
+
default(accordion: UnwrapRef<UseAccordionContext>): unknown;
|
|
50
|
+
}>;
|
|
51
|
+
type __VLS_WithSlots$7<T, S> = T & {
|
|
52
|
+
new (): {
|
|
53
|
+
$slots: S;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
//#endregion
|
|
57
|
+
//#region src/components/accordion/accordion-item-content.vue.d.ts
|
|
58
|
+
interface AccordionItemContentBaseProps extends PolymorphicProps {}
|
|
59
|
+
interface AccordionItemContentProps extends AccordionItemContentBaseProps,
|
|
60
|
+
/**
|
|
61
|
+
* @vue-ignore
|
|
62
|
+
*/
|
|
63
|
+
HTMLAttributes {}
|
|
64
|
+
declare const _default$2: typeof __VLS_export$6;
|
|
65
|
+
declare const __VLS_export$6: __VLS_WithSlots$6<vue954.DefineComponent<AccordionItemContentProps, {}, {}, {}, {}, vue954.ComponentOptionsMixin, vue954.ComponentOptionsMixin, {}, string, vue954.PublicProps, Readonly<AccordionItemContentProps> & Readonly<{}>, {}, {}, {}, {}, string, vue954.ComponentProvideOptions, false, {}, any>, {
|
|
66
|
+
default?: (props: {}) => any;
|
|
67
|
+
}>;
|
|
68
|
+
type __VLS_WithSlots$6<T, S> = T & {
|
|
69
|
+
new (): {
|
|
70
|
+
$slots: S;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
//#endregion
|
|
74
|
+
//#region src/components/accordion/use-accordion-item-context.d.ts
|
|
75
|
+
interface UseAccordionItemContext extends ComputedRef<ItemState> {}
|
|
76
|
+
//#endregion
|
|
77
|
+
//#region src/components/accordion/accordion-item-context.vue.d.ts
|
|
78
|
+
interface AccordionItemContextProps extends SlotsType<{
|
|
79
|
+
default: UnwrapRef<UseAccordionItemContext>;
|
|
80
|
+
}> {}
|
|
81
|
+
declare const _default$3: typeof __VLS_export$5;
|
|
82
|
+
declare const __VLS_export$5: __VLS_WithSlots$5<vue954.DefineComponent<{}, {}, {}, {}, {}, vue954.ComponentOptionsMixin, vue954.ComponentOptionsMixin, {}, string, vue954.PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, vue954.ComponentProvideOptions, true, {}, any>, {
|
|
83
|
+
default(item: UnwrapRef<UseAccordionItemContext>): unknown;
|
|
84
|
+
}>;
|
|
85
|
+
type __VLS_WithSlots$5<T, S> = T & {
|
|
86
|
+
new (): {
|
|
87
|
+
$slots: S;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
//#endregion
|
|
91
|
+
//#region src/components/accordion/accordion-item-indicator.vue.d.ts
|
|
92
|
+
interface AccordionItemIndicatorBaseProps extends PolymorphicProps {}
|
|
93
|
+
interface AccordionItemIndicatorProps extends AccordionItemIndicatorBaseProps,
|
|
94
|
+
/**
|
|
95
|
+
* @vue-ignore
|
|
96
|
+
*/
|
|
97
|
+
HTMLAttributes {}
|
|
98
|
+
declare const _default$4: typeof __VLS_export$4;
|
|
99
|
+
declare const __VLS_export$4: __VLS_WithSlots$4<vue954.DefineComponent<AccordionItemIndicatorProps, {}, {}, {}, {}, vue954.ComponentOptionsMixin, vue954.ComponentOptionsMixin, {}, string, vue954.PublicProps, Readonly<AccordionItemIndicatorProps> & Readonly<{}>, {}, {}, {}, {}, string, vue954.ComponentProvideOptions, false, {}, any>, {
|
|
100
|
+
default?: (props: {}) => any;
|
|
101
|
+
}>;
|
|
102
|
+
type __VLS_WithSlots$4<T, S> = T & {
|
|
103
|
+
new (): {
|
|
104
|
+
$slots: S;
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
//#endregion
|
|
108
|
+
//#region src/components/accordion/accordion-item-trigger.vue.d.ts
|
|
109
|
+
interface AccordionItemTriggerBaseProps extends PolymorphicProps {}
|
|
110
|
+
interface AccordionItemTriggerProps extends AccordionItemTriggerBaseProps,
|
|
111
|
+
/**
|
|
112
|
+
* @vue-ignore
|
|
113
|
+
*/
|
|
114
|
+
ButtonHTMLAttributes {}
|
|
115
|
+
declare const _default$5: typeof __VLS_export$3;
|
|
116
|
+
declare const __VLS_export$3: __VLS_WithSlots$3<vue954.DefineComponent<AccordionItemTriggerProps, {}, {}, {}, {}, vue954.ComponentOptionsMixin, vue954.ComponentOptionsMixin, {}, string, vue954.PublicProps, Readonly<AccordionItemTriggerProps> & Readonly<{}>, {}, {}, {}, {}, string, vue954.ComponentProvideOptions, false, {}, any>, {
|
|
117
|
+
default?: (props: {}) => any;
|
|
118
|
+
}>;
|
|
119
|
+
type __VLS_WithSlots$3<T, S> = T & {
|
|
120
|
+
new (): {
|
|
121
|
+
$slots: S;
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
//#endregion
|
|
125
|
+
//#region src/components/accordion/accordion-item.vue.d.ts
|
|
126
|
+
interface AccordionItemBaseProps extends ItemProps, PolymorphicProps {}
|
|
127
|
+
interface AccordionItemProps extends AccordionItemBaseProps,
|
|
128
|
+
/**
|
|
129
|
+
* @vue-ignore
|
|
130
|
+
*/
|
|
131
|
+
HTMLAttributes {}
|
|
132
|
+
declare const _default$1: typeof __VLS_export$2;
|
|
133
|
+
declare const __VLS_export$2: __VLS_WithSlots$2<vue954.DefineComponent<AccordionItemProps, {}, {}, {}, {}, vue954.ComponentOptionsMixin, vue954.ComponentOptionsMixin, {}, string, vue954.PublicProps, Readonly<AccordionItemProps> & Readonly<{}>, {}, {}, {}, {}, string, vue954.ComponentProvideOptions, false, {}, any>, {
|
|
134
|
+
default?: (props: {}) => any;
|
|
135
|
+
}>;
|
|
136
|
+
type __VLS_WithSlots$2<T, S> = T & {
|
|
137
|
+
new (): {
|
|
138
|
+
$slots: S;
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
//#endregion
|
|
142
|
+
//#region src/components/accordion/accordion-root-provider.vue.d.ts
|
|
143
|
+
interface RootProviderProps {
|
|
144
|
+
value: UnwrapRef<UseAccordionReturn>;
|
|
145
|
+
}
|
|
146
|
+
interface AccordionRootProviderBaseProps extends RootProviderProps, RenderStrategyProps, PolymorphicProps {}
|
|
147
|
+
interface AccordionRootProviderProps extends AccordionRootProviderBaseProps,
|
|
148
|
+
/**
|
|
149
|
+
* @vue-ignore
|
|
150
|
+
*/
|
|
151
|
+
HTMLAttributes {}
|
|
152
|
+
declare const _default$7: typeof __VLS_export$1;
|
|
153
|
+
declare const __VLS_export$1: __VLS_WithSlots$1<vue954.DefineComponent<AccordionRootProviderProps, {}, {}, {}, {}, vue954.ComponentOptionsMixin, vue954.ComponentOptionsMixin, {}, string, vue954.PublicProps, Readonly<AccordionRootProviderProps> & Readonly<{}>, {}, {}, {}, {}, string, vue954.ComponentProvideOptions, false, {}, any>, {
|
|
154
|
+
default?: (props: {}) => any;
|
|
155
|
+
}>;
|
|
156
|
+
type __VLS_WithSlots$1<T, S> = T & {
|
|
157
|
+
new (): {
|
|
158
|
+
$slots: S;
|
|
159
|
+
};
|
|
160
|
+
};
|
|
161
|
+
//#endregion
|
|
162
|
+
//#region src/components/accordion/accordion-root.vue.d.ts
|
|
163
|
+
interface AccordionRootBaseProps extends RootProps, RenderStrategyProps, PolymorphicProps {}
|
|
164
|
+
interface AccordionRootProps extends AccordionRootBaseProps,
|
|
165
|
+
/**
|
|
166
|
+
* @vue-ignore
|
|
167
|
+
*/
|
|
168
|
+
HTMLAttributes {}
|
|
169
|
+
interface AccordionRootEmits extends RootEmits {}
|
|
170
|
+
declare const _default$6: typeof __VLS_export;
|
|
171
|
+
declare const __VLS_export: __VLS_WithSlots<vue954.DefineComponent<AccordionRootProps, {}, {}, {}, {}, vue954.ComponentOptionsMixin, vue954.ComponentOptionsMixin, {
|
|
172
|
+
"update:modelValue": (value: string[]) => any;
|
|
173
|
+
valueChange: (details: accordion.ValueChangeDetails) => any;
|
|
174
|
+
focusChange: (details: accordion.FocusChangeDetails) => any;
|
|
175
|
+
}, string, vue954.PublicProps, Readonly<AccordionRootProps> & Readonly<{
|
|
176
|
+
"onUpdate:modelValue"?: ((value: string[]) => any) | undefined;
|
|
177
|
+
onValueChange?: ((details: accordion.ValueChangeDetails) => any) | undefined;
|
|
178
|
+
onFocusChange?: ((details: accordion.FocusChangeDetails) => any) | undefined;
|
|
179
|
+
}>, {
|
|
180
|
+
disabled: boolean;
|
|
181
|
+
multiple: boolean;
|
|
182
|
+
collapsible: boolean;
|
|
183
|
+
}, {}, {}, {}, string, vue954.ComponentProvideOptions, false, {}, any>, {
|
|
184
|
+
default?: (props: {}) => any;
|
|
185
|
+
}>;
|
|
186
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
187
|
+
new (): {
|
|
188
|
+
$slots: S;
|
|
189
|
+
};
|
|
190
|
+
};
|
|
191
|
+
declare namespace accordion_d_exports {
|
|
192
|
+
export { _default as Context, AccordionContextProps as ContextProps, FocusChangeDetails, _default$1 as Item, AccordionItemBaseProps as ItemBaseProps, _default$2 as ItemContent, AccordionItemContentBaseProps as ItemContentBaseProps, AccordionItemContentProps as ItemContentProps, _default$3 as ItemContext, AccordionItemContextProps as ItemContextProps, _default$4 as ItemIndicator, AccordionItemIndicatorBaseProps as ItemIndicatorBaseProps, AccordionItemIndicatorProps as ItemIndicatorProps, AccordionItemProps as ItemProps, _default$5 as ItemTrigger, AccordionItemTriggerBaseProps as ItemTriggerBaseProps, AccordionItemTriggerProps as ItemTriggerProps, _default$6 as Root, AccordionRootBaseProps as RootBaseProps, AccordionRootEmits as RootEmits, AccordionRootProps as RootProps, _default$7 as RootProvider, AccordionRootProviderBaseProps as RootProviderBaseProps, AccordionRootProviderProps as RootProviderProps, ValueChangeDetails };
|
|
193
|
+
}
|
|
194
|
+
//#endregion
|
|
195
|
+
export { accordion_d_exports as Accordion, _default as AccordionContext, type AccordionContextProps, type AccordionFocusChangeDetails, _default$1 as AccordionItem, type AccordionItemBaseProps, _default$2 as AccordionItemContent, type AccordionItemContentBaseProps, type AccordionItemContentProps, _default$3 as AccordionItemContext, type AccordionItemContextProps, _default$4 as AccordionItemIndicator, type AccordionItemIndicatorBaseProps, type AccordionItemIndicatorProps, type AccordionItemProps, _default$5 as AccordionItemTrigger, type AccordionItemTriggerBaseProps, type AccordionItemTriggerProps, _default$6 as AccordionRoot, type AccordionRootBaseProps, type AccordionRootEmits, type AccordionRootProps, _default$7 as AccordionRootProvider, type AccordionRootProviderBaseProps, type AccordionRootProviderProps, type AccordionValueChangeDetails, type UseAccordionContext, type UseAccordionItemContext, type UseAccordionProps, type UseAccordionReturn, accordionAnatomy, useAccordion, useAccordionContext, useAccordionItemContext };
|