@kirana-ui/vue 0.1.1 → 0.2.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 (133) hide show
  1. package/llms.txt +1619 -241
  2. package/package.json +14 -2
  3. package/skills/kirana-ui-primitives/SKILL.md +142 -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 +10 -13
  14. package/src/avatar.js.map +1 -1
  15. package/src/button.d.ts +4 -21
  16. package/src/button.js.map +1 -1
  17. package/src/calendar.d.ts +65 -99
  18. package/src/calendar.js +6 -1
  19. package/src/calendar.js.map +1 -1
  20. package/src/carousel.d.ts +36 -58
  21. package/src/carousel.js.map +1 -1
  22. package/src/checkbox.d.ts +28 -50
  23. package/src/checkbox.js +2 -2
  24. package/src/checkbox.js.map +1 -1
  25. package/src/collapsible.d.ts +26 -36
  26. package/src/collapsible.js.map +1 -1
  27. package/src/combobox.d.ts +139 -290
  28. package/src/combobox.js +11 -1
  29. package/src/combobox.js.map +1 -1
  30. package/src/command.d.ts +43 -86
  31. package/src/command.js.map +1 -1
  32. package/src/context-menu.d.ts +4 -2
  33. package/src/date-field.d.ts +31 -61
  34. package/src/date-field.js +7 -3
  35. package/src/date-field.js.map +1 -1
  36. package/src/date-picker.d.ts +83 -139
  37. package/src/date-picker.js.map +1 -1
  38. package/src/dialog.d.ts +74 -145
  39. package/src/dialog.js +3 -1
  40. package/src/dialog.js.map +1 -1
  41. package/src/direction.d.ts +5 -8
  42. package/src/direction.js.map +1 -1
  43. package/src/drawer.d.ts +3 -2
  44. package/src/element.d.ts +23 -0
  45. package/src/element.js +90 -0
  46. package/src/element.js.map +1 -0
  47. package/src/field.d.ts +63 -45
  48. package/src/field.js +3 -2
  49. package/src/field.js.map +1 -1
  50. package/src/fieldset.d.ts +12 -13
  51. package/src/fieldset.js.map +1 -1
  52. package/src/form.d.ts +5 -15
  53. package/src/form.js.map +1 -1
  54. package/src/hover-card.d.ts +29 -43
  55. package/src/hover-card.js.map +1 -1
  56. package/src/hover-popup.d.ts +27 -46
  57. package/src/hover-popup.js +4 -1
  58. package/src/hover-popup.js.map +1 -1
  59. package/src/index.d.ts +13 -3
  60. package/src/input.d.ts +12 -14
  61. package/src/input.js.map +1 -1
  62. package/src/label.d.ts +3 -3
  63. package/src/label.js.map +1 -1
  64. package/src/listbox.d.ts +34 -89
  65. package/src/listbox.js.map +1 -1
  66. package/src/menu.d.ts +170 -533
  67. package/src/menu.js.map +1 -1
  68. package/src/menubar.d.ts +6 -24
  69. package/src/menubar.js.map +1 -1
  70. package/src/message-scroller.d.ts +23 -17
  71. package/src/message-scroller.js.map +1 -1
  72. package/src/meter.d.ts +10 -31
  73. package/src/meter.js.map +1 -1
  74. package/src/navigation-menu.d.ts +77 -88
  75. package/src/navigation-menu.js +13 -12
  76. package/src/navigation-menu.js.map +1 -1
  77. package/src/number-field.d.ts +72 -68
  78. package/src/number-field.js +2 -2
  79. package/src/number-field.js.map +1 -1
  80. package/src/otp.d.ts +33 -54
  81. package/src/otp.js +2 -2
  82. package/src/otp.js.map +1 -1
  83. package/src/pagination.d.ts +31 -58
  84. package/src/pagination.js.map +1 -1
  85. package/src/popover.d.ts +60 -36
  86. package/src/popover.js +33 -5
  87. package/src/popover.js.map +1 -1
  88. package/src/primitive.d.ts +21 -0
  89. package/src/primitive.js +27 -0
  90. package/src/primitive.js.map +1 -0
  91. package/src/progress.d.ts +28 -31
  92. package/src/progress.js.map +1 -1
  93. package/src/qr-code.d.ts +12 -21
  94. package/src/qr-code.js.map +1 -1
  95. package/src/radio-group.d.ts +37 -75
  96. package/src/radio-group.js +2 -2
  97. package/src/radio-group.js.map +1 -1
  98. package/src/resizable.d.ts +26 -45
  99. package/src/resizable.js.map +1 -1
  100. package/src/runtime.d.ts +93 -21
  101. package/src/runtime.js +24 -25
  102. package/src/runtime.js.map +1 -1
  103. package/src/scroll-area.d.ts +33 -28
  104. package/src/scroll-area.js.map +1 -1
  105. package/src/select.d.ts +87 -147
  106. package/src/select.js +31 -6
  107. package/src/select.js.map +1 -1
  108. package/src/separator.d.ts +4 -9
  109. package/src/separator.js.map +1 -1
  110. package/src/slider.d.ts +61 -80
  111. package/src/slider.js +10 -10
  112. package/src/slider.js.map +1 -1
  113. package/src/switch.d.ts +21 -39
  114. package/src/switch.js +2 -2
  115. package/src/switch.js.map +1 -1
  116. package/src/tabs.d.ts +44 -98
  117. package/src/tabs.js.map +1 -1
  118. package/src/testing.d.ts +1 -0
  119. package/src/testing.js +1 -0
  120. package/src/toast.d.ts +58 -45
  121. package/src/toast.js +46 -17
  122. package/src/toast.js.map +1 -1
  123. package/src/toggle-group.d.ts +8 -39
  124. package/src/toggle-group.js.map +1 -1
  125. package/src/toggle.d.ts +5 -34
  126. package/src/toggle.js.map +1 -1
  127. package/src/toolbar.d.ts +31 -69
  128. package/src/toolbar.js.map +1 -1
  129. package/src/tooltip.d.ts +29 -43
  130. package/src/tooltip.js.map +1 -1
  131. package/src/value-bar.d.ts +26 -35
  132. package/src/value-bar.js +10 -3
  133. package/src/value-bar.js.map +1 -1
