@kirana-ui/react 0.1.0 → 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 (172) hide show
  1. package/llms.txt +3216 -0
  2. package/package.json +124 -2
  3. package/skills/kirana-ui-primitives/SKILL.md +142 -0
  4. package/src/accordion.d.ts +26 -15
  5. package/src/accordion.js +12 -11
  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 +3 -0
  11. package/src/autocomplete.js +1 -0
  12. package/src/autosize.d.ts +12 -0
  13. package/src/autosize.js +12 -0
  14. package/src/autosize.js.map +1 -0
  15. package/src/avatar.d.ts +12 -8
  16. package/src/avatar.js +19 -10
  17. package/src/avatar.js.map +1 -1
  18. package/src/button.d.ts +4 -2
  19. package/src/button.js +3 -3
  20. package/src/button.js.map +1 -1
  21. package/src/calendar.d.ts +65 -0
  22. package/src/calendar.js +89 -0
  23. package/src/calendar.js.map +1 -0
  24. package/src/carousel.d.ts +36 -0
  25. package/src/carousel.js +52 -0
  26. package/src/carousel.js.map +1 -0
  27. package/src/checkbox.d.ts +10 -7
  28. package/src/checkbox.js +19 -12
  29. package/src/checkbox.js.map +1 -1
  30. package/src/collapsible.d.ts +12 -8
  31. package/src/collapsible.js +8 -7
  32. package/src/collapsible.js.map +1 -1
  33. package/src/combobox.d.ts +119 -0
  34. package/src/combobox.js +177 -0
  35. package/src/combobox.js.map +1 -0
  36. package/src/command.d.ts +53 -0
  37. package/src/command.js +95 -0
  38. package/src/command.js.map +1 -0
  39. package/src/context-menu.d.ts +3 -0
  40. package/src/context-menu.js +1 -0
  41. package/src/date-field.d.ts +37 -0
  42. package/src/date-field.js +64 -0
  43. package/src/date-field.js.map +1 -0
  44. package/src/date-picker.d.ts +44 -0
  45. package/src/date-picker.js +62 -0
  46. package/src/date-picker.js.map +1 -0
  47. package/src/dialog.d.ts +54 -27
  48. package/src/dialog.js +23 -6
  49. package/src/dialog.js.map +1 -1
  50. package/src/direction.d.ts +1 -0
  51. package/src/direction.js +1 -1
  52. package/src/direction.js.map +1 -1
  53. package/src/drawer.d.ts +3 -0
  54. package/src/drawer.js +1 -0
  55. package/src/element.d.ts +12 -0
  56. package/src/element.js +20 -0
  57. package/src/element.js.map +1 -0
  58. package/src/field.d.ts +24 -16
  59. package/src/field.js +11 -9
  60. package/src/field.js.map +1 -1
  61. package/src/fieldset.d.ts +10 -5
  62. package/src/fieldset.js +4 -5
  63. package/src/fieldset.js.map +1 -1
  64. package/src/form.d.ts +5 -2
  65. package/src/form.js +6 -6
  66. package/src/form.js.map +1 -1
  67. package/src/hover-card.d.ts +16 -10
  68. package/src/hover-card.js +1 -1
  69. package/src/hover-card.js.map +1 -1
  70. package/src/hover-popup.d.ts +26 -12
  71. package/src/hover-popup.js +12 -12
  72. package/src/hover-popup.js.map +1 -1
  73. package/src/index.d.ts +37 -3
  74. package/src/index.js +26 -2
  75. package/src/input.d.ts +12 -0
  76. package/src/input.js +21 -0
  77. package/src/input.js.map +1 -0
  78. package/src/label.d.ts +8 -0
  79. package/src/label.js +14 -0
  80. package/src/label.js.map +1 -0
  81. package/src/listbox.d.ts +36 -0
  82. package/src/listbox.js +88 -0
  83. package/src/listbox.js.map +1 -0
  84. package/src/menu.d.ts +107 -0
  85. package/src/menu.js +206 -0
  86. package/src/menu.js.map +1 -0
  87. package/src/menubar-context.d.ts +4 -0
  88. package/src/menubar-context.js +7 -0
  89. package/src/menubar-context.js.map +1 -0
  90. package/src/menubar.d.ts +11 -0
  91. package/src/menubar.js +25 -0
  92. package/src/menubar.js.map +1 -0
  93. package/src/message-scroller.d.ts +24 -0
  94. package/src/message-scroller.js +35 -0
  95. package/src/message-scroller.js.map +1 -0
  96. package/src/meter.d.ts +18 -9
  97. package/src/meter.js +1 -1
  98. package/src/meter.js.map +1 -1
  99. package/src/navigation-menu.d.ts +58 -0
  100. package/src/navigation-menu.js +106 -0
  101. package/src/navigation-menu.js.map +1 -0
  102. package/src/number-field.d.ts +28 -0
  103. package/src/number-field.js +58 -0
  104. package/src/number-field.js.map +1 -0
  105. package/src/otp.d.ts +35 -0
  106. package/src/otp.js +64 -0
  107. package/src/otp.js.map +1 -0
  108. package/src/pagination.d.ts +37 -0
  109. package/src/pagination.js +50 -0
  110. package/src/pagination.js.map +1 -0
  111. package/src/popover.d.ts +32 -22
  112. package/src/popover.js +10 -14
  113. package/src/popover.js.map +1 -1
  114. package/src/progress.d.ts +18 -9
  115. package/src/progress.js +1 -1
  116. package/src/progress.js.map +1 -1
  117. package/src/qr-code.d.ts +21 -0
  118. package/src/qr-code.js +32 -0
  119. package/src/qr-code.js.map +1 -0
  120. package/src/radio-group.d.ts +17 -11
  121. package/src/radio-group.js +20 -22
  122. package/src/radio-group.js.map +1 -1
  123. package/src/resizable.d.ts +24 -0
  124. package/src/resizable.js +51 -0
  125. package/src/resizable.js.map +1 -0
  126. package/src/runtime.d.ts +114 -13
  127. package/src/runtime.js +205 -24
  128. package/src/runtime.js.map +1 -1
  129. package/src/scroll-area.d.ts +36 -0
  130. package/src/scroll-area.js +64 -0
  131. package/src/scroll-area.js.map +1 -0
  132. package/src/select.d.ts +79 -31
  133. package/src/select.js +86 -23
  134. package/src/select.js.map +1 -1
  135. package/src/separator.d.ts +4 -2
  136. package/src/separator.js +3 -3
  137. package/src/separator.js.map +1 -1
  138. package/src/slider.d.ts +35 -20
  139. package/src/slider.js +20 -19
  140. package/src/slider.js.map +1 -1
  141. package/src/switch.d.ts +10 -6
  142. package/src/switch.js +12 -9
  143. package/src/switch.js.map +1 -1
  144. package/src/tabs.d.ts +22 -14
  145. package/src/tabs.js +7 -8
  146. package/src/tabs.js.map +1 -1
  147. package/src/testing.d.ts +1 -0
  148. package/src/testing.js +1 -0
  149. package/src/toast.d.ts +68 -0
  150. package/src/toast.js +107 -0
  151. package/src/toast.js.map +1 -0
  152. package/src/toggle-group.d.ts +10 -0
  153. package/src/toggle-group.js +32 -0
  154. package/src/toggle-group.js.map +1 -0
  155. package/src/toggle.d.ts +5 -2
  156. package/src/toggle.js +15 -5
  157. package/src/toggle.js.map +1 -1
  158. package/src/toolbar-context.d.ts +7 -0
  159. package/src/toolbar-context.js +9 -0
  160. package/src/toolbar-context.js.map +1 -0
  161. package/src/toolbar.d.ts +35 -0
  162. package/src/toolbar.js +63 -0
  163. package/src/toolbar.js.map +1 -0
  164. package/src/tooltip.d.ts +16 -10
  165. package/src/tooltip.js +1 -1
  166. package/src/tooltip.js.map +1 -1
  167. package/src/use-render.d.ts +38 -0
  168. package/src/use-render.js +50 -0
  169. package/src/use-render.js.map +1 -0
  170. package/src/value-bar.d.ts +19 -11
  171. package/src/value-bar.js +8 -5
  172. package/src/value-bar.js.map +1 -1
