@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/src/command.d.ts
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { PropType } from "vue";
|
|
2
|
+
import { CommandProps } from "@kirana-ui/core/command";
|
|
3
|
+
export declare const Command: {
|
|
4
|
+
Root: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
5
|
+
inputValue: StringConstructor;
|
|
6
|
+
defaultInputValue: StringConstructor;
|
|
7
|
+
filter: {
|
|
8
|
+
type: PropType<CommandProps["filter"]>;
|
|
9
|
+
default: undefined;
|
|
10
|
+
};
|
|
11
|
+
loop: BooleanConstructor;
|
|
12
|
+
disabled: BooleanConstructor;
|
|
13
|
+
id: StringConstructor;
|
|
14
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
15
|
+
[key: string]: any;
|
|
16
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("inputValueChange" | "select" | "update:inputValue")[], "inputValueChange" | "select" | "update:inputValue", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
17
|
+
inputValue: StringConstructor;
|
|
18
|
+
defaultInputValue: StringConstructor;
|
|
19
|
+
filter: {
|
|
20
|
+
type: PropType<CommandProps["filter"]>;
|
|
21
|
+
default: undefined;
|
|
22
|
+
};
|
|
23
|
+
loop: BooleanConstructor;
|
|
24
|
+
disabled: BooleanConstructor;
|
|
25
|
+
id: StringConstructor;
|
|
26
|
+
}>> & Readonly<{
|
|
27
|
+
onInputValueChange?: ((...args: any[]) => any) | undefined;
|
|
28
|
+
onSelect?: ((...args: any[]) => any) | undefined;
|
|
29
|
+
"onUpdate:inputValue"?: ((...args: any[]) => any) | undefined;
|
|
30
|
+
}>, {
|
|
31
|
+
filter: ((label: string, query: string, keywords: readonly string[]) => boolean) | null | undefined;
|
|
32
|
+
loop: boolean;
|
|
33
|
+
disabled: boolean;
|
|
34
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
35
|
+
Input: import("vue").Component;
|
|
36
|
+
List: import("vue").Component;
|
|
37
|
+
Empty: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
38
|
+
[key: string]: any;
|
|
39
|
+
}> | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
40
|
+
Group: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
41
|
+
id: StringConstructor;
|
|
42
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
43
|
+
[key: string]: any;
|
|
44
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
45
|
+
id: StringConstructor;
|
|
46
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
47
|
+
GroupHeading: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
48
|
+
[key: string]: any;
|
|
49
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
50
|
+
Item: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
51
|
+
value: {
|
|
52
|
+
type: StringConstructor;
|
|
53
|
+
required: true;
|
|
54
|
+
};
|
|
55
|
+
disabled: {
|
|
56
|
+
type: BooleanConstructor;
|
|
57
|
+
default: undefined;
|
|
58
|
+
};
|
|
59
|
+
label: StringConstructor;
|
|
60
|
+
keywords: PropType<readonly string[]>;
|
|
61
|
+
id: StringConstructor;
|
|
62
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
63
|
+
[key: string]: any;
|
|
64
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
65
|
+
value: {
|
|
66
|
+
type: StringConstructor;
|
|
67
|
+
required: true;
|
|
68
|
+
};
|
|
69
|
+
disabled: {
|
|
70
|
+
type: BooleanConstructor;
|
|
71
|
+
default: undefined;
|
|
72
|
+
};
|
|
73
|
+
label: StringConstructor;
|
|
74
|
+
keywords: PropType<readonly string[]>;
|
|
75
|
+
id: StringConstructor;
|
|
76
|
+
}>> & Readonly<{}>, {
|
|
77
|
+
disabled: boolean;
|
|
78
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
79
|
+
Separator: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
80
|
+
alwaysRender: BooleanConstructor;
|
|
81
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
82
|
+
[key: string]: any;
|
|
83
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
84
|
+
alwaysRender: BooleanConstructor;
|
|
85
|
+
}>> & Readonly<{}>, {
|
|
86
|
+
alwaysRender: boolean;
|
|
87
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
88
|
+
};
|
|
89
|
+
//# sourceMappingURL=command.d.ts.map
|
package/src/command.js
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { context, controller, fromSignal, optional, partComponent, toSignal } from "./runtime.js";
|
|
2
|
+
import { defineComponent, h, inject, provide, useId } from "vue";
|
|
3
|
+
import { createCommand } from "@kirana-ui/core/command";
|
|
4
|
+
// src/command.ts
|
|
5
|
+
const scope = context("Command");
|
|
6
|
+
const GROUP = Symbol("CommandGroup");
|
|
7
|
+
const RootElement = partComponent("CommandRootElement", "div", () => scope.use().root);
|
|
8
|
+
/** `v-model:inputValue`; `@select` hears the item chosen. */
|
|
9
|
+
const Root = defineComponent({
|
|
10
|
+
name: "CommandRoot",
|
|
11
|
+
inheritAttrs: false,
|
|
12
|
+
props: {
|
|
13
|
+
inputValue: String,
|
|
14
|
+
defaultInputValue: String,
|
|
15
|
+
filter: {
|
|
16
|
+
type: null,
|
|
17
|
+
default: void 0
|
|
18
|
+
},
|
|
19
|
+
loop: Boolean,
|
|
20
|
+
disabled: Boolean,
|
|
21
|
+
id: String
|
|
22
|
+
},
|
|
23
|
+
emits: [
|
|
24
|
+
"update:inputValue",
|
|
25
|
+
"inputValueChange",
|
|
26
|
+
"select"
|
|
27
|
+
],
|
|
28
|
+
setup(props, { attrs, slots, emit }) {
|
|
29
|
+
const generated = useId();
|
|
30
|
+
scope.provide(controller(createCommand, () => ({
|
|
31
|
+
id: props.id ?? generated,
|
|
32
|
+
inputValue: props.inputValue,
|
|
33
|
+
defaultInputValue: props.defaultInputValue,
|
|
34
|
+
filter: props.filter,
|
|
35
|
+
loop: props.loop,
|
|
36
|
+
disabled: props.disabled,
|
|
37
|
+
onInputValueChange(value, details) {
|
|
38
|
+
emit("inputValueChange", value, details);
|
|
39
|
+
if (!details.canceled) emit("update:inputValue", value);
|
|
40
|
+
},
|
|
41
|
+
onSelect: (value, details) => emit("select", value, details)
|
|
42
|
+
})));
|
|
43
|
+
return () => h(RootElement, attrs, slots);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
const EmptyElement = partComponent("CommandEmptyElement", "div", () => scope.use().emptyPart);
|
|
47
|
+
/** Drawn while no item is shown for what was typed. */
|
|
48
|
+
const Empty = defineComponent({
|
|
49
|
+
name: "CommandEmpty",
|
|
50
|
+
inheritAttrs: false,
|
|
51
|
+
setup(_props, { attrs, slots }) {
|
|
52
|
+
const empty = fromSignal(scope.use().empty);
|
|
53
|
+
return () => empty.value ? h(EmptyElement, attrs, slots) : null;
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
/** Items under a `<Command.GroupHeading>`. Hidden while none of them is shown. */
|
|
57
|
+
const Group = defineComponent({
|
|
58
|
+
name: "CommandGroup",
|
|
59
|
+
inheritAttrs: false,
|
|
60
|
+
props: { id: String },
|
|
61
|
+
setup(props, { attrs, slots }) {
|
|
62
|
+
const generated = useId();
|
|
63
|
+
const group = scope.use().group(props.id ?? generated);
|
|
64
|
+
provide(GROUP, group);
|
|
65
|
+
const Element = partComponent("CommandGroupElement", "div", () => group.part);
|
|
66
|
+
return () => h(Element, attrs, slots);
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
const GroupHeading = defineComponent({
|
|
70
|
+
name: "CommandGroupHeading",
|
|
71
|
+
inheritAttrs: false,
|
|
72
|
+
setup(_props, { attrs, slots }) {
|
|
73
|
+
const part = inject(GROUP, void 0)?.heading ?? scope.use().heading;
|
|
74
|
+
const Element = partComponent("CommandGroupHeadingElement", "div", () => part);
|
|
75
|
+
return () => h(Element, attrs, slots);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
/** `label` is what is filtered, the item's text when left out; `keywords` are other words for it. */
|
|
79
|
+
const Item = defineComponent({
|
|
80
|
+
name: "CommandItem",
|
|
81
|
+
inheritAttrs: false,
|
|
82
|
+
props: {
|
|
83
|
+
value: {
|
|
84
|
+
type: String,
|
|
85
|
+
required: true
|
|
86
|
+
},
|
|
87
|
+
disabled: optional(Boolean),
|
|
88
|
+
label: String,
|
|
89
|
+
keywords: Array,
|
|
90
|
+
id: String
|
|
91
|
+
},
|
|
92
|
+
setup(props, { attrs, slots }) {
|
|
93
|
+
const generated = useId();
|
|
94
|
+
const options = toSignal(() => ({
|
|
95
|
+
disabled: props.disabled,
|
|
96
|
+
label: props.label,
|
|
97
|
+
keywords: props.keywords,
|
|
98
|
+
id: props.id ?? generated
|
|
99
|
+
}));
|
|
100
|
+
const part = scope.use().item(props.value, () => options.get(), inject(GROUP, void 0));
|
|
101
|
+
const Element = partComponent("CommandItemElement", "div", () => part);
|
|
102
|
+
return () => h(Element, attrs, slots);
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
/** A line between groups: gone while something is typed, unless `always-render`. */
|
|
106
|
+
const Separator = defineComponent({
|
|
107
|
+
name: "CommandSeparator",
|
|
108
|
+
inheritAttrs: false,
|
|
109
|
+
props: { alwaysRender: Boolean },
|
|
110
|
+
setup(props, { attrs, slots }) {
|
|
111
|
+
const options = toSignal(() => ({ alwaysRender: props.alwaysRender }));
|
|
112
|
+
const part = scope.use().separator(() => options.get().alwaysRender);
|
|
113
|
+
const Element = partComponent("CommandSeparatorElement", "div", () => part);
|
|
114
|
+
return () => h(Element, attrs, slots);
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
const Command = {
|
|
118
|
+
Root,
|
|
119
|
+
Input: partComponent("CommandInput", "input", () => scope.use().input),
|
|
120
|
+
List: partComponent("CommandList", "div", () => scope.use().list),
|
|
121
|
+
Empty,
|
|
122
|
+
Group,
|
|
123
|
+
GroupHeading,
|
|
124
|
+
Item,
|
|
125
|
+
Separator
|
|
126
|
+
};
|
|
127
|
+
export { Command };
|
|
128
|
+
|
|
129
|
+
//# sourceMappingURL=command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command.js","names":[],"sources":["../../../../packages/vue/src/command.ts"],"sourcesContent":["import type { ChangeDetails } from \"@kirana-ui/core\"\nimport { createCommand } from \"@kirana-ui/core/command\"\nimport type { CommandGroup, CommandProps, Command as Controller } from \"@kirana-ui/core/command\"\nimport { defineComponent, h, inject, provide, useId } from \"vue\"\nimport type { InjectionKey, PropType } from \"vue\"\n\nimport { context, controller, fromSignal, optional, partComponent, toSignal } from \"./runtime.ts\"\n\nconst scope = context<Controller>(\"Command\")\nconst GROUP: InjectionKey<CommandGroup> = Symbol(\"CommandGroup\")\n\nconst RootElement = partComponent(\"CommandRootElement\", \"div\", () => scope.use().root)\n\n/** `v-model:inputValue`; `@select` hears the item chosen. */\nconst Root = defineComponent({\n name: \"CommandRoot\",\n inheritAttrs: false,\n props: {\n inputValue: String,\n defaultInputValue: String,\n filter: {\n type: null as unknown as PropType<CommandProps[\"filter\"]>,\n default: undefined,\n },\n loop: Boolean,\n disabled: Boolean,\n id: String,\n },\n emits: [\"update:inputValue\", \"inputValueChange\", \"select\"],\n setup(props, { attrs, slots, emit }) {\n const generated = useId()\n scope.provide(\n controller(createCommand, () => ({\n id: props.id ?? generated,\n inputValue: props.inputValue,\n defaultInputValue: props.defaultInputValue,\n filter: props.filter,\n loop: props.loop,\n disabled: props.disabled,\n onInputValueChange(value: string, details: ChangeDetails) {\n emit(\"inputValueChange\", value, details)\n if (!details.canceled) emit(\"update:inputValue\", value)\n },\n onSelect: (value: string, details: ChangeDetails) => emit(\"select\", value, details),\n }))\n )\n return () => h(RootElement, attrs, slots)\n },\n})\n\nconst EmptyElement = partComponent(\"CommandEmptyElement\", \"div\", () => scope.use().emptyPart)\n\n/** Drawn while no item is shown for what was typed. */\nconst Empty = defineComponent({\n name: \"CommandEmpty\",\n inheritAttrs: false,\n setup(_props, { attrs, slots }) {\n const empty = fromSignal(scope.use().empty)\n return () => (empty.value ? h(EmptyElement, attrs, slots) : null)\n },\n})\n\n/** Items under a `<Command.GroupHeading>`. Hidden while none of them is shown. */\nconst Group = defineComponent({\n name: \"CommandGroup\",\n inheritAttrs: false,\n props: { id: String },\n setup(props, { attrs, slots }) {\n const generated = useId()\n const group = scope.use().group(props.id ?? generated)\n provide(GROUP, group)\n const Element = partComponent(\"CommandGroupElement\", \"div\", () => group.part)\n return () => h(Element, attrs, slots)\n },\n})\n\nconst GroupHeading = defineComponent({\n name: \"CommandGroupHeading\",\n inheritAttrs: false,\n setup(_props, { attrs, slots }) {\n const part = inject(GROUP, undefined)?.heading ?? scope.use().heading\n const Element = partComponent(\"CommandGroupHeadingElement\", \"div\", () => part)\n return () => h(Element, attrs, slots)\n },\n})\n\n/** `label` is what is filtered, the item's text when left out; `keywords` are other words for it. */\nconst Item = defineComponent({\n name: \"CommandItem\",\n inheritAttrs: false,\n props: {\n value: { type: String, required: true },\n disabled: optional(Boolean),\n label: String,\n keywords: Array as PropType<readonly string[]>,\n id: String,\n },\n setup(props, { attrs, slots }) {\n const generated = useId()\n const options = toSignal(() => ({\n disabled: props.disabled,\n label: props.label,\n keywords: props.keywords,\n id: props.id ?? generated,\n }))\n const part = scope.use().item(props.value, () => options.get(), inject(GROUP, undefined))\n const Element = partComponent(\"CommandItemElement\", \"div\", () => part)\n return () => h(Element, attrs, slots)\n },\n})\n\n/** A line between groups: gone while something is typed, unless `always-render`. */\nconst Separator = defineComponent({\n name: \"CommandSeparator\",\n inheritAttrs: false,\n props: { alwaysRender: Boolean },\n setup(props, { attrs, slots }) {\n const options = toSignal(() => ({ alwaysRender: props.alwaysRender }))\n const part = scope.use().separator(() => options.get().alwaysRender)\n const Element = partComponent(\"CommandSeparatorElement\", \"div\", () => part)\n return () => h(Element, attrs, slots)\n },\n})\n\nexport const Command = {\n Root,\n Input: partComponent(\"CommandInput\", \"input\", () => scope.use().input),\n List: partComponent(\"CommandList\", \"div\", () => scope.use().list),\n Empty,\n Group,\n GroupHeading,\n Item,\n Separator,\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ContextMenu } from "./menu.js";
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { PropType } from "vue";
|
|
2
|
+
import { DateField as DateField$1, DateFieldProps, DateFieldSegment } from "@kirana-ui/core/date-field";
|
|
3
|
+
declare const scope: {
|
|
4
|
+
provide(controller: DateField$1): DateField$1;
|
|
5
|
+
use(): DateField$1;
|
|
6
|
+
};
|
|
7
|
+
export declare const DateField: {
|
|
8
|
+
Root: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
9
|
+
value: {
|
|
10
|
+
type: PropType<string | null>;
|
|
11
|
+
default: undefined;
|
|
12
|
+
};
|
|
13
|
+
defaultValue: PropType<string | null>;
|
|
14
|
+
locale: StringConstructor;
|
|
15
|
+
min: StringConstructor;
|
|
16
|
+
max: StringConstructor;
|
|
17
|
+
placeholders: PropType<DateFieldProps["placeholders"]>;
|
|
18
|
+
disabled: BooleanConstructor;
|
|
19
|
+
readOnly: BooleanConstructor;
|
|
20
|
+
required: BooleanConstructor;
|
|
21
|
+
name: StringConstructor;
|
|
22
|
+
form: StringConstructor;
|
|
23
|
+
id: StringConstructor;
|
|
24
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
25
|
+
[key: string]: any;
|
|
26
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:value" | "valueChange")[], "update:value" | "valueChange", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
27
|
+
value: {
|
|
28
|
+
type: PropType<string | null>;
|
|
29
|
+
default: undefined;
|
|
30
|
+
};
|
|
31
|
+
defaultValue: PropType<string | null>;
|
|
32
|
+
locale: StringConstructor;
|
|
33
|
+
min: StringConstructor;
|
|
34
|
+
max: StringConstructor;
|
|
35
|
+
placeholders: PropType<DateFieldProps["placeholders"]>;
|
|
36
|
+
disabled: BooleanConstructor;
|
|
37
|
+
readOnly: BooleanConstructor;
|
|
38
|
+
required: BooleanConstructor;
|
|
39
|
+
name: StringConstructor;
|
|
40
|
+
form: StringConstructor;
|
|
41
|
+
id: StringConstructor;
|
|
42
|
+
}>> & Readonly<{
|
|
43
|
+
"onUpdate:value"?: ((...args: any[]) => any) | undefined;
|
|
44
|
+
onValueChange?: ((...args: any[]) => any) | undefined;
|
|
45
|
+
}>, {
|
|
46
|
+
value: string | null;
|
|
47
|
+
disabled: boolean;
|
|
48
|
+
readOnly: boolean;
|
|
49
|
+
required: boolean;
|
|
50
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
51
|
+
Segments: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
52
|
+
[key: string]: any;
|
|
53
|
+
}>[], {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
54
|
+
Segment: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
55
|
+
segment: {
|
|
56
|
+
type: PropType<DateFieldSegment>;
|
|
57
|
+
required: true;
|
|
58
|
+
};
|
|
59
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
60
|
+
[key: string]: any;
|
|
61
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
62
|
+
segment: {
|
|
63
|
+
type: PropType<DateFieldSegment>;
|
|
64
|
+
required: true;
|
|
65
|
+
};
|
|
66
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
67
|
+
Input: import("vue").Component;
|
|
68
|
+
};
|
|
69
|
+
export { scope as dateFieldScope };
|
|
70
|
+
//# sourceMappingURL=date-field.d.ts.map
|
|
@@ -0,0 +1,77 @@
|
|
|
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 { createDateField } from "@kirana-ui/core/date-field";
|
|
6
|
+
// src/date-field.ts
|
|
7
|
+
const scope = context("DateField");
|
|
8
|
+
const RootElement = partComponent("DateFieldRootElement", "div", () => scope.use().root);
|
|
9
|
+
const DateField = {
|
|
10
|
+
Root: defineComponent({
|
|
11
|
+
name: "DateFieldRoot",
|
|
12
|
+
inheritAttrs: false,
|
|
13
|
+
props: {
|
|
14
|
+
value: optional([String, null]),
|
|
15
|
+
defaultValue: String,
|
|
16
|
+
locale: String,
|
|
17
|
+
min: String,
|
|
18
|
+
max: String,
|
|
19
|
+
placeholders: Object,
|
|
20
|
+
disabled: Boolean,
|
|
21
|
+
readOnly: Boolean,
|
|
22
|
+
required: Boolean,
|
|
23
|
+
name: String,
|
|
24
|
+
form: String,
|
|
25
|
+
id: String
|
|
26
|
+
},
|
|
27
|
+
emits: ["update:value", "valueChange"],
|
|
28
|
+
setup(props, { attrs, slots, emit }) {
|
|
29
|
+
const generated = useId();
|
|
30
|
+
const direction = useDirectionAround();
|
|
31
|
+
scope.provide(controller(within(createDateField, { direction }), () => ({
|
|
32
|
+
id: props.id ?? generated,
|
|
33
|
+
value: props.value,
|
|
34
|
+
defaultValue: props.defaultValue,
|
|
35
|
+
locale: props.locale,
|
|
36
|
+
min: props.min,
|
|
37
|
+
max: props.max,
|
|
38
|
+
placeholders: props.placeholders,
|
|
39
|
+
disabled: props.disabled,
|
|
40
|
+
readOnly: props.readOnly,
|
|
41
|
+
required: props.required,
|
|
42
|
+
name: props.name,
|
|
43
|
+
form: props.form,
|
|
44
|
+
onValueChange(value, details) {
|
|
45
|
+
emit("valueChange", value, details);
|
|
46
|
+
if (!details.canceled) emit("update:value", value);
|
|
47
|
+
}
|
|
48
|
+
})));
|
|
49
|
+
return () => h(RootElement, attrs, slots);
|
|
50
|
+
}
|
|
51
|
+
}),
|
|
52
|
+
Segments: defineComponent({
|
|
53
|
+
name: "DateFieldSegments",
|
|
54
|
+
setup(_, { slots }) {
|
|
55
|
+
const segments = fromSignal(scope.use().segments);
|
|
56
|
+
return () => segments.value.map((segment) => h(Fragment, { key: `${segment.index}-${segment.type}` }, slots.default?.({ segment })));
|
|
57
|
+
}
|
|
58
|
+
}),
|
|
59
|
+
Segment: defineComponent({
|
|
60
|
+
name: "DateFieldSegment",
|
|
61
|
+
inheritAttrs: false,
|
|
62
|
+
props: { segment: {
|
|
63
|
+
type: Object,
|
|
64
|
+
required: true
|
|
65
|
+
} },
|
|
66
|
+
setup(props, { attrs }) {
|
|
67
|
+
const { part, text } = scope.use().segment(props.segment);
|
|
68
|
+
const shown = fromSignal(text);
|
|
69
|
+
const Element = partComponent("DateFieldSegmentElement", "span", () => part);
|
|
70
|
+
return () => h(Element, attrs, () => shown.value);
|
|
71
|
+
}
|
|
72
|
+
}),
|
|
73
|
+
Input: partComponent("DateFieldInput", "input", () => scope.use().input)
|
|
74
|
+
};
|
|
75
|
+
export { DateField, scope as dateFieldScope };
|
|
76
|
+
|
|
77
|
+
//# sourceMappingURL=date-field.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-field.js","names":[],"sources":["../../../../packages/vue/src/date-field.ts"],"sourcesContent":["import { within } from \"@kirana-ui/core\"\nimport type { ChangeDetails } from \"@kirana-ui/core\"\nimport { createDateField } from \"@kirana-ui/core/date-field\"\nimport type {\n DateField as Controller,\n DateFieldProps,\n DateFieldSegment,\n} from \"@kirana-ui/core/date-field\"\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>(\"DateField\")\n/** For a component made of this one's parts: a date picker. */\nexport { scope as dateFieldScope }\n\nconst RootElement = partComponent(\"DateFieldRootElement\", \"div\", () => scope.use().root)\n\n/** `v-model:value`, and `@value-change=\"(value, details) => …\"`. */\nconst Root = defineComponent({\n name: \"DateFieldRoot\",\n inheritAttrs: false,\n props: {\n value: optional([String, null] as unknown as PropType<string | null>),\n defaultValue: String as PropType<string | null>,\n locale: String,\n min: String,\n max: String,\n placeholders: Object as PropType<DateFieldProps[\"placeholders\"]>,\n disabled: Boolean,\n readOnly: Boolean,\n required: Boolean,\n name: String,\n form: String,\n id: String,\n },\n emits: [\"update:value\", \"valueChange\"],\n setup(props, { attrs, slots, emit }) {\n const generated = useId()\n const direction = useDirectionAround()\n scope.provide(\n controller(within(createDateField, { direction }), () => ({\n id: props.id ?? generated,\n value: props.value,\n defaultValue: props.defaultValue,\n locale: props.locale,\n min: props.min,\n max: props.max,\n placeholders: props.placeholders,\n disabled: props.disabled,\n readOnly: props.readOnly,\n required: props.required,\n name: props.name,\n form: props.form,\n onValueChange(value: string | null, details: ChangeDetails) {\n emit(\"valueChange\", value, details)\n if (!details.canceled) emit(\"update:value\", value)\n },\n }))\n )\n return () => h(RootElement, attrs, slots)\n },\n})\n\n/** Its slot once for each piece of the date, in the locale's order: `v-slot=\"{ segment }\"`. */\nconst Segments = defineComponent({\n name: \"DateFieldSegments\",\n setup(_, { slots }) {\n const segments = fromSignal(scope.use().segments)\n return () =>\n segments.value.map((segment) =>\n h(Fragment, { key: `${segment.index}-${segment.type}` }, slots.default?.({ segment }))\n )\n },\n})\n\n/** One piece: a part that is typed, or what stands between two. It writes its own text. */\nconst Segment = defineComponent({\n name: \"DateFieldSegment\",\n inheritAttrs: false,\n props: { segment: { type: Object as PropType<DateFieldSegment>, required: true } },\n setup(props, { attrs }) {\n const { part, text } = scope.use().segment(props.segment)\n const shown = fromSignal(text)\n const Element = partComponent(\"DateFieldSegmentElement\", \"span\", () => part)\n return () => h(Element, attrs, () => shown.value)\n },\n})\n\nconst Input = partComponent(\"DateFieldInput\", \"input\", () => scope.use().input)\n\nexport const DateField = { Root, Segments, Segment, Input }\n"],"mappings":";;;;;;AAcA,MAAM,QAAQ,QAAoB,WAAW;AAI7C,MAAM,cAAc,cAAc,wBAAwB,aAAa,MAAM,IAAI,CAAC,CAAC,IAAI;AA2EvF,MAAa,YAAY;CAAE,MAxEd,gBAAgB;EAC3B,MAAM;EACN,cAAc;EACd,OAAO;GACL,OAAO,SAAS,CAAC,QAAQ,IAAI,CAAuC;GACpE,cAAc;GACd,QAAQ;GACR,KAAK;GACL,KAAK;GACL,cAAc;GACd,UAAU;GACV,UAAU;GACV,UAAU;GACV,MAAM;GACN,MAAM;GACN,IAAI;EACN;EACA,OAAO,CAAC,gBAAgB,aAAa;EACrC,MAAM,OAAO,EAAE,OAAO,OAAO,QAAQ;GACnC,MAAM,YAAY,MAAM;GACxB,MAAM,YAAY,mBAAmB;GACrC,MAAM,QACJ,WAAW,OAAO,iBAAiB,EAAE,UAAU,CAAC,UAAU;IACxD,IAAI,MAAM,MAAM;IAChB,OAAO,MAAM;IACb,cAAc,MAAM;IACpB,QAAQ,MAAM;IACd,KAAK,MAAM;IACX,KAAK,MAAM;IACX,cAAc,MAAM;IACpB,UAAU,MAAM;IAChB,UAAU,MAAM;IAChB,UAAU,MAAM;IAChB,MAAM,MAAM;IACZ,MAAM,MAAM;IACZ,cAAc,OAAsB,SAAwB;KAC1D,KAAK,eAAe,OAAO,OAAO;KAClC,IAAI,CAAC,QAAQ,UAAU,KAAK,gBAAgB,KAAK;IACnD;GACF,EAAE,CACJ;GACA,aAAa,EAAE,aAAa,OAAO,KAAK;EAC1C;CACF,CA6B2B;CAAM,UA1BhB,gBAAgB;EAC/B,MAAM;EACN,MAAM,GAAG,EAAE,SAAS;GAClB,MAAM,WAAW,WAAW,MAAM,IAAI,CAAC,CAAC,QAAQ;GAChD,aACE,SAAS,MAAM,KAAK,YAClB,EAAE,UAAU,EAAE,KAAK,GAAG,QAAQ,MAAM,GAAG,QAAQ,OAAO,GAAG,MAAM,UAAU,EAAE,QAAQ,CAAC,CAAC,CACvF;EACJ;CACF,CAiBiC;CAAU,SAd3B,gBAAgB;EAC9B,MAAM;EACN,cAAc;EACd,OAAO,EAAE,SAAS;GAAE,MAAM;GAAsC,UAAU;EAAK,EAAE;EACjF,MAAM,OAAO,EAAE,SAAS;GACtB,MAAM,EAAE,MAAM,SAAS,MAAM,IAAI,CAAC,CAAC,QAAQ,MAAM,OAAO;GACxD,MAAM,QAAQ,WAAW,IAAI;GAC7B,MAAM,UAAU,cAAc,2BAA2B,cAAc,IAAI;GAC3E,aAAa,EAAE,SAAS,aAAa,MAAM,KAAK;EAClD;CACF,CAI2C;CAAS,OAFtC,cAAc,kBAAkB,eAAe,MAAM,IAAI,CAAC,CAAC,KAErB;AAAM"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { PropType } from "vue";
|
|
2
|
+
import { DatePickerProps } from "@kirana-ui/core/date-picker";
|
|
3
|
+
export declare const DatePicker: {
|
|
4
|
+
Root: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
5
|
+
value: {
|
|
6
|
+
type: PropType<string | null>;
|
|
7
|
+
default: undefined;
|
|
8
|
+
};
|
|
9
|
+
defaultValue: PropType<string | null>;
|
|
10
|
+
open: {
|
|
11
|
+
type: BooleanConstructor;
|
|
12
|
+
default: undefined;
|
|
13
|
+
};
|
|
14
|
+
defaultOpen: BooleanConstructor;
|
|
15
|
+
locale: StringConstructor;
|
|
16
|
+
min: StringConstructor;
|
|
17
|
+
max: StringConstructor;
|
|
18
|
+
isDateUnavailable: PropType<DatePickerProps["isDateUnavailable"]>;
|
|
19
|
+
calendarSystem: PropType<DatePickerProps["calendarSystem"]>;
|
|
20
|
+
fixedWeeks: BooleanConstructor;
|
|
21
|
+
placeholders: PropType<DatePickerProps["placeholders"]>;
|
|
22
|
+
disabled: BooleanConstructor;
|
|
23
|
+
readOnly: BooleanConstructor;
|
|
24
|
+
required: BooleanConstructor;
|
|
25
|
+
name: StringConstructor;
|
|
26
|
+
form: StringConstructor;
|
|
27
|
+
id: StringConstructor;
|
|
28
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
29
|
+
[key: string]: any;
|
|
30
|
+
}>[] | undefined, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("openChange" | "update:open" | "update:value" | "valueChange")[], "openChange" | "update:open" | "update:value" | "valueChange", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
31
|
+
value: {
|
|
32
|
+
type: PropType<string | null>;
|
|
33
|
+
default: undefined;
|
|
34
|
+
};
|
|
35
|
+
defaultValue: PropType<string | null>;
|
|
36
|
+
open: {
|
|
37
|
+
type: BooleanConstructor;
|
|
38
|
+
default: undefined;
|
|
39
|
+
};
|
|
40
|
+
defaultOpen: BooleanConstructor;
|
|
41
|
+
locale: StringConstructor;
|
|
42
|
+
min: StringConstructor;
|
|
43
|
+
max: StringConstructor;
|
|
44
|
+
isDateUnavailable: PropType<DatePickerProps["isDateUnavailable"]>;
|
|
45
|
+
calendarSystem: PropType<DatePickerProps["calendarSystem"]>;
|
|
46
|
+
fixedWeeks: BooleanConstructor;
|
|
47
|
+
placeholders: PropType<DatePickerProps["placeholders"]>;
|
|
48
|
+
disabled: BooleanConstructor;
|
|
49
|
+
readOnly: BooleanConstructor;
|
|
50
|
+
required: BooleanConstructor;
|
|
51
|
+
name: StringConstructor;
|
|
52
|
+
form: StringConstructor;
|
|
53
|
+
id: StringConstructor;
|
|
54
|
+
}>> & Readonly<{
|
|
55
|
+
onOpenChange?: ((...args: any[]) => any) | undefined;
|
|
56
|
+
"onUpdate:open"?: ((...args: any[]) => any) | undefined;
|
|
57
|
+
"onUpdate:value"?: ((...args: any[]) => any) | undefined;
|
|
58
|
+
onValueChange?: ((...args: any[]) => any) | undefined;
|
|
59
|
+
}>, {
|
|
60
|
+
value: string | null;
|
|
61
|
+
open: boolean;
|
|
62
|
+
defaultOpen: boolean;
|
|
63
|
+
fixedWeeks: boolean;
|
|
64
|
+
disabled: boolean;
|
|
65
|
+
readOnly: boolean;
|
|
66
|
+
required: boolean;
|
|
67
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
68
|
+
/** The typed date: what holds its segments and its hidden input. */
|
|
69
|
+
Field: import("vue").Component;
|
|
70
|
+
Segments: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
71
|
+
[key: string]: any;
|
|
72
|
+
}>[], {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
73
|
+
Segment: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
74
|
+
segment: {
|
|
75
|
+
type: PropType<import("@kirana-ui/core/date-field").DateFieldSegment>;
|
|
76
|
+
required: true;
|
|
77
|
+
};
|
|
78
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
79
|
+
[key: string]: any;
|
|
80
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
81
|
+
segment: {
|
|
82
|
+
type: PropType<import("@kirana-ui/core/date-field").DateFieldSegment>;
|
|
83
|
+
required: true;
|
|
84
|
+
};
|
|
85
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
86
|
+
Input: import("vue").Component;
|
|
87
|
+
Trigger: import("vue").Component;
|
|
88
|
+
Portal: import("vue").Component;
|
|
89
|
+
Positioner: import("vue").Component;
|
|
90
|
+
Popup: import("vue").Component;
|
|
91
|
+
/** The calendar: what holds its heading, its buttons and its grid. */
|
|
92
|
+
Calendar: import("vue").Component;
|
|
93
|
+
Heading: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
94
|
+
[key: string]: any;
|
|
95
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
96
|
+
Previous: import("vue").Component;
|
|
97
|
+
Next: import("vue").Component;
|
|
98
|
+
Grid: import("vue").Component;
|
|
99
|
+
Weekdays: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
100
|
+
[key: string]: any;
|
|
101
|
+
}>[], {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
102
|
+
HeadCell: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
103
|
+
weekday: {
|
|
104
|
+
type: PropType<import("@kirana-ui/core/calendar").CalendarWeekday>;
|
|
105
|
+
required: true;
|
|
106
|
+
};
|
|
107
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
108
|
+
[key: string]: any;
|
|
109
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
110
|
+
weekday: {
|
|
111
|
+
type: PropType<import("@kirana-ui/core/calendar").CalendarWeekday>;
|
|
112
|
+
required: true;
|
|
113
|
+
};
|
|
114
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
115
|
+
Weeks: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
116
|
+
[key: string]: any;
|
|
117
|
+
}>[], {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
118
|
+
Cell: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
119
|
+
date: {
|
|
120
|
+
type: StringConstructor;
|
|
121
|
+
required: true;
|
|
122
|
+
};
|
|
123
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
124
|
+
[key: string]: any;
|
|
125
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
126
|
+
date: {
|
|
127
|
+
type: StringConstructor;
|
|
128
|
+
required: true;
|
|
129
|
+
};
|
|
130
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
131
|
+
Day: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
132
|
+
date: {
|
|
133
|
+
type: StringConstructor;
|
|
134
|
+
required: true;
|
|
135
|
+
};
|
|
136
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
137
|
+
[key: string]: any;
|
|
138
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
139
|
+
date: {
|
|
140
|
+
type: StringConstructor;
|
|
141
|
+
required: true;
|
|
142
|
+
};
|
|
143
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
144
|
+
};
|
|
145
|
+
//# sourceMappingURL=date-picker.d.ts.map
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { Calendar, calendarScope as scope$1 } from "./calendar.js";
|
|
2
|
+
import { DateField, dateFieldScope as scope$2 } from "./date-field.js";
|
|
3
|
+
import { useDirectionAround } from "./direction-context.js";
|
|
4
|
+
import { Popover, popoverScope as scope$3 } from "./popover.js";
|
|
5
|
+
import { context, controller, optional, partComponent } from "./runtime.js";
|
|
6
|
+
import { within } from "@kirana-ui/core";
|
|
7
|
+
import { defineComponent, useId } from "vue";
|
|
8
|
+
import { createDatePicker } from "@kirana-ui/core/date-picker";
|
|
9
|
+
// src/date-picker.ts
|
|
10
|
+
const scope = context("DatePicker");
|
|
11
|
+
const DatePicker = {
|
|
12
|
+
Root: defineComponent({
|
|
13
|
+
name: "DatePickerRoot",
|
|
14
|
+
props: {
|
|
15
|
+
value: optional([String, null]),
|
|
16
|
+
defaultValue: String,
|
|
17
|
+
open: optional(Boolean),
|
|
18
|
+
defaultOpen: Boolean,
|
|
19
|
+
locale: String,
|
|
20
|
+
min: String,
|
|
21
|
+
max: String,
|
|
22
|
+
isDateUnavailable: Function,
|
|
23
|
+
calendarSystem: Object,
|
|
24
|
+
fixedWeeks: Boolean,
|
|
25
|
+
placeholders: Object,
|
|
26
|
+
disabled: Boolean,
|
|
27
|
+
readOnly: Boolean,
|
|
28
|
+
required: Boolean,
|
|
29
|
+
name: String,
|
|
30
|
+
form: String,
|
|
31
|
+
id: String
|
|
32
|
+
},
|
|
33
|
+
emits: [
|
|
34
|
+
"update:value",
|
|
35
|
+
"valueChange",
|
|
36
|
+
"update:open",
|
|
37
|
+
"openChange"
|
|
38
|
+
],
|
|
39
|
+
setup(props, { slots, emit }) {
|
|
40
|
+
const generated = useId();
|
|
41
|
+
const made = scope.provide(controller(within(createDatePicker, { direction: useDirectionAround() }), () => ({
|
|
42
|
+
...props,
|
|
43
|
+
id: props.id ?? generated,
|
|
44
|
+
onValueChange(value, details) {
|
|
45
|
+
emit("valueChange", value, details);
|
|
46
|
+
if (!details.canceled) emit("update:value", value);
|
|
47
|
+
},
|
|
48
|
+
onOpenChange(open, details) {
|
|
49
|
+
emit("openChange", open, details);
|
|
50
|
+
if (!details.canceled) emit("update:open", open);
|
|
51
|
+
}
|
|
52
|
+
})));
|
|
53
|
+
scope$2.provide(made.field);
|
|
54
|
+
scope$3.provide(made.popover);
|
|
55
|
+
scope$1.provide(made.calendar);
|
|
56
|
+
return () => slots.default?.();
|
|
57
|
+
}
|
|
58
|
+
}),
|
|
59
|
+
/** The typed date: what holds its segments and its hidden input. */
|
|
60
|
+
Field: partComponent("DatePickerField", "div", () => scope.use().field.root),
|
|
61
|
+
Segments: DateField.Segments,
|
|
62
|
+
Segment: DateField.Segment,
|
|
63
|
+
Input: DateField.Input,
|
|
64
|
+
Trigger: Popover.Trigger,
|
|
65
|
+
Portal: Popover.Portal,
|
|
66
|
+
Positioner: Popover.Positioner,
|
|
67
|
+
Popup: Popover.Popup,
|
|
68
|
+
/** The calendar: what holds its heading, its buttons and its grid. */
|
|
69
|
+
Calendar: partComponent("DatePickerCalendar", "div", () => scope.use().calendar.root),
|
|
70
|
+
Heading: Calendar.Heading,
|
|
71
|
+
Previous: Calendar.Previous,
|
|
72
|
+
Next: Calendar.Next,
|
|
73
|
+
Grid: Calendar.Grid,
|
|
74
|
+
Weekdays: Calendar.Weekdays,
|
|
75
|
+
HeadCell: Calendar.HeadCell,
|
|
76
|
+
Weeks: Calendar.Weeks,
|
|
77
|
+
Cell: Calendar.Cell,
|
|
78
|
+
Day: Calendar.Day
|
|
79
|
+
};
|
|
80
|
+
export { DatePicker };
|
|
81
|
+
|
|
82
|
+
//# sourceMappingURL=date-picker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-picker.js","names":[],"sources":["../../../../packages/vue/src/date-picker.ts"],"sourcesContent":["import { within } from \"@kirana-ui/core\"\nimport type { ChangeDetails } from \"@kirana-ui/core\"\nimport { createDatePicker } from \"@kirana-ui/core/date-picker\"\nimport type { DatePicker as Controller, DatePickerProps } from \"@kirana-ui/core/date-picker\"\nimport { defineComponent, useId } from \"vue\"\nimport type { PropType } from \"vue\"\n\nimport { Calendar, calendarScope } from \"./calendar.ts\"\nimport { DateField, dateFieldScope } from \"./date-field.ts\"\nimport { useDirectionAround } from \"./direction-context.ts\"\nimport { Popover, popoverScope } from \"./popover.ts\"\nimport { context, controller, optional, partComponent } from \"./runtime.ts\"\n\nconst scope = context<Controller>(\"DatePicker\")\n\n/**\n * A date field, and a calendar in a popover, with one value between them. It draws nothing.\n * `v-model:value`, `v-model:open`; the `-change` events carry the details.\n */\nconst Root = defineComponent({\n name: \"DatePickerRoot\",\n props: {\n value: optional([String, null] as unknown as PropType<string | null>),\n defaultValue: String as PropType<string | null>,\n open: optional(Boolean),\n defaultOpen: Boolean,\n locale: String,\n min: String,\n max: String,\n isDateUnavailable: Function as PropType<DatePickerProps[\"isDateUnavailable\"]>,\n calendarSystem: Object as PropType<DatePickerProps[\"calendarSystem\"]>,\n fixedWeeks: Boolean,\n placeholders: Object as PropType<DatePickerProps[\"placeholders\"]>,\n disabled: Boolean,\n readOnly: Boolean,\n required: Boolean,\n name: String,\n form: String,\n id: String,\n },\n emits: [\"update:value\", \"valueChange\", \"update:open\", \"openChange\"],\n setup(props, { slots, emit }) {\n const generated = useId()\n const made = scope.provide(\n controller(within(createDatePicker, { direction: useDirectionAround() }), () => ({\n ...props,\n id: props.id ?? generated,\n onValueChange(value: string | null, details: ChangeDetails) {\n emit(\"valueChange\", value, details)\n if (!details.canceled) emit(\"update:value\", value)\n },\n onOpenChange(open: boolean, details: ChangeDetails) {\n emit(\"openChange\", open, details)\n if (!details.canceled) emit(\"update:open\", open)\n },\n }))\n )\n dateFieldScope.provide(made.field)\n popoverScope.provide(made.popover)\n calendarScope.provide(made.calendar)\n return () => slots.default?.()\n },\n})\n\nexport const DatePicker = {\n Root,\n /** The typed date: what holds its segments and its hidden input. */\n Field: partComponent(\"DatePickerField\", \"div\", () => scope.use().field.root),\n Segments: DateField.Segments,\n Segment: DateField.Segment,\n Input: DateField.Input,\n Trigger: Popover.Trigger,\n Portal: Popover.Portal,\n Positioner: Popover.Positioner,\n Popup: Popover.Popup,\n /** The calendar: what holds its heading, its buttons and its grid. */\n Calendar: partComponent(\"DatePickerCalendar\", \"div\", () => scope.use().calendar.root),\n Heading: Calendar.Heading,\n Previous: Calendar.Previous,\n Next: Calendar.Next,\n Grid: Calendar.Grid,\n Weekdays: Calendar.Weekdays,\n HeadCell: Calendar.HeadCell,\n Weeks: Calendar.Weeks,\n Cell: Calendar.Cell,\n Day: Calendar.Day,\n}\n"],"mappings":";;;;;;;;;AAaA,MAAM,QAAQ,QAAoB,YAAY;AAmD9C,MAAa,aAAa;CACxB,MA9CW,gBAAgB;EAC3B,MAAM;EACN,OAAO;GACL,OAAO,SAAS,CAAC,QAAQ,IAAI,CAAuC;GACpE,cAAc;GACd,MAAM,SAAS,OAAO;GACtB,aAAa;GACb,QAAQ;GACR,KAAK;GACL,KAAK;GACL,mBAAmB;GACnB,gBAAgB;GAChB,YAAY;GACZ,cAAc;GACd,UAAU;GACV,UAAU;GACV,UAAU;GACV,MAAM;GACN,MAAM;GACN,IAAI;EACN;EACA,OAAO;GAAC;GAAgB;GAAe;GAAe;EAAY;EAClE,MAAM,OAAO,EAAE,OAAO,QAAQ;GAC5B,MAAM,YAAY,MAAM;GACxB,MAAM,OAAO,MAAM,QACjB,WAAW,OAAO,kBAAkB,EAAE,WAAW,mBAAmB,EAAE,CAAC,UAAU;IAC/E,GAAG;IACH,IAAI,MAAM,MAAM;IAChB,cAAc,OAAsB,SAAwB;KAC1D,KAAK,eAAe,OAAO,OAAO;KAClC,IAAI,CAAC,QAAQ,UAAU,KAAK,gBAAgB,KAAK;IACnD;IACA,aAAa,MAAe,SAAwB;KAClD,KAAK,cAAc,MAAM,OAAO;KAChC,IAAI,CAAC,QAAQ,UAAU,KAAK,eAAe,IAAI;IACjD;GACF,EAAE,CACJ;GACA,QAAe,QAAQ,KAAK,KAAK;GACjC,QAAa,QAAQ,KAAK,OAAO;GACjC,QAAc,QAAQ,KAAK,QAAQ;GACnC,aAAa,MAAM,UAAU;EAC/B;CACF,CAGE;;CAEA,OAAO,cAAc,mBAAmB,aAAa,MAAM,IAAI,CAAC,CAAC,MAAM,IAAI;CAC3E,UAAU,UAAU;CACpB,SAAS,UAAU;CACnB,OAAO,UAAU;CACjB,SAAS,QAAQ;CACjB,QAAQ,QAAQ;CAChB,YAAY,QAAQ;CACpB,OAAO,QAAQ;;CAEf,UAAU,cAAc,sBAAsB,aAAa,MAAM,IAAI,CAAC,CAAC,SAAS,IAAI;CACpF,SAAS,SAAS;CAClB,UAAU,SAAS;CACnB,MAAM,SAAS;CACf,MAAM,SAAS;CACf,UAAU,SAAS;CACnB,UAAU,SAAS;CACnB,OAAO,SAAS;CAChB,MAAM,SAAS;CACf,KAAK,SAAS;AAChB"}
|