package/src/command.d.ts CHANGED
@@ -1,89 +1,46 @@
1
- import { PropType } from "vue";
2
- import { CommandProps } from "@kirana-ui/core/command";
1
+ import { Changes, PartComponent, PartComponentProps } from "./runtime.js";
2
+ import { ChangeDetails } from "@kirana-ui/core";
3
+ import { CommandItemOptions, CommandProps } from "@kirana-ui/core/command";
4
+ export type RootProps = Omit<CommandProps, "id" | "onInputValueChange" | "onSelect"> & {
5
+ id?: string | undefined;
6
+ } & PartComponentProps;
7
+ export type RootEmits = Changes<"inputValue", string> & {
8
+ /** An item was chosen: its value. */
9
+ select: (value: string, details: ChangeDetails) => void;
10
+ };
11
+ export type EmptyProps = PartComponentProps;
12
+ export interface GroupProps extends PartComponentProps {
13
+ id?: string | undefined;
14
+ }
15
+ export type GroupHeadingProps = PartComponentProps;
16
+ export interface ItemProps extends Omit<CommandItemOptions, "id">, PartComponentProps {
17
+ /** What `@select` is told when this item is chosen. */
18
+ value: string;
19
+ id?: string | undefined;
20
+ }
21
+ export interface SeparatorProps extends PartComponentProps {
22
+ /** Keeps the line while something is typed. */
23
+ alwaysRender?: boolean | undefined;
24
+ }
25
+ export type InputProps = PartComponentProps;
26
+ export type ListProps = PartComponentProps;
3
27
  export declare const Command: {
4
- Root: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
5
- inputValue: StringConstructor;
6
- defaultInputValue: StringConstructor;
7
- filter: {
8
- type: PropType<CommandProps["filter"]>;
9
- default: undefined;
10
- };
11
- loop: BooleanConstructor;
12
- disabled: BooleanConstructor;
13
- id: StringConstructor;
14
- }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
15
- [key: string]: any;
16
- }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("inputValueChange" | "select" | "update:inputValue")[], "inputValueChange" | "select" | "update:inputValue", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
17
- inputValue: StringConstructor;
18
- defaultInputValue: StringConstructor;
19
- filter: {
20
- type: PropType<CommandProps["filter"]>;
21
- default: undefined;
22
- };
23
- loop: BooleanConstructor;
24
- disabled: BooleanConstructor;
25
- id: StringConstructor;
26
- }>> & Readonly<{
27
- onInputValueChange?: ((...args: any[]) => any) | undefined;
28
- onSelect?: ((...args: any[]) => any) | undefined;
29
- "onUpdate:inputValue"?: ((...args: any[]) => any) | undefined;
30
- }>, {
31
- filter: ((label: string, query: string, keywords: readonly string[]) => boolean) | null | undefined;
32
- loop: boolean;
33
- disabled: boolean;
34
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
35
- Input: import("vue").Component;
36
- List: import("vue").Component;
37
- Empty: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
38
- [key: string]: any;
39
- }> | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
40
- Group: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
41
- id: StringConstructor;
42
- }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
43
- [key: string]: any;
44
- }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
45
- id: StringConstructor;
46
- }>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
47
- GroupHeading: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
48
- [key: string]: any;
49
- }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
50
- Item: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
51
- value: {
52
- type: StringConstructor;
53
- required: true;
54
- };
55
- disabled: {
56
- type: BooleanConstructor;
57
- default: undefined;
58
- };
59
- label: StringConstructor;
60
- keywords: PropType<readonly string[]>;
61
- id: StringConstructor;
62
- }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
63
- [key: string]: any;
64
- }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
65
- value: {
66
- type: StringConstructor;
67
- required: true;
68
- };
69
- disabled: {
70
- type: BooleanConstructor;
71
- default: undefined;
72
- };
73
- label: StringConstructor;
74
- keywords: PropType<readonly string[]>;
75
- id: StringConstructor;
76
- }>> & Readonly<{}>, {
77
- disabled: boolean;
78
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
79
- Separator: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
80
- alwaysRender: BooleanConstructor;
81
- }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
82
- [key: string]: any;
83
- }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
84
- alwaysRender: BooleanConstructor;
85
- }>> & Readonly<{}>, {
86
- alwaysRender: boolean;
87
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
28
+ Root: PartComponent<"div", {
29
+ readonly disabled?: true | undefined;
30
+ }, RootProps, RootEmits>;
31
+ Input: PartComponent<"input", {
32
+ readonly disabled?: true | undefined;
33
+ }, PartComponentProps, {}, unknown>;
34
+ List: PartComponent<"div", {
35
+ readonly empty?: true | undefined;
36
+ }, PartComponentProps, {}, unknown>;
37
+ Empty: PartComponent<"div", Record<never, never>, PartComponentProps>;
38
+ Group: PartComponent<"div", Record<never, never>, GroupProps>;
39
+ GroupHeading: PartComponent<"div", Record<never, never>, PartComponentProps>;
40
+ Item: PartComponent<"div", {
41
+ readonly highlighted?: true | undefined;
42
+ readonly disabled?: true | undefined;
43
+ }, ItemProps>;
44
+ Separator: PartComponent<"div", Record<never, never>, SeparatorProps>;
88
45
  };
89
46
  //# sourceMappingURL=command.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"command.js","names":[],"sources":["../../../../packages/vue/src/command.ts"],"sourcesContent":["import type { ChangeDetails } from \"@kirana-ui/core\"\nimport { createCommand } from \"@kirana-ui/core/command\"\nimport type { CommandGroup, CommandProps, Command as Controller } from \"@kirana-ui/core/command\"\nimport { defineComponent, h, inject, provide, useId } from \"vue\"\nimport type { InjectionKey, PropType } from \"vue\"\n\nimport { context, controller, fromSignal, optional, partComponent, toSignal } from \"./runtime.ts\"\n\nconst scope = context<Controller>(\"Command\")\nconst GROUP: InjectionKey<CommandGroup> = Symbol(\"CommandGroup\")\n\nconst RootElement = partComponent(\"CommandRootElement\", \"div\", () => scope.use().root)\n\n/** `v-model:inputValue`; `@select` hears the item chosen. */\nconst Root = defineComponent({\n name: \"CommandRoot\",\n inheritAttrs: false,\n props: {\n inputValue: String,\n defaultInputValue: String,\n filter: {\n type: null as unknown as PropType<CommandProps[\"filter\"]>,\n default: undefined,\n },\n loop: Boolean,\n disabled: Boolean,\n id: String,\n },\n emits: [\"update:inputValue\", \"inputValueChange\", \"select\"],\n setup(props, { attrs, slots, emit }) {\n const generated = useId()\n scope.provide(\n controller(createCommand, () => ({\n id: props.id ?? generated,\n inputValue: props.inputValue,\n defaultInputValue: props.defaultInputValue,\n filter: props.filter,\n loop: props.loop,\n disabled: props.disabled,\n onInputValueChange(value: string, details: ChangeDetails) {\n emit(\"inputValueChange\", value, details)\n if (!details.canceled) emit(\"update:inputValue\", value)\n },\n onSelect: (value: string, details: ChangeDetails) => emit(\"select\", value, details),\n }))\n )\n return () => h(RootElement, attrs, slots)\n },\n})\n\nconst EmptyElement = partComponent(\"CommandEmptyElement\", \"div\", () => scope.use().emptyPart)\n\n/** Drawn while no item is shown for what was typed. */\nconst Empty = defineComponent({\n name: \"CommandEmpty\",\n inheritAttrs: false,\n setup(_props, { attrs, slots }) {\n const empty = fromSignal(scope.use().empty)\n return () => (empty.value ? h(EmptyElement, attrs, slots) : null)\n },\n})\n\n/** Items under a `<Command.GroupHeading>`. Hidden while none of them is shown. */\nconst Group = defineComponent({\n name: \"CommandGroup\",\n inheritAttrs: false,\n props: { id: String },\n setup(props, { attrs, slots }) {\n const generated = useId()\n const group = scope.use().group(props.id ?? generated)\n provide(GROUP, group)\n const Element = partComponent(\"CommandGroupElement\", \"div\", () => group.part)\n return () => h(Element, attrs, slots)\n },\n})\n\nconst GroupHeading = defineComponent({\n name: \"CommandGroupHeading\",\n inheritAttrs: false,\n setup(_props, { attrs, slots }) {\n const part = inject(GROUP, undefined)?.heading ?? scope.use().heading\n const Element = partComponent(\"CommandGroupHeadingElement\", \"div\", () => part)\n return () => h(Element, attrs, slots)\n },\n})\n\n/** `label` is what is filtered, the item's text when left out; `keywords` are other words for it. */\nconst Item = defineComponent({\n name: \"CommandItem\",\n inheritAttrs: false,\n props: {\n value: { type: String, required: true },\n disabled: optional(Boolean),\n label: String,\n keywords: Array as PropType<readonly string[]>,\n id: String,\n },\n setup(props, { attrs, slots }) {\n const generated = useId()\n const options = toSignal(() => ({\n disabled: props.disabled,\n label: props.label,\n keywords: props.keywords,\n id: props.id ?? generated,\n }))\n const part = scope.use().item(props.value, () => options.get(), inject(GROUP, undefined))\n const Element = partComponent(\"CommandItemElement\", \"div\", () => part)\n return () => h(Element, attrs, slots)\n },\n})\n\n/** A line between groups: gone while something is typed, unless `always-render`. */\nconst Separator = defineComponent({\n name: \"CommandSeparator\",\n inheritAttrs: false,\n props: { alwaysRender: Boolean },\n setup(props, { attrs, slots }) {\n const options = toSignal(() => ({ alwaysRender: props.alwaysRender }))\n const part = scope.use().separator(() => options.get().alwaysRender)\n const Element = partComponent(\"CommandSeparatorElement\", \"div\", () => part)\n return () => h(Element, attrs, slots)\n },\n})\n\nexport const Command = {\n Root,\n Input: partComponent(\"CommandInput\", \"input\", () => scope.use().input),\n List: partComponent(\"CommandList\", \"div\", () => scope.use().list),\n Empty,\n Group,\n GroupHeading,\n Item,\n Separator,\n}\n"],"mappings":";;;;AAQA,MAAM,QAAQ,QAAoB,SAAS;AAC3C,MAAM,QAAoC,OAAO,cAAc;AAE/D,MAAM,cAAc,cAAc,sBAAsB,aAAa,MAAM,IAAI,CAAC,CAAC,IAAI;;AAGrF,MAAM,OAAO,gBAAgB;CAC3B,MAAM;CACN,cAAc;CACd,OAAO;EACL,YAAY;EACZ,mBAAmB;EACnB,QAAQ;GACN,MAAM;GACN,SAA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MAAM,IAAI,CAAC,CAAC,IAAI;CAChE;CACA;CACA;CACA;CACA;AACF"}