@@ -0,0 +1,106 @@
1
+ import { DirectionContext } from "./direction-context.js";
2
+ import { PartElement, Portal as Portal$1, parts, useController, useMount, useOptions, usePart, usePositioning, useSignal } from "./runtime.js";
3
+ import { defined, within } from "@kirana-ui/core";
4
+ import { createContext, useContext, useId, useMemo } from "react";
5
+ import { createPortal } from "react-dom";
6
+ import { jsx } from "react/jsx-runtime";
7
+ import { createNavigationMenu } from "@kirana-ui/core/navigation-menu";
8
+ // src/navigation-menu.tsx
9
+ const Context = createContext(null);
10
+ const ItemContext = createContext(null);
11
+ function useNavigation(part) {
12
+ const controller = useContext(Context);
13
+ if (!controller) throw new Error(`<NavigationMenu.${part}> must be inside <NavigationMenu.Root>`);
14
+ return controller;
15
+ }
16
+ function useItem(part) {
17
+ const item = useContext(ItemContext);
18
+ if (!item) throw new Error(`<NavigationMenu.${part}> must be inside <NavigationMenu.Item>`);
19
+ return item;
20
+ }
21
+ function Root({ value, defaultValue, onValueChange, delay, closeDelay, orientation, id, ...rest }) {
22
+ const direction = useContext(DirectionContext) ?? void 0;
23
+ const controller = useController(within(createNavigationMenu, { direction }), {
24
+ value,
25
+ defaultValue,
26
+ onValueChange,
27
+ delay,
28
+ closeDelay,
29
+ orientation,
30
+ id
31
+ });
32
+ return /* @__PURE__ */ jsx(Context.Provider, {
33
+ value: controller,
34
+ children: usePart(controller.root, "nav", rest)
35
+ });
36
+ }
37
+ const List = (props) => usePart(useNavigation("List").list, "ul", props);
38
+ function Item({ value, ...props }) {
39
+ const controller = useNavigation("Item");
40
+ const generated = useId();
41
+ const key = value === void 0 ? generated : value;
42
+ const item = useMemo(() => controller.item(key), [controller, key]);
43
+ return usePart(controller.itemPart, "li", props, void 0, (content) => /* @__PURE__ */ jsx(Mounted, {
44
+ item,
45
+ children: content
46
+ }));
47
+ }
48
+ function Mounted({ item, children }) {
49
+ useMount(item);
50
+ return /* @__PURE__ */ jsx(ItemContext.Provider, {
51
+ value: item,
52
+ children
53
+ });
54
+ }
55
+ const Trigger = (props) => usePart(useItem("Trigger").trigger, "button", props);
56
+ const Icon = (props) => usePart(useItem("Icon").icon, "span", props);
57
+ /** An item's content: drawn in `<NavigationMenu.Viewport>`, while it is shown. */
58
+ function Content(props) {
59
+ const item = useItem("Content");
60
+ const mounted = useSignal(item.mounted);
61
+ const viewport = useSignal(useNavigation("Content").viewportElement);
62
+ if (!mounted || !viewport) return null;
63
+ return createPortal(/* @__PURE__ */ jsx(PartElement, {
64
+ of: item.content,
65
+ tag: "div",
66
+ ...props
67
+ }), viewport);
68
+ }
69
+ function Link({ active, closeOnClick, ...props }) {
70
+ const controller = useNavigation("Link");
71
+ const options = useOptions({
72
+ active,
73
+ closeOnClick
74
+ });
75
+ const part = useMemo(() => controller.link(() => defined(options.get())), [controller, options]);
76
+ return usePart(part, "a", props);
77
+ }
78
+ function Portal({ children }) {
79
+ return useSignal(useNavigation("Portal").mounted) ? /* @__PURE__ */ jsx(Portal$1, { children }) : null;
80
+ }
81
+ function Positioner(props) {
82
+ const controller = useNavigation("Positioner");
83
+ return usePart(controller.positioner, "div", usePositioning(controller.positioning, props));
84
+ }
85
+ const Popup = (props) => usePart(useNavigation("Popup").popup, "div", props);
86
+ const Viewport = (props) => usePart(useNavigation("Viewport").viewport, "div", props);
87
+ const Arrow = (props) => usePart(useNavigation("Arrow").arrow, "div", props);
88
+ const Backdrop = (props) => usePart(useNavigation("Backdrop").backdrop, "div", props);
89
+ const NavigationMenu = /* @__PURE__ */ parts("NavigationMenu", {
90
+ Root,
91
+ List,
92
+ Item,
93
+ Trigger,
94
+ Icon,
95
+ Content,
96
+ Link,
97
+ Portal,
98
+ Positioner,
99
+ Popup,
100
+ Viewport,
101
+ Arrow,
102
+ Backdrop
103
+ });
104
+ export { NavigationMenu };
105
+
106
+ //# sourceMappingURL=navigation-menu.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"navigation-menu.js","names":["BodyPortal"],"sources":["../../../../packages/react/src/navigation-menu.tsx"],"sourcesContent":["import { defined, within } from \"@kirana-ui/core\"\nimport type { StateOf } from \"@kirana-ui/core\"\nimport { createNavigationMenu } from \"@kirana-ui/core/navigation-menu\"\nimport type {\n NavigationMenu as Controller,\n NavigationMenuItem,\n NavigationMenuLinkOptions,\n NavigationMenuProps,\n} from \"@kirana-ui/core/navigation-menu\"\nimport type { Vocabulary } from \"@kirana-ui/core/vocabulary\"\nimport { createContext, useContext, useId, useMemo } from \"react\"\nimport type { ReactElement, ReactNode } from \"react\"\nimport { createPortal } from \"react-dom\"\n\nimport { DirectionContext } from \"./direction-context.ts\"\nimport {\n Portal as BodyPortal,\n PartElement,\n parts,\n useController,\n useMount,\n useOptions,\n usePart,\n usePositioning,\n useSignal,\n} from \"./runtime.tsx\"\nimport type { PartComponentProps, PortalProps, PositionerOptions } from \"./runtime.tsx\"\n\nexport type { PortalProps }\n\ntype Parts = Vocabulary[\"navigationMenu\"]\n\nconst Context = createContext<Controller | null>(null)\nconst ItemContext = createContext<NavigationMenuItem | null>(null)\n\nfunction useNavigation(part: string): Controller {\n const controller = useContext(Context)\n if (!controller) throw new Error(`<NavigationMenu.${part}> must be inside <NavigationMenu.Root>`)\n return controller\n}\n\nfunction useItem(part: string): NavigationMenuItem {\n const item = useContext(ItemContext)\n if (!item) throw new Error(`<NavigationMenu.${part}> must be inside <NavigationMenu.Item>`)\n return item\n}\n\n/** `Value` is what tells an item from the others: the type of `value`. */\nexport type RootProps<Value = unknown> = PartComponentProps<\n \"nav\",\n StateOf<Parts[\"root\"]>,\n Omit<NavigationMenuProps<Value>, \"id\"> & { id?: string }\n>\n\nfunction Root<Value = unknown>({\n value,\n defaultValue,\n onValueChange,\n delay,\n closeDelay,\n orientation,\n id,\n ...rest\n}: RootProps<Value>): ReactElement {\n const direction = useContext(DirectionContext) ?? undefined\n const controller: Controller = useController<NavigationMenuProps<Value>, Controller<Value>>(\n within(createNavigationMenu<Value>, { direction }),\n { value, defaultValue, onValueChange, delay, closeDelay, orientation, id }\n )\n return (\n <Context.Provider value={controller}>{usePart(controller.root, \"nav\", rest)}</Context.Provider>\n )\n}\n\nexport type ListProps = PartComponentProps<\"ul\", StateOf<Parts[\"list\"]>>\n\nconst List = (props: ListProps) => usePart(useNavigation(\"List\").list, \"ul\", props)\n\nexport type ItemProps = PartComponentProps<\n \"li\",\n StateOf<Parts[\"item\"]>,\n {\n /**\n * What tells this item from the others: the menu's `value` while its content is shown. An\n * item that is given none makes its own.\n */\n value?: unknown\n }\n>\n\nfunction Item({ value, ...props }: ItemProps): ReactElement {\n const controller = useNavigation(\"Item\")\n // The same on every render of this item, a second one in StrictMode included.\n const generated = useId()\n const key = value === undefined ? generated : value\n const item = useMemo(() => controller.item(key), [controller, key])\n // Its trigger and content find the item, whatever element the caller asked for.\n return usePart(controller.itemPart, \"li\", props, undefined, (content) => (\n <Mounted item={item}>{content}</Mounted>\n ))\n}\n\nfunction Mounted({ item, children }: { item: NavigationMenuItem; children?: ReactNode }) {\n useMount(item)\n return <ItemContext.Provider value={item}>{children}</ItemContext.Provider>\n}\n\nexport type TriggerProps = PartComponentProps<\"button\", StateOf<Parts[\"trigger\"]>>\nexport type IconProps = PartComponentProps<\"span\", StateOf<Parts[\"icon\"]>>\n\nconst Trigger = (props: TriggerProps) => usePart(useItem(\"Trigger\").trigger, \"button\", props)\nconst Icon = (props: IconProps) => usePart(useItem(\"Icon\").icon, \"span\", props)\n\nexport type ContentProps = PartComponentProps<\"div\", StateOf<Parts[\"content\"]>>\n\n/** An item's content: drawn in `<NavigationMenu.Viewport>`, while it is shown. */\nfunction Content(props: ContentProps): ReactElement | null {\n const item = useItem(\"Content\")\n const mounted = useSignal(item.mounted)\n const viewport = useSignal(useNavigation(\"Content\").viewportElement)\n if (!mounted || !viewport) return null\n return createPortal(<PartElement of={item.content} tag=\"div\" {...props} />, viewport)\n}\n\nexport type LinkProps = PartComponentProps<\"a\", StateOf<Parts[\"link\"]>, NavigationMenuLinkOptions>\n\nfunction Link({ active, closeOnClick, ...props }: LinkProps): ReactElement {\n const controller = useNavigation(\"Link\")\n const options = useOptions({ active, closeOnClick })\n const part = useMemo(() => controller.link(() => defined(options.get())), [controller, options])\n return usePart(part, \"a\", props)\n}\n\nfunction Portal({ children }: PortalProps): ReactElement | null {\n const mounted = useSignal(useNavigation(\"Portal\").mounted)\n return mounted ? <BodyPortal>{children}</BodyPortal> : null\n}\n\nexport type PositionerProps = PartComponentProps<\n \"div\",\n StateOf<Parts[\"positioner\"]>,\n PositionerOptions\n>\n\nfunction Positioner(props: PositionerProps): ReactElement {\n const controller = useNavigation(\"Positioner\")\n return usePart(controller.positioner, \"div\", usePositioning(controller.positioning, props))\n}\n\nexport type PopupProps = PartComponentProps<\"div\", StateOf<Parts[\"popup\"]>>\nexport type ViewportProps = PartComponentProps<\"div\", StateOf<Parts[\"viewport\"]>>\nexport type ArrowProps = PartComponentProps<\"div\", StateOf<Parts[\"arrow\"]>>\nexport type BackdropProps = PartComponentProps<\"div\", StateOf<Parts[\"backdrop\"]>>\n\nconst Popup = (props: PopupProps) => usePart(useNavigation(\"Popup\").popup, \"div\", props)\nconst Viewport = (props: ViewportProps) => usePart(useNavigation(\"Viewport\").viewport, \"div\", props)\nconst Arrow = (props: ArrowProps) => usePart(useNavigation(\"Arrow\").arrow, \"div\", props)\nconst Backdrop = (props: BackdropProps) => usePart(useNavigation(\"Backdrop\").backdrop, \"div\", props)\n\nexport const NavigationMenu = /* @__PURE__ */ parts(\"NavigationMenu\", {\n Root,\n List,\n Item,\n Trigger,\n Icon,\n Content,\n Link,\n Portal,\n Positioner,\n Popup,\n Viewport,\n Arrow,\n Backdrop,\n})\n"],"mappings":";;;;;;;;AAgCA,MAAM,UAAU,cAAiC,IAAI;AACrD,MAAM,cAAc,cAAyC,IAAI;AAEjE,SAAS,cAAc,MAA0B;CAC/C,MAAM,aAAa,WAAW,OAAO;CACrC,IAAI,CAAC,YAAY,MAAM,IAAI,MAAM,mBAAmB,KAAK,uCAAuC;CAChG,OAAO;AACT;AAEA,SAAS,QAAQ,MAAkC;CACjD,MAAM,OAAO,WAAW,WAAW;CACnC,IAAI,CAAC,MAAM,MAAM,IAAI,MAAM,mBAAmB,KAAK,uCAAuC;CAC1F,OAAO;AACT;AASA,SAAS,KAAsB,EAC7B,OACA,cACA,eACA,OACA,YACA,aACA,IACA,GAAG,QAC8B;CACjC,MAAM,YAAY,WAAW,gBAAgB,KAAK,KAAA;CAClD,MAAM,aAAyB,cAC7B,OAAO,sBAA6B,EAAE,UAAU,CAAC,GACjD;EAAE;EAAO;EAAc;EAAe;EAAO;EAAY;EAAa;CAAG,CAC3E;CACA,OACE,oBAAC,QAAQ,UAAT;EAAkB,OAAO;EAAa,UAAA,QAAQ,WAAW,MAAM,OAAO,IAAI;CAAoB,CAAA;AAElG;AAIA,MAAM,QAAQ,UAAqB,QAAQ,cAAc,MAAM,CAAC,CAAC,MAAM,MAAM,KAAK;AAclF,SAAS,KAAK,EAAE,OAAO,GAAG,SAAkC;CAC1D,MAAM,aAAa,cAAc,MAAM;CAEvC,MAAM,YAAY,MAAM;CACxB,MAAM,MAAM,UAAU,KAAA,IAAY,YAAY;CAC9C,MAAM,OAAO,cAAc,WAAW,KAAK,GAAG,GAAG,CAAC,YAAY,GAAG,CAAC;CAElE,OAAO,QAAQ,WAAW,UAAU,MAAM,OAAO,KAAA,IAAY,YAC3D,oBAAC,SAAD;EAAe;EAAO,UAAA;CAAiB,CAAA,CACxC;AACH;AAEA,SAAS,QAAQ,EAAE,MAAM,YAAgE;CACvF,SAAS,IAAI;CACb,OAAO,oBAAC,YAAY,UAAb;EAAsB,OAAO;EAAO;CAA+B,CAAA;AAC5E;AAKA,MAAM,WAAW,UAAwB,QAAQ,QAAQ,SAAS,CAAC,CAAC,SAAS,UAAU,KAAK;AAC5F,MAAM,QAAQ,UAAqB,QAAQ,QAAQ,MAAM,CAAC,CAAC,MAAM,QAAQ,KAAK;;AAK9E,SAAS,QAAQ,OAA0C;CACzD,MAAM,OAAO,QAAQ,SAAS;CAC9B,MAAM,UAAU,UAAU,KAAK,OAAO;CACtC,MAAM,WAAW,UAAU,cAAc,SAAS,CAAC,CAAC,eAAe;CACnE,IAAI,CAAC,WAAW,CAAC,UAAU,OAAO;CAClC,OAAO,aAAa,oBAAC,aAAD;EAAa,IAAI,KAAK;EAAS,KAAI;EAAM,GAAI;CAAQ,CAAA,GAAG,QAAQ;AACtF;AAIA,SAAS,KAAK,EAAE,QAAQ,cAAc,GAAG,SAAkC;CACzE,MAAM,aAAa,cAAc,MAAM;CACvC,MAAM,UAAU,WAAW;EAAE;EAAQ;CAAa,CAAC;CACnD,MAAM,OAAO,cAAc,WAAW,WAAW,QAAQ,QAAQ,IAAI,CAAC,CAAC,GAAG,CAAC,YAAY,OAAO,CAAC;CAC/F,OAAO,QAAQ,MAAM,KAAK,KAAK;AACjC;AAEA,SAAS,OAAO,EAAE,YAA8C;CAE9D,OADgB,UAAU,cAAc,QAAQ,CAAC,CAAC,OACrC,IAAI,oBAACA,UAAD,EAAa,SAAqB,CAAA,IAAI;AACzD;AAQA,SAAS,WAAW,OAAsC;CACxD,MAAM,aAAa,cAAc,YAAY;CAC7C,OAAO,QAAQ,WAAW,YAAY,OAAO,eAAe,WAAW,aAAa,KAAK,CAAC;AAC5F;AAOA,MAAM,SAAS,UAAsB,QAAQ,cAAc,OAAO,CAAC,CAAC,OAAO,OAAO,KAAK;AACvF,MAAM,YAAY,UAAyB,QAAQ,cAAc,UAAU,CAAC,CAAC,UAAU,OAAO,KAAK;AACnG,MAAM,SAAS,UAAsB,QAAQ,cAAc,OAAO,CAAC,CAAC,OAAO,OAAO,KAAK;AACvF,MAAM,YAAY,UAAyB,QAAQ,cAAc,UAAU,CAAC,CAAC,UAAU,OAAO,KAAK;AAEnG,MAAa,iBAAiC,sBAAM,kBAAkB;CACpE;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC"}
@@ -0,0 +1,28 @@
1
+ import { PartComponentProps } from "./runtime.js";
2
+ import { StateOf } from "@kirana-ui/core";
3
+ import { ReactElement } from "react";
4
+ import { NumberFieldProps } from "@kirana-ui/core/number-field";
5
+ import { Vocabulary } from "@kirana-ui/core/vocabulary";
6
+ type Parts = Vocabulary["numberField"];
7
+ export type RootProps = PartComponentProps<"div", StateOf<Parts["root"]>, Omit<NumberFieldProps, "id"> & {
8
+ id?: string;
9
+ }>;
10
+ declare function Root({ value, defaultValue, onValueChange, onValueCommitted, min, max, step, smallStep, largeStep, snapOnStep, allowWheelScrub, format, locale, disabled, readOnly, required, name, form, id, ...rest }: RootProps): ReactElement;
11
+ export type GroupProps = PartComponentProps<"div", StateOf<Parts["group"]>>;
12
+ declare const Group: (props: GroupProps) => ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
13
+ export type InputProps = PartComponentProps<"input", StateOf<Parts["input"]>>;
14
+ /** The text input. Its text is the field's own. */
15
+ declare const Input: (props: InputProps) => ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
16
+ export type IncrementProps = PartComponentProps<"button", StateOf<Parts["increment"]>>;
17
+ declare const Increment: (props: IncrementProps) => ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
18
+ export type DecrementProps = PartComponentProps<"button", StateOf<Parts["decrement"]>>;
19
+ declare const Decrement: (props: DecrementProps) => ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
20
+ export declare const NumberField: {
21
+ readonly Root: typeof Root;
22
+ readonly Group: typeof Group;
23
+ readonly Input: typeof Input;
24
+ readonly Increment: typeof Increment;
25
+ readonly Decrement: typeof Decrement;
26
+ };
27
+ export {};
28
+ //# sourceMappingURL=number-field.d.ts.map
@@ -0,0 +1,58 @@
1
+ import { FieldContext } from "./field-context.js";
2
+ import { parts, useController, useOwnText, usePart, useSignal } from "./runtime.js";
3
+ import { within } from "@kirana-ui/core";
4
+ import { createContext, useContext } from "react";
5
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
6
+ import { createNumberField } from "@kirana-ui/core/number-field";
7
+ // src/number-field.tsx
8
+ const Context = createContext(null);
9
+ function useNumberField(part) {
10
+ const controller = useContext(Context);
11
+ if (!controller) throw new Error(`<NumberField.${part}> must be inside <NumberField.Root>`);
12
+ return controller;
13
+ }
14
+ function Root({ value, defaultValue, onValueChange, onValueCommitted, min, max, step, smallStep, largeStep, snapOnStep, allowWheelScrub, format, locale, disabled, readOnly, required, name, form, id, ...rest }) {
15
+ const field = useContext(FieldContext) ?? void 0;
16
+ const controller = useController(within(createNumberField, { field }), {
17
+ value,
18
+ defaultValue,
19
+ onValueChange,
20
+ onValueCommitted,
21
+ min,
22
+ max,
23
+ step,
24
+ smallStep,
25
+ largeStep,
26
+ snapOnStep,
27
+ allowWheelScrub,
28
+ format,
29
+ locale,
30
+ disabled,
31
+ readOnly,
32
+ required,
33
+ name,
34
+ form,
35
+ id
36
+ });
37
+ const named = useSignal(controller.named);
38
+ return /* @__PURE__ */ jsx(Context.Provider, {
39
+ value: controller,
40
+ children: usePart(controller.root, "div", rest, void 0, (content) => /* @__PURE__ */ jsxs(Fragment$1, { children: [content, named ? /* @__PURE__ */ jsx(HiddenInput, {}) : null] }))
41
+ });
42
+ }
43
+ const HiddenInput = () => usePart(useNumberField("Root").hidden, "input", {});
44
+ const Group = (props) => usePart(useNumberField("Group").group, "div", props);
45
+ /** The text input. Its text is the field's own. */
46
+ const Input = (props) => usePart(useOwnText(useNumberField("Input").input), "input", props);
47
+ const Increment = (props) => usePart(useNumberField("Increment").increment, "button", props);
48
+ const Decrement = (props) => usePart(useNumberField("Decrement").decrement, "button", props);
49
+ const NumberField = /* @__PURE__ */ parts("NumberField", {
50
+ Root,
51
+ Group,
52
+ Input,
53
+ Increment,
54
+ Decrement
55
+ });
56
+ export { NumberField };
57
+
58
+ //# sourceMappingURL=number-field.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"number-field.js","names":[],"sources":["../../../../packages/react/src/number-field.tsx"],"sourcesContent":["import { within } from \"@kirana-ui/core\"\nimport type { StateOf } from \"@kirana-ui/core\"\nimport { createNumberField } from \"@kirana-ui/core/number-field\"\nimport type { NumberField as Controller, NumberFieldProps } from \"@kirana-ui/core/number-field\"\nimport type { Vocabulary } from \"@kirana-ui/core/vocabulary\"\nimport { createContext, useContext } from \"react\"\nimport type { ReactElement } from \"react\"\n\nimport { FieldContext } from \"./field-context.ts\"\nimport { parts, useController, useOwnText, usePart, useSignal } from \"./runtime.tsx\"\nimport type { PartComponentProps } from \"./runtime.tsx\"\n\ntype Parts = Vocabulary[\"numberField\"]\n\nconst Context = createContext<Controller | null>(null)\n\nfunction useNumberField(part: string): Controller {\n const controller = useContext(Context)\n if (!controller) throw new Error(`<NumberField.${part}> must be inside <NumberField.Root>`)\n return controller\n}\n\nexport type RootProps = PartComponentProps<\n \"div\",\n StateOf<Parts[\"root\"]>,\n Omit<NumberFieldProps, \"id\"> & { id?: string }\n>\n\nfunction Root({\n value,\n defaultValue,\n onValueChange,\n onValueCommitted,\n min,\n max,\n step,\n smallStep,\n largeStep,\n snapOnStep,\n allowWheelScrub,\n format,\n locale,\n disabled,\n readOnly,\n required,\n name,\n form,\n id,\n ...rest\n}: RootProps): ReactElement {\n const field = useContext(FieldContext) ?? undefined\n const controller = useController<NumberFieldProps, Controller>(\n within(createNumberField, { field }),\n {\n value,\n defaultValue,\n onValueChange,\n onValueCommitted,\n min,\n max,\n step,\n smallStep,\n largeStep,\n snapOnStep,\n allowWheelScrub,\n format,\n locale,\n disabled,\n readOnly,\n required,\n name,\n form,\n id,\n }\n )\n const named = useSignal(controller.named)\n return (\n <Context.Provider value={controller}>\n {usePart(controller.root, \"div\", rest, undefined, (content) => (\n // Its hidden input is in the element, whatever element the caller asked for.\n <>\n {content}\n {named ? <HiddenInput /> : null}\n </>\n ))}\n </Context.Provider>\n )\n}\n\nconst HiddenInput = () => usePart(useNumberField(\"Root\").hidden, \"input\", {})\nexport type GroupProps = PartComponentProps<\"div\", StateOf<Parts[\"group\"]>>\n\nconst Group = (props: GroupProps) => usePart(useNumberField(\"Group\").group, \"div\", props)\nexport type InputProps = PartComponentProps<\"input\", StateOf<Parts[\"input\"]>>\n\n/** The text input. Its text is the field's own. */\nconst Input = (props: InputProps) =>\n usePart(useOwnText(useNumberField(\"Input\").input), \"input\", props)\nexport type IncrementProps = PartComponentProps<\"button\", StateOf<Parts[\"increment\"]>>\n\nconst Increment = (props: IncrementProps) =>\n usePart(useNumberField(\"Increment\").increment, \"button\", props)\nexport type DecrementProps = PartComponentProps<\"button\", StateOf<Parts[\"decrement\"]>>\n\nconst Decrement = (props: DecrementProps) =>\n usePart(useNumberField(\"Decrement\").decrement, \"button\", props)\n\nexport const NumberField = /* @__PURE__ */ parts(\"NumberField\", {\n Root,\n Group,\n Input,\n Increment,\n Decrement,\n})\n"],"mappings":";;;;;;;AAcA,MAAM,UAAU,cAAiC,IAAI;AAErD,SAAS,eAAe,MAA0B;CAChD,MAAM,aAAa,WAAW,OAAO;CACrC,IAAI,CAAC,YAAY,MAAM,IAAI,MAAM,gBAAgB,KAAK,oCAAoC;CAC1F,OAAO;AACT;AAQA,SAAS,KAAK,EACZ,OACA,cACA,eACA,kBACA,KACA,KACA,MACA,WACA,WACA,YACA,iBACA,QACA,QACA,UACA,UACA,UACA,MACA,MACA,IACA,GAAG,QACuB;CAC1B,MAAM,QAAQ,WAAW,YAAY,KAAK,KAAA;CAC1C,MAAM,aAAa,cACjB,OAAO,mBAAmB,EAAE,MAAM,CAAC,GACnC;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CACF;CACA,MAAM,QAAQ,UAAU,WAAW,KAAK;CACxC,OACE,oBAAC,QAAQ,UAAT;EAAkB,OAAO;EACtB,UAAA,QAAQ,WAAW,MAAM,OAAO,MAAM,KAAA,IAAY,YAEjD,qBAAA,YAAA,EAAA,UAAA,CACG,SACA,QAAQ,oBAAC,aAAD,CAAc,CAAA,IAAI,IAC3B,EAAA,CAAA,CACH;CACe,CAAA;AAEtB;AAEA,MAAM,oBAAoB,QAAQ,eAAe,MAAM,CAAC,CAAC,QAAQ,SAAS,CAAC,CAAC;AAG5E,MAAM,SAAS,UAAsB,QAAQ,eAAe,OAAO,CAAC,CAAC,OAAO,OAAO,KAAK;;AAIxF,MAAM,SAAS,UACb,QAAQ,WAAW,eAAe,OAAO,CAAC,CAAC,KAAK,GAAG,SAAS,KAAK;AAGnE,MAAM,aAAa,UACjB,QAAQ,eAAe,WAAW,CAAC,CAAC,WAAW,UAAU,KAAK;AAGhE,MAAM,aAAa,UACjB,QAAQ,eAAe,WAAW,CAAC,CAAC,WAAW,UAAU,KAAK;AAEhE,MAAa,cAA8B,sBAAM,eAAe;CAC9D;CACA;CACA;CACA;CACA;AACF,CAAC"}
package/src/otp.d.ts ADDED
@@ -0,0 +1,35 @@
1
+ import { PartComponentProps } from "./runtime.js";
2
+ import { StateOf } from "@kirana-ui/core";
3
+ import { ReactElement } from "react";
4
+ import { OtpProps } from "@kirana-ui/core/otp";
5
+ import { Vocabulary } from "@kirana-ui/core/vocabulary";
6
+ type Parts = Vocabulary["otp"];
7
+ export type RootProps = PartComponentProps<"div", StateOf<Parts["root"]>, Omit<OtpProps, "id"> & {
8
+ id?: string;
9
+ }>;
10
+ declare function Root({ length, value, defaultValue, onValueChange, onComplete, mode, disabled, name, form, id, ...rest }: RootProps): ReactElement;
11
+ export type InputProps = PartComponentProps<"input", StateOf<Parts["input"]>>;
12
+ declare const Input: (props: InputProps) => ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
13
+ export type GroupProps = PartComponentProps<"div", StateOf<Parts["group"]>>;
14
+ declare const Group: (props: GroupProps) => ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
15
+ export type SeparatorProps = PartComponentProps<"div", StateOf<Parts["separator"]>>;
16
+ declare const Separator: (props: SeparatorProps) => ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
17
+ export type SlotProps = PartComponentProps<"div", StateOf<Parts["slot"]>, {
18
+ /** Which character of the code it shows, from 0. */
19
+ index: number;
20
+ }>;
21
+ /** One cell: it shows its character, then whatever it is given (a caret). */
22
+ declare function Slot({ index, ...props }: SlotProps): ReactElement;
23
+ export type CaretProps = PartComponentProps<"div", StateOf<Parts["caret"]>>;
24
+ /** Drawn in its cell while the cell is the active one and empty. */
25
+ declare function Caret(props: CaretProps): ReactElement | null;
26
+ export declare const Otp: {
27
+ readonly Root: typeof Root;
28
+ readonly Input: typeof Input;
29
+ readonly Group: typeof Group;
30
+ readonly Slot: typeof Slot;
31
+ readonly Separator: typeof Separator;
32
+ readonly Caret: typeof Caret;
33
+ };
34
+ export {};
35
+ //# sourceMappingURL=otp.d.ts.map
package/src/otp.js ADDED
@@ -0,0 +1,64 @@
1
+ import { PartElement, parts, useController, usePart, useSignal } from "./runtime.js";
2
+ import { createContext, useContext } from "react";
3
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
4
+ import { createOtp } from "@kirana-ui/core/otp";
5
+ // src/otp.tsx
6
+ const Context = createContext(null);
7
+ const SlotContext = createContext(null);
8
+ function useOtp(part) {
9
+ const controller = useContext(Context);
10
+ if (!controller) throw new Error(`<Otp.${part}> must be inside <Otp.Root>`);
11
+ return controller;
12
+ }
13
+ function Root({ length, value, defaultValue, onValueChange, onComplete, mode, disabled, name, form, id, ...rest }) {
14
+ const controller = useController(createOtp, {
15
+ length,
16
+ value,
17
+ defaultValue,
18
+ onValueChange,
19
+ onComplete,
20
+ mode,
21
+ disabled,
22
+ name,
23
+ form,
24
+ id
25
+ });
26
+ return /* @__PURE__ */ jsx(Context.Provider, {
27
+ value: controller,
28
+ children: usePart(controller.root, "div", rest)
29
+ });
30
+ }
31
+ const Input = (props) => usePart(useOtp("Input").input, "input", props);
32
+ const Group = (props) => usePart(useOtp("Group").group, "div", props);
33
+ const Separator = (props) => usePart(useOtp("Separator").separator, "div", props);
34
+ /** One cell: it shows its character, then whatever it is given (a caret). */
35
+ function Slot({ index, ...props }) {
36
+ const slot = useOtp("Slot").slot(index);
37
+ const char = useSignal(slot.char);
38
+ return /* @__PURE__ */ jsx(SlotContext.Provider, {
39
+ value: slot,
40
+ children: usePart(slot.part, "div", props, void 0, (content) => /* @__PURE__ */ jsxs(Fragment$1, { children: [char, content] }))
41
+ });
42
+ }
43
+ /** Drawn in its cell while the cell is the active one and empty. */
44
+ function Caret(props) {
45
+ const controller = useOtp("Caret");
46
+ const slot = useContext(SlotContext);
47
+ if (!slot) throw new Error("<Otp.Caret> must be inside <Otp.Slot>");
48
+ return useSignal(slot.caret) ? /* @__PURE__ */ jsx(PartElement, {
49
+ of: controller.caretPart,
50
+ tag: "div",
51
+ ...props
52
+ }) : null;
53
+ }
54
+ const Otp = /* @__PURE__ */ parts("Otp", {
55
+ Root,
56
+ Input,
57
+ Group,
58
+ Slot,
59
+ Separator,
60
+ Caret
61
+ });
62
+ export { Otp };
63
+
64
+ //# sourceMappingURL=otp.js.map
package/src/otp.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"otp.js","names":[],"sources":["../../../../packages/react/src/otp.tsx"],"sourcesContent":["import type { StateOf } from \"@kirana-ui/core\"\nimport { createOtp } from \"@kirana-ui/core/otp\"\nimport type { Otp as Controller, OtpProps, OtpSlot } from \"@kirana-ui/core/otp\"\nimport type { Vocabulary } from \"@kirana-ui/core/vocabulary\"\nimport { createContext, useContext } from \"react\"\nimport type { ReactElement } from \"react\"\n\nimport { PartElement, parts, useController, usePart, useSignal } from \"./runtime.tsx\"\nimport type { PartComponentProps } from \"./runtime.tsx\"\n\ntype Parts = Vocabulary[\"otp\"]\n\nconst Context = createContext<Controller | null>(null)\nconst SlotContext = createContext<OtpSlot | null>(null)\n\nfunction useOtp(part: string): Controller {\n const controller = useContext(Context)\n if (!controller) throw new Error(`<Otp.${part}> must be inside <Otp.Root>`)\n return controller\n}\n\nexport type RootProps = PartComponentProps<\n \"div\",\n StateOf<Parts[\"root\"]>,\n Omit<OtpProps, \"id\"> & { id?: string }\n>\n\nfunction Root({\n length,\n value,\n defaultValue,\n onValueChange,\n onComplete,\n mode,\n disabled,\n name,\n form,\n id,\n ...rest\n}: RootProps): ReactElement {\n const controller = useController<OtpProps, Controller>(createOtp, {\n length,\n value,\n defaultValue,\n onValueChange,\n onComplete,\n mode,\n disabled,\n name,\n form,\n id,\n })\n return (\n <Context.Provider value={controller}>{usePart(controller.root, \"div\", rest)}</Context.Provider>\n )\n}\n\nexport type InputProps = PartComponentProps<\"input\", StateOf<Parts[\"input\"]>>\n\nconst Input = (props: InputProps) => usePart(useOtp(\"Input\").input, \"input\", props)\nexport type GroupProps = PartComponentProps<\"div\", StateOf<Parts[\"group\"]>>\n\nconst Group = (props: GroupProps) => usePart(useOtp(\"Group\").group, \"div\", props)\nexport type SeparatorProps = PartComponentProps<\"div\", StateOf<Parts[\"separator\"]>>\n\nconst Separator = (props: SeparatorProps) => usePart(useOtp(\"Separator\").separator, \"div\", props)\n\nexport type SlotProps = PartComponentProps<\n \"div\",\n StateOf<Parts[\"slot\"]>,\n {\n /** Which character of the code it shows, from 0. */\n index: number\n }\n>\n\n/** One cell: it shows its character, then whatever it is given (a caret). */\nfunction Slot({ index, ...props }: SlotProps): ReactElement {\n const slot = useOtp(\"Slot\").slot(index)\n const char = useSignal(slot.char)\n return (\n <SlotContext.Provider value={slot}>\n {usePart(slot.part, \"div\", props, undefined, (content) => (\n // Its character comes first, whatever element the caller asked for.\n <>\n {char}\n {content}\n </>\n ))}\n </SlotContext.Provider>\n )\n}\n\nexport type CaretProps = PartComponentProps<\"div\", StateOf<Parts[\"caret\"]>>\n\n/** Drawn in its cell while the cell is the active one and empty. */\nfunction Caret(props: CaretProps): ReactElement | null {\n const controller = useOtp(\"Caret\")\n const slot = useContext(SlotContext)\n if (!slot) throw new Error(\"<Otp.Caret> must be inside <Otp.Slot>\")\n const shown = useSignal(slot.caret)\n return shown ? <PartElement of={controller.caretPart} tag=\"div\" {...props} /> : null\n}\n\nexport const Otp = /* @__PURE__ */ parts(\"Otp\", { Root, Input, Group, Slot, Separator, Caret })\n"],"mappings":";;;;;AAYA,MAAM,UAAU,cAAiC,IAAI;AACrD,MAAM,cAAc,cAA8B,IAAI;AAEtD,SAAS,OAAO,MAA0B;CACxC,MAAM,aAAa,WAAW,OAAO;CACrC,IAAI,CAAC,YAAY,MAAM,IAAI,MAAM,QAAQ,KAAK,4BAA4B;CAC1E,OAAO;AACT;AAQA,SAAS,KAAK,EACZ,QACA,OACA,cACA,eACA,YACA,MACA,UACA,MACA,MACA,IACA,GAAG,QACuB;CAC1B,MAAM,aAAa,cAAoC,WAAW;EAChE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CACD,OACE,oBAAC,QAAQ,UAAT;EAAkB,OAAO;EAAa,UAAA,QAAQ,WAAW,MAAM,OAAO,IAAI;CAAoB,CAAA;AAElG;AAIA,MAAM,SAAS,UAAsB,QAAQ,OAAO,OAAO,CAAC,CAAC,OAAO,SAAS,KAAK;AAGlF,MAAM,SAAS,UAAsB,QAAQ,OAAO,OAAO,CAAC,CAAC,OAAO,OAAO,KAAK;AAGhF,MAAM,aAAa,UAA0B,QAAQ,OAAO,WAAW,CAAC,CAAC,WAAW,OAAO,KAAK;;AAYhG,SAAS,KAAK,EAAE,OAAO,GAAG,SAAkC;CAC1D,MAAM,OAAO,OAAO,MAAM,CAAC,CAAC,KAAK,KAAK;CACtC,MAAM,OAAO,UAAU,KAAK,IAAI;CAChC,OACE,oBAAC,YAAY,UAAb;EAAsB,OAAO;EAC1B,UAAA,QAAQ,KAAK,MAAM,OAAO,OAAO,KAAA,IAAY,YAE5C,qBAAA,YAAA,EAAA,UAAA,CACG,MACA,OACD,EAAA,CAAA,CACH;CACmB,CAAA;AAE1B;;AAKA,SAAS,MAAM,OAAwC;CACrD,MAAM,aAAa,OAAO,OAAO;CACjC,MAAM,OAAO,WAAW,WAAW;CACnC,IAAI,CAAC,MAAM,MAAM,IAAI,MAAM,uCAAuC;CAElE,OADc,UAAU,KAAK,KAClB,IAAI,oBAAC,aAAD;EAAa,IAAI,WAAW;EAAW,KAAI;EAAM,GAAI;CAAQ,CAAA,IAAI;AAClF;AAEA,MAAa,MAAsB,sBAAM,OAAO;CAAE;CAAM;CAAO;CAAO;CAAM;CAAW;AAAM,CAAC"}
@@ -0,0 +1,37 @@
1
+ import { PartComponentProps } from "./runtime.js";
2
+ import { StateOf } from "@kirana-ui/core";
3
+ import { ReactElement, ReactNode } from "react";
4
+ import { PaginationEntry, PaginationProps } from "@kirana-ui/core/pagination";
5
+ import { Vocabulary } from "@kirana-ui/core/vocabulary";
6
+ type Parts = Vocabulary["pagination"];
7
+ export type RootProps = PartComponentProps<"nav", StateOf<Parts["root"]>, Omit<PaginationProps, "id"> & {
8
+ id?: string;
9
+ }>;
10
+ declare function Root({ page, defaultPage, onPageChange, count, pageSize, siblingCount, boundaryCount, disabled, id, ...rest }: RootProps): ReactElement;
11
+ export interface ItemsProps {
12
+ /** Draws one entry, once for each: a page, or the mark for pages left out. */
13
+ children: (entry: PaginationEntry) => ReactNode;
14
+ }
15
+ /** Draws its child once for each piece of the row: a page, or the mark for pages left out. */
16
+ declare function Items({ children }: ItemsProps): ReactElement;
17
+ export type ItemProps = PartComponentProps<"button", StateOf<Parts["item"]>, {
18
+ /** The page it goes to, from 1. */
19
+ page: number;
20
+ }>;
21
+ declare function Item({ page, ...props }: ItemProps): ReactElement;
22
+ export type EllipsisProps = PartComponentProps<"span", StateOf<Parts["ellipsis"]>>;
23
+ declare const Ellipsis: (props: EllipsisProps) => ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
24
+ export type PreviousProps = PartComponentProps<"button", StateOf<Parts["previous"]>>;
25
+ declare const Previous: (props: PreviousProps) => ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
26
+ export type NextProps = PartComponentProps<"button", StateOf<Parts["next"]>>;
27
+ declare const Next: (props: NextProps) => ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
28
+ export declare const Pagination: {
29
+ readonly Root: typeof Root;
30
+ readonly Items: typeof Items;
31
+ readonly Item: typeof Item;
32
+ readonly Ellipsis: typeof Ellipsis;
33
+ readonly Previous: typeof Previous;
34
+ readonly Next: typeof Next;
35
+ };
36
+ export {};
37
+ //# sourceMappingURL=pagination.d.ts.map
@@ -0,0 +1,50 @@
1
+ import { parts, useController, usePart, useSignal } from "./runtime.js";
2
+ import { Fragment, createContext, useContext } from "react";
3
+ import { Fragment as Fragment$1, jsx } from "react/jsx-runtime";
4
+ import { createPagination } from "@kirana-ui/core/pagination";
5
+ // src/pagination.tsx
6
+ const Context = createContext(null);
7
+ function usePagination(part) {
8
+ const controller = useContext(Context);
9
+ if (!controller) throw new Error(`<Pagination.${part}> must be inside <Pagination.Root>`);
10
+ return controller;
11
+ }
12
+ function Root({ page, defaultPage, onPageChange, count, pageSize, siblingCount, boundaryCount, disabled, id, ...rest }) {
13
+ const controller = useController(createPagination, {
14
+ page,
15
+ defaultPage,
16
+ onPageChange,
17
+ count,
18
+ pageSize,
19
+ siblingCount,
20
+ boundaryCount,
21
+ disabled,
22
+ id
23
+ });
24
+ return /* @__PURE__ */ jsx(Context.Provider, {
25
+ value: controller,
26
+ children: usePart(controller.root, "nav", rest)
27
+ });
28
+ }
29
+ /** Draws its child once for each piece of the row: a page, or the mark for pages left out. */
30
+ function Items({ children }) {
31
+ const entries = useSignal(usePagination("Items").entries);
32
+ return /* @__PURE__ */ jsx(Fragment$1, { children: entries.map((entry) => /* @__PURE__ */ jsx(Fragment, { children: children(entry) }, entry.key)) });
33
+ }
34
+ function Item({ page, ...props }) {
35
+ return usePart(usePagination("Item").item(page), "button", props);
36
+ }
37
+ const Ellipsis = (props) => usePart(usePagination("Ellipsis").ellipsis, "span", props);
38
+ const Previous = (props) => usePart(usePagination("Previous").previous, "button", props);
39
+ const Next = (props) => usePart(usePagination("Next").next, "button", props);
40
+ const Pagination = /* @__PURE__ */ parts("Pagination", {
41
+ Root,
42
+ Items,
43
+ Item,
44
+ Ellipsis,
45
+ Previous,
46
+ Next
47
+ });
48
+ export { Pagination };
49
+
50
+ //# sourceMappingURL=pagination.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pagination.js","names":[],"sources":["../../../../packages/react/src/pagination.tsx"],"sourcesContent":["import type { StateOf } from \"@kirana-ui/core\"\nimport { createPagination } from \"@kirana-ui/core/pagination\"\nimport type {\n Pagination as Controller,\n PaginationEntry,\n PaginationProps,\n} from \"@kirana-ui/core/pagination\"\nimport type { Vocabulary } from \"@kirana-ui/core/vocabulary\"\nimport { Fragment, createContext, useContext } from \"react\"\nimport type { ReactElement, ReactNode } from \"react\"\n\nimport { parts, useController, usePart, useSignal } from \"./runtime.tsx\"\nimport type { PartComponentProps } from \"./runtime.tsx\"\n\ntype Parts = Vocabulary[\"pagination\"]\n\nconst Context = createContext<Controller | null>(null)\n\nfunction usePagination(part: string): Controller {\n const controller = useContext(Context)\n if (!controller) throw new Error(`<Pagination.${part}> must be inside <Pagination.Root>`)\n return controller\n}\n\nexport type RootProps = PartComponentProps<\n \"nav\",\n StateOf<Parts[\"root\"]>,\n Omit<PaginationProps, \"id\"> & { id?: string }\n>\n\nfunction Root({\n page,\n defaultPage,\n onPageChange,\n count,\n pageSize,\n siblingCount,\n boundaryCount,\n disabled,\n id,\n ...rest\n}: RootProps): ReactElement {\n const controller = useController<PaginationProps, Controller>(createPagination, {\n page,\n defaultPage,\n onPageChange,\n count,\n pageSize,\n siblingCount,\n boundaryCount,\n disabled,\n id,\n })\n return (\n <Context.Provider value={controller}>{usePart(controller.root, \"nav\", rest)}</Context.Provider>\n )\n}\n\nexport interface ItemsProps {\n /** Draws one entry, once for each: a page, or the mark for pages left out. */\n children: (entry: PaginationEntry) => ReactNode\n}\n\n/** Draws its child once for each piece of the row: a page, or the mark for pages left out. */\nfunction Items({ children }: ItemsProps): ReactElement {\n const entries = useSignal(usePagination(\"Items\").entries)\n return (\n <>\n {entries.map((entry) => (\n <Fragment key={entry.key}>{children(entry)}</Fragment>\n ))}\n </>\n )\n}\n\nexport type ItemProps = PartComponentProps<\n \"button\",\n StateOf<Parts[\"item\"]>,\n {\n /** The page it goes to, from 1. */\n page: number\n }\n>\n\nfunction Item({ page, ...props }: ItemProps): ReactElement {\n return usePart(usePagination(\"Item\").item(page), \"button\", props)\n}\n\nexport type EllipsisProps = PartComponentProps<\"span\", StateOf<Parts[\"ellipsis\"]>>\n\nconst Ellipsis = (props: EllipsisProps) =>\n usePart(usePagination(\"Ellipsis\").ellipsis, \"span\", props)\nexport type PreviousProps = PartComponentProps<\"button\", StateOf<Parts[\"previous\"]>>\n\nconst Previous = (props: PreviousProps) =>\n usePart(usePagination(\"Previous\").previous, \"button\", props)\nexport type NextProps = PartComponentProps<\"button\", StateOf<Parts[\"next\"]>>\n\nconst Next = (props: NextProps) => usePart(usePagination(\"Next\").next, \"button\", props)\n\nexport const Pagination = /* @__PURE__ */ parts(\"Pagination\", {\n Root,\n Items,\n Item,\n Ellipsis,\n Previous,\n Next,\n})\n"],"mappings":";;;;;AAgBA,MAAM,UAAU,cAAiC,IAAI;AAErD,SAAS,cAAc,MAA0B;CAC/C,MAAM,aAAa,WAAW,OAAO;CACrC,IAAI,CAAC,YAAY,MAAM,IAAI,MAAM,eAAe,KAAK,mCAAmC;CACxF,OAAO;AACT;AAQA,SAAS,KAAK,EACZ,MACA,aACA,cACA,OACA,UACA,cACA,eACA,UACA,IACA,GAAG,QACuB;CAC1B,MAAM,aAAa,cAA2C,kBAAkB;EAC9E;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CACD,OACE,oBAAC,QAAQ,UAAT;EAAkB,OAAO;EAAa,UAAA,QAAQ,WAAW,MAAM,OAAO,IAAI;CAAoB,CAAA;AAElG;;AAQA,SAAS,MAAM,EAAE,YAAsC;CACrD,MAAM,UAAU,UAAU,cAAc,OAAO,CAAC,CAAC,OAAO;CACxD,OACE,oBAAA,YAAA,EAAA,UACG,QAAQ,KAAK,UACZ,oBAAC,UAAD,EAAA,UAA2B,SAAS,KAAK,EAAY,GAAtC,MAAM,GAAgC,CACtD,EACD,CAAA;AAEN;AAWA,SAAS,KAAK,EAAE,MAAM,GAAG,SAAkC;CACzD,OAAO,QAAQ,cAAc,MAAM,CAAC,CAAC,KAAK,IAAI,GAAG,UAAU,KAAK;AAClE;AAIA,MAAM,YAAY,UAChB,QAAQ,cAAc,UAAU,CAAC,CAAC,UAAU,QAAQ,KAAK;AAG3D,MAAM,YAAY,UAChB,QAAQ,cAAc,UAAU,CAAC,CAAC,UAAU,UAAU,KAAK;AAG7D,MAAM,QAAQ,UAAqB,QAAQ,cAAc,MAAM,CAAC,CAAC,MAAM,UAAU,KAAK;AAEtF,MAAa,aAA6B,sBAAM,cAAc;CAC5D;CACA;CACA;CACA;CACA;CACA;AACF,CAAC"}
package/src/popover.d.ts CHANGED
@@ -1,31 +1,41 @@
1
- import { PartComponentProps } from "./runtime.js";
2
- import { PositionOptions } from "@kirana-ui/core";
1
+ import { PartComponentProps, PortalProps, PositionerOptions } from "./runtime.js";
2
+ import { StateOf } from "@kirana-ui/core";
3
3
  import { ReactElement, ReactNode } from "react";
