@kirana-ui/vue 0.1.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. package/llms.txt +1867 -268
  2. package/package.json +18 -2
  3. package/skills/kirana-ui-primitives/SKILL.md +163 -0
  4. package/src/accordion.d.ts +42 -75
  5. package/src/accordion.js +4 -2
  6. package/src/accordion.js.map +1 -1
  7. package/src/agent.d.ts +1 -0
  8. package/src/agent.js +1 -0
  9. package/src/alert-dialog.d.ts +3 -2
  10. package/src/autocomplete.d.ts +4 -2
  11. package/src/autosize.d.ts +9 -9
  12. package/src/autosize.js.map +1 -1
  13. package/src/avatar.d.ts +37 -13
  14. package/src/avatar.js +39 -15
  15. package/src/avatar.js.map +1 -1
  16. package/src/button.d.ts +4 -21
  17. package/src/button.js.map +1 -1
  18. package/src/calendar.d.ts +71 -99
  19. package/src/calendar.js +81 -11
  20. package/src/calendar.js.map +1 -1
  21. package/src/carousel.d.ts +36 -58
  22. package/src/carousel.js.map +1 -1
  23. package/src/checkbox-group-context.d.ts +5 -0
  24. package/src/checkbox-group-context.js +6 -0
  25. package/src/checkbox-group-context.js.map +1 -0
  26. package/src/checkbox-group.d.ts +12 -0
  27. package/src/checkbox-group.js +44 -0
  28. package/src/checkbox-group.js.map +1 -0
  29. package/src/checkbox.d.ts +29 -50
  30. package/src/checkbox.js +11 -4
  31. package/src/checkbox.js.map +1 -1
  32. package/src/collapsible.d.ts +26 -36
  33. package/src/collapsible.js.map +1 -1
  34. package/src/combobox.d.ts +161 -290
  35. package/src/combobox.js +62 -4
  36. package/src/combobox.js.map +1 -1
  37. package/src/command.d.ts +43 -86
  38. package/src/command.js +2 -0
  39. package/src/command.js.map +1 -1
  40. package/src/context-menu.d.ts +4 -2
  41. package/src/date-field.d.ts +31 -61
  42. package/src/date-field.js +7 -3
  43. package/src/date-field.js.map +1 -1
  44. package/src/date-picker.d.ts +86 -139
  45. package/src/date-picker.js +12 -1
  46. package/src/date-picker.js.map +1 -1
  47. package/src/dialog.d.ts +93 -145
  48. package/src/dialog.js +7 -2
  49. package/src/dialog.js.map +1 -1
  50. package/src/direction.d.ts +5 -8
  51. package/src/direction.js.map +1 -1
  52. package/src/drawer.d.ts +3 -2
  53. package/src/element.d.ts +23 -0
  54. package/src/element.js +90 -0
  55. package/src/element.js.map +1 -0
  56. package/src/field.d.ts +63 -45
  57. package/src/field.js +3 -2
  58. package/src/field.js.map +1 -1
  59. package/src/fieldset.d.ts +12 -13
  60. package/src/fieldset.js.map +1 -1
  61. package/src/form.d.ts +5 -15
  62. package/src/form.js.map +1 -1
  63. package/src/hover-card.d.ts +29 -43
  64. package/src/hover-card.js.map +1 -1
  65. package/src/hover-popup.d.ts +27 -46
  66. package/src/hover-popup.js +4 -1
  67. package/src/hover-popup.js.map +1 -1
  68. package/src/index.d.ts +16 -3
  69. package/src/index.js +2 -1
  70. package/src/input.d.ts +12 -14
  71. package/src/input.js.map +1 -1
  72. package/src/label.d.ts +3 -3
  73. package/src/label.js.map +1 -1
  74. package/src/listbox.d.ts +34 -89
  75. package/src/listbox.js.map +1 -1
  76. package/src/menu.d.ts +170 -533
  77. package/src/menu.js.map +1 -1
  78. package/src/menubar.d.ts +6 -24
  79. package/src/menubar.js.map +1 -1
  80. package/src/message-scroller.d.ts +23 -17
  81. package/src/message-scroller.js.map +1 -1
  82. package/src/meter.d.ts +10 -31
  83. package/src/meter.js.map +1 -1
  84. package/src/navigation-menu.d.ts +77 -88
  85. package/src/navigation-menu.js +13 -12
  86. package/src/navigation-menu.js.map +1 -1
  87. package/src/number-field.d.ts +104 -68
  88. package/src/number-field.js +98 -68
  89. package/src/number-field.js.map +1 -1
  90. package/src/otp.d.ts +33 -54
  91. package/src/otp.js +4 -2
  92. package/src/otp.js.map +1 -1
  93. package/src/pagination.d.ts +31 -58
  94. package/src/pagination.js.map +1 -1
  95. package/src/popover.d.ts +83 -36
  96. package/src/popover.js +68 -8
  97. package/src/popover.js.map +1 -1
  98. package/src/primitive.d.ts +21 -0
  99. package/src/primitive.js +27 -0
  100. package/src/primitive.js.map +1 -0
  101. package/src/progress.d.ts +28 -31
  102. package/src/progress.js.map +1 -1
  103. package/src/qr-code.d.ts +12 -21
  104. package/src/qr-code.js.map +1 -1
  105. package/src/radio-group.d.ts +37 -75
  106. package/src/radio-group.js +8 -4
  107. package/src/radio-group.js.map +1 -1
  108. package/src/resizable.d.ts +26 -45
  109. package/src/resizable.js.map +1 -1
  110. package/src/runtime.d.ts +93 -21
  111. package/src/runtime.js +24 -25
  112. package/src/runtime.js.map +1 -1
  113. package/src/scroll-area.d.ts +33 -28
  114. package/src/scroll-area.js.map +1 -1
  115. package/src/select.d.ts +88 -147
  116. package/src/select.js +33 -6
  117. package/src/select.js.map +1 -1
  118. package/src/separator.d.ts +4 -9
  119. package/src/separator.js.map +1 -1
  120. package/src/slider.d.ts +66 -80
  121. package/src/slider.js +11 -10
  122. package/src/slider.js.map +1 -1
  123. package/src/switch.d.ts +21 -39
  124. package/src/switch.js +2 -2
  125. package/src/switch.js.map +1 -1
  126. package/src/tabs.d.ts +44 -98
  127. package/src/tabs.js.map +1 -1
  128. package/src/testing.d.ts +1 -0
  129. package/src/testing.js +1 -0
  130. package/src/toast.d.ts +58 -45
  131. package/src/toast.js +46 -17
  132. package/src/toast.js.map +1 -1
  133. package/src/toggle-group.d.ts +8 -39
  134. package/src/toggle-group.js.map +1 -1
  135. package/src/toggle.d.ts +5 -34
  136. package/src/toggle.js.map +1 -1
  137. package/src/toolbar.d.ts +31 -69
  138. package/src/toolbar.js.map +1 -1
  139. package/src/tooltip.d.ts +29 -43
  140. package/src/tooltip.js.map +1 -1
  141. package/src/value-bar.d.ts +26 -35
  142. package/src/value-bar.js +10 -3
  143. package/src/value-bar.js.map +1 -1
package/src/button.d.ts CHANGED
@@ -1,23 +1,6 @@
1
+ import { PartComponent, PartComponentProps, StatesOf } from "./runtime.js";
2
+ import { ButtonProps as ButtonProps$1 } from "@kirana-ui/core/button";
3
+ export interface ButtonProps extends ButtonProps$1, PartComponentProps {}
1
4
  /** A `<button>`, or with `as` and `:native-button="false"` another element that acts as one. */