1
+ {"version":3,"file":"command.js","names":[],"sources":["../../../../packages/vue/src/command.ts"],"sourcesContent":["import type { ChangeDetails } from \"@kirana-ui/core\"\nimport { createCommand } from \"@kirana-ui/core/command\"\nimport type {\n CommandGroup,\n CommandItemOptions,\n CommandProps,\n Command as Controller,\n} from \"@kirana-ui/core/command\"\nimport { defineComponent, h, inject, provide, useId } from \"vue\"\nimport type { InjectionKey, PropType } from \"vue\"\n\nimport { context, controller, fromSignal, optional, partComponent, toSignal } from \"./runtime.ts\"\nimport type { Changes, PartComponent, PartComponentProps, StatesOf } from \"./runtime.ts\"\n\ntype State = StatesOf<\"command\">\n\nconst scope = context<Controller>(\"Command\")\nconst GROUP: InjectionKey<CommandGroup> = Symbol(\"CommandGroup\")\n\nconst RootElement = partComponent(\"CommandRootElement\", \"div\", () => scope.use().root)\n\nexport type RootProps = Omit<CommandProps, \"id\" | \"onInputValueChange\" | \"onSelect\"> & {\n id?: string | undefined\n} & PartComponentProps\n\nexport type RootEmits = Changes<\"inputValue\", string> & {\n /** An item was chosen: its value. */\n select: (value: string, details: ChangeDetails) => void\n}\n\n/** `v-model:inputValue`; `@select` hears the item chosen. */\nconst Root = defineComponent({\n name: \"CommandRoot\",\n inheritAttrs: false,\n props: {\n inputValue: String,\n defaultInputValue: String,\n filter: {\n type: null as unknown as PropType<CommandProps[\"filter\"]>,\n default: undefined,\n },\n loop: Boolean,\n disabled: Boolean,\n id: String,\n },\n emits: [\"update:inputValue\", \"inputValueChange\", \"select\"],\n setup(props, { attrs, slots, emit }) {\n const generated = useId()\n scope.provide(\n controller(createCommand, () => ({\n id: props.id ?? generated,\n inputValue: props.inputValue,\n defaultInputValue: props.defaultInputValue,\n filter: props.filter,\n loop: props.loop,\n disabled: props.disabled,\n onInputValueChange(value: string, details: ChangeDetails) {\n emit(\"inputValueChange\", value, details)\n if (!details.canceled) emit(\"update:inputValue\", value)\n },\n onSelect: (value: string, details: ChangeDetails) => emit(\"select\", value, details),\n }))\n )\n return () => h(RootElement, attrs, slots)\n },\n}) as unknown as PartComponent<\"div\", State[\"root\"], RootProps, RootEmits>\n\nconst EmptyElement = partComponent(\"CommandEmptyElement\", \"div\", () => scope.use().emptyPart)\n\nexport type EmptyProps = PartComponentProps\n\n/** Drawn while no item is shown for what was typed. */\nconst Empty = defineComponent({\n name: \"CommandEmpty\",\n inheritAttrs: false,\n setup(_props, { attrs, slots }) {\n const empty = fromSignal(scope.use().empty)\n return () => (empty.value ? h(EmptyElement, attrs, slots) : null)\n },\n}) as unknown as PartComponent<\"div\", State[\"empty\"], EmptyProps>\n\nexport interface GroupProps extends PartComponentProps {\n id?: string | undefined\n}\n\n/** Items under a `<Command.GroupHeading>`. Hidden while none of them is shown. */\nconst Group = defineComponent({\n name: \"CommandGroup\",\n inheritAttrs: false,\n props: { id: String },\n setup(props, { attrs, slots }) {\n const generated = useId()\n const group = scope.use().group(props.id ?? generated)\n provide(GROUP, group)\n const Element = partComponent(\"CommandGroupElement\", \"div\", () => group.part)\n return () => h(Element, attrs, slots)\n },\n}) as unknown as PartComponent<\"div\", State[\"group\"], GroupProps>\n\nexport type GroupHeadingProps = PartComponentProps\n\nconst GroupHeading = defineComponent({\n name: \"CommandGroupHeading\",\n inheritAttrs: false,\n setup(_props, { attrs, slots }) {\n const part = inject(GROUP, undefined)?.heading ?? scope.use().heading\n const Element = partComponent(\"CommandGroupHeadingElement\", \"div\", () => part)\n return () => h(Element, attrs, slots)\n },\n}) as unknown as PartComponent<\"div\", State[\"groupHeading\"], GroupHeadingProps>\n\nexport interface ItemProps extends Omit<CommandItemOptions, \"id\">, PartComponentProps {\n /** What `@select` is told when this item is chosen. */\n value: string\n id?: string | undefined\n}\n\n/** `label` is what is filtered, the item's text when left out; `keywords` are other words for it. */\nconst Item = defineComponent({\n name: \"CommandItem\",\n inheritAttrs: false,\n props: {\n value: { type: String, required: true },\n disabled: optional(Boolean),\n label: String,\n keywords: Array as PropType<readonly string[]>,\n id: String,\n },\n setup(props, { attrs, slots }) {\n const generated = useId()\n const options = toSignal(() => ({\n disabled: props.disabled,\n label: props.label,\n keywords: props.keywords,\n id: props.id ?? generated,\n }))\n const part = scope.use().item(props.value, () => options.get(), inject(GROUP, undefined))\n const Element = partComponent(\"CommandItemElement\", \"div\", () => part)\n return () => h(Element, attrs, slots)\n },\n}) as unknown as PartComponent<\"div\", State[\"item\"], ItemProps>\n\nexport interface SeparatorProps extends PartComponentProps {\n /** Keeps the line while something is typed. */\n alwaysRender?: boolean | undefined\n}\n\n/** A line between groups: gone while something is typed, unless `always-render`. */\nconst Separator = defineComponent({\n name: \"CommandSeparator\",\n inheritAttrs: false,\n props: { alwaysRender: Boolean },\n setup(props, { attrs, slots }) {\n const options = toSignal(() => ({ alwaysRender: props.alwaysRender }))\n const part = scope.use().separator(() => options.get().alwaysRender)\n const Element = partComponent(\"CommandSeparatorElement\", \"div\", () => part)\n return () => h(Element, attrs, slots)\n },\n}) as unknown as PartComponent<\"div\", State[\"separator\"], SeparatorProps>\n\nexport type InputProps = PartComponentProps\nexport type ListProps = PartComponentProps\nexport const Command = {\n Root,\n Input: partComponent<\"input\", State[\"input\"]>(\"CommandInput\", \"input\", () => scope.use().input),\n List: partComponent<\"div\", State[\"list\"]>(\"CommandList\", \"div\", () => scope.use().list),\n Empty,\n Group,\n GroupHeading,\n Item,\n Separator,\n}\n"],"mappings":";;;;AAgBA,MAAM,QAAQ,QAAoB,SAAS;AAC3C,MAAM,QAAoC,OAAO,cAAc;AAE/D,MAAM,cAAc,cAAc,sBAAsB,aAAa,MAAM,IAAI,CAAC,CAAC,IAAI;;AAYrF,MAAM,OAAO,gBAAgB;CAC3B,MAAM;CACN,cAAc;CACd,OAAO;EACL,YAAY;EACZ,mBAAmB;EACnB,QAAQ;GACN,MAAM;GACN,SAAS,KAAA;EACX;EACA,MAAM;EACN,UAAU;EACV,IAAI;CACN;CACA,OAAO;EAAC;EAAqB;EAA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4 @@
1
- import { ContextMenu } from "./menu.js";
2
- export { ContextMenu };
1
+ import { PortalProps } from "./runtime.js";
2
+ import { PositionerProps } from "./popover.js";
3
+ import { ArrowProps, CheckboxItemEmits, CheckboxItemIndicatorProps, CheckboxItemProps, ContextMenu, ContextRootProps, ContextTriggerProps, GroupLabelProps, GroupProps, ItemProps, LinkItemProps, Menu, PopupProps, RadioGroupEmits, RadioGroupProps, RadioItemIndicatorProps, RadioItemProps, RootEmits, SeparatorProps, SubmenuRootEmits, SubmenuRootProps, SubmenuTriggerProps } from "./menu.js";
4
+ export { type ArrowProps, type CheckboxItemEmits, type CheckboxItemIndicatorProps, type CheckboxItemProps, ContextMenu, type ContextRootProps, type ContextTriggerProps, type GroupLabelProps, type GroupProps, type ItemProps, type LinkItemProps, type Menu, type PopupProps, type PortalProps, type PositionerProps, type RadioGroupEmits, type RadioGroupProps, type RadioItemIndicatorProps, type RadioItemProps, type RootEmits, type ContextRootProps as RootProps, type SeparatorProps, type SubmenuRootEmits, type SubmenuRootProps, type SubmenuTriggerProps, type ContextTriggerProps as TriggerProps };
@@ -1,70 +1,40 @@
1
- import { PropType } from "vue";
1
+ import { Changes, PartComponent, PartComponentProps, PlainComponent } from "./runtime.js";
2
2
  import { DateField as DateField$1, DateFieldProps, DateFieldSegment } from "@kirana-ui/core/date-field";
3
+ /**
4
+ * The date field its parts are inside. Exported for a component that is made of one (a date picker
5
+ * provides its own to the date field's parts).
6
+ */
3
7
  declare const scope: {
4
8
  provide(controller: DateField$1): DateField$1;
5
9
  use(): DateField$1;
6
10
  };
11
+ export type RootProps = Omit<DateFieldProps, "id" | "onValueChange"> & {
12
+ id?: string | undefined;
13
+ } & PartComponentProps;
14
+ /** The value is `null` while the date is not whole. */
15
+ export type RootEmits = Changes<"value", string | null>;
16
+ export type SegmentsProps = Record<never, never>;
17
+ export interface SegmentProps extends PartComponentProps {
18
+ /** The piece it draws, as `DateField.Segments` gives it. */
19
+ segment: DateFieldSegment;
20
+ }
21
+ export type InputProps = PartComponentProps;
7
22
  export declare const DateField: {
8
- Root: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
9
- value: {
10
- type: PropType<string | null>;
11
- default: undefined;
12
- };
13
- defaultValue: PropType<string | null>;
14
- locale: StringConstructor;
15
- min: StringConstructor;
16
- max: StringConstructor;
17
- placeholders: PropType<DateFieldProps["placeholders"]>;
18
- disabled: BooleanConstructor;
19
- readOnly: BooleanConstructor;
20
- required: BooleanConstructor;
21
- name: StringConstructor;
22
- form: StringConstructor;
23
- id: StringConstructor;
24
- }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
25
- [key: string]: any;
26
- }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:value" | "valueChange")[], "update:value" | "valueChange", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
27
- value: {
28
- type: PropType<string | null>;
29
- default: undefined;
30
- };
31
- defaultValue: PropType<string | null>;
32
- locale: StringConstructor;
33
- min: StringConstructor;
34
- max: StringConstructor;
35
- placeholders: PropType<DateFieldProps["placeholders"]>;
36
- disabled: BooleanConstructor;
37
- readOnly: BooleanConstructor;
38
- required: BooleanConstructor;
39
- name: StringConstructor;
40
- form: StringConstructor;
41
- id: StringConstructor;
42
- }>> & Readonly<{
43
- "onUpdate:value"?: ((...args: any[]) => any) | undefined;
44
- onValueChange?: ((...args: any[]) => any) | undefined;
45
- }>, {
46
- value: string | null;
47
- disabled: boolean;
48
- readOnly: boolean;
49
- required: boolean;
50
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
51
- Segments: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
52
- [key: string]: any;
53
- }>[], {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
54
- Segment: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
55
- segment: {
56
- type: PropType<DateFieldSegment>;
57
- required: true;
58
- };
59
- }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
60
- [key: string]: any;
61
- }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
62
- segment: {
63
- type: PropType<DateFieldSegment>;
64
- required: true;
65
- };
66
- }>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
67
- Input: import("vue").Component;
23
+ Root: PartComponent<"div", {
24
+ readonly disabled?: true | undefined;
25
+ readonly readonly?: true | undefined;
26
+ readonly invalid?: true | undefined;
27
+ }, RootProps, RootEmits>;
28
+ Segments: PlainComponent<SegmentsProps, {}, {
29
+ segment: DateFieldSegment;
30
+ }>;
31
+ Segment: PartComponent<"span", {
32
+ readonly segment?: "day" | "literal" | "month" | "year" | undefined;
33
+ readonly placeholder?: true | undefined;
34
+ readonly disabled?: true | undefined;
35
+ readonly invalid?: true | undefined;
36
+ }, SegmentProps>;
37
+ Input: PartComponent<"input", Record<never, never>, PartComponentProps, {}, unknown>;
68
38
  };
