@kirana-ui/vue 0.1.0 → 0.1.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/llms.txt +1838 -0
- package/package.json +112 -2
- package/src/autocomplete.d.ts +2 -0
- package/src/autocomplete.js +1 -0
- package/src/autosize.d.ts +12 -0
- package/src/autosize.js +24 -0
- package/src/autosize.js.map +1 -0
- package/src/calendar.d.ts +107 -0
- package/src/calendar.js +125 -0
- package/src/calendar.js.map +1 -0
- package/src/carousel.d.ts +61 -0
- package/src/carousel.js +75 -0
- package/src/carousel.js.map +1 -0
- package/src/checkbox.d.ts +2 -0
- package/src/checkbox.js +2 -0
- package/src/checkbox.js.map +1 -1
- package/src/combobox.d.ts +298 -0
- package/src/combobox.js +286 -0
- package/src/combobox.js.map +1 -0
- package/src/command.d.ts +89 -0
- package/src/command.js +129 -0
- package/src/command.js.map +1 -0
- package/src/context-menu.d.ts +2 -0
- package/src/context-menu.js +1 -0
- package/src/date-field.d.ts +70 -0
- package/src/date-field.js +77 -0
- package/src/date-field.js.map +1 -0
- package/src/date-picker.d.ts +145 -0
- package/src/date-picker.js +82 -0
- package/src/date-picker.js.map +1 -0
- package/src/dialog.d.ts +70 -0
- package/src/dialog.js +56 -1
- package/src/dialog.js.map +1 -1
- package/src/drawer.d.ts +2 -0
- package/src/drawer.js +1 -0
- package/src/hover-card.d.ts +9 -1
- package/src/hover-popup.d.ts +9 -1
- package/src/hover-popup.js +41 -25
- package/src/hover-popup.js.map +1 -1
- package/src/index.d.ts +27 -2
- package/src/index.js +26 -2
- package/src/input.d.ts +19 -0
- package/src/input.js +36 -0
- package/src/input.js.map +1 -0
- package/src/label.d.ts +5 -0
- package/src/label.js +18 -0
- package/src/label.js.map +1 -0
- package/src/listbox.d.ts +92 -0
- package/src/listbox.js +104 -0
- package/src/listbox.js.map +1 -0
- package/src/menu.d.ts +542 -0
- package/src/menu.js +235 -0
- package/src/menu.js.map +1 -0
- package/src/menubar-context.d.ts +5 -0
- package/src/menubar-context.js +6 -0
- package/src/menubar-context.js.map +1 -0
- package/src/menubar.d.ts +26 -0
- package/src/menubar.js +34 -0
- package/src/menubar.js.map +1 -0
- package/src/message-scroller.d.ts +20 -0
- package/src/message-scroller.js +34 -0
- package/src/message-scroller.js.map +1 -0
- package/src/navigation-menu.d.ts +91 -0
- package/src/navigation-menu.js +117 -0
- package/src/navigation-menu.js.map +1 -0
- package/src/number-field.d.ts +71 -0
- package/src/number-field.js +81 -0
- package/src/number-field.js.map +1 -0
- package/src/otp.d.ts +58 -0
- package/src/otp.js +86 -0
- package/src/otp.js.map +1 -0
- package/src/pagination.d.ts +61 -0
- package/src/pagination.js +70 -0
- package/src/pagination.js.map +1 -0
- package/src/popover.d.ts +5 -0
- package/src/popover.js +1 -1
- package/src/popover.js.map +1 -1
- package/src/qr-code.d.ts +24 -0
- package/src/qr-code.js +34 -0
- package/src/qr-code.js.map +1 -0
- package/src/radio-group.d.ts +2 -0
- package/src/radio-group.js +2 -0
- package/src/radio-group.js.map +1 -1
- package/src/resizable.d.ts +48 -0
- package/src/resizable.js +62 -0
- package/src/resizable.js.map +1 -0
- package/src/runtime.d.ts +20 -1
- package/src/runtime.js +22 -3
- package/src/runtime.js.map +1 -1
- package/src/scroll-area.d.ts +32 -0
- package/src/scroll-area.js +63 -0
- package/src/scroll-area.js.map +1 -0
- package/src/select.d.ts +36 -1
- package/src/select.js +68 -4
- package/src/select.js.map +1 -1
- package/src/slider.d.ts +4 -0
- package/src/slider.js +2 -0
- package/src/slider.js.map +1 -1
- package/src/switch.d.ts +2 -0
- package/src/switch.js +2 -0
- package/src/switch.js.map +1 -1
- package/src/toast.d.ts +48 -0
- package/src/toast.js +66 -0
- package/src/toast.js.map +1 -0
- package/src/toggle-group.d.ts +41 -0
- package/src/toggle-group.js +46 -0
- package/src/toggle-group.js.map +1 -0
- package/src/toggle.d.ts +14 -1
- package/src/toggle.js +19 -4
- package/src/toggle.js.map +1 -1
- package/src/toolbar-context.d.ts +8 -0
- package/src/toolbar-context.js +8 -0
- package/src/toolbar-context.js.map +1 -0
- package/src/toolbar.d.ts +72 -0
- package/src/toolbar.js +55 -0
- package/src/toolbar.js.map +1 -0
- package/src/tooltip.d.ts +9 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kirana-ui/vue",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Kirana UI Primitives for Vue",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "The Kirana authors",
|
|
@@ -11,6 +11,10 @@
|
|
|
11
11
|
"types": "./src/index.d.ts",
|
|
12
12
|
"default": "./src/index.js"
|
|
13
13
|
},
|
|
14
|
+
"./runtime": {
|
|
15
|
+
"types": "./src/runtime.d.ts",
|
|
16
|
+
"default": "./src/runtime.js"
|
|
17
|
+
},
|
|
14
18
|
"./accordion": {
|
|
15
19
|
"types": "./src/accordion.d.ts",
|
|
16
20
|
"default": "./src/accordion.js"
|
|
@@ -35,6 +39,14 @@
|
|
|
35
39
|
"types": "./src/collapsible.d.ts",
|
|
36
40
|
"default": "./src/collapsible.js"
|
|
37
41
|
},
|
|
42
|
+
"./combobox": {
|
|
43
|
+
"types": "./src/combobox.d.ts",
|
|
44
|
+
"default": "./src/combobox.js"
|
|
45
|
+
},
|
|
46
|
+
"./context-menu": {
|
|
47
|
+
"types": "./src/context-menu.d.ts",
|
|
48
|
+
"default": "./src/context-menu.js"
|
|
49
|
+
},
|
|
38
50
|
"./dialog": {
|
|
39
51
|
"types": "./src/dialog.d.ts",
|
|
40
52
|
"default": "./src/dialog.js"
|
|
@@ -63,6 +75,86 @@
|
|
|
63
75
|
"types": "./src/meter.d.ts",
|
|
64
76
|
"default": "./src/meter.js"
|
|
65
77
|
},
|
|
78
|
+
"./listbox": {
|
|
79
|
+
"types": "./src/listbox.d.ts",
|
|
80
|
+
"default": "./src/listbox.js"
|
|
81
|
+
},
|
|
82
|
+
"./menu": {
|
|
83
|
+
"types": "./src/menu.d.ts",
|
|
84
|
+
"default": "./src/menu.js"
|
|
85
|
+
},
|
|
86
|
+
"./menubar": {
|
|
87
|
+
"types": "./src/menubar.d.ts",
|
|
88
|
+
"default": "./src/menubar.js"
|
|
89
|
+
},
|
|
90
|
+
"./navigation-menu": {
|
|
91
|
+
"types": "./src/navigation-menu.d.ts",
|
|
92
|
+
"default": "./src/navigation-menu.js"
|
|
93
|
+
},
|
|
94
|
+
"./otp": {
|
|
95
|
+
"types": "./src/otp.d.ts",
|
|
96
|
+
"default": "./src/otp.js"
|
|
97
|
+
},
|
|
98
|
+
"./date-field": {
|
|
99
|
+
"types": "./src/date-field.d.ts",
|
|
100
|
+
"default": "./src/date-field.js"
|
|
101
|
+
},
|
|
102
|
+
"./input": {
|
|
103
|
+
"types": "./src/input.d.ts",
|
|
104
|
+
"default": "./src/input.js"
|
|
105
|
+
},
|
|
106
|
+
"./label": {
|
|
107
|
+
"types": "./src/label.d.ts",
|
|
108
|
+
"default": "./src/label.js"
|
|
109
|
+
},
|
|
110
|
+
"./command": {
|
|
111
|
+
"types": "./src/command.d.ts",
|
|
112
|
+
"default": "./src/command.js"
|
|
113
|
+
},
|
|
114
|
+
"./number-field": {
|
|
115
|
+
"types": "./src/number-field.d.ts",
|
|
116
|
+
"default": "./src/number-field.js"
|
|
117
|
+
},
|
|
118
|
+
"./autocomplete": {
|
|
119
|
+
"types": "./src/autocomplete.d.ts",
|
|
120
|
+
"default": "./src/autocomplete.js"
|
|
121
|
+
},
|
|
122
|
+
"./pagination": {
|
|
123
|
+
"types": "./src/pagination.d.ts",
|
|
124
|
+
"default": "./src/pagination.js"
|
|
125
|
+
},
|
|
126
|
+
"./date-picker": {
|
|
127
|
+
"types": "./src/date-picker.d.ts",
|
|
128
|
+
"default": "./src/date-picker.js"
|
|
129
|
+
},
|
|
130
|
+
"./calendar": {
|
|
131
|
+
"types": "./src/calendar.d.ts",
|
|
132
|
+
"default": "./src/calendar.js"
|
|
133
|
+
},
|
|
134
|
+
"./drawer": {
|
|
135
|
+
"types": "./src/drawer.d.ts",
|
|
136
|
+
"default": "./src/drawer.js"
|
|
137
|
+
},
|
|
138
|
+
"./message-scroller": {
|
|
139
|
+
"types": "./src/message-scroller.d.ts",
|
|
140
|
+
"default": "./src/message-scroller.js"
|
|
141
|
+
},
|
|
142
|
+
"./qr-code": {
|
|
143
|
+
"types": "./src/qr-code.d.ts",
|
|
144
|
+
"default": "./src/qr-code.js"
|
|
145
|
+
},
|
|
146
|
+
"./autosize": {
|
|
147
|
+
"types": "./src/autosize.d.ts",
|
|
148
|
+
"default": "./src/autosize.js"
|
|
149
|
+
},
|
|
150
|
+
"./carousel": {
|
|
151
|
+
"types": "./src/carousel.d.ts",
|
|
152
|
+
"default": "./src/carousel.js"
|
|
153
|
+
},
|
|
154
|
+
"./toast": {
|
|
155
|
+
"types": "./src/toast.d.ts",
|
|
156
|
+
"default": "./src/toast.js"
|
|
157
|
+
},
|
|
66
158
|
"./popover": {
|
|
67
159
|
"types": "./src/popover.d.ts",
|
|
68
160
|
"default": "./src/popover.js"
|
|
@@ -75,6 +167,14 @@
|
|
|
75
167
|
"types": "./src/radio-group.d.ts",
|
|
76
168
|
"default": "./src/radio-group.js"
|
|
77
169
|
},
|
|
170
|
+
"./resizable": {
|
|
171
|
+
"types": "./src/resizable.d.ts",
|
|
172
|
+
"default": "./src/resizable.js"
|
|
173
|
+
},
|
|
174
|
+
"./scroll-area": {
|
|
175
|
+
"types": "./src/scroll-area.d.ts",
|
|
176
|
+
"default": "./src/scroll-area.js"
|
|
177
|
+
},
|
|
78
178
|
"./select": {
|
|
79
179
|
"types": "./src/select.d.ts",
|
|
80
180
|
"default": "./src/select.js"
|
|
@@ -99,6 +199,14 @@
|
|
|
99
199
|
"types": "./src/toggle.d.ts",
|
|
100
200
|
"default": "./src/toggle.js"
|
|
101
201
|
},
|
|
202
|
+
"./toggle-group": {
|
|
203
|
+
"types": "./src/toggle-group.d.ts",
|
|
204
|
+
"default": "./src/toggle-group.js"
|
|
205
|
+
},
|
|
206
|
+
"./toolbar": {
|
|
207
|
+
"types": "./src/toolbar.d.ts",
|
|
208
|
+
"default": "./src/toolbar.js"
|
|
209
|
+
},
|
|
102
210
|
"./tooltip": {
|
|
103
211
|
"types": "./src/tooltip.d.ts",
|
|
104
212
|
"default": "./src/tooltip.js"
|
|
@@ -106,7 +214,7 @@
|
|
|
106
214
|
"./package.json": "./package.json"
|
|
107
215
|
},
|
|
108
216
|
"dependencies": {
|
|
109
|
-
"@kirana-ui/core": "0.1.
|
|
217
|
+
"@kirana-ui/core": "0.1.1"
|
|
110
218
|
},
|
|
111
219
|
"peerDependencies": {
|
|
112
220
|
"vue": "^3.5.0"
|
|
@@ -127,6 +235,8 @@
|
|
|
127
235
|
"src",
|
|
128
236
|
"README.md",
|
|
129
237
|
"REFERENCE.md",
|
|
238
|
+
"llms.txt",
|
|
239
|
+
"skills",
|
|
130
240
|
"LICENSE"
|
|
131
241
|
]
|
|
132
242
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Autocomplete } from "./combobox.js";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const Autosize: {
|
|
2
|
+
Textarea: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
3
|
+
modelValue: StringConstructor;
|
|
4
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
5
|
+
[key: string]: any;
|
|
6
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
7
|
+
modelValue: StringConstructor;
|
|
8
|
+
}>> & Readonly<{
|
|
9
|
+
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
10
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=autosize.d.ts.map
|
package/src/autosize.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { controller, partComponent } from "./runtime.js";
|
|
2
|
+
import { defineComponent, h } from "vue";
|
|
3
|
+
import { createAutosize } from "@kirana-ui/core/autosize";
|
|
4
|
+
const Autosize = { Textarea: defineComponent({
|
|
5
|
+
name: "AutosizeTextarea",
|
|
6
|
+
inheritAttrs: false,
|
|
7
|
+
props: { modelValue: String },
|
|
8
|
+
emits: ["update:modelValue"],
|
|
9
|
+
setup(props, { attrs, slots, emit }) {
|
|
10
|
+
const made = controller(createAutosize, () => ({ value: props.modelValue ?? attrs.value }));
|
|
11
|
+
const Element = partComponent("AutosizeTextareaElement", "textarea", () => made.textarea);
|
|
12
|
+
return () => h(Element, {
|
|
13
|
+
...attrs,
|
|
14
|
+
...props.modelValue === void 0 ? {} : { value: props.modelValue },
|
|
15
|
+
onInput: (event) => {
|
|
16
|
+
emit("update:modelValue", event.target.value);
|
|
17
|
+
attrs.onInput?.(event);
|
|
18
|
+
}
|
|
19
|
+
}, slots);
|
|
20
|
+
}
|
|
21
|
+
}) };
|
|
22
|
+
export { Autosize };
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=autosize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autosize.js","names":[],"sources":["../../../../packages/vue/src/autosize.ts"],"sourcesContent":["import { createAutosize } from \"@kirana-ui/core/autosize\"\nimport { defineComponent, h } from \"vue\"\n\nimport { controller, partComponent } from \"./runtime.ts\"\n\n/**\n * A `<textarea>` as tall as its text. It takes what a `<textarea>` takes, and `v-model`.\n */\nconst Textarea = defineComponent({\n name: \"AutosizeTextarea\",\n inheritAttrs: false,\n props: { modelValue: String },\n emits: [\"update:modelValue\"],\n setup(props, { attrs, slots, emit }) {\n const made = controller(createAutosize, () => ({ value: props.modelValue ?? attrs.value }))\n const Element = partComponent(\"AutosizeTextareaElement\", \"textarea\", () => made.textarea)\n return () =>\n h(\n Element,\n {\n ...attrs,\n ...(props.modelValue === undefined ? {} : { value: props.modelValue }),\n onInput: (event: Event) => {\n emit(\"update:modelValue\", (event.target as HTMLTextAreaElement).value)\n ;(attrs.onInput as ((event: Event) => void) | undefined)?.(event)\n },\n },\n slots\n )\n },\n})\n\nexport const Autosize = { Textarea }\n"],"mappings":";;;AAgCA,MAAa,WAAW,EAAE,UAxBT,gBAAgB;CAC/B,MAAM;CACN,cAAc;CACd,OAAO,EAAE,YAAY,OAAO;CAC5B,OAAO,CAAC,mBAAmB;CAC3B,MAAM,OAAO,EAAE,OAAO,OAAO,QAAQ;EACnC,MAAM,OAAO,WAAW,uBAAuB,EAAE,OAAO,MAAM,cAAc,MAAM,MAAM,EAAE;EAC1F,MAAM,UAAU,cAAc,2BAA2B,kBAAkB,KAAK,QAAQ;EACxF,aACE,EACE,SACA;GACE,GAAG;GACH,GAAI,MAAM,eAAe,KAAA,IAAY,CAAC,IAAI,EAAE,OAAO,MAAM,WAAW;GACpE,UAAU,UAAiB;IACzB,KAAK,qBAAsB,MAAM,OAA+B,KAAK;IACpE,MAAO,UAAmD,KAAK;GAClE;EACF,GACA,KACF;CACJ;AACF,CAE0B,EAAS"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { PropType } from "vue";
|
|
2
|
+
import { Calendar as Calendar$1, CalendarProps, CalendarValue, CalendarWeekday } from "@kirana-ui/core/calendar";
|
|
3
|
+
declare const scope: {
|
|
4
|
+
provide(controller: Calendar$1): Calendar$1;
|
|
5
|
+
use(): Calendar$1;
|
|
6
|
+
};
|
|
7
|
+
export declare const Calendar: {
|
|
8
|
+
Root: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
9
|
+
value: {
|
|
10
|
+
type: PropType<CalendarValue>;
|
|
11
|
+
default: undefined;
|
|
12
|
+
};
|
|
13
|
+
defaultValue: PropType<CalendarValue>;
|
|
14
|
+
mode: PropType<"single" | "range">;
|
|
15
|
+
defaultFocusedValue: StringConstructor;
|
|
16
|
+
locale: StringConstructor;
|
|
17
|
+
calendarSystem: PropType<CalendarProps["calendarSystem"]>;
|
|
18
|
+
min: StringConstructor;
|
|
19
|
+
max: StringConstructor;
|
|
20
|
+
isDateUnavailable: PropType<(date: string) => boolean>;
|
|
21
|
+
disabled: BooleanConstructor;
|
|
22
|
+
readOnly: BooleanConstructor;
|
|
23
|
+
fixedWeeks: BooleanConstructor;
|
|
24
|
+
id: StringConstructor;
|
|
25
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
26
|
+
[key: string]: any;
|
|
27
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("monthChange" | "update:value" | "valueChange")[], "monthChange" | "update:value" | "valueChange", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
28
|
+
value: {
|
|
29
|
+
type: PropType<CalendarValue>;
|
|
30
|
+
default: undefined;
|
|
31
|
+
};
|
|
32
|
+
defaultValue: PropType<CalendarValue>;
|
|
33
|
+
mode: PropType<"single" | "range">;
|
|
34
|
+
defaultFocusedValue: StringConstructor;
|
|
35
|
+
locale: StringConstructor;
|
|
36
|
+
calendarSystem: PropType<CalendarProps["calendarSystem"]>;
|
|
37
|
+
min: StringConstructor;
|
|
38
|
+
max: StringConstructor;
|
|
39
|
+
isDateUnavailable: PropType<(date: string) => boolean>;
|
|
40
|
+
disabled: BooleanConstructor;
|
|
41
|
+
readOnly: BooleanConstructor;
|
|
42
|
+
fixedWeeks: BooleanConstructor;
|
|
43
|
+
id: StringConstructor;
|
|
44
|
+
}>> & Readonly<{
|
|
45
|
+
onMonthChange?: ((...args: any[]) => any) | undefined;
|
|
46
|
+
"onUpdate:value"?: ((...args: any[]) => any) | undefined;
|
|
47
|
+
onValueChange?: ((...args: any[]) => any) | undefined;
|
|
48
|
+
}>, {
|
|
49
|
+
value: CalendarValue;
|
|
50
|
+
disabled: boolean;
|
|
51
|
+
readOnly: boolean;
|
|
52
|
+
fixedWeeks: boolean;
|
|
53
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
54
|
+
Heading: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
55
|
+
[key: string]: any;
|
|
56
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
57
|
+
Previous: import("vue").Component;
|
|
58
|
+
Next: import("vue").Component;
|
|
59
|
+
Grid: import("vue").Component;
|
|
60
|
+
Weekdays: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
61
|
+
[key: string]: any;
|
|
62
|
+
}>[], {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
63
|
+
HeadCell: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
64
|
+
weekday: {
|
|
65
|
+
type: PropType<CalendarWeekday>;
|
|
66
|
+
required: true;
|
|
67
|
+
};
|
|
68
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
69
|
+
[key: string]: any;
|
|
70
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
71
|
+
weekday: {
|
|
72
|
+
type: PropType<CalendarWeekday>;
|
|
73
|
+
required: true;
|
|
74
|
+
};
|
|
75
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
76
|
+
Weeks: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
77
|
+
[key: string]: any;
|
|
78
|
+
}>[], {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
79
|
+
Cell: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
80
|
+
date: {
|
|
81
|
+
type: StringConstructor;
|
|
82
|
+
required: true;
|
|
83
|
+
};
|
|
84
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
85
|
+
[key: string]: any;
|
|
86
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
87
|
+
date: {
|
|
88
|
+
type: StringConstructor;
|
|
89
|
+
required: true;
|
|
90
|
+
};
|
|
91
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
92
|
+
Day: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
93
|
+
date: {
|
|
94
|
+
type: StringConstructor;
|
|
95
|
+
required: true;
|
|
96
|
+
};
|
|
97
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
98
|
+
[key: string]: any;
|
|
99
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
100
|
+
date: {
|
|
101
|
+
type: StringConstructor;
|
|
102
|
+
required: true;
|
|
103
|
+
};
|
|
104
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
105
|
+
};
|
|
106
|
+
export { scope as calendarScope };
|
|
107
|
+
//# sourceMappingURL=calendar.d.ts.map
|
package/src/calendar.js
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { useDirectionAround } from "./direction-context.js";
|
|
2
|
+
import { context, controller, fromSignal, optional, partComponent } from "./runtime.js";
|
|
3
|
+
import { within } from "@kirana-ui/core";
|
|
4
|
+
import { Fragment, defineComponent, h, useId } from "vue";
|
|
5
|
+
import { createCalendar } from "@kirana-ui/core/calendar";
|
|
6
|
+
// src/calendar.ts
|
|
7
|
+
const scope = context("Calendar");
|
|
8
|
+
const RootElement = partComponent("CalendarRootElement", "div", () => scope.use().root);
|
|
9
|
+
/** `v-model:value`, `@value-change="(value, details) => …"`, `@month-change="(month) => …"`. */
|
|
10
|
+
const Root = defineComponent({
|
|
11
|
+
name: "CalendarRoot",
|
|
12
|
+
inheritAttrs: false,
|
|
13
|
+
props: {
|
|
14
|
+
value: optional([String, Object]),
|
|
15
|
+
defaultValue: [String, Object],
|
|
16
|
+
mode: String,
|
|
17
|
+
defaultFocusedValue: String,
|
|
18
|
+
locale: String,
|
|
19
|
+
calendarSystem: Object,
|
|
20
|
+
min: String,
|
|
21
|
+
max: String,
|
|
22
|
+
isDateUnavailable: Function,
|
|
23
|
+
disabled: Boolean,
|
|
24
|
+
readOnly: Boolean,
|
|
25
|
+
fixedWeeks: Boolean,
|
|
26
|
+
id: String
|
|
27
|
+
},
|
|
28
|
+
emits: [
|
|
29
|
+
"update:value",
|
|
30
|
+
"valueChange",
|
|
31
|
+
"monthChange"
|
|
32
|
+
],
|
|
33
|
+
setup(props, { attrs, slots, emit }) {
|
|
34
|
+
const generated = useId();
|
|
35
|
+
const direction = useDirectionAround();
|
|
36
|
+
scope.provide(controller(within(createCalendar, { direction }), () => ({
|
|
37
|
+
id: props.id ?? generated,
|
|
38
|
+
value: props.value,
|
|
39
|
+
defaultValue: props.defaultValue,
|
|
40
|
+
mode: props.mode,
|
|
41
|
+
defaultFocusedValue: props.defaultFocusedValue,
|
|
42
|
+
locale: props.locale,
|
|
43
|
+
calendarSystem: props.calendarSystem,
|
|
44
|
+
min: props.min,
|
|
45
|
+
max: props.max,
|
|
46
|
+
isDateUnavailable: props.isDateUnavailable,
|
|
47
|
+
disabled: props.disabled,
|
|
48
|
+
readOnly: props.readOnly,
|
|
49
|
+
fixedWeeks: props.fixedWeeks,
|
|
50
|
+
onValueChange(value, details) {
|
|
51
|
+
emit("valueChange", value, details);
|
|
52
|
+
if (!details.canceled) emit("update:value", value);
|
|
53
|
+
},
|
|
54
|
+
onMonthChange: (month) => emit("monthChange", month)
|
|
55
|
+
})));
|
|
56
|
+
return () => h(RootElement, attrs, slots);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
const HeadingElement = partComponent("CalendarHeadingElement", "div", () => scope.use().heading);
|
|
60
|
+
/** Names the month shown, unless it is given something else to say. */
|
|
61
|
+
const Heading = defineComponent({
|
|
62
|
+
name: "CalendarHeading",
|
|
63
|
+
inheritAttrs: false,
|
|
64
|
+
setup(_, { attrs, slots }) {
|
|
65
|
+
const title = fromSignal(scope.use().title);
|
|
66
|
+
return () => h(HeadingElement, attrs, slots.default ?? (() => title.value));
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
/** Its slot once for each day of the week, in the locale's order: `v-slot="{ weekday }"`. */
|
|
70
|
+
const Weekdays = defineComponent({
|
|
71
|
+
name: "CalendarWeekdays",
|
|
72
|
+
setup(_, { slots }) {
|
|
73
|
+
const weekdays = fromSignal(scope.use().weekdays);
|
|
74
|
+
return () => weekdays.value.map((weekday) => h(Fragment, { key: weekday.index }, slots.default?.({ weekday })));
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
/** Its slot once for each week of the month shown: `v-slot="{ week }"`. */
|
|
78
|
+
const Weeks = defineComponent({
|
|
79
|
+
name: "CalendarWeeks",
|
|
80
|
+
setup(_, { slots }) {
|
|
81
|
+
const weeks = fromSignal(scope.use().weeks);
|
|
82
|
+
return () => weeks.value.map((week) => h(Fragment, { key: week[0].date }, slots.default?.({ week })));
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
const HeadCell = defineComponent({
|
|
86
|
+
name: "CalendarHeadCell",
|
|
87
|
+
inheritAttrs: false,
|
|
88
|
+
props: { weekday: {
|
|
89
|
+
type: Object,
|
|
90
|
+
required: true
|
|
91
|
+
} },
|
|
92
|
+
setup(props, { attrs, slots }) {
|
|
93
|
+
const part = scope.use().headCell(props.weekday);
|
|
94
|
+
const Element = partComponent("CalendarHeadCellElement", "th", () => part);
|
|
95
|
+
return () => h(Element, attrs, slots);
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
const dated = (name, tag, member) => defineComponent({
|
|
99
|
+
name,
|
|
100
|
+
inheritAttrs: false,
|
|
101
|
+
props: { date: {
|
|
102
|
+
type: String,
|
|
103
|
+
required: true
|
|
104
|
+
} },
|
|
105
|
+
setup(props, { attrs, slots }) {
|
|
106
|
+
const part = scope.use()[member](props.date);
|
|
107
|
+
const Element = partComponent(`${name}Element`, tag, () => part);
|
|
108
|
+
return () => h(Element, attrs, slots);
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
const Calendar = {
|
|
112
|
+
Root,
|
|
113
|
+
Heading,
|
|
114
|
+
Previous: partComponent("CalendarPrevious", "button", () => scope.use().previous),
|
|
115
|
+
Next: partComponent("CalendarNext", "button", () => scope.use().next),
|
|
116
|
+
Grid: partComponent("CalendarGrid", "table", () => scope.use().grid),
|
|
117
|
+
Weekdays,
|
|
118
|
+
HeadCell,
|
|
119
|
+
Weeks,
|
|
120
|
+
Cell: dated("CalendarCell", "td", "cell"),
|
|
121
|
+
Day: dated("CalendarDay", "button", "day")
|
|
122
|
+
};
|
|
123
|
+
export { Calendar, scope as calendarScope };
|
|
124
|
+
|
|
125
|
+
//# sourceMappingURL=calendar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendar.js","names":[],"sources":["../../../../packages/vue/src/calendar.ts"],"sourcesContent":["import { within } from \"@kirana-ui/core\"\nimport type { ChangeDetails } from \"@kirana-ui/core\"\nimport { createCalendar } from \"@kirana-ui/core/calendar\"\nimport type {\n Calendar as Controller,\n CalendarProps,\n CalendarValue,\n CalendarWeekday,\n} from \"@kirana-ui/core/calendar\"\nimport { Fragment, defineComponent, h, useId } from \"vue\"\nimport type { PropType } from \"vue\"\n\nimport { useDirectionAround } from \"./direction-context.ts\"\nimport { context, controller, fromSignal, optional, partComponent } from \"./runtime.ts\"\n\nconst scope = context<Controller>(\"Calendar\")\n/** For a component made of this one's parts: a date picker. */\nexport { scope as calendarScope }\n\nconst RootElement = partComponent(\"CalendarRootElement\", \"div\", () => scope.use().root)\n\n/** `v-model:value`, `@value-change=\"(value, details) => …\"`, `@month-change=\"(month) => …\"`. */\nconst Root = defineComponent({\n name: \"CalendarRoot\",\n inheritAttrs: false,\n props: {\n value: optional([String, Object] as PropType<CalendarValue>),\n defaultValue: [String, Object] as PropType<CalendarValue>,\n mode: String as PropType<\"single\" | \"range\">,\n defaultFocusedValue: String,\n locale: String,\n calendarSystem: Object as PropType<CalendarProps[\"calendarSystem\"]>,\n min: String,\n max: String,\n isDateUnavailable: Function as PropType<(date: string) => boolean>,\n disabled: Boolean,\n readOnly: Boolean,\n fixedWeeks: Boolean,\n id: String,\n },\n emits: [\"update:value\", \"valueChange\", \"monthChange\"],\n setup(props, { attrs, slots, emit }) {\n const generated = useId()\n const direction = useDirectionAround()\n scope.provide(\n controller(within(createCalendar, { direction }), () => ({\n id: props.id ?? generated,\n value: props.value,\n defaultValue: props.defaultValue,\n mode: props.mode,\n defaultFocusedValue: props.defaultFocusedValue,\n locale: props.locale,\n calendarSystem: props.calendarSystem,\n min: props.min,\n max: props.max,\n isDateUnavailable: props.isDateUnavailable,\n disabled: props.disabled,\n readOnly: props.readOnly,\n fixedWeeks: props.fixedWeeks,\n onValueChange(value: CalendarValue, details: ChangeDetails) {\n emit(\"valueChange\", value, details)\n if (!details.canceled) emit(\"update:value\", value)\n },\n onMonthChange: (month: string) => emit(\"monthChange\", month),\n }))\n )\n return () => h(RootElement, attrs, slots)\n },\n})\n\nconst HeadingElement = partComponent(\"CalendarHeadingElement\", \"div\", () => scope.use().heading)\n\n/** Names the month shown, unless it is given something else to say. */\nconst Heading = defineComponent({\n name: \"CalendarHeading\",\n inheritAttrs: false,\n setup(_, { attrs, slots }) {\n const title = fromSignal(scope.use().title)\n return () => h(HeadingElement, attrs, slots.default ?? (() => title.value))\n },\n})\n\n/** Its slot once for each day of the week, in the locale's order: `v-slot=\"{ weekday }\"`. */\nconst Weekdays = defineComponent({\n name: \"CalendarWeekdays\",\n setup(_, { slots }) {\n const weekdays = fromSignal(scope.use().weekdays)\n return () =>\n weekdays.value.map((weekday) =>\n h(Fragment, { key: weekday.index }, slots.default?.({ weekday }))\n )\n },\n})\n\n/** Its slot once for each week of the month shown: `v-slot=\"{ week }\"`. */\nconst Weeks = defineComponent({\n name: \"CalendarWeeks\",\n setup(_, { slots }) {\n const weeks = fromSignal(scope.use().weeks)\n return () =>\n weeks.value.map((week) => h(Fragment, { key: week[0]!.date }, slots.default?.({ week })))\n },\n})\n\nconst HeadCell = defineComponent({\n name: \"CalendarHeadCell\",\n inheritAttrs: false,\n props: { weekday: { type: Object as PropType<CalendarWeekday>, required: true } },\n setup(props, { attrs, slots }) {\n const part = scope.use().headCell(props.weekday)\n const Element = partComponent(\"CalendarHeadCellElement\", \"th\", () => part)\n return () => h(Element, attrs, slots)\n },\n})\n\nconst dated = (name: string, tag: string, member: \"cell\" | \"day\") =>\n defineComponent({\n name,\n inheritAttrs: false,\n props: { date: { type: String, required: true } },\n setup(props, { attrs, slots }) {\n const part = scope.use()[member](props.date)\n const Element = partComponent(`${name}Element`, tag, () => part)\n return () => h(Element, attrs, slots)\n },\n })\n\nexport const Calendar = {\n Root,\n Heading,\n Previous: partComponent(\"CalendarPrevious\", \"button\", () => scope.use().previous),\n Next: partComponent(\"CalendarNext\", \"button\", () => scope.use().next),\n Grid: partComponent(\"CalendarGrid\", \"table\", () => scope.use().grid),\n Weekdays,\n HeadCell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M,IAAI,CAAC,CAAC,OAAO,CAAC,MAAM,IAAI;EAC3C,MAAM,UAAU,cAAc,GAAG,KAAK,UAAU,WAAW,IAAI;EAC/D,aAAa,EAAE,SAAS,OAAO,KAAK;CACtC;AACF,CAAC;AAEH,MAAa,WAAW;CACtB;CACA;CACA,UAAU,cAAc,oBAAoB,gBAAgB,MAAM,IAAI,CAAC,CAAC,QAAQ;CAChF,MAAM,cAAc,gBAAgB,gBAAgB,MAAM,IAAI,CAAC,CAAC,IAAI;CACpE,MAAM,cAAc,gBAAgB,eAAe,MAAM,IAAI,CAAC,CAAC,IAAI;CACnE;CACA;CACA;CACA,MAAM,MAAM,gBAAgB,MAAM,MAAM;CACxC,KAAK,MAAM,eAAe,UAAU,KAAK;AAC3C"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Orientation } from "@kirana-ui/core";
|
|
2
|
+
import { PropType } from "vue";
|
|
3
|
+
export declare const Carousel: {
|
|
4
|
+
Root: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
5
|
+
index: {
|
|
6
|
+
type: NumberConstructor;
|
|
7
|
+
default: undefined;
|
|
8
|
+
};
|
|
9
|
+
defaultIndex: NumberConstructor;
|
|
10
|
+
orientation: PropType<Orientation>;
|
|
11
|
+
loop: BooleanConstructor;
|
|
12
|
+
id: StringConstructor;
|
|
13
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
14
|
+
[key: string]: any;
|
|
15
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("indexChange" | "update:index")[], "indexChange" | "update:index", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
16
|
+
index: {
|
|
17
|
+
type: NumberConstructor;
|
|
18
|
+
default: undefined;
|
|
19
|
+
};
|
|
20
|
+
defaultIndex: NumberConstructor;
|
|
21
|
+
orientation: PropType<Orientation>;
|
|
22
|
+
loop: BooleanConstructor;
|
|
23
|
+
id: StringConstructor;
|
|
24
|
+
}>> & Readonly<{
|
|
25
|
+
onIndexChange?: ((...args: any[]) => any) | undefined;
|
|
26
|
+
"onUpdate:index"?: ((...args: any[]) => any) | undefined;
|
|
27
|
+
}>, {
|
|
28
|
+
index: number;
|
|
29
|
+
loop: boolean;
|
|
30
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
31
|
+
Viewport: import("vue").Component;
|
|
32
|
+
Item: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
33
|
+
index: {
|
|
34
|
+
type: NumberConstructor;
|
|
35
|
+
required: true;
|
|
36
|
+
};
|
|
37
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
38
|
+
[key: string]: any;
|
|
39
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
40
|
+
index: {
|
|
41
|
+
type: NumberConstructor;
|
|
42
|
+
required: true;
|
|
43
|
+
};
|
|
44
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
45
|
+
Previous: import("vue").Component;
|
|
46
|
+
Next: import("vue").Component;
|
|
47
|
+
Indicator: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
48
|
+
index: {
|
|
49
|
+
type: NumberConstructor;
|
|
50
|
+
required: true;
|
|
51
|
+
};
|
|
52
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
53
|
+
[key: string]: any;
|
|
54
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
55
|
+
index: {
|
|
56
|
+
type: NumberConstructor;
|
|
57
|
+
required: true;
|
|
58
|
+
};
|
|
59
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
60
|
+
};
|
|
61
|
+
//# sourceMappingURL=carousel.d.ts.map
|
package/src/carousel.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { useDirectionAround } from "./direction-context.js";
|
|
2
|
+
import { context, controller, optional, partComponent } from "./runtime.js";
|
|
3
|
+
import { within } from "@kirana-ui/core";
|
|
4
|
+
import { defineComponent, h, useId } from "vue";
|
|
5
|
+
import { createCarousel } from "@kirana-ui/core/carousel";
|
|
6
|
+
// src/carousel.ts
|
|
7
|
+
const scope = context("Carousel");
|
|
8
|
+
const RootElement = partComponent("CarouselRootElement", "div", () => scope.use().root);
|
|
9
|
+
/** `v-model:index`, and `@index-change="(index, details) => …"`. */
|
|
10
|
+
const Root = defineComponent({
|
|
11
|
+
name: "CarouselRoot",
|
|
12
|
+
inheritAttrs: false,
|
|
13
|
+
props: {
|
|
14
|
+
index: optional(Number),
|
|
15
|
+
defaultIndex: Number,
|
|
16
|
+
orientation: String,
|
|
17
|
+
loop: Boolean,
|
|
18
|
+
id: String
|
|
19
|
+
},
|
|
20
|
+
emits: ["update:index", "indexChange"],
|
|
21
|
+
setup(props, { attrs, slots, emit }) {
|
|
22
|
+
const generated = useId();
|
|
23
|
+
const direction = useDirectionAround();
|
|
24
|
+
scope.provide(controller(within(createCarousel, { direction }), () => ({
|
|
25
|
+
id: props.id ?? generated,
|
|
26
|
+
index: props.index,
|
|
27
|
+
defaultIndex: props.defaultIndex,
|
|
28
|
+
orientation: props.orientation,
|
|
29
|
+
loop: props.loop,
|
|
30
|
+
onIndexChange: (index, details) => {
|
|
31
|
+
emit("indexChange", index, details);
|
|
32
|
+
if (!details.canceled) emit("update:index", index);
|
|
33
|
+
}
|
|
34
|
+
})));
|
|
35
|
+
return () => h(RootElement, attrs, slots);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
const Viewport = partComponent("CarouselViewport", "div", () => scope.use().viewport);
|
|
39
|
+
const Previous = partComponent("CarouselPrevious", "button", () => scope.use().previous);
|
|
40
|
+
const Next = partComponent("CarouselNext", "button", () => scope.use().next);
|
|
41
|
+
const Carousel = {
|
|
42
|
+
Root,
|
|
43
|
+
Viewport,
|
|
44
|
+
Item: defineComponent({
|
|
45
|
+
name: "CarouselItem",
|
|
46
|
+
inheritAttrs: false,
|
|
47
|
+
props: { index: {
|
|
48
|
+
type: Number,
|
|
49
|
+
required: true
|
|
50
|
+
} },
|
|
51
|
+
setup(props, { attrs, slots }) {
|
|
52
|
+
const part = scope.use().item(props.index);
|
|
53
|
+
const Element = partComponent("CarouselItemElement", "div", () => part);
|
|
54
|
+
return () => h(Element, attrs, slots);
|
|
55
|
+
}
|
|
56
|
+
}),
|
|
57
|
+
Previous,
|
|
58
|
+
Next,
|
|
59
|
+
Indicator: defineComponent({
|
|
60
|
+
name: "CarouselIndicator",
|
|
61
|
+
inheritAttrs: false,
|
|
62
|
+
props: { index: {
|
|
63
|
+
type: Number,
|
|
64
|
+
required: true
|
|
65
|
+
} },
|
|
66
|
+
setup(props, { attrs, slots }) {
|
|
67
|
+
const part = scope.use().indicator(props.index);
|
|
68
|
+
const Element = partComponent("CarouselIndicatorElement", "button", () => part);
|
|
69
|
+
return () => h(Element, attrs, slots);
|
|
70
|
+
}
|
|
71
|
+
})
|
|
72
|
+
};
|
|
73
|
+
export { Carousel };
|
|
74
|
+
|
|
75
|
+
//# sourceMappingURL=carousel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"carousel.js","names":[],"sources":["../../../../packages/vue/src/carousel.ts"],"sourcesContent":["import { within } from \"@kirana-ui/core\"\nimport type { ChangeDetails, Orientation } from \"@kirana-ui/core\"\nimport { createCarousel } from \"@kirana-ui/core/carousel\"\nimport type { Carousel as Controller } from \"@kirana-ui/core/carousel\"\nimport { defineComponent, h, useId } from \"vue\"\nimport type { PropType } from \"vue\"\n\nimport { useDirectionAround } from \"./direction-context.ts\"\nimport { context, controller, optional, partComponent } from \"./runtime.ts\"\n\nconst scope = context<Controller>(\"Carousel\")\n\nconst RootElement = partComponent(\"CarouselRootElement\", \"div\", () => scope.use().root)\n\n/** `v-model:index`, and `@index-change=\"(index, details) => …\"`. */\nconst Root = defineComponent({\n name: \"CarouselRoot\",\n inheritAttrs: false,\n props: {\n index: optional(Number),\n defaultIndex: Number,\n orientation: String as PropType<Orientation>,\n loop: Boolean,\n id: String,\n },\n emits: [\"update:index\", \"indexChange\"],\n setup(props, { attrs, slots, emit }) {\n const generated = useId()\n const direction = useDirectionAround()\n scope.provide(\n controller(within(createCarousel, { direction }), () => ({\n id: props.id ?? generated,\n index: props.index,\n defaultIndex: props.defaultIndex,\n orientation: props.orientation,\n loop: props.loop,\n onIndexChange: (index: number, details: ChangeDetails) => {\n emit(\"indexChange\", index, details)\n if (!details.canceled) emit(\"update:index\", index)\n },\n }))\n )\n return () => h(RootElement, attrs, slots)\n },\n})\n\nconst Viewport = partComponent(\"CarouselViewport\", \"div\", () => scope.use().viewport)\nconst Previous = partComponent(\"CarouselPrevious\", \"button\", () => scope.use().previous)\nconst Next = partComponent(\"CarouselNext\", \"button\", () => scope.use().next)\n\nconst Item = defineComponent({\n name: \"CarouselItem\",\n inheritAttrs: false,\n props: { index: { type: Number, required: true } },\n setup(props, { attrs, slots }) {\n const part = scope.use().item(props.index)\n const Element = partComponent(\"CarouselItemElement\", \"div\", () => part)\n return () => h(Element, attrs, slots)\n },\n})\n\nconst Indicator = defineComponent({\n name: \"CarouselIndicator\",\n inheritAttrs: false,\n props: { index: { type: Number, required: true } },\n setup(props, { attrs, slots }) {\n const part = scope.use().indicator(props.index)\n const Element = partComponent(\"CarouselIndicatorElement\", \"button\", () => part)\n return () => h(Element, attrs, slots)\n },\n})\n\nexport const Carousel = { Root, Viewport, Item, Previous, Next, Indicator }\n"],"mappings":";;;;;;AAUA,MAAM,QAAQ,QAAoB,UAAU;AAE5C,MAAM,cAAc,cAAc,uBAAuB,aAAa,MAAM,IAAI,CAAC,CAAC,IAA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;GAAE,MAAM;GAAQ,UAAU;EAAK,EAAE;EACjD,MAAM,OAAO,EAAE,OAAO,SAAS;GAC7B,MAAM,OAAO,MAAM,IAAI,CAAC,CAAC,UAAU,MAAM,KAAK;GAC9C,MAAM,UAAU,cAAc,4BAA4B,gBAAgB,IAAI;GAC9E,aAAa,EAAE,SAAS,OAAO,KAAK;EACtC;CACF,CAEgE;AAAU"}
|
package/src/checkbox.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export declare const Checkbox: {
|
|
|
10
10
|
readOnly: BooleanConstructor;
|
|
11
11
|
required: BooleanConstructor;
|
|
12
12
|
name: StringConstructor;
|
|
13
|
+
form: StringConstructor;
|
|
13
14
|
value: StringConstructor;
|
|
14
15
|
id: StringConstructor;
|
|
15
16
|
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
@@ -25,6 +26,7 @@ export declare const Checkbox: {
|
|
|
25
26
|
readOnly: BooleanConstructor;
|
|
26
27
|
required: BooleanConstructor;
|
|
27
28
|
name: StringConstructor;
|
|
29
|
+
form: StringConstructor;
|
|
28
30
|
value: StringConstructor;
|
|
29
31
|
id: StringConstructor;
|
|
30
32
|
}>> & Readonly<{
|
package/src/checkbox.js
CHANGED
|
@@ -19,6 +19,7 @@ const Root = defineComponent({
|
|
|
19
19
|
readOnly: Boolean,
|
|
20
20
|
required: Boolean,
|
|
21
21
|
name: String,
|
|
22
|
+
form: String,
|
|
22
23
|
value: String,
|
|
23
24
|
id: String
|
|
24
25
|
},
|
|
@@ -35,6 +36,7 @@ const Root = defineComponent({
|
|
|
35
36
|
readOnly: props.readOnly,
|
|
36
37
|
required: props.required,
|
|
37
38
|
name: props.name,
|
|
39
|
+
form: props.form,
|
|
38
40
|
value: props.value,
|
|
39
41
|
onCheckedChange(checked, details) {
|
|
40
42
|
emit("checkedChange", checked, details);
|