2
- export declare const Button: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
3
- disabled: BooleanConstructor;
4
- focusableWhenDisabled: BooleanConstructor;
5
- nativeButton: {
6
- type: BooleanConstructor;
7
- default: undefined;
8
- };
9
- }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
10
- [key: string]: any;
11
- }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
12
- disabled: BooleanConstructor;
13
- focusableWhenDisabled: BooleanConstructor;
14
- nativeButton: {
15
- type: BooleanConstructor;
16
- default: undefined;
17
- };
18
- }>> & Readonly<{}>, {
19
- disabled: boolean;
20
- focusableWhenDisabled: boolean;
21
- nativeButton: boolean;
22
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
5
+ export declare const Button: PartComponent<"button", StatesOf<"button">["root"], ButtonProps>;
23
6
  //# sourceMappingURL=button.d.ts.map
package/src/button.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"button.js","names":[],"sources":["../../../../packages/vue/src/button.ts"],"sourcesContent":["import { createButton } from \"@kirana-ui/core/button\"\nimport { defineComponent, h } from \"vue\"\n\nimport { controller, optional, partComponent } from \"./runtime.ts\"\n\n/** A `<button>`, or with `as` and `:native-button=\"false\"` another element that acts as one. */\nexport const Button = defineComponent({\n name: \"Button\",\n inheritAttrs: false,\n props: {\n disabled: Boolean,\n focusableWhenDisabled: Boolean,\n nativeButton: optional(Boolean),\n },\n setup(props, { attrs, slots }) {\n const made = controller(createButton, () => ({ ...props }))\n const Element = partComponent(\"ButtonElement\", \"button\", () => made.root)\n return () => h(Element, attrs, slots)\n },\n})\n"],"mappings":";;;;;AAMA,MAAa,SAAS,gBAAgB;CACpC,MAAM;CACN,cAAc;CACd,OAAO;EACL,UAAU;EACV,uBAAuB;EACvB,cAAc,SAAS,OAAO;CAChC;CACA,MAAM,OAAO,EAAE,OAAO,SAAS;EAC7B,MAAM,OAAO,WAAW,qBAAqB,EAAE,GAAG,MAAM,EAAE;EAC1D,MAAM,UAAU,cAAc,iBAAiB,gBAAgB,KAAK,IAAI;EACxE,aAAa,EAAE,SAAS,OAAO,KAAK;CACtC;AACF,CAAC"}
1
+ {"version":3,"file":"button.js","names":[],"sources":["../../../../packages/vue/src/button.ts"],"sourcesContent":["import { createButton } from \"@kirana-ui/core/button\"\nimport type { ButtonProps as CoreProps } from \"@kirana-ui/core/button\"\nimport { defineComponent, h } from \"vue\"\n\nimport { controller, optional, partComponent } from \"./runtime.ts\"\nimport type { PartComponent, PartComponentProps, StatesOf } from \"./runtime.ts\"\n\nexport interface ButtonProps extends CoreProps, PartComponentProps {}\n\n/** A `<button>`, or with `as` and `:native-button=\"false\"` another element that acts as one. */\nexport const Button = defineComponent({\n name: \"Button\",\n inheritAttrs: false,\n props: {\n disabled: Boolean,\n focusableWhenDisabled: Boolean,\n nativeButton: optional(Boolean),\n },\n setup(props, { attrs, slots }) {\n const made = controller(createButton, () => ({ ...props }))\n const Element = partComponent(\"ButtonElement\", \"button\", () => made.root)\n return () => h(Element, attrs, slots)\n },\n}) as unknown as PartComponent<\"button\", StatesOf<\"button\">[\"root\"], ButtonProps>\n"],"mappings":";;;;;AAUA,MAAa,SAAS,gBAAgB;CACpC,MAAM;CACN,cAAc;CACd,OAAO;EACL,UAAU;EACV,uBAAuB;EACvB,cAAc,SAAS,OAAO;CAChC;CACA,MAAM,OAAO,EAAE,OAAO,SAAS;EAC7B,MAAM,OAAO,WAAW,qBAAqB,EAAE,GAAG,MAAM,EAAE;EAC1D,MAAM,UAAU,cAAc,iBAAiB,gBAAgB,KAAK,IAAI;EACxE,aAAa,EAAE,SAAS,OAAO,KAAK;CACtC;AACF,CAAC"}
package/src/calendar.d.ts CHANGED
@@ -1,107 +1,79 @@
1
- import { PropType } from "vue";
2
- import { Calendar as Calendar$1, CalendarProps, CalendarValue, CalendarWeekday } from "@kirana-ui/core/calendar";
1
+ import { Changes, PartComponent, PartComponentProps, PartGiven, PartInstance, PlainComponent, StatesOf } from "./runtime.js";
2
+ import { PublicProps } from "vue";
3
+ import { Calendar as Calendar$1, CalendarDay, CalendarMode, CalendarMonth, CalendarProps, CalendarValueOf, CalendarWeekday } from "@kirana-ui/core/calendar";
4
+ type State = StatesOf<"calendar">;
5
+ /**
6
+ * The calendar its parts are inside. Exported for a component that is made of one (a date picker
7
+ * provides its own to the calendar's parts).
8
+ */
3
9
  declare const scope: {
4
10
  provide(controller: Calendar$1): Calendar$1;
5
11
  use(): Calendar$1;
6
12
  };
13
+ /** `value` and its events are typed by `mode`: a day, a range, or a list of days. */
14
+ export type RootProps<Mode extends CalendarMode = "single"> = Omit<CalendarProps<Mode>, "id" | "onValueChange" | "onMonthChange"> & {
15
+ id?: string | undefined;
16
+ } & PartComponentProps;
17
+ export type RootEmits<Mode extends CalendarMode = "single"> = Changes<"value", CalendarValueOf<Mode>> & Changes<"month", string>;
18
+ export type HeadingProps = PartComponentProps;
19
+ export type WeekdaysProps = Record<never, never>;
20
+ export type MonthsProps = Record<never, never>;
21
+ export type WeeksProps = Record<never, never>;
22
+ export interface HeadCellProps extends PartComponentProps {
23
+ /** The day of the week it names, as `Calendar.Weekdays` gives it. */
24
+ weekday: CalendarWeekday;
25
+ }
26
+ export interface CellProps extends PartComponentProps {
27
+ /** The day it is for, as a week of `Calendar.Weeks` gives it. */
28
+ date: string;
29
+ }
30
+ export type DayProps = CellProps;
31
+ export type PreviousProps = PartComponentProps;
32
+ export type NextProps = PartComponentProps;
33
+ export type GridProps = PartComponentProps;
34
+ export type InputProps = PartComponentProps;
7
35
  export declare const Calendar: {
8
- Root: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
9
- value: {
10
- type: PropType<CalendarValue>;
11
- default: undefined;
12
- };
13
- defaultValue: PropType<CalendarValue>;
14
- mode: PropType<"single" | "range">;
15
- defaultFocusedValue: StringConstructor;
16
- locale: StringConstructor;
17
- calendarSystem: PropType<CalendarProps["calendarSystem"]>;
18
- min: StringConstructor;
19
- max: StringConstructor;
20
- isDateUnavailable: PropType<(date: string) => boolean>;
21
- disabled: BooleanConstructor;
22
- readOnly: BooleanConstructor;
23
- fixedWeeks: BooleanConstructor;
24
- id: StringConstructor;
25
- }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
26
- [key: string]: any;
27
- }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("monthChange" | "update:value" | "valueChange")[], "monthChange" | "update:value" | "valueChange", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
28
- value: {
29
- type: PropType<CalendarValue>;
30
- default: undefined;
31
- };
32
- defaultValue: PropType<CalendarValue>;
33
- mode: PropType<"single" | "range">;
34
- defaultFocusedValue: StringConstructor;
35
- locale: StringConstructor;
36
- calendarSystem: PropType<CalendarProps["calendarSystem"]>;
37
- min: StringConstructor;
38
- max: StringConstructor;
39
- isDateUnavailable: PropType<(date: string) => boolean>;
40
- disabled: BooleanConstructor;
41
- readOnly: BooleanConstructor;
42
- fixedWeeks: BooleanConstructor;
43
- id: StringConstructor;
44
- }>> & Readonly<{
45
- onMonthChange?: ((...args: any[]) => any) | undefined;
46
- "onUpdate:value"?: ((...args: any[]) => any) | undefined;
47
- onValueChange?: ((...args: any[]) => any) | undefined;
48
- }>, {
49
- value: CalendarValue;
50
- disabled: boolean;
51
- readOnly: boolean;
52
- fixedWeeks: boolean;
53
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
54
- Heading: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
55
- [key: string]: any;
56
- }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
57
- Previous: import("vue").Component;
58
- Next: import("vue").Component;
59
- Grid: import("vue").Component;
60
- Weekdays: import("vue").DefineComponent<{}, () => 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<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
63
- HeadCell: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
64
- weekday: {
65
- type: PropType<CalendarWeekday>;
66
- required: true;
67
- };
68
- }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
69
- [key: string]: any;
70
- }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
71
- weekday: {
72
- type: PropType<CalendarWeekday>;
73
- required: true;
74
- };
75
- }>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
76
- Weeks: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
77
- [key: string]: any;
78
- }>[], {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
79
- Cell: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
80
- date: {
81
- type: StringConstructor;
82
- required: true;
83
- };
84
- }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
85
- [key: string]: any;
86
- }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
87
- date: {
88
- type: StringConstructor;
89
- required: true;
90
- };
91
- }>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
92
- Day: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
93
- date: {
94
- type: StringConstructor;
95
- required: true;
96
- };
97
- }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
98
- [key: string]: any;
99
- }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
100
- date: {
101
- type: StringConstructor;
102
- required: true;
103
- };
104
- }>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
36
+ Root: new <Mode extends CalendarMode = "single", As extends string = "div">(props: PartGiven<As, RootProps<Mode>, RootEmits<Mode>> & PublicProps) => PartInstance<As, RootProps<Mode>, RootEmits<Mode>, {
37
+ state: State["root"];
38
+ }>;
39
+ Heading: PartComponent<"div", Record<never, never>, PartComponentProps>;
40
+ Previous: PartComponent<"button", {
41
+ readonly disabled?: true | undefined;
42
+ }, PartComponentProps, {}, unknown>;
43
+ Next: PartComponent<"button", {
44
+ readonly disabled?: true | undefined;
45
+ }, PartComponentProps, {}, unknown>;
46
+ Months: PlainComponent<MonthsProps, {}, {
47
+ month: CalendarMonth;
48
+ }>;
49
+ Grid: PartComponent<"table", Record<never, never>, PartComponentProps, {}, unknown>;
50
+ Weekdays: PlainComponent<WeekdaysProps, {}, {
51
+ weekday: CalendarWeekday;
52
+ }>;
53
+ HeadCell: PartComponent<"th", Record<never, never>, HeadCellProps>;
54
+ Weeks: PlainComponent<WeeksProps, {}, {
55
+ week: readonly CalendarDay[];
56
+ }>;
57
+ Cell: PartComponent<"td", {
58
+ readonly selected?: true | undefined;
59
+ readonly today?: true | undefined;
60
+ readonly outsideMonth?: true | undefined;
61
+ readonly disabled?: true | undefined;
62
+ readonly unavailable?: true | undefined;
63
+ readonly rangeStart?: true | undefined;
64
+ readonly rangeEnd?: true | undefined;
65
+ }, CellProps>;
66
+ Day: PartComponent<"button", {
67
+ readonly selected?: true | undefined;
68
+ readonly today?: true | undefined;
69
+ readonly outsideMonth?: true | undefined;
70
+ readonly disabled?: true | undefined;
71
+ readonly unavailable?: true | undefined;
72
+ readonly rangeStart?: true | undefined;
73
+ readonly rangeEnd?: true | undefined;
74
+ }, CellProps>;
75
+ /** The hidden input the value is submitted by, when the root has a `name`. */
76
+ Input: PartComponent<"input", Record<never, never>, PartComponentProps, {}, unknown>;
105
77
  };