69
39
  export { scope as dateFieldScope };
70
40
  //# sourceMappingURL=date-field.d.ts.map
package/src/date-field.js CHANGED
@@ -4,6 +4,10 @@ import { within } from "@kirana-ui/core";
4
4
  import { Fragment, defineComponent, h, useId } from "vue";
5
5
  import { createDateField } from "@kirana-ui/core/date-field";
6
6
  // src/date-field.ts
7
+ /**
8
+ * The date field its parts are inside. Exported for a component that is made of one (a date picker
9
+ * provides its own to the date field's parts).
10
+ */
7
11
  const scope = context("DateField");
8
12
  const RootElement = partComponent("DateFieldRootElement", "div", () => scope.use().root);
9
13
  const DateField = {
@@ -63,11 +67,11 @@ const DateField = {
63
67
  type: Object,
64
68
  required: true
65
69
  } },
66
- setup(props, { attrs }) {
70
+ setup(props, { attrs, slots }) {
67
71
  const { part, text } = scope.use().segment(props.segment);
68
72
  const shown = fromSignal(text);
69
- const Element = partComponent("DateFieldSegmentElement", "span", () => part);
70
- return () => h(Element, attrs, () => shown.value);
73
+ const Element = partComponent("DateFieldSegmentElement", "span", () => part, (content, composed) => composed && content != null && content.length > 0 ? content : [shown.value]);
74
+ return () => h(Element, attrs, slots);
71
75
  }
72
76
  }),
73
77
  Input: partComponent("DateFieldInput", "input", () => scope.use().input)
