@kirana-ui/vue 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/llms.txt +1838 -0
- package/package.json +112 -2
- package/src/autocomplete.d.ts +2 -0
- package/src/autocomplete.js +1 -0
- package/src/autosize.d.ts +12 -0
- package/src/autosize.js +24 -0
- package/src/autosize.js.map +1 -0
- package/src/calendar.d.ts +107 -0
- package/src/calendar.js +125 -0
- package/src/calendar.js.map +1 -0
- package/src/carousel.d.ts +61 -0
- package/src/carousel.js +75 -0
- package/src/carousel.js.map +1 -0
- package/src/checkbox.d.ts +2 -0
- package/src/checkbox.js +2 -0
- package/src/checkbox.js.map +1 -1
- package/src/combobox.d.ts +298 -0
- package/src/combobox.js +286 -0
- package/src/combobox.js.map +1 -0
- package/src/command.d.ts +89 -0
- package/src/command.js +129 -0
- package/src/command.js.map +1 -0
- package/src/context-menu.d.ts +2 -0
- package/src/context-menu.js +1 -0
- package/src/date-field.d.ts +70 -0
- package/src/date-field.js +77 -0
- package/src/date-field.js.map +1 -0
- package/src/date-picker.d.ts +145 -0
- package/src/date-picker.js +82 -0
- package/src/date-picker.js.map +1 -0
- package/src/dialog.d.ts +70 -0
- package/src/dialog.js +56 -1
- package/src/dialog.js.map +1 -1
- package/src/drawer.d.ts +2 -0
- package/src/drawer.js +1 -0
- package/src/hover-card.d.ts +9 -1
- package/src/hover-popup.d.ts +9 -1
- package/src/hover-popup.js +41 -25
- package/src/hover-popup.js.map +1 -1
- package/src/index.d.ts +27 -2
- package/src/index.js +26 -2
- package/src/input.d.ts +19 -0
- package/src/input.js +36 -0
- package/src/input.js.map +1 -0
- package/src/label.d.ts +5 -0
- package/src/label.js +18 -0
- package/src/label.js.map +1 -0
- package/src/listbox.d.ts +92 -0
- package/src/listbox.js +104 -0
- package/src/listbox.js.map +1 -0
- package/src/menu.d.ts +542 -0
- package/src/menu.js +235 -0
- package/src/menu.js.map +1 -0
- package/src/menubar-context.d.ts +5 -0
- package/src/menubar-context.js +6 -0
- package/src/menubar-context.js.map +1 -0
- package/src/menubar.d.ts +26 -0
- package/src/menubar.js +34 -0
- package/src/menubar.js.map +1 -0
- package/src/message-scroller.d.ts +20 -0
- package/src/message-scroller.js +34 -0
- package/src/message-scroller.js.map +1 -0
- package/src/navigation-menu.d.ts +91 -0
- package/src/navigation-menu.js +117 -0
- package/src/navigation-menu.js.map +1 -0
- package/src/number-field.d.ts +71 -0
- package/src/number-field.js +81 -0
- package/src/number-field.js.map +1 -0
- package/src/otp.d.ts +58 -0
- package/src/otp.js +86 -0
- package/src/otp.js.map +1 -0
- package/src/pagination.d.ts +61 -0
- package/src/pagination.js +70 -0
- package/src/pagination.js.map +1 -0
- package/src/popover.d.ts +5 -0
- package/src/popover.js +1 -1
- package/src/popover.js.map +1 -1
- package/src/qr-code.d.ts +24 -0
- package/src/qr-code.js +34 -0
- package/src/qr-code.js.map +1 -0
- package/src/radio-group.d.ts +2 -0
- package/src/radio-group.js +2 -0
- package/src/radio-group.js.map +1 -1
- package/src/resizable.d.ts +48 -0
- package/src/resizable.js +62 -0
- package/src/resizable.js.map +1 -0
- package/src/runtime.d.ts +20 -1
- package/src/runtime.js +22 -3
- package/src/runtime.js.map +1 -1
- package/src/scroll-area.d.ts +32 -0
- package/src/scroll-area.js +63 -0
- package/src/scroll-area.js.map +1 -0
- package/src/select.d.ts +36 -1
- package/src/select.js +68 -4
- package/src/select.js.map +1 -1
- package/src/slider.d.ts +4 -0
- package/src/slider.js +2 -0
- package/src/slider.js.map +1 -1
- package/src/switch.d.ts +2 -0
- package/src/switch.js +2 -0
- package/src/switch.js.map +1 -1
- package/src/toast.d.ts +48 -0
- package/src/toast.js +66 -0
- package/src/toast.js.map +1 -0
- package/src/toggle-group.d.ts +41 -0
- package/src/toggle-group.js +46 -0
- package/src/toggle-group.js.map +1 -0
- package/src/toggle.d.ts +14 -1
- package/src/toggle.js +19 -4
- package/src/toggle.js.map +1 -1
- package/src/toolbar-context.d.ts +8 -0
- package/src/toolbar-context.js +8 -0
- package/src/toolbar-context.js.map +1 -0
- package/src/toolbar.d.ts +72 -0
- package/src/toolbar.js +55 -0
- package/src/toolbar.js.map +1 -0
- package/src/tooltip.d.ts +9 -1
package/src/slider.js
CHANGED
|
@@ -19,9 +19,11 @@ const Root = defineComponent({
|
|
|
19
19
|
step: Number,
|
|
20
20
|
largeStep: Number,
|
|
21
21
|
minStepsBetweenValues: Number,
|
|
22
|
+
thumbAlignment: String,
|
|
22
23
|
orientation: String,
|
|
23
24
|
disabled: Boolean,
|
|
24
25
|
name: String,
|
|
26
|
+
form: String,
|
|
25
27
|
format: Object,
|
|
26
28
|
locale: String,
|
|
27
29
|
getAriaValueText: Function,
|
package/src/slider.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slider.js","names":[],"sources":["../../../../packages/vue/src/slider.ts"],"sourcesContent":["import { within } from \"@kirana-ui/core\"\nimport type { ChangeDetails } from \"@kirana-ui/core\"\nimport { createSlider } from \"@kirana-ui/core/slider\"\nimport type { Slider as Controller, SliderProps, SliderValue } from \"@kirana-ui/core/slider\"\nimport { defineComponent, h, useId } from \"vue\"\nimport type { PropType } from \"vue\"\n\nimport { useDirectionAround } from \"./direction-context.ts\"\nimport { useFieldAround } from \"./field-context.ts\"\nimport { context, controller, fromSignal, optional, partComponent } from \"./runtime.ts\"\n\nconst scope = context<Controller>(\"Slider\")\n\nconst RootElement = partComponent(\"SliderRootElement\", \"div\", () => scope.use().root)\n\n/** `v-model:value`, or `value` with `@value-change=\"(value, details) => …\"`. */\nconst Root = defineComponent({\n name: \"SliderRoot\",\n inheritAttrs: false,\n props: {\n value: optional([Number, Array] as PropType<SliderValue>),\n defaultValue: optional([Number, Array] as PropType<SliderValue>),\n min: Number,\n max: Number,\n step: Number,\n largeStep: Number,\n minStepsBetweenValues: Number,\n orientation: String as PropType<\"horizontal\" | \"vertical\">,\n disabled: Boolean,\n name: String,\n format: Object as PropType<Intl.NumberFormatOptions>,\n locale: String,\n getAriaValueText: Function as PropType<SliderProps[\"getAriaValueText\"]>,\n id: String,\n },\n emits: [\"update:value\", \"valueChange\", \"valueCommitted\"],\n setup(props, { attrs, slots, emit }) {\n const generated = useId()\n const field = useFieldAround()\n scope.provide(\n controller(within(createSlider, { field, direction: useDirectionAround() }), () => ({\n ...props,\n id: props.id ?? generated,\n onValueChange(value: number | number[], details: ChangeDetails) {\n emit(\"valueChange\", value, details)\n if (!details.canceled) emit(\"update:value\", value)\n },\n onValueCommitted: (value: number | number[], details: ChangeDetails) =>\n emit(\"valueCommitted\", value, details),\n }))\n )\n return () => h(RootElement, attrs, slots)\n },\n})\n\n/** `index` is which value of a range the thumb is, from 0. */\nconst Thumb = defineComponent({\n name: \"SliderThumb\",\n inheritAttrs: false,\n props: { index: { type: Number, default: 0 } },\n setup(props, { attrs, slots }) {\n const slider = scope.use()\n // A thumb is its index for as long as it is in the page.\n const index = props.index\n const Element = partComponent(\"SliderThumbElement\", \"div\", () => slider.thumb(index))\n const Input = partComponent(\"SliderThumbInput\", \"input\", () => slider.thumbInput(index))\n return () => h(Element, attrs, () => [slots.default?.(), h(Input)])\n },\n})\n\nconst ValueElement = partComponent(\"SliderValueElement\", \"output\", () => scope.use().value)\n\n/** The written value, or what its slot makes of it (`v-slot=\"{ text, values }\"`). */\nconst Value = defineComponent({\n name: \"SliderValue\",\n inheritAttrs: false,\n setup(_props, { attrs, slots }) {\n const slider = scope.use()\n const text = fromSignal(slider.text)\n const values = fromSignal(slider.values)\n return () =>\n h(\n ValueElement,\n attrs,\n () => slots.default?.({ text: text.value, values: values.value }) ?? text.value\n )\n },\n})\n\nexport const Slider = {\n Root,\n Value,\n Control: partComponent(\"SliderControl\", \"div\", () => scope.use().control),\n Track: partComponent(\"SliderTrack\", \"div\", () => scope.use().track),\n Indicator: partComponent(\"SliderIndicator\", \"div\", () => scope.use().indicator),\n Thumb,\n}\n"],"mappings":";;;;;;;AAWA,MAAM,QAAQ,QAAoB,QAAQ;AAE1C,MAAM,cAAc,cAAc,qBAAqB,aAAa,MAAM,IAAI,CAAC,CAAC,IAAI;;AAGpF,MAAM,OAAO,gBAAgB;CAC3B,MAAM;CACN,cAAc;CACd,OAAO;EACL,OAAO,SAAS,CAAC,QAAQ,KAAK,CAA0B;EACxD,cAAc,SAAS,CAAC,QAAQ,KAAK,CAA0B;EAC/D,KAAK;EACL,KAAK;EACL,MAAM;EACN,WAAW;EACX,uBAAuB;EACvB,aAAa;EACb,UAAU;EACV,MAAM;EACN,QAAQ;EACR,QAAQ;EACR,kBAAkB;EAClB,IAAI;CACN;CACA,OAAO;EAAC;EAAgB;EAAe;CAAgB;CACvD,MAAM,OAAO,EAAE,OAAO,OAAO,QAAQ;EACnC,MAAM,YAAY,MAAM;EACxB,MAAM,QAAQ,eAAe;EAC7B,MAAM,QACJ,WAAW,OAAO,cAAc;GAAE;GAAO,WAAW,mBAAmB;EAAE,CAAC,UAAU;GAClF,GAAG;GACH,IAAI,MAAM,MAAM;GAChB,cAAc,OAA0B,SAAwB;IAC9D,KAAK,eAAe,OAAO,OAAO;IAClC,IAAI,CAAC,QAAQ,UAAU,KAAK,gBAAgB,KAAK;GACnD;GACA,mBAAmB,OAA0B,YAC3C,KAAK,kBAAkB,OAAO,OAAO;EACzC,EAAE,CACJ;EACA,aAAa,EAAE,aAAa,OAAO,KAAK;CAC1C;AACF,CAAC;;AAGD,MAAM,QAAQ,gBAAgB;CAC5B,MAAM;CACN,cAAc;CACd,OAAO,EAAE,OAAO;EAAE,MAAM;EAAQ,SAAS;CAAE,EAAE;CAC7C,MAAM,OAAO,EAAE,OAAO,SAAS;EAC7B,MAAM,SAAS,MAAM,IAAI;EAEzB,MAAM,QAAQ,MAAM;EACpB,MAAM,UAAU,cAAc,sBAAsB,aAAa,OAAO,MAAM,KAAK,CAAC;EACpF,MAAM,QAAQ,cAAc,oBAAoB,eAAe,OAAO,WAAW,KAAK,CAAC;EACvF,aAAa,EAAE,SAAS,aAAa,CAAC,MAAM,UAAU,GAAG,EAAE,KAAK,CAAC,CAAC;CACpE;AACF,CAAC;AAED,MAAM,eAAe,cAAc,sBAAsB,gBAAgB,MAAM,IAAI,CAAC,CAAC,KAAK;AAmB1F,MAAa,SAAS;CACpB;CACA,OAlBY,gBAAgB;EAC5B,MAAM;EACN,cAAc;EACd,MAAM,QAAQ,EAAE,OAAO,SAAS;GAC9B,MAAM,SAAS,MAAM,IAAI;GACzB,MAAM,OAAO,WAAW,OAAO,IAAI;GACnC,MAAM,SAAS,WAAW,OAAO,MAAM;GACvC,aACE,EACE,cACA,aACM,MAAM,UAAU;IAAE,MAAM,KAAK;IAAO,QAAQ,OAAO;GAAM,CAAC,KAAK,KAAK,KAC5E;EACJ;CACF,CAIE;CACA,SAAS,cAAc,iBAAiB,aAAa,MAAM,IAAI,CAAC,CAAC,OAAO;CACxE,OAAO,cAAc,eAAe,aAAa,MAAM,IAAI,CAAC,CAAC,KAAK;CAClE,WAAW,cAAc,mBAAmB,aAAa,MAAM,IAAI,CAAC,CAAC,SAAS;CAC9E;AACF"}
|
|
1
|
+
{"version":3,"file":"slider.js","names":[],"sources":["../../../../packages/vue/src/slider.ts"],"sourcesContent":["import { within } from \"@kirana-ui/core\"\nimport type { ChangeDetails } from \"@kirana-ui/core\"\nimport { createSlider } from \"@kirana-ui/core/slider\"\nimport type { Slider as Controller, SliderProps, SliderValue } from \"@kirana-ui/core/slider\"\nimport { defineComponent, h, useId } from \"vue\"\nimport type { PropType } from \"vue\"\n\nimport { useDirectionAround } from \"./direction-context.ts\"\nimport { useFieldAround } from \"./field-context.ts\"\nimport { context, controller, fromSignal, optional, partComponent } from \"./runtime.ts\"\n\nconst scope = context<Controller>(\"Slider\")\n\nconst RootElement = partComponent(\"SliderRootElement\", \"div\", () => scope.use().root)\n\n/** `v-model:value`, or `value` with `@value-change=\"(value, details) => …\"`. */\nconst Root = defineComponent({\n name: \"SliderRoot\",\n inheritAttrs: false,\n props: {\n value: optional([Number, Array] as PropType<SliderValue>),\n defaultValue: optional([Number, Array] as PropType<SliderValue>),\n min: Number,\n max: Number,\n step: Number,\n largeStep: Number,\n minStepsBetweenValues: Number,\n thumbAlignment: String as PropType<SliderProps[\"thumbAlignment\"]>,\n orientation: String as PropType<\"horizontal\" | \"vertical\">,\n disabled: Boolean,\n name: String,\n form: String,\n format: Object as PropType<Intl.NumberFormatOptions>,\n locale: String,\n getAriaValueText: Function as PropType<SliderProps[\"getAriaValueText\"]>,\n id: String,\n },\n emits: [\"update:value\", \"valueChange\", \"valueCommitted\"],\n setup(props, { attrs, slots, emit }) {\n const generated = useId()\n const field = useFieldAround()\n scope.provide(\n controller(within(createSlider, { field, direction: useDirectionAround() }), () => ({\n ...props,\n id: props.id ?? generated,\n onValueChange(value: number | number[], details: ChangeDetails) {\n emit(\"valueChange\", value, details)\n if (!details.canceled) emit(\"update:value\", value)\n },\n onValueCommitted: (value: number | number[], details: ChangeDetails) =>\n emit(\"valueCommitted\", value, details),\n }))\n )\n return () => h(RootElement, attrs, slots)\n },\n})\n\n/** `index` is which value of a range the thumb is, from 0. */\nconst Thumb = defineComponent({\n name: \"SliderThumb\",\n inheritAttrs: false,\n props: { index: { type: Number, default: 0 } },\n setup(props, { attrs, slots }) {\n const slider = scope.use()\n // A thumb is its index for as long as it is in the page.\n const index = props.index\n const Element = partComponent(\"SliderThumbElement\", \"div\", () => slider.thumb(index))\n const Input = partComponent(\"SliderThumbInput\", \"input\", () => slider.thumbInput(index))\n return () => h(Element, attrs, () => [slots.default?.(), h(Input)])\n },\n})\n\nconst ValueElement = partComponent(\"SliderValueElement\", \"output\", () => scope.use().value)\n\n/** The written value, or what its slot makes of it (`v-slot=\"{ text, values }\"`). */\nconst Value = defineComponent({\n name: \"SliderValue\",\n inheritAttrs: false,\n setup(_props, { attrs, slots }) {\n const slider = scope.use()\n const text = fromSignal(slider.text)\n const values = fromSignal(slider.values)\n return () =>\n h(\n ValueElement,\n attrs,\n () => slots.default?.({ text: text.value, values: values.value }) ?? text.value\n )\n },\n})\n\nexport const Slider = {\n Root,\n Value,\n Control: partComponent(\"SliderControl\", \"div\", () => scope.use().control),\n Track: partComponent(\"SliderTrack\", \"div\", () => scope.use().track),\n Indicator: partComponent(\"SliderIndicator\", \"div\", () => scope.use().indicator),\n Thumb,\n}\n"],"mappings":";;;;;;;AAWA,MAAM,QAAQ,QAAoB,QAAQ;AAE1C,MAAM,cAAc,cAAc,qBAAqB,aAAa,MAAM,IAAI,CAAC,CAAC,IAAI;;AAGpF,MAAM,OAAO,gBAAgB;CAC3B,MAAM;CACN,cAAc;CACd,OAAO;EACL,OAAO,SAAS,CAAC,QAAQ,KAAK,CAA0B;EACxD,cAAc,SAAS,CAAC,QAAQ,KAAK,CAA0B;EAC/D,KAAK;EACL,KAAK;EACL,MAAM;EACN,WAAW;EACX,uBAAuB;EACvB,gBAAgB;EAChB,aAAa;EACb,UAAU;EACV,MAAM;EACN,MAAM;EACN,QAAQ;EACR,QAAQ;EACR,kBAAkB;EAClB,IAAI;CACN;CACA,OAAO;EAAC;EAAgB;EAAe;CAAgB;CACvD,MAAM,OAAO,EAAE,OAAO,OAAO,QAAQ;EACnC,MAAM,YAAY,MAAM;EACxB,MAAM,QAAQ,eAAe;EAC7B,MAAM,QACJ,WAAW,OAAO,cAAc;GAAE;GAAO,WAAW,mBAAmB;EAAE,CAAC,UAAU;GAClF,GAAG;GACH,IAAI,MAAM,MAAM;GAChB,cAAc,OAA0B,SAAwB;IAC9D,KAAK,eAAe,OAAO,OAAO;IAClC,IAAI,CAAC,QAAQ,UAAU,KAAK,gBAAgB,KAAK;GACnD;GACA,mBAAmB,OAA0B,YAC3C,KAAK,kBAAkB,OAAO,OAAO;EACzC,EAAE,CACJ;EACA,aAAa,EAAE,aAAa,OAAO,KAAK;CAC1C;AACF,CAAC;;AAGD,MAAM,QAAQ,gBAAgB;CAC5B,MAAM;CACN,cAAc;CACd,OAAO,EAAE,OAAO;EAAE,MAAM;EAAQ,SAAS;CAAE,EAAE;CAC7C,MAAM,OAAO,EAAE,OAAO,SAAS;EAC7B,MAAM,SAAS,MAAM,IAAI;EAEzB,MAAM,QAAQ,MAAM;EACpB,MAAM,UAAU,cAAc,sBAAsB,aAAa,OAAO,MAAM,KAAK,CAAC;EACpF,MAAM,QAAQ,cAAc,oBAAoB,eAAe,OAAO,WAAW,KAAK,CAAC;EACvF,aAAa,EAAE,SAAS,aAAa,CAAC,MAAM,UAAU,GAAG,EAAE,KAAK,CAAC,CAAC;CACpE;AACF,CAAC;AAED,MAAM,eAAe,cAAc,sBAAsB,gBAAgB,MAAM,IAAI,CAAC,CAAC,KAAK;AAmB1F,MAAa,SAAS;CACpB;CACA,OAlBY,gBAAgB;EAC5B,MAAM;EACN,cAAc;EACd,MAAM,QAAQ,EAAE,OAAO,SAAS;GAC9B,MAAM,SAAS,MAAM,IAAI;GACzB,MAAM,OAAO,WAAW,OAAO,IAAI;GACnC,MAAM,SAAS,WAAW,OAAO,MAAM;GACvC,aACE,EACE,cACA,aACM,MAAM,UAAU;IAAE,MAAM,KAAK;IAAO,QAAQ,OAAO;GAAM,CAAC,KAAK,KAAK,KAC5E;EACJ;CACF,CAIE;CACA,SAAS,cAAc,iBAAiB,aAAa,MAAM,IAAI,CAAC,CAAC,OAAO;CACxE,OAAO,cAAc,eAAe,aAAa,MAAM,IAAI,CAAC,CAAC,KAAK;CAClE,WAAW,cAAc,mBAAmB,aAAa,MAAM,IAAI,CAAC,CAAC,SAAS;CAC9E;AACF"}
|
package/src/switch.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export declare const Switch: {
|
|
|
9
9
|
readOnly: BooleanConstructor;
|
|
10
10
|
required: BooleanConstructor;
|
|
11
11
|
name: StringConstructor;
|
|
12
|
+
form: StringConstructor;
|
|
12
13
|
value: StringConstructor;
|
|
13
14
|
id: StringConstructor;
|
|
14
15
|
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
@@ -23,6 +24,7 @@ export declare const Switch: {
|
|
|
23
24
|
readOnly: BooleanConstructor;
|
|
24
25
|
required: BooleanConstructor;
|
|
25
26
|
name: StringConstructor;
|
|
27
|
+
form: StringConstructor;
|
|
26
28
|
value: StringConstructor;
|
|
27
29
|
id: StringConstructor;
|
|
28
30
|
}>> & Readonly<{
|
package/src/switch.js
CHANGED
|
@@ -18,6 +18,7 @@ const Switch = {
|
|
|
18
18
|
readOnly: Boolean,
|
|
19
19
|
required: Boolean,
|
|
20
20
|
name: String,
|
|
21
|
+
form: String,
|
|
21
22
|
value: String,
|
|
22
23
|
id: String
|
|
23
24
|
},
|
|
@@ -33,6 +34,7 @@ const Switch = {
|
|
|
33
34
|
readOnly: props.readOnly,
|
|
34
35
|
required: props.required,
|
|
35
36
|
name: props.name,
|
|
37
|
+
form: props.form,
|
|
36
38
|
value: props.value,
|
|
37
39
|
onCheckedChange(checked, details) {
|
|
38
40
|
emit("checkedChange", checked, details);
|
package/src/switch.js.map
CHANGED
|
@@ -1 +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;
|
|
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 form: 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 form: props.form,\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;AA0C3E,MAAa,SAAS;CACpB,MAxCW,gBAAgB;EAC3B,MAAM;EACN,cAAc;EACd,OAAO;GACL,SAAS,SAAS,OAAO;GACzB,gBAAgB;GAChB,UAAU;GACV,UAAU;GACV,UAAU;GACV,MAAM;GACN,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,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/toast.d.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { PropType } from "vue";
|
|
2
|
+
import { ToastOptions, ToastProps, ToastRecord, ToastRecord as ToastRecord$1, Toaster, Toaster as Toaster$1, createToaster } from "@kirana-ui/core/toast";
|
|
3
|
+
export declare const Toast: {
|
|
4
|
+
Viewport: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
5
|
+
toaster: {
|
|
6
|
+
type: PropType<Toaster$1>;
|
|
7
|
+
required: true;
|
|
8
|
+
};
|
|
9
|
+
label: StringConstructor;
|
|
10
|
+
hotkey: StringConstructor;
|
|
11
|
+
swipeDirection: PropType<ToastProps["swipeDirection"]>;
|
|
12
|
+
id: StringConstructor;
|
|
13
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
14
|
+
[key: string]: any;
|
|
15
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
16
|
+
toaster: {
|
|
17
|
+
type: PropType<Toaster$1>;
|
|
18
|
+
required: true;
|
|
19
|
+
};
|
|
20
|
+
label: StringConstructor;
|
|
21
|
+
hotkey: StringConstructor;
|
|
22
|
+
swipeDirection: PropType<ToastProps["swipeDirection"]>;
|
|
23
|
+
id: StringConstructor;
|
|
24
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
25
|
+
List: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
26
|
+
[key: string]: any;
|
|
27
|
+
}>[], {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
28
|
+
Root: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
29
|
+
toast: {
|
|
30
|
+
type: PropType<ToastRecord$1>;
|
|
31
|
+
required: true;
|
|
32
|
+
};
|
|
33
|
+
}>, () => 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<import("vue").ExtractPropTypes<{
|
|
36
|
+
toast: {
|
|
37
|
+
type: PropType<ToastRecord$1>;
|
|
38
|
+
required: true;
|
|
39
|
+
};
|
|
40
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
41
|
+
Content: import("vue").Component;
|
|
42
|
+
Title: import("vue").Component;
|
|
43
|
+
Description: import("vue").Component;
|
|
44
|
+
Close: import("vue").Component;
|
|
45
|
+
Action: import("vue").Component;
|
|
46
|
+
};
|
|
47
|
+
export { type ToastOptions, type ToastRecord, type Toaster, createToaster };
|
|
48
|
+
//# sourceMappingURL=toast.d.ts.map
|
package/src/toast.js
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { context, controller, fromSignal, partComponent } from "./runtime.js";
|
|
2
|
+
import { Fragment, defineComponent, h, useId } from "vue";
|
|
3
|
+
import { createToast, createToaster } from "@kirana-ui/core/toast";
|
|
4
|
+
// src/toast.ts
|
|
5
|
+
const scope = context("Toast");
|
|
6
|
+
const toastScope = context("Toast.Root");
|
|
7
|
+
const ViewportElement = partComponent("ToastViewportElement", "div", () => scope.use().viewport);
|
|
8
|
+
/** Where a toaster's toasts are drawn. Always in the page: put it once, near the root. */
|
|
9
|
+
const Viewport = defineComponent({
|
|
10
|
+
name: "ToastViewport",
|
|
11
|
+
inheritAttrs: false,
|
|
12
|
+
props: {
|
|
13
|
+
toaster: {
|
|
14
|
+
type: Object,
|
|
15
|
+
required: true
|
|
16
|
+
},
|
|
17
|
+
label: String,
|
|
18
|
+
hotkey: String,
|
|
19
|
+
swipeDirection: String,
|
|
20
|
+
id: String
|
|
21
|
+
},
|
|
22
|
+
setup(props, { attrs, slots }) {
|
|
23
|
+
const generated = useId();
|
|
24
|
+
scope.provide(controller(createToast, () => ({
|
|
25
|
+
id: props.id ?? generated,
|
|
26
|
+
toaster: props.toaster,
|
|
27
|
+
label: props.label,
|
|
28
|
+
hotkey: props.hotkey,
|
|
29
|
+
swipeDirection: props.swipeDirection
|
|
30
|
+
})));
|
|
31
|
+
return () => h(ViewportElement, attrs, slots);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
/** Draws its slot once for each toast, the newest first: `v-slot="{ toast }"`. */
|
|
35
|
+
const List = defineComponent({
|
|
36
|
+
name: "ToastList",
|
|
37
|
+
setup(_, { slots }) {
|
|
38
|
+
const toasts = fromSignal(scope.use().toasts);
|
|
39
|
+
return () => toasts.value.map((toast) => h(Fragment, { key: toast.id }, slots.default?.({ toast })));
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
const RootElement = partComponent("ToastRootElement", "div", () => toastScope.use().root);
|
|
43
|
+
const Toast = {
|
|
44
|
+
Viewport,
|
|
45
|
+
List,
|
|
46
|
+
Root: defineComponent({
|
|
47
|
+
name: "ToastRoot",
|
|
48
|
+
inheritAttrs: false,
|
|
49
|
+
props: { toast: {
|
|
50
|
+
type: Object,
|
|
51
|
+
required: true
|
|
52
|
+
} },
|
|
53
|
+
setup(props, { attrs, slots }) {
|
|
54
|
+
toastScope.provide(scope.use().toast(props.toast.id));
|
|
55
|
+
return () => h(RootElement, attrs, slots);
|
|
56
|
+
}
|
|
57
|
+
}),
|
|
58
|
+
Content: partComponent("ToastContent", "div", () => toastScope.use().content),
|
|
59
|
+
Title: partComponent("ToastTitle", "div", () => toastScope.use().title),
|
|
60
|
+
Description: partComponent("ToastDescription", "div", () => toastScope.use().description),
|
|
61
|
+
Close: partComponent("ToastClose", "button", () => toastScope.use().close),
|
|
62
|
+
Action: partComponent("ToastAction", "button", () => toastScope.use().action)
|
|
63
|
+
};
|
|
64
|
+
export { Toast, createToaster };
|
|
65
|
+
|
|
66
|
+
//# sourceMappingURL=toast.js.map
|
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
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
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
|
+
*/
|
|
2
6
|
export declare const Toggle: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
3
7
|
pressed: {
|
|
4
8
|
type: BooleanConstructor;
|
|
@@ -6,6 +10,10 @@ export declare const Toggle: import("vue").DefineComponent<import("vue").Extract
|
|
|
6
10
|
};
|
|
7
11
|
defaultPressed: BooleanConstructor;
|
|
8
12
|
disabled: BooleanConstructor;
|
|
13
|
+
value: {
|
|
14
|
+
type: PropType<unknown>;
|
|
15
|
+
default: unknown;
|
|
16
|
+
};
|
|
9
17
|
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
10
18
|
[key: string]: any;
|
|
11
19
|
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("pressedChange" | "update:pressed")[], "pressedChange" | "update:pressed", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
@@ -15,6 +23,10 @@ export declare const Toggle: import("vue").DefineComponent<import("vue").Extract
|
|
|
15
23
|
};
|
|
16
24
|
defaultPressed: BooleanConstructor;
|
|
17
25
|
disabled: BooleanConstructor;
|
|
26
|
+
value: {
|
|
27
|
+
type: PropType<unknown>;
|
|
28
|
+
default: unknown;
|
|
29
|
+
};
|
|
18
30
|
}>> & Readonly<{
|
|
19
31
|
onPressedChange?: ((...args: any[]) => any) | undefined;
|
|
20
32
|
"onUpdate:pressed"?: ((...args: any[]) => any) | undefined;
|
|
@@ -22,5 +34,6 @@ export declare const Toggle: import("vue").DefineComponent<import("vue").Extract
|
|
|
22
34
|
pressed: boolean;
|
|
23
35
|
defaultPressed: boolean;
|
|
24
36
|
disabled: boolean;
|
|
37
|
+
value: unknown;
|
|
25
38
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
26
39
|
//# sourceMappingURL=toggle.d.ts.map
|
package/src/toggle.js
CHANGED
|
@@ -1,22 +1,37 @@
|
|
|
1
1
|
import { controller, optional, partComponent } from "./runtime.js";
|
|
2
|
-
import {
|
|
2
|
+
import { TOGGLE_GROUP, TOOLBAR } from "./toolbar-context.js";
|
|
3
|
+
import { within } from "@kirana-ui/core";
|
|
4
|
+
import { defineComponent, h, inject } from "vue";
|
|
3
5
|
import { createToggle } from "@kirana-ui/core/toggle";
|
|
4
6
|
// src/toggle.ts
|
|
5
|
-
/**
|
|
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
|
+
*/
|
|
6
11
|
const Toggle = defineComponent({
|
|
7
12
|
name: "Toggle",
|
|
8
13
|
inheritAttrs: false,
|
|
9
14
|
props: {
|
|
10
15
|
pressed: optional(Boolean),
|
|
11
16
|
defaultPressed: Boolean,
|
|
12
|
-
disabled: Boolean
|
|
17
|
+
disabled: Boolean,
|
|
18
|
+
value: {
|
|
19
|
+
type: null,
|
|
20
|
+
default: void 0
|
|
21
|
+
}
|
|
13
22
|
},
|
|
14
23
|
emits: ["update:pressed", "pressedChange"],
|
|
15
24
|
setup(props, { attrs, slots, emit }) {
|
|
16
|
-
const
|
|
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
|
+
}), () => ({
|
|
17
31
|
pressed: props.pressed,
|
|
18
32
|
defaultPressed: props.defaultPressed,
|
|
19
33
|
disabled: props.disabled,
|
|
34
|
+
value: props.value,
|
|
20
35
|
onPressedChange(pressed, details) {
|
|
21
36
|
emit("pressedChange", pressed, details);
|
|
22
37
|
if (!details.canceled) emit("update:pressed", pressed);
|
package/src/toggle.js.map
CHANGED
|
@@ -1 +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
|
|
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
CHANGED
|
@@ -29,7 +29,15 @@ export declare const Tooltip: {
|
|
|
29
29
|
defaultOpen: boolean;
|
|
30
30
|
disabled: boolean;
|
|
31
31
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
32
|
-
Trigger: import("vue").
|
|
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>;
|
|
33
41
|
Portal: import("vue").Component;
|
|
34
42
|
Positioner: import("vue").Component;
|
|
35
43
|
Popup: import("vue").Component;
|