106
78
  export { scope as calendarScope };
107
79
  //# sourceMappingURL=calendar.d.ts.map
package/src/calendar.js CHANGED
@@ -1,19 +1,45 @@
1
1
  import { useDirectionAround } from "./direction-context.js";
2
+ import { written } from "./element.js";
2
3
  import { context, controller, fromSignal, optional, partComponent } from "./runtime.js";
3
4
  import { within } from "@kirana-ui/core";
4
- import { Fragment, defineComponent, h, useId } from "vue";
5
+ import { Fragment, defineComponent, h, inject, provide, useId } from "vue";
5
6
  import { createCalendar } from "@kirana-ui/core/calendar";
6
7
  // src/calendar.ts
8
+ /**
9
+ * The calendar its parts are inside. Exported for a component that is made of one (a date picker
10
+ * provides its own to the calendar's parts).
11
+ */
7
12
  const scope = context("Calendar");
8
13
  const RootElement = partComponent("CalendarRootElement", "div", () => scope.use().root);
9
- /** `v-model:value`, `@value-change="(value, details) => …"`, `@month-change="(month) => …"`. */
14
+ /** The place of the month its parts are drawn in, inside `Calendar.Months`. */
15
+ const MONTH = Symbol("CalendarMonth");
16
+ /** The month a part is drawn in: the one `Calendar.Months` gave, or the first. */
17
+ const useMonth = () => scope.use().monthAt(inject(MONTH, 0));
18
+ /**
19
+ * `v-model:value`, `@value-change="(value, details) => …"`; `v-model:month` (the first day of
20
+ * the month shown), `@month-change="(month, details) => …"`.
21
+ */
10
22
  const Root = defineComponent({
11
23
  name: "CalendarRoot",
12
24
  inheritAttrs: false,
13
25
  props: {
14
- value: optional([String, Object]),
15
- defaultValue: [String, Object],
26
+ value: optional([
27
+ String,
28
+ Object,
29
+ Array
30
+ ]),
31
+ defaultValue: [
32
+ String,
33
+ Object,
34
+ Array
35
+ ],
16
36
  mode: String,
37
+ minDays: Number,
38
+ maxDays: Number,
39
+ months: Number,
40
+ pagedNavigation: Boolean,
41
+ month: optional(String),
42
+ defaultMonth: String,
17
43
  defaultFocusedValue: String,
18
44
  locale: String,
19
45
  calendarSystem: Object,
@@ -23,11 +49,14 @@ const Root = defineComponent({
23
49
  disabled: Boolean,
24
50
  readOnly: Boolean,
25
51
  fixedWeeks: Boolean,
52
+ name: String,
53
+ form: String,
26
54
  id: String
27
55
  },
28
56
  emits: [
29
57
  "update:value",
30
58
  "valueChange",
59
+ "update:month",
31
60
  "monthChange"
32
61
  ],
33
62
  setup(props, { attrs, slots, emit }) {
@@ -38,6 +67,12 @@ const Root = defineComponent({
38
67
  value: props.value,
39
68
  defaultValue: props.defaultValue,
40
69
  mode: props.mode,
70
+ minDays: props.minDays,
71
+ maxDays: props.maxDays,
72
+ months: props.months,
73
+ pagedNavigation: props.pagedNavigation,
74
+ month: props.month,
75
+ defaultMonth: props.defaultMonth,
41
76
  defaultFocusedValue: props.defaultFocusedValue,
42
77
  locale: props.locale,
43
78
  calendarSystem: props.calendarSystem,
@@ -47,22 +82,28 @@ const Root = defineComponent({
47
82
  disabled: props.disabled,
48
83
  readOnly: props.readOnly,
49
84
  fixedWeeks: props.fixedWeeks,
85
+ name: props.name,
86
+ form: props.form,
50
87
  onValueChange(value, details) {
51
88
  emit("valueChange", value, details);
52
89
  if (!details.canceled) emit("update:value", value);
53
90
  },
54
- onMonthChange: (month) => emit("monthChange", month)
91
+ onMonthChange(month, details) {
92
+ emit("monthChange", month, details);
93
+ if (!details.canceled) emit("update:month", month);
94
+ }
55
95
  })));
56
96
  return () => h(RootElement, attrs, slots);
57
97
  }
58
98
  });
59
- const HeadingElement = partComponent("CalendarHeadingElement", "div", () => scope.use().heading);
60
99
  /** Names the month shown, unless it is given something else to say. */
61
100
  const Heading = defineComponent({
62
101
  name: "CalendarHeading",
63
102
  inheritAttrs: false,
64
103
  setup(_, { attrs, slots }) {
65
- const title = fromSignal(scope.use().title);
104
+ const month = useMonth();
105
+ const title = fromSignal(month.title);
106
+ const HeadingElement = partComponent("CalendarHeadingElement", "div", () => month.heading, written(() => title.value));
66
107
  return () => h(HeadingElement, attrs, slots.default ?? (() => title.value));
67
108
  }
68
109
  });
@@ -74,11 +115,37 @@ const Weekdays = defineComponent({
74
115
  return () => weekdays.value.map((weekday) => h(Fragment, { key: weekday.index }, slots.default?.({ weekday })));
75
116
  }
76
117
  });
118
+ /** Holds the parts of one month: they are that month's. */
119
+ const MonthScope = defineComponent({
120
+ name: "CalendarMonthScope",
121
+ props: { index: {
122
+ type: Number,
123
+ required: true
124
+ } },
125
+ setup(props, { slots }) {
126
+ provide(MONTH, props.index);
127
+ return () => slots.default?.();
128
+ }
129
+ });
130
+ /**
131
+ * Its slot once for each month shown (`months` on the root), side by side: `v-slot="{ month }"`.
132
+ * The parts inside each are that month's. Left out for one month.
133
+ */
134
+ const Months = defineComponent({
135
+ name: "CalendarMonths",
136
+ setup(_, { slots }) {
137
+ const months = fromSignal(scope.use().months);
138
+ return () => months.value.map((month) => h(MonthScope, {
139
+ key: month.index,
140
+ index: month.index
141
+ }, () => slots.default?.({ month })));
142
+ }
143
+ });
77
144
  /** Its slot once for each week of the month shown: `v-slot="{ week }"`. */
78
145
  const Weeks = defineComponent({
79
146
  name: "CalendarWeeks",
80
147
  setup(_, { slots }) {
81
- const weeks = fromSignal(scope.use().weeks);
148
+ const weeks = fromSignal(useMonth().weeks);
82
149
  return () => weeks.value.map((week) => h(Fragment, { key: week[0].date }, slots.default?.({ week })));
83
150
  }
84
151
  });
@@ -103,7 +170,7 @@ const dated = (name, tag, member) => defineComponent({
103
170
  required: true
104
171
  } },
105
172
  setup(props, { attrs, slots }) {
106
- const part = scope.use()[member](props.date);
173
+ const part = scope.use()[member](props.date, inject(MONTH, void 0));
107
174
  const Element = partComponent(`${name}Element`, tag, () => part);
108
175
  return () => h(Element, attrs, slots);
109
176
  }
@@ -113,12 +180,15 @@ const Calendar = {
113
180
  Heading,
114
181
  Previous: partComponent("CalendarPrevious", "button", () => scope.use().previous),
115
182
  Next: partComponent("CalendarNext", "button", () => scope.use().next),
116
- Grid: partComponent("CalendarGrid", "table", () => scope.use().grid),
183
+ Months,
184
+ Grid: partComponent("CalendarGrid", "table", () => useMonth().grid),
117
185
  Weekdays,
118
186
  HeadCell,
119
187
  Weeks,
120
188
  Cell: dated("CalendarCell", "td", "cell"),
121
- Day: dated("CalendarDay", "button", "day")
189
+ Day: dated("CalendarDay", "button", "day"),
190
+ /** The hidden input the value is submitted by, when the root has a `name`. */
191
+ Input: partComponent("CalendarInput", "input", () => scope.use().input)
122
192
  };
123
193
  export { Calendar, scope as calendarScope };
124
194
 
@@ -1 +1 @@
1
- {"version":3,"file":"calendar.js","names":[],"sources":["../../../../packages/vue/src/calendar.ts"],"sourcesContent":["import { within } from \"@kirana-ui/core\"\nimport type { ChangeDetails } from \"@kirana-ui/core\"\nimport { createCalendar } from \"@kirana-ui/core/calendar\"\nimport type {\n Calendar as Controller,\n CalendarProps,\n CalendarValue,\n CalendarWeekday,\n} from \"@kirana-ui/core/calendar\"\nimport { Fragment, defineComponent, h, useId } from \"vue\"\nimport type { PropType } from \"vue\"\n\nimport { useDirectionAround } from \"./direction-context.ts\"\nimport { context, controller, fromSignal, optional, partComponent } from \"./runtime.ts\"\n\nconst scope = context<Controller>(\"Calendar\")\n/** For a component made of this one's parts: a date picker. */\nexport { scope as calendarScope }\n\nconst RootElement = partComponent(\"CalendarRootElement\", \"div\", () => scope.use().root)\n\n/** `v-model:value`, `@value-change=\"(value, details) => …\"`, `@month-change=\"(month) => …\"`. */\nconst Root = defineComponent({\n name: \"CalendarRoot\",\n inheritAttrs: false,\n props: {\n value: optional([String, Object] as PropType<CalendarValue>),\n defaultValue: [String, Object] as PropType<CalendarValue>,\n mode: String as PropType<\"single\" | \"range\">,\n defaultFocusedValue: String,\n locale: String,\n calendarSystem: Object as PropType<CalendarProps[\"calendarSystem\"]>,\n min: String,\n max: String,\n isDateUnavailable: Function as PropType<(date: string) => boolean>,\n disabled: Boolean,\n readOnly: Boolean,\n fixedWeeks: Boolean,\n id: String,\n },\n emits: [\"update:value\", \"valueChange\", \"monthChange\"],\n setup(props, { attrs, slots, emit }) {\n const generated = useId()\n const direction = useDirectionAround()\n scope.provide(\n controller(within(createCalendar, { direction }), () => ({\n id: props.id ?? generated,\n value: props.value,\n defaultValue: props.defaultValue,\n mode: props.mode,\n defaultFocusedValue: props.defaultFocusedValue,\n locale: props.locale,\n calendarSystem: props.calendarSystem,\n min: props.min,\n max: props.max,\n isDateUnavailable: props.isDateUnavailable,\n disabled: props.disabled,\n readOnly: props.readOnly,\n fixedWeeks: props.fixedWeeks,\n onValueChange(value: CalendarValue, details: ChangeDetails) {\n emit(\"valueChange\", value, details)\n if (!details.canceled) emit(\"update:value\", value)\n },\n onMonthChange: (month: string) => emit(\"monthChange\", month),\n }))\n )\n return () => h(RootElement, attrs, slots)\n },\n})\n\nconst HeadingElement = partComponent(\"CalendarHeadingElement\", \"div\", () => scope.use().heading)\n\n/** Names the month shown, unless it is given something else to say. */\nconst Heading = defineComponent({\n name: \"CalendarHeading\",\n inheritAttrs: false,\n setup(_, { attrs, slots }) {\n const title = fromSignal(scope.use().title)\n return () => h(HeadingElement, attrs, slots.default ?? (() => title.value))\n },\n})\n\n/** Its slot once for each day of the week, in the locale's order: `v-slot=\"{ weekday }\"`. */\nconst Weekdays = defineComponent({\n name: \"CalendarWeekdays\",\n setup(_, { slots }) {\n const weekdays = fromSignal(scope.use().weekdays)\n return () =>\n weekdays.value.map((weekday) =>\n h(Fragment, { key: weekday.index }, slots.default?.({ weekday }))\n )\n },\n})\n\n/** Its slot once for each week of the month shown: `v-slot=\"{ week }\"`. */\nconst Weeks = defineComponent({\n name: \"CalendarWeeks\",\n setup(_, { slots }) {\n const weeks = fromSignal(scope.use().weeks)\n return () =>\n weeks.value.map((week) => h(Fragment, { key: week[0]!.date }, slots.default?.({ week })))\n },\n})\n\nconst HeadCell = defineComponent({\n name: \"CalendarHeadCell\",\n inheritAttrs: false,\n props: { weekday: { type: Object as PropType<CalendarWeekday>, required: true } },\n setup(props, { attrs, slots }) {\n const part = scope.use().headCell(props.weekday)\n const Element = partComponent(\"CalendarHeadCellElement\", \"th\", () => part)\n return () => h(Element, attrs, slots)\n },\n})\n\nconst dated = (name: string, tag: string, member: \"cell\" | \"day\") =>\n defineComponent({\n name,\n inheritAttrs: false,\n props: { date: { type: String, required: true } },\n setup(props, { attrs, slots }) {\n const part = scope.use()[member](props.date)\n const Element = partComponent(`${name}Element`, tag, () => part)\n return () => h(Element, attrs, slots)\n },\n })\n\nexport const Calendar = {\n Root,\n Heading,\n Previous: partComponent(\"CalendarPrevious\", \"button\", () => scope.use().previous),\n Next: partComponent(\"CalendarNext\", \"button\", () => scope.use().next),\n Grid: partComponent(\"CalendarGrid\", \"table\", () => scope.use().grid),\n Weekdays,\n HeadCell,\n Weeks,\n Cell: dated(\"CalendarCell\", \"td\", \"cell\"),\n Day: dated(\"CalendarDay\", \"button\", \"day\"),\n}\n"],"mappings":";;;;;;AAeA,MAAM,QAAQ,QAAoB,UAAU;AAI5C,MAAM,cAAc,cAAc,uBAAuB,aAAa,MAAM,IAAI,CAAC,CAAC,IAAI;;AAGtF,MAAM,OAAO,gBAAgB;CAC3B,MAAM;CACN,cAAc;CACd,OAAO;EACL,OAAO,SAAS,CAAC,QAAQ,MAAM,CAA4B;EAC3D,cAAc,CAAC,QAAQ,MAAM;EAC7B,MAAM;EACN,qBAAqB;EACrB,QAAQ;EACR,gBAAgB;EAChB,KAAK;EACL,KAAK;EACL,mBAAmB;EACnB,UAAU;EACV,UAAU;EACV,YAAY;EACZ,IAAI;CACN;CACA,OAAO;EAAC;EAAgB;EAAe;CAAa;CACpD,MAAM,OAAO,EAAE,OAAO,OAAO,QAAQ;EACnC,MAAM,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AI,CAAC,CAAC,KAAK;EAC1C,aACE,MAAM,MAAM,KAAK,SAAS,EAAE,UAAU,EAAE,KAAK,KAAK,EAAE,CAAE,KAAK,GAAG,MAAM,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC;CAC5F;AACF,CAAC;AAED,MAAM,WAAW,gBAAgB;CAC/B,MAAM;CACN,cAAc;CACd,OAAO,EAAE,SAAS;EAAE,MAAM;EAAqC,UAAU;CAAK,EAAE;CAChF,MAAM,OAAO,EAAE,OAAO,SAAS;EAC7B,MAAM,OAAO,MAAM,IAAI,CAAC,CAAC,SAAS,MAAM,OAAO;EAC/C,MAAM,UAAU,cAAc,2BAA2B,YAAY,IAAI;EACzE,aAAa,EAAE,SAAS,OAAO,KAAK;CACtC;AACF,CAAC;AAED,MAAM,SAAS,MAAc,KAAa,WACxC,gBAAgB;CACd;CACA,cAAc;CACd,OAAO,EAAE,MAAM;EAAE,MAAM;EAAQ,UAAU;CAAK,EAAE;CAChD,MAAM,OAAO,EAAE,OAAO,SAAS;EAC7B,MAAM,OAAO,MAAM,IAAI,CAAC,CAAC,OAAO,CAAC,MAAM,IAAI;EAC3C,MAAM,UAAU,cAAc,GAAG,KAAK,UAAU,WAAW,IAAI;EAC/D,aAAa,EAAE,SAAS,OAAO,KAAK;CACtC;AACF,CAAC;AAEH,MAAa,WAAW;CACtB;CACA;CACA,UAAU,cAAc,oBAAoB,gBAAgB,MAAM,IAAI,CAAC,CAAC,QAAQ;CAChF,MAAM,cAAc,gBAAgB,gBAAgB,MAAM,IAAI,CAAC,CAAC,IAAI;CACpE,MAAM,cAAc,gBAAgB,eAAe,MAAM,IAAI,CAAC,CAAC,IAAI;CACnE;CACA;CACA;CACA,MAAM,MAAM,gBAAgB,MAAM,MAAM;CACxC,KAAK,MAAM,eAAe,UAAU,KAAK;AAC3C"}
1
+ {"version":3,"file":"calendar.js","names":[],"sources":["../../../../packages/vue/src/calendar.ts"],"sourcesContent":["import { within } from \"@kirana-ui/core\"\nimport type { ChangeDetails } from \"@kirana-ui/core\"\nimport { createCalendar } from \"@kirana-ui/core/calendar\"\nimport type {\n Calendar as Controller,\n CalendarDay,\n CalendarMode,\n CalendarMonth,\n CalendarProps,\n CalendarValue,\n CalendarValueOf,\n CalendarWeekday,\n} from \"@kirana-ui/core/calendar\"\nimport { Fragment, defineComponent, h, inject, provide, useId } from \"vue\"\nimport type { InjectionKey, PropType, PublicProps } from \"vue\"\n\nimport { useDirectionAround } from \"./direction-context.ts\"\nimport { written } from \"./element.ts\"\nimport { context, controller, fromSignal, optional, partComponent } from \"./runtime.ts\"\nimport type {\n Changes,\n PartComponent,\n PartComponentProps,\n PartGiven,\n PartInstance,\n PlainComponent,\n StatesOf,\n} from \"./runtime.ts\"\n\ntype State = StatesOf<\"calendar\">\n\n/**\n * The calendar its parts are inside. Exported for a component that is made of one (a date picker\n * provides its own to the calendar's parts).\n */\nconst scope = context<Controller>(\"Calendar\")\n/** For a component made of this one's parts: a date picker. */\nexport { scope as calendarScope }\n\nconst RootElement = partComponent(\"CalendarRootElement\", \"div\", () => scope.use().root)\n\n/** The place of the month its parts are drawn in, inside `Calendar.Months`. */\nconst MONTH: InjectionKey<number> = Symbol(\"CalendarMonth\")\n/** The month a part is drawn in: the one `Calendar.Months` gave, or the first. */\nconst useMonth = () => scope.use().monthAt(inject(MONTH, 0))\n\n/** `value` and its events are typed by `mode`: a day, a range, or a list of days. */\nexport type RootProps<Mode extends CalendarMode = \"single\"> = Omit<\n CalendarProps<Mode>,\n \"id\" | \"onValueChange\" | \"onMonthChange\"\n> & {\n id?: string | undefined\n} & PartComponentProps\n\nexport type RootEmits<Mode extends CalendarMode = \"single\"> = Changes<\n \"value\",\n CalendarValueOf<Mode>\n> &\n Changes<\"month\", string>\n\n/**\n * `v-model:value`, `@value-change=\"(value, details) => …\"`; `v-model:month` (the first day of\n * the month shown), `@month-change=\"(month, details) => …\"`.\n */\nconst Root = defineComponent({\n name: \"CalendarRoot\",\n inheritAttrs: false,\n props: {\n value: optional([String, Object, Array] as PropType<CalendarValue>),\n defaultValue: [String, Object, Array] as PropType<CalendarValue>,\n mode: String as PropType<CalendarMode>,\n minDays: Number,\n maxDays: Number,\n months: Number,\n pagedNavigation: Boolean,\n month: optional(String),\n defaultMonth: String,\n defaultFocusedValue: String,\n locale: String,\n calendarSystem: Object as PropType<CalendarProps[\"calendarSystem\"]>,\n min: String,\n max: String,\n isDateUnavailable: Function as PropType<(date: string) => boolean>,\n disabled: Boolean,\n readOnly: Boolean,\n fixedWeeks: Boolean,\n name: String,\n form: String,\n id: String,\n },\n emits: [\"update:value\", \"valueChange\", \"update:month\", \"monthChange\"],\n setup(props, { attrs, slots, emit }) {\n const generated = useId()\n const direction = useDirectionAround()\n scope.provide(\n controller(within(createCalendar, { direction }), () => ({\n id: props.id ?? generated,\n value: props.value,\n defaultValue: props.defaultValue,\n mode: props.mode,\n minDays: props.minDays,\n maxDays: props.maxDays,\n months: props.months,\n pagedNavigation: props.pagedNavigation,\n month: props.month,\n defaultMonth: props.defaultMonth,\n defaultFocusedValue: props.defaultFocusedValue,\n locale: props.locale,\n calendarSystem: props.calendarSystem,\n min: props.min,\n max: props.max,\n isDateUnavailable: props.isDateUnavailable,\n disabled: props.disabled,\n readOnly: props.readOnly,\n fixedWeeks: props.fixedWeeks,\n name: props.name,\n form: props.form,\n onValueChange(value: CalendarValue, details: ChangeDetails) {\n emit(\"valueChange\", value, details)\n if (!details.canceled) emit(\"update:value\", value)\n },\n onMonthChange(month: string, details: ChangeDetails) {\n emit(\"monthChange\", month, details)\n if (!details.canceled) emit(\"update:month\", month)\n },\n }))\n )\n return () => h(RootElement, attrs, slots)\n },\n}) as unknown as new <Mode extends CalendarMode = \"single\", As extends string = \"div\">(\n props: PartGiven<As, RootProps<Mode>, RootEmits<Mode>> & PublicProps\n) => PartInstance<As, RootProps<Mode>, RootEmits<Mode>, { state: State[\"root\"] }>\n\nexport type HeadingProps = PartComponentProps\n\n/** Names the month shown, unless it is given something else to say. */\nconst Heading = defineComponent({\n name: \"CalendarHeading\",\n inheritAttrs: false,\n setup(_, { attrs, slots }) {\n const month = useMonth()\n const title = fromSignal(month.title)\n // With `as-child` the caller's element holds the text, unless it writes its own.\n const HeadingElement = partComponent(\n \"CalendarHeadingElement\",\n \"div\",\n () => month.heading,\n written(() => title.value)\n )\n return () => h(HeadingElement, attrs, slots.default ?? (() => title.value))\n },\n}) as unknown as PartComponent<\"div\", State[\"heading\"], HeadingProps>\n\nexport type WeekdaysProps = Record<never, never>\n\n/** Its slot once for each day of the week, in the locale's order: `v-slot=\"{ weekday }\"`. */\nconst Weekdays = defineComponent({\n name: \"CalendarWeekdays\",\n setup(_, { slots }) {\n const weekdays = fromSignal(scope.use().weekdays)\n return () =>\n weekdays.value.map((weekday) =>\n h(Fragment, { key: weekday.index }, slots.default?.({ weekday }))\n )\n },\n}) as unknown as PlainComponent<WeekdaysProps, {}, { weekday: CalendarWeekday }>\n\nexport type MonthsProps = Record<never, never>\n\n/** Holds the parts of one month: they are that month's. */\nconst MonthScope = defineComponent({\n name: \"CalendarMonthScope\",\n props: { index: { type: Number, required: true } },\n setup(props, { slots }) {\n // Keyed by its place: a scope is one month's for as long as it is drawn.\n provide(MONTH, props.index)\n return () => slots.default?.()\n },\n})\n\n/**\n * Its slot once for each month shown (`months` on the root), side by side: `v-slot=\"{ month }\"`.\n * The parts inside each are that month's. Left out for one month.\n */\nconst Months = defineComponent({\n name: \"CalendarMonths\",\n setup(_, { slots }) {\n const months = fromSignal(scope.use().months)\n return () =>\n months.value.map((month) =>\n h(MonthScope, { key: month.index, index: month.index }, () => slots.default?.({ month }))\n )\n },\n}) as unknown as PlainComponent<MonthsProps, {}, { month: CalendarMonth }>\n\nexport type WeeksProps = Record<never, never>\n\n/** Its slot once for each week of the month shown: `v-slot=\"{ week }\"`. */\nconst Weeks = defineComponent({\n name: \"CalendarWeeks\",\n setup(_, { slots }) {\n const weeks = fromSignal(useMonth().weeks)\n return () =>\n weeks.value.map((week) => h(Fragment, { key: week[0]!.date }, slots.default?.({ week })))\n },\n}) as unknown as PlainComponent<WeeksProps, {}, { week: readonly CalendarDay[] }>\n\nexport interface HeadCellProps extends PartComponentProps {\n /** The day of the week it names, as `Calendar.Weekdays` gives it. */\n weekday: CalendarWeekday\n}\n\nconst HeadCell = defineComponent({\n name: \"CalendarHeadCell\",\n inheritAttrs: false,\n props: { weekday: { type: Object as PropType<CalendarWeekday>, required: true } },\n setup(props, { attrs, slots }) {\n const part = scope.use().headCell(props.weekday)\n const Element = partComponent(\"CalendarHeadCellElement\", \"th\", () => part)\n return () => h(Element, attrs, slots)\n },\n}) as unknown as PartComponent<\"th\", State[\"headCell\"], HeadCellProps>\n\nexport interface CellProps extends PartComponentProps {\n /** The day it is for, as a week of `Calendar.Weeks` gives it. */\n date: string\n}\nexport type DayProps = CellProps\nexport type PreviousProps = PartComponentProps\nexport type NextProps = PartComponentProps\nexport type GridProps = PartComponentProps\nexport type InputProps = PartComponentProps\n\nconst dated = <Tag extends string, Member extends \"cell\" | \"day\">(\n name: string,\n tag: Tag,\n member: Member\n) =>\n defineComponent({\n name,\n inheritAttrs: false,\n props: { date: { type: String, required: true } },\n setup(props, { attrs, slots }) {\n const part = scope.use()[member](props.date, inject(MONTH, undefined))\n const Element = partComponent<string>(`${name}Element`, tag, () => part)\n return () => h(Element, attrs, slots)\n },\n }) as unknown as PartComponent<Tag, State[Member], CellProps>\n\nexport const Calendar = {\n Root,\n Heading,\n Previous: partComponent<\"button\", State[\"previous\"]>(\n \"CalendarPrevious\",\n \"button\",\n () => scope.use().previous\n ),\n Next: partComponent<\"button\", State[\"next\"]>(\"CalendarNext\", \"button\", () => scope.use().next),\n Months,\n Grid: partComponent<\"table\", State[\"grid\"]>(\"CalendarGrid\", \"table\", () => useMonth().grid),\n Weekdays,\n HeadCell,\n Weeks,\n Cell: dated(\"CalendarCell\", \"td\", \"cell\"),\n Day: dated(\"CalendarDay\", \"button\", \"day\"),\n /** The hidden input the value is submitted by, when the root has a `name`. */\n Input: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AM,IAAI,CAAC,CAAC,IAAI;CAC7F;CACA,MAAM,cAAsC,gBAAgB,eAAe,SAAS,CAAC,CAAC,IAAI;CAC1F;CACA;CACA;CACA,MAAM,MAAM,gBAAgB,MAAM,MAAM;CACxC,KAAK,MAAM,eAAe,UAAU,KAAK;;CAEzC,OAAO,cAAuC,iBAAiB,eAAe,MAAM,IAAI,CAAC,CAAC,KAAK;AACjG"}
package/src/carousel.d.ts CHANGED
@@ -1,61 +1,39 @@
1
- import { Orientation } from "@kirana-ui/core";
2
- import { PropType } from "vue";
1
+ import { Changes, PartComponent, PartComponentProps } from "./runtime.js";
2
+ import { CarouselProps } from "@kirana-ui/core/carousel";
3
+ export type RootProps = Omit<CarouselProps, "id" | "onIndexChange"> & {
4
+ id?: string | undefined;
5
+ } & PartComponentProps;
6
+ export type RootEmits = Changes<"index", number>;
7
+ export type ViewportProps = PartComponentProps;
8
+ export type PreviousProps = PartComponentProps;
9
+ export type NextProps = PartComponentProps;
10
+ export interface ItemProps extends PartComponentProps {
11
+ /** Its place among the slides, from 0. */
12
+ index: number;
13
+ }
14
+ export interface IndicatorProps extends PartComponentProps {
15
+ /** The slide it goes to, from 0. */
16
+ index: number;
17
+ }
3
18
  export declare const Carousel: {
4
- Root: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
5
- index: {
6
- type: NumberConstructor;
7
- default: undefined;
8
- };
9
- defaultIndex: NumberConstructor;
10
- orientation: PropType<Orientation>;
11
- loop: BooleanConstructor;
12
- id: StringConstructor;
13
- }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
14
- [key: string]: any;
15
- }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("indexChange" | "update:index")[], "indexChange" | "update:index", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
16
- index: {
17
- type: NumberConstructor;
18
- default: undefined;
19
- };
20
- defaultIndex: NumberConstructor;
21
- orientation: PropType<Orientation>;
22
- loop: BooleanConstructor;
23
- id: StringConstructor;
24
- }>> & Readonly<{
25
- onIndexChange?: ((...args: any[]) => any) | undefined;
26
- "onUpdate:index"?: ((...args: any[]) => any) | undefined;
27
- }>, {
28
- index: number;
29
- loop: boolean;
30
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
31
- Viewport: import("vue").Component;
32
- Item: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
33
- index: {
34
- type: NumberConstructor;
35
- required: true;
36
- };
37
- }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
38
- [key: string]: any;
39
- }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
40
- index: {
41
- type: NumberConstructor;
42
- required: true;
43
- };
44
- }>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
45
- Previous: import("vue").Component;
46
- Next: import("vue").Component;
47
- Indicator: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
48
- index: {
49
- type: NumberConstructor;
50
- required: true;
51
- };
52
- }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
53
- [key: string]: any;
54
- }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
55
- index: {
56
- type: NumberConstructor;
57
- required: true;
58
- };
59
- }>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
19
+ Root: PartComponent<"div", {
20
+ readonly orientation?: "horizontal" | "vertical" | undefined;
21
+ }, RootProps, RootEmits>;
22
+ Viewport: PartComponent<"div", {
23
+ readonly orientation?: "horizontal" | "vertical" | undefined;
24
+ }, PartComponentProps, {}, unknown>;
25
+ Item: PartComponent<"div", {
26
+ readonly orientation?: "horizontal" | "vertical" | undefined;
27
+ readonly current?: true | undefined;
28
+ }, ItemProps>;
29
+ Previous: PartComponent<"button", {
30
+ readonly disabled?: true | undefined;
31
+ }, PartComponentProps, {}, unknown>;
32
+ Next: PartComponent<"button", {
33
+ readonly disabled?: true | undefined;
34
+ }, PartComponentProps, {}, unknown>;
35
+ Indicator: PartComponent<"button", {
36
+ readonly current?: true | undefined;
37
+ }, IndicatorProps>;
60
38
  };