@@ -1 +1 @@
1
- {"version":3,"file":"date-field.js","names":[],"sources":["../../../../packages/vue/src/date-field.ts"],"sourcesContent":["import { within } from \"@kirana-ui/core\"\nimport type { ChangeDetails } from \"@kirana-ui/core\"\nimport { createDateField } from \"@kirana-ui/core/date-field\"\nimport type {\n DateField as Controller,\n DateFieldProps,\n DateFieldSegment,\n} from \"@kirana-ui/core/date-field\"\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>(\"DateField\")\n/** For a component made of this one's parts: a date picker. */\nexport { scope as dateFieldScope }\n\nconst RootElement = partComponent(\"DateFieldRootElement\", \"div\", () => scope.use().root)\n\n/** `v-model:value`, and `@value-change=\"(value, details) => …\"`. */\nconst Root = defineComponent({\n name: \"DateFieldRoot\",\n inheritAttrs: false,\n props: {\n value: optional([String, null] as unknown as PropType<string | null>),\n defaultValue: String as PropType<string | null>,\n locale: String,\n min: String,\n max: String,\n placeholders: Object as PropType<DateFieldProps[\"placeholders\"]>,\n disabled: Boolean,\n readOnly: Boolean,\n required: Boolean,\n name: String,\n form: String,\n id: String,\n },\n emits: [\"update:value\", \"valueChange\"],\n setup(props, { attrs, slots, emit }) {\n const generated = useId()\n const direction = useDirectionAround()\n scope.provide(\n controller(within(createDateField, { direction }), () => ({\n id: props.id ?? generated,\n value: props.value,\n defaultValue: props.defaultValue,\n locale: props.locale,\n min: props.min,\n max: props.max,\n placeholders: props.placeholders,\n disabled: props.disabled,\n readOnly: props.readOnly,\n required: props.required,\n name: props.name,\n form: props.form,\n onValueChange(value: string | null, details: ChangeDetails) {\n emit(\"valueChange\", value, details)\n if (!details.canceled) emit(\"update:value\", value)\n },\n }))\n )\n return () => h(RootElement, attrs, slots)\n },\n})\n\n/** Its slot once for each piece of the date, in the locale's order: `v-slot=\"{ segment }\"`. */\nconst Segments = defineComponent({\n name: \"DateFieldSegments\",\n setup(_, { slots }) {\n const segments = fromSignal(scope.use().segments)\n return () =>\n segments.value.map((segment) =>\n h(Fragment, { key: `${segment.index}-${segment.type}` }, slots.default?.({ segment }))\n )\n },\n})\n\n/** One piece: a part that is typed, or what stands between two. It writes its own text. */\nconst Segment = defineComponent({\n name: \"DateFieldSegment\",\n inheritAttrs: false,\n props: { segment: { type: Object as PropType<DateFieldSegment>, required: true } },\n setup(props, { attrs }) {\n const { part, text } = scope.use().segment(props.segment)\n const shown = fromSignal(text)\n const Element = partComponent(\"DateFieldSegmentElement\", \"span\", () => part)\n return () => h(Element, attrs, () => shown.value)\n },\n})\n\nconst Input = partComponent(\"DateFieldInput\", \"input\", () => scope.use().input)\n\nexport const DateField = { Root, Segments, Segment, Input }\n"],"mappings":";;;;;;AAcA,MAAM,QAAQ,QAAoB,WAAW;AAI7C,MAAM,cAAc,cAAc,wBAAwB,aAAa,MAAM,IAAI,CAAC,CAAC,IAAI;AA2EvF,MAAa,YAAY;CAAE,MAxEd,gBAAgB;EAC3B,MAAM;EACN,cAAc;EACd,OAAO;GACL,OAAO,SAAS,CAAC,QAAQ,IAAI,CAAuC;GACpE,cAAc;GACd,QAAQ;GACR,KAAK;GACL,KAAK;GACL,cAAc;GACd,UAAU;GACV,UAAU;GACV,UAAU;GACV,MAAM;GACN,MAAM;GACN,IAAI;EACN;EACA,OAAO,CAAC,gBAAgB,aAAa;EACrC,MAAM,OAAO,EAAE,OAAO,OAAO,QAAQ;GACnC,MAAM,YAAY,MAAM;GACxB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../../../../packages/vue/src/date-field.ts"],"sourcesContent":["import { within } from \"@kirana-ui/core\"\nimport type { ChangeDetails } from \"@kirana-ui/core\"\nimport { createDateField } from \"@kirana-ui/core/date-field\"\nimport type {\n DateField as Controller,\n DateFieldProps,\n DateFieldSegment,\n} from \"@kirana-ui/core/date-field\"\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\"\nimport type {\n Changes,\n PartComponent,\n PartComponentProps,\n PlainComponent,\n StatesOf,\n} from \"./runtime.ts\"\n\ntype State = StatesOf<\"dateField\">\n\n/**\n * The date field its parts are inside. Exported for a component that is made of one (a date picker\n * provides its own to the date field's parts).\n */\nconst scope = context<Controller>(\"DateField\")\n/** For a component made of this one's parts: a date picker. */\nexport { scope as dateFieldScope }\n\nconst RootElement = partComponent(\"DateFieldRootElement\", \"div\", () => scope.use().root)\n\nexport type RootProps = Omit<DateFieldProps, \"id\" | \"onValueChange\"> & {\n id?: string | undefined\n} & PartComponentProps\n\n/** The value is `null` while the date is not whole. */\nexport type RootEmits = Changes<\"value\", string | null>\n\n/** `v-model:value`, and `@value-change=\"(value, details) => …\"`. */\nconst Root = defineComponent({\n name: \"DateFieldRoot\",\n inheritAttrs: false,\n props: {\n value: optional([String, null] as unknown as PropType<string | null>),\n defaultValue: String as PropType<string | null>,\n locale: String,\n min: String,\n max: String,\n placeholders: Object as PropType<DateFieldProps[\"placeholders\"]>,\n disabled: Boolean,\n readOnly: Boolean,\n required: Boolean,\n name: String,\n form: String,\n id: String,\n },\n emits: [\"update:value\", \"valueChange\"],\n setup(props, { attrs, slots, emit }) {\n const generated = useId()\n const direction = useDirectionAround()\n scope.provide(\n controller(within(createDateField, { direction }), () => ({\n id: props.id ?? generated,\n value: props.value,\n defaultValue: props.defaultValue,\n locale: props.locale,\n min: props.min,\n max: props.max,\n placeholders: props.placeholders,\n disabled: props.disabled,\n readOnly: props.readOnly,\n required: props.required,\n name: props.name,\n form: props.form,\n onValueChange(value: string | null, details: ChangeDetails) {\n emit(\"valueChange\", value, details)\n if (!details.canceled) emit(\"update:value\", value)\n },\n }))\n )\n return () => h(RootElement, attrs, slots)\n },\n}) as unknown as PartComponent<\"div\", State[\"root\"], RootProps, RootEmits>\n\nexport type SegmentsProps = Record<never, never>\n\n/** Its slot once for each piece of the date, in the locale's order: `v-slot=\"{ segment }\"`. */\nconst Segments = defineComponent({\n name: \"DateFieldSegments\",\n setup(_, { slots }) {\n const segments = fromSignal(scope.use().segments)\n return () =>\n segments.value.map((segment) =>\n h(Fragment, { key: `${segment.index}-${segment.type}` }, slots.default?.({ segment }))\n )\n },\n}) as unknown as PlainComponent<SegmentsProps, {}, { segment: DateFieldSegment }>\n\nexport interface SegmentProps extends PartComponentProps {\n /** The piece it draws, as `DateField.Segments` gives it. */\n segment: DateFieldSegment\n}\n\n/** One piece: a part that is typed, or what stands between two. It writes its own text. */\nconst Segment = defineComponent({\n name: \"DateFieldSegment\",\n inheritAttrs: false,\n props: { segment: { type: Object as PropType<DateFieldSegment>, required: true } },\n setup(props, { attrs, slots }) {\n const { part, text } = scope.use().segment(props.segment)\n const shown = fromSignal(text)\n // Its text is the field's to write, whatever its slot holds: with `as-child` the slot is\n // the caller's element, which holds the text unless it writes its own.\n const Element = partComponent(\n \"DateFieldSegmentElement\",\n \"span\",\n () => part,\n (content, composed) =>\n composed && content != null && content.length > 0 ? content : [shown.value]\n )\n return () => h(Element, attrs, slots)\n },\n}) as unknown as PartComponent<\"span\", State[\"segment\"], SegmentProps>\n\nexport type InputProps = PartComponentProps\nconst Input = partComponent<\"input\", State[\"input\"]>(\n \"DateFieldInput\",\n \"input\",\n () => scope.use().input\n)\n\nexport const DateField = { Root, Segments, Segment, Input }\n"],"mappings":";;;;;;;;;;AA2BA,MAAM,QAAQ,QAAoB,WAAW;AAI7C,MAAM,cAAc,cAAc,wBAAwB,aAAa,MAAM,IAA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AAsC,UAAU;EAAK,EAAE;EACjF,MAAM,OAAO,EAAE,OAAO,SAAS;GAC7B,MAAM,EAAE,MAAM,SAAS,MAAM,IAAI,CAAC,CAAC,QAAQ,MAAM,OAAO;GACxD,MAAM,QAAQ,WAAW,IAAI;GAG7B,MAAM,UAAU,cACd,2BACA,cACM,OACL,SAAS,aACR,YAAY,WAAW,QAAQ,QAAQ,SAAS,IAAI,UAAU,CAAC,MAAM,KAAK,CAC9E;GACA,aAAa,EAAE,SAAS,OAAO,KAAK;EACtC;CACF,CAS2C;CAAS,OANtC,cACZ,kBACA,eACM,MAAM,IAAI,CAAC,CAAC,KAGgC;AAAM"}
@@ -1,145 +1,89 @@
1
- import { PropType } from "vue";
1
+ import { Changes, PartComponent, PartComponentProps, PlainComponent, PortalProps } from "./runtime.js";
2
+ import { InputProps, SegmentProps, SegmentsProps } from "./date-field.js";
3
+ import { PopupProps, PositionerProps, TriggerProps } from "./popover.js";
4
+ import { CellProps, DayProps, GridProps, HeadCellProps, HeadingProps, NextProps, PreviousProps, WeekdaysProps, WeeksProps } from "./calendar.js";
2
5
  import { DatePickerProps } from "@kirana-ui/core/date-picker";
