@kirana-ui/vue 0.1.0 → 0.2.0
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 +3216 -0
- package/package.json +124 -2
- package/skills/kirana-ui-primitives/SKILL.md +142 -0
- package/src/accordion.d.ts +42 -75
- package/src/accordion.js +4 -2
- package/src/accordion.js.map +1 -1
- package/src/agent.d.ts +1 -0
- package/src/agent.js +1 -0
- package/src/alert-dialog.d.ts +3 -2
- package/src/autocomplete.d.ts +4 -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 +10 -13
- package/src/avatar.js.map +1 -1
- package/src/button.d.ts +4 -21
- package/src/button.js.map +1 -1
- package/src/calendar.d.ts +73 -0
- package/src/calendar.js +130 -0
- package/src/calendar.js.map +1 -0
- package/src/carousel.d.ts +39 -0
- package/src/carousel.js +75 -0
- package/src/carousel.js.map +1 -0
- package/src/checkbox.d.ts +28 -48
- package/src/checkbox.js +4 -2
- package/src/checkbox.js.map +1 -1
- package/src/collapsible.d.ts +26 -36
- package/src/collapsible.js.map +1 -1
- package/src/combobox.d.ts +147 -0
- package/src/combobox.js +296 -0
- package/src/combobox.js.map +1 -0
- package/src/command.d.ts +46 -0
- package/src/command.js +129 -0
- package/src/command.js.map +1 -0
- package/src/context-menu.d.ts +4 -0
- package/src/context-menu.js +1 -0
- package/src/date-field.d.ts +40 -0
- package/src/date-field.js +81 -0
- package/src/date-field.js.map +1 -0
- package/src/date-picker.d.ts +89 -0
- package/src/date-picker.js +82 -0
- package/src/date-picker.js.map +1 -0
- package/src/dialog.d.ts +77 -78
- package/src/dialog.js +58 -1
- package/src/dialog.js.map +1 -1
- package/src/direction.d.ts +5 -8
- package/src/direction.js.map +1 -1
- package/src/drawer.d.ts +3 -0
- package/src/drawer.js +1 -0
- package/src/element.d.ts +23 -0
- package/src/element.js +90 -0
- package/src/element.js.map +1 -0
- package/src/field.d.ts +63 -45
- package/src/field.js +3 -2
- package/src/field.js.map +1 -1
- package/src/fieldset.d.ts +12 -13
- package/src/fieldset.js.map +1 -1
- package/src/form.d.ts +5 -15
- package/src/form.js.map +1 -1
- package/src/hover-card.d.ts +29 -35
- package/src/hover-card.js.map +1 -1
- package/src/hover-popup.d.ts +27 -38
- package/src/hover-popup.js +45 -26
- package/src/hover-popup.js.map +1 -1
- package/src/index.d.ts +37 -2
- package/src/index.js +26 -2
- package/src/input.d.ts +17 -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 +37 -0
- package/src/listbox.js +104 -0
- package/src/listbox.js.map +1 -0
- package/src/menu.d.ts +179 -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 +8 -0
- package/src/menubar.js +34 -0
- package/src/menubar.js.map +1 -0
- package/src/message-scroller.d.ts +26 -0
- package/src/message-scroller.js +34 -0
- package/src/message-scroller.js.map +1 -0
- package/src/meter.d.ts +10 -31
- package/src/meter.js.map +1 -1
- package/src/navigation-menu.d.ts +80 -0
- package/src/navigation-menu.js +118 -0
- package/src/navigation-menu.js.map +1 -0
- package/src/number-field.d.ts +75 -0
- package/src/number-field.js +81 -0
- package/src/number-field.js.map +1 -0
- package/src/otp.d.ts +37 -0
- package/src/otp.js +86 -0
- package/src/otp.js.map +1 -0
- package/src/pagination.d.ts +34 -0
- package/src/pagination.js +70 -0
- package/src/pagination.js.map +1 -0
- package/src/popover.d.ts +64 -35
- package/src/popover.js +34 -6
- package/src/popover.js.map +1 -1
- package/src/primitive.d.ts +21 -0
- package/src/primitive.js +27 -0
- package/src/primitive.js.map +1 -0
- package/src/progress.d.ts +28 -31
- package/src/progress.js.map +1 -1
- package/src/qr-code.d.ts +15 -0
- package/src/qr-code.js +34 -0
- package/src/qr-code.js.map +1 -0
- package/src/radio-group.d.ts +37 -73
- package/src/radio-group.js +4 -2
- package/src/radio-group.js.map +1 -1
- package/src/resizable.d.ts +29 -0
- package/src/resizable.js +62 -0
- package/src/resizable.js.map +1 -0
- package/src/runtime.d.ts +97 -6
- package/src/runtime.js +43 -25
- package/src/runtime.js.map +1 -1
- package/src/scroll-area.d.ts +37 -0
- package/src/scroll-area.js +63 -0
- package/src/scroll-area.js.map +1 -0
- package/src/select.d.ts +91 -116
- package/src/select.js +99 -10
- package/src/select.js.map +1 -1
- package/src/separator.d.ts +4 -9
- package/src/separator.js.map +1 -1
- package/src/slider.d.ts +61 -76
- package/src/slider.js +12 -10
- package/src/slider.js.map +1 -1
- package/src/switch.d.ts +21 -37
- package/src/switch.js +4 -2
- package/src/switch.js.map +1 -1
- package/src/tabs.d.ts +44 -98
- package/src/tabs.js.map +1 -1
- package/src/testing.d.ts +1 -0
- package/src/testing.js +1 -0
- package/src/toast.d.ts +61 -0
- package/src/toast.js +95 -0
- package/src/toast.js.map +1 -0
- package/src/toggle-group.d.ts +10 -0
- package/src/toggle-group.js +46 -0
- package/src/toggle-group.js.map +1 -0
- package/src/toggle.d.ts +9 -25
- 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 +34 -0
- package/src/toolbar.js +55 -0
- package/src/toolbar.js.map +1 -0
- package/src/tooltip.d.ts +29 -35
- package/src/tooltip.js.map +1 -1
- package/src/value-bar.d.ts +26 -35
- package/src/value-bar.js +10 -3
- package/src/value-bar.js.map +1 -1
package/src/popover.d.ts
CHANGED
|
@@ -1,39 +1,68 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { Changes, PartComponent, PartComponentProps, PlainComponent, PortalProps } from "./runtime.js";
|
|
2
|
+
import { Anchor, PartState, PositionOptions } from "@kirana-ui/core";
|
|
3
|
+
import { Popover as Popover$1, PopoverProps } from "@kirana-ui/core/popover";
|
|
4
|
+
import { Component, ComponentPublicInstance, Ref } from "vue";
|
|
5
|
+
/**
|
|
6
|
+
* The popover its parts are inside. Exported for a component that is made of one (a date picker
|
|
7
|
+
* provides its own to the popover's parts).
|
|
8
|
+
*/
|
|
9
|
+
declare const scope: {
|
|
10
|
+
provide(controller: Popover$1): Popover$1;
|
|
11
|
+
use(): Popover$1;
|
|
12
|
+
};
|
|
13
|
+
export type RootProps = Omit<PopoverProps, "id" | "onOpenChange"> & {
|
|
14
|
+
id?: string | undefined;
|
|
15
|
+
};
|
|
16
|
+
export type RootEmits = Changes<"open", boolean>;
|
|
17
|
+
/**
|
|
18
|
+
* What a positioner's `anchor` may be: an element, a place in the viewport (an object with
|
|
19
|
+
* `getBoundingClientRect`), a template ref to an element or a component (in a template that is
|
|
20
|
+
* the element or the component's instance), or a function that gives an element or a place.
|
|
21
|
+
*/
|
|
22
|
+
export type PositionerAnchor = Anchor | ComponentPublicInstance | Ref<Anchor | ComponentPublicInstance | null | undefined> | (() => Anchor | null | undefined) | null | undefined;
|
|
23
|
+
/** A positioner's own props: where its popup goes, and what it is placed against. */
|
|
24
|
+
export interface PositionerProps extends Partial<Pick<PositionOptions, "side" | "align" | "sideOffset" | "alignOffset" | "collisionPadding">>, PartComponentProps {
|
|
25
|
+
/**
|
|
26
|
+
* What the popup is placed against, when that is not its trigger. It may change while the
|
|
27
|
+
* popup is open: the popup follows.
|
|
28
|
+
*/
|
|
29
|
+
anchor?: PositionerAnchor;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* A positioner: the part's element, with where it goes as props. The one place a positioner's
|
|
33
|
+
* own props are named.
|
|
34
|
+
*/
|
|
35
|
+
export declare function positionerComponent<Placed = PartState>(name: string, use: () => {
|
|
5
36
|
positioning: Popover$1["positioning"];
|
|
6
|
-
}, element: Component):
|
|
37
|
+
}, element: Component): PartComponent<"div", Placed, PositionerProps>;
|
|
38
|
+
export type TriggerProps = PartComponentProps;
|
|
39
|
+
export type PopupProps = PartComponentProps;
|
|
40
|
+
export type TitleProps = PartComponentProps;
|
|
41
|
+
export type DescriptionProps = PartComponentProps;
|
|
42
|
+
export type CloseProps = PartComponentProps;
|
|
7
43
|
export declare const Popover: {
|
|
8
|
-
Root:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
31
|
-
Trigger: Component;
|
|
32
|
-
Portal: Component;
|
|
33
|
-
Positioner: Component;
|
|
34
|
-
Popup: Component;
|
|
35
|
-
Title: Component;
|
|
36
|
-
Description: Component;
|
|
37
|
-
Close: Component;
|
|
44
|
+
Root: PlainComponent<RootProps, RootEmits>;
|
|
45
|
+
Trigger: PartComponent<"button", {
|
|
46
|
+
readonly popupOpen?: true | undefined;
|
|
47
|
+
}, PartComponentProps, {}, unknown>;
|
|
48
|
+
Portal: PlainComponent<PortalProps, {}, {}>;
|
|
49
|
+
Positioner: PartComponent<"div", {
|
|
50
|
+
readonly open?: true | undefined;
|
|
51
|
+
readonly closed?: true | undefined;
|
|
52
|
+
readonly side?: "bottom" | "inline-end" | "inline-start" | "left" | "right" | "top" | undefined;
|
|
53
|
+
readonly align?: "center" | "end" | "start" | undefined;
|
|
54
|
+
}, PositionerProps>;
|
|
55
|
+
Popup: PartComponent<"div", {
|
|
56
|
+
readonly open?: true | undefined;
|
|
57
|
+
readonly closed?: true | undefined;
|
|
58
|
+
readonly startingStyle?: true | undefined;
|
|
59
|
+
readonly endingStyle?: true | undefined;
|
|
60
|
+
readonly side?: "bottom" | "inline-end" | "inline-start" | "left" | "right" | "top" | undefined;
|
|
61
|
+
readonly align?: "center" | "end" | "start" | undefined;
|
|
62
|
+
}, PartComponentProps, {}, unknown>;
|
|
63
|
+
Title: PartComponent<"h2", Record<never, never>, PartComponentProps, {}, unknown>;
|
|
64
|
+
Description: PartComponent<"p", Record<never, never>, PartComponentProps, {}, unknown>;
|
|
65
|
+
Close: PartComponent<"button", Record<never, never>, PartComponentProps, {}, unknown>;
|
|
38
66
|
};
|
|
67
|
+
export { type PortalProps, scope as popoverScope };
|
|
39
68
|
//# sourceMappingURL=popover.d.ts.map
|
package/src/popover.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import { context, controller, optional, partComponent, portalComponent } from "./runtime.js";
|
|
1
|
+
import { context, controller, elementOf, optional, partComponent, portalComponent } from "./runtime.js";
|
|
2
2
|
import { defined } from "@kirana-ui/core";
|
|
3
3
|
import { createPopover } from "@kirana-ui/core/popover";
|
|
4
|
-
import { defineComponent, h, useId, watchEffect } from "vue";
|
|
4
|
+
import { defineComponent, h, unref, useId, watchEffect } from "vue";
|
|
5
5
|
// src/popover.ts
|
|
6
|
+
/**
|
|
7
|
+
* The popover its parts are inside. Exported for a component that is made of one (a date picker
|
|
8
|
+
* provides its own to the popover's parts).
|
|
9
|
+
*/
|
|
6
10
|
const scope = context("Popover");
|
|
7
11
|
const Root = defineComponent({
|
|
8
12
|
name: "PopoverRoot",
|
|
@@ -26,7 +30,20 @@ const Root = defineComponent({
|
|
|
26
30
|
return () => slots.default?.();
|
|
27
31
|
}
|
|
28
32
|
});
|
|
29
|
-
|
|
33
|
+
function anchorOf(given) {
|
|
34
|
+
const named = unref(given);
|
|
35
|
+
if (typeof named === "function") {
|
|
36
|
+
const ask = named;
|
|
37
|
+
return ask() ?? ask;
|
|
38
|
+
}
|
|
39
|
+
if (!named || typeof named !== "object") return named;
|
|
40
|
+
if ("getBoundingClientRect" in named) return named;
|
|
41
|
+
return elementOf(named) ?? void 0;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* A positioner: the part's element, with where it goes as props. The one place a positioner's
|
|
45
|
+
* own props are named.
|
|
46
|
+
*/
|
|
30
47
|
function positionerComponent(name, use, element) {
|
|
31
48
|
return defineComponent({
|
|
32
49
|
name,
|
|
@@ -36,11 +53,22 @@ function positionerComponent(name, use, element) {
|
|
|
36
53
|
align: String,
|
|
37
54
|
sideOffset: Number,
|
|
38
55
|
alignOffset: Number,
|
|
39
|
-
collisionPadding: Number
|
|
56
|
+
collisionPadding: Number,
|
|
57
|
+
/**
|
|
58
|
+
* What the popup is placed against, when that is not its trigger. It may change while
|
|
59
|
+
* the popup is open: the popup follows.
|
|
60
|
+
*/
|
|
61
|
+
anchor: {
|
|
62
|
+
type: null,
|
|
63
|
+
default: void 0
|
|
64
|
+
}
|
|
40
65
|
},
|
|
41
66
|
setup(props, { attrs, slots }) {
|
|
42
67
|
const { positioning } = use();
|
|
43
|
-
watchEffect(() => positioning.set(defined({
|
|
68
|
+
watchEffect(() => positioning.set(defined({
|
|
69
|
+
...props,
|
|
70
|
+
anchor: anchorOf(props.anchor)
|
|
71
|
+
})), { flush: "sync" });
|
|
44
72
|
return () => h(element, attrs, slots);
|
|
45
73
|
}
|
|
46
74
|
});
|
|
@@ -55,6 +83,6 @@ const Popover = {
|
|
|
55
83
|
Description: partComponent("PopoverDescription", "p", () => scope.use().description),
|
|
56
84
|
Close: partComponent("PopoverClose", "button", () => scope.use().close)
|
|
57
85
|
};
|
|
58
|
-
export { Popover, positionerComponent };
|
|
86
|
+
export { Popover, scope as popoverScope, positionerComponent };
|
|
59
87
|
|
|
60
88
|
//# sourceMappingURL=popover.js.map
|
package/src/popover.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover.js","names":[],"sources":["../../../../packages/vue/src/popover.ts"],"sourcesContent":["import { defined } from \"@kirana-ui/core\"\nimport type { ChangeDetails, PositionOptions } from \"@kirana-ui/core\"\nimport { createPopover } from \"@kirana-ui/core/popover\"\nimport type { Popover as Controller } from \"@kirana-ui/core/popover\"\nimport { defineComponent, h, useId, watchEffect } from \"vue\"\nimport type { Component, PropType } from \"vue\"\n\nimport {
|
|
1
|
+
{"version":3,"file":"popover.js","names":[],"sources":["../../../../packages/vue/src/popover.ts"],"sourcesContent":["import { defined } from \"@kirana-ui/core\"\nimport type { Anchor, ChangeDetails, PartState, PositionOptions } from \"@kirana-ui/core\"\nimport { createPopover } from \"@kirana-ui/core/popover\"\nimport type { Popover as Controller, PopoverProps } from \"@kirana-ui/core/popover\"\nimport { defineComponent, h, unref, useId, watchEffect } from \"vue\"\nimport type { Component, ComponentPublicInstance, PropType, Ref } from \"vue\"\n\nimport {\n context,\n controller,\n elementOf,\n optional,\n partComponent,\n portalComponent,\n} from \"./runtime.ts\"\nimport type {\n Changes,\n PartComponent,\n PartComponentProps,\n PlainComponent,\n StatesOf,\n} from \"./runtime.ts\"\n\nexport type { PortalProps } from \"./runtime.ts\"\n\ntype State = StatesOf<\"popover\">\n\n/**\n * The popover its parts are inside. Exported for a component that is made of one (a date picker\n * provides its own to the popover's parts).\n */\nconst scope = context<Controller>(\"Popover\")\n/** For a component made of this one's parts: a date picker. */\nexport { scope as popoverScope }\n\nexport type RootProps = Omit<PopoverProps, \"id\" | \"onOpenChange\"> & { id?: string | undefined }\n\nexport type RootEmits = Changes<\"open\", boolean>\n\nconst Root = defineComponent({\n name: \"PopoverRoot\",\n props: { open: optional(Boolean), defaultOpen: Boolean, id: String },\n emits: [\"update:open\", \"openChange\"],\n setup(props, { slots, emit }) {\n const generated = useId()\n scope.provide(\n controller(createPopover, () => ({\n id: props.id ?? generated,\n open: props.open,\n defaultOpen: props.defaultOpen,\n onOpenChange(open: boolean, details: ChangeDetails) {\n emit(\"openChange\", open, details)\n if (!details.canceled) emit(\"update:open\", open)\n },\n }))\n )\n return () => slots.default?.()\n },\n}) as unknown as PlainComponent<RootProps, RootEmits>\n\n/**\n * What a positioner's `anchor` may be: an element, a place in the viewport (an object with\n * `getBoundingClientRect`), a template ref to an element or a component (in a template that is\n * the element or the component's instance), or a function that gives an element or a place.\n */\nexport type PositionerAnchor =\n | Anchor\n | ComponentPublicInstance\n | Ref<Anchor | ComponentPublicInstance | null | undefined>\n | (() => Anchor | null | undefined)\n | null\n | undefined\n\nfunction anchorOf(given: unknown): PositionOptions[\"anchor\"] {\n const named: unknown = unref(given)\n // A function is asked here, so a change of what it reads is followed; and given whole while\n // it has nothing, to be asked again as the popup is placed.\n if (typeof named === \"function\") {\n const ask = named as () => Anchor | null | undefined\n return ask() ?? ask\n }\n if (!named || typeof named !== \"object\") return named as null | undefined\n if (\"getBoundingClientRect\" in named) return named as Anchor\n // A component's instance.\n return elementOf(named) ?? undefined\n}\n\n/** A positioner's own props: where its popup goes, and what it is placed against. */\nexport interface PositionerProps\n extends\n Partial<\n Pick<PositionOptions, \"side\" | \"align\" | \"sideOffset\" | \"alignOffset\" | \"collisionPadding\">\n >,\n PartComponentProps {\n /**\n * What the popup is placed against, when that is not its trigger. It may change while the\n * popup is open: the popup follows.\n */\n anchor?: PositionerAnchor\n}\n\n/**\n * A positioner: the part's element, with where it goes as props. The one place a positioner's\n * own props are named.\n */\nexport function positionerComponent<Placed = PartState>(\n name: string,\n use: () => { positioning: Controller[\"positioning\"] },\n element: Component\n): PartComponent<\"div\", Placed, PositionerProps> {\n return defineComponent({\n name,\n inheritAttrs: false,\n props: {\n side: String as PropType<PositionOptions[\"side\"]>,\n align: String as PropType<PositionOptions[\"align\"]>,\n sideOffset: Number,\n alignOffset: Number,\n collisionPadding: Number,\n /**\n * What the popup is placed against, when that is not its trigger. It may change while\n * the popup is open: the popup follows.\n */\n anchor: {\n type: null as unknown as PropType<PositionerAnchor>,\n default: undefined as unknown,\n },\n },\n setup(props, { attrs, slots }) {\n const { positioning } = use()\n // As they change, and before the element attaches: the first placement reads these.\n watchEffect(() => positioning.set(defined({ ...props, anchor: anchorOf(props.anchor) })), {\n flush: \"sync\",\n })\n return () => h(element, attrs, slots)\n },\n }) as unknown as PartComponent<\"div\", Placed, PositionerProps>\n}\n\nexport type TriggerProps = PartComponentProps\nexport type PopupProps = PartComponentProps\nexport type TitleProps = PartComponentProps\nexport type DescriptionProps = PartComponentProps\nexport type CloseProps = PartComponentProps\nexport const Popover = {\n Root,\n Trigger: partComponent<\"button\", State[\"trigger\"]>(\n \"PopoverTrigger\",\n \"button\",\n () => scope.use().trigger\n ),\n Portal: portalComponent(\"PopoverPortal\", () => scope.use().mounted),\n Positioner: positionerComponent<State[\"positioner\"]>(\n \"PopoverPositioner\",\n () => scope.use(),\n partComponent(\"PopoverPositionerElement\", \"div\", () => scope.use().positioner)\n ),\n Popup: partComponent<\"div\", State[\"popup\"]>(\"PopoverPopup\", \"div\", () => scope.use().popup),\n Title: partComponent<\"h2\", State[\"title\"]>(\"PopoverTitle\", \"h2\", () => scope.use().title),\n Description: partComponent<\"p\", State[\"description\"]>(\n \"PopoverDescription\",\n \"p\",\n () => scope.use().description\n ),\n Close: partComponent<\"button\", State[\"close\"]>(\"PopoverClose\", \"button\", () => scope.use().close),\n}\n"],"mappings":";;;;;;;;;AA+BA,MAAM,QAAQ,QAAoB,SAAS;AAQ3C,MAAM,OAAO,gBAAgB;CAC3B,MAAM;CACN,OAAO;EAAE,MAAM,SAAS,OAAO;EAAG,aAAa;EAAS,IAAI;CAAO;CACnE,OAAO,CAAC,eAAe,YAAY;CACnC,MAAM,OAAO,EAAE,OAAO,QAAQ;EAC5B,MAAM,YAAY,MAAM;EACxB,MAAM,QACJ,WAAW,sBAAsB;GAC/B,IAAI,MAAM,MAAM;GAChB,MAAM,MAAM;GACZ,aAAa,MAAM;GACnB,aAAa,MAAe,SAAwB;IAClD,KAAK,cAAc,MAAM,OAAO;IAChC,IAAI,CAAC,QAAQ,UAAU,KAAK,eAAe,IAAI;GACjD;EACF,EAAE,CACJ;EACA,aAAa,MAAM,UAAU;CAC/B;AACF,CAAC;AAeD,SAAS,SAAS,OAA2C;CAC3D,MAAM,QAAiB,MAAM,KAAK;CAGlC,IAAI,OAAO,UAAU,YAAY;EAC/B,MAAM,MAAM;EACZ,OAAO,IAAI,KAAK;CAClB;CACA,IAAI,CAAC,SAAS,OAAO,UAAU,UAAU,OAAO;CAChD,IAAI,2BAA2B,OAAO,OAAO;CAE7C,OAAO,UAAU,KAAK,KAAK,KAAA;AAC7B;;;;;AAoBA,SAAgB,oBACd,MACA,KACA,SAC+C;CAC/C,OAAO,gBAAgB;EACrB;EACA,cAAc;EACd,OAAO;GACL,MAAM;GACN,OAAO;GACP,YAAY;GACZ,aAAa;GACb,kBAAkB;;;;;GAKlB,QAAQ;IACN,MAAM;IACN,SAAS,KAAA;GACX;EACF;EACA,MAAM,OAAO,EAAE,OAAO,SAAS;GAC7B,MAAM,EAAE,gBAAgB,IAAI;GAE5B,kBAAkB,YAAY,IAAI,QAAQ;IAAE,GAAG;IAAO,QAAQ,SAAS,MAAM,MAAM;GAAE,CAAC,CAAC,GAAG,EACxF,OAAO,OACT,CAAC;GACD,aAAa,EAAE,SAAS,OAAO,KAAK;EACtC;CACF,CAAC;AACH;AAOA,MAAa,UAAU;CACrB;CACA,SAAS,cACP,kBACA,gBACM,MAAM,IAAI,CAAC,CAAC,OACpB;CACA,QAAQ,gBAAgB,uBAAuB,MAAM,IAAI,CAAC,CAAC,OAAO;CAClE,YAAY,oBACV,2BACM,MAAM,IAAI,GAChB,cAAc,4BAA4B,aAAa,MAAM,IAAI,CAAC,CAAC,UAAU,CAC/E;CACA,OAAO,cAAqC,gBAAgB,aAAa,MAAM,IAAI,CAAC,CAAC,KAAK;CAC1F,OAAO,cAAoC,gBAAgB,YAAY,MAAM,IAAI,CAAC,CAAC,KAAK;CACxF,aAAa,cACX,sBACA,WACM,MAAM,IAAI,CAAC,CAAC,WACpB;CACA,OAAO,cAAwC,gBAAgB,gBAAgB,MAAM,IAAI,CAAC,CAAC,KAAK;AAClG"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { DefaultSlot, ElementAttributes } from "./runtime.js";
|
|
2
|
+
import { Component, DefineSetupFnComponent, PublicProps } from "vue";
|
|
3
|
+
export interface PrimitiveProps {
|
|
4
|
+
/** Another tag for the element, or a component to draw in its place; a `div` when left out. */
|
|
5
|
+
as?: string | Component | undefined;
|
|
6
|
+
/** Draws the element in its slot in place of its own: it takes the attributes given here. */
|
|
7
|
+
asChild?: boolean | undefined;
|
|
8
|
+
}
|
|
9
|
+
/** What a `Primitive` drawn as `Tag` takes: its two props, and what the element takes. */
|
|
10
|
+
export type PrimitiveGiven<Tag extends string> = PrimitiveProps & Omit<ElementAttributes<Tag>, keyof PrimitiveProps>;
|
|
11
|
+
/**
|
|
12
|
+
* A plain element of one's own (a badge, a breadcrumb's link) with the composition a part
|
|
13
|
+
* has: `as` for another tag or component (a `div` unless said), or with `as-child` the
|
|
14
|
+
* caller's own element in its slot. By a part's rule: the slotted element's own props lie
|
|
15
|
+
* over the attributes on the `Primitive`, classes join, styles are merged, and both listeners
|
|
16
|
+
* of an event run, the `Primitive`'s first.
|
|
17
|
+
*/
|
|
18
|
+
export declare const Primitive: new <As extends string = "div">(props: PrimitiveGiven<As> & {
|
|
19
|
+
as?: As | Component | undefined;
|
|
20
|
+
} & PublicProps) => InstanceType<DefineSetupFnComponent<PrimitiveGiven<As>, {}, DefaultSlot<{}>>>;
|
|
21
|
+
//# sourceMappingURL=primitive.d.ts.map
|
package/src/primitive.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { draw } from "./element.js";
|
|
2
|
+
import { defineComponent } from "vue";
|
|
3
|
+
// src/primitive.ts
|
|
4
|
+
/**
|
|
5
|
+
* A plain element of one's own (a badge, a breadcrumb's link) with the composition a part
|
|
6
|
+
* has: `as` for another tag or component (a `div` unless said), or with `as-child` the
|
|
7
|
+
* caller's own element in its slot. By a part's rule: the slotted element's own props lie
|
|
8
|
+
* over the attributes on the `Primitive`, classes join, styles are merged, and both listeners
|
|
9
|
+
* of an event run, the `Primitive`'s first.
|
|
10
|
+
*/
|
|
11
|
+
const Primitive = defineComponent({
|
|
12
|
+
name: "Primitive",
|
|
13
|
+
inheritAttrs: false,
|
|
14
|
+
props: {
|
|
15
|
+
as: {
|
|
16
|
+
type: [String, Object],
|
|
17
|
+
default: "div"
|
|
18
|
+
},
|
|
19
|
+
asChild: Boolean
|
|
20
|
+
},
|
|
21
|
+
setup(props, { attrs, slots }) {
|
|
22
|
+
return () => draw(props.as, props.asChild, attrs, slots.default?.());
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
export { Primitive };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=primitive.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"primitive.js","names":[],"sources":["../../../../packages/vue/src/primitive.ts"],"sourcesContent":["import { defineComponent } from \"vue\"\nimport type { Component, DefineSetupFnComponent, PropType, PublicProps } from \"vue\"\n\nimport { draw } from \"./element.ts\"\nimport type { DefaultSlot, ElementAttributes } from \"./runtime.ts\"\n\nexport interface PrimitiveProps {\n /** Another tag for the element, or a component to draw in its place; a `div` when left out. */\n as?: string | Component | undefined\n /** Draws the element in its slot in place of its own: it takes the attributes given here. */\n asChild?: boolean | undefined\n}\n\n/** What a `Primitive` drawn as `Tag` takes: its two props, and what the element takes. */\nexport type PrimitiveGiven<Tag extends string> = PrimitiveProps &\n Omit<ElementAttributes<Tag>, keyof PrimitiveProps>\n\n/**\n * A plain element of one's own (a badge, a breadcrumb's link) with the composition a part\n * has: `as` for another tag or component (a `div` unless said), or with `as-child` the\n * caller's own element in its slot. By a part's rule: the slotted element's own props lie\n * over the attributes on the `Primitive`, classes join, styles are merged, and both listeners\n * of an event run, the `Primitive`'s first.\n */\nexport const Primitive = defineComponent({\n name: \"Primitive\",\n inheritAttrs: false,\n props: {\n as: { type: [String, Object] as PropType<string | Component>, default: \"div\" },\n asChild: Boolean,\n },\n setup(props, { attrs, slots }) {\n return () => draw(props.as, props.asChild, attrs, slots.default?.())\n },\n}) as unknown as new <As extends string = \"div\">(\n props: PrimitiveGiven<As> & { as?: As | Component | undefined } & PublicProps\n) => InstanceType<DefineSetupFnComponent<PrimitiveGiven<As>, {}, DefaultSlot<{}>>>\n"],"mappings":";;;;;;;;;;AAwBA,MAAa,YAAY,gBAAgB;CACvC,MAAM;CACN,cAAc;CACd,OAAO;EACL,IAAI;GAAE,MAAM,CAAC,QAAQ,MAAM;GAAmC,SAAS;EAAM;EAC7E,SAAS;CACX;CACA,MAAM,OAAO,EAAE,OAAO,SAAS;EAC7B,aAAa,KAAK,MAAM,IAAI,MAAM,SAAS,OAAO,MAAM,UAAU,CAAC;CACrE;AACF,CAAC"}
|
package/src/progress.d.ts
CHANGED
|
@@ -1,34 +1,31 @@
|
|
|
1
|
+
import { IndicatorProps, LabelProps, RootProps, TrackProps, ValueGiven, ValueProps, valueBar } from "./value-bar.js";
|
|
2
|
+
import { PartComponent, PartComponentProps } from "./runtime.js";
|
|
1
3
|
export declare const Progress: {
|
|
2
|
-
Root:
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
Track: import("vue").Component;
|
|
28
|
-
Indicator: import("vue").Component;
|
|
29
|
-
Value: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
30
|
-
[key: string]: any;
|
|
31
|
-
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
32
|
-
Label: import("vue").Component;
|
|
4
|
+
Root: PartComponent<"div", {
|
|
5
|
+
readonly progressing?: true | undefined;
|
|
6
|
+
readonly complete?: true | undefined;
|
|
7
|
+
readonly indeterminate?: true | undefined;
|
|
8
|
+
}, RootProps<number | null>>;
|
|
9
|
+
Track: PartComponent<"div", {
|
|
10
|
+
readonly progressing?: true | undefined;
|
|
11
|
+
readonly complete?: true | undefined;
|
|
12
|
+
readonly indeterminate?: true | undefined;
|
|
13
|
+
}, PartComponentProps, {}, unknown>;
|
|
14
|
+
Indicator: PartComponent<"div", {
|
|
15
|
+
readonly progressing?: true | undefined;
|
|
16
|
+
readonly complete?: true | undefined;
|
|
17
|
+
readonly indeterminate?: true | undefined;
|
|
18
|
+
}, PartComponentProps, {}, unknown>;
|
|
19
|
+
Value: PartComponent<"span", {
|
|
20
|
+
readonly progressing?: true | undefined;
|
|
21
|
+
readonly complete?: true | undefined;
|
|
22
|
+
readonly indeterminate?: true | undefined;
|
|
23
|
+
}, PartComponentProps, {}, ValueGiven>;
|
|
24
|
+
Label: PartComponent<"span", {
|
|
25
|
+
readonly progressing?: true | undefined;
|
|
26
|
+
readonly complete?: true | undefined;
|
|
27
|
+
readonly indeterminate?: true | undefined;
|
|
28
|
+
}, PartComponentProps, {}, unknown>;
|
|
33
29
|
};
|
|
30
|
+
export type { IndicatorProps, LabelProps, RootProps, TrackProps, ValueGiven, ValueProps, valueBar };
|
|
34
31
|
//# sourceMappingURL=progress.d.ts.map
|
package/src/progress.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progress.js","names":[],"sources":["../../../../packages/vue/src/progress.ts"],"sourcesContent":["import { createProgress } from \"@kirana-ui/core/progress\"\n\nimport { valueBar } from \"./value-bar.ts\"\n\nexport const Progress = valueBar(\"Progress\", createProgress)\n"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"progress.js","names":[],"sources":["../../../../packages/vue/src/progress.ts"],"sourcesContent":["import { createProgress } from \"@kirana-ui/core/progress\"\n\nimport type { StatesOf } from \"./runtime.ts\"\nimport { valueBar } from \"./value-bar.ts\"\n\nexport type * from \"./value-bar.ts\"\n\nexport const Progress = valueBar<StatesOf<\"progress\">>(\"Progress\", createProgress)\n"],"mappings":";;;AAOA,MAAa,WAAW,SAA+B,YAAY,cAAc"}
|
package/src/qr-code.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { PartComponent, PartComponentProps } from "./runtime.js";
|
|
2
|
+
import { QrCodeProps } from "@kirana-ui/core/qr-code";
|
|
3
|
+
export type RootProps = Omit<QrCodeProps, "id"> & {
|
|
4
|
+
id?: string | undefined;
|
|
5
|
+
} & PartComponentProps;
|
|
6
|
+
export type FrameProps = PartComponentProps;
|
|
7
|
+
export type PatternProps = PartComponentProps;
|
|
8
|
+
export declare const QrCode: {
|
|
9
|
+
Root: PartComponent<"div", {
|
|
10
|
+
readonly invalid?: true | undefined;
|
|
11
|
+
}, RootProps>;
|
|
12
|
+
Frame: PartComponent<"svg", Record<never, never>, PartComponentProps, {}, unknown>;
|
|
13
|
+
Pattern: PartComponent<"path", Record<never, never>, PartComponentProps, {}, unknown>;
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=qr-code.d.ts.map
|
package/src/qr-code.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { context, controller, partComponent } from "./runtime.js";
|
|
2
|
+
import { defineComponent, h, useId } from "vue";
|
|
3
|
+
import { createQrCode } from "@kirana-ui/core/qr-code";
|
|
4
|
+
// src/qr-code.ts
|
|
5
|
+
const scope = context("QrCode");
|
|
6
|
+
const RootElement = partComponent("QrCodeRootElement", "div", () => scope.use().root);
|
|
7
|
+
const QrCode = {
|
|
8
|
+
Root: defineComponent({
|
|
9
|
+
name: "QrCodeRoot",
|
|
10
|
+
inheritAttrs: false,
|
|
11
|
+
props: {
|
|
12
|
+
value: {
|
|
13
|
+
type: String,
|
|
14
|
+
required: true
|
|
15
|
+
},
|
|
16
|
+
correction: String,
|
|
17
|
+
id: String
|
|
18
|
+
},
|
|
19
|
+
setup(props, { attrs, slots }) {
|
|
20
|
+
const generated = useId();
|
|
21
|
+
scope.provide(controller(createQrCode, () => ({
|
|
22
|
+
id: props.id ?? generated,
|
|
23
|
+
value: props.value,
|
|
24
|
+
correction: props.correction
|
|
25
|
+
})));
|
|
26
|
+
return () => h(RootElement, attrs, slots);
|
|
27
|
+
}
|
|
28
|
+
}),
|
|
29
|
+
Frame: partComponent("QrCodeFrame", "svg", () => scope.use().frame),
|
|
30
|
+
Pattern: partComponent("QrCodePattern", "path", () => scope.use().pattern)
|
|
31
|
+
};
|
|
32
|
+
export { QrCode };
|
|
33
|
+
|
|
34
|
+
//# sourceMappingURL=qr-code.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qr-code.js","names":[],"sources":["../../../../packages/vue/src/qr-code.ts"],"sourcesContent":["import { createQrCode } from \"@kirana-ui/core/qr-code\"\nimport type { QrCode as Controller, QrCodeProps, QrCorrection } from \"@kirana-ui/core/qr-code\"\nimport { defineComponent, h, useId } from \"vue\"\nimport type { PropType } from \"vue\"\n\nimport { context, controller, partComponent } from \"./runtime.ts\"\nimport type { PartComponent, PartComponentProps, StatesOf } from \"./runtime.ts\"\n\ntype State = StatesOf<\"qrCode\">\n\nconst scope = context<Controller>(\"QrCode\")\n\nconst RootElement = partComponent(\"QrCodeRootElement\", \"div\", () => scope.use().root)\n\nexport type RootProps = Omit<QrCodeProps, \"id\"> & {\n id?: string | undefined\n} & PartComponentProps\n\nconst Root = defineComponent({\n name: \"QrCodeRoot\",\n inheritAttrs: false,\n props: {\n value: { type: String, required: true },\n correction: String as PropType<QrCorrection>,\n id: String,\n },\n setup(props, { attrs, slots }) {\n const generated = useId()\n scope.provide(\n controller(createQrCode, () => ({\n id: props.id ?? generated,\n value: props.value,\n correction: props.correction,\n }))\n )\n return () => h(RootElement, attrs, slots)\n },\n}) as unknown as PartComponent<\"div\", State[\"root\"], RootProps>\n\nexport type FrameProps = PartComponentProps\nexport type PatternProps = PartComponentProps\nconst Frame = partComponent<\"svg\", State[\"frame\"]>(\"QrCodeFrame\", \"svg\", () => scope.use().frame)\nconst Pattern = partComponent<\"path\", State[\"pattern\"]>(\n \"QrCodePattern\",\n \"path\",\n () => scope.use().pattern\n)\n\nexport const QrCode = { Root, Frame, Pattern }\n"],"mappings":";;;;AAUA,MAAM,QAAQ,QAAoB,QAAQ;AAE1C,MAAM,cAAc,cAAc,qBAAqB,aAAa,MAAM,IAAI,CAAC,CAAC,IAAI;AAoCpF,MAAa,SAAS;CAAE,MA9BX,gBAAgB;EAC3B,MAAM;EACN,cAAc;EACd,OAAO;GACL,OAAO;IAAE,MAAM;IAAQ,UAAU;GAAK;GACtC,YAAY;GACZ,IAAI;EACN;EACA,MAAM,OAAO,EAAE,OAAO,SAAS;GAC7B,MAAM,YAAY,MAAM;GACxB,MAAM,QACJ,WAAW,qBAAqB;IAC9B,IAAI,MAAM,MAAM;IAChB,OAAO,MAAM;IACb,YAAY,MAAM;GACpB,EAAE,CACJ;GACA,aAAa,EAAE,aAAa,OAAO,KAAK;EAC1C;CACF,CAWwB;CAAM,OAPhB,cAAqC,eAAe,aAAa,MAAM,IAAI,CAAC,CAAC,KAO7D;CAAO,SANrB,cACd,iBACA,cACM,MAAM,IAAI,CAAC,CAAC,OAGiB;AAAQ"}
|
package/src/radio-group.d.ts
CHANGED
|
@@ -1,76 +1,40 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Changes, PartComponent, PartComponentProps, PartGiven, PartInstance, StatesOf } from "./runtime.js";
|
|
2
|
+
import { PublicProps } from "vue";
|
|
3
|
+
import { RadioGroupProps, RadioItemOptions } from "@kirana-ui/core/radio-group";
|
|
4
|
+
type State = StatesOf<"radioGroup">;
|
|
5
|
+
export type RootProps<Value = unknown> = Omit<RadioGroupProps<Value>, "id" | "onValueChange"> & {
|
|
6
|
+
id?: string | undefined;
|
|
7
|
+
} & PartComponentProps;
|
|
8
|
+
/** The value is `null` when the group is put back to none chosen. */
|
|
9
|
+
export type RootEmits<Value = unknown> = Changes<"value", Value | null>;
|
|
10
|
+
export interface ItemProps extends RadioItemOptions, PartComponentProps {
|
|
11
|
+
/** What the group's value is while this item is the chosen one. */
|
|
12
|
+
value: unknown;
|
|
13
|
+
}
|
|
14
|
+
export interface IndicatorProps extends PartComponentProps {
|
|
15
|
+
/** Keeps the mark in the page while its item is not the chosen one. */
|
|
16
|
+
keepMounted?: boolean | undefined;
|
|
17
|
+
}
|
|
2
18
|
export declare const RadioGroup: {
|
|
3
|
-
Root:
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
default: unknown;
|
|
23
|
-
};
|
|
24
|
-
defaultValue: {
|
|
25
|
-
type: PropType<unknown>;
|
|
26
|
-
default: unknown;
|
|
27
|
-
};
|
|
28
|
-
disabled: BooleanConstructor;
|
|
29
|
-
readOnly: BooleanConstructor;
|
|
30
|
-
required: BooleanConstructor;
|
|
31
|
-
name: StringConstructor;
|
|
32
|
-
id: StringConstructor;
|
|
33
|
-
}>> & Readonly<{
|
|
34
|
-
"onUpdate:value"?: ((...args: any[]) => any) | undefined;
|
|
35
|
-
onValueChange?: ((...args: any[]) => any) | undefined;
|
|
36
|
-
}>, {
|
|
37
|
-
value: unknown;
|
|
38
|
-
defaultValue: unknown;
|
|
39
|
-
disabled: boolean;
|
|
40
|
-
readOnly: boolean;
|
|
41
|
-
required: boolean;
|
|
42
|
-
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
43
|
-
Item: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
44
|
-
value: {
|
|
45
|
-
type: PropType<unknown>;
|
|
46
|
-
required: true;
|
|
47
|
-
};
|
|
48
|
-
disabled: {
|
|
49
|
-
type: BooleanConstructor;
|
|
50
|
-
default: undefined;
|
|
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
|
-
value: {
|
|
56
|
-
type: PropType<unknown>;
|
|
57
|
-
required: true;
|
|
58
|
-
};
|
|
59
|
-
disabled: {
|
|
60
|
-
type: BooleanConstructor;
|
|
61
|
-
default: undefined;
|
|
62
|
-
};
|
|
63
|
-
}>> & Readonly<{}>, {
|
|
64
|
-
disabled: boolean;
|
|
65
|
-
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
66
|
-
Indicator: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
67
|
-
keepMounted: BooleanConstructor;
|
|
68
|
-
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
69
|
-
[key: string]: any;
|
|
70
|
-
}> | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
71
|
-
keepMounted: BooleanConstructor;
|
|
72
|
-
}>> & Readonly<{}>, {
|
|
73
|
-
keepMounted: boolean;
|
|
74
|
-
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
19
|
+
Root: new <Value = unknown, As extends string = "div">(props: PartGiven<As, RootProps<Value>, RootEmits<Value>> & PublicProps) => PartInstance<As, RootProps<Value>, RootEmits<Value>, {
|
|
20
|
+
state: State["root"];
|
|
21
|
+
}>;
|
|
22
|
+
Item: PartComponent<"span", {
|
|
23
|
+
readonly checked?: true | undefined;
|
|
24
|
+
readonly unchecked?: true | undefined;
|
|
25
|
+
readonly disabled?: true | undefined;
|
|
26
|
+
readonly readonly?: true | undefined;
|
|
27
|
+
readonly required?: true | undefined;
|
|
28
|
+
}, ItemProps>;
|
|
29
|
+
Indicator: PartComponent<"span", {
|
|
30
|
+
readonly checked?: true | undefined;
|
|
31
|
+
readonly unchecked?: true | undefined;
|
|
32
|
+
readonly disabled?: true | undefined;
|
|
33
|
+
readonly readonly?: true | undefined;
|
|
34
|
+
readonly required?: true | undefined;
|
|
35
|
+
readonly startingStyle?: true | undefined;
|
|
36
|
+
readonly endingStyle?: true | undefined;
|
|
37
|
+
}, IndicatorProps>;
|
|
75
38
|
};
|
|
39
|
+
export {};
|
|
76
40
|
//# sourceMappingURL=radio-group.d.ts.map
|
package/src/radio-group.js
CHANGED
|
@@ -25,6 +25,7 @@ const RadioGroup = {
|
|
|
25
25
|
readOnly: Boolean,
|
|
26
26
|
required: Boolean,
|
|
27
27
|
name: String,
|
|
28
|
+
form: String,
|
|
28
29
|
id: String
|
|
29
30
|
},
|
|
30
31
|
emits: ["update:value", "valueChange"],
|
|
@@ -42,6 +43,7 @@ const RadioGroup = {
|
|
|
42
43
|
readOnly: props.readOnly,
|
|
43
44
|
required: props.required,
|
|
44
45
|
name: props.name,
|
|
46
|
+
form: props.form,
|
|
45
47
|
onValueChange(value, details) {
|
|
46
48
|
emit("valueChange", value, details);
|
|
47
49
|
if (!details.canceled) emit("update:value", value);
|
|
@@ -68,9 +70,9 @@ const RadioGroup = {
|
|
|
68
70
|
const item = group.item(value, read);
|
|
69
71
|
const input = group.itemInput(value, read);
|
|
70
72
|
provide(ITEM, value);
|
|
71
|
-
const Element = partComponent("RadioGroupItemElement", "span", () => item);
|
|
72
73
|
const Input = partComponent("RadioGroupItemInput", "input", () => input);
|
|
73
|
-
|
|
74
|
+
const Element = partComponent("RadioGroupItemElement", "span", () => item, (content) => [content, h(Input)]);
|
|
75
|
+
return () => h(Element, attrs, slots);
|
|
74
76
|
}
|
|
75
77
|
}),
|
|
76
78
|
Indicator: defineComponent({
|
package/src/radio-group.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radio-group.js","names":[],"sources":["../../../../packages/vue/src/radio-group.ts"],"sourcesContent":["import { defined, within } from \"@kirana-ui/core\"\nimport type { ChangeDetails } from \"@kirana-ui/core\"\nimport { createRadioGroup } from \"@kirana-ui/core/radio-group\"\nimport type {
|
|
1
|
+
{"version":3,"file":"radio-group.js","names":[],"sources":["../../../../packages/vue/src/radio-group.ts"],"sourcesContent":["import { defined, within } from \"@kirana-ui/core\"\nimport type { ChangeDetails } from \"@kirana-ui/core\"\nimport { createRadioGroup } from \"@kirana-ui/core/radio-group\"\nimport type {\n RadioGroup as Controller,\n RadioGroupProps,\n RadioItemOptions,\n} from \"@kirana-ui/core/radio-group\"\nimport { defineComponent, h, inject, onBeforeUnmount, onMounted, provide, useId } from \"vue\"\nimport type { InjectionKey, PropType, PublicProps } from \"vue\"\n\nimport { useDirectionAround } from \"./direction-context.ts\"\nimport { useFieldAround } from \"./field-context.ts\"\nimport { context, controller, fromSignal, optional, partComponent, toSignal } from \"./runtime.ts\"\nimport type {\n Changes,\n PartComponent,\n PartComponentProps,\n PartGiven,\n PartInstance,\n StatesOf,\n} from \"./runtime.ts\"\n\ntype State = StatesOf<\"radioGroup\">\n\nconst scope = context<Controller>(\"RadioGroup\")\nconst ITEM: InjectionKey<unknown> = Symbol(\"RadioGroupItem\")\n\nconst RootElement = partComponent(\"RadioGroupRootElement\", \"div\", () => scope.use().root)\n\nexport type RootProps<Value = unknown> = Omit<RadioGroupProps<Value>, \"id\" | \"onValueChange\"> & {\n id?: string | undefined\n} & PartComponentProps\n\n/** The value is `null` when the group is put back to none chosen. */\nexport type RootEmits<Value = unknown> = Changes<\"value\", Value | null>\n\n/** `v-model:value`, or `value` with `@value-change=\"(value, details) => …\"`. */\nconst Root = defineComponent({\n name: \"RadioGroupRoot\",\n inheritAttrs: false,\n props: {\n value: { type: null as unknown as PropType<unknown>, default: undefined as unknown },\n defaultValue: { type: null as unknown as PropType<unknown>, default: null as unknown },\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 field = useFieldAround()\n scope.provide(\n controller(within(createRadioGroup, { field, direction: useDirectionAround() }), () => ({\n id: props.id ?? generated,\n value: props.value,\n defaultValue: props.defaultValue,\n disabled: props.disabled,\n readOnly: props.readOnly,\n required: props.required,\n name: props.name,\n form: props.form,\n onValueChange(value: unknown, 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}) as unknown as new <Value = unknown, As extends string = \"div\">(\n props: PartGiven<As, RootProps<Value>, RootEmits<Value>> & PublicProps\n) => PartInstance<As, RootProps<Value>, RootEmits<Value>, { state: State[\"root\"] }>\n\nexport interface ItemProps extends RadioItemOptions, PartComponentProps {\n /** What the group's value is while this item is the chosen one. */\n value: unknown\n}\n\nconst Item = defineComponent({\n name: \"RadioGroupItem\",\n inheritAttrs: false,\n props: {\n value: { type: null as unknown as PropType<unknown>, required: true },\n disabled: optional(Boolean),\n },\n setup(props, { attrs, slots }) {\n // An item is its value for as long as it is in the page.\n const value = props.value\n const options = toSignal(() => ({ disabled: props.disabled }))\n const read = () => defined(options.get())\n const group = scope.use()\n const item = group.item(value, read)\n const input = group.itemInput(value, read)\n provide(ITEM, value)\n const Input = partComponent(\"RadioGroupItemInput\", \"input\", () => input)\n // Its native input is the element's last child, whatever element the caller asked for.\n const Element = partComponent(\n \"RadioGroupItemElement\",\n \"span\",\n () => item,\n (content) => [content, h(Input)]\n )\n return () => h(Element, attrs, slots)\n },\n}) as unknown as PartComponent<\"span\", State[\"item\"], ItemProps>\n\nexport interface IndicatorProps extends PartComponentProps {\n /** Keeps the mark in the page while its item is not the chosen one. */\n keepMounted?: boolean | undefined\n}\n\n/** `keep-mounted` keeps the mark in the page while its item is not the chosen one. */\nconst Indicator = defineComponent({\n name: \"RadioGroupIndicator\",\n inheritAttrs: false,\n props: { keepMounted: Boolean },\n setup(props, { attrs, slots }) {\n const indicator = scope.use().indicator(inject(ITEM))\n let stop: (() => void) | undefined\n onMounted(() => {\n stop = indicator.mount()\n })\n onBeforeUnmount(() => stop?.())\n const mounted = fromSignal(indicator.mounted)\n const Element = partComponent(\"RadioGroupIndicatorElement\", \"span\", () => indicator.part)\n return () => (mounted.value || props.keepMounted ? h(Element, attrs, slots) : null)\n },\n}) as unknown as PartComponent<\"span\", State[\"indicator\"], IndicatorProps>\n\nexport const RadioGroup = { Root, Item, Indicator }\n"],"mappings":";;;;;;;AAyBA,MAAM,QAAQ,QAAoB,YAAY;AAC9C,MAAM,OAA8B,OAAO,gBAAgB;AAE3D,MAAM,cAAc,cAAc,yBAAyB,aAAa,MAAM,IAAI,CAAC,CAAC,IAAI;AAyGxF,MAAa,aAAa;CAAE,MA/Ff,gBAAgB;EAC3B,MAAM;EACN,cAAc;EACd,OAAO;GACL,OAAO;IAAE,MAAM;IAAsC,SAAS,KAAA;GAAqB;GACnF,cAAc;IAAE,MAAM;IAAsC,SAAS;GAAgB;GACrF,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,QAAQ,eAAe;GAC7B,MAAM,QACJ,WAAW,OAAO,kBAAkB;IAAE;IAAO,WAAW,mBAAmB;GAAE,CAAC,UAAU;IACtF,IAAI,MAAM,MAAM;IAChB,OAAO,MAAM;IACb,cAAc,MAAM;IACpB,UAAU,MAAM;IAChB,UAAU,MAAM;IAChB,UAAU,MAAM;IAChB,MAAM,MAAM;IACZ,MAAM,MAAM;IACZ,cAAc,OAAgB,SAAwB;KACpD,KAAK,eAAe,OAAO,OAAO;KAClC,IAAI,CAAC,QAAQ,UAAU,KAAK,gBAAgB,KAAK;IACnD;GACF,EAAE,CACJ;GACA,aAAa,EAAE,aAAa,OAAO,KAAK;EAC1C;CACF,CA4D4B;CAAM,MAnDrB,gBAAgB;EAC3B,MAAM;EACN,cAAc;EACd,OAAO;GACL,OAAO;IAAE,MAAM;IAAsC,UAAU;GAAK;GACpE,UAAU,SAAS,OAAO;EAC5B;EACA,MAAM,OAAO,EAAE,OAAO,SAAS;GAE7B,MAAM,QAAQ,MAAM;GACpB,MAAM,UAAU,gBAAgB,EAAE,UAAU,MAAM,SAAS,EAAE;GAC7D,MAAM,aAAa,QAAQ,QAAQ,IAAI,CAAC;GACxC,MAAM,QAAQ,MAAM,IAAI;GACxB,MAAM,OAAO,MAAM,KAAK,OAAO,IAAI;GACnC,MAAM,QAAQ,MAAM,UAAU,OAAO,IAAI;GACzC,QAAQ,MAAM,KAAK;GACnB,MAAM,QAAQ,cAAc,uBAAuB,eAAe,KAAK;GAEvE,MAAM,UAAU,cACd,yBACA,cACM,OACL,YAAY,CAAC,SAAS,EAAE,KAAK,CAAC,CACjC;GACA,aAAa,EAAE,SAAS,OAAO,KAAK;EACtC;CACF,CAyBkC;CAAM,WAjBtB,gBAAgB;EAChC,MAAM;EACN,cAAc;EACd,OAAO,EAAE,aAAa,QAAQ;EAC9B,MAAM,OAAO,EAAE,OAAO,SAAS;GAC7B,MAAM,YAAY,MAAM,IAAI,CAAC,CAAC,UAAU,OAAO,IAAI,CAAC;GACpD,IAAI;GACJ,gBAAgB;IACd,OAAO,UAAU,MAAM;GACzB,CAAC;GACD,sBAAsB,OAAO,CAAC;GAC9B,MAAM,UAAU,WAAW,UAAU,OAAO;GAC5C,MAAM,UAAU,cAAc,8BAA8B,cAAc,UAAU,IAAI;GACxF,aAAc,QAAQ,SAAS,MAAM,cAAc,EAAE,SAAS,OAAO,KAAK,IAAI;EAChF;CACF,CAEwC;AAAU"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { PartComponent, PartComponentProps } from "./runtime.js";
|
|
2
|
+
import { ChangeDetails } from "@kirana-ui/core";
|
|
3
|
+
import { ResizablePanelOptions, ResizableProps } from "@kirana-ui/core/resizable";
|
|
4
|
+
export type GroupProps = Omit<ResizableProps, "id" | "onSizesChange"> & {
|
|
5
|
+
id?: string | undefined;
|
|
6
|
+
} & PartComponentProps;
|
|
7
|
+
export type GroupEmits = {
|
|
8
|
+
/** The panels were resized: each one's share, in order. */
|
|
9
|
+
sizesChange: (sizes: number[], details: ChangeDetails) => void;
|
|
10
|
+
};
|
|
11
|
+
export interface PanelProps extends ResizablePanelOptions, PartComponentProps {}
|
|
12
|
+
export interface HandleProps extends PartComponentProps {
|
|
13
|
+
disabled?: boolean | undefined;
|
|
14
|
+
}
|
|
15
|
+
export declare const Resizable: {
|
|
16
|
+
Group: PartComponent<"div", {
|
|
17
|
+
readonly orientation?: "horizontal" | "vertical" | undefined;
|
|
18
|
+
readonly disabled?: true | undefined;
|
|
19
|
+
}, GroupProps, GroupEmits>;
|
|
20
|
+
Panel: PartComponent<"div", {
|
|
21
|
+
readonly orientation?: "horizontal" | "vertical" | undefined;
|
|
22
|
+
}, PanelProps>;
|
|
23
|
+
Handle: PartComponent<"div", {
|
|
24
|
+
readonly orientation?: "horizontal" | "vertical" | undefined;
|
|
25
|
+
readonly dragging?: true | undefined;
|
|
26
|
+
readonly disabled?: true | undefined;
|
|
27
|
+
}, HandleProps>;
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=resizable.d.ts.map
|