61
39
  //# sourceMappingURL=carousel.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"carousel.js","names":[],"sources":["../../../../packages/vue/src/carousel.ts"],"sourcesContent":["import { within } from \"@kirana-ui/core\"\nimport type { ChangeDetails, Orientation } from \"@kirana-ui/core\"\nimport { createCarousel } from \"@kirana-ui/core/carousel\"\nimport type { Carousel as Controller } from \"@kirana-ui/core/carousel\"\nimport { defineComponent, h, useId } from \"vue\"\nimport type { PropType } from \"vue\"\n\nimport { useDirectionAround } from \"./direction-context.ts\"\nimport { context, controller, optional, partComponent } from \"./runtime.ts\"\n\nconst scope = context<Controller>(\"Carousel\")\n\nconst RootElement = partComponent(\"CarouselRootElement\", \"div\", () => scope.use().root)\n\n/** `v-model:index`, and `@index-change=\"(index, details) => …\"`. */\nconst Root = defineComponent({\n name: \"CarouselRoot\",\n inheritAttrs: false,\n props: {\n index: optional(Number),\n defaultIndex: Number,\n orientation: String as PropType<Orientation>,\n loop: Boolean,\n id: String,\n },\n emits: [\"update:index\", \"indexChange\"],\n setup(props, { attrs, slots, emit }) {\n const generated = useId()\n const direction = useDirectionAround()\n scope.provide(\n controller(within(createCarousel, { direction }), () => ({\n id: props.id ?? generated,\n index: props.index,\n defaultIndex: props.defaultIndex,\n orientation: props.orientation,\n loop: props.loop,\n onIndexChange: (index: number, details: ChangeDetails) => {\n emit(\"indexChange\", index, details)\n if (!details.canceled) emit(\"update:index\", index)\n },\n }))\n )\n return () => h(RootElement, attrs, slots)\n },\n})\n\nconst Viewport = partComponent(\"CarouselViewport\", \"div\", () => scope.use().viewport)\nconst Previous = partComponent(\"CarouselPrevious\", \"button\", () => scope.use().previous)\nconst Next = partComponent(\"CarouselNext\", \"button\", () => scope.use().next)\n\nconst Item = defineComponent({\n name: \"CarouselItem\",\n inheritAttrs: false,\n props: { index: { type: Number, required: true } },\n setup(props, { attrs, slots }) {\n const part = scope.use().item(props.index)\n const Element = partComponent(\"CarouselItemElement\", \"div\", () => part)\n return () => h(Element, attrs, slots)\n },\n})\n\nconst Indicator = defineComponent({\n name: \"CarouselIndicator\",\n inheritAttrs: false,\n props: { index: { type: Number, required: true } },\n setup(props, { attrs, slots }) {\n const part = scope.use().indicator(props.index)\n const Element = partComponent(\"CarouselIndicatorElement\", \"button\", () => part)\n return () => h(Element, attrs, slots)\n },\n})\n\nexport const Carousel = { Root, Viewport, Item, Previous, Next, Indicator }\n"],"mappings":";;;;;;AAUA,MAAM,QAAQ,QAAoB,UAAU;AAE5C,MAAM,cAAc,cAAc,uBAAuB,aAAa,MAAM,IAAI,CAAC,CAAC,IAAI;;AAGtF,MAAM,OAAO,gBAAgB;CAC3B,MAAM;CACN,cAAc;CACd,OAAO;EACL,OAAO,SAAS,MAAM;EACtB,cAAc;EACd,aAAa;EACb,MAAM;EACN,IAAI;CACN;CACA,OAAO,CAAC,gBAAgB,aAAa;CACrC,MAAM,OAAO,EAAE,OAAO,OAAO,QAAQ;EACnC,MAAM,YAAY,MAAM;EACxB,MAAM,YAAY,mBAAmB;EACrC,MAAM,QACJ,WAAW,OAAO,gBAAgB,EAAE,UAAU,CAAC,UAAU;GACvD,IAAI,MAAM,MAAM;GAChB,OAAO,MAAM;GACb,cAAc,MAAM;GACpB,aAAa,MAAM;GACnB,MAAM,MAAM;GACZ,gBAAgB,OAAe,YAA2B;IACxD,KAAK,eAAe,OAAO,OAAO;IAClC,IAAI,CAAC,QAAQ,UAAU,KAAK,gBAAgB,KAAK;GACnD;EACF,EAAE,CACJ;EACA,aAAa,EAAE,aAAa,OAAO,KAAK;CAC1C;AACF,CAAC;AAED,MAAM,WAAW,cAAc,oBAAoB,aAAa,MAAM,IAAI,CAAC,CAAC,QAAQ;AACpF,MAAM,WAAW,cAAc,oBAAoB,gBAAgB,MAAM,IAAI,CAAC,CAAC,QAAQ;AACvF,MAAM,OAAO,cAAc,gBAAgB,gBAAgB,MAAM,IAAI,CAAC,CAAC,IAAI;AAwB3E,MAAa,WAAW;CAAE;CAAM;CAAU,MAtB7B,gBAAgB;EAC3B,MAAM;EACN,cAAc;EACd,OAAO,EAAE,OAAO;GAAE,MAAM;GAAQ,UAAU;EAAK,EAAE;EACjD,MAAM,OAAO,EAAE,OAAO,SAAS;GAC7B,MAAM,OAAO,MAAM,IAAI,CAAC,CAAC,KAAK,MAAM,KAAK;GACzC,MAAM,UAAU,cAAc,uBAAuB,aAAa,IAAI;GACtE,aAAa,EAAE,SAAS,OAAO,KAAK;EACtC;CACF,CAa0C;CAAM;CAAU;CAAM,WAX9C,gBAAgB;EAChC,MAAM;EACN,cAAc;EACd,OAAO,EAAE,OAAO;GAAE,MAAM;GAAQ,UAAU;EAAK,EAAE;EACjD,MAAM,OAAO,EAAE,OAAO,SAAS;GAC7B,MAAM,OAAO,MAAM,IAAI,CAAC,CAAC,UAAU,MAAM,KAAK;GAC9C,MAAM,UAAU,cAAc,4BAA4B,gBAAgB,IAAI;GAC9E,aAAa,EAAE,SAAS,OAAO,KAAK;EACtC;CACF,CAEgE;AAAU"}