6
+ export type RootProps = Omit<DatePickerProps, "id" | "onValueChange" | "onOpenChange"> & {
7
+ id?: string | undefined;
8
+ };
9
+ /** The value is `null` while the date is not whole. */
10
+ export type RootEmits = Changes<"value", string | null> & Changes<"open", boolean>;
11
+ export type FieldProps = PartComponentProps;
12
+ export type CalendarProps = PartComponentProps;
3
13
  export declare const DatePicker: {
4
- Root: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
5
- value: {
6
- type: PropType<string | null>;
7
- default: undefined;
8
- };
9
- defaultValue: PropType<string | null>;
10
- open: {
11
- type: BooleanConstructor;
12
- default: undefined;
13
- };
14
- defaultOpen: BooleanConstructor;
15
- locale: StringConstructor;
16
- min: StringConstructor;
17
- max: StringConstructor;
18
- isDateUnavailable: PropType<DatePickerProps["isDateUnavailable"]>;
19
- calendarSystem: PropType<DatePickerProps["calendarSystem"]>;
20
- fixedWeeks: BooleanConstructor;
21
- placeholders: PropType<DatePickerProps["placeholders"]>;
22
- disabled: BooleanConstructor;
23
- readOnly: BooleanConstructor;
24
- required: BooleanConstructor;
25
- name: StringConstructor;
26
- form: StringConstructor;
27
- id: StringConstructor;
28
- }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
29
- [key: string]: any;
30
- }>[] | undefined, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("openChange" | "update:open" | "update:value" | "valueChange")[], "openChange" | "update:open" | "update:value" | "valueChange", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
31
- value: {
32
- type: PropType<string | null>;
33
- default: undefined;
34
- };
35
- defaultValue: PropType<string | null>;
36
- open: {
37
- type: BooleanConstructor;
38
- default: undefined;
39
- };
40
- defaultOpen: BooleanConstructor;
41
- locale: StringConstructor;
42
- min: StringConstructor;
43
- max: StringConstructor;
44
- isDateUnavailable: PropType<DatePickerProps["isDateUnavailable"]>;
45
- calendarSystem: PropType<DatePickerProps["calendarSystem"]>;
46
- fixedWeeks: BooleanConstructor;
47
- placeholders: PropType<DatePickerProps["placeholders"]>;
48
- disabled: BooleanConstructor;
49
- readOnly: BooleanConstructor;
50
- required: BooleanConstructor;
51
- name: StringConstructor;
52
- form: StringConstructor;
53
- id: StringConstructor;
54
- }>> & Readonly<{
55
- onOpenChange?: ((...args: any[]) => any) | undefined;
56
- "onUpdate:open"?: ((...args: any[]) => any) | undefined;
57
- "onUpdate:value"?: ((...args: any[]) => any) | undefined;
58
- onValueChange?: ((...args: any[]) => any) | undefined;
59
- }>, {
60
- value: string | null;
61
- open: boolean;
62
- defaultOpen: boolean;
63
- fixedWeeks: boolean;
64
- disabled: boolean;
65
- readOnly: boolean;
66
- required: boolean;
67
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
14
+ Root: PlainComponent<RootProps, RootEmits>;
68
15
  /** The typed date: what holds its segments and its hidden input. */
69
- Field: import("vue").Component;
70
- Segments: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
71
- [key: string]: any;
72
- }>[], {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
73
- Segment: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
74
- segment: {
75
- type: PropType<import("@kirana-ui/core/date-field").DateFieldSegment>;
76
- required: true;
77
- };
78
- }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
79
- [key: string]: any;
80
- }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
81
- segment: {
82
- type: PropType<import("@kirana-ui/core/date-field").DateFieldSegment>;
83
- required: true;
84
- };
85
- }>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
86
- Input: import("vue").Component;
87
- Trigger: import("vue").Component;
88
- Portal: import("vue").Component;
89
- Positioner: import("vue").Component;
90
- Popup: import("vue").Component;
16
+ Field: PartComponent<"div", {
17
+ readonly disabled?: true | undefined;
18
+ readonly readonly?: true | undefined;
19
+ readonly invalid?: true | undefined;
20
+ }, PartComponentProps, {}, unknown>;
21
+ Segments: PlainComponent<SegmentsProps, {}, {
22
+ segment: import("@kirana-ui/core/date-field").DateFieldSegment;
23
+ }>;
24
+ Segment: PartComponent<"span", {
25
+ readonly segment?: "day" | "literal" | "month" | "year" | undefined;
26
+ readonly placeholder?: true | undefined;
27
+ readonly disabled?: true | undefined;
28
+ readonly invalid?: true | undefined;
29
+ }, SegmentProps>;
30
+ Input: PartComponent<"input", Record<never, never>, PartComponentProps, {}, unknown>;
31
+ Trigger: PartComponent<"button", {
32
+ readonly popupOpen?: true | undefined;
33
+ }, PartComponentProps, {}, unknown>;
34
+ Portal: PlainComponent<PortalProps, {}, {}>;
35
+ Positioner: PartComponent<"div", {
36
+ readonly open?: true | undefined;
37
+ readonly closed?: true | undefined;
38
+ readonly side?: "bottom" | "inline-end" | "inline-start" | "left" | "right" | "top" | undefined;
39
+ readonly align?: "center" | "end" | "start" | undefined;
40
+ }, PositionerProps>;
41
+ Popup: PartComponent<"div", {
42
+ readonly open?: true | undefined;
43
+ readonly closed?: true | undefined;
44
+ readonly startingStyle?: true | undefined;
45
+ readonly endingStyle?: true | undefined;
46
+ readonly side?: "bottom" | "inline-end" | "inline-start" | "left" | "right" | "top" | undefined;
47
+ readonly align?: "center" | "end" | "start" | undefined;
48
+ }, PartComponentProps, {}, unknown>;
91
49
  /** The calendar: what holds its heading, its buttons and its grid. */
