@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
package/dist/input.d.ts
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { type PartSlots } from "./use-primitive.js";
|
|
2
|
+
/**
|
|
3
|
+
* A native <input>, wired to the Field it's in.
|
|
4
|
+
* @stable
|
|
5
|
+
*/
|
|
6
|
+
declare const Input: import("./create-parts.js").ElementPart<import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
7
|
+
value: {
|
|
8
|
+
type: StringConstructor;
|
|
9
|
+
default: undefined;
|
|
10
|
+
};
|
|
11
|
+
modelValue: {
|
|
12
|
+
type: StringConstructor;
|
|
13
|
+
default: undefined;
|
|
14
|
+
};
|
|
15
|
+
defaultValue: {
|
|
16
|
+
type: StringConstructor;
|
|
17
|
+
default: undefined;
|
|
18
|
+
};
|
|
19
|
+
disabled: {
|
|
20
|
+
type: BooleanConstructor;
|
|
21
|
+
default: undefined;
|
|
22
|
+
};
|
|
23
|
+
readOnly: {
|
|
24
|
+
type: BooleanConstructor;
|
|
25
|
+
default: undefined;
|
|
26
|
+
};
|
|
27
|
+
required: {
|
|
28
|
+
type: BooleanConstructor;
|
|
29
|
+
default: undefined;
|
|
30
|
+
};
|
|
31
|
+
controller: import("vue").PropType<import("@ui-sdk/core/input").InputController>;
|
|
32
|
+
debug: {
|
|
33
|
+
type: BooleanConstructor;
|
|
34
|
+
default: undefined;
|
|
35
|
+
};
|
|
36
|
+
}>, (() => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
37
|
+
[key: string]: any;
|
|
38
|
+
}> | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
39
|
+
[key: string]: any;
|
|
40
|
+
}>[] | null) & {
|
|
41
|
+
state: NoInfer<import("@ui-sdk/core/input").InputState>;
|
|
42
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
43
|
+
"update:value": (_value: string) => boolean;
|
|
44
|
+
"update:modelValue": (_value: string) => boolean;
|
|
45
|
+
valueChange: (_value: string, _details: import("@ui-sdk/core").ChangeDetails<import("@ui-sdk/core/input").InputValueChangeReason>) => boolean;
|
|
46
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
47
|
+
value: {
|
|
48
|
+
type: StringConstructor;
|
|
49
|
+
default: undefined;
|
|
50
|
+
};
|
|
51
|
+
modelValue: {
|
|
52
|
+
type: StringConstructor;
|
|
53
|
+
default: undefined;
|
|
54
|
+
};
|
|
55
|
+
defaultValue: {
|
|
56
|
+
type: StringConstructor;
|
|
57
|
+
default: undefined;
|
|
58
|
+
};
|
|
59
|
+
disabled: {
|
|
60
|
+
type: BooleanConstructor;
|
|
61
|
+
default: undefined;
|
|
62
|
+
};
|
|
63
|
+
readOnly: {
|
|
64
|
+
type: BooleanConstructor;
|
|
65
|
+
default: undefined;
|
|
66
|
+
};
|
|
67
|
+
required: {
|
|
68
|
+
type: BooleanConstructor;
|
|
69
|
+
default: undefined;
|
|
70
|
+
};
|
|
71
|
+
controller: import("vue").PropType<import("@ui-sdk/core/input").InputController>;
|
|
72
|
+
debug: {
|
|
73
|
+
type: BooleanConstructor;
|
|
74
|
+
default: undefined;
|
|
75
|
+
};
|
|
76
|
+
}>> & Readonly<{
|
|
77
|
+
"onUpdate:modelValue"?: ((_value: string) => any) | undefined;
|
|
78
|
+
"onUpdate:value"?: ((_value: string) => any) | undefined;
|
|
79
|
+
onValueChange?: ((_value: string, _details: import("@ui-sdk/core").ChangeDetails<import("@ui-sdk/core/input").InputValueChangeReason>) => any) | undefined;
|
|
80
|
+
}>, {
|
|
81
|
+
value: string;
|
|
82
|
+
disabled: boolean;
|
|
83
|
+
debug: boolean;
|
|
84
|
+
defaultValue: string;
|
|
85
|
+
required: boolean;
|
|
86
|
+
readOnly: boolean;
|
|
87
|
+
modelValue: string;
|
|
88
|
+
}, PartSlots<import("@ui-sdk/core/input").InputPrimitive, "root">, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, "input">;
|
|
89
|
+
/**
|
|
90
|
+
* Holds an Input or Textarea with icons, text and buttons around it. Presses
|
|
91
|
+
* on its text and icons focus the field.
|
|
92
|
+
* @stable
|
|
93
|
+
*/
|
|
94
|
+
declare const InputGroup: import("./create-parts.js").ElementPart<import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
95
|
+
debug: {
|
|
96
|
+
type: BooleanConstructor;
|
|
97
|
+
default: undefined;
|
|
98
|
+
};
|
|
99
|
+
}>, (() => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
100
|
+
[key: string]: any;
|
|
101
|
+
}> | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
102
|
+
[key: string]: any;
|
|
103
|
+
}>[] | null) & {
|
|
104
|
+
state: NoInfer<import("@ui-sdk/core/input").InputGroupState>;
|
|
105
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
106
|
+
debug: {
|
|
107
|
+
type: BooleanConstructor;
|
|
108
|
+
default: undefined;
|
|
109
|
+
};
|
|
110
|
+
}>> & Readonly<{}>, {
|
|
111
|
+
debug: boolean;
|
|
112
|
+
}, PartSlots<import("@ui-sdk/core/input").InputGroupPrimitive, "group">, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, "div">;
|
|
113
|
+
/**
|
|
114
|
+
* Empties the field in its group and focuses it. Shown while there's text to clear.
|
|
115
|
+
* @stable
|
|
116
|
+
*/
|
|
117
|
+
declare const InputClear: Pick<import("vue").DefineSetupFnComponent<Omit<import("@ui-sdk/core/renderer").BaseSlotProps, never>, {} & {}, import("./use-primitive.js").StateSlots<NoInfer<import("@ui-sdk/core/input").InputGroupState>>>, never> & import("./create-parts.js").ElementConstructor<import("vue").DefineSetupFnComponent<Omit<import("@ui-sdk/core/renderer").BaseSlotProps, never>, {} & {}, import("./use-primitive.js").StateSlots<NoInfer<import("@ui-sdk/core/input").InputGroupState>>>, "button">;
|
|
118
|
+
export { createInputController } from "@ui-sdk/core/input";
|
|
119
|
+
export type { InputController, InputGroupOptions, InputGroupPrimitive, InputGroupState, InputOptions, InputPrimitive, InputProps, InputState, InputValueChangeReason, TextareaOptions, TextareaPrimitive, TextareaProps, TextareaState, TextareaSubmitDetails, } from "@ui-sdk/core/input";
|
|
120
|
+
export { Input, InputClear, InputGroup };
|
package/dist/input.js
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// src/input.ts
|
|
2
|
+
import {
|
|
3
|
+
input as inputPrimitive,
|
|
4
|
+
inputGroup as inputGroupPrimitive
|
|
5
|
+
} from "@ui-sdk/core/input";
|
|
6
|
+
import { defineComponent } from "vue";
|
|
7
|
+
import { useFieldControl } from "./field-context.js";
|
|
8
|
+
import {
|
|
9
|
+
elementProps,
|
|
10
|
+
readOnlyOf,
|
|
11
|
+
textEmits,
|
|
12
|
+
textOptions,
|
|
13
|
+
textProps
|
|
14
|
+
} from "./text-control.js";
|
|
15
|
+
import { createParts, withElement } from "./create-parts.js";
|
|
16
|
+
import {
|
|
17
|
+
optionalBoolean,
|
|
18
|
+
usePart,
|
|
19
|
+
usePrimitive
|
|
20
|
+
} from "./use-primitive.js";
|
|
21
|
+
import { createInputController } from "@ui-sdk/core/input";
|
|
22
|
+
var groupParts = createParts(inputGroupPrimitive, { clear: "button" });
|
|
23
|
+
var Input = withElement(
|
|
24
|
+
"input",
|
|
25
|
+
defineComponent({
|
|
26
|
+
name: "Input",
|
|
27
|
+
inheritAttrs: false,
|
|
28
|
+
props: textProps,
|
|
29
|
+
emits: textEmits,
|
|
30
|
+
slots: Object,
|
|
31
|
+
setup(props, { attrs, emit }) {
|
|
32
|
+
const field = useFieldControl();
|
|
33
|
+
const input = usePrimitive(inputPrimitive, textOptions(props, emit));
|
|
34
|
+
const part = () => ({
|
|
35
|
+
disabled: props.disabled || field?.disabled(),
|
|
36
|
+
readOnly: readOnlyOf(props, attrs),
|
|
37
|
+
required: props.required
|
|
38
|
+
});
|
|
39
|
+
return usePart(
|
|
40
|
+
input,
|
|
41
|
+
"root",
|
|
42
|
+
part,
|
|
43
|
+
() => elementProps(props, field, attrs, "input"),
|
|
44
|
+
{
|
|
45
|
+
tag: "input",
|
|
46
|
+
extend: field?.props
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
})
|
|
51
|
+
);
|
|
52
|
+
var InputGroup = withElement(
|
|
53
|
+
"div",
|
|
54
|
+
defineComponent({
|
|
55
|
+
name: "InputGroup",
|
|
56
|
+
inheritAttrs: false,
|
|
57
|
+
props: { debug: optionalBoolean },
|
|
58
|
+
slots: Object,
|
|
59
|
+
setup(props) {
|
|
60
|
+
const group = usePrimitive(inputGroupPrimitive, () => ({
|
|
61
|
+
debug: props.debug
|
|
62
|
+
}));
|
|
63
|
+
return usePart(group, "group");
|
|
64
|
+
}
|
|
65
|
+
})
|
|
66
|
+
);
|
|
67
|
+
var InputClear = groupParts.Clear;
|
|
68
|
+
export {
|
|
69
|
+
Input,
|
|
70
|
+
InputClear,
|
|
71
|
+
InputGroup,
|
|
72
|
+
createInputController
|
|
73
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Primitive, SlotName } from "@ui-sdk/core";
|
|
2
|
+
import type { Feature } from "@ui-sdk/core/renderer";
|
|
3
|
+
import { type PartSlots } from "./use-primitive.js";
|
|
4
|
+
/**
|
|
5
|
+
* An icon part of `primitive`'s `slot`, registering `feature`, which ships the
|
|
6
|
+
* part. Its item is the item part it's inside, for a list whose value shows
|
|
7
|
+
* the selected item's icon.
|
|
8
|
+
*/
|
|
9
|
+
declare function defineItemIcon<P extends Primitive, S extends SlotName<P>>(name: string, primitive: P, slot: S, feature: Feature): import("./create-parts.js").ElementPart<import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
10
|
+
mirror: {
|
|
11
|
+
type: BooleanConstructor;
|
|
12
|
+
default: undefined;
|
|
13
|
+
};
|
|
14
|
+
}>, (() => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
15
|
+
[key: string]: any;
|
|
16
|
+
}> | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
17
|
+
[key: string]: any;
|
|
18
|
+
}>[] | null) & {
|
|
19
|
+
state: import("@ui-sdk/core").TypesOf<P>["slots"][S] extends infer T ? T extends import("@ui-sdk/core").TypesOf<P>["slots"][S] ? T extends import("@ui-sdk/core").SlotDefinition<any, any, any, infer Public> ? Public : never : never : never;
|
|
20
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
21
|
+
mirror: {
|
|
22
|
+
type: BooleanConstructor;
|
|
23
|
+
default: undefined;
|
|
24
|
+
};
|
|
25
|
+
}>> & Readonly<{}>, {
|
|
26
|
+
mirror: boolean;
|
|
27
|
+
}, PartSlots<P, S>, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, "span">;
|
|
28
|
+
/**
|
|
29
|
+
* The selected item's icon, copied from its item's icon part. Rendered while
|
|
30
|
+
* one item is selected and it has an icon. Its content is the copy the core
|
|
31
|
+
* writes, so it takes no children.
|
|
32
|
+
*/
|
|
33
|
+
declare function defineValueIcon<P extends Primitive>(name: string, primitive: P, feature: Feature): import("./create-parts.js").ElementPart<import("vue").DefineComponent<{}, () => unknown, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, PartSlots<P, "value-icon" & keyof import("@ui-sdk/core").TypesOf<P>["slots"]>, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, "span">;
|
|
34
|
+
export { defineItemIcon, defineValueIcon };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// src/item-icon.ts
|
|
2
|
+
import { defineComponent, useId } from "vue";
|
|
3
|
+
import { useConnectedHandle, useConnectedPart } from "./controller-target.js";
|
|
4
|
+
import { withElement } from "./create-parts.js";
|
|
5
|
+
import {
|
|
6
|
+
optionalBoolean,
|
|
7
|
+
useHandle,
|
|
8
|
+
usePart,
|
|
9
|
+
useScope
|
|
10
|
+
} from "./use-primitive.js";
|
|
11
|
+
function defineItemIcon(name, primitive, slot, feature) {
|
|
12
|
+
return withElement(
|
|
13
|
+
"span",
|
|
14
|
+
defineComponent({
|
|
15
|
+
name,
|
|
16
|
+
inheritAttrs: false,
|
|
17
|
+
props: { mirror: optionalBoolean },
|
|
18
|
+
slots: Object,
|
|
19
|
+
setup(props) {
|
|
20
|
+
const handle = useHandle(primitive);
|
|
21
|
+
handle.instance.use(feature);
|
|
22
|
+
const item = useScope(primitive)?.around.item;
|
|
23
|
+
const id = useId();
|
|
24
|
+
const part = () => ({ id, mirror: props.mirror, item: item?.().value });
|
|
25
|
+
return usePart(handle, slot, part, void 0, "span");
|
|
26
|
+
}
|
|
27
|
+
})
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
function defineValueIcon(name, primitive, feature) {
|
|
31
|
+
return withElement(
|
|
32
|
+
"span",
|
|
33
|
+
defineComponent({
|
|
34
|
+
name,
|
|
35
|
+
inheritAttrs: false,
|
|
36
|
+
slots: Object,
|
|
37
|
+
setup() {
|
|
38
|
+
return useConnectedPart(
|
|
39
|
+
useConnectedHandle(primitive),
|
|
40
|
+
(handle) => {
|
|
41
|
+
handle.instance.use(feature);
|
|
42
|
+
return usePart(
|
|
43
|
+
handle,
|
|
44
|
+
"value-icon",
|
|
45
|
+
void 0,
|
|
46
|
+
void 0,
|
|
47
|
+
{
|
|
48
|
+
tag: "span",
|
|
49
|
+
children: () => void 0
|
|
50
|
+
}
|
|
51
|
+
);
|
|
52
|
+
},
|
|
53
|
+
// Inside a trigger outside its root, nothing until the root mounts.
|
|
54
|
+
() => null
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
})
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
export {
|
|
61
|
+
defineItemIcon,
|
|
62
|
+
defineValueIcon
|
|
63
|
+
};
|
package/dist/label.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A native <label> that names any control, by `for` or by wrapping it. A
|
|
3
|
+
* control a <label> can't reach, like a radio group or a slider, takes it as
|
|
4
|
+
* its name, and a press on the label activates it.
|
|
5
|
+
* @experimental
|
|
6
|
+
*/
|
|
7
|
+
declare const Label: import("./create-parts.js").ElementPart<new (props: Omit<import("@ui-sdk/core").OptionsOf<import("@ui-sdk/core/label").LabelPrimitive> & import("@ui-sdk/core/renderer").BaseSlotProps, never> & {} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps) => import("vue").CreateComponentPublicInstanceWithMixins<Omit<import("@ui-sdk/core").OptionsOf<import("@ui-sdk/core/label").LabelPrimitive> & import("@ui-sdk/core/renderer").BaseSlotProps, never> & {}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {}, import("vue").PublicProps, {}, false, {}, import("./use-primitive.js").StateSlots<{}>, {}, {}, string, {}, any, import("vue").ComponentProvideOptions, {
|
|
8
|
+
P: {};
|
|
9
|
+
B: {};
|
|
10
|
+
D: {};
|
|
11
|
+
C: {};
|
|
12
|
+
M: {};
|
|
13
|
+
Defaults: {};
|
|
14
|
+
}, Omit<import("@ui-sdk/core").OptionsOf<import("@ui-sdk/core/label").LabelPrimitive> & import("@ui-sdk/core/renderer").BaseSlotProps, never> & {}, {}, {}, {}, {}, {}>, "label">;
|
|
15
|
+
export { Label };
|
|
16
|
+
export type { LabelOptions, LabelPrimitive } from "@ui-sdk/core/label";
|
package/dist/label.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Whether a `<KeepAlive>` keeps the component's page away, as a ref. Call in `setup`. */
|
|
2
|
+
declare function useKeptAway(): import("vue").ShallowRef<boolean, boolean>;
|
|
3
|
+
type PartRef = (el: HTMLElement | null) => void;
|
|
4
|
+
/**
|
|
5
|
+
* Binds an instance's parts to their elements as Vue hands them over, and
|
|
6
|
+
* lets go of the page while a `<KeepAlive>` keeps the component away, so a
|
|
7
|
+
* cached open dialog stops locking scroll, then binds them again, its state
|
|
8
|
+
* kept. Returns the ref to give each part's element.
|
|
9
|
+
*/
|
|
10
|
+
declare function useBindings(): (ref: PartRef, slot: string) => (el: unknown) => void;
|
|
11
|
+
export { useBindings, useKeptAway };
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
// src/lifecycle.ts
|
|
2
|
+
import {
|
|
3
|
+
getCurrentInstance,
|
|
4
|
+
onActivated,
|
|
5
|
+
onDeactivated,
|
|
6
|
+
shallowRef,
|
|
7
|
+
watch
|
|
8
|
+
} from "vue";
|
|
9
|
+
function inDeactivatedPage(instance) {
|
|
10
|
+
for (let current = instance; current; current = current.parent) {
|
|
11
|
+
if (current.isDeactivated) {
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
function useKeptAway() {
|
|
18
|
+
const isAway = shallowRef(inDeactivatedPage(getCurrentInstance()));
|
|
19
|
+
onDeactivated(() => isAway.value = true);
|
|
20
|
+
onActivated(() => isAway.value = false);
|
|
21
|
+
return isAway;
|
|
22
|
+
}
|
|
23
|
+
function useBindings() {
|
|
24
|
+
const bound = /* @__PURE__ */ new Map();
|
|
25
|
+
const isAway = useKeptAway();
|
|
26
|
+
let isReleased = isAway.value;
|
|
27
|
+
watch(
|
|
28
|
+
isAway,
|
|
29
|
+
() => {
|
|
30
|
+
isReleased = isAway.value;
|
|
31
|
+
bound.forEach((el, ref) => ref(isReleased ? null : el));
|
|
32
|
+
},
|
|
33
|
+
{ flush: "post" }
|
|
34
|
+
);
|
|
35
|
+
const refs = /* @__PURE__ */ new WeakMap();
|
|
36
|
+
const held = /* @__PURE__ */ new WeakMap();
|
|
37
|
+
const outside = {};
|
|
38
|
+
return (ref, slot) => {
|
|
39
|
+
const owner = getCurrentInstance() ?? outside;
|
|
40
|
+
let own = refs.get(owner);
|
|
41
|
+
if (!own) {
|
|
42
|
+
refs.set(owner, own = /* @__PURE__ */ new WeakMap());
|
|
43
|
+
}
|
|
44
|
+
let wrapped = own.get(ref);
|
|
45
|
+
if (wrapped) {
|
|
46
|
+
return wrapped;
|
|
47
|
+
}
|
|
48
|
+
const suspense = owner.suspense;
|
|
49
|
+
let mine = null;
|
|
50
|
+
wrapped = (value) => {
|
|
51
|
+
const el = value && typeof value === "object" && "$el" in value ? value.$el : value;
|
|
52
|
+
if (!el) {
|
|
53
|
+
const last = mine;
|
|
54
|
+
mine = null;
|
|
55
|
+
if (bound.get(ref) !== last) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
bound.delete(ref);
|
|
59
|
+
return ref(null);
|
|
60
|
+
}
|
|
61
|
+
let slots = held.get(el);
|
|
62
|
+
if (!slots) {
|
|
63
|
+
held.set(el, slots = /* @__PURE__ */ new Map());
|
|
64
|
+
}
|
|
65
|
+
const previous = slots.get(slot);
|
|
66
|
+
slots.set(slot, ref);
|
|
67
|
+
if (previous && previous !== ref && bound.get(previous) === el) {
|
|
68
|
+
bound.delete(previous);
|
|
69
|
+
if (!isReleased) {
|
|
70
|
+
previous(null);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
mine = el;
|
|
74
|
+
bound.set(ref, el);
|
|
75
|
+
if (isReleased) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
if (suspense?.pendingBranch) {
|
|
79
|
+
suspense.effects.push(() => bound.get(ref) === el && ref(el));
|
|
80
|
+
} else {
|
|
81
|
+
ref(el);
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
own.set(ref, wrapped);
|
|
85
|
+
return wrapped;
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
export {
|
|
89
|
+
useBindings,
|
|
90
|
+
useKeptAway
|
|
91
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { ListData } from "@ui-sdk/core/select";
|
|
2
|
+
import { type Component, type PropType, type VNode } from "vue";
|
|
3
|
+
type ListParts = {
|
|
4
|
+
Item: Component;
|
|
5
|
+
Group: Component;
|
|
6
|
+
GroupLabel: Component;
|
|
7
|
+
Separator: Component;
|
|
8
|
+
};
|
|
9
|
+
declare const ListItems: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
10
|
+
items: {
|
|
11
|
+
type: PropType<readonly ListData<any>[number][]>;
|
|
12
|
+
required: true;
|
|
13
|
+
};
|
|
14
|
+
parts: {
|
|
15
|
+
type: PropType<ListParts>;
|
|
16
|
+
required: true;
|
|
17
|
+
};
|
|
18
|
+
keyOf: {
|
|
19
|
+
type: PropType<(value: unknown) => string>;
|
|
20
|
+
required: true;
|
|
21
|
+
};
|
|
22
|
+
}>, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
23
|
+
[key: string]: any;
|
|
24
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
25
|
+
items: {
|
|
26
|
+
type: PropType<readonly ListData<any>[number][]>;
|
|
27
|
+
required: true;
|
|
28
|
+
};
|
|
29
|
+
parts: {
|
|
30
|
+
type: PropType<ListParts>;
|
|
31
|
+
required: true;
|
|
32
|
+
};
|
|
33
|
+
keyOf: {
|
|
34
|
+
type: PropType<(value: unknown) => string>;
|
|
35
|
+
required: true;
|
|
36
|
+
};
|
|
37
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
38
|
+
export { ListItems, type ListParts };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// src/list-items.ts
|
|
2
|
+
import {
|
|
3
|
+
defineComponent,
|
|
4
|
+
Fragment,
|
|
5
|
+
h
|
|
6
|
+
} from "vue";
|
|
7
|
+
var ListItems = defineComponent({
|
|
8
|
+
name: "ListItems",
|
|
9
|
+
props: {
|
|
10
|
+
items: {
|
|
11
|
+
type: Array,
|
|
12
|
+
required: true
|
|
13
|
+
},
|
|
14
|
+
parts: { type: Object, required: true },
|
|
15
|
+
keyOf: {
|
|
16
|
+
type: Function,
|
|
17
|
+
required: true
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
setup(props) {
|
|
21
|
+
const render = (items) => {
|
|
22
|
+
const groupsByLabel = /* @__PURE__ */ new Map();
|
|
23
|
+
return items.map((entry, index) => {
|
|
24
|
+
const { Item, Group, GroupLabel, Separator } = props.parts;
|
|
25
|
+
if (typeof entry === "string") {
|
|
26
|
+
return h(Item, { key: entry, value: entry }, () => entry);
|
|
27
|
+
}
|
|
28
|
+
if ("type" in entry && entry.type === "separator") {
|
|
29
|
+
return h(Separator, { key: `separator-${index}` });
|
|
30
|
+
}
|
|
31
|
+
if ("type" in entry && entry.type === "group") {
|
|
32
|
+
const label2 = entry.label ?? "";
|
|
33
|
+
const before = groupsByLabel.get(label2) ?? 0;
|
|
34
|
+
groupsByLabel.set(label2, before + 1);
|
|
35
|
+
return h(Group, { key: `group-${label2}-${before}` }, () => [
|
|
36
|
+
entry.label && h(GroupLabel, null, () => entry.label),
|
|
37
|
+
...render(entry.items)
|
|
38
|
+
]);
|
|
39
|
+
}
|
|
40
|
+
const { value, label, disabled, keywords } = entry;
|
|
41
|
+
return h(
|
|
42
|
+
Item,
|
|
43
|
+
{
|
|
44
|
+
key: props.keyOf(value),
|
|
45
|
+
value,
|
|
46
|
+
label,
|
|
47
|
+
disabled,
|
|
48
|
+
...keywords && { keywords }
|
|
49
|
+
},
|
|
50
|
+
() => label
|
|
51
|
+
);
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
return () => h(Fragment, render(props.items));
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
export {
|
|
58
|
+
ListItems
|
|
59
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { MatchSegment } from "@ui-sdk/core/combobox";
|
|
2
|
+
import { type VNode } from "vue";
|
|
3
|
+
declare function markSegments(segments: MatchSegment[]): (string | VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
4
|
+
[key: string]: any;
|
|
5
|
+
}>)[];
|
|
6
|
+
declare function slotText(nodes: VNode[] | undefined): string | undefined;
|
|
7
|
+
export { markSegments, slotText };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// src/list-text.ts
|
|
2
|
+
import { h, Text } from "vue";
|
|
3
|
+
function markSegments(segments) {
|
|
4
|
+
return segments.map(({ text, match }) => match ? h("mark", text) : text);
|
|
5
|
+
}
|
|
6
|
+
function slotText(nodes) {
|
|
7
|
+
if (!nodes?.length || !nodes.every((node) => node.type === Text)) {
|
|
8
|
+
return void 0;
|
|
9
|
+
}
|
|
10
|
+
return nodes.map((node) => node.children).join("");
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
markSegments,
|
|
14
|
+
slotText
|
|
15
|
+
};
|