4
- import { PopoverProps } from "@kirana-ui/core/popover";
4
+ import { Popover as Popover$1, PopoverProps } from "@kirana-ui/core/popover";
5
+ import { Vocabulary } from "@kirana-ui/core/vocabulary";
6
+ type Parts = Vocabulary["popover"];
7
+ /**
8
+ * The popover its parts are inside. Exported for a component that is made of one (a date picker
9
+ * provides its own to the popover's parts).
10
+ */
11
+ declare const Context: import("react").Context<Popover$1 | null>;
5
12
  export type RootProps = Omit<PopoverProps, "id"> & {
6
13
  id?: string;
7
14
  children?: ReactNode;
8
15
  };
9
16
  declare function Root({ children, ...props }: RootProps): ReactElement;
10
- declare function Portal({ children }: {
11
- children?: ReactNode;
12
- }): ReactElement | null;
13
- export type PositionerProps = PartComponentProps & Partial<PositionOptions>;
14
- declare function Positioner({ side, align, sideOffset, alignOffset, collisionPadding, ...props }: PositionerProps): ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
15
- declare const Trigger: (props: PartComponentProps) => ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
16
- declare const Popup: (props: PartComponentProps) => ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
17
- declare const Title: (props: PartComponentProps) => ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
18
- declare const Description: (props: PartComponentProps) => ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
19
- declare const Close: (props: PartComponentProps) => ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
17
+ declare function Portal({ children }: PortalProps): ReactElement | null;
18
+ export type PositionerProps = PartComponentProps<"div", StateOf<Parts["positioner"]>, PositionerOptions>;
19
+ declare function Positioner(props: PositionerProps): ReactElement;
20
+ export type TriggerProps = PartComponentProps<"button", StateOf<Parts["trigger"]>>;
21
+ export type PopupProps = PartComponentProps<"div", StateOf<Parts["popup"]>>;
22
+ export type TitleProps = PartComponentProps<"h2", StateOf<Parts["title"]>>;
23
+ export type DescriptionProps = PartComponentProps<"p", StateOf<Parts["description"]>>;
24
+ export type CloseProps = PartComponentProps<"button", StateOf<Parts["close"]>>;
25
+ declare const Trigger: (props: TriggerProps) => ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
26
+ declare const Popup: (props: PopupProps) => ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
27
+ declare const Title: (props: TitleProps) => ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
28
+ declare const Description: (props: DescriptionProps) => ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
29
+ declare const Close: (props: CloseProps) => ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
20
30
  export declare const Popover: {
21
- Root: typeof Root;
22
- Trigger: typeof Trigger;
23
- Portal: typeof Portal;
24
- Positioner: typeof Positioner;
25
- Popup: typeof Popup;
26
- Title: typeof Title;
27
- Description: typeof Description;
28
- Close: typeof Close;
31
+ readonly Root: typeof Root;
32
+ readonly Trigger: typeof Trigger;
33
+ readonly Portal: typeof Portal;
34
+ readonly Positioner: typeof Positioner;
35
+ readonly Popup: typeof Popup;
36
+ readonly Title: typeof Title;
37
+ readonly Description: typeof Description;
38
+ readonly Close: typeof Close;
29
39
  };
