@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
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { PropType } from "vue";
|
|
2
|
+
export declare const NumberField: {
|
|
3
|
+
Root: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
4
|
+
modelValue: {
|
|
5
|
+
type: PropType<number | null>;
|
|
6
|
+
default: undefined;
|
|
7
|
+
};
|
|
8
|
+
defaultValue: {
|
|
9
|
+
type: PropType<number | null>;
|
|
10
|
+
default: undefined;
|
|
11
|
+
};
|
|
12
|
+
min: NumberConstructor;
|
|
13
|
+
max: NumberConstructor;
|
|
14
|
+
step: NumberConstructor;
|
|
15
|
+
smallStep: NumberConstructor;
|
|
16
|
+
largeStep: NumberConstructor;
|
|
17
|
+
snapOnStep: BooleanConstructor;
|
|
18
|
+
allowWheelScrub: BooleanConstructor;
|
|
19
|
+
format: PropType<Intl.NumberFormatOptions>;
|
|
20
|
+
locale: StringConstructor;
|
|
21
|
+
disabled: BooleanConstructor;
|
|
22
|
+
readOnly: BooleanConstructor;
|
|
23
|
+
required: BooleanConstructor;
|
|
24
|
+
name: StringConstructor;
|
|
25
|
+
form: StringConstructor;
|
|
26
|
+
id: StringConstructor;
|
|
27
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
28
|
+
[key: string]: any;
|
|
29
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "valueChange" | "valueCommitted")[], "update:modelValue" | "valueChange" | "valueCommitted", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
30
|
+
modelValue: {
|
|
31
|
+
type: PropType<number | null>;
|
|
32
|
+
default: undefined;
|
|
33
|
+
};
|
|
34
|
+
defaultValue: {
|
|
35
|
+
type: PropType<number | null>;
|
|
36
|
+
default: undefined;
|
|
37
|
+
};
|
|
38
|
+
min: NumberConstructor;
|
|
39
|
+
max: NumberConstructor;
|
|
40
|
+
step: NumberConstructor;
|
|
41
|
+
smallStep: NumberConstructor;
|
|
42
|
+
largeStep: NumberConstructor;
|
|
43
|
+
snapOnStep: BooleanConstructor;
|
|
44
|
+
allowWheelScrub: BooleanConstructor;
|
|
45
|
+
format: PropType<Intl.NumberFormatOptions>;
|
|
46
|
+
locale: StringConstructor;
|
|
47
|
+
disabled: BooleanConstructor;
|
|
48
|
+
readOnly: BooleanConstructor;
|
|
49
|
+
required: BooleanConstructor;
|
|
50
|
+
name: StringConstructor;
|
|
51
|
+
form: StringConstructor;
|
|
52
|
+
id: StringConstructor;
|
|
53
|
+
}>> & Readonly<{
|
|
54
|
+
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
55
|
+
onValueChange?: ((...args: any[]) => any) | undefined;
|
|
56
|
+
onValueCommitted?: ((...args: any[]) => any) | undefined;
|
|
57
|
+
}>, {
|
|
58
|
+
modelValue: number | null;
|
|
59
|
+
defaultValue: number | null;
|
|
60
|
+
snapOnStep: boolean;
|
|
61
|
+
allowWheelScrub: boolean;
|
|
62
|
+
disabled: boolean;
|
|
63
|
+
readOnly: boolean;
|
|
64
|
+
required: boolean;
|
|
65
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
66
|
+
Group: import("vue").Component;
|
|
67
|
+
Input: import("vue").Component;
|
|
68
|
+
Increment: import("vue").Component;
|
|
69
|
+
Decrement: import("vue").Component;
|
|
70
|
+
};
|
|
71
|
+
//# sourceMappingURL=number-field.d.ts.map
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { useFieldAround } from "./field-context.js";
|
|
2
|
+
import { context, controller, fromSignal, partComponent } from "./runtime.js";
|
|
3
|
+
import { within } from "@kirana-ui/core";
|
|
4
|
+
import { defineComponent, h, useId } from "vue";
|
|
5
|
+
import { createNumberField } from "@kirana-ui/core/number-field";
|
|
6
|
+
// src/number-field.ts
|
|
7
|
+
const scope = context("NumberField");
|
|
8
|
+
const RootElement = partComponent("NumberFieldRootElement", "div", () => scope.use().root);
|
|
9
|
+
const HiddenInput = partComponent("NumberFieldHiddenInput", "input", () => scope.use().hidden);
|
|
10
|
+
const NumberField = {
|
|
11
|
+
Root: defineComponent({
|
|
12
|
+
name: "NumberFieldRoot",
|
|
13
|
+
inheritAttrs: false,
|
|
14
|
+
props: {
|
|
15
|
+
modelValue: {
|
|
16
|
+
type: null,
|
|
17
|
+
default: void 0
|
|
18
|
+
},
|
|
19
|
+
defaultValue: {
|
|
20
|
+
type: null,
|
|
21
|
+
default: void 0
|
|
22
|
+
},
|
|
23
|
+
min: Number,
|
|
24
|
+
max: Number,
|
|
25
|
+
step: Number,
|
|
26
|
+
smallStep: Number,
|
|
27
|
+
largeStep: Number,
|
|
28
|
+
snapOnStep: Boolean,
|
|
29
|
+
allowWheelScrub: Boolean,
|
|
30
|
+
format: Object,
|
|
31
|
+
locale: String,
|
|
32
|
+
disabled: Boolean,
|
|
33
|
+
readOnly: Boolean,
|
|
34
|
+
required: Boolean,
|
|
35
|
+
name: String,
|
|
36
|
+
form: String,
|
|
37
|
+
id: String
|
|
38
|
+
},
|
|
39
|
+
emits: [
|
|
40
|
+
"update:modelValue",
|
|
41
|
+
"valueChange",
|
|
42
|
+
"valueCommitted"
|
|
43
|
+
],
|
|
44
|
+
setup(props, { attrs, slots, emit }) {
|
|
45
|
+
const generated = useId();
|
|
46
|
+
const made = scope.provide(controller(within(createNumberField, { field: useFieldAround() }), () => ({
|
|
47
|
+
id: props.id ?? generated,
|
|
48
|
+
value: props.modelValue,
|
|
49
|
+
defaultValue: props.defaultValue,
|
|
50
|
+
min: props.min,
|
|
51
|
+
max: props.max,
|
|
52
|
+
step: props.step,
|
|
53
|
+
smallStep: props.smallStep,
|
|
54
|
+
largeStep: props.largeStep,
|
|
55
|
+
snapOnStep: props.snapOnStep,
|
|
56
|
+
allowWheelScrub: props.allowWheelScrub,
|
|
57
|
+
format: props.format,
|
|
58
|
+
locale: props.locale,
|
|
59
|
+
disabled: props.disabled,
|
|
60
|
+
readOnly: props.readOnly,
|
|
61
|
+
required: props.required,
|
|
62
|
+
name: props.name,
|
|
63
|
+
form: props.form,
|
|
64
|
+
onValueChange(value, details) {
|
|
65
|
+
emit("valueChange", value, details);
|
|
66
|
+
if (!details.canceled) emit("update:modelValue", value);
|
|
67
|
+
},
|
|
68
|
+
onValueCommitted: (value, details) => emit("valueCommitted", value, details)
|
|
69
|
+
})));
|
|
70
|
+
const named = fromSignal(made.named);
|
|
71
|
+
return () => h(RootElement, attrs, () => [slots.default?.(), named.value ? h(HiddenInput) : null]);
|
|
72
|
+
}
|
|
73
|
+
}),
|
|
74
|
+
Group: partComponent("NumberFieldGroup", "div", () => scope.use().group),
|
|
75
|
+
Input: partComponent("NumberFieldInput", "input", () => scope.use().input),
|
|
76
|
+
Increment: partComponent("NumberFieldIncrement", "button", () => scope.use().increment),
|
|
77
|
+
Decrement: partComponent("NumberFieldDecrement", "button", () => scope.use().decrement)
|
|
78
|
+
};
|
|
79
|
+
export { NumberField };
|
|
80
|
+
|
|
81
|
+
//# sourceMappingURL=number-field.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"number-field.js","names":[],"sources":["../../../../packages/vue/src/number-field.ts"],"sourcesContent":["import { within } from \"@kirana-ui/core\"\nimport type { ChangeDetails } from \"@kirana-ui/core\"\nimport { createNumberField } from \"@kirana-ui/core/number-field\"\nimport type { NumberField as Controller } from \"@kirana-ui/core/number-field\"\nimport { defineComponent, h, useId } from \"vue\"\nimport type { PropType } from \"vue\"\n\nimport { useFieldAround } from \"./field-context.ts\"\nimport { context, controller, fromSignal, partComponent } from \"./runtime.ts\"\n\nconst scope = context<Controller>(\"NumberField\")\n\nconst RootElement = partComponent(\"NumberFieldRootElement\", \"div\", () => scope.use().root)\nconst HiddenInput = partComponent(\"NumberFieldHiddenInput\", \"input\", () => scope.use().hidden)\n\n/** `v-model` is the number, `null` for none; `@value-committed` hears a change that is done. */\nconst Root = defineComponent({\n name: \"NumberFieldRoot\",\n inheritAttrs: false,\n props: {\n modelValue: { type: null as unknown as PropType<number | null>, default: undefined },\n defaultValue: { type: null as unknown as PropType<number | null>, default: undefined },\n min: Number,\n max: Number,\n step: Number,\n smallStep: Number,\n largeStep: Number,\n snapOnStep: Boolean,\n allowWheelScrub: Boolean,\n format: Object as PropType<Intl.NumberFormatOptions>,\n locale: String,\n disabled: Boolean,\n readOnly: Boolean,\n required: Boolean,\n name: String,\n form: String,\n id: String,\n },\n emits: [\"update:modelValue\", \"valueChange\", \"valueCommitted\"],\n setup(props, { attrs, slots, emit }) {\n const generated = useId()\n const made = scope.provide(\n controller(within(createNumberField, { field: useFieldAround() }), () => ({\n id: props.id ?? generated,\n value: props.modelValue,\n defaultValue: props.defaultValue,\n min: props.min,\n max: props.max,\n step: props.step,\n smallStep: props.smallStep,\n largeStep: props.largeStep,\n snapOnStep: props.snapOnStep,\n allowWheelScrub: props.allowWheelScrub,\n format: props.format,\n locale: props.locale,\n disabled: props.disabled,\n readOnly: props.readOnly,\n required: props.required,\n name: props.name,\n form: props.form,\n onValueChange(value: number | null, details: ChangeDetails) {\n emit(\"valueChange\", value, details)\n if (!details.canceled) emit(\"update:modelValue\", value)\n },\n onValueCommitted: (value: number | null, details: ChangeDetails) =>\n emit(\"valueCommitted\", value, details),\n }))\n )\n const named = fromSignal(made.named)\n return () =>\n h(RootElement, attrs, () => [slots.default?.(), named.value ? h(HiddenInput) : null])\n },\n})\n\nexport const NumberField = {\n Root,\n Group: partComponent(\"NumberFieldGroup\", \"div\", () => scope.use().group),\n Input: partComponent(\"NumberFieldInput\", \"input\", () => scope.use().input),\n Increment: partComponent(\"NumberFieldIncrement\", \"button\", () => scope.use().increment),\n Decrement: partComponent(\"NumberFieldDecrement\", \"button\", () => scope.use().decrement),\n}\n"],"mappings":";;;;;;AAUA,MAAM,QAAQ,QAAoB,aAAa;AAE/C,MAAM,cAAc,cAAc,0BAA0B,aAAa,MAAM,IAAI,CAAC,CAAC,IAAI;AACzF,MAAM,cAAc,cAAc,0BAA0B,eAAe,MAAM,IAAI,CAAC,CAAC,MAAM;AA6D7F,MAAa,cAAc;CACzB,MA3DW,gBAAgB;EAC3B,MAAM;EACN,cAAc;EACd,OAAO;GACL,YAAY;IAAE,MAAM;IAA4C,SAAS,KAAA;GAAU;GACnF,cAAc;IAAE,MAAM;IAA4C,SAAS,KAAA;GAAU;GACrF,KAAK;GACL,KAAK;GACL,MAAM;GACN,WAAW;GACX,WAAW;GACX,YAAY;GACZ,iBAAiB;GACjB,QAAQ;GACR,QAAQ;GACR,UAAU;GACV,UAAU;GACV,UAAU;GACV,MAAM;GACN,MAAM;GACN,IAAI;EACN;EACA,OAAO;GAAC;GAAqB;GAAe;EAAgB;EAC5D,MAAM,OAAO,EAAE,OAAO,OAAO,QAAQ;GACnC,MAAM,YAAY,MAAM;GACxB,MAAM,OAAO,MAAM,QACjB,WAAW,OAAO,mBAAmB,EAAE,OAAO,eAAe,EAAE,CAAC,UAAU;IACxE,IAAI,MAAM,MAAM;IAChB,OAAO,MAAM;IACb,cAAc,MAAM;IACpB,KAAK,MAAM;IACX,KAAK,MAAM;IACX,MAAM,MAAM;IACZ,WAAW,MAAM;IACjB,WAAW,MAAM;IACjB,YAAY,MAAM;IAClB,iBAAiB,MAAM;IACvB,QAAQ,MAAM;IACd,QAAQ,MAAM;IACd,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,qBAAqB,KAAK;IACxD;IACA,mBAAmB,OAAsB,YACvC,KAAK,kBAAkB,OAAO,OAAO;GACzC,EAAE,CACJ;GACA,MAAM,QAAQ,WAAW,KAAK,KAAK;GACnC,aACE,EAAE,aAAa,aAAa,CAAC,MAAM,UAAU,GAAG,MAAM,QAAQ,EAAE,WAAW,IAAI,IAAI,CAAC;EACxF;CACF,CAGE;CACA,OAAO,cAAc,oBAAoB,aAAa,MAAM,IAAI,CAAC,CAAC,KAAK;CACvE,OAAO,cAAc,oBAAoB,eAAe,MAAM,IAAI,CAAC,CAAC,KAAK;CACzE,WAAW,cAAc,wBAAwB,gBAAgB,MAAM,IAAI,CAAC,CAAC,SAAS;CACtF,WAAW,cAAc,wBAAwB,gBAAgB,MAAM,IAAI,CAAC,CAAC,SAAS;AACxF"}
|
package/src/otp.d.ts
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { PropType } from "vue";
|
|
2
|
+
import { OtpProps } from "@kirana-ui/core/otp";
|
|
3
|
+
export declare const Otp: {
|
|
4
|
+
Root: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
5
|
+
length: NumberConstructor;
|
|
6
|
+
value: {
|
|
7
|
+
type: StringConstructor;
|
|
8
|
+
default: undefined;
|
|
9
|
+
};
|
|
10
|
+
defaultValue: StringConstructor;
|
|
11
|
+
mode: PropType<OtpProps["mode"]>;
|
|
12
|
+
disabled: BooleanConstructor;
|
|
13
|
+
name: StringConstructor;
|
|
14
|
+
form: StringConstructor;
|
|
15
|
+
id: StringConstructor;
|
|
16
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
17
|
+
[key: string]: any;
|
|
18
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("complete" | "update:value" | "valueChange")[], "complete" | "update:value" | "valueChange", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
19
|
+
length: NumberConstructor;
|
|
20
|
+
value: {
|
|
21
|
+
type: StringConstructor;
|
|
22
|
+
default: undefined;
|
|
23
|
+
};
|
|
24
|
+
defaultValue: StringConstructor;
|
|
25
|
+
mode: PropType<OtpProps["mode"]>;
|
|
26
|
+
disabled: BooleanConstructor;
|
|
27
|
+
name: StringConstructor;
|
|
28
|
+
form: StringConstructor;
|
|
29
|
+
id: StringConstructor;
|
|
30
|
+
}>> & Readonly<{
|
|
31
|
+
onComplete?: ((...args: any[]) => any) | undefined;
|
|
32
|
+
"onUpdate:value"?: ((...args: any[]) => any) | undefined;
|
|
33
|
+
onValueChange?: ((...args: any[]) => any) | undefined;
|
|
34
|
+
}>, {
|
|
35
|
+
value: string;
|
|
36
|
+
disabled: boolean;
|
|
37
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
38
|
+
Input: import("vue").Component;
|
|
39
|
+
Group: import("vue").Component;
|
|
40
|
+
Slot: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
41
|
+
index: {
|
|
42
|
+
type: NumberConstructor;
|
|
43
|
+
required: true;
|
|
44
|
+
};
|
|
45
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
46
|
+
[key: string]: any;
|
|
47
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
48
|
+
index: {
|
|
49
|
+
type: NumberConstructor;
|
|
50
|
+
required: true;
|
|
51
|
+
};
|
|
52
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
53
|
+
Separator: import("vue").Component;
|
|
54
|
+
Caret: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
55
|
+
[key: string]: any;
|
|
56
|
+
}> | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=otp.d.ts.map
|
package/src/otp.js
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { context, controller, fromSignal, optional, partComponent } from "./runtime.js";
|
|
2
|
+
import { defineComponent, h, inject, provide, useId } from "vue";
|
|
3
|
+
import { createOtp } from "@kirana-ui/core/otp";
|
|
4
|
+
// src/otp.ts
|
|
5
|
+
const scope = context("Otp");
|
|
6
|
+
const SLOT = Symbol("OtpSlot");
|
|
7
|
+
const RootElement = partComponent("OtpRootElement", "div", () => scope.use().root);
|
|
8
|
+
/** `v-model:value`; `@value-change` carries the details, `@complete` the finished code. */
|
|
9
|
+
const Root = defineComponent({
|
|
10
|
+
name: "OtpRoot",
|
|
11
|
+
inheritAttrs: false,
|
|
12
|
+
props: {
|
|
13
|
+
length: Number,
|
|
14
|
+
value: optional(String),
|
|
15
|
+
defaultValue: String,
|
|
16
|
+
mode: String,
|
|
17
|
+
disabled: Boolean,
|
|
18
|
+
name: String,
|
|
19
|
+
form: String,
|
|
20
|
+
id: String
|
|
21
|
+
},
|
|
22
|
+
emits: [
|
|
23
|
+
"update:value",
|
|
24
|
+
"valueChange",
|
|
25
|
+
"complete"
|
|
26
|
+
],
|
|
27
|
+
setup(props, { attrs, slots, emit }) {
|
|
28
|
+
const generated = useId();
|
|
29
|
+
scope.provide(controller(createOtp, () => ({
|
|
30
|
+
id: props.id ?? generated,
|
|
31
|
+
length: props.length,
|
|
32
|
+
value: props.value,
|
|
33
|
+
defaultValue: props.defaultValue,
|
|
34
|
+
mode: props.mode,
|
|
35
|
+
disabled: props.disabled,
|
|
36
|
+
name: props.name,
|
|
37
|
+
form: props.form,
|
|
38
|
+
onValueChange(value, details) {
|
|
39
|
+
emit("valueChange", value, details);
|
|
40
|
+
if (!details.canceled) emit("update:value", value);
|
|
41
|
+
},
|
|
42
|
+
onComplete: (value) => emit("complete", value)
|
|
43
|
+
})));
|
|
44
|
+
return () => h(RootElement, attrs, slots);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
/** One cell: it shows its character, then whatever it is given (a caret). */
|
|
48
|
+
const Slot = defineComponent({
|
|
49
|
+
name: "OtpSlot",
|
|
50
|
+
inheritAttrs: false,
|
|
51
|
+
props: { index: {
|
|
52
|
+
type: Number,
|
|
53
|
+
required: true
|
|
54
|
+
} },
|
|
55
|
+
setup(props, { attrs, slots }) {
|
|
56
|
+
const slot = scope.use().slot(props.index);
|
|
57
|
+
provide(SLOT, slot);
|
|
58
|
+
const char = fromSignal(slot.char);
|
|
59
|
+
const Element = partComponent("OtpSlotElement", "div", () => slot.part);
|
|
60
|
+
return () => h(Element, attrs, () => [char.value, slots.default?.()]);
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
/** Drawn in its cell while the cell is the active one and empty. */
|
|
64
|
+
const Caret = defineComponent({
|
|
65
|
+
name: "OtpCaret",
|
|
66
|
+
inheritAttrs: false,
|
|
67
|
+
setup(_props, { attrs, slots }) {
|
|
68
|
+
const made = scope.use();
|
|
69
|
+
const slot = inject(SLOT, void 0);
|
|
70
|
+
if (!slot) throw new Error("An Otp.Caret must be inside <Otp.Slot>");
|
|
71
|
+
const shown = fromSignal(slot.caret);
|
|
72
|
+
const Element = partComponent("OtpCaretElement", "div", () => made.caretPart);
|
|
73
|
+
return () => shown.value ? h(Element, attrs, slots) : null;
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
const Otp = {
|
|
77
|
+
Root,
|
|
78
|
+
Input: partComponent("OtpInput", "input", () => scope.use().input),
|
|
79
|
+
Group: partComponent("OtpGroup", "div", () => scope.use().group),
|
|
80
|
+
Slot,
|
|
81
|
+
Separator: partComponent("OtpSeparator", "div", () => scope.use().separator),
|
|
82
|
+
Caret
|
|
83
|
+
};
|
|
84
|
+
export { Otp };
|
|
85
|
+
|
|
86
|
+
//# sourceMappingURL=otp.js.map
|
package/src/otp.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"otp.js","names":[],"sources":["../../../../packages/vue/src/otp.ts"],"sourcesContent":["import type { ChangeDetails } from \"@kirana-ui/core\"\nimport { createOtp } from \"@kirana-ui/core/otp\"\nimport type { Otp as Controller, OtpProps, OtpSlot } from \"@kirana-ui/core/otp\"\nimport { defineComponent, h, inject, provide, useId } from \"vue\"\nimport type { InjectionKey, PropType } from \"vue\"\n\nimport { context, controller, fromSignal, optional, partComponent } from \"./runtime.ts\"\n\nconst scope = context<Controller>(\"Otp\")\nconst SLOT: InjectionKey<OtpSlot> = Symbol(\"OtpSlot\")\n\nconst RootElement = partComponent(\"OtpRootElement\", \"div\", () => scope.use().root)\n\n/** `v-model:value`; `@value-change` carries the details, `@complete` the finished code. */\nconst Root = defineComponent({\n name: \"OtpRoot\",\n inheritAttrs: false,\n props: {\n length: Number,\n value: optional(String),\n defaultValue: String,\n mode: String as PropType<OtpProps[\"mode\"]>,\n disabled: Boolean,\n name: String,\n form: String,\n id: String,\n },\n emits: [\"update:value\", \"valueChange\", \"complete\"],\n setup(props, { attrs, slots, emit }) {\n const generated = useId()\n scope.provide(\n controller(createOtp, () => ({\n id: props.id ?? generated,\n length: props.length,\n value: props.value,\n defaultValue: props.defaultValue,\n mode: props.mode,\n disabled: props.disabled,\n name: props.name,\n form: props.form,\n onValueChange(value: string, details: ChangeDetails) {\n emit(\"valueChange\", value, details)\n if (!details.canceled) emit(\"update:value\", value)\n },\n onComplete: (value: string) => emit(\"complete\", value),\n }))\n )\n return () => h(RootElement, attrs, slots)\n },\n})\n\n/** One cell: it shows its character, then whatever it is given (a caret). */\nconst Slot = defineComponent({\n name: \"OtpSlot\",\n inheritAttrs: false,\n props: { index: { type: Number, required: true } },\n setup(props, { attrs, slots }) {\n const slot = scope.use().slot(props.index)\n provide(SLOT, slot)\n const char = fromSignal(slot.char)\n const Element = partComponent(\"OtpSlotElement\", \"div\", () => slot.part)\n return () => h(Element, attrs, () => [char.value, slots.default?.()])\n },\n})\n\n/** Drawn in its cell while the cell is the active one and empty. */\nconst Caret = defineComponent({\n name: \"OtpCaret\",\n inheritAttrs: false,\n setup(_props, { attrs, slots }) {\n const made = scope.use()\n const slot = inject(SLOT, undefined)\n if (!slot) throw new Error(\"An Otp.Caret must be inside <Otp.Slot>\")\n const shown = fromSignal(slot.caret)\n const Element = partComponent(\"OtpCaretElement\", \"div\", () => made.caretPart)\n return () => (shown.value ? h(Element, attrs, slots) : null)\n },\n})\n\nexport const Otp = {\n Root,\n Input: partComponent(\"OtpInput\", \"input\", () => scope.use().input),\n Group: partComponent(\"OtpGroup\", \"div\", () => scope.use().group),\n Slot,\n Separator: partComponent(\"OtpSeparator\", \"div\", () => scope.use().separator),\n Caret,\n}\n"],"mappings":";;;;AAQA,MAAM,QAAQ,QAAoB,KAAK;AACvC,MAAM,OAA8B,OAAO,SAAS;AAEpD,MAAM,cAAc,cAAc,kBAAkB,aAAa,MAAM,IAAI,CAAC,CAAC,IAAI;;AAGjF,MAAM,OAAO,gBAAgB;CAC3B,MAAM;CACN,cAAc;CACd,OAAO;EACL,QAAQ;EACR,OAAO,SAAS,MAAM;EACtB,cAAc;EACd,MAAM;EACN,UAAU;EACV,MAAM;EACN,MAAM;EACN,IAAI;CACN;CACA,OAAO;EAAC;EAAgB;EAAe;CAAU;CACjD,MAAM,OAAO,EAAE,OAAO,OAAO,QAAQ;EACnC,MAAM,YAAY,MAAM;EACxB,MAAM,QACJ,WAAW,kBAAkB;GAC3B,IAAI,MAAM,MAAM;GAChB,QAAQ,MAAM;GACd,OAAO,MAAM;GACb,cAAc,MAAM;GACpB,MAAM,MAAM;GACZ,UAAU,MAAM;GAChB,MAAM,MAAM;GACZ,MAAM,MAAM;GACZ,cAAc,OAAe,SAAwB;IACnD,KAAK,eAAe,OAAO,OAAO;IAClC,IAAI,CAAC,QAAQ,UAAU,KAAK,gBAAgB,KAAK;GACnD;GACA,aAAa,UAAkB,KAAK,YAAY,KAAK;EACvD,EAAE,CACJ;EACA,aAAa,EAAE,aAAa,OAAO,KAAK;CAC1C;AACF,CAAC;;AAGD,MAAM,OAAO,gBAAgB;CAC3B,MAAM;CACN,cAAc;CACd,OAAO,EAAE,OAAO;EAAE,MAAM;EAAQ,UAAU;CAAK,EAAE;CACjD,MAAM,OAAO,EAAE,OAAO,SAAS;EAC7B,MAAM,OAAO,MAAM,IAAI,CAAC,CAAC,KAAK,MAAM,KAAK;EACzC,QAAQ,MAAM,IAAI;EAClB,MAAM,OAAO,WAAW,KAAK,IAAI;EACjC,MAAM,UAAU,cAAc,kBAAkB,aAAa,KAAK,IAAI;EACtE,aAAa,EAAE,SAAS,aAAa,CAAC,KAAK,OAAO,MAAM,UAAU,CAAC,CAAC;CACtE;AACF,CAAC;;AAGD,MAAM,QAAQ,gBAAgB;CAC5B,MAAM;CACN,cAAc;CACd,MAAM,QAAQ,EAAE,OAAO,SAAS;EAC9B,MAAM,OAAO,MAAM,IAAI;EACvB,MAAM,OAAO,OAAO,MAAM,KAAA,CAAS;EACnC,IAAI,CAAC,MAAM,MAAM,IAAI,MAAM,wCAAwC;EACnE,MAAM,QAAQ,WAAW,KAAK,KAAK;EACnC,MAAM,UAAU,cAAc,mBAAmB,aAAa,KAAK,SAAS;EAC5E,aAAc,MAAM,QAAQ,EAAE,SAAS,OAAO,KAAK,IAAI;CACzD;AACF,CAAC;AAED,MAAa,MAAM;CACjB;CACA,OAAO,cAAc,YAAY,eAAe,MAAM,IAAI,CAAC,CAAC,KAAK;CACjE,OAAO,cAAc,YAAY,aAAa,MAAM,IAAI,CAAC,CAAC,KAAK;CAC/D;CACA,WAAW,cAAc,gBAAgB,aAAa,MAAM,IAAI,CAAC,CAAC,SAAS;CAC3E;AACF"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export declare const Pagination: {
|
|
2
|
+
Root: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
3
|
+
page: {
|
|
4
|
+
type: NumberConstructor;
|
|
5
|
+
default: undefined;
|
|
6
|
+
};
|
|
7
|
+
defaultPage: NumberConstructor;
|
|
8
|
+
count: {
|
|
9
|
+
type: NumberConstructor;
|
|
10
|
+
required: true;
|
|
11
|
+
};
|
|
12
|
+
pageSize: NumberConstructor;
|
|
13
|
+
siblingCount: NumberConstructor;
|
|
14
|
+
boundaryCount: NumberConstructor;
|
|
15
|
+
disabled: BooleanConstructor;
|
|
16
|
+
id: StringConstructor;
|
|
17
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
18
|
+
[key: string]: any;
|
|
19
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("pageChange" | "update:page")[], "pageChange" | "update:page", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
20
|
+
page: {
|
|
21
|
+
type: NumberConstructor;
|
|
22
|
+
default: undefined;
|
|
23
|
+
};
|
|
24
|
+
defaultPage: NumberConstructor;
|
|
25
|
+
count: {
|
|
26
|
+
type: NumberConstructor;
|
|
27
|
+
required: true;
|
|
28
|
+
};
|
|
29
|
+
pageSize: NumberConstructor;
|
|
30
|
+
siblingCount: NumberConstructor;
|
|
31
|
+
boundaryCount: NumberConstructor;
|
|
32
|
+
disabled: BooleanConstructor;
|
|
33
|
+
id: StringConstructor;
|
|
34
|
+
}>> & Readonly<{
|
|
35
|
+
onPageChange?: ((...args: any[]) => any) | undefined;
|
|
36
|
+
"onUpdate:page"?: ((...args: any[]) => any) | undefined;
|
|
37
|
+
}>, {
|
|
38
|
+
page: number;
|
|
39
|
+
disabled: boolean;
|
|
40
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
41
|
+
Items: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
42
|
+
[key: string]: any;
|
|
43
|
+
}>[], {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
44
|
+
Item: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
45
|
+
page: {
|
|
46
|
+
type: NumberConstructor;
|
|
47
|
+
required: true;
|
|
48
|
+
};
|
|
49
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
50
|
+
[key: string]: any;
|
|
51
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
52
|
+
page: {
|
|
53
|
+
type: NumberConstructor;
|
|
54
|
+
required: true;
|
|
55
|
+
};
|
|
56
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
57
|
+
Ellipsis: import("vue").Component;
|
|
58
|
+
Previous: import("vue").Component;
|
|
59
|
+
Next: import("vue").Component;
|
|
60
|
+
};
|
|
61
|
+
//# sourceMappingURL=pagination.d.ts.map
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { context, controller, fromSignal, optional, partComponent } from "./runtime.js";
|
|
2
|
+
import { Fragment, defineComponent, h, useId } from "vue";
|
|
3
|
+
import { createPagination } from "@kirana-ui/core/pagination";
|
|
4
|
+
// src/pagination.ts
|
|
5
|
+
const scope = context("Pagination");
|
|
6
|
+
const RootElement = partComponent("PaginationRootElement", "nav", () => scope.use().root);
|
|
7
|
+
const Pagination = {
|
|
8
|
+
Root: defineComponent({
|
|
9
|
+
name: "PaginationRoot",
|
|
10
|
+
inheritAttrs: false,
|
|
11
|
+
props: {
|
|
12
|
+
page: optional(Number),
|
|
13
|
+
defaultPage: Number,
|
|
14
|
+
count: {
|
|
15
|
+
type: Number,
|
|
16
|
+
required: true
|
|
17
|
+
},
|
|
18
|
+
pageSize: Number,
|
|
19
|
+
siblingCount: Number,
|
|
20
|
+
boundaryCount: Number,
|
|
21
|
+
disabled: Boolean,
|
|
22
|
+
id: String
|
|
23
|
+
},
|
|
24
|
+
emits: ["update:page", "pageChange"],
|
|
25
|
+
setup(props, { attrs, slots, emit }) {
|
|
26
|
+
const generated = useId();
|
|
27
|
+
scope.provide(controller(createPagination, () => ({
|
|
28
|
+
id: props.id ?? generated,
|
|
29
|
+
page: props.page,
|
|
30
|
+
defaultPage: props.defaultPage,
|
|
31
|
+
count: props.count,
|
|
32
|
+
pageSize: props.pageSize,
|
|
33
|
+
siblingCount: props.siblingCount,
|
|
34
|
+
boundaryCount: props.boundaryCount,
|
|
35
|
+
disabled: props.disabled,
|
|
36
|
+
onPageChange(page, details) {
|
|
37
|
+
emit("pageChange", page, details);
|
|
38
|
+
if (!details.canceled) emit("update:page", page);
|
|
39
|
+
}
|
|
40
|
+
})));
|
|
41
|
+
return () => h(RootElement, attrs, slots);
|
|
42
|
+
}
|
|
43
|
+
}),
|
|
44
|
+
Items: defineComponent({
|
|
45
|
+
name: "PaginationItems",
|
|
46
|
+
setup(_props, { slots }) {
|
|
47
|
+
const entries = fromSignal(scope.use().entries);
|
|
48
|
+
return () => entries.value.map((entry) => h(Fragment, { key: entry.key }, slots.default?.({ entry })));
|
|
49
|
+
}
|
|
50
|
+
}),
|
|
51
|
+
Item: defineComponent({
|
|
52
|
+
name: "PaginationItem",
|
|
53
|
+
inheritAttrs: false,
|
|
54
|
+
props: { page: {
|
|
55
|
+
type: Number,
|
|
56
|
+
required: true
|
|
57
|
+
} },
|
|
58
|
+
setup(props, { attrs, slots }) {
|
|
59
|
+
const made = scope.use();
|
|
60
|
+
const Element = partComponent("PaginationItemElement", "button", () => made.item(props.page));
|
|
61
|
+
return () => h(Element, attrs, slots);
|
|
62
|
+
}
|
|
63
|
+
}),
|
|
64
|
+
Ellipsis: partComponent("PaginationEllipsis", "span", () => scope.use().ellipsis),
|
|
65
|
+
Previous: partComponent("PaginationPrevious", "button", () => scope.use().previous),
|
|
66
|
+
Next: partComponent("PaginationNext", "button", () => scope.use().next)
|
|
67
|
+
};
|
|
68
|
+
export { Pagination };
|
|
69
|
+
|
|
70
|
+
//# sourceMappingURL=pagination.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.js","names":[],"sources":["../../../../packages/vue/src/pagination.ts"],"sourcesContent":["import type { ChangeDetails } from \"@kirana-ui/core\"\nimport { createPagination } from \"@kirana-ui/core/pagination\"\nimport type { Pagination as Controller } from \"@kirana-ui/core/pagination\"\nimport { Fragment, defineComponent, h, useId } from \"vue\"\n\nimport { context, controller, fromSignal, optional, partComponent } from \"./runtime.ts\"\n\nconst scope = context<Controller>(\"Pagination\")\n\nconst RootElement = partComponent(\"PaginationRootElement\", \"nav\", () => scope.use().root)\n\n/** `v-model:page`, and `@page-change=\"(page, details) => …\"`. */\nconst Root = defineComponent({\n name: \"PaginationRoot\",\n inheritAttrs: false,\n props: {\n page: optional(Number),\n defaultPage: Number,\n count: { type: Number, required: true },\n pageSize: Number,\n siblingCount: Number,\n boundaryCount: Number,\n disabled: Boolean,\n id: String,\n },\n emits: [\"update:page\", \"pageChange\"],\n setup(props, { attrs, slots, emit }) {\n const generated = useId()\n scope.provide(\n controller(createPagination, () => ({\n id: props.id ?? generated,\n page: props.page,\n defaultPage: props.defaultPage,\n count: props.count,\n pageSize: props.pageSize,\n siblingCount: props.siblingCount,\n boundaryCount: props.boundaryCount,\n disabled: props.disabled,\n onPageChange(page: number, details: ChangeDetails) {\n emit(\"pageChange\", page, details)\n if (!details.canceled) emit(\"update:page\", page)\n },\n }))\n )\n return () => h(RootElement, attrs, slots)\n },\n})\n\n/** Draws its slot once for each piece of the row (`v-slot=\"{ entry }\"`). */\nconst Items = defineComponent({\n name: \"PaginationItems\",\n setup(_props, { slots }) {\n const entries = fromSignal(scope.use().entries)\n return () =>\n entries.value.map((entry) => h(Fragment, { key: entry.key }, slots.default?.({ entry })))\n },\n})\n\nconst Item = defineComponent({\n name: \"PaginationItem\",\n inheritAttrs: false,\n props: { page: { type: Number, required: true } },\n setup(props, { attrs, slots }) {\n const made = scope.use()\n const Element = partComponent(\"PaginationItemElement\", \"button\", () => made.item(props.page))\n return () => h(Element, attrs, slots)\n },\n})\n\nexport const Pagination = {\n Root,\n Items,\n Item,\n Ellipsis: partComponent(\"PaginationEllipsis\", \"span\", () => scope.use().ellipsis),\n Previous: partComponent(\"PaginationPrevious\", \"button\", () => scope.use().previous),\n Next: partComponent(\"PaginationNext\", \"button\", () => scope.use().next),\n}\n"],"mappings":";;;;AAOA,MAAM,QAAQ,QAAoB,YAAY;AAE9C,MAAM,cAAc,cAAc,yBAAyB,aAAa,MAAM,IAAI,CAAC,CAAC,IAAI;AA4DxF,MAAa,aAAa;CACxB,MA1DW,gBAAgB;EAC3B,MAAM;EACN,cAAc;EACd,OAAO;GACL,MAAM,SAAS,MAAM;GACrB,aAAa;GACb,OAAO;IAAE,MAAM;IAAQ,UAAU;GAAK;GACtC,UAAU;GACV,cAAc;GACd,eAAe;GACf,UAAU;GACV,IAAI;EACN;EACA,OAAO,CAAC,eAAe,YAAY;EACnC,MAAM,OAAO,EAAE,OAAO,OAAO,QAAQ;GACnC,MAAM,YAAY,MAAM;GACxB,MAAM,QACJ,WAAW,yBAAyB;IAClC,IAAI,MAAM,MAAM;IAChB,MAAM,MAAM;IACZ,aAAa,MAAM;IACnB,OAAO,MAAM;IACb,UAAU,MAAM;IAChB,cAAc,MAAM;IACpB,eAAe,MAAM;IACrB,UAAU,MAAM;IAChB,aAAa,MAAc,SAAwB;KACjD,KAAK,cAAc,MAAM,OAAO;KAChC,IAAI,CAAC,QAAQ,UAAU,KAAK,eAAe,IAAI;IACjD;GACF,EAAE,CACJ;GACA,aAAa,EAAE,aAAa,OAAO,KAAK;EAC1C;CACF,CAwBE;CACA,OAtBY,gBAAgB;EAC5B,MAAM;EACN,MAAM,QAAQ,EAAE,SAAS;GACvB,MAAM,UAAU,WAAW,MAAM,IAAI,CAAC,CAAC,OAAO;GAC9C,aACE,QAAQ,MAAM,KAAK,UAAU,EAAE,UAAU,EAAE,KAAK,MAAM,IAAI,GAAG,MAAM,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;EAC5F;CACF,CAeE;CACA,MAdW,gBAAgB;EAC3B,MAAM;EACN,cAAc;EACd,OAAO,EAAE,MAAM;GAAE,MAAM;GAAQ,UAAU;EAAK,EAAE;EAChD,MAAM,OAAO,EAAE,OAAO,SAAS;GAC7B,MAAM,OAAO,MAAM,IAAI;GACvB,MAAM,UAAU,cAAc,yBAAyB,gBAAgB,KAAK,KAAK,MAAM,IAAI,CAAC;GAC5F,aAAa,EAAE,SAAS,OAAO,KAAK;EACtC;CACF,CAKE;CACA,UAAU,cAAc,sBAAsB,cAAc,MAAM,IAAI,CAAC,CAAC,QAAQ;CAChF,UAAU,cAAc,sBAAsB,gBAAgB,MAAM,IAAI,CAAC,CAAC,QAAQ;CAClF,MAAM,cAAc,kBAAkB,gBAAgB,MAAM,IAAI,CAAC,CAAC,IAAI;AACxE"}
|
package/src/popover.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { Popover as Popover$1 } from "@kirana-ui/core/popover";
|
|
2
2
|
import { Component } from "vue";
|
|
3
|
+
declare const scope: {
|
|
4
|
+
provide(controller: Popover$1): Popover$1;
|
|
5
|
+
use(): Popover$1;
|
|
6
|
+
};
|
|
3
7
|
/** A positioner: the part's element, with where it goes as props. */
|
|
4
8
|
export declare function positionerComponent(name: string, use: () => {
|
|
5
9
|
positioning: Popover$1["positioning"];
|
|
@@ -36,4 +40,5 @@ export declare const Popover: {
|
|
|
36
40
|
Description: Component;
|
|
37
41
|
Close: Component;
|
|
38
42
|
};
|
|
43
|
+
export { scope as popoverScope };
|
|
39
44
|
//# sourceMappingURL=popover.d.ts.map
|
package/src/popover.js
CHANGED
|
@@ -55,6 +55,6 @@ const Popover = {
|
|
|
55
55
|
Description: partComponent("PopoverDescription", "p", () => scope.use().description),
|
|
56
56
|
Close: partComponent("PopoverClose", "button", () => scope.use().close)
|
|
57
57
|
};
|
|
58
|
-
export { Popover, positionerComponent };
|
|
58
|
+
export { Popover, scope as popoverScope, positionerComponent };
|
|
59
59
|
|
|
60
60
|
//# 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 { context, controller, optional, partComponent, portalComponent } from \"./runtime.ts\"\n\nconst scope = context<Controller>(\"Popover\")\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})\n\n/** A positioner: the part's element, with where it goes as props. */\nexport function positionerComponent(\n name: string,\n use: () => { positioning: Controller[\"positioning\"] },\n element: Component\n): Component {\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 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 })), { flush: \"sync\" })\n return () => h(element, attrs, slots)\n },\n })\n}\n\nexport const Popover = {\n Root,\n Trigger: partComponent(\"PopoverTrigger\", \"button\", () => scope.use().trigger),\n Portal: portalComponent(\"PopoverPortal\", () => scope.use().mounted),\n Positioner: positionerComponent(\n \"PopoverPositioner\",\n () => scope.use(),\n partComponent(\"PopoverPositionerElement\", \"div\", () => scope.use().positioner)\n ),\n Popup: partComponent(\"PopoverPopup\", \"div\", () => scope.use().popup),\n Title: partComponent(\"PopoverTitle\", \"h2\", () => scope.use().title),\n Description: partComponent(\"PopoverDescription\", \"p\", () => scope.use().description),\n Close: partComponent(\"PopoverClose\", \"button\", () => scope.use().close),\n}\n"],"mappings":";;;;;AASA,MAAM,QAAQ,QAAoB,SAAS;
|
|
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 { context, controller, optional, partComponent, portalComponent } from \"./runtime.ts\"\n\nconst scope = context<Controller>(\"Popover\")\n/** For a component made of this one's parts: a date picker. */\nexport { scope as popoverScope }\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})\n\n/** A positioner: the part's element, with where it goes as props. */\nexport function positionerComponent(\n name: string,\n use: () => { positioning: Controller[\"positioning\"] },\n element: Component\n): Component {\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 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 })), { flush: \"sync\" })\n return () => h(element, attrs, slots)\n },\n })\n}\n\nexport const Popover = {\n Root,\n Trigger: partComponent(\"PopoverTrigger\", \"button\", () => scope.use().trigger),\n Portal: portalComponent(\"PopoverPortal\", () => scope.use().mounted),\n Positioner: positionerComponent(\n \"PopoverPositioner\",\n () => scope.use(),\n partComponent(\"PopoverPositionerElement\", \"div\", () => scope.use().positioner)\n ),\n Popup: partComponent(\"PopoverPopup\", \"div\", () => scope.use().popup),\n Title: partComponent(\"PopoverTitle\", \"h2\", () => scope.use().title),\n Description: partComponent(\"PopoverDescription\", \"p\", () => scope.use().description),\n Close: partComponent(\"PopoverClose\", \"button\", () => scope.use().close),\n}\n"],"mappings":";;;;;AASA,MAAM,QAAQ,QAAoB,SAAS;AAI3C,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;;AAGD,SAAgB,oBACd,MACA,KACA,SACW;CACX,OAAO,gBAAgB;EACrB;EACA,cAAc;EACd,OAAO;GACL,MAAM;GACN,OAAO;GACP,YAAY;GACZ,aAAa;GACb,kBAAkB;EACpB;EACA,MAAM,OAAO,EAAE,OAAO,SAAS;GAC7B,MAAM,EAAE,gBAAgB,IAAI;GAE5B,kBAAkB,YAAY,IAAI,QAAQ,EAAE,GAAG,MAAM,CAAC,CAAC,GAAG,EAAE,OAAO,OAAO,CAAC;GAC3E,aAAa,EAAE,SAAS,OAAO,KAAK;EACtC;CACF,CAAC;AACH;AAEA,MAAa,UAAU;CACrB;CACA,SAAS,cAAc,kBAAkB,gBAAgB,MAAM,IAAI,CAAC,CAAC,OAAO;CAC5E,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,cAAc,gBAAgB,aAAa,MAAM,IAAI,CAAC,CAAC,KAAK;CACnE,OAAO,cAAc,gBAAgB,YAAY,MAAM,IAAI,CAAC,CAAC,KAAK;CAClE,aAAa,cAAc,sBAAsB,WAAW,MAAM,IAAI,CAAC,CAAC,WAAW;CACnF,OAAO,cAAc,gBAAgB,gBAAgB,MAAM,IAAI,CAAC,CAAC,KAAK;AACxE"}
|
package/src/qr-code.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { PropType } from "vue";
|
|
2
|
+
import { QrCorrection } from "@kirana-ui/core/qr-code";
|
|
3
|
+
export declare const QrCode: {
|
|
4
|
+
Root: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
5
|
+
value: {
|
|
6
|
+
type: StringConstructor;
|
|
7
|
+
required: true;
|
|
8
|
+
};
|
|
9
|
+
correction: PropType<QrCorrection>;
|
|
10
|
+
id: StringConstructor;
|
|
11
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
12
|
+
[key: string]: any;
|
|
13
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
14
|
+
value: {
|
|
15
|
+
type: StringConstructor;
|
|
16
|
+
required: true;
|
|
17
|
+
};
|
|
18
|
+
correction: PropType<QrCorrection>;
|
|
19
|
+
id: StringConstructor;
|
|
20
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
21
|
+
Frame: import("vue").Component;
|
|
22
|
+
Pattern: import("vue").Component;
|
|
23
|
+
};
|
|
24
|
+
//# 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, 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\"\n\nconst scope = context<Controller>(\"QrCode\")\n\nconst RootElement = partComponent(\"QrCodeRootElement\", \"div\", () => scope.use().root)\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})\n\nconst Frame = partComponent(\"QrCodeFrame\", \"svg\", () => scope.use().frame)\nconst Pattern = partComponent(\"QrCodePattern\", \"path\", () => scope.use().pattern)\n\nexport const QrCode = { Root, Frame, Pattern }\n"],"mappings":";;;;AAOA,MAAM,QAAQ,QAAoB,QAAQ;AAE1C,MAAM,cAAc,cAAc,qBAAqB,aAAa,MAAM,IAAI,CAAC,CAAC,IAAI;AA0BpF,MAAa,SAAS;CAAE,MAxBX,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,CAKwB;CAAM,OAHhB,cAAc,eAAe,aAAa,MAAM,IAAI,CAAC,CAAC,KAGtC;CAAO,SAFrB,cAAc,iBAAiB,cAAc,MAAM,IAAI,CAAC,CAAC,OAEpC;AAAQ"}
|
package/src/radio-group.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export declare const RadioGroup: {
|
|
|
13
13
|
readOnly: BooleanConstructor;
|
|
14
14
|
required: BooleanConstructor;
|
|
15
15
|
name: StringConstructor;
|
|
16
|
+
form: StringConstructor;
|
|
16
17
|
id: StringConstructor;
|
|
17
18
|
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
18
19
|
[key: string]: any;
|
|
@@ -29,6 +30,7 @@ export declare const RadioGroup: {
|
|
|
29
30
|
readOnly: BooleanConstructor;
|
|
30
31
|
required: BooleanConstructor;
|
|
31
32
|
name: StringConstructor;
|
|
33
|
+
form: StringConstructor;
|
|
32
34
|
id: StringConstructor;
|
|
33
35
|
}>> & Readonly<{
|
|
34
36
|
"onUpdate:value"?: ((...args: any[]) => any) | undefined;
|
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);
|
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 { RadioGroup as Controller } from \"@kirana-ui/core/radio-group\"\nimport { defineComponent, h, inject, onBeforeUnmount, onMounted, provide, useId } from \"vue\"\nimport type { InjectionKey, PropType } 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\"\n\nconst scope = context<Controller>(\"RadioGroup\")\nconst ITEM: InjectionKey<unknown> = Symbol(\"RadioGroupItem\")\n\nconst RootElement = partComponent(\"RadioGroupRootElement\", \"div\", () => scope.use().root)\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 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 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})\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 Element = partComponent(\"RadioGroupItemElement\", \"span\", () => item)\n const Input = partComponent(\"RadioGroupItemInput\", \"input\", () => input)\n return () => h(Element, attrs, () => [slots.default?.(), h(Input)])\n },\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})\n\nexport const RadioGroup = { Root, Item, Indicator }\n"],"mappings":";;;;;;;AAWA,MAAM,QAAQ,QAAoB,YAAY;AAC9C,MAAM,OAA8B,OAAO,gBAAgB;AAE3D,MAAM,cAAc,cAAc,yBAAyB,aAAa,MAAM,IAAI,CAAC,CAAC,IAAI;
|
|
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 { RadioGroup as Controller } from \"@kirana-ui/core/radio-group\"\nimport { defineComponent, h, inject, onBeforeUnmount, onMounted, provide, useId } from \"vue\"\nimport type { InjectionKey, PropType } 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\"\n\nconst scope = context<Controller>(\"RadioGroup\")\nconst ITEM: InjectionKey<unknown> = Symbol(\"RadioGroupItem\")\n\nconst RootElement = partComponent(\"RadioGroupRootElement\", \"div\", () => scope.use().root)\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})\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 Element = partComponent(\"RadioGroupItemElement\", \"span\", () => item)\n const Input = partComponent(\"RadioGroupItemInput\", \"input\", () => input)\n return () => h(Element, attrs, () => [slots.default?.(), h(Input)])\n },\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})\n\nexport const RadioGroup = { Root, Item, Indicator }\n"],"mappings":";;;;;;;AAWA,MAAM,QAAQ,QAAoB,YAAY;AAC9C,MAAM,OAA8B,OAAO,gBAAgB;AAE3D,MAAM,cAAc,cAAc,yBAAyB,aAAa,MAAM,IAAI,CAAC,CAAC,IAAI;AAgFxF,MAAa,aAAa;CAAE,MA7Ef,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,CA0C4B;CAAM,MAxCrB,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,UAAU,cAAc,yBAAyB,cAAc,IAAI;GACzE,MAAM,QAAQ,cAAc,uBAAuB,eAAe,KAAK;GACvE,aAAa,EAAE,SAAS,aAAa,CAAC,MAAM,UAAU,GAAG,EAAE,KAAK,CAAC,CAAC;EACpE;CACF,CAoBkC;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"}
|