@kirana-ui/vue 0.0.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/llms.txt +1838 -0
- package/package.json +230 -6
- package/src/accordion.d.ts +78 -0
- package/src/accordion.js +92 -0
- package/src/accordion.js.map +1 -0
- package/src/alert-dialog.d.ts +2 -0
- package/src/alert-dialog.js +1 -0
- package/src/autocomplete.d.ts +2 -0
- package/src/autocomplete.js +1 -0
- package/src/autosize.d.ts +12 -0
- package/src/autosize.js +24 -0
- package/src/autosize.js.map +1 -0
- package/src/avatar.d.ts +16 -0
- package/src/avatar.js +40 -0
- package/src/avatar.js.map +1 -0
- package/src/button.d.ts +23 -0
- package/src/button.js +22 -0
- package/src/button.js.map +1 -0
- package/src/calendar.d.ts +107 -0
- package/src/calendar.js +125 -0
- package/src/calendar.js.map +1 -0
- package/src/carousel.d.ts +61 -0
- package/src/carousel.js +75 -0
- package/src/carousel.js.map +1 -0
- package/src/checkbox.d.ts +53 -0
- package/src/checkbox.js +64 -0
- package/src/checkbox.js.map +1 -0
- package/src/collapsible.d.ts +39 -0
- package/src/collapsible.js +50 -0
- package/src/collapsible.js.map +1 -0
- package/src/combobox.d.ts +298 -0
- package/src/combobox.js +286 -0
- package/src/combobox.js.map +1 -0
- package/src/command.d.ts +89 -0
- package/src/command.js +129 -0
- package/src/command.js.map +1 -0
- package/src/context-menu.d.ts +2 -0
- package/src/context-menu.js +1 -0
- package/src/date-field.d.ts +70 -0
- package/src/date-field.js +77 -0
- package/src/date-field.js.map +1 -0
- package/src/date-picker.d.ts +145 -0
- package/src/date-picker.js +82 -0
- package/src/date-picker.js.map +1 -0
- package/src/dialog.d.ts +154 -0
- package/src/dialog.js +133 -0
- package/src/dialog.js.map +1 -0
- package/src/direction-context.d.ts +5 -0
- package/src/direction-context.js +9 -0
- package/src/direction-context.js.map +1 -0
- package/src/direction.d.ts +16 -0
- package/src/direction.js +25 -0
- package/src/direction.js.map +1 -0
- package/src/drawer.d.ts +2 -0
- package/src/drawer.js +1 -0
- package/src/field-context.d.ts +6 -0
- package/src/field-context.js +17 -0
- package/src/field-context.js.map +1 -0
- package/src/field.d.ts +49 -0
- package/src/field.js +79 -0
- package/src/field.js.map +1 -0
- package/src/fieldset.d.ts +18 -0
- package/src/fieldset.js +35 -0
- package/src/fieldset.js.map +1 -0
- package/src/form.d.ts +22 -0
- package/src/form.js +29 -0
- package/src/form.js.map +1 -0
- package/src/hover-card.d.ts +46 -0
- package/src/hover-card.js +7 -0
- package/src/hover-card.js.map +1 -0
- package/src/hover-popup.d.ts +49 -0
- package/src/hover-popup.js +62 -0
- package/src/hover-popup.js.map +1 -0
- package/src/index.d.ts +48 -0
- package/src/index.js +47 -0
- package/src/input.d.ts +19 -0
- package/src/input.js +36 -0
- package/src/input.js.map +1 -0
- package/src/label.d.ts +5 -0
- package/src/label.js +18 -0
- package/src/label.js.map +1 -0
- package/src/listbox.d.ts +92 -0
- package/src/listbox.js +104 -0
- package/src/listbox.js.map +1 -0
- package/src/menu.d.ts +542 -0
- package/src/menu.js +235 -0
- package/src/menu.js.map +1 -0
- package/src/menubar-context.d.ts +5 -0
- package/src/menubar-context.js +6 -0
- package/src/menubar-context.js.map +1 -0
- package/src/menubar.d.ts +26 -0
- package/src/menubar.js +34 -0
- package/src/menubar.js.map +1 -0
- package/src/message-scroller.d.ts +20 -0
- package/src/message-scroller.js +34 -0
- package/src/message-scroller.js.map +1 -0
- package/src/meter.d.ts +34 -0
- package/src/meter.js +7 -0
- package/src/meter.js.map +1 -0
- package/src/navigation-menu.d.ts +91 -0
- package/src/navigation-menu.js +117 -0
- package/src/navigation-menu.js.map +1 -0
- package/src/number-field.d.ts +71 -0
- package/src/number-field.js +81 -0
- package/src/number-field.js.map +1 -0
- package/src/otp.d.ts +58 -0
- package/src/otp.js +86 -0
- package/src/otp.js.map +1 -0
- package/src/pagination.d.ts +61 -0
- package/src/pagination.js +70 -0
- package/src/pagination.js.map +1 -0
- package/src/popover.d.ts +44 -0
- package/src/popover.js +60 -0
- package/src/popover.js.map +1 -0
- package/src/progress.d.ts +34 -0
- package/src/progress.js +7 -0
- package/src/progress.js.map +1 -0
- package/src/qr-code.d.ts +24 -0
- package/src/qr-code.js +34 -0
- package/src/qr-code.js.map +1 -0
- package/src/radio-group.d.ts +78 -0
- package/src/radio-group.js +97 -0
- package/src/radio-group.js.map +1 -0
- package/src/resizable.d.ts +48 -0
- package/src/resizable.js +62 -0
- package/src/resizable.js.map +1 -0
- package/src/runtime.d.ts +48 -0
- package/src/runtime.js +149 -0
- package/src/runtime.js.map +1 -0
- package/src/scroll-area.d.ts +32 -0
- package/src/scroll-area.js +63 -0
- package/src/scroll-area.js.map +1 -0
- package/src/select.d.ts +154 -0
- package/src/select.js +191 -0
- package/src/select.js.map +1 -0
- package/src/separator.d.ts +10 -0
- package/src/separator.js +17 -0
- package/src/separator.js.map +1 -0
- package/src/slider.d.ts +83 -0
- package/src/slider.js +94 -0
- package/src/slider.js.map +1 -0
- package/src/switch.d.ts +42 -0
- package/src/switch.js +51 -0
- package/src/switch.js.map +1 -0
- package/src/tabs.d.ts +101 -0
- package/src/tabs.js +106 -0
- package/src/tabs.js.map +1 -0
- package/src/toast.d.ts +48 -0
- package/src/toast.js +66 -0
- package/src/toast.js.map +1 -0
- package/src/toggle-group.d.ts +41 -0
- package/src/toggle-group.js +46 -0
- package/src/toggle-group.js.map +1 -0
- package/src/toggle.d.ts +39 -0
- package/src/toggle.js +46 -0
- package/src/toggle.js.map +1 -0
- package/src/toolbar-context.d.ts +8 -0
- package/src/toolbar-context.js +8 -0
- package/src/toolbar-context.js.map +1 -0
- package/src/toolbar.d.ts +72 -0
- package/src/toolbar.js +55 -0
- package/src/toolbar.js.map +1 -0
- package/src/tooltip.d.ts +46 -0
- package/src/tooltip.js +7 -0
- package/src/tooltip.js.map +1 -0
- package/src/value-bar.d.ts +38 -0
- package/src/value-bar.js +52 -0
- package/src/value-bar.js.map +1 -0
- package/README.md +0 -7
- package/index.js +0 -5
package/src/toast.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toast.js","names":[],"sources":["../../../../packages/vue/src/toast.ts"],"sourcesContent":["import { createToast } from \"@kirana-ui/core/toast\"\nimport type {\n Toast as Controller,\n ToastParts,\n ToastProps,\n ToastRecord,\n Toaster,\n} from \"@kirana-ui/core/toast\"\nimport { Fragment, defineComponent, h, useId } from \"vue\"\nimport type { PropType } from \"vue\"\n\nimport { context, controller, fromSignal, partComponent } from \"./runtime.ts\"\n\nconst scope = context<Controller>(\"Toast\")\nconst toastScope = context<ToastParts>(\"Toast.Root\")\n\nconst ViewportElement = partComponent(\"ToastViewportElement\", \"div\", () => scope.use().viewport)\n\n/** Where a toaster's toasts are drawn. Always in the page: put it once, near the root. */\nconst Viewport = defineComponent({\n name: \"ToastViewport\",\n inheritAttrs: false,\n props: {\n toaster: { type: Object as PropType<Toaster>, required: true },\n label: String,\n hotkey: String,\n swipeDirection: String as PropType<ToastProps[\"swipeDirection\"]>,\n id: String,\n },\n setup(props, { attrs, slots }) {\n const generated = useId()\n scope.provide(\n controller(createToast, () => ({\n id: props.id ?? generated,\n toaster: props.toaster,\n label: props.label,\n hotkey: props.hotkey,\n swipeDirection: props.swipeDirection,\n }))\n )\n return () => h(ViewportElement, attrs, slots)\n },\n})\n\n/** Draws its slot once for each toast, the newest first: `v-slot=\"{ toast }\"`. */\nconst List = defineComponent({\n name: \"ToastList\",\n setup(_, { slots }) {\n const toasts = fromSignal(scope.use().toasts)\n return () =>\n toasts.value.map((toast) => h(Fragment, { key: toast.id }, slots.default?.({ toast })))\n },\n})\n\nconst RootElement = partComponent(\"ToastRootElement\", \"div\", () => toastScope.use().root)\n\nconst Root = defineComponent({\n name: \"ToastRoot\",\n inheritAttrs: false,\n props: { toast: { type: Object as PropType<ToastRecord>, required: true } },\n setup(props, { attrs, slots }) {\n toastScope.provide(scope.use().toast(props.toast.id))\n return () => h(RootElement, attrs, slots)\n },\n})\n\nconst Content = partComponent(\"ToastContent\", \"div\", () => toastScope.use().content)\nconst Title = partComponent(\"ToastTitle\", \"div\", () => toastScope.use().title)\nconst Description = partComponent(\"ToastDescription\", \"div\", () => toastScope.use().description)\nconst Close = partComponent(\"ToastClose\", \"button\", () => toastScope.use().close)\nconst Action = partComponent(\"ToastAction\", \"button\", () => toastScope.use().action)\n\nexport const Toast = { Viewport, List, Root, Content, Title, Description, Close, Action }\n\nexport { createToaster } from \"@kirana-ui/core/toast\"\nexport type { ToastOptions, ToastRecord, Toaster } from \"@kirana-ui/core/toast\"\n"],"mappings":";;;;AAaA,MAAM,QAAQ,QAAoB,OAAO;AACzC,MAAM,aAAa,QAAoB,YAAY;AAEnD,MAAM,kBAAkB,cAAc,wBAAwB,aAAa,MAAM,IAAI,CAAC,CAAC,QAAQ;;AAG/F,MAAM,WAAW,gBAAgB;CAC/B,MAAM;CACN,cAAc;CACd,OAAO;EACL,SAAS;GAAE,MAAM;GAA6B,UAAU;EAAK;EAC7D,OAAO;EACP,QAAQ;EACR,gBAAgB;EAChB,IAAI;CACN;CACA,MAAM,OAAO,EAAE,OAAO,SAAS;EAC7B,MAAM,YAAY,MAAM;EACxB,MAAM,QACJ,WAAW,oBAAoB;GAC7B,IAAI,MAAM,MAAM;GAChB,SAAS,MAAM;GACf,OAAO,MAAM;GACb,QAAQ,MAAM;GACd,gBAAgB,MAAM;EACxB,EAAE,CACJ;EACA,aAAa,EAAE,iBAAiB,OAAO,KAAK;CAC9C;AACF,CAAC;;AAGD,MAAM,OAAO,gBAAgB;CAC3B,MAAM;CACN,MAAM,GAAG,EAAE,SAAS;EAClB,MAAM,SAAS,WAAW,MAAM,IAAI,CAAC,CAAC,MAAM;EAC5C,aACE,OAAO,MAAM,KAAK,UAAU,EAAE,UAAU,EAAE,KAAK,MAAM,GAAG,GAAG,MAAM,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;CAC1F;AACF,CAAC;AAED,MAAM,cAAc,cAAc,oBAAoB,aAAa,WAAW,IAAI,CAAC,CAAC,IAAI;AAkBxF,MAAa,QAAQ;CAAE;CAAU;CAAM,MAhB1B,gBAAgB;EAC3B,MAAM;EACN,cAAc;EACd,OAAO,EAAE,OAAO;GAAE,MAAM;GAAiC,UAAU;EAAK,EAAE;EAC1E,MAAM,OAAO,EAAE,OAAO,SAAS;GAC7B,WAAW,QAAQ,MAAM,IAAI,CAAC,CAAC,MAAM,MAAM,MAAM,EAAE,CAAC;GACpD,aAAa,EAAE,aAAa,OAAO,KAAK;EAC1C;CACF,CAQuC;CAAM,SAN7B,cAAc,gBAAgB,aAAa,WAAW,IAAI,CAAC,CAAC,OAM/B;CAAS,OALxC,cAAc,cAAc,aAAa,WAAW,IAAI,CAAC,CAAC,KAKlB;CAAO,aAJzC,cAAc,oBAAoB,aAAa,WAAW,IAAI,CAAC,CAAC,WAIvB;CAAa,OAH5D,cAAc,cAAc,gBAAgB,WAAW,IAAI,CAAC,CAAC,KAGD;CAAO,QAFlE,cAAc,eAAe,gBAAgB,WAAW,IAAI,CAAC,CAAC,MAEI;AAAO"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Orientation } from "@kirana-ui/core";
|
|
2
|
+
import { PropType } from "vue";
|
|
3
|
+
/** `v-model:value` (a list). Each `Toggle` with a `value` inside it is one of its toggles. */
|
|
4
|
+
export declare const ToggleGroup: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
5
|
+
value: {
|
|
6
|
+
type: PropType<readonly unknown[]>;
|
|
7
|
+
default: undefined;
|
|
8
|
+
};
|
|
9
|
+
defaultValue: PropType<readonly unknown[]>;
|
|
10
|
+
multiple: BooleanConstructor;
|
|
11
|
+
disabled: BooleanConstructor;
|
|
12
|
+
orientation: PropType<Orientation>;
|
|
13
|
+
loop: {
|
|
14
|
+
type: BooleanConstructor;
|
|
15
|
+
default: undefined;
|
|
16
|
+
};
|
|
17
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
18
|
+
[key: string]: any;
|
|
19
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:value" | "valueChange")[], "update:value" | "valueChange", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
20
|
+
value: {
|
|
21
|
+
type: PropType<readonly unknown[]>;
|
|
22
|
+
default: undefined;
|
|
23
|
+
};
|
|
24
|
+
defaultValue: PropType<readonly unknown[]>;
|
|
25
|
+
multiple: BooleanConstructor;
|
|
26
|
+
disabled: BooleanConstructor;
|
|
27
|
+
orientation: PropType<Orientation>;
|
|
28
|
+
loop: {
|
|
29
|
+
type: BooleanConstructor;
|
|
30
|
+
default: undefined;
|
|
31
|
+
};
|
|
32
|
+
}>> & Readonly<{
|
|
33
|
+
"onUpdate:value"?: ((...args: any[]) => any) | undefined;
|
|
34
|
+
onValueChange?: ((...args: any[]) => any) | undefined;
|
|
35
|
+
}>, {
|
|
36
|
+
value: readonly unknown[];
|
|
37
|
+
multiple: boolean;
|
|
38
|
+
disabled: boolean;
|
|
39
|
+
loop: boolean;
|
|
40
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
41
|
+
//# sourceMappingURL=toggle-group.d.ts.map
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { useDirectionAround } from "./direction-context.js";
|
|
2
|
+
import { controller, optional, partComponent } from "./runtime.js";
|
|
3
|
+
import { TOGGLE_GROUP, TOOLBAR } from "./toolbar-context.js";
|
|
4
|
+
import { within } from "@kirana-ui/core";
|
|
5
|
+
import { defineComponent, h, inject, provide } from "vue";
|
|
6
|
+
import { createToggleGroup } from "@kirana-ui/core/toggle-group";
|
|
7
|
+
// src/toggle-group.ts
|
|
8
|
+
/** `v-model:value` (a list). Each `Toggle` with a `value` inside it is one of its toggles. */
|
|
9
|
+
const ToggleGroup = defineComponent({
|
|
10
|
+
name: "ToggleGroup",
|
|
11
|
+
inheritAttrs: false,
|
|
12
|
+
props: {
|
|
13
|
+
value: optional(Array),
|
|
14
|
+
defaultValue: Array,
|
|
15
|
+
multiple: Boolean,
|
|
16
|
+
disabled: Boolean,
|
|
17
|
+
orientation: String,
|
|
18
|
+
loop: optional(Boolean)
|
|
19
|
+
},
|
|
20
|
+
emits: ["update:value", "valueChange"],
|
|
21
|
+
setup(props, { attrs, slots, emit }) {
|
|
22
|
+
const direction = useDirectionAround();
|
|
23
|
+
const toolbar = inject(TOOLBAR, null) ?? void 0;
|
|
24
|
+
const made = controller(within(createToggleGroup, {
|
|
25
|
+
direction,
|
|
26
|
+
toolbar
|
|
27
|
+
}), () => ({
|
|
28
|
+
value: props.value,
|
|
29
|
+
defaultValue: props.defaultValue,
|
|
30
|
+
multiple: props.multiple,
|
|
31
|
+
disabled: props.disabled,
|
|
32
|
+
orientation: props.orientation,
|
|
33
|
+
loop: props.loop,
|
|
34
|
+
onValueChange(value, details) {
|
|
35
|
+
emit("valueChange", value, details);
|
|
36
|
+
if (!details.canceled) emit("update:value", value);
|
|
37
|
+
}
|
|
38
|
+
}));
|
|
39
|
+
provide(TOGGLE_GROUP, made);
|
|
40
|
+
const Element = partComponent("ToggleGroupElement", "div", () => made.root);
|
|
41
|
+
return () => h(Element, attrs, slots);
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
export { ToggleGroup };
|
|
45
|
+
|
|
46
|
+
//# sourceMappingURL=toggle-group.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toggle-group.js","names":[],"sources":["../../../../packages/vue/src/toggle-group.ts"],"sourcesContent":["import { within } from \"@kirana-ui/core\"\nimport type { ChangeDetails, Orientation } from \"@kirana-ui/core\"\nimport { createToggleGroup } from \"@kirana-ui/core/toggle-group\"\nimport { defineComponent, h, inject, provide } from \"vue\"\nimport type { PropType } from \"vue\"\n\nimport { useDirectionAround } from \"./direction-context.ts\"\nimport { controller, optional, partComponent } from \"./runtime.ts\"\nimport { TOGGLE_GROUP, TOOLBAR } from \"./toolbar-context.ts\"\n\n/** `v-model:value` (a list). Each `Toggle` with a `value` inside it is one of its toggles. */\nexport const ToggleGroup = defineComponent({\n name: \"ToggleGroup\",\n inheritAttrs: false,\n props: {\n value: optional(Array as PropType<readonly unknown[]>),\n defaultValue: Array as PropType<readonly unknown[]>,\n multiple: Boolean,\n disabled: Boolean,\n orientation: String as PropType<Orientation>,\n loop: optional(Boolean),\n },\n emits: [\"update:value\", \"valueChange\"],\n setup(props, { attrs, slots, emit }) {\n const direction = useDirectionAround()\n const toolbar = inject(TOOLBAR, null) ?? undefined\n const made = controller(within(createToggleGroup, { direction, toolbar }), () => ({\n value: props.value,\n defaultValue: props.defaultValue,\n multiple: props.multiple,\n disabled: props.disabled,\n orientation: props.orientation,\n loop: props.loop,\n onValueChange(value: unknown[], details: ChangeDetails) {\n emit(\"valueChange\", value, details)\n if (!details.canceled) emit(\"update:value\", value)\n },\n }))\n provide(TOGGLE_GROUP, made)\n const Element = partComponent(\"ToggleGroupElement\", \"div\", () => made.root)\n return () => h(Element, attrs, slots)\n },\n})\n"],"mappings":";;;;;;;;AAWA,MAAa,cAAc,gBAAgB;CACzC,MAAM;CACN,cAAc;CACd,OAAO;EACL,OAAO,SAAS,KAAqC;EACrD,cAAc;EACd,UAAU;EACV,UAAU;EACV,aAAa;EACb,MAAM,SAAS,OAAO;CACxB;CACA,OAAO,CAAC,gBAAgB,aAAa;CACrC,MAAM,OAAO,EAAE,OAAO,OAAO,QAAQ;EACnC,MAAM,YAAY,mBAAmB;EACrC,MAAM,UAAU,OAAO,SAAS,IAAI,KAAK,KAAA;EACzC,MAAM,OAAO,WAAW,OAAO,mBAAmB;GAAE;GAAW;EAAQ,CAAC,UAAU;GAChF,OAAO,MAAM;GACb,cAAc,MAAM;GACpB,UAAU,MAAM;GAChB,UAAU,MAAM;GAChB,aAAa,MAAM;GACnB,MAAM,MAAM;GACZ,cAAc,OAAkB,SAAwB;IACtD,KAAK,eAAe,OAAO,OAAO;IAClC,IAAI,CAAC,QAAQ,UAAU,KAAK,gBAAgB,KAAK;GACnD;EACF,EAAE;EACF,QAAQ,cAAc,IAAI;EAC1B,MAAM,UAAU,cAAc,sBAAsB,aAAa,KAAK,IAAI;EAC1E,aAAa,EAAE,SAAS,OAAO,KAAK;CACtC;AACF,CAAC"}
|
package/src/toggle.d.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { PropType } from "vue";
|
|
2
|
+
/**
|
|
3
|
+
* `v-model:pressed`, or `pressed` with `@pressed-change="(pressed, details) => …"`. Inside a
|
|
4
|
+
* `ToggleGroup`, `value` makes it one of the group's toggles.
|
|
5
|
+
*/
|
|
6
|
+
export declare const Toggle: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
7
|
+
pressed: {
|
|
8
|
+
type: BooleanConstructor;
|
|
9
|
+
default: undefined;
|
|
10
|
+
};
|
|
11
|
+
defaultPressed: BooleanConstructor;
|
|
12
|
+
disabled: BooleanConstructor;
|
|
13
|
+
value: {
|
|
14
|
+
type: PropType<unknown>;
|
|
15
|
+
default: unknown;
|
|
16
|
+
};
|
|
17
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
18
|
+
[key: string]: any;
|
|
19
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("pressedChange" | "update:pressed")[], "pressedChange" | "update:pressed", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
20
|
+
pressed: {
|
|
21
|
+
type: BooleanConstructor;
|
|
22
|
+
default: undefined;
|
|
23
|
+
};
|
|
24
|
+
defaultPressed: BooleanConstructor;
|
|
25
|
+
disabled: BooleanConstructor;
|
|
26
|
+
value: {
|
|
27
|
+
type: PropType<unknown>;
|
|
28
|
+
default: unknown;
|
|
29
|
+
};
|
|
30
|
+
}>> & Readonly<{
|
|
31
|
+
onPressedChange?: ((...args: any[]) => any) | undefined;
|
|
32
|
+
"onUpdate:pressed"?: ((...args: any[]) => any) | undefined;
|
|
33
|
+
}>, {
|
|
34
|
+
pressed: boolean;
|
|
35
|
+
defaultPressed: boolean;
|
|
36
|
+
disabled: boolean;
|
|
37
|
+
value: unknown;
|
|
38
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
39
|
+
//# sourceMappingURL=toggle.d.ts.map
|
package/src/toggle.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { controller, optional, partComponent } from "./runtime.js";
|
|
2
|
+
import { TOGGLE_GROUP, TOOLBAR } from "./toolbar-context.js";
|
|
3
|
+
import { within } from "@kirana-ui/core";
|
|
4
|
+
import { defineComponent, h, inject } from "vue";
|
|
5
|
+
import { createToggle } from "@kirana-ui/core/toggle";
|
|
6
|
+
// src/toggle.ts
|
|
7
|
+
/**
|
|
8
|
+
* `v-model:pressed`, or `pressed` with `@pressed-change="(pressed, details) => …"`. Inside a
|
|
9
|
+
* `ToggleGroup`, `value` makes it one of the group's toggles.
|
|
10
|
+
*/
|
|
11
|
+
const Toggle = defineComponent({
|
|
12
|
+
name: "Toggle",
|
|
13
|
+
inheritAttrs: false,
|
|
14
|
+
props: {
|
|
15
|
+
pressed: optional(Boolean),
|
|
16
|
+
defaultPressed: Boolean,
|
|
17
|
+
disabled: Boolean,
|
|
18
|
+
value: {
|
|
19
|
+
type: null,
|
|
20
|
+
default: void 0
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
emits: ["update:pressed", "pressedChange"],
|
|
24
|
+
setup(props, { attrs, slots, emit }) {
|
|
25
|
+
const group = inject(TOGGLE_GROUP, null) ?? void 0;
|
|
26
|
+
const toolbar = inject(TOOLBAR, null) ?? void 0;
|
|
27
|
+
const made = controller(within(createToggle, {
|
|
28
|
+
group,
|
|
29
|
+
toolbar
|
|
30
|
+
}), () => ({
|
|
31
|
+
pressed: props.pressed,
|
|
32
|
+
defaultPressed: props.defaultPressed,
|
|
33
|
+
disabled: props.disabled,
|
|
34
|
+
value: props.value,
|
|
35
|
+
onPressedChange(pressed, details) {
|
|
36
|
+
emit("pressedChange", pressed, details);
|
|
37
|
+
if (!details.canceled) emit("update:pressed", pressed);
|
|
38
|
+
}
|
|
39
|
+
}));
|
|
40
|
+
const Element = partComponent("ToggleElement", "button", () => made.root);
|
|
41
|
+
return () => h(Element, attrs, slots);
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
export { Toggle };
|
|
45
|
+
|
|
46
|
+
//# sourceMappingURL=toggle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toggle.js","names":[],"sources":["../../../../packages/vue/src/toggle.ts"],"sourcesContent":["import { within } from \"@kirana-ui/core\"\nimport type { ChangeDetails } from \"@kirana-ui/core\"\nimport { createToggle } from \"@kirana-ui/core/toggle\"\nimport { defineComponent, h, inject } from \"vue\"\nimport type { PropType } from \"vue\"\n\nimport { controller, optional, partComponent } from \"./runtime.ts\"\nimport { TOGGLE_GROUP, TOOLBAR } from \"./toolbar-context.ts\"\n\n/**\n * `v-model:pressed`, or `pressed` with `@pressed-change=\"(pressed, details) => …\"`. Inside a\n * `ToggleGroup`, `value` makes it one of the group's toggles.\n */\nexport const Toggle = defineComponent({\n name: \"Toggle\",\n inheritAttrs: false,\n props: {\n pressed: optional(Boolean),\n defaultPressed: Boolean,\n disabled: Boolean,\n value: { type: null as unknown as PropType<unknown>, default: undefined as unknown },\n },\n emits: [\"update:pressed\", \"pressedChange\"],\n setup(props, { attrs, slots, emit }) {\n const group = inject(TOGGLE_GROUP, null) ?? undefined\n const toolbar = inject(TOOLBAR, null) ?? undefined\n const made = controller(within(createToggle, { group, toolbar }), () => ({\n pressed: props.pressed,\n defaultPressed: props.defaultPressed,\n disabled: props.disabled,\n value: props.value,\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":";;;;;;;;;;AAaA,MAAa,SAAS,gBAAgB;CACpC,MAAM;CACN,cAAc;CACd,OAAO;EACL,SAAS,SAAS,OAAO;EACzB,gBAAgB;EAChB,UAAU;EACV,OAAO;GAAE,MAAM;GAAsC,SAAS,KAAA;EAAqB;CACrF;CACA,OAAO,CAAC,kBAAkB,eAAe;CACzC,MAAM,OAAO,EAAE,OAAO,OAAO,QAAQ;EACnC,MAAM,QAAQ,OAAO,cAAc,IAAI,KAAK,KAAA;EAC5C,MAAM,UAAU,OAAO,SAAS,IAAI,KAAK,KAAA;EACzC,MAAM,OAAO,WAAW,OAAO,cAAc;GAAE;GAAO;EAAQ,CAAC,UAAU;GACvE,SAAS,MAAM;GACf,gBAAgB,MAAM;GACtB,UAAU,MAAM;GAChB,OAAO,MAAM;GACb,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"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { InjectionKey } from "vue";
|
|
2
|
+
import { ToggleGroup } from "@kirana-ui/core/toggle-group";
|
|
3
|
+
import { Toolbar } from "@kirana-ui/core/toolbar";
|
|
4
|
+
/** The toolbar a control is an item of, if it is in one. */
|
|
5
|
+
export declare const TOOLBAR: InjectionKey<Toolbar | null>;
|
|
6
|
+
/** The group a toggle is one of the toggles of, if it is in one. */
|
|
7
|
+
export declare const TOGGLE_GROUP: InjectionKey<ToggleGroup | null>;
|
|
8
|
+
//# sourceMappingURL=toolbar-context.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// src/toolbar-context.ts
|
|
2
|
+
/** The toolbar a control is an item of, if it is in one. */
|
|
3
|
+
const TOOLBAR = Symbol("Toolbar");
|
|
4
|
+
/** The group a toggle is one of the toggles of, if it is in one. */
|
|
5
|
+
const TOGGLE_GROUP = Symbol("ToggleGroup");
|
|
6
|
+
export { TOGGLE_GROUP, TOOLBAR };
|
|
7
|
+
|
|
8
|
+
//# sourceMappingURL=toolbar-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolbar-context.js","names":[],"sources":["../../../../packages/vue/src/toolbar-context.ts"],"sourcesContent":["import type { ToggleGroup } from \"@kirana-ui/core/toggle-group\"\nimport type { Toolbar } from \"@kirana-ui/core/toolbar\"\nimport type { InjectionKey } from \"vue\"\n\n/** The toolbar a control is an item of, if it is in one. */\nexport const TOOLBAR: InjectionKey<Toolbar | null> = Symbol(\"Toolbar\")\n/** The group a toggle is one of the toggles of, if it is in one. */\nexport const TOGGLE_GROUP: InjectionKey<ToggleGroup | null> = Symbol(\"ToggleGroup\")\n"],"mappings":";;AAKA,MAAa,UAAwC,OAAO,SAAS;;AAErE,MAAa,eAAiD,OAAO,aAAa"}
|
package/src/toolbar.d.ts
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { Orientation } from "@kirana-ui/core";
|
|
2
|
+
import { PropType } from "vue";
|
|
3
|
+
export declare const Toolbar: {
|
|
4
|
+
Root: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
5
|
+
orientation: PropType<Orientation>;
|
|
6
|
+
loop: {
|
|
7
|
+
type: BooleanConstructor;
|
|
8
|
+
default: undefined;
|
|
9
|
+
};
|
|
10
|
+
disabled: BooleanConstructor;
|
|
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
|
+
orientation: PropType<Orientation>;
|
|
15
|
+
loop: {
|
|
16
|
+
type: BooleanConstructor;
|
|
17
|
+
default: undefined;
|
|
18
|
+
};
|
|
19
|
+
disabled: BooleanConstructor;
|
|
20
|
+
}>> & Readonly<{}>, {
|
|
21
|
+
loop: boolean;
|
|
22
|
+
disabled: boolean;
|
|
23
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
24
|
+
Button: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
25
|
+
disabled: {
|
|
26
|
+
type: BooleanConstructor;
|
|
27
|
+
default: undefined;
|
|
28
|
+
};
|
|
29
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
30
|
+
[key: string]: any;
|
|
31
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
32
|
+
disabled: {
|
|
33
|
+
type: BooleanConstructor;
|
|
34
|
+
default: undefined;
|
|
35
|
+
};
|
|
36
|
+
}>> & Readonly<{}>, {
|
|
37
|
+
disabled: boolean;
|
|
38
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
39
|
+
Link: import("vue").Component;
|
|
40
|
+
Input: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
41
|
+
disabled: {
|
|
42
|
+
type: BooleanConstructor;
|
|
43
|
+
default: undefined;
|
|
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
|
+
disabled: {
|
|
49
|
+
type: BooleanConstructor;
|
|
50
|
+
default: undefined;
|
|
51
|
+
};
|
|
52
|
+
}>> & Readonly<{}>, {
|
|
53
|
+
disabled: boolean;
|
|
54
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
55
|
+
Group: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
56
|
+
disabled: {
|
|
57
|
+
type: BooleanConstructor;
|
|
58
|
+
default: undefined;
|
|
59
|
+
};
|
|
60
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
61
|
+
[key: string]: any;
|
|
62
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
63
|
+
disabled: {
|
|
64
|
+
type: BooleanConstructor;
|
|
65
|
+
default: undefined;
|
|
66
|
+
};
|
|
67
|
+
}>> & Readonly<{}>, {
|
|
68
|
+
disabled: boolean;
|
|
69
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
70
|
+
Separator: import("vue").Component;
|
|
71
|
+
};
|
|
72
|
+
//# sourceMappingURL=toolbar.d.ts.map
|
package/src/toolbar.js
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { useDirectionAround } from "./direction-context.js";
|
|
2
|
+
import { controller, optional, partComponent, toSignal } from "./runtime.js";
|
|
3
|
+
import { TOGGLE_GROUP, TOOLBAR } from "./toolbar-context.js";
|
|
4
|
+
import { defined, within } from "@kirana-ui/core";
|
|
5
|
+
import { defineComponent, h, inject, provide } from "vue";
|
|
6
|
+
import { createToolbar } from "@kirana-ui/core/toolbar";
|
|
7
|
+
// src/toolbar.ts
|
|
8
|
+
function useToolbar() {
|
|
9
|
+
const made = inject(TOOLBAR, null);
|
|
10
|
+
if (!made) throw new Error("A Toolbar part must be inside <Toolbar.Root>");
|
|
11
|
+
return made;
|
|
12
|
+
}
|
|
13
|
+
const Root = defineComponent({
|
|
14
|
+
name: "ToolbarRoot",
|
|
15
|
+
inheritAttrs: false,
|
|
16
|
+
props: {
|
|
17
|
+
orientation: String,
|
|
18
|
+
loop: optional(Boolean),
|
|
19
|
+
disabled: Boolean
|
|
20
|
+
},
|
|
21
|
+
setup(props, { attrs, slots }) {
|
|
22
|
+
const direction = useDirectionAround();
|
|
23
|
+
const made = controller(within(createToolbar, { direction }), () => ({
|
|
24
|
+
orientation: props.orientation,
|
|
25
|
+
loop: props.loop,
|
|
26
|
+
disabled: props.disabled
|
|
27
|
+
}));
|
|
28
|
+
provide(TOOLBAR, made);
|
|
29
|
+
provide(TOGGLE_GROUP, null);
|
|
30
|
+
const Element = partComponent("ToolbarRootElement", "div", () => made.root);
|
|
31
|
+
return () => h(Element, attrs, slots);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
const item = (name, label, tag) => defineComponent({
|
|
35
|
+
name: `Toolbar${label}`,
|
|
36
|
+
inheritAttrs: false,
|
|
37
|
+
props: { disabled: optional(Boolean) },
|
|
38
|
+
setup(props, { attrs, slots }) {
|
|
39
|
+
const options = toSignal(() => ({ disabled: props.disabled }));
|
|
40
|
+
const part = useToolbar()[name](() => defined(options.get()));
|
|
41
|
+
const Element = partComponent(`Toolbar${label}Element`, tag, () => part);
|
|
42
|
+
return () => h(Element, attrs, slots);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
const Toolbar = {
|
|
46
|
+
Root,
|
|
47
|
+
Button: item("button", "Button", "button"),
|
|
48
|
+
Link: partComponent("ToolbarLink", "a", () => useToolbar().link()),
|
|
49
|
+
Input: item("input", "Input", "input"),
|
|
50
|
+
Group: item("group", "Group", "div"),
|
|
51
|
+
Separator: partComponent("ToolbarSeparator", "div", () => useToolbar().separator)
|
|
52
|
+
};
|
|
53
|
+
export { Toolbar };
|
|
54
|
+
|
|
55
|
+
//# sourceMappingURL=toolbar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolbar.js","names":[],"sources":["../../../../packages/vue/src/toolbar.ts"],"sourcesContent":["import { defined, within } from \"@kirana-ui/core\"\nimport type { Orientation } from \"@kirana-ui/core\"\nimport { createToolbar } from \"@kirana-ui/core/toolbar\"\nimport type { Toolbar as Controller } from \"@kirana-ui/core/toolbar\"\nimport { defineComponent, h, inject, provide } from \"vue\"\nimport type { PropType } from \"vue\"\n\nimport { useDirectionAround } from \"./direction-context.ts\"\nimport { controller, optional, partComponent, toSignal } from \"./runtime.ts\"\nimport { TOGGLE_GROUP, TOOLBAR } from \"./toolbar-context.ts\"\n\nfunction useToolbar(): Controller {\n const made = inject(TOOLBAR, null)\n if (!made) throw new Error(\"A Toolbar part must be inside <Toolbar.Root>\")\n return made\n}\n\nconst Root = defineComponent({\n name: \"ToolbarRoot\",\n inheritAttrs: false,\n props: {\n orientation: String as PropType<Orientation>,\n loop: optional(Boolean),\n disabled: Boolean,\n },\n setup(props, { attrs, slots }) {\n const direction = useDirectionAround()\n const made = controller(within(createToolbar, { direction }), () => ({\n orientation: props.orientation,\n loop: props.loop,\n disabled: props.disabled,\n }))\n provide(TOOLBAR, made)\n // A toggle group around the toolbar is not the group of the toolbar's toggles.\n provide(TOGGLE_GROUP, null)\n const Element = partComponent(\"ToolbarRootElement\", \"div\", () => made.root)\n return () => h(Element, attrs, slots)\n },\n})\n\nconst item = (name: \"button\" | \"input\" | \"group\", label: string, tag: string) =>\n defineComponent({\n name: `Toolbar${label}`,\n inheritAttrs: false,\n props: { disabled: optional(Boolean) },\n setup(props, { attrs, slots }) {\n const options = toSignal(() => ({ disabled: props.disabled }))\n const part = useToolbar()[name](() => defined(options.get()))\n const Element = partComponent(`Toolbar${label}Element`, tag, () => part)\n return () => h(Element, attrs, slots)\n },\n })\n\nexport const Toolbar = {\n Root,\n Button: item(\"button\", \"Button\", \"button\"),\n Link: partComponent(\"ToolbarLink\", \"a\", () => useToolbar().link()),\n Input: item(\"input\", \"Input\", \"input\"),\n Group: item(\"group\", \"Group\", \"div\"),\n Separator: partComponent(\"ToolbarSeparator\", \"div\", () => useToolbar().separator),\n}\n"],"mappings":";;;;;;;AAWA,SAAS,aAAyB;CAChC,MAAM,OAAO,OAAO,SAAS,IAAI;CACjC,IAAI,CAAC,MAAM,MAAM,IAAI,MAAM,8CAA8C;CACzE,OAAO;AACT;AAEA,MAAM,OAAO,gBAAgB;CAC3B,MAAM;CACN,cAAc;CACd,OAAO;EACL,aAAa;EACb,MAAM,SAAS,OAAO;EACtB,UAAU;CACZ;CACA,MAAM,OAAO,EAAE,OAAO,SAAS;EAC7B,MAAM,YAAY,mBAAmB;EACrC,MAAM,OAAO,WAAW,OAAO,eAAe,EAAE,UAAU,CAAC,UAAU;GACnE,aAAa,MAAM;GACnB,MAAM,MAAM;GACZ,UAAU,MAAM;EAClB,EAAE;EACF,QAAQ,SAAS,IAAI;EAErB,QAAQ,cAAc,IAAI;EAC1B,MAAM,UAAU,cAAc,sBAAsB,aAAa,KAAK,IAAI;EAC1E,aAAa,EAAE,SAAS,OAAO,KAAK;CACtC;AACF,CAAC;AAED,MAAM,QAAQ,MAAoC,OAAe,QAC/D,gBAAgB;CACd,MAAM,UAAU;CAChB,cAAc;CACd,OAAO,EAAE,UAAU,SAAS,OAAO,EAAE;CACrC,MAAM,OAAO,EAAE,OAAO,SAAS;EAC7B,MAAM,UAAU,gBAAgB,EAAE,UAAU,MAAM,SAAS,EAAE;EAC7D,MAAM,OAAO,WAAW,CAAC,CAAC,KAAK,OAAO,QAAQ,QAAQ,IAAI,CAAC,CAAC;EAC5D,MAAM,UAAU,cAAc,UAAU,MAAM,UAAU,WAAW,IAAI;EACvE,aAAa,EAAE,SAAS,OAAO,KAAK;CACtC;AACF,CAAC;AAEH,MAAa,UAAU;CACrB;CACA,QAAQ,KAAK,UAAU,UAAU,QAAQ;CACzC,MAAM,cAAc,eAAe,WAAW,WAAW,CAAC,CAAC,KAAK,CAAC;CACjE,OAAO,KAAK,SAAS,SAAS,OAAO;CACrC,OAAO,KAAK,SAAS,SAAS,KAAK;CACnC,WAAW,cAAc,oBAAoB,aAAa,WAAW,CAAC,CAAC,SAAS;AAClF"}
|
package/src/tooltip.d.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
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").DefineComponent<import("vue").ExtractPropTypes<{
|
|
33
|
+
delay: NumberConstructor;
|
|
34
|
+
closeDelay: NumberConstructor;
|
|
35
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
36
|
+
[key: string]: any;
|
|
37
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
38
|
+
delay: NumberConstructor;
|
|
39
|
+
closeDelay: NumberConstructor;
|
|
40
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
41
|
+
Portal: import("vue").Component;
|
|
42
|
+
Positioner: import("vue").Component;
|
|
43
|
+
Popup: import("vue").Component;
|
|
44
|
+
Arrow: import("vue").Component;
|
|
45
|
+
};
|
|
46
|
+
//# 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
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
# @kirana-ui/vue
|
|
2
|
-
|
|
3
|
-
A placeholder holding the name for Kirana UI Primitives for Vue, part of Kirana UI Primitives: headless components for
|
|
4
|
-
React, Vue, Svelte, Solid and Angular. Nothing is released under this name yet, and installing it
|
|
5
|
-
throws.
|
|
6
|
-
|
|
7
|
-
Documentation: https://ui.kirana.style · Source: https://github.com/kirana-style/primitives
|
package/index.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
// A placeholder that holds the name on npm for a part of Kirana UI Primitives that is not released
|
|
2
|
-
// yet. It fails loudly rather than doing nothing.
|
|
3
|
-
throw new Error(
|
|
4
|
-
"@kirana-ui/vue@0.0.0 is a placeholder: nothing is released under this name yet. Kirana UI: https://ui.kirana.style"
|
|
5
|
-
)
|