92
- Calendar: import("vue").Component;
93
- Heading: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
94
- [key: string]: any;
95
- }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
96
- Previous: import("vue").Component;
97
- Next: import("vue").Component;
98
- Grid: import("vue").Component;
99
- Weekdays: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
100
- [key: string]: any;
101
- }>[], {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
102
- HeadCell: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
103
- weekday: {
104
- type: PropType<import("@kirana-ui/core/calendar").CalendarWeekday>;
105
- required: true;
106
- };
107
- }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
108
- [key: string]: any;
109
- }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
110
- weekday: {
111
- type: PropType<import("@kirana-ui/core/calendar").CalendarWeekday>;
112
- required: true;
113
- };
114
- }>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
115
- Weeks: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
116
- [key: string]: any;
117
- }>[], {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
118
- Cell: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
119
- date: {
120
- type: StringConstructor;
121
- required: true;
122
- };
123
- }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
124
- [key: string]: any;
125
- }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
126
- date: {
127
- type: StringConstructor;
128
- required: true;
129
- };
130
- }>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
131
- Day: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
132
- date: {
133
- type: StringConstructor;
134
- required: true;
135
- };
136
- }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
137
- [key: string]: any;
138
- }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
139
- date: {
140
- type: StringConstructor;
141
- required: true;
142
- };
143
- }>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
50
+ Calendar: PartComponent<"div", {
51
+ readonly disabled?: true | undefined;
52
+ readonly readonly?: true | undefined;
53
+ }, PartComponentProps, {}, unknown>;
54
+ Heading: PartComponent<"div", Record<never, never>, PartComponentProps>;
55
+ Previous: PartComponent<"button", {
56
+ readonly disabled?: true | undefined;
57
+ }, PartComponentProps, {}, unknown>;
58
+ Next: PartComponent<"button", {
59
+ readonly disabled?: true | undefined;
60
+ }, PartComponentProps, {}, unknown>;
61
+ Grid: PartComponent<"table", Record<never, never>, PartComponentProps, {}, unknown>;
62
+ Weekdays: PlainComponent<WeekdaysProps, {}, {
63
+ weekday: import("@kirana-ui/core/calendar").CalendarWeekday;
64
+ }>;
65
+ HeadCell: PartComponent<"th", Record<never, never>, HeadCellProps>;
66
+ Weeks: PlainComponent<WeeksProps, {}, {
67
+ week: readonly import("@kirana-ui/core/calendar").CalendarDay[];
68
+ }>;
69
+ Cell: PartComponent<"td", {
70
+ readonly selected?: true | undefined;
71
+ readonly today?: true | undefined;
72
+ readonly outsideMonth?: true | undefined;
73
+ readonly disabled?: true | undefined;
74
+ readonly unavailable?: true | undefined;
75
+ readonly rangeStart?: true | undefined;
76
+ readonly rangeEnd?: true | undefined;
77
+ }, CellProps>;
78
+ Day: PartComponent<"button", {
79
+ readonly selected?: true | undefined;
80
+ readonly today?: true | undefined;
81
+ readonly outsideMonth?: true | undefined;
82
+ readonly disabled?: true | undefined;
83
+ readonly unavailable?: true | undefined;
84
+ readonly rangeStart?: true | undefined;
85
+ readonly rangeEnd?: true | undefined;
86
+ }, CellProps>;
144
87
  };
88
+ export type { CellProps, DayProps, GridProps, HeadCellProps, HeadingProps, InputProps, NextProps, PopupProps, PortalProps, PositionerProps, PreviousProps, SegmentProps, SegmentsProps, TriggerProps, WeekdaysProps, WeeksProps };
145
89
  //# sourceMappingURL=date-picker.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"date-picker.js","names":[],"sources":["../../../../packages/vue/src/date-picker.ts"],"sourcesContent":["import { within } from \"@kirana-ui/core\"\nimport type { ChangeDetails } from \"@kirana-ui/core\"\nimport { createDatePicker } from \"@kirana-ui/core/date-picker\"\nimport type { DatePicker as Controller, DatePickerProps } from \"@kirana-ui/core/date-picker\"\nimport { defineComponent, useId } from \"vue\"\nimport type { PropType } from \"vue\"\n\nimport { Calendar, calendarScope } from \"./calendar.ts\"\nimport { DateField, dateFieldScope } from \"./date-field.ts\"\nimport { useDirectionAround } from \"./direction-context.ts\"\nimport { Popover, popoverScope } from \"./popover.ts\"\nimport { context, controller, optional, partComponent } from \"./runtime.ts\"\n\nconst scope = context<Controller>(\"DatePicker\")\n\n/**\n * A date field, and a calendar in a popover, with one value between them. It draws nothing.\n * `v-model:value`, `v-model:open`; the `-change` events carry the details.\n */\nconst Root = defineComponent({\n name: \"DatePickerRoot\",\n props: {\n value: optional([String, null] as unknown as PropType<string | null>),\n defaultValue: String as PropType<string | null>,\n open: optional(Boolean),\n defaultOpen: Boolean,\n locale: String,\n min: String,\n max: String,\n isDateUnavailable: Function as PropType<DatePickerProps[\"isDateUnavailable\"]>,\n calendarSystem: Object as PropType<DatePickerProps[\"calendarSystem\"]>,\n fixedWeeks: Boolean,\n placeholders: Object as PropType<DatePickerProps[\"placeholders\"]>,\n disabled: Boolean,\n readOnly: Boolean,\n required: Boolean,\n name: String,\n form: String,\n id: String,\n },\n emits: [\"update:value\", \"valueChange\", \"update:open\", \"openChange\"],\n setup(props, { slots, emit }) {\n const generated = useId()\n const made = scope.provide(\n controller(within(createDatePicker, { direction: useDirectionAround() }), () => ({\n ...props,\n id: props.id ?? generated,\n onValueChange(value: string | null, details: ChangeDetails) {\n emit(\"valueChange\", value, details)\n if (!details.canceled) emit(\"update:value\", value)\n },\n onOpenChange(open: boolean, details: ChangeDetails) {\n emit(\"openChange\", open, details)\n if (!details.canceled) emit(\"update:open\", open)\n },\n }))\n )\n dateFieldScope.provide(made.field)\n popoverScope.provide(made.popover)\n calendarScope.provide(made.calendar)\n return () => slots.default?.()\n },\n})\n\nexport const DatePicker = {\n Root,\n /** The typed date: what holds its segments and its hidden input. */\n Field: partComponent(\"DatePickerField\", \"div\", () => scope.use().field.root),\n Segments: DateField.Segments,\n Segment: DateField.Segment,\n Input: DateField.Input,\n Trigger: Popover.Trigger,\n Portal: Popover.Portal,\n Positioner: Popover.Positioner,\n Popup: Popover.Popup,\n /** The calendar: what holds its heading, its buttons and its grid. */\n Calendar: partComponent(\"DatePickerCalendar\", \"div\", () => scope.use().calendar.root),\n Heading: Calendar.Heading,\n Previous: Calendar.Previous,\n Next: Calendar.Next,\n Grid: Calendar.Grid,\n Weekdays: Calendar.Weekdays,\n HeadCell: Calendar.HeadCell,\n Weeks: Calendar.Weeks,\n Cell: Calendar.Cell,\n Day: Calendar.Day,\n}\n"],"mappings":";;;;;;;;;AAaA,MAAM,QAAQ,QAAoB,YAAY;AAmD9C,MAAa,aAAa;CACxB,MA9CW,gBAAgB;EAC3B,MAAM;EACN,OAAO;GACL,OAAO,SAAS,CAAC,QAAQ,IAAI,CAAuC;GACpE,cAAc;GACd,MAAM,SAAS,OAAO;GACtB,aAAa;GACb,QAAQ;GACR,KAAK;GACL,KAAK;GACL,mBAAmB;GACnB,gBAAgB;GAChB,YAAY;GACZ,cAAc;GACd,UAAU;GACV,UAAU;GACV,UAAU;GACV,MAAM;GACN,MAAM;GACN,IAAI;EACN;EACA,OAAO;GAAC;GAAgB;GAAe;GAAe;EAAY;EAClE,MAAM,OAAO,EAAE,OAAO,QAAQ;GAC5B,MAAM,YAAY,MAAM;GACxB,MAAM,OAAO,MAAM,QACjB,WAAW,OAAO,kBAAkB,EAAE,WAAW,mBAAmB,EAAE,CAAC,UAAU;IAC/E,GAAG;IACH,IAAI,MAAM,MAAM;IAChB,cAAc,OAAsB,SAAwB;KAC1D,KAAK,eAAe,OAAO,OAAO;KAClC,IAAI,CAAC,QAAQ,UAAU,KAAK,gBAAgB,KAAK;IACnD;IACA,aAAa,MAAe,SAAwB;KAClD,KAAK,cAAc,MAAM,OAAO;KAChC,IAAI,CAAC,QAAQ,UAAU,KAAK,eAAe,IAAI;IACjD;GACF,EAAE,CACJ;GACA,QAAe,QAAQ,KAAK,KAAK;GACjC,QAAa,QAAQ,KAAK,OAAO;GACjC,QAAc,QAAQ,KAAK,QAAQ;GACnC,aAAa,MAAM,UAAU;EAC/B;CACF,CAGE;;CAEA,OAAO,cAAc,mBAAmB,aAAa,MAAM,IAAI,CAAC,CAAC,MAAM,IAAI;CAC3E,UAAU,UAAU;CACpB,SAAS,UAAU;CACnB,OAAO,UAAU;CACjB,SAAS,QAAQ;CACjB,QAAQ,QAAQ;CAChB,YAAY,QAAQ;CACpB,OAAO,QAAQ;;CAEf,UAAU,cAAc,sBAAsB,aAAa,MAAM,IAAI,CAAC,CAAC,SAAS,IAAI;CACpF,SAAS,SAAS;CAClB,UAAU,SAAS;CACnB,MAAM,SAAS;CACf,MAAM,SAAS;CACf,UAAU,SAAS;CACnB,UAAU,SAAS;CACnB,OAAO,SAAS;CAChB,MAAM,SAAS;CACf,KAAK,SAAS;AAChB"}
