@kirana-ui/vue 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/package.json +130 -4
- package/src/accordion.d.ts +78 -0
- package/src/accordion.js +92 -0
- package/src/accordion.js.map +1 -0
- package/src/alert-dialog.d.ts +2 -0
- package/src/alert-dialog.js +1 -0
- package/src/avatar.d.ts +16 -0
- package/src/avatar.js +40 -0
- package/src/avatar.js.map +1 -0
- package/src/button.d.ts +23 -0
- package/src/button.js +22 -0
- package/src/button.js.map +1 -0
- package/src/checkbox.d.ts +51 -0
- package/src/checkbox.js +62 -0
- package/src/checkbox.js.map +1 -0
- package/src/collapsible.d.ts +39 -0
- package/src/collapsible.js +50 -0
- package/src/collapsible.js.map +1 -0
- package/src/dialog.d.ts +84 -0
- package/src/dialog.js +78 -0
- package/src/dialog.js.map +1 -0
- package/src/direction-context.d.ts +5 -0
- package/src/direction-context.js +9 -0
- package/src/direction-context.js.map +1 -0
- package/src/direction.d.ts +16 -0
- package/src/direction.js +25 -0
- package/src/direction.js.map +1 -0
- package/src/field-context.d.ts +6 -0
- package/src/field-context.js +17 -0
- package/src/field-context.js.map +1 -0
- package/src/field.d.ts +49 -0
- package/src/field.js +79 -0
- package/src/field.js.map +1 -0
- package/src/fieldset.d.ts +18 -0
- package/src/fieldset.js +35 -0
- package/src/fieldset.js.map +1 -0
- package/src/form.d.ts +22 -0
- package/src/form.js +29 -0
- package/src/form.js.map +1 -0
- package/src/hover-card.d.ts +38 -0
- package/src/hover-card.js +7 -0
- package/src/hover-card.js.map +1 -0
- package/src/hover-popup.d.ts +41 -0
- package/src/hover-popup.js +46 -0
- package/src/hover-popup.js.map +1 -0
- package/src/index.d.ts +23 -0
- package/src/index.js +23 -0
- package/src/meter.d.ts +34 -0
- package/src/meter.js +7 -0
- package/src/meter.js.map +1 -0
- package/src/popover.d.ts +39 -0
- package/src/popover.js +60 -0
- package/src/popover.js.map +1 -0
- package/src/progress.d.ts +34 -0
- package/src/progress.js +7 -0
- package/src/progress.js.map +1 -0
- package/src/radio-group.d.ts +76 -0
- package/src/radio-group.js +95 -0
- package/src/radio-group.js.map +1 -0
- package/src/runtime.d.ts +29 -0
- package/src/runtime.js +130 -0
- package/src/runtime.js.map +1 -0
- package/src/select.d.ts +119 -0
- package/src/select.js +127 -0
- package/src/select.js.map +1 -0
- package/src/separator.d.ts +10 -0
- package/src/separator.js +17 -0
- package/src/separator.js.map +1 -0
- package/src/slider.d.ts +79 -0
- package/src/slider.js +92 -0
- package/src/slider.js.map +1 -0
- package/src/switch.d.ts +40 -0
- package/src/switch.js +49 -0
- package/src/switch.js.map +1 -0
- package/src/tabs.d.ts +101 -0
- package/src/tabs.js +106 -0
- package/src/tabs.js.map +1 -0
- package/src/toggle.d.ts +26 -0
- package/src/toggle.js +31 -0
- package/src/toggle.js.map +1 -0
- package/src/tooltip.d.ts +38 -0
- package/src/tooltip.js +7 -0
- package/src/tooltip.js.map +1 -0
- package/src/value-bar.d.ts +38 -0
- package/src/value-bar.js +52 -0
- package/src/value-bar.js.map +1 -0
- package/README.md +0 -3
package/src/switch.d.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export declare const Switch: {
|
|
2
|
+
Root: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
3
|
+
checked: {
|
|
4
|
+
type: BooleanConstructor;
|
|
5
|
+
default: undefined;
|
|
6
|
+
};
|
|
7
|
+
defaultChecked: BooleanConstructor;
|
|
8
|
+
disabled: BooleanConstructor;
|
|
9
|
+
readOnly: BooleanConstructor;
|
|
10
|
+
required: BooleanConstructor;
|
|
11
|
+
name: StringConstructor;
|
|
12
|
+
value: StringConstructor;
|
|
13
|
+
id: StringConstructor;
|
|
14
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
15
|
+
[key: string]: any;
|
|
16
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("checkedChange" | "update:checked")[], "checkedChange" | "update:checked", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
17
|
+
checked: {
|
|
18
|
+
type: BooleanConstructor;
|
|
19
|
+
default: undefined;
|
|
20
|
+
};
|
|
21
|
+
defaultChecked: BooleanConstructor;
|
|
22
|
+
disabled: BooleanConstructor;
|
|
23
|
+
readOnly: BooleanConstructor;
|
|
24
|
+
required: BooleanConstructor;
|
|
25
|
+
name: StringConstructor;
|
|
26
|
+
value: StringConstructor;
|
|
27
|
+
id: StringConstructor;
|
|
28
|
+
}>> & Readonly<{
|
|
29
|
+
onCheckedChange?: ((...args: any[]) => any) | undefined;
|
|
30
|
+
"onUpdate:checked"?: ((...args: any[]) => any) | undefined;
|
|
31
|
+
}>, {
|
|
32
|
+
checked: boolean;
|
|
33
|
+
defaultChecked: boolean;
|
|
34
|
+
disabled: boolean;
|
|
35
|
+
readOnly: boolean;
|
|
36
|
+
required: boolean;
|
|
37
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
38
|
+
Thumb: import("vue").Component;
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=switch.d.ts.map
|
package/src/switch.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { useFieldAround } from "./field-context.js";
|
|
2
|
+
import { context, controller, optional, partComponent } from "./runtime.js";
|
|
3
|
+
import { within } from "@kirana-ui/core";
|
|
4
|
+
import { defineComponent, h, useId } from "vue";
|
|
5
|
+
import { createSwitch } from "@kirana-ui/core/switch";
|
|
6
|
+
// src/switch.ts
|
|
7
|
+
const scope = context("Switch");
|
|
8
|
+
const RootElement = partComponent("SwitchRootElement", "span", () => scope.use().root);
|
|
9
|
+
const Input = partComponent("SwitchInput", "input", () => scope.use().input);
|
|
10
|
+
const Switch = {
|
|
11
|
+
Root: defineComponent({
|
|
12
|
+
name: "SwitchRoot",
|
|
13
|
+
inheritAttrs: false,
|
|
14
|
+
props: {
|
|
15
|
+
checked: optional(Boolean),
|
|
16
|
+
defaultChecked: Boolean,
|
|
17
|
+
disabled: Boolean,
|
|
18
|
+
readOnly: Boolean,
|
|
19
|
+
required: Boolean,
|
|
20
|
+
name: String,
|
|
21
|
+
value: String,
|
|
22
|
+
id: String
|
|
23
|
+
},
|
|
24
|
+
emits: ["update:checked", "checkedChange"],
|
|
25
|
+
setup(props, { attrs, slots, emit }) {
|
|
26
|
+
const generated = useId();
|
|
27
|
+
const field = useFieldAround();
|
|
28
|
+
scope.provide(controller(within(createSwitch, { field }), () => ({
|
|
29
|
+
id: props.id ?? generated,
|
|
30
|
+
checked: props.checked,
|
|
31
|
+
defaultChecked: props.defaultChecked,
|
|
32
|
+
disabled: props.disabled,
|
|
33
|
+
readOnly: props.readOnly,
|
|
34
|
+
required: props.required,
|
|
35
|
+
name: props.name,
|
|
36
|
+
value: props.value,
|
|
37
|
+
onCheckedChange(checked, details) {
|
|
38
|
+
emit("checkedChange", checked, details);
|
|
39
|
+
if (!details.canceled) emit("update:checked", checked);
|
|
40
|
+
}
|
|
41
|
+
})));
|
|
42
|
+
return () => h(RootElement, attrs, () => [slots.default?.(), h(Input)]);
|
|
43
|
+
}
|
|
44
|
+
}),
|
|
45
|
+
Thumb: partComponent("SwitchThumb", "span", () => scope.use().thumb)
|
|
46
|
+
};
|
|
47
|
+
export { Switch };
|
|
48
|
+
|
|
49
|
+
//# sourceMappingURL=switch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"switch.js","names":[],"sources":["../../../../packages/vue/src/switch.ts"],"sourcesContent":["import { within } from \"@kirana-ui/core\"\nimport type { ChangeDetails } from \"@kirana-ui/core\"\nimport { createSwitch } from \"@kirana-ui/core/switch\"\nimport type { Switch as Controller } from \"@kirana-ui/core/switch\"\nimport { defineComponent, h, useId } from \"vue\"\n\nimport { useFieldAround } from \"./field-context.ts\"\nimport { context, controller, optional, partComponent } from \"./runtime.ts\"\n\nconst scope = context<Controller>(\"Switch\")\n\nconst RootElement = partComponent(\"SwitchRootElement\", \"span\", () => scope.use().root)\nconst Input = partComponent(\"SwitchInput\", \"input\", () => scope.use().input)\n\n/** `v-model:checked`, or `checked` with `@checked-change=\"(checked, details) => …\"`. */\nconst Root = defineComponent({\n name: \"SwitchRoot\",\n inheritAttrs: false,\n props: {\n checked: optional(Boolean),\n defaultChecked: Boolean,\n disabled: Boolean,\n readOnly: Boolean,\n required: Boolean,\n name: String,\n value: String,\n id: String,\n },\n emits: [\"update:checked\", \"checkedChange\"],\n setup(props, { attrs, slots, emit }) {\n const generated = useId()\n const field = useFieldAround()\n scope.provide(\n controller(within(createSwitch, { field }), () => ({\n id: props.id ?? generated,\n checked: props.checked,\n defaultChecked: props.defaultChecked,\n disabled: props.disabled,\n readOnly: props.readOnly,\n required: props.required,\n name: props.name,\n value: props.value,\n onCheckedChange(checked: boolean, details: ChangeDetails) {\n emit(\"checkedChange\", checked, details)\n if (!details.canceled) emit(\"update:checked\", checked)\n },\n }))\n )\n return () => h(RootElement, attrs, () => [slots.default?.(), h(Input)])\n },\n})\n\nexport const Switch = {\n Root,\n Thumb: partComponent(\"SwitchThumb\", \"span\", () => scope.use().thumb),\n}\n"],"mappings":";;;;;;AASA,MAAM,QAAQ,QAAoB,QAAQ;AAE1C,MAAM,cAAc,cAAc,qBAAqB,cAAc,MAAM,IAAI,CAAC,CAAC,IAAI;AACrF,MAAM,QAAQ,cAAc,eAAe,eAAe,MAAM,IAAI,CAAC,CAAC,KAAK;AAwC3E,MAAa,SAAS;CACpB,MAtCW,gBAAgB;EAC3B,MAAM;EACN,cAAc;EACd,OAAO;GACL,SAAS,SAAS,OAAO;GACzB,gBAAgB;GAChB,UAAU;GACV,UAAU;GACV,UAAU;GACV,MAAM;GACN,OAAO;GACP,IAAI;EACN;EACA,OAAO,CAAC,kBAAkB,eAAe;EACzC,MAAM,OAAO,EAAE,OAAO,OAAO,QAAQ;GACnC,MAAM,YAAY,MAAM;GACxB,MAAM,QAAQ,eAAe;GAC7B,MAAM,QACJ,WAAW,OAAO,cAAc,EAAE,MAAM,CAAC,UAAU;IACjD,IAAI,MAAM,MAAM;IAChB,SAAS,MAAM;IACf,gBAAgB,MAAM;IACtB,UAAU,MAAM;IAChB,UAAU,MAAM;IAChB,UAAU,MAAM;IAChB,MAAM,MAAM;IACZ,OAAO,MAAM;IACb,gBAAgB,SAAkB,SAAwB;KACxD,KAAK,iBAAiB,SAAS,OAAO;KACtC,IAAI,CAAC,QAAQ,UAAU,KAAK,kBAAkB,OAAO;IACvD;GACF,EAAE,CACJ;GACA,aAAa,EAAE,aAAa,aAAa,CAAC,MAAM,UAAU,GAAG,EAAE,KAAK,CAAC,CAAC;EACxE;CACF,CAGE;CACA,OAAO,cAAc,eAAe,cAAc,MAAM,IAAI,CAAC,CAAC,KAAK;AACrE"}
|
package/src/tabs.d.ts
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { Orientation } from "@kirana-ui/core";
|
|
2
|
+
import { PropType } from "vue";
|
|
3
|
+
export declare const Tabs: {
|
|
4
|
+
Root: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
5
|
+
value: {
|
|
6
|
+
type: PropType<unknown>;
|
|
7
|
+
default: unknown;
|
|
8
|
+
};
|
|
9
|
+
defaultValue: {
|
|
10
|
+
type: PropType<unknown>;
|
|
11
|
+
default: unknown;
|
|
12
|
+
};
|
|
13
|
+
orientation: PropType<Orientation>;
|
|
14
|
+
id: StringConstructor;
|
|
15
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
16
|
+
[key: string]: any;
|
|
17
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:value" | "valueChange")[], "update:value" | "valueChange", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
18
|
+
value: {
|
|
19
|
+
type: PropType<unknown>;
|
|
20
|
+
default: unknown;
|
|
21
|
+
};
|
|
22
|
+
defaultValue: {
|
|
23
|
+
type: PropType<unknown>;
|
|
24
|
+
default: unknown;
|
|
25
|
+
};
|
|
26
|
+
orientation: PropType<Orientation>;
|
|
27
|
+
id: StringConstructor;
|
|
28
|
+
}>> & Readonly<{
|
|
29
|
+
"onUpdate:value"?: ((...args: any[]) => any) | undefined;
|
|
30
|
+
onValueChange?: ((...args: any[]) => any) | undefined;
|
|
31
|
+
}>, {
|
|
32
|
+
value: unknown;
|
|
33
|
+
defaultValue: unknown;
|
|
34
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
35
|
+
List: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
36
|
+
activateOnFocus: {
|
|
37
|
+
type: BooleanConstructor;
|
|
38
|
+
default: undefined;
|
|
39
|
+
};
|
|
40
|
+
loop: {
|
|
41
|
+
type: BooleanConstructor;
|
|
42
|
+
default: undefined;
|
|
43
|
+
};
|
|
44
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
45
|
+
[key: string]: any;
|
|
46
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
47
|
+
activateOnFocus: {
|
|
48
|
+
type: BooleanConstructor;
|
|
49
|
+
default: undefined;
|
|
50
|
+
};
|
|
51
|
+
loop: {
|
|
52
|
+
type: BooleanConstructor;
|
|
53
|
+
default: undefined;
|
|
54
|
+
};
|
|
55
|
+
}>> & Readonly<{}>, {
|
|
56
|
+
activateOnFocus: boolean;
|
|
57
|
+
loop: boolean;
|
|
58
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
59
|
+
Tab: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
60
|
+
value: {
|
|
61
|
+
type: PropType<unknown>;
|
|
62
|
+
required: true;
|
|
63
|
+
};
|
|
64
|
+
disabled: {
|
|
65
|
+
type: BooleanConstructor;
|
|
66
|
+
default: undefined;
|
|
67
|
+
};
|
|
68
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
69
|
+
[key: string]: any;
|
|
70
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
71
|
+
value: {
|
|
72
|
+
type: PropType<unknown>;
|
|
73
|
+
required: true;
|
|
74
|
+
};
|
|
75
|
+
disabled: {
|
|
76
|
+
type: BooleanConstructor;
|
|
77
|
+
default: undefined;
|
|
78
|
+
};
|
|
79
|
+
}>> & Readonly<{}>, {
|
|
80
|
+
disabled: boolean;
|
|
81
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
82
|
+
Indicator: import("vue").Component;
|
|
83
|
+
Panel: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
84
|
+
value: {
|
|
85
|
+
type: PropType<unknown>;
|
|
86
|
+
required: true;
|
|
87
|
+
};
|
|
88
|
+
keepMounted: BooleanConstructor;
|
|
89
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
90
|
+
[key: string]: any;
|
|
91
|
+
}> | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
92
|
+
value: {
|
|
93
|
+
type: PropType<unknown>;
|
|
94
|
+
required: true;
|
|
95
|
+
};
|
|
96
|
+
keepMounted: BooleanConstructor;
|
|
97
|
+
}>> & Readonly<{}>, {
|
|
98
|
+
keepMounted: boolean;
|
|
99
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
100
|
+
};
|
|
101
|
+
//# sourceMappingURL=tabs.d.ts.map
|
package/src/tabs.js
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { useDirectionAround } from "./direction-context.js";
|
|
2
|
+
import { context, controller, fromSignal, optional, partComponent, toSignal } from "./runtime.js";
|
|
3
|
+
import { defined, within } from "@kirana-ui/core";
|
|
4
|
+
import { defineComponent, h, onBeforeUnmount, onMounted, useId, watchEffect } from "vue";
|
|
5
|
+
import { createTabs } from "@kirana-ui/core/tabs";
|
|
6
|
+
// src/tabs.ts
|
|
7
|
+
const scope = context("Tabs");
|
|
8
|
+
const ANY = null;
|
|
9
|
+
const RootElement = partComponent("TabsRootElement", "div", () => scope.use().root);
|
|
10
|
+
/** `v-model:value`, or `value` with `@value-change="(value, details) => …"`. */
|
|
11
|
+
const Root = defineComponent({
|
|
12
|
+
name: "TabsRoot",
|
|
13
|
+
inheritAttrs: false,
|
|
14
|
+
props: {
|
|
15
|
+
value: {
|
|
16
|
+
type: ANY,
|
|
17
|
+
default: void 0
|
|
18
|
+
},
|
|
19
|
+
defaultValue: {
|
|
20
|
+
type: ANY,
|
|
21
|
+
default: null
|
|
22
|
+
},
|
|
23
|
+
orientation: String,
|
|
24
|
+
id: String
|
|
25
|
+
},
|
|
26
|
+
emits: ["update:value", "valueChange"],
|
|
27
|
+
setup(props, { attrs, slots, emit }) {
|
|
28
|
+
const generated = useId();
|
|
29
|
+
const direction = useDirectionAround();
|
|
30
|
+
scope.provide(controller(within(createTabs, { direction }), () => ({
|
|
31
|
+
id: props.id ?? generated,
|
|
32
|
+
value: props.value,
|
|
33
|
+
defaultValue: props.defaultValue,
|
|
34
|
+
orientation: props.orientation,
|
|
35
|
+
onValueChange(value, details) {
|
|
36
|
+
emit("valueChange", value, details);
|
|
37
|
+
if (!details.canceled) emit("update:value", value);
|
|
38
|
+
}
|
|
39
|
+
})));
|
|
40
|
+
return () => h(RootElement, attrs, slots);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
const ListElement = partComponent("TabsListElement", "div", () => scope.use().list);
|
|
44
|
+
const List = defineComponent({
|
|
45
|
+
name: "TabsList",
|
|
46
|
+
inheritAttrs: false,
|
|
47
|
+
props: {
|
|
48
|
+
activateOnFocus: optional(Boolean),
|
|
49
|
+
loop: optional(Boolean)
|
|
50
|
+
},
|
|
51
|
+
setup(props, { attrs, slots }) {
|
|
52
|
+
const { listOptions } = scope.use();
|
|
53
|
+
watchEffect(() => listOptions.set(defined({ ...props })), { flush: "sync" });
|
|
54
|
+
return () => h(ListElement, attrs, slots);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
const Tab = defineComponent({
|
|
58
|
+
name: "TabsTab",
|
|
59
|
+
inheritAttrs: false,
|
|
60
|
+
props: {
|
|
61
|
+
value: {
|
|
62
|
+
type: ANY,
|
|
63
|
+
required: true
|
|
64
|
+
},
|
|
65
|
+
disabled: optional(Boolean)
|
|
66
|
+
},
|
|
67
|
+
setup(props, { attrs, slots }) {
|
|
68
|
+
const options = toSignal(() => ({ disabled: props.disabled }));
|
|
69
|
+
const part = scope.use().tab(props.value, () => defined(options.get()));
|
|
70
|
+
const Element = partComponent("TabsTabElement", "button", () => part);
|
|
71
|
+
return () => h(Element, attrs, slots);
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
/** `keep-mounted` keeps the panel in the page, `hidden`, while its tab is not the active one. */
|
|
75
|
+
const Panel = defineComponent({
|
|
76
|
+
name: "TabsPanel",
|
|
77
|
+
inheritAttrs: false,
|
|
78
|
+
props: {
|
|
79
|
+
value: {
|
|
80
|
+
type: ANY,
|
|
81
|
+
required: true
|
|
82
|
+
},
|
|
83
|
+
keepMounted: Boolean
|
|
84
|
+
},
|
|
85
|
+
setup(props, { attrs, slots }) {
|
|
86
|
+
const panel = scope.use().panel(props.value);
|
|
87
|
+
let stop;
|
|
88
|
+
onMounted(() => {
|
|
89
|
+
stop = panel.mount();
|
|
90
|
+
});
|
|
91
|
+
onBeforeUnmount(() => stop?.());
|
|
92
|
+
const mounted = fromSignal(panel.mounted);
|
|
93
|
+
const Element = partComponent("TabsPanelElement", "div", () => panel.part);
|
|
94
|
+
return () => mounted.value || props.keepMounted ? h(Element, attrs, slots) : null;
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
const Tabs = {
|
|
98
|
+
Root,
|
|
99
|
+
List,
|
|
100
|
+
Tab,
|
|
101
|
+
Indicator: partComponent("TabsIndicator", "span", () => scope.use().indicator),
|
|
102
|
+
Panel
|
|
103
|
+
};
|
|
104
|
+
export { Tabs };
|
|
105
|
+
|
|
106
|
+
//# sourceMappingURL=tabs.js.map
|
package/src/tabs.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tabs.js","names":[],"sources":["../../../../packages/vue/src/tabs.ts"],"sourcesContent":["import { defined, within } from \"@kirana-ui/core\"\nimport type { ChangeDetails, Orientation } from \"@kirana-ui/core\"\nimport { createTabs } from \"@kirana-ui/core/tabs\"\nimport type { Tabs as Controller } from \"@kirana-ui/core/tabs\"\nimport { defineComponent, h, onBeforeUnmount, onMounted, useId, watchEffect } from \"vue\"\nimport type { PropType } from \"vue\"\n\nimport { useDirectionAround } from \"./direction-context.ts\"\nimport { context, controller, fromSignal, optional, partComponent, toSignal } from \"./runtime.ts\"\n\nconst scope = context<Controller>(\"Tabs\")\nconst ANY = null as unknown as PropType<unknown>\n\nconst RootElement = partComponent(\"TabsRootElement\", \"div\", () => scope.use().root)\n\n/** `v-model:value`, or `value` with `@value-change=\"(value, details) => …\"`. */\nconst Root = defineComponent({\n name: \"TabsRoot\",\n inheritAttrs: false,\n props: {\n value: { type: ANY, default: undefined as unknown },\n defaultValue: { type: ANY, default: null as unknown },\n orientation: String as PropType<Orientation>,\n id: String,\n },\n emits: [\"update:value\", \"valueChange\"],\n setup(props, { attrs, slots, emit }) {\n const generated = useId()\n const direction = useDirectionAround()\n scope.provide(\n controller(within(createTabs, { direction }), () => ({\n id: props.id ?? generated,\n value: props.value,\n defaultValue: props.defaultValue,\n orientation: props.orientation,\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 ListElement = partComponent(\"TabsListElement\", \"div\", () => scope.use().list)\n\nconst List = defineComponent({\n name: \"TabsList\",\n inheritAttrs: false,\n props: { activateOnFocus: optional(Boolean), loop: optional(Boolean) },\n setup(props, { attrs, slots }) {\n const { listOptions } = scope.use()\n watchEffect(() => listOptions.set(defined({ ...props })), { flush: \"sync\" })\n return () => h(ListElement, attrs, slots)\n },\n})\n\nconst Tab = defineComponent({\n name: \"TabsTab\",\n inheritAttrs: false,\n props: { value: { type: ANY, required: true }, disabled: optional(Boolean) },\n setup(props, { attrs, slots }) {\n const options = toSignal(() => ({ disabled: props.disabled }))\n // A tab is its value for as long as it is in the page.\n const part = scope.use().tab(props.value, () => defined(options.get()))\n const Element = partComponent(\"TabsTabElement\", \"button\", () => part)\n return () => h(Element, attrs, slots)\n },\n})\n\n/** `keep-mounted` keeps the panel in the page, `hidden`, while its tab is not the active one. */\nconst Panel = defineComponent({\n name: \"TabsPanel\",\n inheritAttrs: false,\n props: { value: { type: ANY, required: true }, keepMounted: Boolean },\n setup(props, { attrs, slots }) {\n const panel = scope.use().panel(props.value)\n let stop: (() => void) | undefined\n onMounted(() => {\n stop = panel.mount()\n })\n onBeforeUnmount(() => stop?.())\n const mounted = fromSignal(panel.mounted)\n const Element = partComponent(\"TabsPanelElement\", \"div\", () => panel.part)\n return () => (mounted.value || props.keepMounted ? h(Element, attrs, slots) : null)\n },\n})\n\nexport const Tabs = {\n Root,\n List,\n Tab,\n Indicator: partComponent(\"TabsIndicator\", \"span\", () => scope.use().indicator),\n Panel,\n}\n"],"mappings":";;;;;;AAUA,MAAM,QAAQ,QAAoB,MAAM;AACxC,MAAM,MAAM;AAEZ,MAAM,cAAc,cAAc,mBAAmB,aAAa,MAAM,IAAI,CAAC,CAAC,IAAI;;AAGlF,MAAM,OAAO,gBAAgB;CAC3B,MAAM;CACN,cAAc;CACd,OAAO;EACL,OAAO;GAAE,MAAM;GAAK,SAAS,KAAA;EAAqB;EAClD,cAAc;GAAE,MAAM;GAAK,SAAS;EAAgB;EACpD,aAAa;EACb,IAAI;CACN;CACA,OAAO,CAAC,gBAAgB,aAAa;CACrC,MAAM,OAAO,EAAE,OAAO,OAAO,QAAQ;EACnC,MAAM,YAAY,MAAM;EACxB,MAAM,YAAY,mBAAmB;EACrC,MAAM,QACJ,WAAW,OAAO,YAAY,EAAE,UAAU,CAAC,UAAU;GACnD,IAAI,MAAM,MAAM;GAChB,OAAO,MAAM;GACb,cAAc,MAAM;GACpB,aAAa,MAAM;GACnB,cAAc,OAAgB,SAAwB;IACpD,KAAK,eAAe,OAAO,OAAO;IAClC,IAAI,CAAC,QAAQ,UAAU,KAAK,gBAAgB,KAAK;GACnD;EACF,EAAE,CACJ;EACA,aAAa,EAAE,aAAa,OAAO,KAAK;CAC1C;AACF,CAAC;AAED,MAAM,cAAc,cAAc,mBAAmB,aAAa,MAAM,IAAI,CAAC,CAAC,IAAI;AAElF,MAAM,OAAO,gBAAgB;CAC3B,MAAM;CACN,cAAc;CACd,OAAO;EAAE,iBAAiB,SAAS,OAAO;EAAG,MAAM,SAAS,OAAO;CAAE;CACrE,MAAM,OAAO,EAAE,OAAO,SAAS;EAC7B,MAAM,EAAE,gBAAgB,MAAM,IAAI;EAClC,kBAAkB,YAAY,IAAI,QAAQ,EAAE,GAAG,MAAM,CAAC,CAAC,GAAG,EAAE,OAAO,OAAO,CAAC;EAC3E,aAAa,EAAE,aAAa,OAAO,KAAK;CAC1C;AACF,CAAC;AAED,MAAM,MAAM,gBAAgB;CAC1B,MAAM;CACN,cAAc;CACd,OAAO;EAAE,OAAO;GAAE,MAAM;GAAK,UAAU;EAAK;EAAG,UAAU,SAAS,OAAO;CAAE;CAC3E,MAAM,OAAO,EAAE,OAAO,SAAS;EAC7B,MAAM,UAAU,gBAAgB,EAAE,UAAU,MAAM,SAAS,EAAE;EAE7D,MAAM,OAAO,MAAM,IAAI,CAAC,CAAC,IAAI,MAAM,aAAa,QAAQ,QAAQ,IAAI,CAAC,CAAC;EACtE,MAAM,UAAU,cAAc,kBAAkB,gBAAgB,IAAI;EACpE,aAAa,EAAE,SAAS,OAAO,KAAK;CACtC;AACF,CAAC;;AAGD,MAAM,QAAQ,gBAAgB;CAC5B,MAAM;CACN,cAAc;CACd,OAAO;EAAE,OAAO;GAAE,MAAM;GAAK,UAAU;EAAK;EAAG,aAAa;CAAQ;CACpE,MAAM,OAAO,EAAE,OAAO,SAAS;EAC7B,MAAM,QAAQ,MAAM,IAAI,CAAC,CAAC,MAAM,MAAM,KAAK;EAC3C,IAAI;EACJ,gBAAgB;GACd,OAAO,MAAM,MAAM;EACrB,CAAC;EACD,sBAAsB,OAAO,CAAC;EAC9B,MAAM,UAAU,WAAW,MAAM,OAAO;EACxC,MAAM,UAAU,cAAc,oBAAoB,aAAa,MAAM,IAAI;EACzE,aAAc,QAAQ,SAAS,MAAM,cAAc,EAAE,SAAS,OAAO,KAAK,IAAI;CAChF;AACF,CAAC;AAED,MAAa,OAAO;CAClB;CACA;CACA;CACA,WAAW,cAAc,iBAAiB,cAAc,MAAM,IAAI,CAAC,CAAC,SAAS;CAC7E;AACF"}
|
package/src/toggle.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** `v-model:pressed`, or `pressed` with `@pressed-change="(pressed, details) => …"`. */
|
|
2
|
+
export declare const Toggle: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
3
|
+
pressed: {
|
|
4
|
+
type: BooleanConstructor;
|
|
5
|
+
default: undefined;
|
|
6
|
+
};
|
|
7
|
+
defaultPressed: BooleanConstructor;
|
|
8
|
+
disabled: BooleanConstructor;
|
|
9
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
10
|
+
[key: string]: any;
|
|
11
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("pressedChange" | "update:pressed")[], "pressedChange" | "update:pressed", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
12
|
+
pressed: {
|
|
13
|
+
type: BooleanConstructor;
|
|
14
|
+
default: undefined;
|
|
15
|
+
};
|
|
16
|
+
defaultPressed: BooleanConstructor;
|
|
17
|
+
disabled: BooleanConstructor;
|
|
18
|
+
}>> & Readonly<{
|
|
19
|
+
onPressedChange?: ((...args: any[]) => any) | undefined;
|
|
20
|
+
"onUpdate:pressed"?: ((...args: any[]) => any) | undefined;
|
|
21
|
+
}>, {
|
|
22
|
+
pressed: boolean;
|
|
23
|
+
defaultPressed: boolean;
|
|
24
|
+
disabled: boolean;
|
|
25
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
26
|
+
//# sourceMappingURL=toggle.d.ts.map
|
package/src/toggle.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { controller, optional, partComponent } from "./runtime.js";
|
|
2
|
+
import { defineComponent, h } from "vue";
|
|
3
|
+
import { createToggle } from "@kirana-ui/core/toggle";
|
|
4
|
+
// src/toggle.ts
|
|
5
|
+
/** `v-model:pressed`, or `pressed` with `@pressed-change="(pressed, details) => …"`. */
|
|
6
|
+
const Toggle = defineComponent({
|
|
7
|
+
name: "Toggle",
|
|
8
|
+
inheritAttrs: false,
|
|
9
|
+
props: {
|
|
10
|
+
pressed: optional(Boolean),
|
|
11
|
+
defaultPressed: Boolean,
|
|
12
|
+
disabled: Boolean
|
|
13
|
+
},
|
|
14
|
+
emits: ["update:pressed", "pressedChange"],
|
|
15
|
+
setup(props, { attrs, slots, emit }) {
|
|
16
|
+
const made = controller(createToggle, () => ({
|
|
17
|
+
pressed: props.pressed,
|
|
18
|
+
defaultPressed: props.defaultPressed,
|
|
19
|
+
disabled: props.disabled,
|
|
20
|
+
onPressedChange(pressed, details) {
|
|
21
|
+
emit("pressedChange", pressed, details);
|
|
22
|
+
if (!details.canceled) emit("update:pressed", pressed);
|
|
23
|
+
}
|
|
24
|
+
}));
|
|
25
|
+
const Element = partComponent("ToggleElement", "button", () => made.root);
|
|
26
|
+
return () => h(Element, attrs, slots);
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
export { Toggle };
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=toggle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toggle.js","names":[],"sources":["../../../../packages/vue/src/toggle.ts"],"sourcesContent":["import type { ChangeDetails } from \"@kirana-ui/core\"\nimport { createToggle } from \"@kirana-ui/core/toggle\"\nimport { defineComponent, h } from \"vue\"\n\nimport { controller, optional, partComponent } from \"./runtime.ts\"\n\n/** `v-model:pressed`, or `pressed` with `@pressed-change=\"(pressed, details) => …\"`. */\nexport const Toggle = defineComponent({\n name: \"Toggle\",\n inheritAttrs: false,\n props: { pressed: optional(Boolean), defaultPressed: Boolean, disabled: Boolean },\n emits: [\"update:pressed\", \"pressedChange\"],\n setup(props, { attrs, slots, emit }) {\n const made = controller(createToggle, () => ({\n pressed: props.pressed,\n defaultPressed: props.defaultPressed,\n disabled: props.disabled,\n onPressedChange(pressed: boolean, details: ChangeDetails) {\n emit(\"pressedChange\", pressed, details)\n if (!details.canceled) emit(\"update:pressed\", pressed)\n },\n }))\n const Element = partComponent(\"ToggleElement\", \"button\", () => made.root)\n return () => h(Element, attrs, slots)\n },\n})\n"],"mappings":";;;;;AAOA,MAAa,SAAS,gBAAgB;CACpC,MAAM;CACN,cAAc;CACd,OAAO;EAAE,SAAS,SAAS,OAAO;EAAG,gBAAgB;EAAS,UAAU;CAAQ;CAChF,OAAO,CAAC,kBAAkB,eAAe;CACzC,MAAM,OAAO,EAAE,OAAO,OAAO,QAAQ;EACnC,MAAM,OAAO,WAAW,qBAAqB;GAC3C,SAAS,MAAM;GACf,gBAAgB,MAAM;GACtB,UAAU,MAAM;GAChB,gBAAgB,SAAkB,SAAwB;IACxD,KAAK,iBAAiB,SAAS,OAAO;IACtC,IAAI,CAAC,QAAQ,UAAU,KAAK,kBAAkB,OAAO;GACvD;EACF,EAAE;EACF,MAAM,UAAU,cAAc,iBAAiB,gBAAgB,KAAK,IAAI;EACxE,aAAa,EAAE,SAAS,OAAO,KAAK;CACtC;AACF,CAAC"}
|
package/src/tooltip.d.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export declare const Tooltip: {
|
|
2
|
+
Root: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
3
|
+
open: {
|
|
4
|
+
type: BooleanConstructor;
|
|
5
|
+
default: undefined;
|
|
6
|
+
};
|
|
7
|
+
defaultOpen: BooleanConstructor;
|
|
8
|
+
delay: NumberConstructor;
|
|
9
|
+
closeDelay: NumberConstructor;
|
|
10
|
+
disabled: BooleanConstructor;
|
|
11
|
+
id: StringConstructor;
|
|
12
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
13
|
+
[key: string]: any;
|
|
14
|
+
}>[] | undefined, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("openChange" | "update:open")[], "openChange" | "update:open", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
15
|
+
open: {
|
|
16
|
+
type: BooleanConstructor;
|
|
17
|
+
default: undefined;
|
|
18
|
+
};
|
|
19
|
+
defaultOpen: BooleanConstructor;
|
|
20
|
+
delay: NumberConstructor;
|
|
21
|
+
closeDelay: NumberConstructor;
|
|
22
|
+
disabled: BooleanConstructor;
|
|
23
|
+
id: StringConstructor;
|
|
24
|
+
}>> & Readonly<{
|
|
25
|
+
onOpenChange?: ((...args: any[]) => any) | undefined;
|
|
26
|
+
"onUpdate:open"?: ((...args: any[]) => any) | undefined;
|
|
27
|
+
}>, {
|
|
28
|
+
open: boolean;
|
|
29
|
+
defaultOpen: boolean;
|
|
30
|
+
disabled: boolean;
|
|
31
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
32
|
+
Trigger: import("vue").Component;
|
|
33
|
+
Portal: import("vue").Component;
|
|
34
|
+
Positioner: import("vue").Component;
|
|
35
|
+
Popup: import("vue").Component;
|
|
36
|
+
Arrow: import("vue").Component;
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=tooltip.d.ts.map
|
package/src/tooltip.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tooltip.js","names":[],"sources":["../../../../packages/vue/src/tooltip.ts"],"sourcesContent":["import { createTooltip } from \"@kirana-ui/core/tooltip\"\n\nimport { hoverPopup } from \"./hover-popup.ts\"\n\nexport const Tooltip = hoverPopup(\"Tooltip\", createTooltip, \"button\")\n"],"mappings":";;;AAIA,MAAa,UAAU,WAAW,WAAW,eAAe,QAAQ"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ReadonlySignal } from "@kirana-ui/core";
|
|
2
|
+
import { PropType } from "vue";
|
|
3
|
+
import { ValueBar, ValueBarProps } from "@kirana-ui/core/progress";
|
|
4
|
+
/** The parts of a value drawn as a filled track: a progress bar's, a meter's. */
|
|
5
|
+
export declare function valueBar(name: string, create: (props: ReadonlySignal<ValueBarProps>) => ValueBar): {
|
|
6
|
+
Root: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
7
|
+
value: {
|
|
8
|
+
type: PropType<number | null>;
|
|
9
|
+
required: true;
|
|
10
|
+
};
|
|
11
|
+
min: NumberConstructor;
|
|
12
|
+
max: NumberConstructor;
|
|
13
|
+
format: PropType<Intl.NumberFormatOptions>;
|
|
14
|
+
locale: StringConstructor;
|
|
15
|
+
getAriaValueText: PropType<ValueBarProps["getAriaValueText"]>;
|
|
16
|
+
id: StringConstructor;
|
|
17
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
18
|
+
[key: string]: any;
|
|
19
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
20
|
+
value: {
|
|
21
|
+
type: PropType<number | null>;
|
|
22
|
+
required: true;
|
|
23
|
+
};
|
|
24
|
+
min: NumberConstructor;
|
|
25
|
+
max: NumberConstructor;
|
|
26
|
+
format: PropType<Intl.NumberFormatOptions>;
|
|
27
|
+
locale: StringConstructor;
|
|
28
|
+
getAriaValueText: PropType<ValueBarProps["getAriaValueText"]>;
|
|
29
|
+
id: StringConstructor;
|
|
30
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
31
|
+
Track: import("vue").Component;
|
|
32
|
+
Indicator: import("vue").Component;
|
|
33
|
+
Value: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
34
|
+
[key: string]: any;
|
|
35
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
36
|
+
Label: import("vue").Component;
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=value-bar.d.ts.map
|
package/src/value-bar.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { context, controller, fromSignal, partComponent } from "./runtime.js";
|
|
2
|
+
import { defineComponent, h, useId } from "vue";
|
|
3
|
+
// src/value-bar.ts
|
|
4
|
+
/** The parts of a value drawn as a filled track: a progress bar's, a meter's. */
|
|
5
|
+
function valueBar(name, create) {
|
|
6
|
+
const scope = context(name);
|
|
7
|
+
const RootElement = partComponent(`${name}RootElement`, "div", () => scope.use().root);
|
|
8
|
+
const Root = defineComponent({
|
|
9
|
+
name: `${name}Root`,
|
|
10
|
+
inheritAttrs: false,
|
|
11
|
+
props: {
|
|
12
|
+
value: {
|
|
13
|
+
type: null,
|
|
14
|
+
required: true
|
|
15
|
+
},
|
|
16
|
+
min: Number,
|
|
17
|
+
max: Number,
|
|
18
|
+
format: Object,
|
|
19
|
+
locale: String,
|
|
20
|
+
getAriaValueText: Function,
|
|
21
|
+
id: String
|
|
22
|
+
},
|
|
23
|
+
setup(props, { attrs, slots }) {
|
|
24
|
+
const generated = useId();
|
|
25
|
+
scope.provide(controller(create, () => ({
|
|
26
|
+
...props,
|
|
27
|
+
id: props.id ?? generated
|
|
28
|
+
})));
|
|
29
|
+
return () => h(RootElement, attrs, slots);
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
const ValueElement = partComponent(`${name}ValueElement`, "span", () => scope.use().value);
|
|
33
|
+
/** The written value, or what its slot makes of it (`v-slot="{ text }"`). */
|
|
34
|
+
const Value = defineComponent({
|
|
35
|
+
name: `${name}Value`,
|
|
36
|
+
inheritAttrs: false,
|
|
37
|
+
setup(_props, { attrs, slots }) {
|
|
38
|
+
const text = fromSignal(scope.use().text);
|
|
39
|
+
return () => h(ValueElement, attrs, () => slots.default?.({ text: text.value }) ?? text.value);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
return {
|
|
43
|
+
Root,
|
|
44
|
+
Track: partComponent(`${name}Track`, "div", () => scope.use().track),
|
|
45
|
+
Indicator: partComponent(`${name}Indicator`, "div", () => scope.use().indicator),
|
|
46
|
+
Value,
|
|
47
|
+
Label: partComponent(`${name}Label`, "span", () => scope.use().label)
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
export { valueBar };
|
|
51
|
+
|
|
52
|
+
//# sourceMappingURL=value-bar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"value-bar.js","names":[],"sources":["../../../../packages/vue/src/value-bar.ts"],"sourcesContent":["import type { ReadonlySignal } from \"@kirana-ui/core\"\nimport type { ValueBar, ValueBarProps } from \"@kirana-ui/core/progress\"\nimport { defineComponent, h, useId } from \"vue\"\nimport type { PropType } from \"vue\"\n\nimport { context, controller, fromSignal, partComponent } from \"./runtime.ts\"\n\n/** The parts of a value drawn as a filled track: a progress bar's, a meter's. */\nexport function valueBar(name: string, create: (props: ReadonlySignal<ValueBarProps>) => ValueBar) {\n const scope = context<ValueBar>(name)\n const RootElement = partComponent(`${name}RootElement`, \"div\", () => scope.use().root)\n\n const Root = defineComponent({\n name: `${name}Root`,\n inheritAttrs: false,\n props: {\n value: { type: null as unknown as PropType<number | null>, required: true },\n min: Number,\n max: Number,\n format: Object as PropType<Intl.NumberFormatOptions>,\n locale: String,\n getAriaValueText: Function as PropType<ValueBarProps[\"getAriaValueText\"]>,\n id: String,\n },\n setup(props, { attrs, slots }) {\n const generated = useId()\n scope.provide(controller(create, () => ({ ...props, id: props.id ?? generated })))\n return () => h(RootElement, attrs, slots)\n },\n })\n\n const ValueElement = partComponent(`${name}ValueElement`, \"span\", () => scope.use().value)\n\n /** The written value, or what its slot makes of it (`v-slot=\"{ text }\"`). */\n const Value = defineComponent({\n name: `${name}Value`,\n inheritAttrs: false,\n setup(_props, { attrs, slots }) {\n const text = fromSignal(scope.use().text)\n return () => h(ValueElement, attrs, () => slots.default?.({ text: text.value }) ?? text.value)\n },\n })\n\n return {\n Root,\n Track: partComponent(`${name}Track`, \"div\", () => scope.use().track),\n Indicator: partComponent(`${name}Indicator`, \"div\", () => scope.use().indicator),\n Value,\n Label: partComponent(`${name}Label`, \"span\", () => scope.use().label),\n }\n}\n"],"mappings":";;;;AAQA,SAAgB,SAAS,MAAc,QAA4D;CACjG,MAAM,QAAQ,QAAkB,IAAI;CACpC,MAAM,cAAc,cAAc,GAAG,KAAK,cAAc,aAAa,MAAM,IAAI,CAAC,CAAC,IAAI;CAErF,MAAM,OAAO,gBAAgB;EAC3B,MAAM,GAAG,KAAK;EACd,cAAc;EACd,OAAO;GACL,OAAO;IAAE,MAAM;IAA4C,UAAU;GAAK;GAC1E,KAAK;GACL,KAAK;GACL,QAAQ;GACR,QAAQ;GACR,kBAAkB;GAClB,IAAI;EACN;EACA,MAAM,OAAO,EAAE,OAAO,SAAS;GAC7B,MAAM,YAAY,MAAM;GACxB,MAAM,QAAQ,WAAW,eAAe;IAAE,GAAG;IAAO,IAAI,MAAM,MAAM;GAAU,EAAE,CAAC;GACjF,aAAa,EAAE,aAAa,OAAO,KAAK;EAC1C;CACF,CAAC;CAED,MAAM,eAAe,cAAc,GAAG,KAAK,eAAe,cAAc,MAAM,IAAI,CAAC,CAAC,KAAK;;CAGzF,MAAM,QAAQ,gBAAgB;EAC5B,MAAM,GAAG,KAAK;EACd,cAAc;EACd,MAAM,QAAQ,EAAE,OAAO,SAAS;GAC9B,MAAM,OAAO,WAAW,MAAM,IAAI,CAAC,CAAC,IAAI;GACxC,aAAa,EAAE,cAAc,aAAa,MAAM,UAAU,EAAE,MAAM,KAAK,MAAM,CAAC,KAAK,KAAK,KAAK;EAC/F;CACF,CAAC;CAED,OAAO;EACL;EACA,OAAO,cAAc,GAAG,KAAK,QAAQ,aAAa,MAAM,IAAI,CAAC,CAAC,KAAK;EACnE,WAAW,cAAc,GAAG,KAAK,YAAY,aAAa,MAAM,IAAI,CAAC,CAAC,SAAS;EAC/E;EACA,OAAO,cAAc,GAAG,KAAK,QAAQ,cAAc,MAAM,IAAI,CAAC,CAAC,KAAK;CACtE;AACF"}
|
package/README.md
DELETED