30
- export {};
40
+ export { Context as PopoverContext, type PortalProps };
31
41
  //# sourceMappingURL=popover.d.ts.map
package/src/popover.js CHANGED
@@ -1,9 +1,12 @@
1
- import { Portal as Portal$1, useController, usePart, useSignal } from "./runtime.js";
2
- import { defined } from "@kirana-ui/core";
1
+ import { Portal as Portal$1, parts, useController, usePart, usePositioning, useSignal } from "./runtime.js";
3
2
  import { createContext, useContext } from "react";
4
3
  import { jsx } from "react/jsx-runtime";
5
4
  import { createPopover } from "@kirana-ui/core/popover";
6
5
  // src/popover.tsx
6
+ /**
7
+ * The popover its parts are inside. Exported for a component that is made of one (a date picker
8
+ * provides its own to the popover's parts).
9
+ */
7
10
  const Context = createContext(null);
8
11
  function usePopover(part) {
9
12
  const controller = useContext(Context);
@@ -20,23 +23,16 @@ function Root({ children, ...props }) {
20
23
  function Portal({ children }) {
21
24
  return useSignal(usePopover("Portal").mounted) ? /* @__PURE__ */ jsx(Portal$1, { children }) : null;
22
25
  }
23
- function Positioner({ side, align, sideOffset, alignOffset, collisionPadding, ...props }) {
26
+ function Positioner(props) {
24
27
  const controller = usePopover("Positioner");
25
- controller.positioning.set(defined({
26
- side,
27
- align,
28
- sideOffset,
29
- alignOffset,
30
- collisionPadding
31
- }));
32
- return usePart(controller.positioner, "div", props);
28
+ return usePart(controller.positioner, "div", usePositioning(controller.positioning, props));
33
29
  }
34
30
  const Trigger = (props) => usePart(usePopover("Trigger").trigger, "button", props);
35
31
  const Popup = (props) => usePart(usePopover("Popup").popup, "div", props);
36
32
  const Title = (props) => usePart(usePopover("Title").title, "h2", props);
37
33
  const Description = (props) => usePart(usePopover("Description").description, "p", props);
38
34
  const Close = (props) => usePart(usePopover("Close").close, "button", props);
39
- const Popover = {
35
+ const Popover = /* @__PURE__ */ parts("Popover", {
40
36
  Root,
41
37
  Trigger,
42
38
  Portal,
@@ -45,7 +41,7 @@ const Popover = {
45
41
  Title,
46
42
  Description,
47
43
  Close
48
- };
49
- export { Popover };
44
+ });
45
+ export { Popover, Context as PopoverContext };
50
46
 
51
47
  //# sourceMappingURL=popover.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"popover.js","names":["BodyPortal"],"sources":["../../../../packages/react/src/popover.tsx"],"sourcesContent":["import { defined } from \"@kirana-ui/core\"\nimport type { PositionOptions } from \"@kirana-ui/core\"\nimport { createPopover } from \"@kirana-ui/core/popover\"\nimport type { Popover as Controller, PopoverProps } from \"@kirana-ui/core/popover\"\nimport { createContext, useContext } from \"react\"\nimport type { ReactElement, ReactNode } from \"react\"\n\nimport { Portal as BodyPortal, useController, usePart, useSignal } from \"./runtime.tsx\"\nimport type { PartComponentProps } from \"./runtime.tsx\"\n\nconst Context = createContext<Controller | null>(null)\n\nfunction usePopover(part: string): Controller {\n const controller = useContext(Context)\n if (!controller) throw new Error(`<Popover.${part}> must be inside <Popover.Root>`)\n return controller\n}\n\nexport type RootProps = Omit<PopoverProps, \"id\"> & { id?: string; children?: ReactNode }\n\nfunction Root({ children, ...props }: RootProps): ReactElement {\n const controller = useController(createPopover, props)\n return <Context.Provider value={controller}>{children}</Context.Provider>\n}\n\nfunction Portal({ children }: { children?: ReactNode }): ReactElement | null {\n const mounted = useSignal(usePopover(\"Portal\").mounted)\n return mounted ? <BodyPortal>{children}</BodyPortal> : null\n}\n\nexport type PositionerProps = PartComponentProps & Partial<PositionOptions>\n\nfunction Positioner({\n side,\n align,\n sideOffset,\n alignOffset,\n collisionPadding,\n ...props\n}: PositionerProps) {\n const controller = usePopover(\"Positioner\")\n // Written while rendering, so the first placement (made when the element attaches, before\n // this component's effects) reads them. Nothing re-renders for it: the core compares.\n controller.positioning.set(defined({ side, align, sideOffset, alignOffset, collisionPadding }))\n return usePart(controller.positioner, \"div\", props)\n}\n\nconst Trigger = (props: PartComponentProps) =>\n usePart(usePopover(\"Trigger\").trigger, \"button\", props)\nconst Popup = (props: PartComponentProps) => usePart(usePopover(\"Popup\").popup, \"div\", props)\nconst Title = (props: PartComponentProps) => usePart(usePopover(\"Title\").title, \"h2\", props)\nconst Description = (props: PartComponentProps) =>\n usePart(usePopover(\"Description\").description, \"p\", props)\nconst Close = (props: PartComponentProps) => usePart(usePopover(\"Close\").close, \"button\", props)\n\nexport const Popover = { Root, Trigger, Portal, Positioner, Popup, Title, Description, Close }\n"],"mappings":";;;;;;AAUA,MAAM,UAAU,cAAiC,IAAI;AAErD,SAAS,WAAW,MAA0B;CAC5C,MAAM,aAAa,WAAW,OAAO;CACrC,IAAI,CAAC,YAAY,MAAM,IAAI,MAAM,YAAY,KAAK,gCAAgC;CAClF,OAAO;AACT;AAIA,SAAS,KAAK,EAAE,UAAU,GAAG,SAAkC;CAC7D,MAAM,aAAa,cAAc,eAAe,KAAK;CACrD,OAAO,oBAAC,QAAQ,UAAT;EAAkB,OAAO;EAAa;CAA2B,CAAA;AAC1E;AAEA,SAAS,OAAO,EAAE,YAA2D;CAE3E,OADgB,UAAU,WAAW,QAAQ,CAAC,CAAC,OAClC,IAAI,oBAACA,UAAD,EAAa,SAAqB,CAAA,IAAI;AACzD;AAIA,SAAS,WAAW,EAClB,MACA,OACA,YACA,aACA,kBACA,GAAG,SACe;CAClB,MAAM,aAAa,WAAW,YAAY;CAG1C,WAAW,YAAY,IAAI,QAAQ;EAAE;EAAM;EAAO;EAAY;EAAa;CAAiB,CAAC,CAAC;CAC9F,OAAO,QAAQ,WAAW,YAAY,OAAO,KAAK;AACpD;AAEA,MAAM,WAAW,UACf,QAAQ,WAAW,SAAS,CAAC,CAAC,SAAS,UAAU,KAAK;AACxD,MAAM,SAAS,UAA8B,QAAQ,WAAW,OAAO,CAAC,CAAC,OAAO,OAAO,KAAK;AAC5F,MAAM,SAAS,UAA8B,QAAQ,WAAW,OAAO,CAAC,CAAC,OAAO,MAAM,KAAK;AAC3F,MAAM,eAAe,UACnB,QAAQ,WAAW,aAAa,CAAC,CAAC,aAAa,KAAK,KAAK;AAC3D,MAAM,SAAS,UAA8B,QAAQ,WAAW,OAAO,CAAC,CAAC,OAAO,UAAU,KAAK;AAE/F,MAAa,UAAU;CAAE;CAAM;CAAS;CAAQ;CAAY;CAAO;CAAO;CAAa;AAAM"}
1
+ {"version":3,"file":"popover.js","names":["BodyPortal"],"sources":["../../../../packages/react/src/popover.tsx"],"sourcesContent":["import type { StateOf } from \"@kirana-ui/core\"\nimport { createPopover } from \"@kirana-ui/core/popover\"\nimport type { Popover as Controller, PopoverProps } from \"@kirana-ui/core/popover\"\nimport type { Vocabulary } from \"@kirana-ui/core/vocabulary\"\nimport { createContext, useContext } from \"react\"\nimport type { ReactElement, ReactNode } from \"react\"\n\nimport {\n Portal as BodyPortal,\n parts,\n useController,\n usePart,\n usePositioning,\n useSignal,\n} from \"./runtime.tsx\"\nimport type { PartComponentProps, PortalProps, PositionerOptions } from \"./runtime.tsx\"\n\nexport type { PortalProps }\n\ntype Parts = Vocabulary[\"popover\"]\n\n/**\n * The popover its parts are inside. Exported for a component that is made of one (a date picker\n * provides its own to the popover's parts).\n */\nconst Context = createContext<Controller | null>(null)\n/** For a component made of this one's parts: a date picker. */\nexport { Context as PopoverContext }\n\nfunction usePopover(part: string): Controller {\n const controller = useContext(Context)\n if (!controller) throw new Error(`<Popover.${part}> must be inside <Popover.Root>`)\n return controller\n}\n\nexport type RootProps = Omit<PopoverProps, \"id\"> & { id?: string; children?: ReactNode }\n\nfunction Root({ children, ...props }: RootProps): ReactElement {\n const controller = useController(createPopover, props)\n return <Context.Provider value={controller}>{children}</Context.Provider>\n}\n\nfunction Portal({ children }: PortalProps): ReactElement | null {\n const mounted = useSignal(usePopover(\"Portal\").mounted)\n return mounted ? <BodyPortal>{children}</BodyPortal> : null\n}\n\nexport type PositionerProps = PartComponentProps<\n \"div\",\n StateOf<Parts[\"positioner\"]>,\n PositionerOptions\n>\n\nfunction Positioner(props: PositionerProps): ReactElement {\n const controller = usePopover(\"Positioner\")\n return usePart(controller.positioner, \"div\", usePositioning(controller.positioning, props))\n}\n\nexport type TriggerProps = PartComponentProps<\"button\", StateOf<Parts[\"trigger\"]>>\nexport type PopupProps = PartComponentProps<\"div\", StateOf<Parts[\"popup\"]>>\nexport type TitleProps = PartComponentProps<\"h2\", StateOf<Parts[\"title\"]>>\nexport type DescriptionProps = PartComponentProps<\"p\", StateOf<Parts[\"description\"]>>\nexport type CloseProps = PartComponentProps<\"button\", StateOf<Parts[\"close\"]>>\n\nconst Trigger = (props: TriggerProps) => usePart(usePopover(\"Trigger\").trigger, \"button\", props)\nconst Popup = (props: PopupProps) => usePart(usePopover(\"Popup\").popup, \"div\", props)\nconst Title = (props: TitleProps) => usePart(usePopover(\"Title\").title, \"h2\", props)\nconst Description = (props: DescriptionProps) =>\n usePart(usePopover(\"Description\").description, \"p\", props)\nconst Close = (props: CloseProps) => usePart(usePopover(\"Close\").close, \"button\", props)\n\nexport const Popover = /* @__PURE__ */ parts(\"Popover\", {\n Root,\n Trigger,\n Portal,\n Positioner,\n Popup,\n Title,\n Description,\n Close,\n})\n"],"mappings":";;;;;;;;;AAyBA,MAAM,UAAU,cAAiC,IAAI;AAIrD,SAAS,WAAW,MAA0B;CAC5C,MAAM,aAAa,WAAW,OAAO;CACrC,IAAI,CAAC,YAAY,MAAM,IAAI,MAAM,YAAY,KAAK,gCAAgC;CAClF,OAAO;AACT;AAIA,SAAS,KAAK,EAAE,UAAU,GAAG,SAAkC;CAC7D,MAAM,aAAa,cAAc,eAAe,KAAK;CACrD,OAAO,oBAAC,QAAQ,UAAT;EAAkB,OAAO;EAAa;CAA2B,CAAA;AAC1E;AAEA,SAAS,OAAO,EAAE,YAA8C;CAE9D,OADgB,UAAU,WAAW,QAAQ,CAAC,CAAC,OAClC,IAAI,oBAACA,UAAD,EAAa,SAAqB,CAAA,IAAI;AACzD;AAQA,SAAS,WAAW,OAAsC;CACxD,MAAM,aAAa,WAAW,YAAY;CAC1C,OAAO,QAAQ,WAAW,YAAY,OAAO,eAAe,WAAW,aAAa,KAAK,CAAC;AAC5F;AAQA,MAAM,WAAW,UAAwB,QAAQ,WAAW,SAAS,CAAC,CAAC,SAAS,UAAU,KAAK;AAC/F,MAAM,SAAS,UAAsB,QAAQ,WAAW,OAAO,CAAC,CAAC,OAAO,OAAO,KAAK;AACpF,MAAM,SAAS,UAAsB,QAAQ,WAAW,OAAO,CAAC,CAAC,OAAO,MAAM,KAAK;AACnF,MAAM,eAAe,UACnB,QAAQ,WAAW,aAAa,CAAC,CAAC,aAAa,KAAK,KAAK;AAC3D,MAAM,SAAS,UAAsB,QAAQ,WAAW,OAAO,CAAC,CAAC,OAAO,UAAU,KAAK;AAEvF,MAAa,UAA0B,sBAAM,WAAW;CACtD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC"}
package/src/progress.d.ts CHANGED
@@ -1,13 +1,22 @@
1
1
  import { PartComponentProps } from "./runtime.js";
2
+ import { ValueOptions } from "./value-bar.js";
3
+ import { StateOf } from "@kirana-ui/core";
4
+ import { ProgressProps } from "@kirana-ui/core/progress";
5
+ import { Vocabulary } from "@kirana-ui/core/vocabulary";
6
+ type Parts = Vocabulary["progress"];
7
+ export type RootProps = PartComponentProps<"div", StateOf<Parts["root"]>, Omit<ProgressProps, "id"> & {
8
+ id?: string;
9
+ }>;
10
+ export type TrackProps = PartComponentProps<"div", StateOf<Parts["track"]>>;
11
+ export type IndicatorProps = PartComponentProps<"div", StateOf<Parts["indicator"]>>;
12
+ export type ValueProps = PartComponentProps<"span", StateOf<Parts["value"]>, ValueOptions>;
13
+ export type LabelProps = PartComponentProps<"span", StateOf<Parts["label"]>>;
2
14
  export declare const Progress: {
3
- Root: ({ value, min, max, format, locale, getAriaValueText, id, ...rest }: Omit<import("@kirana-ui/core/meter").ValueBarProps, "id"> & {
4
- id?: string;
5
- } & PartComponentProps<undefined>) => import("react").ReactElement;
6
- Track: (props: PartComponentProps) => import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
7
- Indicator: (props: PartComponentProps) => import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
8
- Value: ({ children, ...props }: Omit<PartComponentProps<undefined>, "children"> & {
9
- children?: ((text: string | undefined) => import("react").ReactNode) | undefined;
10
- }) => import("react").ReactElement;
11
- Label: (props: PartComponentProps) => import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
15
+ Root: (props: RootProps) => import("react").ReactElement;
16
+ Track: (props: TrackProps) => import("react").ReactElement;
17
+ Indicator: (props: IndicatorProps) => import("react").ReactElement;
18
+ Value: (props: ValueProps) => import("react").ReactElement;
19
+ Label: (props: LabelProps) => import("react").ReactElement;
12
20
  };
21
+ export {};
13
22
  //# sourceMappingURL=progress.d.ts.map
package/src/progress.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { valueBar } from "./value-bar.js";
2
2
  import { createProgress } from "@kirana-ui/core/progress";
3
3
  // src/progress.tsx
4
- const Progress = valueBar("Progress", createProgress);
4
+ const Progress = /* @__PURE__ */ valueBar("Progress", createProgress);
5
5
  export { Progress };
6
6
 
7
7
  //# sourceMappingURL=progress.js.map