1
+ {"version":3,"file":"date-picker.js","names":[],"sources":["../../../../packages/vue/src/date-picker.ts"],"sourcesContent":["import { within } from \"@kirana-ui/core\"\nimport type { ChangeDetails } from \"@kirana-ui/core\"\nimport { createDatePicker } from \"@kirana-ui/core/date-picker\"\nimport type { DatePicker as Controller, DatePickerProps } from \"@kirana-ui/core/date-picker\"\nimport { defineComponent, useId } from \"vue\"\nimport type { PropType } from \"vue\"\n\nimport { Calendar, calendarScope } from \"./calendar.ts\"\nimport { DateField, dateFieldScope } from \"./date-field.ts\"\nimport { useDirectionAround } from \"./direction-context.ts\"\nimport { Popover, popoverScope } from \"./popover.ts\"\nimport { context, controller, optional, partComponent } from \"./runtime.ts\"\nimport type { Changes, PartComponentProps, PlainComponent, StatesOf } from \"./runtime.ts\"\n\ntype State = StatesOf<\"datePicker\">\n\nconst scope = context<Controller>(\"DatePicker\")\n\nexport type RootProps = Omit<DatePickerProps, \"id\" | \"onValueChange\" | \"onOpenChange\"> & {\n id?: string | undefined\n}\n\n/** The value is `null` while the date is not whole. */\nexport type RootEmits = Changes<\"value\", string | null> & Changes<\"open\", boolean>\n\n/**\n * A date field, and a calendar in a popover, with one value between them. It draws nothing.\n * `v-model:value`, `v-model:open`; the `-change` events carry the details.\n */\nconst Root = defineComponent({\n name: \"DatePickerRoot\",\n props: {\n value: optional([String, null] as unknown as PropType<string | null>),\n defaultValue: String as PropType<string | null>,\n open: optional(Boolean),\n defaultOpen: Boolean,\n locale: String,\n min: String,\n max: String,\n isDateUnavailable: Function as PropType<DatePickerProps[\"isDateUnavailable\"]>,\n calendarSystem: Object as PropType<DatePickerProps[\"calendarSystem\"]>,\n fixedWeeks: Boolean,\n placeholders: Object as PropType<DatePickerProps[\"placeholders\"]>,\n disabled: Boolean,\n readOnly: Boolean,\n required: Boolean,\n name: String,\n form: String,\n id: String,\n },\n emits: [\"update:value\", \"valueChange\", \"update:open\", \"openChange\"],\n setup(props, { slots, emit }) {\n const generated = useId()\n const made = scope.provide(\n controller(within(createDatePicker, { direction: useDirectionAround() }), () => ({\n ...props,\n id: props.id ?? generated,\n onValueChange(value: string | null, details: ChangeDetails) {\n emit(\"valueChange\", value, details)\n if (!details.canceled) emit(\"update:value\", value)\n },\n onOpenChange(open: boolean, details: ChangeDetails) {\n emit(\"openChange\", open, details)\n if (!details.canceled) emit(\"update:open\", open)\n },\n }))\n )\n dateFieldScope.provide(made.field)\n popoverScope.provide(made.popover)\n calendarScope.provide(made.calendar)\n return () => slots.default?.()\n },\n}) as unknown as PlainComponent<RootProps, RootEmits>\n\nexport type FieldProps = PartComponentProps\nexport type CalendarProps = PartComponentProps\nexport type { SegmentProps, SegmentsProps, InputProps } from \"./date-field.ts\"\nexport type { PopupProps, PortalProps, PositionerProps, TriggerProps } from \"./popover.ts\"\nexport type {\n CellProps,\n DayProps,\n GridProps,\n HeadCellProps,\n HeadingProps,\n NextProps,\n PreviousProps,\n WeekdaysProps,\n WeeksProps,\n} from \"./calendar.ts\"\nexport const DatePicker = {\n Root,\n /** The typed date: what holds its segments and its hidden input. */\n Field: partComponent<\"div\", State[\"field\"]>(\n \"DatePickerField\",\n \"div\",\n () => scope.use().field.root\n ),\n Segments: DateField.Segments,\n Segment: DateField.Segment,\n Input: DateField.Input,\n Trigger: Popover.Trigger,\n Portal: Popover.Portal,\n Positioner: Popover.Positioner,\n Popup: Popover.Popup,\n /** The calendar: what holds its heading, its buttons and its grid. */\n Calendar: partComponent<\"div\", State[\"calendar\"]>(\n \"DatePickerCalendar\",\n \"div\",\n () => scope.use().calendar.root\n ),\n Heading: Calendar.Heading,\n Previous: Calendar.Previous,\n Next: Calendar.Next,\n Grid: Calendar.Grid,\n Weekdays: Calendar.Weekdays,\n HeadCell: Calendar.HeadCell,\n Weeks: Calendar.Weeks,\n Cell: Calendar.Cell,\n Day: Calendar.Day,\n}\n"],"mappings":";;;;;;;;;AAgBA,MAAM,QAAQ,QAAoB,YAAY;AAyE9C,MAAa,aAAa;CACxB,MA7DW,gBAAgB;EAC3B,MAAM;EACN,OAAO;GACL,OAAO,SAAS,CAAC,QAAQ,IAAI,CAAuC;GACpE,cAAc;GACd,MAAM,SAAS,OAAO;GACtB,aAAa;GACb,QAAQ;GACR,KAAK;GACL,KAAK;GACL,mBAAmB;GACnB,gBAAgB;GAChB,YAAY;GACZ,cAAc;GACd,UAAU;GACV,UAAU;GACV,UAAU;GACV,MAAM;GACN,MAAM;GACN,IAAI;EACN;EACA,OAAO;GAAC;GAAgB;GAAe;GAAe;EAAY;EAClE,MAAM,OAAO,EAAE,OAAO,QAAQ;GAC5B,MAAM,YAAY,MAAM;GACxB,MAAM,OAAO,MAAM,QACjB,WAAW,OAAO,kBAAkB,EAAE,WAAW,mBAAmB,EAAE,CAAC,UAAU;IAC/E,GAAG;IACH,IAAI,MAAM,MAAM;IAChB,cAAc,OAAsB,SAAwB;KAC1D,KAAK,eAAe,OAAO,OAAO;KAClC,IAAI,CAAC,QAAQ,UAAU,KAAK,gBAAgB,KAAK;IACnD;IACA,aAAa,MAAe,SAAwB;KAClD,KAAK,cAAc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