@ui-sdk/vue 0.0.0-stage → 0.1.0-beta.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/LICENSE +202 -0
- package/README.md +10 -2
- package/dist/accordion.d.ts +561 -0
- package/dist/accordion.js +24 -0
- package/dist/agent.d.ts +2 -0
- package/dist/agent.js +7 -0
- package/dist/alert-dialog.d.ts +231 -0
- package/dist/alert-dialog.js +33 -0
- package/dist/async-options.d.ts +18 -0
- package/dist/async-options.js +40 -0
- package/dist/autocomplete.d.ts +384 -0
- package/dist/autocomplete.js +344 -0
- package/dist/avatar.d.ts +40 -0
- package/dist/avatar.js +28 -0
- package/dist/button.d.ts +52 -0
- package/dist/button.js +43 -0
- package/dist/calendar-context.d.ts +10 -0
- package/dist/calendar-context.js +7 -0
- package/dist/calendar.d.ts +311 -0
- package/dist/calendar.js +349 -0
- package/dist/carousel.d.ts +236 -0
- package/dist/carousel.js +204 -0
- package/dist/checkbox.d.ts +211 -0
- package/dist/checkbox.js +151 -0
- package/dist/children.d.ts +41 -0
- package/dist/children.js +135 -0
- package/dist/collapsible.d.ts +54 -0
- package/dist/collapsible.js +18 -0
- package/dist/color-picker.d.ts +187 -0
- package/dist/color-picker.js +158 -0
- package/dist/color.d.ts +2 -0
- package/dist/color.js +21 -0
- package/dist/combobox.d.ts +517 -0
- package/dist/combobox.js +531 -0
- package/dist/command.d.ts +322 -0
- package/dist/command.js +345 -0
- package/dist/controller-target.d.ts +49 -0
- package/dist/controller-target.js +112 -0
- package/dist/create-parts.d.ts +126 -0
- package/dist/create-parts.js +206 -0
- package/dist/date-input.d.ts +133 -0
- package/dist/date-input.js +31 -0
- package/dist/date-picker.d.ts +328 -0
- package/dist/date-picker.js +354 -0
- package/dist/date.d.ts +2 -0
- package/dist/date.js +59 -0
- package/dist/dialog-parts.d.ts +259 -0
- package/dist/dialog-parts.js +300 -0
- package/dist/dialog.d.ts +251 -0
- package/dist/dialog.js +25 -0
- package/dist/drawer.d.ts +304 -0
- package/dist/drawer.js +373 -0
- package/dist/editor-context.d.ts +4 -0
- package/dist/editor-context.js +5 -0
- package/dist/field-context.d.ts +26 -0
- package/dist/field-context.js +44 -0
- package/dist/field.d.ts +154 -0
- package/dist/field.js +240 -0
- package/dist/file-input.d.ts +212 -0
- package/dist/file-input.js +255 -0
- package/dist/form-inputs.d.ts +16 -0
- package/dist/form-inputs.js +25 -0
- package/dist/gesture.d.ts +1 -0
- package/dist/gesture.js +15 -0
- package/dist/history.d.ts +2 -0
- package/dist/history.js +11 -0
- package/dist/hover-card.d.ts +137 -0
- package/dist/hover-card.js +153 -0
- package/dist/image-cropper.d.ts +74 -0
- package/dist/image-cropper.js +36 -0
- package/dist/image.d.ts +2 -0
- package/dist/image.js +5 -0
- package/dist/index.d.ts +59 -0
- package/dist/index.js +60 -0
- package/dist/input.d.ts +120 -0
- package/dist/input.js +73 -0
- package/dist/item-icon.d.ts +34 -0
- package/dist/item-icon.js +63 -0
- package/dist/label.d.ts +16 -0
- package/dist/label.js +8 -0
- package/dist/lifecycle.d.ts +11 -0
- package/dist/lifecycle.js +91 -0
- package/dist/list-items.d.ts +38 -0
- package/dist/list-items.js +59 -0
- package/dist/list-text.d.ts +7 -0
- package/dist/list-text.js +15 -0
- package/dist/listbox.d.ts +273 -0
- package/dist/listbox.js +126 -0
- package/dist/menu.d.ts +678 -0
- package/dist/menu.js +607 -0
- package/dist/menubar-context.d.ts +5 -0
- package/dist/menubar-context.js +5 -0
- package/dist/menubar.d.ts +61 -0
- package/dist/menubar.js +48 -0
- package/dist/meter.d.ts +41 -0
- package/dist/meter.js +37 -0
- package/dist/navigation-menu.d.ts +228 -0
- package/dist/navigation-menu.js +195 -0
- package/dist/number-input.d.ts +176 -0
- package/dist/number-input.js +231 -0
- package/dist/number.d.ts +2 -0
- package/dist/number.js +39 -0
- package/dist/nuxt/entries.json +977 -0
- package/dist/nuxt/module.d.ts +18 -0
- package/dist/nuxt/module.js +31 -0
- package/dist/nuxt/registrations.d.ts +22 -0
- package/dist/nuxt/registrations.js +22 -0
- package/dist/observe.d.ts +2 -0
- package/dist/observe.js +7 -0
- package/dist/otp-input.d.ts +142 -0
- package/dist/otp-input.js +130 -0
- package/dist/overlays.d.ts +40 -0
- package/dist/overlays.js +118 -0
- package/dist/pagination.d.ts +201 -0
- package/dist/pagination.js +146 -0
- package/dist/password-input.d.ts +144 -0
- package/dist/password-input.js +134 -0
- package/dist/popover.d.ts +211 -0
- package/dist/popover.js +258 -0
- package/dist/popup.d.ts +60 -0
- package/dist/popup.js +89 -0
- package/dist/preferences.d.ts +44 -0
- package/dist/preferences.js +102 -0
- package/dist/primitive.d.ts +2 -0
- package/dist/primitive.js +11 -0
- package/dist/progress.d.ts +41 -0
- package/dist/progress.js +37 -0
- package/dist/radio.d.ts +164 -0
- package/dist/radio.js +145 -0
- package/dist/rating.d.ts +149 -0
- package/dist/rating.js +146 -0
- package/dist/renderless.d.ts +4 -0
- package/dist/renderless.js +28 -0
- package/dist/resizable.d.ts +54 -0
- package/dist/resizable.js +22 -0
- package/dist/scroll-area.d.ts +72 -0
- package/dist/scroll-area.js +77 -0
- package/dist/segmented-control.d.ts +151 -0
- package/dist/segmented-control.js +110 -0
- package/dist/segmented-input.d.ts +76 -0
- package/dist/segmented-input.js +115 -0
- package/dist/select.d.ts +458 -0
- package/dist/select.js +468 -0
- package/dist/separator.d.ts +14 -0
- package/dist/separator.js +8 -0
- package/dist/shortcuts.d.ts +32 -0
- package/dist/shortcuts.js +56 -0
- package/dist/slider.d.ts +65 -0
- package/dist/slider.js +194 -0
- package/dist/switch.d.ts +103 -0
- package/dist/switch.js +71 -0
- package/dist/tabs.d.ts +338 -0
- package/dist/tabs.js +27 -0
- package/dist/text-control.d.ts +89 -0
- package/dist/text-control.js +51 -0
- package/dist/text-match.d.ts +2 -0
- package/dist/text-match.js +7 -0
- package/dist/textarea.d.ts +106 -0
- package/dist/textarea.js +68 -0
- package/dist/time-input.d.ts +131 -0
- package/dist/time-input.js +32 -0
- package/dist/timeline.d.ts +81 -0
- package/dist/timeline.js +30 -0
- package/dist/toast-parts.d.ts +203 -0
- package/dist/toast-parts.js +270 -0
- package/dist/toast.d.ts +2 -0
- package/dist/toast.js +21 -0
- package/dist/toggle-props.d.ts +22 -0
- package/dist/toggle-props.js +14 -0
- package/dist/toggle.d.ts +199 -0
- package/dist/toggle.js +129 -0
- package/dist/token-input.d.ts +136 -0
- package/dist/token-input.js +214 -0
- package/dist/toolbar-context.d.ts +7 -0
- package/dist/toolbar-context.js +20 -0
- package/dist/toolbar.d.ts +120 -0
- package/dist/toolbar.js +77 -0
- package/dist/tooltip.d.ts +160 -0
- package/dist/tooltip.js +224 -0
- package/dist/tree.d.ts +300 -0
- package/dist/tree.js +209 -0
- package/dist/trigger-menu.d.ts +452 -0
- package/dist/trigger-menu.js +254 -0
- package/dist/use-primitive.d.ts +132 -0
- package/dist/use-primitive.js +462 -0
- package/dist/waterfall.d.ts +201 -0
- package/dist/waterfall.js +171 -0
- package/docs/README.md +89 -0
- package/docs/agents.md +1523 -0
- package/docs/components/accordion.md +1369 -0
- package/docs/components/alert-dialog.md +799 -0
- package/docs/components/autocomplete.md +1857 -0
- package/docs/components/avatar.md +272 -0
- package/docs/components/button.md +435 -0
- package/docs/components/calendar.md +1589 -0
- package/docs/components/carousel.md +1171 -0
- package/docs/components/checkbox.md +1008 -0
- package/docs/components/collapsible.md +536 -0
- package/docs/components/color-picker.md +706 -0
- package/docs/components/combobox.md +3504 -0
- package/docs/components/command.md +1481 -0
- package/docs/components/date-input.md +536 -0
- package/docs/components/date-picker.md +1244 -0
- package/docs/components/dialog.md +1397 -0
- package/docs/components/drawer.md +1166 -0
- package/docs/components/field.md +538 -0
- package/docs/components/file-input.md +611 -0
- package/docs/components/hover-card.md +505 -0
- package/docs/components/image-cropper.md +556 -0
- package/docs/components/input.md +306 -0
- package/docs/components/label.md +203 -0
- package/docs/components/listbox.md +1004 -0
- package/docs/components/menu.md +1229 -0
- package/docs/components/menubar.md +443 -0
- package/docs/components/meter.md +315 -0
- package/docs/components/navigation-menu.md +1523 -0
- package/docs/components/number-input.md +1029 -0
- package/docs/components/otp-input.md +512 -0
- package/docs/components/pagination.md +613 -0
- package/docs/components/password-input.md +649 -0
- package/docs/components/popover.md +1448 -0
- package/docs/components/preferences.md +208 -0
- package/docs/components/progress.md +423 -0
- package/docs/components/radio.md +785 -0
- package/docs/components/rating.md +416 -0
- package/docs/components/resizable.md +910 -0
- package/docs/components/scroll-area.md +915 -0
- package/docs/components/segmented-control.md +435 -0
- package/docs/components/select.md +2015 -0
- package/docs/components/separator.md +229 -0
- package/docs/components/slider.md +1084 -0
- package/docs/components/switch.md +565 -0
- package/docs/components/tabs.md +944 -0
- package/docs/components/textarea.md +299 -0
- package/docs/components/time-input.md +224 -0
- package/docs/components/timeline.md +654 -0
- package/docs/components/toast.md +1224 -0
- package/docs/components/toggle.md +500 -0
- package/docs/components/token-input.md +953 -0
- package/docs/components/toolbar.md +739 -0
- package/docs/components/tooltip.md +818 -0
- package/docs/components/tree.md +1306 -0
- package/docs/components/trigger-menu.md +1223 -0
- package/docs/components/waterfall.md +717 -0
- package/docs/controllers.md +71 -0
- package/docs/core.md +8027 -0
- package/docs/custom-parts.md +89 -0
- package/docs/first-component.md +83 -0
- package/docs/forms.md +122 -0
- package/docs/installation.md +72 -0
- package/docs/introduction.md +32 -0
- package/docs/lists-and-menus.md +122 -0
- package/docs/llms.txt +1502 -0
- package/docs/parts-and-composition.md +85 -0
- package/docs/popups.md +108 -0
- package/docs/rendering.md +56 -0
- package/docs/server-rendering.md +180 -0
- package/docs/state-and-events.md +100 -0
- package/docs/styling-and-animation.md +148 -0
- package/docs/utilities/async-options.md +348 -0
- package/docs/utilities/shortcuts.md +159 -0
- package/package.json +352 -3
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
// src/autocomplete.ts
|
|
2
|
+
import {
|
|
3
|
+
autocomplete as autocompletePrimitive
|
|
4
|
+
} from "@ui-sdk/core/autocomplete";
|
|
5
|
+
import {
|
|
6
|
+
defineComponent,
|
|
7
|
+
h,
|
|
8
|
+
inject,
|
|
9
|
+
provide
|
|
10
|
+
} from "vue";
|
|
11
|
+
import {
|
|
12
|
+
hasChild,
|
|
13
|
+
NotPlaced,
|
|
14
|
+
slotContent,
|
|
15
|
+
usePlaceContent,
|
|
16
|
+
usePlacedContent
|
|
17
|
+
} from "./children.js";
|
|
18
|
+
import { useFieldControl } from "./field-context.js";
|
|
19
|
+
import { markSegments, slotText } from "./list-text.js";
|
|
20
|
+
import {
|
|
21
|
+
containerProp,
|
|
22
|
+
provideSheetHeader,
|
|
23
|
+
renderPopup,
|
|
24
|
+
sheetViewport,
|
|
25
|
+
useControllerEntry,
|
|
26
|
+
useInSheetHeader,
|
|
27
|
+
useSheetHeader
|
|
28
|
+
} from "./popup.js";
|
|
29
|
+
import { ListItems } from "./list-items.js";
|
|
30
|
+
import { createParts, withElement } from "./create-parts.js";
|
|
31
|
+
import {
|
|
32
|
+
defaultSlot,
|
|
33
|
+
optionalBoolean,
|
|
34
|
+
orModel,
|
|
35
|
+
useHandle,
|
|
36
|
+
usePart,
|
|
37
|
+
usePrimitive,
|
|
38
|
+
useScope
|
|
39
|
+
} from "./use-primitive.js";
|
|
40
|
+
import { renderless } from "./renderless.js";
|
|
41
|
+
import { readOnlyOf } from "./text-control.js";
|
|
42
|
+
import { createAutocompleteController } from "@ui-sdk/core/autocomplete";
|
|
43
|
+
var ContainerKey = /* @__PURE__ */ Symbol(
|
|
44
|
+
"autocomplete-container"
|
|
45
|
+
);
|
|
46
|
+
var useAutocomplete = () => useHandle(autocompletePrimitive);
|
|
47
|
+
var parts = createParts(autocompletePrimitive, {
|
|
48
|
+
label: "label",
|
|
49
|
+
trigger: "button",
|
|
50
|
+
clear: "button",
|
|
51
|
+
item: "div",
|
|
52
|
+
"item-icon": "span",
|
|
53
|
+
group: "div",
|
|
54
|
+
"group-label": "div",
|
|
55
|
+
separator: "div",
|
|
56
|
+
status: "div",
|
|
57
|
+
arrow: "div"
|
|
58
|
+
});
|
|
59
|
+
var Autocomplete = /* @__PURE__ */ renderless(
|
|
60
|
+
defineComponent({
|
|
61
|
+
name: "Autocomplete",
|
|
62
|
+
props: {
|
|
63
|
+
value: { type: String, default: void 0 },
|
|
64
|
+
modelValue: { type: String, default: void 0 },
|
|
65
|
+
defaultValue: { type: String, default: void 0 },
|
|
66
|
+
open: optionalBoolean,
|
|
67
|
+
defaultOpen: optionalBoolean,
|
|
68
|
+
items: Array,
|
|
69
|
+
emptyItems: Array,
|
|
70
|
+
announcement: Function,
|
|
71
|
+
filter: {
|
|
72
|
+
type: [String, Boolean, Function],
|
|
73
|
+
default: void 0
|
|
74
|
+
},
|
|
75
|
+
inlineComplete: optionalBoolean,
|
|
76
|
+
autoHighlight: optionalBoolean,
|
|
77
|
+
openOnFocus: optionalBoolean,
|
|
78
|
+
submitOnSelect: optionalBoolean,
|
|
79
|
+
status: String,
|
|
80
|
+
loop: optionalBoolean,
|
|
81
|
+
modal: {
|
|
82
|
+
type: [Boolean, String],
|
|
83
|
+
default: void 0
|
|
84
|
+
},
|
|
85
|
+
presentation: String,
|
|
86
|
+
disabled: optionalBoolean,
|
|
87
|
+
readOnly: optionalBoolean,
|
|
88
|
+
required: optionalBoolean,
|
|
89
|
+
name: String,
|
|
90
|
+
form: String,
|
|
91
|
+
controller: Object,
|
|
92
|
+
dismissible: optionalBoolean,
|
|
93
|
+
debug: optionalBoolean,
|
|
94
|
+
container: containerProp
|
|
95
|
+
},
|
|
96
|
+
emits: {
|
|
97
|
+
"update:value": (_value) => true,
|
|
98
|
+
"update:modelValue": (_value) => true,
|
|
99
|
+
valueChange: (_value, _details) => true,
|
|
100
|
+
"update:open": (_open) => true,
|
|
101
|
+
openChange: (_open, _details) => true,
|
|
102
|
+
openChangeComplete: (_open) => true,
|
|
103
|
+
dismissAttempt: (_details) => true,
|
|
104
|
+
submit: (_value, _details) => true,
|
|
105
|
+
highlight: (_value, _details) => true,
|
|
106
|
+
loadMore: () => true
|
|
107
|
+
},
|
|
108
|
+
setup(props, { slots, attrs, emit }) {
|
|
109
|
+
const field = useFieldControl();
|
|
110
|
+
provide(ContainerKey, () => props.container);
|
|
111
|
+
const autocomplete = usePrimitive(autocompletePrimitive, () => ({
|
|
112
|
+
...props,
|
|
113
|
+
value: orModel(props.value, props.modelValue),
|
|
114
|
+
container: void 0,
|
|
115
|
+
name: props.name ?? field?.name(),
|
|
116
|
+
disabled: props.disabled || field?.disabled(),
|
|
117
|
+
readOnly: readOnlyOf(props, attrs),
|
|
118
|
+
onValueChange: (value, details) => {
|
|
119
|
+
emit("valueChange", value, details);
|
|
120
|
+
if (details.canceled) {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
emit("update:value", value);
|
|
124
|
+
emit("update:modelValue", value);
|
|
125
|
+
},
|
|
126
|
+
onOpenChange: (open, details) => {
|
|
127
|
+
emit("openChange", open, details);
|
|
128
|
+
if (!details.canceled) {
|
|
129
|
+
emit("update:open", open);
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
onOpenChangeComplete: (open) => emit("openChangeComplete", open),
|
|
133
|
+
onDismissAttempt: (details) => emit("dismissAttempt", details),
|
|
134
|
+
onSubmit: (value, details) => emit("submit", value, details),
|
|
135
|
+
onHighlight: (value, details) => emit("highlight", value, details),
|
|
136
|
+
onLoadMore: () => emit("loadMore")
|
|
137
|
+
}));
|
|
138
|
+
useControllerEntry(() => props.controller, autocomplete);
|
|
139
|
+
provideSheetHeader();
|
|
140
|
+
const placed = usePlacedContent();
|
|
141
|
+
return () => {
|
|
142
|
+
const children = slots.default?.() ?? [];
|
|
143
|
+
const own = !props.items || placed() || hasChild(children, AutocompleteContent);
|
|
144
|
+
return [
|
|
145
|
+
children,
|
|
146
|
+
props.items && !own && h(NotPlaced, () => h(AutocompleteContent))
|
|
147
|
+
];
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
})
|
|
151
|
+
);
|
|
152
|
+
var AutocompleteLabel = parts.Label;
|
|
153
|
+
var AutocompleteSeparator = parts.Separator;
|
|
154
|
+
var AutocompleteInput = withElement(
|
|
155
|
+
"input",
|
|
156
|
+
defineComponent({
|
|
157
|
+
name: "AutocompleteInput",
|
|
158
|
+
inheritAttrs: false,
|
|
159
|
+
slots: Object,
|
|
160
|
+
setup(_, { attrs }) {
|
|
161
|
+
const field = useFieldControl(attrs);
|
|
162
|
+
const inHeader = useInSheetHeader();
|
|
163
|
+
const part = usePart(
|
|
164
|
+
autocompletePrimitive,
|
|
165
|
+
"input",
|
|
166
|
+
void 0,
|
|
167
|
+
void 0,
|
|
168
|
+
{
|
|
169
|
+
tag: "input",
|
|
170
|
+
extend: field?.props
|
|
171
|
+
}
|
|
172
|
+
);
|
|
173
|
+
return () => {
|
|
174
|
+
const element = part();
|
|
175
|
+
return element && inHeader(element);
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
})
|
|
179
|
+
);
|
|
180
|
+
var AutocompleteTrigger = parts.Trigger;
|
|
181
|
+
var AutocompleteClear = parts.Clear;
|
|
182
|
+
var AutocompleteContent = withElement(
|
|
183
|
+
"div",
|
|
184
|
+
defineComponent({
|
|
185
|
+
name: "AutocompleteContent",
|
|
186
|
+
inheritAttrs: false,
|
|
187
|
+
props: {
|
|
188
|
+
side: String,
|
|
189
|
+
align: String,
|
|
190
|
+
sideOffset: Number,
|
|
191
|
+
alignOffset: Number,
|
|
192
|
+
collisionPadding: Number,
|
|
193
|
+
arrowPadding: Number,
|
|
194
|
+
anchor: [Object, String],
|
|
195
|
+
keepMounted: optionalBoolean,
|
|
196
|
+
container: containerProp
|
|
197
|
+
},
|
|
198
|
+
slots: Object,
|
|
199
|
+
setup(props, { slots }) {
|
|
200
|
+
usePlaceContent();
|
|
201
|
+
const autocomplete = useAutocomplete();
|
|
202
|
+
const inherited = inject(ContainerKey, () => void 0);
|
|
203
|
+
const content = () => {
|
|
204
|
+
const { container, ...content2 } = props;
|
|
205
|
+
return content2;
|
|
206
|
+
};
|
|
207
|
+
const header = useSheetHeader(autocomplete);
|
|
208
|
+
const part = usePart(autocomplete, "content", content, void 0, {
|
|
209
|
+
tag: "div",
|
|
210
|
+
children: (state) => [
|
|
211
|
+
header(),
|
|
212
|
+
defaultSlot(
|
|
213
|
+
slots,
|
|
214
|
+
state,
|
|
215
|
+
() => autocomplete.state.items && h(AutocompleteList)
|
|
216
|
+
)
|
|
217
|
+
]
|
|
218
|
+
});
|
|
219
|
+
return () => {
|
|
220
|
+
const element = part();
|
|
221
|
+
if (!element) {
|
|
222
|
+
return null;
|
|
223
|
+
}
|
|
224
|
+
return renderPopup(
|
|
225
|
+
sheetViewport(autocomplete, element),
|
|
226
|
+
props.container ?? inherited()
|
|
227
|
+
);
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
})
|
|
231
|
+
);
|
|
232
|
+
var AutocompleteList = withElement(
|
|
233
|
+
"div",
|
|
234
|
+
defineComponent({
|
|
235
|
+
name: "AutocompleteList",
|
|
236
|
+
inheritAttrs: false,
|
|
237
|
+
slots: Object,
|
|
238
|
+
setup(_, { slots }) {
|
|
239
|
+
const autocomplete = useAutocomplete();
|
|
240
|
+
return usePart(autocomplete, "list", void 0, void 0, {
|
|
241
|
+
tag: "div",
|
|
242
|
+
children: (state) => defaultSlot(
|
|
243
|
+
slots,
|
|
244
|
+
state,
|
|
245
|
+
() => autocomplete.state.items && h(AutocompleteItems, { items: state.items })
|
|
246
|
+
)
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
})
|
|
250
|
+
);
|
|
251
|
+
var AutocompleteItem = parts.Item;
|
|
252
|
+
var AutocompleteItemText = withElement(
|
|
253
|
+
"span",
|
|
254
|
+
defineComponent({
|
|
255
|
+
name: "AutocompleteItemText",
|
|
256
|
+
inheritAttrs: false,
|
|
257
|
+
slots: Object,
|
|
258
|
+
setup(_, { slots }) {
|
|
259
|
+
const item = useScope(autocompletePrimitive)?.around.item;
|
|
260
|
+
if (!item) {
|
|
261
|
+
throw new Error(
|
|
262
|
+
"<AutocompleteItemText> must be used inside <AutocompleteItem>."
|
|
263
|
+
);
|
|
264
|
+
}
|
|
265
|
+
let text = "";
|
|
266
|
+
let own;
|
|
267
|
+
let ownText;
|
|
268
|
+
const part = usePart(
|
|
269
|
+
autocompletePrimitive,
|
|
270
|
+
"item-text",
|
|
271
|
+
() => ({ id: item().value, text }),
|
|
272
|
+
void 0,
|
|
273
|
+
{
|
|
274
|
+
tag: "span",
|
|
275
|
+
children: (state) => own && ownText === void 0 ? own : markSegments(state.segments)
|
|
276
|
+
}
|
|
277
|
+
);
|
|
278
|
+
return () => {
|
|
279
|
+
own = slotContent(slots.default, { state: part.state });
|
|
280
|
+
ownText = slotText(own);
|
|
281
|
+
text = ownText ?? item().label ?? item().value;
|
|
282
|
+
return part();
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
})
|
|
286
|
+
);
|
|
287
|
+
var AutocompleteItemIcon = parts.ItemIcon;
|
|
288
|
+
var AutocompleteGroup = parts.Group;
|
|
289
|
+
var AutocompleteGroupLabel = parts.GroupLabel;
|
|
290
|
+
var AutocompleteEmpty = withElement(
|
|
291
|
+
"div",
|
|
292
|
+
defineComponent({
|
|
293
|
+
name: "AutocompleteEmpty",
|
|
294
|
+
inheritAttrs: false,
|
|
295
|
+
slots: Object,
|
|
296
|
+
setup(_, { slots }) {
|
|
297
|
+
return usePart(autocompletePrimitive, "empty", void 0, void 0, {
|
|
298
|
+
tag: "div",
|
|
299
|
+
children: (state) => state.empty ? slots.default?.({ state }) : null
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
})
|
|
303
|
+
);
|
|
304
|
+
var AutocompleteStatus = parts.Status;
|
|
305
|
+
var AutocompleteArrow = parts.Arrow;
|
|
306
|
+
var AutocompleteItems = defineComponent({
|
|
307
|
+
name: "AutocompleteItems",
|
|
308
|
+
props: {
|
|
309
|
+
items: { type: Array, required: true }
|
|
310
|
+
},
|
|
311
|
+
setup(props) {
|
|
312
|
+
return () => h(ListItems, {
|
|
313
|
+
items: props.items,
|
|
314
|
+
parts: listParts,
|
|
315
|
+
keyOf: String
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
});
|
|
319
|
+
var listParts = {
|
|
320
|
+
Item: AutocompleteItem,
|
|
321
|
+
Group: AutocompleteGroup,
|
|
322
|
+
GroupLabel: AutocompleteGroupLabel,
|
|
323
|
+
Separator: AutocompleteSeparator
|
|
324
|
+
};
|
|
325
|
+
export {
|
|
326
|
+
Autocomplete,
|
|
327
|
+
AutocompleteArrow,
|
|
328
|
+
AutocompleteClear,
|
|
329
|
+
AutocompleteContent,
|
|
330
|
+
AutocompleteEmpty,
|
|
331
|
+
AutocompleteGroup,
|
|
332
|
+
AutocompleteGroupLabel,
|
|
333
|
+
AutocompleteInput,
|
|
334
|
+
AutocompleteItem,
|
|
335
|
+
AutocompleteItemIcon,
|
|
336
|
+
AutocompleteItemText,
|
|
337
|
+
AutocompleteItems,
|
|
338
|
+
AutocompleteLabel,
|
|
339
|
+
AutocompleteList,
|
|
340
|
+
AutocompleteSeparator,
|
|
341
|
+
AutocompleteStatus,
|
|
342
|
+
AutocompleteTrigger,
|
|
343
|
+
createAutocompleteController
|
|
344
|
+
};
|
package/dist/avatar.d.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type PartSlots } from "./use-primitive.js";
|
|
2
|
+
/**
|
|
3
|
+
* The root: a box for the image and its fallback.
|
|
4
|
+
* @stable
|
|
5
|
+
*/
|
|
6
|
+
declare const Avatar: import("./create-parts.js").ElementPart<new (props: Omit<import("@ui-sdk/core").OptionsOf<import("@ui-sdk/core/avatar").AvatarPrimitive> & import("@ui-sdk/core/renderer").BaseSlotProps, "onLoadingStatusChange"> & {
|
|
7
|
+
onLoadingStatusChange?: ((status: import("@ui-sdk/core/avatar").AvatarLoadingStatus, details: import("@ui-sdk/core").ChangeDetails<import("@ui-sdk/core/avatar").AvatarLoadingStatusChangeReason>) => any) | undefined;
|
|
8
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps) => import("vue").CreateComponentPublicInstanceWithMixins<Omit<import("@ui-sdk/core").OptionsOf<import("@ui-sdk/core/avatar").AvatarPrimitive> & import("@ui-sdk/core/renderer").BaseSlotProps, "onLoadingStatusChange"> & {
|
|
9
|
+
onLoadingStatusChange?: ((status: import("@ui-sdk/core/avatar").AvatarLoadingStatus, details: import("@ui-sdk/core").ChangeDetails<import("@ui-sdk/core/avatar").AvatarLoadingStatusChangeReason>) => any) | undefined;
|
|
10
|
+
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
11
|
+
loadingStatusChange: (status: import("@ui-sdk/core/avatar").AvatarLoadingStatus, details: import("@ui-sdk/core").ChangeDetails<import("@ui-sdk/core/avatar").AvatarLoadingStatusChangeReason>) => true;
|
|
12
|
+
} & {}, import("vue").PublicProps, {}, false, {}, import("./use-primitive.js").StateSlots<NoInfer<import("@ui-sdk/core/avatar").AvatarState>>, {}, {}, string, {}, any, import("vue").ComponentProvideOptions, {
|
|
13
|
+
P: {};
|
|
14
|
+
B: {};
|
|
15
|
+
D: {};
|
|
16
|
+
C: {};
|
|
17
|
+
M: {};
|
|
18
|
+
Defaults: {};
|
|
19
|
+
}, Omit<import("@ui-sdk/core").OptionsOf<import("@ui-sdk/core/avatar").AvatarPrimitive> & import("@ui-sdk/core/renderer").BaseSlotProps, "onLoadingStatusChange"> & {
|
|
20
|
+
onLoadingStatusChange?: ((status: import("@ui-sdk/core/avatar").AvatarLoadingStatus, details: import("@ui-sdk/core").ChangeDetails<import("@ui-sdk/core/avatar").AvatarLoadingStatusChangeReason>) => any) | undefined;
|
|
21
|
+
}, {}, {}, {}, {}, {}>, "span">;
|
|
22
|
+
/**
|
|
23
|
+
* A real <img>, hidden until it loads. Every image attribute passes through,
|
|
24
|
+
* like `crossorigin`, `referrerpolicy`, `srcset` and `sizes`.
|
|
25
|
+
* @stable
|
|
26
|
+
*/
|
|
27
|
+
declare const AvatarImage: import("./create-parts.js").ElementPart<import("vue").DefineComponent<{}, (() => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
28
|
+
[key: string]: any;
|
|
29
|
+
}> | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
30
|
+
[key: string]: any;
|
|
31
|
+
}>[] | null) & {
|
|
32
|
+
state: NoInfer<import("@ui-sdk/core/avatar").AvatarState>;
|
|
33
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, PartSlots<import("@ui-sdk/core/avatar").AvatarPrimitive, "image">, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, "img">;
|
|
34
|
+
/**
|
|
35
|
+
* Shown while there's no loaded image, after its `delay`.
|
|
36
|
+
* @stable
|
|
37
|
+
*/
|
|
38
|
+
declare const AvatarFallback: Pick<import("vue").DefineSetupFnComponent<Omit<NoInfer<import("@ui-sdk/core/avatar").AvatarFallbackProps> & import("@ui-sdk/core/renderer").BaseSlotProps, never>, {} & {}, import("./use-primitive.js").StateSlots<NoInfer<import("@ui-sdk/core/avatar").AvatarState>>>, never> & import("./create-parts.js").ElementConstructor<import("vue").DefineSetupFnComponent<Omit<NoInfer<import("@ui-sdk/core/avatar").AvatarFallbackProps> & import("@ui-sdk/core/renderer").BaseSlotProps, never>, {} & {}, import("./use-primitive.js").StateSlots<NoInfer<import("@ui-sdk/core/avatar").AvatarState>>>, "span">;
|
|
39
|
+
export { Avatar, AvatarFallback, AvatarImage };
|
|
40
|
+
export type { AvatarFallbackProps, AvatarLoadingStatus, AvatarLoadingStatusChangeReason, AvatarOptions, AvatarPrimitive, AvatarState, } from "@ui-sdk/core/avatar";
|
package/dist/avatar.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// src/avatar.ts
|
|
2
|
+
import { avatar } from "@ui-sdk/core/avatar";
|
|
3
|
+
import { defineComponent } from "vue";
|
|
4
|
+
import { createParts, withElement } from "./create-parts.js";
|
|
5
|
+
import { usePart } from "./use-primitive.js";
|
|
6
|
+
var parts = createParts(avatar, { root: "span", fallback: "span" });
|
|
7
|
+
var Avatar = parts.Root;
|
|
8
|
+
var AvatarImage = withElement(
|
|
9
|
+
"img",
|
|
10
|
+
defineComponent({
|
|
11
|
+
name: "AvatarImage",
|
|
12
|
+
inheritAttrs: false,
|
|
13
|
+
slots: Object,
|
|
14
|
+
setup(_, { attrs }) {
|
|
15
|
+
const sourcesLast = () => {
|
|
16
|
+
const { src, srcset, ...rest } = attrs;
|
|
17
|
+
return { ...rest, srcset, src };
|
|
18
|
+
};
|
|
19
|
+
return usePart(avatar, "image", void 0, sourcesLast, "img");
|
|
20
|
+
}
|
|
21
|
+
})
|
|
22
|
+
);
|
|
23
|
+
var AvatarFallback = parts.Fallback;
|
|
24
|
+
export {
|
|
25
|
+
Avatar,
|
|
26
|
+
AvatarFallback,
|
|
27
|
+
AvatarImage
|
|
28
|
+
};
|
package/dist/button.d.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { type ButtonActionDetails } from "@ui-sdk/core/button";
|
|
2
|
+
import { type PropType } from "vue";
|
|
3
|
+
import { type PartSlots } from "./use-primitive.js";
|
|
4
|
+
/**
|
|
5
|
+
* A button, or a link or any element that acts as one through the `render` slot.
|
|
6
|
+
* @stable
|
|
7
|
+
*/
|
|
8
|
+
declare const Button: import("./create-parts.js").ElementPart<import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
9
|
+
disabled: {
|
|
10
|
+
type: BooleanConstructor;
|
|
11
|
+
default: undefined;
|
|
12
|
+
};
|
|
13
|
+
focusableWhenDisabled: {
|
|
14
|
+
type: BooleanConstructor;
|
|
15
|
+
default: undefined;
|
|
16
|
+
};
|
|
17
|
+
type: PropType<"button" | "submit" | "reset">;
|
|
18
|
+
pendingAnnouncement: StringConstructor;
|
|
19
|
+
debug: {
|
|
20
|
+
type: BooleanConstructor;
|
|
21
|
+
default: undefined;
|
|
22
|
+
};
|
|
23
|
+
onClick: PropType<(event: MouseEvent, details: ButtonActionDetails) => unknown>;
|
|
24
|
+
}>, (() => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
25
|
+
[key: string]: any;
|
|
26
|
+
}> | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
27
|
+
[key: string]: any;
|
|
28
|
+
}>[] | null) & {
|
|
29
|
+
state: NoInfer<import("@ui-sdk/core/button").ButtonState>;
|
|
30
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
31
|
+
disabled: {
|
|
32
|
+
type: BooleanConstructor;
|
|
33
|
+
default: undefined;
|
|
34
|
+
};
|
|
35
|
+
focusableWhenDisabled: {
|
|
36
|
+
type: BooleanConstructor;
|
|
37
|
+
default: undefined;
|
|
38
|
+
};
|
|
39
|
+
type: PropType<"button" | "submit" | "reset">;
|
|
40
|
+
pendingAnnouncement: StringConstructor;
|
|
41
|
+
debug: {
|
|
42
|
+
type: BooleanConstructor;
|
|
43
|
+
default: undefined;
|
|
44
|
+
};
|
|
45
|
+
onClick: PropType<(event: MouseEvent, details: ButtonActionDetails) => unknown>;
|
|
46
|
+
}>> & Readonly<{}>, {
|
|
47
|
+
disabled: boolean;
|
|
48
|
+
debug: boolean;
|
|
49
|
+
focusableWhenDisabled: boolean;
|
|
50
|
+
}, PartSlots<import("@ui-sdk/core/button").ButtonPrimitive, "root">, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, "button">;
|
|
51
|
+
export { Button };
|
|
52
|
+
export type { ButtonActionDetails, ButtonApi, ButtonOptions, ButtonPrimitive, ButtonState, } from "@ui-sdk/core/button";
|
package/dist/button.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// src/button.ts
|
|
2
|
+
import {
|
|
3
|
+
button as buttonPrimitive
|
|
4
|
+
} from "@ui-sdk/core/button";
|
|
5
|
+
import { defineComponent } from "vue";
|
|
6
|
+
import { withElement } from "./create-parts.js";
|
|
7
|
+
import {
|
|
8
|
+
optionalBoolean,
|
|
9
|
+
usePart,
|
|
10
|
+
usePrimitive
|
|
11
|
+
} from "./use-primitive.js";
|
|
12
|
+
var Button = withElement(
|
|
13
|
+
"button",
|
|
14
|
+
defineComponent({
|
|
15
|
+
name: "Button",
|
|
16
|
+
inheritAttrs: false,
|
|
17
|
+
props: {
|
|
18
|
+
disabled: optionalBoolean,
|
|
19
|
+
focusableWhenDisabled: optionalBoolean,
|
|
20
|
+
type: String,
|
|
21
|
+
pendingAnnouncement: String,
|
|
22
|
+
debug: optionalBoolean,
|
|
23
|
+
// `@click="save"` binds here, so the button gets the handler's Promise and
|
|
24
|
+
// stays pending until it settles.
|
|
25
|
+
onClick: Function
|
|
26
|
+
},
|
|
27
|
+
slots: Object,
|
|
28
|
+
setup(props) {
|
|
29
|
+
const button = usePrimitive(buttonPrimitive, () => ({
|
|
30
|
+
disabled: props.disabled,
|
|
31
|
+
focusableWhenDisabled: props.focusableWhenDisabled,
|
|
32
|
+
type: props.type,
|
|
33
|
+
pendingAnnouncement: props.pendingAnnouncement,
|
|
34
|
+
debug: props.debug,
|
|
35
|
+
action: (event, details) => props.onClick?.(event, details)
|
|
36
|
+
}));
|
|
37
|
+
return usePart(button, "root", void 0, void 0, "button");
|
|
38
|
+
}
|
|
39
|
+
})
|
|
40
|
+
);
|
|
41
|
+
export {
|
|
42
|
+
Button
|
|
43
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { calendar as calendarPrimitive, CalendarGridState } from "@ui-sdk/core/calendar";
|
|
2
|
+
import type { InjectionKey } from "vue";
|
|
3
|
+
import type { PrimitiveHandle } from "./use-primitive.js";
|
|
4
|
+
type CalendarHandle = PrimitiveHandle<typeof calendarPrimitive>;
|
|
5
|
+
declare const CalendarKey: InjectionKey<CalendarHandle>;
|
|
6
|
+
declare const GridKey: InjectionKey<{
|
|
7
|
+
offset: () => number;
|
|
8
|
+
state: CalendarGridState;
|
|
9
|
+
}>;
|
|
10
|
+
export { type CalendarHandle, CalendarKey, GridKey };
|