@kirana-ui/vue 0.0.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/LICENSE +1 -1
- package/llms.txt +1838 -0
- package/package.json +230 -6
- package/src/accordion.d.ts +78 -0
- package/src/accordion.js +92 -0
- package/src/accordion.js.map +1 -0
- package/src/alert-dialog.d.ts +2 -0
- package/src/alert-dialog.js +1 -0
- 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/avatar.d.ts +16 -0
- package/src/avatar.js +40 -0
- package/src/avatar.js.map +1 -0
- package/src/button.d.ts +23 -0
- package/src/button.js +22 -0
- package/src/button.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 +53 -0
- package/src/checkbox.js +64 -0
- package/src/checkbox.js.map +1 -0
- package/src/collapsible.d.ts +39 -0
- package/src/collapsible.js +50 -0
- package/src/collapsible.js.map +1 -0
- 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 +154 -0
- package/src/dialog.js +133 -0
- package/src/dialog.js.map +1 -0
- package/src/direction-context.d.ts +5 -0
- package/src/direction-context.js +9 -0
- package/src/direction-context.js.map +1 -0
- package/src/direction.d.ts +16 -0
- package/src/direction.js +25 -0
- package/src/direction.js.map +1 -0
- package/src/drawer.d.ts +2 -0
- package/src/drawer.js +1 -0
- package/src/field-context.d.ts +6 -0
- package/src/field-context.js +17 -0
- package/src/field-context.js.map +1 -0
- package/src/field.d.ts +49 -0
- package/src/field.js +79 -0
- package/src/field.js.map +1 -0
- package/src/fieldset.d.ts +18 -0
- package/src/fieldset.js +35 -0
- package/src/fieldset.js.map +1 -0
- package/src/form.d.ts +22 -0
- package/src/form.js +29 -0
- package/src/form.js.map +1 -0
- package/src/hover-card.d.ts +46 -0
- package/src/hover-card.js +7 -0
- package/src/hover-card.js.map +1 -0
- package/src/hover-popup.d.ts +49 -0
- package/src/hover-popup.js +62 -0
- package/src/hover-popup.js.map +1 -0
- package/src/index.d.ts +48 -0
- package/src/index.js +47 -0
- 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/meter.d.ts +34 -0
- package/src/meter.js +7 -0
- package/src/meter.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 +44 -0
- package/src/popover.js +60 -0
- package/src/popover.js.map +1 -0
- package/src/progress.d.ts +34 -0
- package/src/progress.js +7 -0
- package/src/progress.js.map +1 -0
- 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 +78 -0
- package/src/radio-group.js +97 -0
- package/src/radio-group.js.map +1 -0
- 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 +48 -0
- package/src/runtime.js +149 -0
- package/src/runtime.js.map +1 -0
- 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 +154 -0
- package/src/select.js +191 -0
- package/src/select.js.map +1 -0
- package/src/separator.d.ts +10 -0
- package/src/separator.js +17 -0
- package/src/separator.js.map +1 -0
- package/src/slider.d.ts +83 -0
- package/src/slider.js +94 -0
- package/src/slider.js.map +1 -0
- package/src/switch.d.ts +42 -0
- package/src/switch.js +51 -0
- package/src/switch.js.map +1 -0
- package/src/tabs.d.ts +101 -0
- package/src/tabs.js +106 -0
- package/src/tabs.js.map +1 -0
- 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 +39 -0
- package/src/toggle.js +46 -0
- package/src/toggle.js.map +1 -0
- 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 +46 -0
- package/src/tooltip.js +7 -0
- package/src/tooltip.js.map +1 -0
- package/src/value-bar.d.ts +38 -0
- package/src/value-bar.js +52 -0
- package/src/value-bar.js.map +1 -0
- package/README.md +0 -7
- package/index.js +0 -5
|
@@ -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,\n Weeks,\n Cell: dated(\"CalendarCell\", \"td\", \"cell\"),\n Day: dated(\"CalendarDay\", \"button\", \"day\"),\n}\n"],"mappings":"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"}
|
|
@@ -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,IAAI;;AAGtF,MAAM,OAAO,gBAAgB;CAC3B,MAAM;CACN,cAAc;CACd,OAAO;EACL,OAAO,SAAS,MAAM;EACtB,cAAc;EACd,aAAa;EACb,MAAM;EACN,IAAI;CACN;CACA,OAAO,CAAC,gBAAgB,aAAa;CACrC,MAAM,OAAO,EAAE,OAAO,OAAO,QAAQ;EACnC,MAAM,YAAY,MAAM;EACxB,MAAM,YAAY,mBAAmB;EACrC,MAAM,QACJ,WAAW,OAAO,gBAAgB,EAAE,UAAU,CAAC,UAAU;GACvD,IAAI,MAAM,MAAM;GAChB,OAAO,MAAM;GACb,cAAc,MAAM;GACpB,aAAa,MAAM;GACnB,MAAM,MAAM;GACZ,gBAAgB,OAAe,YAA2B;IACxD,KAAK,eAAe,OAAO,OAAO;IAClC,IAAI,CAAC,QAAQ,UAAU,KAAK,gBAAgB,KAAK;GACnD;EACF,EAAE,CACJ;EACA,aAAa,EAAE,aAAa,OAAO,KAAK;CAC1C;AACF,CAAC;AAED,MAAM,WAAW,cAAc,oBAAoB,aAAa,MAAM,IAAI,CAAC,CAAC,QAAQ;AACpF,MAAM,WAAW,cAAc,oBAAoB,gBAAgB,MAAM,IAAI,CAAC,CAAC,QAAQ;AACvF,MAAM,OAAO,cAAc,gBAAgB,gBAAgB,MAAM,IAAI,CAAC,CAAC,IAAI;AAwB3E,MAAa,WAAW;CAAE;CAAM;CAAU,MAtB7B,gBAAgB;EAC3B,MAAM;EACN,cAAc;EACd,OAAO,EAAE,OAAO;GAAE,MAAM;GAAQ,UAAU;EAAK,EAAE;EACjD,MAAM,OAAO,EAAE,OAAO,SAAS;GAC7B,MAAM,OAAO,MAAM,IAAI,CAAC,CAAC,KAAK,MAAM,KAAK;GACzC,MAAM,UAAU,cAAc,uBAAuB,aAAa,IAAI;GACtE,aAAa,EAAE,SAAS,OAAO,KAAK;EACtC;CACF,CAa0C;CAAM;CAAU;CAAM,WAX9C,gBAAgB;EAChC,MAAM;EACN,cAAc;EACd,OAAO,EAAE,OAAO;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"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export declare const Checkbox: {
|
|
2
|
+
Root: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
3
|
+
checked: {
|
|
4
|
+
type: BooleanConstructor;
|
|
5
|
+
default: undefined;
|
|
6
|
+
};
|
|
7
|
+
defaultChecked: BooleanConstructor;
|
|
8
|
+
indeterminate: BooleanConstructor;
|
|
9
|
+
disabled: BooleanConstructor;
|
|
10
|
+
readOnly: BooleanConstructor;
|
|
11
|
+
required: BooleanConstructor;
|
|
12
|
+
name: StringConstructor;
|
|
13
|
+
form: StringConstructor;
|
|
14
|
+
value: StringConstructor;
|
|
15
|
+
id: StringConstructor;
|
|
16
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
17
|
+
[key: string]: any;
|
|
18
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("checkedChange" | "update:checked")[], "checkedChange" | "update:checked", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
19
|
+
checked: {
|
|
20
|
+
type: BooleanConstructor;
|
|
21
|
+
default: undefined;
|
|
22
|
+
};
|
|
23
|
+
defaultChecked: BooleanConstructor;
|
|
24
|
+
indeterminate: BooleanConstructor;
|
|
25
|
+
disabled: BooleanConstructor;
|
|
26
|
+
readOnly: BooleanConstructor;
|
|
27
|
+
required: BooleanConstructor;
|
|
28
|
+
name: StringConstructor;
|
|
29
|
+
form: StringConstructor;
|
|
30
|
+
value: StringConstructor;
|
|
31
|
+
id: StringConstructor;
|
|
32
|
+
}>> & Readonly<{
|
|
33
|
+
onCheckedChange?: ((...args: any[]) => any) | undefined;
|
|
34
|
+
"onUpdate:checked"?: ((...args: any[]) => any) | undefined;
|
|
35
|
+
}>, {
|
|
36
|
+
checked: boolean;
|
|
37
|
+
defaultChecked: boolean;
|
|
38
|
+
indeterminate: boolean;
|
|
39
|
+
disabled: boolean;
|
|
40
|
+
readOnly: boolean;
|
|
41
|
+
required: boolean;
|
|
42
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
43
|
+
Indicator: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
44
|
+
keepMounted: BooleanConstructor;
|
|
45
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
46
|
+
[key: string]: any;
|
|
47
|
+
}> | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
48
|
+
keepMounted: BooleanConstructor;
|
|
49
|
+
}>> & Readonly<{}>, {
|
|
50
|
+
keepMounted: boolean;
|
|
51
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=checkbox.d.ts.map
|
package/src/checkbox.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { useFieldAround } from "./field-context.js";
|
|
2
|
+
import { context, controller, fromSignal, optional, partComponent } from "./runtime.js";
|
|
3
|
+
import { within } from "@kirana-ui/core";
|
|
4
|
+
import { defineComponent, h, useId } from "vue";
|
|
5
|
+
import { createCheckbox } from "@kirana-ui/core/checkbox";
|
|
6
|
+
// src/checkbox.ts
|
|
7
|
+
const scope = context("Checkbox");
|
|
8
|
+
const RootElement = partComponent("CheckboxRootElement", "span", () => scope.use().root);
|
|
9
|
+
const Input = partComponent("CheckboxInput", "input", () => scope.use().input);
|
|
10
|
+
/** `v-model:checked`, or `checked` with `@checked-change="(checked, details) => …"`. */
|
|
11
|
+
const Root = defineComponent({
|
|
12
|
+
name: "CheckboxRoot",
|
|
13
|
+
inheritAttrs: false,
|
|
14
|
+
props: {
|
|
15
|
+
checked: optional(Boolean),
|
|
16
|
+
defaultChecked: Boolean,
|
|
17
|
+
indeterminate: Boolean,
|
|
18
|
+
disabled: Boolean,
|
|
19
|
+
readOnly: Boolean,
|
|
20
|
+
required: Boolean,
|
|
21
|
+
name: String,
|
|
22
|
+
form: String,
|
|
23
|
+
value: String,
|
|
24
|
+
id: String
|
|
25
|
+
},
|
|
26
|
+
emits: ["update:checked", "checkedChange"],
|
|
27
|
+
setup(props, { attrs, slots, emit }) {
|
|
28
|
+
const generated = useId();
|
|
29
|
+
const field = useFieldAround();
|
|
30
|
+
scope.provide(controller(within(createCheckbox, { field }), () => ({
|
|
31
|
+
id: props.id ?? generated,
|
|
32
|
+
checked: props.checked,
|
|
33
|
+
defaultChecked: props.defaultChecked,
|
|
34
|
+
indeterminate: props.indeterminate,
|
|
35
|
+
disabled: props.disabled,
|
|
36
|
+
readOnly: props.readOnly,
|
|
37
|
+
required: props.required,
|
|
38
|
+
name: props.name,
|
|
39
|
+
form: props.form,
|
|
40
|
+
value: props.value,
|
|
41
|
+
onCheckedChange(checked, details) {
|
|
42
|
+
emit("checkedChange", checked, details);
|
|
43
|
+
if (!details.canceled) emit("update:checked", checked);
|
|
44
|
+
}
|
|
45
|
+
})));
|
|
46
|
+
return () => h(RootElement, attrs, () => [slots.default?.(), h(Input)]);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
const IndicatorElement = partComponent("CheckboxIndicatorElement", "span", () => scope.use().indicator);
|
|
50
|
+
const Checkbox = {
|
|
51
|
+
Root,
|
|
52
|
+
Indicator: defineComponent({
|
|
53
|
+
name: "CheckboxIndicator",
|
|
54
|
+
inheritAttrs: false,
|
|
55
|
+
props: { keepMounted: Boolean },
|
|
56
|
+
setup(props, { attrs, slots }) {
|
|
57
|
+
const mounted = fromSignal(scope.use().indicatorMounted);
|
|
58
|
+
return () => mounted.value || props.keepMounted ? h(IndicatorElement, attrs, slots) : null;
|
|
59
|
+
}
|
|
60
|
+
})
|
|
61
|
+
};
|
|
62
|
+
export { Checkbox };
|
|
63
|
+
|
|
64
|
+
//# sourceMappingURL=checkbox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkbox.js","names":[],"sources":["../../../../packages/vue/src/checkbox.ts"],"sourcesContent":["import { within } from \"@kirana-ui/core\"\nimport type { ChangeDetails } from \"@kirana-ui/core\"\nimport { createCheckbox } from \"@kirana-ui/core/checkbox\"\nimport type { Checkbox as Controller } from \"@kirana-ui/core/checkbox\"\nimport { defineComponent, h, useId } from \"vue\"\n\nimport { useFieldAround } from \"./field-context.ts\"\nimport { context, controller, fromSignal, optional, partComponent } from \"./runtime.ts\"\n\nconst scope = context<Controller>(\"Checkbox\")\n\nconst RootElement = partComponent(\"CheckboxRootElement\", \"span\", () => scope.use().root)\nconst Input = partComponent(\"CheckboxInput\", \"input\", () => scope.use().input)\n\n/** `v-model:checked`, or `checked` with `@checked-change=\"(checked, details) => …\"`. */\nconst Root = defineComponent({\n name: \"CheckboxRoot\",\n inheritAttrs: false,\n props: {\n checked: optional(Boolean),\n defaultChecked: Boolean,\n indeterminate: Boolean,\n disabled: Boolean,\n readOnly: Boolean,\n required: Boolean,\n name: String,\n form: String,\n value: String,\n id: String,\n },\n emits: [\"update:checked\", \"checkedChange\"],\n setup(props, { attrs, slots, emit }) {\n const generated = useId()\n const field = useFieldAround()\n scope.provide(\n controller(within(createCheckbox, { field }), () => ({\n id: props.id ?? generated,\n checked: props.checked,\n defaultChecked: props.defaultChecked,\n indeterminate: props.indeterminate,\n disabled: props.disabled,\n readOnly: props.readOnly,\n required: props.required,\n name: props.name,\n form: props.form,\n value: props.value,\n onCheckedChange(checked: boolean, details: ChangeDetails) {\n emit(\"checkedChange\", checked, details)\n if (!details.canceled) emit(\"update:checked\", checked)\n },\n }))\n )\n return () => h(RootElement, attrs, () => [slots.default?.(), h(Input)])\n },\n})\n\nconst IndicatorElement = partComponent(\n \"CheckboxIndicatorElement\",\n \"span\",\n () => scope.use().indicator\n)\n\n/** `keep-mounted` keeps the mark in the page while the box is unchecked. */\nconst Indicator = defineComponent({\n name: \"CheckboxIndicator\",\n inheritAttrs: false,\n props: { keepMounted: Boolean },\n setup(props, { attrs, slots }) {\n const mounted = fromSignal(scope.use().indicatorMounted)\n return () => (mounted.value || props.keepMounted ? h(IndicatorElement, attrs, slots) : null)\n },\n})\n\nexport const Checkbox = { Root, Indicator }\n"],"mappings":";;;;;;AASA,MAAM,QAAQ,QAAoB,UAAU;AAE5C,MAAM,cAAc,cAAc,uBAAuB,cAAc,MAAM,IAAI,CAAC,CAAC,IAAI;AACvF,MAAM,QAAQ,cAAc,iBAAiB,eAAe,MAAM,IAAI,CAAC,CAAC,KAAK;;AAG7E,MAAM,OAAO,gBAAgB;CAC3B,MAAM;CACN,cAAc;CACd,OAAO;EACL,SAAS,SAAS,OAAO;EACzB,gBAAgB;EAChB,eAAe;EACf,UAAU;EACV,UAAU;EACV,UAAU;EACV,MAAM;EACN,MAAM;EACN,OAAO;EACP,IAAI;CACN;CACA,OAAO,CAAC,kBAAkB,eAAe;CACzC,MAAM,OAAO,EAAE,OAAO,OAAO,QAAQ;EACnC,MAAM,YAAY,MAAM;EACxB,MAAM,QAAQ,eAAe;EAC7B,MAAM,QACJ,WAAW,OAAO,gBAAgB,EAAE,MAAM,CAAC,UAAU;GACnD,IAAI,MAAM,MAAM;GAChB,SAAS,MAAM;GACf,gBAAgB,MAAM;GACtB,eAAe,MAAM;GACrB,UAAU,MAAM;GAChB,UAAU,MAAM;GAChB,UAAU,MAAM;GAChB,MAAM,MAAM;GACZ,MAAM,MAAM;GACZ,OAAO,MAAM;GACb,gBAAgB,SAAkB,SAAwB;IACxD,KAAK,iBAAiB,SAAS,OAAO;IACtC,IAAI,CAAC,QAAQ,UAAU,KAAK,kBAAkB,OAAO;GACvD;EACF,EAAE,CACJ;EACA,aAAa,EAAE,aAAa,aAAa,CAAC,MAAM,UAAU,GAAG,EAAE,KAAK,CAAC,CAAC;CACxE;AACF,CAAC;AAED,MAAM,mBAAmB,cACvB,4BACA,cACM,MAAM,IAAI,CAAC,CAAC,SACpB;AAaA,MAAa,WAAW;CAAE;CAAM,WAVd,gBAAgB;EAChC,MAAM;EACN,cAAc;EACd,OAAO,EAAE,aAAa,QAAQ;EAC9B,MAAM,OAAO,EAAE,OAAO,SAAS;GAC7B,MAAM,UAAU,WAAW,MAAM,IAAI,CAAC,CAAC,gBAAgB;GACvD,aAAc,QAAQ,SAAS,MAAM,cAAc,EAAE,kBAAkB,OAAO,KAAK,IAAI;EACzF;CACF,CAEgC;AAAU"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export declare const Collapsible: {
|
|
2
|
+
Root: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
3
|
+
open: {
|
|
4
|
+
type: BooleanConstructor;
|
|
5
|
+
default: undefined;
|
|
6
|
+
};
|
|
7
|
+
defaultOpen: BooleanConstructor;
|
|
8
|
+
disabled: BooleanConstructor;
|
|
9
|
+
id: StringConstructor;
|
|
10
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
11
|
+
[key: string]: any;
|
|
12
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("openChange" | "update:open")[], "openChange" | "update:open", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
13
|
+
open: {
|
|
14
|
+
type: BooleanConstructor;
|
|
15
|
+
default: undefined;
|
|
16
|
+
};
|
|
17
|
+
defaultOpen: BooleanConstructor;
|
|
18
|
+
disabled: BooleanConstructor;
|
|
19
|
+
id: StringConstructor;
|
|
20
|
+
}>> & Readonly<{
|
|
21
|
+
onOpenChange?: ((...args: any[]) => any) | undefined;
|
|
22
|
+
"onUpdate:open"?: ((...args: any[]) => any) | undefined;
|
|
23
|
+
}>, {
|
|
24
|
+
open: boolean;
|
|
25
|
+
defaultOpen: boolean;
|
|
26
|
+
disabled: boolean;
|
|
27
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
28
|
+
Trigger: import("vue").Component;
|
|
29
|
+
Panel: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
30
|
+
keepMounted: BooleanConstructor;
|
|
31
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
32
|
+
[key: string]: any;
|
|
33
|
+
}> | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
34
|
+
keepMounted: BooleanConstructor;
|
|
35
|
+
}>> & Readonly<{}>, {
|
|
36
|
+
keepMounted: boolean;
|
|
37
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=collapsible.d.ts.map
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { context, controller, fromSignal, optional, partComponent } from "./runtime.js";
|
|
2
|
+
import { defineComponent, h, useId } from "vue";
|
|
3
|
+
import { createCollapsible } from "@kirana-ui/core/collapsible";
|
|
4
|
+
// src/collapsible.ts
|
|
5
|
+
const scope = context("Collapsible");
|
|
6
|
+
const RootElement = partComponent("CollapsibleRootElement", "div", () => scope.use().root);
|
|
7
|
+
/** `v-model:open`, or `open` with `@open-change="(open, details) => …"`. */
|
|
8
|
+
const Root = defineComponent({
|
|
9
|
+
name: "CollapsibleRoot",
|
|
10
|
+
inheritAttrs: false,
|
|
11
|
+
props: {
|
|
12
|
+
open: optional(Boolean),
|
|
13
|
+
defaultOpen: Boolean,
|
|
14
|
+
disabled: Boolean,
|
|
15
|
+
id: String
|
|
16
|
+
},
|
|
17
|
+
emits: ["update:open", "openChange"],
|
|
18
|
+
setup(props, { attrs, slots, emit }) {
|
|
19
|
+
const generated = useId();
|
|
20
|
+
scope.provide(controller(createCollapsible, () => ({
|
|
21
|
+
id: props.id ?? generated,
|
|
22
|
+
open: props.open,
|
|
23
|
+
defaultOpen: props.defaultOpen,
|
|
24
|
+
disabled: props.disabled,
|
|
25
|
+
onOpenChange(open, details) {
|
|
26
|
+
emit("openChange", open, details);
|
|
27
|
+
if (!details.canceled) emit("update:open", open);
|
|
28
|
+
}
|
|
29
|
+
})));
|
|
30
|
+
return () => h(RootElement, attrs, slots);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
const Trigger = partComponent("CollapsibleTrigger", "button", () => scope.use().trigger);
|
|
34
|
+
const PanelElement = partComponent("CollapsiblePanelElement", "div", () => scope.use().panel);
|
|
35
|
+
const Collapsible = {
|
|
36
|
+
Root,
|
|
37
|
+
Trigger,
|
|
38
|
+
Panel: defineComponent({
|
|
39
|
+
name: "CollapsiblePanel",
|
|
40
|
+
inheritAttrs: false,
|
|
41
|
+
props: { keepMounted: Boolean },
|
|
42
|
+
setup(props, { attrs, slots }) {
|
|
43
|
+
const mounted = fromSignal(scope.use().mounted);
|
|
44
|
+
return () => mounted.value || props.keepMounted ? h(PanelElement, attrs, slots) : null;
|
|
45
|
+
}
|
|
46
|
+
})
|
|
47
|
+
};
|
|
48
|
+
export { Collapsible };
|
|
49
|
+
|
|
50
|
+
//# sourceMappingURL=collapsible.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collapsible.js","names":[],"sources":["../../../../packages/vue/src/collapsible.ts"],"sourcesContent":["import type { ChangeDetails } from \"@kirana-ui/core\"\nimport { createCollapsible } from \"@kirana-ui/core/collapsible\"\nimport type { Collapsible as Controller } from \"@kirana-ui/core/collapsible\"\nimport { defineComponent, h, useId } from \"vue\"\n\nimport { context, controller, fromSignal, optional, partComponent } from \"./runtime.ts\"\n\nconst scope = context<Controller>(\"Collapsible\")\n\nconst RootElement = partComponent(\"CollapsibleRootElement\", \"div\", () => scope.use().root)\n\n/** `v-model:open`, or `open` with `@open-change=\"(open, details) => …\"`. */\nconst Root = defineComponent({\n name: \"CollapsibleRoot\",\n inheritAttrs: false,\n props: {\n open: optional(Boolean),\n defaultOpen: Boolean,\n disabled: Boolean,\n id: String,\n },\n emits: [\"update:open\", \"openChange\"],\n setup(props, { attrs, slots, emit }) {\n const generated = useId()\n scope.provide(\n controller(createCollapsible, () => ({\n id: props.id ?? generated,\n open: props.open,\n defaultOpen: props.defaultOpen,\n disabled: props.disabled,\n onOpenChange(open: boolean, details: ChangeDetails) {\n emit(\"openChange\", open, details)\n if (!details.canceled) emit(\"update:open\", open)\n },\n }))\n )\n return () => h(RootElement, attrs, slots)\n },\n})\n\nconst Trigger = partComponent(\"CollapsibleTrigger\", \"button\", () => scope.use().trigger)\n\nconst PanelElement = partComponent(\"CollapsiblePanelElement\", \"div\", () => scope.use().panel)\n\n/** `keep-mounted` keeps the closed panel in the page, `hidden`. */\nconst Panel = defineComponent({\n name: \"CollapsiblePanel\",\n inheritAttrs: false,\n props: { keepMounted: Boolean },\n setup(props, { attrs, slots }) {\n const mounted = fromSignal(scope.use().mounted)\n return () => (mounted.value || props.keepMounted ? h(PanelElement, attrs, slots) : null)\n },\n})\n\nexport const Collapsible = { Root, Trigger, Panel }\n"],"mappings":";;;;AAOA,MAAM,QAAQ,QAAoB,aAAa;AAE/C,MAAM,cAAc,cAAc,0BAA0B,aAAa,MAAM,IAAI,CAAC,CAAC,IAAI;;AAGzF,MAAM,OAAO,gBAAgB;CAC3B,MAAM;CACN,cAAc;CACd,OAAO;EACL,MAAM,SAAS,OAAO;EACtB,aAAa;EACb,UAAU;EACV,IAAI;CACN;CACA,OAAO,CAAC,eAAe,YAAY;CACnC,MAAM,OAAO,EAAE,OAAO,OAAO,QAAQ;EACnC,MAAM,YAAY,MAAM;EACxB,MAAM,QACJ,WAAW,0BAA0B;GACnC,IAAI,MAAM,MAAM;GAChB,MAAM,MAAM;GACZ,aAAa,MAAM;GACnB,UAAU,MAAM;GAChB,aAAa,MAAe,SAAwB;IAClD,KAAK,cAAc,MAAM,OAAO;IAChC,IAAI,CAAC,QAAQ,UAAU,KAAK,eAAe,IAAI;GACjD;EACF,EAAE,CACJ;EACA,aAAa,EAAE,aAAa,OAAO,KAAK;CAC1C;AACF,CAAC;AAED,MAAM,UAAU,cAAc,sBAAsB,gBAAgB,MAAM,IAAI,CAAC,CAAC,OAAO;AAEvF,MAAM,eAAe,cAAc,2BAA2B,aAAa,MAAM,IAAI,CAAC,CAAC,KAAK;AAa5F,MAAa,cAAc;CAAE;CAAM;CAAS,OAV9B,gBAAgB;EAC5B,MAAM;EACN,cAAc;EACd,OAAO,EAAE,aAAa,QAAQ;EAC9B,MAAM,OAAO,EAAE,OAAO,SAAS;GAC7B,MAAM,UAAU,WAAW,MAAM,IAAI,CAAC,CAAC,OAAO;GAC9C,aAAc,QAAQ,SAAS,MAAM,cAAc,EAAE,cAAc,OAAO,KAAK,IAAI;EACrF;CACF,CAE4C;AAAM"}
|