@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,176 @@
|
|
|
1
|
+
import { type NumberInputController, type NumberInputState, type NumberInputValueChangeReason } from "@ui-sdk/core/number-input";
|
|
2
|
+
import type { ChangeDetails, CommitDetails } from "@ui-sdk/core";
|
|
3
|
+
import { type PropType } from "vue";
|
|
4
|
+
import { type PartSlots } from "./use-primitive.js";
|
|
5
|
+
type Value = number | null;
|
|
6
|
+
/**
|
|
7
|
+
* The root, and the hidden input that submits the number as is.
|
|
8
|
+
* @stable
|
|
9
|
+
*/
|
|
10
|
+
declare const NumberInput: import("./create-parts.js").ElementPart<import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
11
|
+
value: {
|
|
12
|
+
type: PropType<Value>;
|
|
13
|
+
default: undefined;
|
|
14
|
+
};
|
|
15
|
+
modelValue: {
|
|
16
|
+
type: PropType<Value>;
|
|
17
|
+
default: undefined;
|
|
18
|
+
};
|
|
19
|
+
defaultValue: {
|
|
20
|
+
type: PropType<Value>;
|
|
21
|
+
default: undefined;
|
|
22
|
+
};
|
|
23
|
+
min: NumberConstructor;
|
|
24
|
+
max: NumberConstructor;
|
|
25
|
+
step: NumberConstructor;
|
|
26
|
+
largeStep: NumberConstructor;
|
|
27
|
+
smallStep: NumberConstructor;
|
|
28
|
+
format: PropType<Intl.NumberFormatOptions>;
|
|
29
|
+
locale: StringConstructor;
|
|
30
|
+
wheel: {
|
|
31
|
+
type: BooleanConstructor;
|
|
32
|
+
default: undefined;
|
|
33
|
+
};
|
|
34
|
+
disabled: {
|
|
35
|
+
type: BooleanConstructor;
|
|
36
|
+
default: undefined;
|
|
37
|
+
};
|
|
38
|
+
readOnly: {
|
|
39
|
+
type: BooleanConstructor;
|
|
40
|
+
default: undefined;
|
|
41
|
+
};
|
|
42
|
+
required: {
|
|
43
|
+
type: BooleanConstructor;
|
|
44
|
+
default: undefined;
|
|
45
|
+
};
|
|
46
|
+
name: StringConstructor;
|
|
47
|
+
form: StringConstructor;
|
|
48
|
+
controller: PropType<NumberInputController>;
|
|
49
|
+
debug: {
|
|
50
|
+
type: BooleanConstructor;
|
|
51
|
+
default: undefined;
|
|
52
|
+
};
|
|
53
|
+
}>, (() => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
54
|
+
[key: string]: any;
|
|
55
|
+
}> | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
56
|
+
[key: string]: any;
|
|
57
|
+
}>[] | null) & {
|
|
58
|
+
state: NoInfer<NumberInputState>;
|
|
59
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
60
|
+
"update:value": (_value: Value) => true;
|
|
61
|
+
"update:modelValue": (_value: Value) => true;
|
|
62
|
+
valueChange: (_value: Value, _details: ChangeDetails<NumberInputValueChangeReason>) => true;
|
|
63
|
+
valueCommit: (_value: Value, _details: CommitDetails<NumberInputValueChangeReason>) => true;
|
|
64
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
65
|
+
value: {
|
|
66
|
+
type: PropType<Value>;
|
|
67
|
+
default: undefined;
|
|
68
|
+
};
|
|
69
|
+
modelValue: {
|
|
70
|
+
type: PropType<Value>;
|
|
71
|
+
default: undefined;
|
|
72
|
+
};
|
|
73
|
+
defaultValue: {
|
|
74
|
+
type: PropType<Value>;
|
|
75
|
+
default: undefined;
|
|
76
|
+
};
|
|
77
|
+
min: NumberConstructor;
|
|
78
|
+
max: NumberConstructor;
|
|
79
|
+
step: NumberConstructor;
|
|
80
|
+
largeStep: NumberConstructor;
|
|
81
|
+
smallStep: NumberConstructor;
|
|
82
|
+
format: PropType<Intl.NumberFormatOptions>;
|
|
83
|
+
locale: StringConstructor;
|
|
84
|
+
wheel: {
|
|
85
|
+
type: BooleanConstructor;
|
|
86
|
+
default: undefined;
|
|
87
|
+
};
|
|
88
|
+
disabled: {
|
|
89
|
+
type: BooleanConstructor;
|
|
90
|
+
default: undefined;
|
|
91
|
+
};
|
|
92
|
+
readOnly: {
|
|
93
|
+
type: BooleanConstructor;
|
|
94
|
+
default: undefined;
|
|
95
|
+
};
|
|
96
|
+
required: {
|
|
97
|
+
type: BooleanConstructor;
|
|
98
|
+
default: undefined;
|
|
99
|
+
};
|
|
100
|
+
name: StringConstructor;
|
|
101
|
+
form: StringConstructor;
|
|
102
|
+
controller: PropType<NumberInputController>;
|
|
103
|
+
debug: {
|
|
104
|
+
type: BooleanConstructor;
|
|
105
|
+
default: undefined;
|
|
106
|
+
};
|
|
107
|
+
}>> & Readonly<{
|
|
108
|
+
"onUpdate:modelValue"?: ((_value: Value) => any) | undefined;
|
|
109
|
+
"onUpdate:value"?: ((_value: Value) => any) | undefined;
|
|
110
|
+
onValueChange?: ((_value: Value, _details: ChangeDetails<NumberInputValueChangeReason>) => any) | undefined;
|
|
111
|
+
onValueCommit?: ((_value: Value, _details: CommitDetails<NumberInputValueChangeReason>) => any) | undefined;
|
|
112
|
+
}>, {
|
|
113
|
+
value: Value;
|
|
114
|
+
wheel: boolean;
|
|
115
|
+
disabled: boolean;
|
|
116
|
+
debug: boolean;
|
|
117
|
+
defaultValue: Value;
|
|
118
|
+
required: boolean;
|
|
119
|
+
readOnly: boolean;
|
|
120
|
+
modelValue: Value;
|
|
121
|
+
}, PartSlots<import("@ui-sdk/core/number-input").NumberInputPrimitive, "root">, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, "div">;
|
|
122
|
+
/**
|
|
123
|
+
* Holds the input and its buttons.
|
|
124
|
+
* @stable
|
|
125
|
+
*/
|
|
126
|
+
declare const NumberInputGroup: Pick<import("vue").DefineSetupFnComponent<Omit<import("@ui-sdk/core/renderer").BaseSlotProps, never>, {} & {}, import("./use-primitive.js").StateSlots<NoInfer<NumberInputState>>>, never> & import("./create-parts.js").ElementConstructor<import("vue").DefineSetupFnComponent<Omit<import("@ui-sdk/core/renderer").BaseSlotProps, never>, {} & {}, import("./use-primitive.js").StateSlots<NoInfer<NumberInputState>>>, "div">;
|
|
127
|
+
/**
|
|
128
|
+
* Steps up once, then repeats while held. Shift steps by `largeStep`.
|
|
129
|
+
* @stable
|
|
130
|
+
*/
|
|
131
|
+
declare const NumberInputIncrement: Pick<import("vue").DefineSetupFnComponent<Omit<NoInfer<import("@ui-sdk/core/number-input").NumberInputButtonProps> & import("@ui-sdk/core/renderer").BaseSlotProps, never>, {} & {}, import("./use-primitive.js").StateSlots<NoInfer<import("@ui-sdk/core/number-input").NumberInputButtonState>>>, never> & import("./create-parts.js").ElementConstructor<import("vue").DefineSetupFnComponent<Omit<NoInfer<import("@ui-sdk/core/number-input").NumberInputButtonProps> & import("@ui-sdk/core/renderer").BaseSlotProps, never>, {} & {}, import("./use-primitive.js").StateSlots<NoInfer<import("@ui-sdk/core/number-input").NumberInputButtonState>>>, "button">;
|
|
132
|
+
/**
|
|
133
|
+
* Steps down once, then repeats while held. Shift steps by `largeStep`.
|
|
134
|
+
* @stable
|
|
135
|
+
*/
|
|
136
|
+
declare const NumberInputDecrement: Pick<import("vue").DefineSetupFnComponent<Omit<NoInfer<import("@ui-sdk/core/number-input").NumberInputButtonProps> & import("@ui-sdk/core/renderer").BaseSlotProps, never>, {} & {}, import("./use-primitive.js").StateSlots<NoInfer<import("@ui-sdk/core/number-input").NumberInputButtonState>>>, never> & import("./create-parts.js").ElementConstructor<import("vue").DefineSetupFnComponent<Omit<NoInfer<import("@ui-sdk/core/number-input").NumberInputButtonProps> & import("@ui-sdk/core/renderer").BaseSlotProps, never>, {} & {}, import("./use-primitive.js").StateSlots<NoInfer<import("@ui-sdk/core/number-input").NumberInputButtonState>>>, "button">;
|
|
137
|
+
/**
|
|
138
|
+
* The text field, which shows the formatted number and takes typing.
|
|
139
|
+
* @stable
|
|
140
|
+
*/
|
|
141
|
+
declare const NumberInputControl: import("./create-parts.js").ElementPart<import("vue").DefineComponent<{}, (() => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
142
|
+
[key: string]: any;
|
|
143
|
+
}> | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
144
|
+
[key: string]: any;
|
|
145
|
+
}>[] | null) & {
|
|
146
|
+
state: NoInfer<NumberInputState>;
|
|
147
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, PartSlots<import("@ui-sdk/core/number-input").NumberInputPrimitive, "control">, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, "input">;
|
|
148
|
+
/**
|
|
149
|
+
* Drag across it to change the value. It works anywhere inside the number
|
|
150
|
+
* input, and outside it through `controller`, like an icon in a toolbar.
|
|
151
|
+
* @stable
|
|
152
|
+
*/
|
|
153
|
+
declare const NumberInputScrubArea: import("./create-parts.js").ElementPart<import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
154
|
+
orientation: PropType<"horizontal" | "vertical">;
|
|
155
|
+
pixelsPerStep: NumberConstructor;
|
|
156
|
+
controller: PropType<NumberInputController>;
|
|
157
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
158
|
+
[key: string]: any;
|
|
159
|
+
}> | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
160
|
+
[key: string]: any;
|
|
161
|
+
}>[], {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
162
|
+
orientation: PropType<"horizontal" | "vertical">;
|
|
163
|
+
pixelsPerStep: NumberConstructor;
|
|
164
|
+
controller: PropType<NumberInputController>;
|
|
165
|
+
}>> & Readonly<{}>, {}, PartSlots<import("@ui-sdk/core/number-input").NumberInputPrimitive, "scrub-area">, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, "span">;
|
|
166
|
+
/**
|
|
167
|
+
* Stands in for the mouse cursor while a scrub locks the pointer. Rendered in
|
|
168
|
+
* the body, so transformed ancestors can't move it.
|
|
169
|
+
* @stable
|
|
170
|
+
*/
|
|
171
|
+
declare const NumberInputScrubAreaCursor: import("./create-parts.js").ElementPart<import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
172
|
+
[key: string]: any;
|
|
173
|
+
}> | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, PartSlots<import("@ui-sdk/core/number-input").NumberInputPrimitive, "scrub-area-cursor">, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, "span">;
|
|
174
|
+
export { createNumberInputController } from "@ui-sdk/core/number-input";
|
|
175
|
+
export type { NumberInputApi, NumberInputButtonProps, NumberInputButtonState, NumberInputChangeOptions, NumberInputController, NumberInputOptions, NumberInputPrimitive, NumberInputScrubAreaProps, NumberInputState, NumberInputValueChangeReason, } from "@ui-sdk/core/number-input";
|
|
176
|
+
export { NumberInput, NumberInputControl, NumberInputDecrement, NumberInputGroup, NumberInputIncrement, NumberInputScrubArea, NumberInputScrubAreaCursor, };
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
// src/number-input.ts
|
|
2
|
+
import {
|
|
3
|
+
numberInput as numberInputPrimitive
|
|
4
|
+
} from "@ui-sdk/core/number-input";
|
|
5
|
+
import {
|
|
6
|
+
defineComponent,
|
|
7
|
+
h,
|
|
8
|
+
inject,
|
|
9
|
+
provide,
|
|
10
|
+
Teleport
|
|
11
|
+
} from "vue";
|
|
12
|
+
import {
|
|
13
|
+
renderUnbound,
|
|
14
|
+
useControllerEntry,
|
|
15
|
+
useControllerTarget
|
|
16
|
+
} from "./controller-target.js";
|
|
17
|
+
import { useFieldControl, useFieldControlId } from "./field-context.js";
|
|
18
|
+
import { createParts, withElement } from "./create-parts.js";
|
|
19
|
+
import {
|
|
20
|
+
optionalBoolean,
|
|
21
|
+
orModel,
|
|
22
|
+
provideHandle,
|
|
23
|
+
useHandle,
|
|
24
|
+
usePart,
|
|
25
|
+
usePrimitive,
|
|
26
|
+
useScope
|
|
27
|
+
} from "./use-primitive.js";
|
|
28
|
+
import { readOnlyOf } from "./text-control.js";
|
|
29
|
+
import { createNumberInputController } from "@ui-sdk/core/number-input";
|
|
30
|
+
var FieldOfKey = /* @__PURE__ */ Symbol("number-input-field");
|
|
31
|
+
var parts = createParts(numberInputPrimitive, {
|
|
32
|
+
group: "div",
|
|
33
|
+
increment: "button",
|
|
34
|
+
decrement: "button"
|
|
35
|
+
});
|
|
36
|
+
var NumberInput = withElement(
|
|
37
|
+
"div",
|
|
38
|
+
defineComponent({
|
|
39
|
+
name: "NumberInput",
|
|
40
|
+
inheritAttrs: false,
|
|
41
|
+
props: {
|
|
42
|
+
value: { type: Number, default: void 0 },
|
|
43
|
+
modelValue: { type: Number, default: void 0 },
|
|
44
|
+
defaultValue: { type: Number, default: void 0 },
|
|
45
|
+
min: Number,
|
|
46
|
+
max: Number,
|
|
47
|
+
step: Number,
|
|
48
|
+
largeStep: Number,
|
|
49
|
+
smallStep: Number,
|
|
50
|
+
format: Object,
|
|
51
|
+
locale: String,
|
|
52
|
+
wheel: optionalBoolean,
|
|
53
|
+
disabled: optionalBoolean,
|
|
54
|
+
readOnly: optionalBoolean,
|
|
55
|
+
required: optionalBoolean,
|
|
56
|
+
name: String,
|
|
57
|
+
form: String,
|
|
58
|
+
controller: Object,
|
|
59
|
+
debug: optionalBoolean
|
|
60
|
+
},
|
|
61
|
+
emits: {
|
|
62
|
+
"update:value": (_value) => true,
|
|
63
|
+
"update:modelValue": (_value) => true,
|
|
64
|
+
valueChange: (_value, _details) => true,
|
|
65
|
+
valueCommit: (_value, _details) => true
|
|
66
|
+
},
|
|
67
|
+
slots: Object,
|
|
68
|
+
setup(props, { attrs, emit }) {
|
|
69
|
+
const field = useFieldControl();
|
|
70
|
+
const controlId = useFieldControlId();
|
|
71
|
+
const numberInput = usePrimitive(numberInputPrimitive, () => ({
|
|
72
|
+
value: orModel(props.value, props.modelValue),
|
|
73
|
+
defaultValue: props.defaultValue,
|
|
74
|
+
min: props.min,
|
|
75
|
+
max: props.max,
|
|
76
|
+
step: props.step,
|
|
77
|
+
largeStep: props.largeStep,
|
|
78
|
+
smallStep: props.smallStep,
|
|
79
|
+
format: props.format,
|
|
80
|
+
locale: props.locale,
|
|
81
|
+
wheel: props.wheel,
|
|
82
|
+
disabled: props.disabled || field?.disabled(),
|
|
83
|
+
readOnly: readOnlyOf(props, attrs),
|
|
84
|
+
required: props.required,
|
|
85
|
+
name: props.name ?? field?.name(),
|
|
86
|
+
form: props.form,
|
|
87
|
+
controller: props.controller,
|
|
88
|
+
controlId,
|
|
89
|
+
debug: props.debug,
|
|
90
|
+
onValueChange: (value, details) => {
|
|
91
|
+
emit("valueChange", value, details);
|
|
92
|
+
if (details.canceled) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
emit("update:value", value);
|
|
96
|
+
emit("update:modelValue", value);
|
|
97
|
+
},
|
|
98
|
+
onValueCommit: (value, details) => emit("valueCommit", value, details)
|
|
99
|
+
}));
|
|
100
|
+
provide(FieldOfKey, field);
|
|
101
|
+
useControllerEntry(() => props.controller, numberInput);
|
|
102
|
+
return usePart(numberInput, "root", void 0, void 0, {
|
|
103
|
+
tag: "div",
|
|
104
|
+
hidden: () => h("input", numberInput.slot("hidden-input"))
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
})
|
|
108
|
+
);
|
|
109
|
+
var NumberInputGroup = parts.Group;
|
|
110
|
+
var NumberInputIncrement = parts.Increment;
|
|
111
|
+
var NumberInputDecrement = parts.Decrement;
|
|
112
|
+
var NumberInputControl = withElement(
|
|
113
|
+
"input",
|
|
114
|
+
defineComponent({
|
|
115
|
+
name: "NumberInputControl",
|
|
116
|
+
inheritAttrs: false,
|
|
117
|
+
slots: Object,
|
|
118
|
+
setup() {
|
|
119
|
+
const field = inject(FieldOfKey, null);
|
|
120
|
+
return usePart(
|
|
121
|
+
useHandle(numberInputPrimitive),
|
|
122
|
+
"control",
|
|
123
|
+
void 0,
|
|
124
|
+
void 0,
|
|
125
|
+
{
|
|
126
|
+
tag: "input",
|
|
127
|
+
extend: field?.props
|
|
128
|
+
}
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
})
|
|
132
|
+
);
|
|
133
|
+
var unconnected = {
|
|
134
|
+
value: null,
|
|
135
|
+
disabled: false,
|
|
136
|
+
readOnly: false,
|
|
137
|
+
required: false,
|
|
138
|
+
scrubbing: false
|
|
139
|
+
};
|
|
140
|
+
var NumberInputScrubArea = withElement(
|
|
141
|
+
"span",
|
|
142
|
+
defineComponent({
|
|
143
|
+
name: "NumberInputScrubArea",
|
|
144
|
+
inheritAttrs: false,
|
|
145
|
+
props: {
|
|
146
|
+
orientation: String,
|
|
147
|
+
pixelsPerStep: Number,
|
|
148
|
+
controller: Object
|
|
149
|
+
},
|
|
150
|
+
slots: Object,
|
|
151
|
+
setup(props, { slots, attrs }) {
|
|
152
|
+
const connected = useControllerTarget(
|
|
153
|
+
numberInputPrimitive,
|
|
154
|
+
() => props.controller
|
|
155
|
+
);
|
|
156
|
+
return () => {
|
|
157
|
+
const numberInput = connected();
|
|
158
|
+
if (!numberInput) {
|
|
159
|
+
return renderUnbound("span", attrs, { slots, state: unconnected });
|
|
160
|
+
}
|
|
161
|
+
return h(
|
|
162
|
+
ScrubAreaPart,
|
|
163
|
+
{
|
|
164
|
+
numberInput,
|
|
165
|
+
orientation: props.orientation,
|
|
166
|
+
pixelsPerStep: props.pixelsPerStep,
|
|
167
|
+
// A new number input needs a new part, bound to its instance.
|
|
168
|
+
key: numberInput.instance.id,
|
|
169
|
+
...attrs
|
|
170
|
+
},
|
|
171
|
+
slots
|
|
172
|
+
);
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
})
|
|
176
|
+
);
|
|
177
|
+
var ScrubAreaPart = defineComponent({
|
|
178
|
+
name: "NumberInputScrubAreaPart",
|
|
179
|
+
inheritAttrs: false,
|
|
180
|
+
props: {
|
|
181
|
+
numberInput: {
|
|
182
|
+
type: Object,
|
|
183
|
+
required: true
|
|
184
|
+
},
|
|
185
|
+
orientation: String,
|
|
186
|
+
pixelsPerStep: Number
|
|
187
|
+
},
|
|
188
|
+
setup(props) {
|
|
189
|
+
provideHandle(props.numberInput);
|
|
190
|
+
const scrub = () => ({
|
|
191
|
+
orientation: props.orientation,
|
|
192
|
+
pixelsPerStep: props.pixelsPerStep
|
|
193
|
+
});
|
|
194
|
+
return usePart(props.numberInput, "scrub-area", scrub, void 0, "span");
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
var NumberInputScrubAreaCursor = withElement(
|
|
198
|
+
"span",
|
|
199
|
+
defineComponent({
|
|
200
|
+
name: "NumberInputScrubAreaCursor",
|
|
201
|
+
inheritAttrs: false,
|
|
202
|
+
slots: Object,
|
|
203
|
+
setup() {
|
|
204
|
+
const numberInput = useScope(numberInputPrimitive)?.handle;
|
|
205
|
+
if (!numberInput) {
|
|
206
|
+
return () => null;
|
|
207
|
+
}
|
|
208
|
+
const cursor = usePart(
|
|
209
|
+
numberInput,
|
|
210
|
+
"scrub-area-cursor",
|
|
211
|
+
void 0,
|
|
212
|
+
void 0,
|
|
213
|
+
"span"
|
|
214
|
+
);
|
|
215
|
+
return () => {
|
|
216
|
+
const element = cursor();
|
|
217
|
+
return element && h(Teleport, { to: "body" }, [element]);
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
})
|
|
221
|
+
);
|
|
222
|
+
export {
|
|
223
|
+
NumberInput,
|
|
224
|
+
NumberInputControl,
|
|
225
|
+
NumberInputDecrement,
|
|
226
|
+
NumberInputGroup,
|
|
227
|
+
NumberInputIncrement,
|
|
228
|
+
NumberInputScrubArea,
|
|
229
|
+
NumberInputScrubAreaCursor,
|
|
230
|
+
createNumberInputController
|
|
231
|
+
};
|
package/dist/number.d.ts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { clamp, decimalsOf, formatNumber, formatNumberRange, formatNumberToParts, fractionOf, isPartialNumber, maxOnGrid, numberFormatter, parseNumber, roundTo, scrubTo, stepBy, stepFromKey, stepValue, valueAt, wrap, } from "@ui-sdk/core/number";
|
|
2
|
+
export type { NumberFormat, NumberKeyOptions, NumberMove, NumberRange, NumberScale, NumberScrub, NumberSnap, StepRange, } from "@ui-sdk/core/number";
|
package/dist/number.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// src/number.ts
|
|
2
|
+
import {
|
|
3
|
+
clamp,
|
|
4
|
+
decimalsOf,
|
|
5
|
+
formatNumber,
|
|
6
|
+
formatNumberRange,
|
|
7
|
+
formatNumberToParts,
|
|
8
|
+
fractionOf,
|
|
9
|
+
isPartialNumber,
|
|
10
|
+
maxOnGrid,
|
|
11
|
+
numberFormatter,
|
|
12
|
+
parseNumber,
|
|
13
|
+
roundTo,
|
|
14
|
+
scrubTo,
|
|
15
|
+
stepBy,
|
|
16
|
+
stepFromKey,
|
|
17
|
+
stepValue,
|
|
18
|
+
valueAt,
|
|
19
|
+
wrap
|
|
20
|
+
} from "@ui-sdk/core/number";
|
|
21
|
+
export {
|
|
22
|
+
clamp,
|
|
23
|
+
decimalsOf,
|
|
24
|
+
formatNumber,
|
|
25
|
+
formatNumberRange,
|
|
26
|
+
formatNumberToParts,
|
|
27
|
+
fractionOf,
|
|
28
|
+
isPartialNumber,
|
|
29
|
+
maxOnGrid,
|
|
30
|
+
numberFormatter,
|
|
31
|
+
parseNumber,
|
|
32
|
+
roundTo,
|
|
33
|
+
scrubTo,
|
|
34
|
+
stepBy,
|
|
35
|
+
stepFromKey,
|
|
36
|
+
stepValue,
|
|
37
|
+
valueAt,
|
|
38
|
+
wrap
|
|
39
|
+
};
|