1
+ {"version":3,"file":"carousel.js","names":[],"sources":["../../../../packages/vue/src/carousel.ts"],"sourcesContent":["import { within } from \"@kirana-ui/core\"\nimport type { ChangeDetails, Orientation } from \"@kirana-ui/core\"\nimport { createCarousel } from \"@kirana-ui/core/carousel\"\nimport type { CarouselProps, Carousel as Controller } from \"@kirana-ui/core/carousel\"\nimport { defineComponent, h, useId } from \"vue\"\nimport type { PropType } from \"vue\"\n\nimport { useDirectionAround } from \"./direction-context.ts\"\nimport { context, controller, optional, partComponent } from \"./runtime.ts\"\nimport type { Changes, PartComponent, PartComponentProps, StatesOf } from \"./runtime.ts\"\n\ntype State = StatesOf<\"carousel\">\n\nconst scope = context<Controller>(\"Carousel\")\n\nconst RootElement = partComponent(\"CarouselRootElement\", \"div\", () => scope.use().root)\n\nexport type RootProps = Omit<CarouselProps, \"id\" | \"onIndexChange\"> & {\n id?: string | undefined\n} & PartComponentProps\n\nexport type RootEmits = Changes<\"index\", number>\n\n/** `v-model:index`, and `@index-change=\"(index, details) => …\"`. */\nconst Root = defineComponent({\n name: \"CarouselRoot\",\n inheritAttrs: false,\n props: {\n index: optional(Number),\n defaultIndex: Number,\n orientation: String as PropType<Orientation>,\n loop: Boolean,\n id: String,\n },\n emits: [\"update:index\", \"indexChange\"],\n setup(props, { attrs, slots, emit }) {\n const generated = useId()\n const direction = useDirectionAround()\n scope.provide(\n controller(within(createCarousel, { direction }), () => ({\n id: props.id ?? generated,\n index: props.index,\n defaultIndex: props.defaultIndex,\n orientation: props.orientation,\n loop: props.loop,\n onIndexChange: (index: number, details: ChangeDetails) => {\n emit(\"indexChange\", index, details)\n if (!details.canceled) emit(\"update:index\", index)\n },\n }))\n )\n return () => h(RootElement, attrs, slots)\n },\n}) as unknown as PartComponent<\"div\", State[\"root\"], RootProps, RootEmits>\n\nexport type ViewportProps = PartComponentProps\nexport type PreviousProps = PartComponentProps\nexport type NextProps = PartComponentProps\nconst Viewport = partComponent<\"div\", State[\"viewport\"]>(\n \"CarouselViewport\",\n \"div\",\n () => scope.use().viewport\n)\nconst Previous = partComponent<\"button\", State[\"previous\"]>(\n \"CarouselPrevious\",\n \"button\",\n () => scope.use().previous\n)\nconst Next = partComponent<\"button\", State[\"next\"]>(\n \"CarouselNext\",\n \"button\",\n () => scope.use().next\n)\n\nexport interface ItemProps extends PartComponentProps {\n /** Its place among the slides, from 0. */\n index: number\n}\n\nconst Item = defineComponent({\n name: \"CarouselItem\",\n inheritAttrs: false,\n props: { index: { type: Number, required: true } },\n setup(props, { attrs, slots }) {\n const part = scope.use().item(props.index)\n const Element = partComponent(\"CarouselItemElement\", \"div\", () => part)\n return () => h(Element, attrs, slots)\n },\n}) as unknown as PartComponent<\"div\", State[\"item\"], ItemProps>\n\nexport interface IndicatorProps extends PartComponentProps {\n /** The slide it goes to, from 0. */\n index: number\n}\n\nconst Indicator = defineComponent({\n name: \"CarouselIndicator\",\n inheritAttrs: false,\n props: { index: { type: Number, required: true } },\n setup(props, { attrs, slots }) {\n const part = scope.use().indicator(props.index)\n const Element = partComponent(\"CarouselIndicatorElement\", \"button\", () => part)\n return () => h(Element, attrs, slots)\n },\n}) as unknown as PartComponent<\"button\", State[\"indicator\"], IndicatorProps>\n\nexport const Carousel = { Root, Viewport, Item, Previous, Next, Indicator }\n"],"mappings":";;;;;;AAaA,MAAM,QAAQ,QAAoB,UAAU;AAE5C,MAAM,cAAc,cAAc,uBAAuB,aAAa,MAAM,IAAI,CAAC,CAAC,IAAI;;AAStF,MAAM,OAAO,gBAAgB;CAC3B,MAAM;CACN,cAAc;CACd,OAAO;EACL,OAAO,SAAS,MAAM;EACtB,cAAc;EACd,aAAa;EACb,MAAM;EACN,IAAI;CACN;CACA,OAAO,CAAC,gBAAgB,aAAa;CACrC,MAAM,OAAO,EAAE,OAAO,OAAO,QAAQ;EACnC,MAAM,YAAY,MAAM;EACxB,MAAM,YAAY,mBAAmB;EACrC,MAAM,QACJ,WAAW,OAAO,gBAAgB,EAAE,UAAU,CAAC,UAAU;GACvD,IAAI,MAAM,MAAM;GAChB,OAAO,MAAM;GACb,cAAc,MAAM;GACpB,aAAa,MAAM;GACnB,MAAM,MAAM;GACZ,gBAAgB,OAAe,YAA2B;IACxD,KAAK,eAAe,OAAO,OAAO;IAClC,IAAI,CAAC,QAAQ,UAAU,KAAK,gBAAgB,KAAK;GACnD;EACF,EAAE,CACJ;EACA,aAAa,EAAE,aAAa,OAAO,KAAK;CAC1C;AACF,CAAC;AAKD,MAAM,WAAW,cACf,oBACA,aACM,MAAM,IAAI,CAAC,CAAC,QACpB;AACA,MAAM,WAAW,cACf,oBACA,gBACM,MAAM,IAAI,CAAC,CAAC,QACpB;AACA,MAAM,OAAO,cACX,gBACA,gBACM,MAAM,IAAI,CAAC,CAAC,IACpB;AAkCA,MAAa,WAAW;CAAE;CAAM;CAAU,MA3B7B,gBAAgB;EAC3B,MAAM;EACN,cAAc;EACd,OAAO,EAAE,OAAO;GAAE,MAAM;GAAQ,UAAU;EAAK,EAAE;EACjD,MAAM,OAAO,EAAE,OAAO,SAAS;GAC7B,MAAM,OAAO,MAAM,IAAI,CAAC,CAAC,KAAK,MAAM,KAAK;GACzC,MAAM,UAAU,cAAc,uBAAuB,aAAa,IAAI;GACtE,aAAa,EAAE,SAAS,OAAO,KAAK;EACtC;CACF,CAkB0C;CAAM;CAAU;CAAM,WAX9C,gBAAgB;EAChC,MAAM;EACN,cAAc;EACd,OAAO,EAAE,OAAO;GAAE,MAAM;GAAQ,UAAU;EAAK,EAAE;EACjD,MAAM,OAAO,EAAE,OAAO,SAAS;GAC7B,MAAM,OAAO,MAAM,IAAI,CAAC,CAAC,UAAU,MAAM,KAAK;GAC9C,MAAM,UAAU,cAAc,4BAA4B,gBAAgB,IAAI;GAC9E,aAAa,EAAE,SAAS,OAAO,KAAK;EACtC;CACF,CAEgE;AAAU"}
@@ -0,0 +1,5 @@
1
+ import { InjectionKey } from "vue";
2
+ import { CheckboxGroup } from "@kirana-ui/core/checkbox-group";
3
+ /** The group a checkbox is one of the boxes of, if it is in one. */
4
+ export declare const CHECKBOX_GROUP: InjectionKey<CheckboxGroup | null>;
5
+ //# sourceMappingURL=checkbox-group-context.d.ts.map
@@ -0,0 +1,6 @@
1
+ // src/checkbox-group-context.ts
2
+ /** The group a checkbox is one of the boxes of, if it is in one. */
3
+ const CHECKBOX_GROUP = Symbol("CheckboxGroup");
4
+ export { CHECKBOX_GROUP };
5
+
6
+ //# sourceMappingURL=checkbox-group-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkbox-group-context.js","names":[],"sources":["../../../../packages/vue/src/checkbox-group-context.ts"],"sourcesContent":["import type { CheckboxGroup } from \"@kirana-ui/core/checkbox-group\"\nimport type { InjectionKey } from \"vue\"\n\n/** The group a checkbox is one of the boxes of, if it is in one. */\nexport const CHECKBOX_GROUP: InjectionKey<CheckboxGroup | null> = Symbol(\"CheckboxGroup\")\n"],"mappings":";;AAIA,MAAa,iBAAqD,OAAO,eAAe"}
@@ -0,0 +1,12 @@
1
+ import { Changes, PartComponent, PartComponentProps, StatesOf } from "./runtime.js";
2
+ import { CheckboxGroupProps as CheckboxGroupProps$1 } from "@kirana-ui/core/checkbox-group";
3
+ export type CheckboxGroupProps = Omit<CheckboxGroupProps$1, "id" | "onValueChange"> & {
4
+ id?: string | undefined;
5
+ } & PartComponentProps;
6
+ export type CheckboxGroupEmits = Changes<"value", string[]>;
7
+ /**
8
+ * `v-model:value` (a list). Each `Checkbox.Root` with a `value` inside it is checked while the
9
+ * list has its value; with `all-values`, a `Checkbox.Root` marked `parent` stands for them all.
10
+ */
11
+ export declare const CheckboxGroup: PartComponent<"div", StatesOf<"checkboxGroup">["root"], CheckboxGroupProps, CheckboxGroupEmits>;
12
+ //# sourceMappingURL=checkbox-group.d.ts.map