@kirana-ui/react 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 (161) hide show
  1. package/llms.txt +1601 -223
  2. package/package.json +14 -2
  3. package/skills/kirana-ui-primitives/SKILL.md +142 -0
  4. package/src/accordion.d.ts +26 -15
  5. package/src/accordion.js +11 -10
  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 -2
  11. package/src/autosize.d.ts +5 -2
  12. package/src/autosize.js +2 -2
  13. package/src/autosize.js.map +1 -1
  14. package/src/avatar.d.ts +12 -8
  15. package/src/avatar.js +18 -9
  16. package/src/avatar.js.map +1 -1
  17. package/src/button.d.ts +4 -2
  18. package/src/button.js +3 -3
  19. package/src/button.js.map +1 -1
  20. package/src/calendar.d.ts +49 -28
  21. package/src/calendar.js +7 -3
  22. package/src/calendar.js.map +1 -1
  23. package/src/carousel.d.ts +25 -15
  24. package/src/carousel.js +3 -3
  25. package/src/carousel.js.map +1 -1
  26. package/src/checkbox.d.ts +10 -7
  27. package/src/checkbox.js +18 -12
  28. package/src/checkbox.js.map +1 -1
  29. package/src/collapsible.d.ts +12 -8
  30. package/src/collapsible.js +8 -7
  31. package/src/collapsible.js.map +1 -1
  32. package/src/combobox.d.ts +88 -60
  33. package/src/combobox.js +44 -31
  34. package/src/combobox.js.map +1 -1
  35. package/src/command.d.ts +30 -21
  36. package/src/command.js +14 -7
  37. package/src/command.js.map +1 -1
  38. package/src/context-menu.d.ts +3 -2
  39. package/src/date-field.d.ts +25 -13
  40. package/src/date-field.js +7 -3
  41. package/src/date-field.js.map +1 -1
  42. package/src/date-picker.d.ts +31 -40
  43. package/src/date-picker.js +3 -3
  44. package/src/date-picker.js.map +1 -1
  45. package/src/dialog.d.ts +45 -35
  46. package/src/dialog.js +12 -8
  47. package/src/dialog.js.map +1 -1
  48. package/src/direction.d.ts +1 -0
  49. package/src/direction.js.map +1 -1
  50. package/src/drawer.d.ts +3 -2
  51. package/src/element.d.ts +12 -0
  52. package/src/element.js +20 -0
  53. package/src/element.js.map +1 -0
  54. package/src/field.d.ts +24 -16
  55. package/src/field.js +9 -7
  56. package/src/field.js.map +1 -1
  57. package/src/fieldset.d.ts +10 -5
  58. package/src/fieldset.js +4 -5
  59. package/src/fieldset.js.map +1 -1
  60. package/src/form.d.ts +5 -2
  61. package/src/form.js +6 -6
  62. package/src/form.js.map +1 -1
  63. package/src/hover-card.d.ts +16 -10
  64. package/src/hover-card.js +1 -1
  65. package/src/hover-card.js.map +1 -1
  66. package/src/hover-popup.d.ts +24 -14
  67. package/src/hover-popup.js +5 -13
  68. package/src/hover-popup.js.map +1 -1
  69. package/src/index.d.ts +13 -3
  70. package/src/input.d.ts +4 -2
  71. package/src/input.js +3 -3
  72. package/src/input.js.map +1 -1
  73. package/src/label.d.ts +4 -1
  74. package/src/label.js +3 -3
  75. package/src/label.js.map +1 -1
  76. package/src/listbox.d.ts +23 -15
  77. package/src/listbox.js +4 -5
  78. package/src/listbox.js.map +1 -1
  79. package/src/menu.d.ts +83 -65
  80. package/src/menu.js +10 -18
  81. package/src/menu.js.map +1 -1
  82. package/src/menubar.d.ts +5 -3
  83. package/src/menubar.js +3 -3
  84. package/src/menubar.js.map +1 -1
  85. package/src/message-scroller.d.ts +15 -9
  86. package/src/message-scroller.js +3 -3
  87. package/src/message-scroller.js.map +1 -1
  88. package/src/meter.d.ts +18 -9
  89. package/src/meter.js +1 -1
  90. package/src/meter.js.map +1 -1
  91. package/src/navigation-menu.d.ts +50 -40
  92. package/src/navigation-menu.js +15 -24
  93. package/src/navigation-menu.js.map +1 -1
  94. package/src/number-field.d.ts +19 -12
  95. package/src/number-field.js +6 -10
  96. package/src/number-field.js.map +1 -1
  97. package/src/otp.d.ts +24 -15
  98. package/src/otp.js +7 -13
  99. package/src/otp.js.map +1 -1
  100. package/src/pagination.d.ts +26 -16
  101. package/src/pagination.js +3 -3
  102. package/src/pagination.js.map +1 -1
  103. package/src/popover.d.ts +30 -21
  104. package/src/popover.js +9 -13
  105. package/src/popover.js.map +1 -1
  106. package/src/progress.d.ts +18 -9
  107. package/src/progress.js +1 -1
  108. package/src/progress.js.map +1 -1
  109. package/src/qr-code.d.ts +12 -7
  110. package/src/qr-code.js +3 -3
  111. package/src/qr-code.js.map +1 -1
  112. package/src/radio-group.d.ts +17 -11
  113. package/src/radio-group.js +16 -19
  114. package/src/radio-group.js.map +1 -1
  115. package/src/resizable.d.ts +13 -8
  116. package/src/resizable.js +3 -3
  117. package/src/resizable.js.map +1 -1
  118. package/src/runtime.d.ts +89 -15
  119. package/src/runtime.js +112 -19
  120. package/src/runtime.js.map +1 -1
  121. package/src/scroll-area.d.ts +26 -15
  122. package/src/scroll-area.js +9 -6
  123. package/src/scroll-area.js.map +1 -1
  124. package/src/select.d.ts +65 -45
  125. package/src/select.js +40 -35
  126. package/src/select.js.map +1 -1
  127. package/src/separator.d.ts +4 -2
  128. package/src/separator.js +3 -3
  129. package/src/separator.js.map +1 -1
  130. package/src/slider.d.ts +35 -20
  131. package/src/slider.js +17 -18
  132. package/src/slider.js.map +1 -1
  133. package/src/switch.d.ts +10 -6
  134. package/src/switch.js +11 -9
  135. package/src/switch.js.map +1 -1
  136. package/src/tabs.d.ts +22 -14
  137. package/src/tabs.js +5 -6
  138. package/src/tabs.js.map +1 -1
  139. package/src/testing.d.ts +1 -0
  140. package/src/testing.js +1 -0
  141. package/src/toast.d.ts +59 -23
  142. package/src/toast.js +59 -13
  143. package/src/toast.js.map +1 -1
  144. package/src/toggle-group.d.ts +5 -2
  145. package/src/toggle-group.js +3 -3
  146. package/src/toggle-group.js.map +1 -1
  147. package/src/toggle.d.ts +4 -2
  148. package/src/toggle.js +3 -3
  149. package/src/toggle.js.map +1 -1
  150. package/src/toolbar.d.ts +26 -11
  151. package/src/toolbar.js +23 -13
  152. package/src/toolbar.js.map +1 -1
  153. package/src/tooltip.d.ts +16 -10
  154. package/src/tooltip.js +1 -1
  155. package/src/tooltip.js.map +1 -1
  156. package/src/use-render.d.ts +38 -0
  157. package/src/use-render.js +50 -0
  158. package/src/use-render.js.map +1 -0
  159. package/src/value-bar.d.ts +19 -11
  160. package/src/value-bar.js +8 -5
  161. package/src/value-bar.js.map +1 -1
package/src/fieldset.d.ts CHANGED
@@ -1,15 +1,20 @@
1
1
  import { PartComponentProps } from "./runtime.js";
2
+ import { StateOf } from "@kirana-ui/core";
2
3
  import { ReactElement } from "react";
3
4
  import { Fieldset as Fieldset$1, FieldsetProps } from "@kirana-ui/core/fieldset";
5
+ import { Vocabulary } from "@kirana-ui/core/vocabulary";
6
+ type Parts = Vocabulary["fieldset"];
4
7
  /** The fieldset a field is in, if it is in one. */
5
8
  export declare const FieldsetContext: import("react").Context<Fieldset$1 | null>;
6
- declare function Root({ disabled, id, ...rest }: Omit<FieldsetProps, "id"> & {
9
+ export type RootProps = PartComponentProps<"fieldset", StateOf<Parts["root"]>, Omit<FieldsetProps, "id"> & {
7
10
  id?: string;
8
- } & PartComponentProps): ReactElement;
9
- declare const Legend: (props: PartComponentProps) => ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
11
+ }>;
12
+ declare function Root({ disabled, id, ...rest }: RootProps): ReactElement;
13
+ export type LegendProps = PartComponentProps<"div", StateOf<Parts["legend"]>>;
14
+ declare const Legend: (props: LegendProps) => ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
10
15
  export declare const Fieldset: {
11
- Root: typeof Root;
12
- Legend: typeof Legend;
16
+ readonly Root: typeof Root;
17
+ readonly Legend: typeof Legend;
13
18
  };
14
19
  export {};
15
20
  //# sourceMappingURL=fieldset.d.ts.map
package/src/fieldset.js CHANGED
@@ -1,4 +1,4 @@
1
- import { useController, usePart } from "./runtime.js";
1
+ import { parts, useController, usePart } from "./runtime.js";
2
2
  import { createContext, useContext } from "react";
3
3
  import { jsx } from "react/jsx-runtime";
4
4
  import { createFieldset } from "@kirana-ui/core/fieldset";
@@ -17,15 +17,14 @@ function Root({ disabled, id, ...rest }) {
17
17
  });
18
18
  return /* @__PURE__ */ jsx(FieldsetContext.Provider, {
19
19
  value: controller,
20
- children: /* @__PURE__ */ jsx(RootElement, { ...rest })
20
+ children: usePart(controller.root, "fieldset", rest)
21
21
  });
22
22
  }
23
- const RootElement = (props) => usePart(useFieldset("Root").root, "fieldset", props);
24
23
  const Legend = (props) => usePart(useFieldset("Legend").legend, "div", props);
25
- const Fieldset = {
24
+ const Fieldset = /* @__PURE__ */ parts("Fieldset", {
26
25
  Root,
27
26
  Legend
28
- };
27
+ });
29
28
  export { Fieldset, FieldsetContext };
30
29
 
31
30
  //# sourceMappingURL=fieldset.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fieldset.js","names":[],"sources":["../../../../packages/react/src/fieldset.tsx"],"sourcesContent":["import { createFieldset } from \"@kirana-ui/core/fieldset\"\nimport type { Fieldset as Controller, FieldsetProps } from \"@kirana-ui/core/fieldset\"\nimport { createContext, useContext } from \"react\"\nimport type { ReactElement } from \"react\"\n\nimport { useController, usePart } from \"./runtime.tsx\"\nimport type { PartComponentProps } from \"./runtime.tsx\"\n\n/** The fieldset a field is in, if it is in one. */\nexport const FieldsetContext = createContext<Controller | null>(null)\n\nfunction useFieldset(part: string): Controller {\n const controller = useContext(FieldsetContext)\n if (!controller) throw new Error(`<Fieldset.${part}> must be inside <Fieldset.Root>`)\n return controller\n}\n\nfunction Root({\n disabled,\n id,\n ...rest\n}: Omit<FieldsetProps, \"id\"> & { id?: string } & PartComponentProps): ReactElement {\n const controller = useController(createFieldset, { disabled, id })\n return (\n <FieldsetContext.Provider value={controller}>\n <RootElement {...rest} />\n </FieldsetContext.Provider>\n )\n}\n\nconst RootElement = (props: PartComponentProps) =>\n usePart(useFieldset(\"Root\").root, \"fieldset\", props)\nconst Legend = (props: PartComponentProps) => usePart(useFieldset(\"Legend\").legend, \"div\", props)\n\nexport const Fieldset = { Root, Legend }\n"],"mappings":";;;;;;AASA,MAAa,kBAAkB,cAAiC,IAAI;AAEpE,SAAS,YAAY,MAA0B;CAC7C,MAAM,aAAa,WAAW,eAAe;CAC7C,IAAI,CAAC,YAAY,MAAM,IAAI,MAAM,aAAa,KAAK,iCAAiC;CACpF,OAAO;AACT;AAEA,SAAS,KAAK,EACZ,UACA,IACA,GAAG,QAC8E;CACjF,MAAM,aAAa,cAAc,gBAAgB;EAAE;EAAU;CAAG,CAAC;CACjE,OACE,oBAAC,gBAAgB,UAAjB;EAA0B,OAAO;EAC/B,UAAA,oBAAC,aAAD,EAAa,GAAI,KAAO,CAAA;CACA,CAAA;AAE9B;AAEA,MAAM,eAAe,UACnB,QAAQ,YAAY,MAAM,CAAC,CAAC,MAAM,YAAY,KAAK;AACrD,MAAM,UAAU,UAA8B,QAAQ,YAAY,QAAQ,CAAC,CAAC,QAAQ,OAAO,KAAK;AAEhG,MAAa,WAAW;CAAE;CAAM;AAAO"}
1
+ {"version":3,"file":"fieldset.js","names":[],"sources":["../../../../packages/react/src/fieldset.tsx"],"sourcesContent":["import type { StateOf } from \"@kirana-ui/core\"\nimport { createFieldset } from \"@kirana-ui/core/fieldset\"\nimport type { Fieldset as Controller, FieldsetProps } from \"@kirana-ui/core/fieldset\"\nimport type { Vocabulary } from \"@kirana-ui/core/vocabulary\"\nimport { createContext, useContext } from \"react\"\nimport type { ReactElement } from \"react\"\n\nimport { parts, useController, usePart } from \"./runtime.tsx\"\nimport type { PartComponentProps } from \"./runtime.tsx\"\n\ntype Parts = Vocabulary[\"fieldset\"]\n\n/** The fieldset a field is in, if it is in one. */\nexport const FieldsetContext = createContext<Controller | null>(null)\n\nfunction useFieldset(part: string): Controller {\n const controller = useContext(FieldsetContext)\n if (!controller) throw new Error(`<Fieldset.${part}> must be inside <Fieldset.Root>`)\n return controller\n}\n\nexport type RootProps = PartComponentProps<\n \"fieldset\",\n StateOf<Parts[\"root\"]>,\n Omit<FieldsetProps, \"id\"> & { id?: string }\n>\n\nfunction Root({ disabled, id, ...rest }: RootProps): ReactElement {\n const controller = useController(createFieldset, { disabled, id })\n return (\n <FieldsetContext.Provider value={controller}>\n {usePart(controller.root, \"fieldset\", rest)}\n </FieldsetContext.Provider>\n )\n}\n\nexport type LegendProps = PartComponentProps<\"div\", StateOf<Parts[\"legend\"]>>\n\nconst Legend = (props: LegendProps) => usePart(useFieldset(\"Legend\").legend, \"div\", props)\n\nexport const Fieldset = /* @__PURE__ */ parts(\"Fieldset\", { Root, Legend })\n"],"mappings":";;;;;;AAaA,MAAa,kBAAkB,cAAiC,IAAI;AAEpE,SAAS,YAAY,MAA0B;CAC7C,MAAM,aAAa,WAAW,eAAe;CAC7C,IAAI,CAAC,YAAY,MAAM,IAAI,MAAM,aAAa,KAAK,iCAAiC;CACpF,OAAO;AACT;AAQA,SAAS,KAAK,EAAE,UAAU,IAAI,GAAG,QAAiC;CAChE,MAAM,aAAa,cAAc,gBAAgB;EAAE;EAAU;CAAG,CAAC;CACjE,OACE,oBAAC,gBAAgB,UAAjB;EAA0B,OAAO;EAC9B,UAAA,QAAQ,WAAW,MAAM,YAAY,IAAI;CAClB,CAAA;AAE9B;AAIA,MAAM,UAAU,UAAuB,QAAQ,YAAY,QAAQ,CAAC,CAAC,QAAQ,OAAO,KAAK;AAEzF,MAAa,WAA2B,sBAAM,YAAY;CAAE;CAAM;AAAO,CAAC"}
package/src/form.d.ts CHANGED
@@ -1,8 +1,11 @@
1
1
  import { PartComponentProps } from "./runtime.js";
2
+ import { StateOf } from "@kirana-ui/core";
2
3
  import { ReactElement } from "react";
3
- import { Form as Form$1, FormProps } from "@kirana-ui/core/form";
4
+ import { Form as Form$1, FormProps as FormProps$1 } from "@kirana-ui/core/form";
5
+ import { Vocabulary } from "@kirana-ui/core/vocabulary";
4
6
  /** The form a field is in, if it is in one. */
5
7
  export declare const FormContext: import("react").Context<Form$1 | null>;
8
+ export type FormProps = PartComponentProps<"form", StateOf<Vocabulary["form"]["root"]>, FormProps$1>;
6
9
  /** A `<form>` whose fields say what is wrong; `onFormSubmit` takes the values once all are valid. */
7
- export declare function Form({ errors, onClearErrors, onFormSubmit, validationMode, ...rest }: FormProps & PartComponentProps): ReactElement;
10
+ export declare const Form: ({ errors, onClearErrors, onFormSubmit, validationMode, ...rest }: FormProps) => ReactElement;
8
11
  //# sourceMappingURL=form.d.ts.map
package/src/form.js CHANGED
@@ -1,4 +1,4 @@
1
- import { useController, usePart } from "./runtime.js";
1
+ import { PartElement, component, useController } from "./runtime.js";
2
2
  import { createContext } from "react";
3
3
  import { jsx } from "react/jsx-runtime";
4
4
  import { createForm } from "@kirana-ui/core/form";
@@ -6,7 +6,7 @@ import { createForm } from "@kirana-ui/core/form";
6
6
  /** The form a field is in, if it is in one. */
7
7
  const FormContext = createContext(null);
8
8
  /** A `<form>` whose fields say what is wrong; `onFormSubmit` takes the values once all are valid. */
9
- function Form({ errors, onClearErrors, onFormSubmit, validationMode, ...rest }) {
9
+ const Form = /* @__PURE__ */ component("Form", function Form({ errors, onClearErrors, onFormSubmit, validationMode, ...rest }) {
10
10
  const controller = useController(createForm, {
11
11
  errors,
12
12
  onClearErrors,
@@ -15,13 +15,13 @@ function Form({ errors, onClearErrors, onFormSubmit, validationMode, ...rest })
15
15
  });
16
16
  return /* @__PURE__ */ jsx(FormContext.Provider, {
17
17
  value: controller,
18
- children: /* @__PURE__ */ jsx(Element, {
19
- part: controller,
18
+ children: /* @__PURE__ */ jsx(PartElement, {
19
+ of: controller.root,
20
+ tag: "form",
20
21
  ...rest
21
22
  })
22
23
  });
23
- }
24
- const Element = ({ part, ...props }) => usePart(part.root, "form", props);
24
+ });
25
25
  export { Form, FormContext };
26
26
 
27
27
  //# sourceMappingURL=form.js.map
package/src/form.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"form.js","names":[],"sources":["../../../../packages/react/src/form.tsx"],"sourcesContent":["import { createForm } from \"@kirana-ui/core/form\"\nimport type { Form as Controller, FormProps } from \"@kirana-ui/core/form\"\nimport { createContext } from \"react\"\nimport type { ReactElement } from \"react\"\n\nimport { useController, usePart } from \"./runtime.tsx\"\nimport type { PartComponentProps } from \"./runtime.tsx\"\n\n/** The form a field is in, if it is in one. */\nexport const FormContext = createContext<Controller | null>(null)\n\n/** A `<form>` whose fields say what is wrong; `onFormSubmit` takes the values once all are valid. */\nexport function Form({\n errors,\n onClearErrors,\n onFormSubmit,\n validationMode,\n ...rest\n}: FormProps & PartComponentProps): ReactElement {\n const controller = useController(createForm, {\n errors,\n onClearErrors,\n onFormSubmit,\n validationMode,\n })\n return (\n <FormContext.Provider value={controller}>\n <Element part={controller} {...rest} />\n </FormContext.Provider>\n )\n}\n\nconst Element = ({ part, ...props }: PartComponentProps & { part: Controller }) =>\n usePart(part.root, \"form\", props)\n"],"mappings":";;;;;;AASA,MAAa,cAAc,cAAiC,IAAI;;AAGhE,SAAgB,KAAK,EACnB,QACA,eACA,cACA,gBACA,GAAG,QAC4C;CAC/C,MAAM,aAAa,cAAc,YAAY;EAC3C;EACA;EACA;EACA;CACF,CAAC;CACD,OACE,oBAAC,YAAY,UAAb;EAAsB,OAAO;EAC3B,UAAA,oBAAC,SAAD;GAAS,MAAM;GAAY,GAAI;EAAO,CAAA;CAClB,CAAA;AAE1B;AAEA,MAAM,WAAW,EAAE,MAAM,GAAG,YAC1B,QAAQ,KAAK,MAAM,QAAQ,KAAK"}
1
+ {"version":3,"file":"form.js","names":[],"sources":["../../../../packages/react/src/form.tsx"],"sourcesContent":["import type { StateOf } from \"@kirana-ui/core\"\nimport { createForm } from \"@kirana-ui/core/form\"\nimport type { Form as Controller, FormProps as CoreProps } from \"@kirana-ui/core/form\"\nimport type { Vocabulary } from \"@kirana-ui/core/vocabulary\"\nimport { createContext } from \"react\"\nimport type { ReactElement } from \"react\"\n\nimport { PartElement, component, useController } from \"./runtime.tsx\"\nimport type { PartComponentProps } from \"./runtime.tsx\"\n\n/** The form a field is in, if it is in one. */\nexport const FormContext = createContext<Controller | null>(null)\n\nexport type FormProps = PartComponentProps<\"form\", StateOf<Vocabulary[\"form\"][\"root\"]>, CoreProps>\n\n/** A `<form>` whose fields say what is wrong; `onFormSubmit` takes the values once all are valid. */\nexport const Form = /* @__PURE__ */ component(\n \"Form\",\n function Form({\n errors,\n onClearErrors,\n onFormSubmit,\n validationMode,\n ...rest\n }: FormProps): ReactElement {\n const controller = useController(createForm, {\n errors,\n onClearErrors,\n onFormSubmit,\n validationMode,\n })\n return (\n <FormContext.Provider value={controller}>\n <PartElement of={controller.root} tag=\"form\" {...rest} />\n </FormContext.Provider>\n )\n }\n)\n"],"mappings":";;;;;;AAWA,MAAa,cAAc,cAAiC,IAAI;;AAKhE,MAAa,OAAuB,0BAClC,QACA,SAAS,KAAK,EACZ,QACA,eACA,cACA,gBACA,GAAG,QACuB;CAC1B,MAAM,aAAa,cAAc,YAAY;EAC3C;EACA;EACA;EACA;CACF,CAAC;CACD,OACE,oBAAC,YAAY,UAAb;EAAsB,OAAO;EAC3B,UAAA,oBAAC,aAAD;GAAa,IAAI,WAAW;GAAM,KAAI;GAAO,GAAI;EAAO,CAAA;CACpC,CAAA;AAE1B,CACF"}
@@ -1,13 +1,19 @@
1
- import { PositionerProps, RootProps, TriggerProps } from "./hover-popup.js";
2
- import { PartComponentProps } from "./runtime.js";
1
+ import { RootProps, TriggerOptions } from "./hover-popup.js";
2
+ import { PartComponentProps, PortalProps, PositionerOptions } from "./runtime.js";
3
+ import { StateOf } from "@kirana-ui/core";
4
+ import { Vocabulary } from "@kirana-ui/core/vocabulary";
5
+ type Parts = Vocabulary["hoverCard"];
6
+ export type TriggerProps = PartComponentProps<"a", StateOf<Parts["trigger"]>, TriggerOptions>;
7
+ export type PositionerProps = PartComponentProps<"div", StateOf<Parts["positioner"]>, PositionerOptions>;
8
+ export type PopupProps = PartComponentProps<"div", StateOf<Parts["popup"]>>;
9
+ export type ArrowProps = PartComponentProps<"div", StateOf<Parts["arrow"]>>;
3
10
  export declare const HoverCard: {
4
- Root: ({ children, ...props }: RootProps) => import("react").ReactElement;
5
- Trigger: ({ delay, closeDelay, ...props }: TriggerProps) => import("react").ReactElement;
6
- Portal: ({ children }: {
7
- children?: import("react").ReactNode;
8
- }) => import("react").ReactElement | null;
9
- Positioner: ({ side, align, sideOffset, alignOffset, collisionPadding, ...props }: PositionerProps) => import("react").ReactElement;
10
- Popup: (props: PartComponentProps) => import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
11
- Arrow: (props: PartComponentProps) => import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
11
+ Root: (props: RootProps) => import("react").ReactElement;
12
+ Trigger: (props: TriggerProps) => import("react").ReactElement;
13
+ Portal: (props: PortalProps) => import("react").ReactElement | null;
14
+ Positioner: (props: PositionerProps) => import("react").ReactElement;
15
+ Popup: (props: PopupProps) => import("react").ReactElement;
16
+ Arrow: (props: ArrowProps) => import("react").ReactElement;
12
17
  };
18
+ export type { PortalProps, RootProps };
13
19
  //# sourceMappingURL=hover-card.d.ts.map
package/src/hover-card.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { hoverPopup } from "./hover-popup.js";
2
2
  import { createHoverCard } from "@kirana-ui/core/hover-card";
3
3
  // src/hover-card.tsx
4
- const HoverCard = hoverPopup("HoverCard", createHoverCard, "a");
4
+ const HoverCard = /* @__PURE__ */ hoverPopup("HoverCard", createHoverCard, "a");
5
5
  export { HoverCard };
6
6
 
7
7
  //# sourceMappingURL=hover-card.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"hover-card.js","names":[],"sources":["../../../../packages/react/src/hover-card.tsx"],"sourcesContent":["import { createHoverCard } from \"@kirana-ui/core/hover-card\"\n\nimport { hoverPopup } from \"./hover-popup.tsx\"\n\nexport const HoverCard = hoverPopup(\"HoverCard\", createHoverCard, \"a\")\n"],"mappings":";;;AAIA,MAAa,YAAY,WAAW,aAAa,iBAAiB,GAAG"}
1
+ {"version":3,"file":"hover-card.js","names":[],"sources":["../../../../packages/react/src/hover-card.tsx"],"sourcesContent":["import type { StateOf } from \"@kirana-ui/core\"\nimport { createHoverCard } from \"@kirana-ui/core/hover-card\"\nimport type { Vocabulary } from \"@kirana-ui/core/vocabulary\"\n\nimport { hoverPopup } from \"./hover-popup.tsx\"\nimport type { TriggerOptions } from \"./hover-popup.tsx\"\nimport type { PartComponentProps, PositionerOptions } from \"./runtime.tsx\"\n\nexport type { PortalProps, RootProps } from \"./hover-popup.tsx\"\n\ntype Parts = Vocabulary[\"hoverCard\"]\n\nexport type TriggerProps = PartComponentProps<\"a\", StateOf<Parts[\"trigger\"]>, TriggerOptions>\nexport type PositionerProps = PartComponentProps<\n \"div\",\n StateOf<Parts[\"positioner\"]>,\n PositionerOptions\n>\nexport type PopupProps = PartComponentProps<\"div\", StateOf<Parts[\"popup\"]>>\nexport type ArrowProps = PartComponentProps<\"div\", StateOf<Parts[\"arrow\"]>>\n\nexport const HoverCard = /* @__PURE__ */ hoverPopup<{\n Trigger: TriggerProps\n Positioner: PositionerProps\n Popup: PopupProps\n Arrow: ArrowProps\n}>(\"HoverCard\", createHoverCard, \"a\")\n"],"mappings":";;;AAqBA,MAAa,YAA4B,2BAKtC,aAAa,iBAAiB,GAAG"}
@@ -1,25 +1,35 @@
1
- import { PartComponentProps } from "./runtime.js";
2
- import { PositionOptions, ReadonlySignal } from "@kirana-ui/core";
1
+ import { PartComponentProps, PartTag, PortalProps, PositionerOptions, PositionerProps } from "./runtime.js";
2
+ import { PartState, ReadonlySignal } from "@kirana-ui/core";
3
3
  import { ReactElement, ReactNode } from "react";
4
4
  import { HoverPopup, HoverPopupProps } from "@kirana-ui/core/tooltip";
5
5
  export type RootProps = Omit<HoverPopupProps, "id"> & {
6
6
  id?: string;
7
7
  children?: ReactNode;
8
8
  };
9
- export type PositionerProps = PartComponentProps & Partial<PositionOptions>;
10
- export type TriggerProps = PartComponentProps & {
9
+ /** What a trigger takes of its own: `delay` and `closeDelay` here come before the root's. */
10
+ export interface TriggerOptions {
11
+ /** How long the pointer rests on this trigger before the popup opens, in milliseconds. */
11
12
  delay?: number;
13
+ /** How long after the pointer leaves this trigger's popup closes, in milliseconds. */
12
14
  closeDelay?: number;
13
- };
15
+ }
16
+ /** A trigger's props. Its element is its component's: a tooltip's `button`, a hover card's `a`. */
17
+ export type TriggerProps<Tag extends PartTag = "button", State = PartState> = PartComponentProps<Tag, State, TriggerOptions>;
18
+ /** The props of the parts that draw an element, as their component's entry types them. */
19
+ export interface HoverPartProps {
20
+ Trigger: TriggerOptions;
21
+ Positioner: PositionerOptions;
22
+ Popup: object;
23
+ Arrow: object;
24
+ }
14
25
  /** The parts of a popup the pointer opens: a tooltip's, a hover card's. */
15
- export declare function hoverPopup(name: string, create: (props: ReadonlySignal<HoverPopupProps>) => HoverPopup, triggerTag: string): {
16
- Root: ({ children, ...props }: RootProps) => ReactElement;
17
- Trigger: ({ delay, closeDelay, ...props }: TriggerProps) => ReactElement;
18
- Portal: ({ children }: {
19
- children?: ReactNode;
20
- }) => ReactElement | null;
21
- Positioner: ({ side, align, sideOffset, alignOffset, collisionPadding, ...props }: PositionerProps) => ReactElement;
22
- Popup: (props: PartComponentProps) => ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
23
- Arrow: (props: PartComponentProps) => ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
26
+ export declare function hoverPopup<Props extends HoverPartProps>(name: string, create: (props: ReadonlySignal<HoverPopupProps>) => HoverPopup, triggerTag: PartTag): {
27
+ Root: (props: RootProps) => ReactElement;
28
+ Trigger: (props: Props["Trigger"]) => ReactElement;
29
+ Portal: (props: PortalProps) => ReactElement | null;
30
+ Positioner: (props: Props["Positioner"]) => ReactElement;
31
+ Popup: (props: Props["Popup"]) => ReactElement;
32
+ Arrow: (props: Props["Arrow"]) => ReactElement;
24
33
  };
34
+ export type { PortalProps, PositionerProps };
25
35
  //# sourceMappingURL=hover-popup.d.ts.map
@@ -1,4 +1,4 @@
1
- import { Portal, useController, usePart, useSignal } from "./runtime.js";
1
+ import { Portal, parts, useController, usePart, usePositioning, useSignal } from "./runtime.js";
2
2
  import { defined } from "@kirana-ui/core";
3
3
  import { createContext, useContext } from "react";
4
4
  import { jsx } from "react/jsx-runtime";
@@ -21,18 +21,10 @@ function hoverPopup(name, create, triggerTag) {
21
21
  function Portal$1({ children }) {
22
22
  return useSignal(use("Portal").mounted) ? /* @__PURE__ */ jsx(Portal, { children }) : null;
23
23
  }
24
- function Positioner({ side, align, sideOffset, alignOffset, collisionPadding, ...props }) {
24
+ function Positioner(props) {
25
25
  const controller = use("Positioner");
26
- controller.positioning.set(defined({
27
- side,
28
- align,
29
- sideOffset,
30
- alignOffset,
31
- collisionPadding
32
- }));
33
- return usePart(controller.positioner, "div", props);
26
+ return usePart(controller.positioner, "div", usePositioning(controller.positioning, props));
34
27
  }
35
- /** `delay` and `closeDelay` here come before the root's. */
36
28
  function Trigger({ delay, closeDelay, ...props }) {
37
29
  const controller = use("Trigger");
38
30
  controller.timing.set(defined({
@@ -43,14 +35,14 @@ function hoverPopup(name, create, triggerTag) {
43
35
  }
44
36
  const Popup = (props) => usePart(use("Popup").popup, "div", props);
45
37
  const Arrow = (props) => usePart(use("Arrow").arrow, "div", props);
46
- return {
38
+ return parts(name, {
47
39
  Root,
48
40
  Trigger,
49
41
  Portal: Portal$1,
50
42
  Positioner,
51
43
  Popup,
52
44
  Arrow
53
- };
45
+ });
54
46
  }
55
47
  export { hoverPopup };
56
48
 
@@ -1 +1 @@
1
- {"version":3,"file":"hover-popup.js","names":["Portal","BodyPortal"],"sources":["../../../../packages/react/src/hover-popup.tsx"],"sourcesContent":["import { defined } from \"@kirana-ui/core\"\nimport type { PositionOptions, ReadonlySignal } from \"@kirana-ui/core\"\nimport type { HoverPopup, HoverPopupProps } from \"@kirana-ui/core/tooltip\"\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\nexport type RootProps = Omit<HoverPopupProps, \"id\"> & { id?: string; children?: ReactNode }\nexport type PositionerProps = PartComponentProps & Partial<PositionOptions>\nexport type TriggerProps = PartComponentProps & { delay?: number; closeDelay?: number }\n\n/** The parts of a popup the pointer opens: a tooltip's, a hover card's. */\nexport function hoverPopup(\n name: string,\n create: (props: ReadonlySignal<HoverPopupProps>) => HoverPopup,\n triggerTag: string\n) {\n const Context = createContext<HoverPopup | null>(null)\n\n function use(part: string): HoverPopup {\n const controller = useContext(Context)\n if (!controller) throw new Error(`<${name}.${part}> must be inside <${name}.Root>`)\n return controller\n }\n\n function Root({ children, ...props }: RootProps): ReactElement {\n const controller = useController(create, props)\n return <Context.Provider value={controller}>{children}</Context.Provider>\n }\n\n function Portal({ children }: { children?: ReactNode }): ReactElement | null {\n const mounted = useSignal(use(\"Portal\").mounted)\n return mounted ? <BodyPortal>{children}</BodyPortal> : null\n }\n\n function Positioner({\n side,\n align,\n sideOffset,\n alignOffset,\n collisionPadding,\n ...props\n }: PositionerProps): ReactElement {\n const controller = use(\"Positioner\")\n // Written while rendering, so the first placement reads them. Nothing re-renders for it.\n controller.positioning.set(defined({ side, align, sideOffset, alignOffset, collisionPadding }))\n return usePart(controller.positioner, \"div\", props)\n }\n\n /** `delay` and `closeDelay` here come before the root's. */\n function Trigger({ delay, closeDelay, ...props }: TriggerProps): ReactElement {\n const controller = use(\"Trigger\")\n controller.timing.set(defined({ delay, closeDelay }))\n return usePart(controller.trigger, triggerTag, props)\n }\n const Popup = (props: PartComponentProps) => usePart(use(\"Popup\").popup, \"div\", props)\n const Arrow = (props: PartComponentProps) => usePart(use(\"Arrow\").arrow, \"div\", props)\n\n return { Root, Trigger, Portal, Positioner, Popup, Arrow }\n}\n"],"mappings":";;;;;;AAcA,SAAgB,WACd,MACA,QACA,YACA;CACA,MAAM,UAAU,cAAiC,IAAI;CAErD,SAAS,IAAI,MAA0B;EACrC,MAAM,aAAa,WAAW,OAAO;EACrC,IAAI,CAAC,YAAY,MAAM,IAAI,MAAM,IAAI,KAAK,GAAG,KAAK,oBAAoB,KAAK,OAAO;EAClF,OAAO;CACT;CAEA,SAAS,KAAK,EAAE,UAAU,GAAG,SAAkC;EAC7D,MAAM,aAAa,cAAc,QAAQ,KAAK;EAC9C,OAAO,oBAAC,QAAQ,UAAT;GAAkB,OAAO;GAAa;EAA2B,CAAA;CAC1E;CAEA,SAASA,SAAO,EAAE,YAA2D;EAE3E,OADgB,UAAU,IAAI,QAAQ,CAAC,CAAC,OAC3B,IAAI,oBAACC,QAAD,EAAa,SAAqB,CAAA,IAAI;CACzD;CAEA,SAAS,WAAW,EAClB,MACA,OACA,YACA,aACA,kBACA,GAAG,SAC6B;EAChC,MAAM,aAAa,IAAI,YAAY;EAEnC,WAAW,YAAY,IAAI,QAAQ;GAAE;GAAM;GAAO;GAAY;GAAa;EAAiB,CAAC,CAAC;EAC9F,OAAO,QAAQ,WAAW,YAAY,OAAO,KAAK;CACpD;;CAGA,SAAS,QAAQ,EAAE,OAAO,YAAY,GAAG,SAAqC;EAC5E,MAAM,aAAa,IAAI,SAAS;EAChC,WAAW,OAAO,IAAI,QAAQ;GAAE;GAAO;EAAW,CAAC,CAAC;EACpD,OAAO,QAAQ,WAAW,SAAS,YAAY,KAAK;CACtD;CACA,MAAM,SAAS,UAA8B,QAAQ,IAAI,OAAO,CAAC,CAAC,OAAO,OAAO,KAAK;CACrF,MAAM,SAAS,UAA8B,QAAQ,IAAI,OAAO,CAAC,CAAC,OAAO,OAAO,KAAK;CAErF,OAAO;EAAE;EAAM;EAAS,QAAA;EAAQ;EAAY;EAAO;CAAM;AAC3D"}
1
+ {"version":3,"file":"hover-popup.js","names":["Portal","BodyPortal"],"sources":["../../../../packages/react/src/hover-popup.tsx"],"sourcesContent":["import { defined } from \"@kirana-ui/core\"\nimport type { PartState, ReadonlySignal } from \"@kirana-ui/core\"\nimport type { HoverPopup, HoverPopupProps } from \"@kirana-ui/core/tooltip\"\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 {\n PartComponentProps,\n PartTag,\n PortalProps,\n PositionerOptions,\n PositionerProps,\n} from \"./runtime.tsx\"\n\nexport type { PortalProps, PositionerProps }\n\nexport type RootProps = Omit<HoverPopupProps, \"id\"> & { id?: string; children?: ReactNode }\n\n/** What a trigger takes of its own: `delay` and `closeDelay` here come before the root's. */\nexport interface TriggerOptions {\n /** How long the pointer rests on this trigger before the popup opens, in milliseconds. */\n delay?: number\n /** How long after the pointer leaves this trigger's popup closes, in milliseconds. */\n closeDelay?: number\n}\n\n/** A trigger's props. Its element is its component's: a tooltip's `button`, a hover card's `a`. */\nexport type TriggerProps<Tag extends PartTag = \"button\", State = PartState> = PartComponentProps<\n Tag,\n State,\n TriggerOptions\n>\n\n/** The props of the parts that draw an element, as their component's entry types them. */\nexport interface HoverPartProps {\n Trigger: TriggerOptions\n Positioner: PositionerOptions\n Popup: object\n Arrow: object\n}\n\n/** The parts of a popup the pointer opens: a tooltip's, a hover card's. */\nexport function hoverPopup<Props extends HoverPartProps>(\n name: string,\n create: (props: ReadonlySignal<HoverPopupProps>) => HoverPopup,\n triggerTag: PartTag\n) {\n const Context = createContext<HoverPopup | null>(null)\n\n function use(part: string): HoverPopup {\n const controller = useContext(Context)\n if (!controller) throw new Error(`<${name}.${part}> must be inside <${name}.Root>`)\n return controller\n }\n\n function Root({ children, ...props }: RootProps): ReactElement {\n const controller = useController(create, props)\n return <Context.Provider value={controller}>{children}</Context.Provider>\n }\n\n function Portal({ children }: PortalProps): ReactElement | null {\n const mounted = useSignal(use(\"Portal\").mounted)\n return mounted ? <BodyPortal>{children}</BodyPortal> : null\n }\n\n function Positioner(props: PositionerProps): ReactElement {\n const controller = use(\"Positioner\")\n return usePart(controller.positioner, \"div\", usePositioning(controller.positioning, props))\n }\n\n function Trigger({ delay, closeDelay, ...props }: TriggerProps<\"div\">): ReactElement {\n const controller = use(\"Trigger\")\n controller.timing.set(defined({ delay, closeDelay }))\n // Typed here as any part's: the entry says which element it is.\n return usePart(controller.trigger, triggerTag as \"div\", props)\n }\n const Popup = (props: PartComponentProps) => usePart(use(\"Popup\").popup, \"div\", props)\n const Arrow = (props: PartComponentProps) => usePart(use(\"Arrow\").arrow, \"div\", props)\n\n return parts(name, { Root, Trigger, Portal, Positioner, Popup, Arrow }) as unknown as {\n Root: (props: RootProps) => ReactElement\n Trigger: (props: Props[\"Trigger\"]) => ReactElement\n Portal: (props: PortalProps) => ReactElement | null\n Positioner: (props: Props[\"Positioner\"]) => ReactElement\n Popup: (props: Props[\"Popup\"]) => ReactElement\n Arrow: (props: Props[\"Arrow\"]) => ReactElement\n }\n}\n"],"mappings":";;;;;;AAkDA,SAAgB,WACd,MACA,QACA,YACA;CACA,MAAM,UAAU,cAAiC,IAAI;CAErD,SAAS,IAAI,MAA0B;EACrC,MAAM,aAAa,WAAW,OAAO;EACrC,IAAI,CAAC,YAAY,MAAM,IAAI,MAAM,IAAI,KAAK,GAAG,KAAK,oBAAoB,KAAK,OAAO;EAClF,OAAO;CACT;CAEA,SAAS,KAAK,EAAE,UAAU,GAAG,SAAkC;EAC7D,MAAM,aAAa,cAAc,QAAQ,KAAK;EAC9C,OAAO,oBAAC,QAAQ,UAAT;GAAkB,OAAO;GAAa;EAA2B,CAAA;CAC1E;CAEA,SAASA,SAAO,EAAE,YAA8C;EAE9D,OADgB,UAAU,IAAI,QAAQ,CAAC,CAAC,OAC3B,IAAI,oBAACC,QAAD,EAAa,SAAqB,CAAA,IAAI;CACzD;CAEA,SAAS,WAAW,OAAsC;EACxD,MAAM,aAAa,IAAI,YAAY;EACnC,OAAO,QAAQ,WAAW,YAAY,OAAO,eAAe,WAAW,aAAa,KAAK,CAAC;CAC5F;CAEA,SAAS,QAAQ,EAAE,OAAO,YAAY,GAAG,SAA4C;EACnF,MAAM,aAAa,IAAI,SAAS;EAChC,WAAW,OAAO,IAAI,QAAQ;GAAE;GAAO;EAAW,CAAC,CAAC;EAEpD,OAAO,QAAQ,WAAW,SAAS,YAAqB,KAAK;CAC/D;CACA,MAAM,SAAS,UAA8B,QAAQ,IAAI,OAAO,CAAC,CAAC,OAAO,OAAO,KAAK;CACrF,MAAM,SAAS,UAA8B,QAAQ,IAAI,OAAO,CAAC,CAAC,OAAO,OAAO,KAAK;CAErF,OAAO,MAAM,MAAM;EAAE;EAAM;EAAS,QAAA;EAAQ;EAAY;EAAO;CAAM,CAAC;AAQxE"}
package/src/index.d.ts CHANGED
@@ -22,7 +22,7 @@ import { Calendar } from "./calendar.js";
22
22
  import { QrCode } from "./qr-code.js";
23
23
  import { Autosize } from "./autosize.js";
24
24
  import { Carousel } from "./carousel.js";
25
- import { Toast, createToaster } from "./toast.js";
25
+ import { Toast, ToastActionOptions, ToastContent, ToastOptions, ToastRecord, ToastState, Toaster, ToasterOptions, createToaster } from "./toast.js";
26
26
  import { Resizable } from "./resizable.js";
27
27
  import { Popover } from "./popover.js";
28
28
  import { RadioGroup } from "./radio-group.js";
@@ -30,7 +30,7 @@ import { Select } from "./select.js";
30
30
  import { Switch } from "./switch.js";
31
31
  import { Tabs } from "./tabs.js";
32
32
  import { Tooltip } from "./tooltip.js";
33
- import { PartComponentProps, PortalProvider, PortalProviderProps, RenderProp } from "./runtime.js";
33
+ import { PartComponentProps, PartEvent, PortalProvider, PortalProviderProps, RenderProp } from "./runtime.js";
34
34
  import { Avatar } from "./avatar.js";
35
35
  import { Button } from "./button.js";
36
36
  import { Meter } from "./meter.js";
@@ -45,4 +45,14 @@ import { Field } from "./field.js";
45
45
  import { Fieldset } from "./fieldset.js";
46
46
  import { Form } from "./form.js";
47
47
  import { DirectionProvider, DirectionProviderProps, useDirection } from "./direction.js";
48
- export { Accordion, AlertDialog, Autocomplete, Autosize, Avatar, Button, Calendar, Carousel, Checkbox, Collapsible, Combobox, Command, ContextMenu, DateField, DatePicker, Dialog, DirectionProvider, type DirectionProviderProps, Drawer, Field, Fieldset, Form, HoverCard, Input, Label, Listbox, Menu, Menubar, MessageScroller, Meter, NavigationMenu, NumberField, Otp, Pagination, type PartComponentProps, Popover, PortalProvider, type PortalProviderProps, Progress, QrCode, RadioGroup, type RenderProp, Resizable, ScrollArea, Select, Separator, Slider, Switch, Tabs, Toast, Toggle, ToggleGroup, Toolbar, Tooltip, createToaster, useDirection };
48
+ import { Align, Anchor, AnchorOption, Bindable, ChangeDetails, ChangeSource, ComponentDefinition, Direction, ItemLabels, ListCollection, Orientation, Part, PartDefinition, PartProps, PartState, PartStyle, PhysicalSide, PositionOptions, ReadonlySignal, Side, Signal, StateDefinition, StateOf } from "@kirana-ui/core";
49
+ import { CalendarDay, CalendarValue, CalendarWeekday, DateRange, IsoDate } from "@kirana-ui/core/calendar";
50
+ import { DateFieldSegment, DateUnit } from "@kirana-ui/core/date-field";
51
+ import { DrawerSide, DrawerSnapPoint } from "@kirana-ui/core/drawer";
52
+ import { QrCorrection } from "@kirana-ui/core/qr-code";
53
+ import { SelectShown } from "@kirana-ui/core/select";
54
+ import { FieldValidity, ValidityKey } from "@kirana-ui/core/field";
55
+ import { FormErrors, FormValues, ValidationMode } from "@kirana-ui/core/form";
56
+ import { PaginationEntry } from "@kirana-ui/core/pagination";
57
+ import { SliderChangeDetails, SliderTold } from "@kirana-ui/core/slider";
58
+ export { Accordion, AlertDialog, type Align, type Anchor, type AnchorOption, Autocomplete, Autosize, Avatar, type Bindable, Button, Calendar, type CalendarDay, type CalendarValue, type CalendarWeekday, Carousel, type ChangeDetails, type ChangeSource, Checkbox, Collapsible, Combobox, Command, type ComponentDefinition, ContextMenu, DateField, type DateFieldSegment, DatePicker, type DateRange, type DateUnit, Dialog, type Direction, DirectionProvider, type DirectionProviderProps, Drawer, type DrawerSide, type DrawerSnapPoint, Field, type FieldValidity, Fieldset, Form, type FormErrors, type FormValues, HoverCard, Input, type IsoDate, type ItemLabels, Label, type ListCollection, Listbox, Menu, Menubar, MessageScroller, Meter, NavigationMenu, NumberField, type Orientation, Otp, Pagination, type PaginationEntry, type Part, type PartComponentProps, type PartDefinition, type PartEvent, type PartProps, type PartState, type PartStyle, type PhysicalSide, Popover, PortalProvider, type PortalProviderProps, type PositionOptions, Progress, QrCode, type QrCorrection, RadioGroup, type ReadonlySignal, type RenderProp, Resizable, ScrollArea, Select, type SelectShown, Separator, type Side, type Signal, Slider, type SliderChangeDetails, type SliderTold, type StateDefinition, type StateOf, Switch, Tabs, Toast, type ToastActionOptions, type ToastContent, type ToastOptions, type ToastRecord, type ToastState, type Toaster, type ToasterOptions, Toggle, ToggleGroup, Toolbar, Tooltip, type ValidationMode, type ValidityKey, createToaster, useDirection };
package/src/input.d.ts CHANGED
@@ -1,10 +1,12 @@
1
1
  import { PartComponentProps } from "./runtime.js";
2
+ import { StateOf } from "@kirana-ui/core";
2
3
  import { ReactElement } from "react";
3
4
  import { InputProps as InputProps$1 } from "@kirana-ui/core/input";
4
- export type InputProps = InputProps$1 & PartComponentProps;
5
+ import { Vocabulary } from "@kirana-ui/core/vocabulary";
6
+ export type InputProps = PartComponentProps<"input", StateOf<Vocabulary["input"]["input"]>, InputProps$1>;
5
7
  /**
6
8
  * An `<input>`; a `<textarea>` through `render`. It takes what an `<input>` takes (`value`,
7
9
  * `defaultValue`), and inside a `<Field.Root>` it is the field's control.
8
10
  */
9
- export declare function Input({ disabled, onValueChange, ...rest }: InputProps): ReactElement;
11
+ export declare const Input: ({ disabled, onValueChange, ...rest }: InputProps) => ReactElement;
10
12
  //# sourceMappingURL=input.d.ts.map
package/src/input.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { FieldContext } from "./field-context.js";
2
- import { useController, usePart } from "./runtime.js";
2
+ import { component, useController, usePart } from "./runtime.js";
3
3
  import { within } from "@kirana-ui/core";
4
4
  import { useContext } from "react";
5
5
  import { createInput } from "@kirana-ui/core/input";
@@ -8,14 +8,14 @@ import { createInput } from "@kirana-ui/core/input";
8
8
  * An `<input>`; a `<textarea>` through `render`. It takes what an `<input>` takes (`value`,
9
9
  * `defaultValue`), and inside a `<Field.Root>` it is the field's control.
10
10
  */
11
- function Input({ disabled, onValueChange, ...rest }) {
11
+ const Input = /* @__PURE__ */ component("Input", function Input({ disabled, onValueChange, ...rest }) {
12
12
  const field = useContext(FieldContext) ?? void 0;
13
13
  const controller = useController(within(createInput, { field }), {
14
14
  disabled,
15
15
  onValueChange
16
16
  });
17
17
  return usePart(controller.input, "input", rest);
18
- }
18
+ });
19
19
  export { Input };
20
20
 
21
21
  //# sourceMappingURL=input.js.map
package/src/input.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"input.js","names":[],"sources":["../../../../packages/react/src/input.tsx"],"sourcesContent":["import { within } from \"@kirana-ui/core\"\nimport { createInput } from \"@kirana-ui/core/input\"\nimport type { Input as Controller, InputProps as CoreProps } from \"@kirana-ui/core/input\"\nimport { useContext } from \"react\"\nimport type { ReactElement } from \"react\"\n\nimport { FieldContext } from \"./field-context.ts\"\nimport { useController, usePart } from \"./runtime.tsx\"\nimport type { PartComponentProps } from \"./runtime.tsx\"\n\nexport type InputProps = CoreProps & PartComponentProps\n\n/**\n * An `<input>`; a `<textarea>` through `render`. It takes what an `<input>` takes (`value`,\n * `defaultValue`), and inside a `<Field.Root>` it is the field's control.\n */\nexport function Input({ disabled, onValueChange, ...rest }: InputProps): ReactElement {\n const field = useContext(FieldContext) ?? undefined\n const controller = useController<CoreProps, Controller>(within(createInput, { field }), {\n disabled,\n onValueChange,\n })\n return usePart(controller.input, \"input\", rest)\n}\n"],"mappings":";;;;;;;;;;AAgBA,SAAgB,MAAM,EAAE,UAAU,eAAe,GAAG,QAAkC;CACpF,MAAM,QAAQ,WAAW,YAAY,KAAK,KAAA;CAC1C,MAAM,aAAa,cAAqC,OAAO,aAAa,EAAE,MAAM,CAAC,GAAG;EACtF;EACA;CACF,CAAC;CACD,OAAO,QAAQ,WAAW,OAAO,SAAS,IAAI;AAChD"}
1
+ {"version":3,"file":"input.js","names":[],"sources":["../../../../packages/react/src/input.tsx"],"sourcesContent":["import { within } from \"@kirana-ui/core\"\nimport type { StateOf } from \"@kirana-ui/core\"\nimport { createInput } from \"@kirana-ui/core/input\"\nimport type { Input as Controller, InputProps as CoreProps } from \"@kirana-ui/core/input\"\nimport type { Vocabulary } from \"@kirana-ui/core/vocabulary\"\nimport { useContext } from \"react\"\nimport type { ReactElement } from \"react\"\n\nimport { FieldContext } from \"./field-context.ts\"\nimport { component, useController, usePart } from \"./runtime.tsx\"\nimport type { PartComponentProps } from \"./runtime.tsx\"\n\nexport type InputProps = PartComponentProps<\n \"input\",\n StateOf<Vocabulary[\"input\"][\"input\"]>,\n CoreProps\n>\n\n/**\n * An `<input>`; a `<textarea>` through `render`. It takes what an `<input>` takes (`value`,\n * `defaultValue`), and inside a `<Field.Root>` it is the field's control.\n */\nexport const Input = /* @__PURE__ */ component(\n \"Input\",\n function Input({ disabled, onValueChange, ...rest }: InputProps): ReactElement {\n const field = useContext(FieldContext) ?? undefined\n const controller = useController<CoreProps, Controller>(within(createInput, { field }), {\n disabled,\n onValueChange,\n })\n return usePart(controller.input, \"input\", rest)\n }\n)\n"],"mappings":";;;;;;;;;;AAsBA,MAAa,QAAwB,0BACnC,SACA,SAAS,MAAM,EAAE,UAAU,eAAe,GAAG,QAAkC;CAC7E,MAAM,QAAQ,WAAW,YAAY,KAAK,KAAA;CAC1C,MAAM,aAAa,cAAqC,OAAO,aAAa,EAAE,MAAM,CAAC,GAAG;EACtF;EACA;CACF,CAAC;CACD,OAAO,QAAQ,WAAW,OAAO,SAAS,IAAI;AAChD,CACF"}
package/src/label.d.ts CHANGED
@@ -1,5 +1,8 @@
1
1
  import { PartComponentProps } from "./runtime.js";
2
+ import { StateOf } from "@kirana-ui/core";
2
3
  import { ReactElement } from "react";
4
+ import { Vocabulary } from "@kirana-ui/core/vocabulary";
5
+ export type LabelProps = PartComponentProps<"label", StateOf<Vocabulary["label"]["label"]>>;
3
6
  /** A `<label>`. Inside a `<Field.Root>` it is the field's label. */
4
- export declare function Label(props: PartComponentProps): ReactElement;
7
+ export declare const Label: (props: LabelProps) => ReactElement;
5
8
  //# sourceMappingURL=label.d.ts.map
package/src/label.js CHANGED
@@ -1,14 +1,14 @@
1
1
  import { FieldContext } from "./field-context.js";
2
- import { usePart } from "./runtime.js";
2
+ import { component, usePart } from "./runtime.js";
3
3
  import { useContext, useMemo } from "react";
4
4
  import { createLabel } from "@kirana-ui/core/label";
5
5
  // src/label.tsx
6
6
  /** A `<label>`. Inside a `<Field.Root>` it is the field's label. */
7
- function Label(props) {
7
+ const Label = /* @__PURE__ */ component("Label", function Label(props) {
8
8
  const field = useContext(FieldContext) ?? void 0;
9
9
  const made = useMemo(() => createLabel({ field }), [field]);
10
10
  return usePart(made.label, "label", props);
11
- }
11
+ });
12
12
  export { Label };
13
13
 
14
14
  //# sourceMappingURL=label.js.map
package/src/label.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"label.js","names":[],"sources":["../../../../packages/react/src/label.tsx"],"sourcesContent":["import { createLabel } from \"@kirana-ui/core/label\"\nimport { useContext, useMemo } from \"react\"\nimport type { ReactElement } from \"react\"\n\nimport { FieldContext } from \"./field-context.ts\"\nimport { usePart } from \"./runtime.tsx\"\nimport type { PartComponentProps } from \"./runtime.tsx\"\n\n/** A `<label>`. Inside a `<Field.Root>` it is the field's label. */\nexport function Label(props: PartComponentProps): ReactElement {\n const field = useContext(FieldContext) ?? undefined\n const made = useMemo(() => createLabel({ field }), [field])\n return usePart(made.label, \"label\", props)\n}\n"],"mappings":";;;;;;AASA,SAAgB,MAAM,OAAyC;CAC7D,MAAM,QAAQ,WAAW,YAAY,KAAK,KAAA;CAC1C,MAAM,OAAO,cAAc,YAAY,EAAE,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC;CAC1D,OAAO,QAAQ,KAAK,OAAO,SAAS,KAAK;AAC3C"}
1
+ {"version":3,"file":"label.js","names":[],"sources":["../../../../packages/react/src/label.tsx"],"sourcesContent":["import type { StateOf } from \"@kirana-ui/core\"\nimport { createLabel } from \"@kirana-ui/core/label\"\nimport type { Vocabulary } from \"@kirana-ui/core/vocabulary\"\nimport { useContext, useMemo } from \"react\"\nimport type { ReactElement } from \"react\"\n\nimport { FieldContext } from \"./field-context.ts\"\nimport { component, usePart } from \"./runtime.tsx\"\nimport type { PartComponentProps } from \"./runtime.tsx\"\n\nexport type LabelProps = PartComponentProps<\"label\", StateOf<Vocabulary[\"label\"][\"label\"]>>\n\n/** A `<label>`. Inside a `<Field.Root>` it is the field's label. */\nexport const Label = /* @__PURE__ */ component(\n \"Label\",\n function Label(props: LabelProps): ReactElement {\n const field = useContext(FieldContext) ?? undefined\n const made = useMemo(() => createLabel({ field }), [field])\n return usePart(made.label, \"label\", props)\n }\n)\n"],"mappings":";;;;;;AAaA,MAAa,QAAwB,0BACnC,SACA,SAAS,MAAM,OAAiC;CAC9C,MAAM,QAAQ,WAAW,YAAY,KAAK,KAAA;CAC1C,MAAM,OAAO,cAAc,YAAY,EAAE,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC;CAC1D,OAAO,QAAQ,KAAK,OAAO,SAAS,KAAK;AAC3C,CACF"}
package/src/listbox.d.ts CHANGED
@@ -1,28 +1,36 @@
1
1
  import { PartComponentProps } from "./runtime.js";
2
+ import { StateOf } from "@kirana-ui/core";
2
3
  import { ReactElement } from "react";
3
4
  import { ListboxItemOptions, ListboxProps } from "@kirana-ui/core/listbox";
4
- export type RootProps<Value> = Omit<ListboxProps<Value>, "id"> & {
5
+ import { Vocabulary } from "@kirana-ui/core/vocabulary";
6
+ type Parts = Vocabulary["listbox"];
7
+ /** `Value` is what tells an item from the others: the type of `value`'s entries. */
8
+ export type RootProps<Value = unknown> = PartComponentProps<"div", StateOf<Parts["root"]>, Omit<ListboxProps<Value>, "id"> & {
5
9
  id?: string;
6
- } & PartComponentProps;
7
- declare function Root<Value>({ value, defaultValue, onValueChange, multiple, disabled, loop, name, form, virtualized, id, ...rest }: RootProps<Value>): ReactElement;
8
- export type ItemProps = PartComponentProps & ListboxItemOptions & {
10
+ }>;
11
+ declare function Root<Value = unknown>({ value, defaultValue, onValueChange, multiple, disabled, loop, name, form, virtualized, id, ...rest }: RootProps<Value>): ReactElement;
12
+ export type ItemProps = PartComponentProps<"div", StateOf<Parts["item"]>, ListboxItemOptions & {
13
+ /** What is in the listbox's value while this item is chosen. */
9
14
  value: unknown;
10
- };
15
+ }>;
11
16
  declare function Item({ value, disabled, label, index, ...props }: ItemProps): ReactElement;
12
- export interface ItemIndicatorProps extends PartComponentProps {
17
+ export type ItemIndicatorProps = PartComponentProps<"span", StateOf<Parts["itemIndicator"]>, {
18
+ /** Keeps the mark in the page while its item is not chosen. */
13
19
  keepMounted?: boolean;
14
- }
20
+ }>;
15
21
  declare function ItemIndicator({ keepMounted, ...props }: ItemIndicatorProps): ReactElement | null;
16
- declare function Group({ id, ...props }: PartComponentProps & {
22
+ export type GroupProps = PartComponentProps<"div", StateOf<Parts["group"]>, {
17
23
  id?: string;
18
- }): ReactElement;
19
- declare function GroupLabel(props: PartComponentProps): ReactElement;
24
+ }>;
25
+ declare function Group({ id, ...props }: GroupProps): ReactElement;
26
+ export type GroupLabelProps = PartComponentProps<"div", StateOf<Parts["groupLabel"]>>;
27
+ declare function GroupLabel(props: GroupLabelProps): ReactElement;
20
28
  export declare const Listbox: {
21
- Root: typeof Root;
22
- Item: typeof Item;
23
- ItemIndicator: typeof ItemIndicator;
24
- Group: typeof Group;
25
- GroupLabel: typeof GroupLabel;
29
+ readonly Root: typeof Root;
30
+ readonly Item: typeof Item;
31
+ readonly ItemIndicator: typeof ItemIndicator;
32
+ readonly Group: typeof Group;
33
+ readonly GroupLabel: typeof GroupLabel;
26
34
  };
27
35
  export {};
28
36
  //# sourceMappingURL=listbox.d.ts.map
package/src/listbox.js CHANGED
@@ -1,4 +1,4 @@
1
- import { useController, useOptions, usePart, useSignal } from "./runtime.js";
1
+ import { PartElement, parts, useController, useOptions, usePart, useSignal } from "./runtime.js";
2
2
  import { defined } from "@kirana-ui/core";
3
3
  import { createContext, useContext, useId, useMemo } from "react";
4
4
  import { jsx } from "react/jsx-runtime";
@@ -47,14 +47,13 @@ function Item({ value, disabled, label, index, ...props }) {
47
47
  children: usePart(part, "div", props)
48
48
  });
49
49
  }
50
- const PartElement = ({ part, tag, ...props }) => usePart(part, tag, props);
51
50
  function ItemIndicator({ keepMounted, ...props }) {
52
51
  const controller = useListbox("ItemIndicator");
53
52
  const value = useContext(ItemContext);
54
53
  const selected = useSignal(controller.selected(value));
55
54
  const part = useMemo(() => controller.indicator(value), [controller, value]);
56
55
  return selected || keepMounted ? /* @__PURE__ */ jsx(PartElement, {
57
- part,
56
+ of: part,
58
57
  tag: "span",
59
58
  ...props
60
59
  }) : null;
@@ -77,13 +76,13 @@ function GroupLabel(props) {
77
76
  if (!group) throw new Error("<Listbox.GroupLabel> must be inside <Listbox.Group>");
78
77
  return usePart(group.label, "div", props);
79
78
  }
80
- const Listbox = {
79
+ const Listbox = /* @__PURE__ */ parts("Listbox", {
81
80
  Root,
82
81
  Item,
83
82
  ItemIndicator,
84
83
  Group,
85
84
  GroupLabel
86
- };
85
+ });
87
86
  export { Listbox };
88
87
 
89
88
  //# sourceMappingURL=listbox.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"listbox.js","names":[],"sources":["../../../../packages/react/src/listbox.tsx"],"sourcesContent":["import { defined } from \"@kirana-ui/core\"\nimport type { Part } from \"@kirana-ui/core\"\nimport { createListbox } from \"@kirana-ui/core/listbox\"\nimport type {\n Listbox as Controller,\n ListboxGroup,\n ListboxItemOptions,\n ListboxProps,\n} from \"@kirana-ui/core/listbox\"\nimport { createContext, useContext, useId, useMemo } from \"react\"\nimport type { ReactElement } from \"react\"\n\nimport { useController, useOptions, usePart, useSignal } from \"./runtime.tsx\"\nimport type { PartComponentProps } from \"./runtime.tsx\"\n\nconst Context = createContext<Controller | null>(null)\nconst ItemContext = createContext<unknown>(undefined)\nconst GroupContext = createContext<ListboxGroup | null>(null)\n\nfunction useListbox(part: string): Controller {\n const controller = useContext(Context)\n if (!controller) throw new Error(`<Listbox.${part}> must be inside <Listbox.Root>`)\n return controller\n}\n\nexport type RootProps<Value> = Omit<ListboxProps<Value>, \"id\"> & {\n id?: string\n} & PartComponentProps\n\nfunction Root<Value>({\n value,\n defaultValue,\n onValueChange,\n multiple,\n disabled,\n loop,\n name,\n form,\n virtualized,\n id,\n ...rest\n}: RootProps<Value>): ReactElement {\n const controller = useController<ListboxProps<Value>, Controller<Value>>(createListbox, {\n value: value as readonly Value[] | undefined,\n defaultValue: defaultValue as readonly Value[] | undefined,\n onValueChange,\n multiple,\n disabled,\n loop,\n name,\n form,\n virtualized,\n id,\n }) as unknown as Controller\n return (\n <Context.Provider value={controller}>{usePart(controller.root, \"div\", rest)}</Context.Provider>\n )\n}\n\nexport type ItemProps = PartComponentProps & ListboxItemOptions & { value: unknown }\n\nfunction Item({ value, disabled, label, index, ...props }: ItemProps): ReactElement {\n const controller = useListbox(\"Item\")\n const options = useOptions({ disabled, label, index })\n const part = useMemo(\n () => controller.item(value, () => defined(options.get())),\n [controller, value, options]\n )\n return <ItemContext.Provider value={value}>{usePart(part, \"div\", props)}</ItemContext.Provider>\n}\n\nconst PartElement = ({ part, tag, ...props }: PartComponentProps & { part: Part; tag: string }) =>\n usePart(part, tag, props)\n\nexport interface ItemIndicatorProps extends PartComponentProps {\n keepMounted?: boolean\n}\n\nfunction ItemIndicator({ keepMounted, ...props }: ItemIndicatorProps): ReactElement | null {\n const controller = useListbox(\"ItemIndicator\")\n const value = useContext(ItemContext)\n const selected = useSignal(controller.selected(value))\n const part = useMemo(() => controller.indicator(value), [controller, value])\n return selected || keepMounted ? <PartElement part={part} tag=\"span\" {...props} /> : null\n}\n\nfunction Group({ id, ...props }: PartComponentProps & { id?: string }): ReactElement {\n const controller = useListbox(\"Group\")\n const generated = useId()\n const group = useMemo(() => controller.group(id ?? generated), [controller, id, generated])\n return (\n <GroupContext.Provider value={group}>{usePart(group.root, \"div\", props)}</GroupContext.Provider>\n )\n}\n\nfunction GroupLabel(props: PartComponentProps): ReactElement {\n const group = useContext(GroupContext)\n if (!group) throw new Error(\"<Listbox.GroupLabel> must be inside <Listbox.Group>\")\n return usePart(group.label, \"div\", props)\n}\n\nexport const Listbox = { Root, Item, ItemIndicator, Group, GroupLabel }\n"],"mappings":";;;;;;AAeA,MAAM,UAAU,cAAiC,IAAI;AACrD,MAAM,cAAc,cAAuB,KAAA,CAAS;AACpD,MAAM,eAAe,cAAmC,IAAI;AAE5D,SAAS,WAAW,MAA0B;CAC5C,MAAM,aAAa,WAAW,OAAO;CACrC,IAAI,CAAC,YAAY,MAAM,IAAI,MAAM,YAAY,KAAK,gCAAgC;CAClF,OAAO;AACT;AAMA,SAAS,KAAY,EACnB,OACA,cACA,eACA,UACA,UACA,MACA,MACA,MACA,aACA,IACA,GAAG,QAC8B;CACjC,MAAM,aAAa,cAAsD,eAAe;EAC/E;EACO;EACd;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,SAAS,KAAK,EAAE,OAAO,UAAU,OAAO,OAAO,GAAG,SAAkC;CAClF,MAAM,aAAa,WAAW,MAAM;CACpC,MAAM,UAAU,WAAW;EAAE;EAAU;EAAO;CAAM,CAAC;CACrD,MAAM,OAAO,cACL,WAAW,KAAK,aAAa,QAAQ,QAAQ,IAAI,CAAC,CAAC,GACzD;EAAC;EAAY;EAAO;CAAO,CAC7B;CACA,OAAO,oBAAC,YAAY,UAAb;EAA6B;EAAQ,UAAA,QAAQ,MAAM,OAAO,KAAK;CAAwB,CAAA;AAChG;AAEA,MAAM,eAAe,EAAE,MAAM,KAAK,GAAG,YACnC,QAAQ,MAAM,KAAK,KAAK;AAM1B,SAAS,cAAc,EAAE,aAAa,GAAG,SAAkD;CACzF,MAAM,aAAa,WAAW,eAAe;CAC7C,MAAM,QAAQ,WAAW,WAAW;CACpC,MAAM,WAAW,UAAU,WAAW,SAAS,KAAK,CAAC;CACrD,MAAM,OAAO,cAAc,WAAW,UAAU,KAAK,GAAG,CAAC,YAAY,KAAK,CAAC;CAC3E,OAAO,YAAY,cAAc,oBAAC,aAAD;EAAmB;EAAM,KAAI;EAAO,GAAI;CAAQ,CAAA,IAAI;AACvF;AAEA,SAAS,MAAM,EAAE,IAAI,GAAG,SAA6D;CACnF,MAAM,aAAa,WAAW,OAAO;CACrC,MAAM,YAAY,MAAM;CACxB,MAAM,QAAQ,cAAc,WAAW,MAAM,MAAM,SAAS,GAAG;EAAC;EAAY;EAAI;CAAS,CAAC;CAC1F,OACE,oBAAC,aAAa,UAAd;EAAuB,OAAO;EAAQ,UAAA,QAAQ,MAAM,MAAM,OAAO,KAAK;CAAyB,CAAA;AAEnG;AAEA,SAAS,WAAW,OAAyC;CAC3D,MAAM,QAAQ,WAAW,YAAY;CACrC,IAAI,CAAC,OAAO,MAAM,IAAI,MAAM,qDAAqD;CACjF,OAAO,QAAQ,MAAM,OAAO,OAAO,KAAK;AAC1C;AAEA,MAAa,UAAU;CAAE;CAAM;CAAM;CAAe;CAAO;AAAW"}
1
+ {"version":3,"file":"listbox.js","names":[],"sources":["../../../../packages/react/src/listbox.tsx"],"sourcesContent":["import { defined } from \"@kirana-ui/core\"\nimport type { StateOf } from \"@kirana-ui/core\"\nimport { createListbox } from \"@kirana-ui/core/listbox\"\nimport type {\n Listbox as Controller,\n ListboxGroup,\n ListboxItemOptions,\n ListboxProps,\n} from \"@kirana-ui/core/listbox\"\nimport type { Vocabulary } from \"@kirana-ui/core/vocabulary\"\nimport { createContext, useContext, useId, useMemo } from \"react\"\nimport type { ReactElement } from \"react\"\n\nimport { PartElement, parts, useController, useOptions, usePart, useSignal } from \"./runtime.tsx\"\nimport type { PartComponentProps } from \"./runtime.tsx\"\n\ntype Parts = Vocabulary[\"listbox\"]\n\nconst Context = createContext<Controller | null>(null)\nconst ItemContext = createContext<unknown>(undefined)\nconst GroupContext = createContext<ListboxGroup | null>(null)\n\nfunction useListbox(part: string): Controller {\n const controller = useContext(Context)\n if (!controller) throw new Error(`<Listbox.${part}> must be inside <Listbox.Root>`)\n return controller\n}\n\n/** `Value` is what tells an item from the others: the type of `value`'s entries. */\nexport type RootProps<Value = unknown> = PartComponentProps<\n \"div\",\n StateOf<Parts[\"root\"]>,\n Omit<ListboxProps<Value>, \"id\"> & { id?: string }\n>\n\nfunction Root<Value = unknown>({\n value,\n defaultValue,\n onValueChange,\n multiple,\n disabled,\n loop,\n name,\n form,\n virtualized,\n id,\n ...rest\n}: RootProps<Value>): ReactElement {\n const controller: Controller = useController<ListboxProps<Value>, Controller<Value>>(\n createListbox,\n { value, defaultValue, onValueChange, multiple, disabled, loop, name, form, virtualized, id }\n )\n return (\n <Context.Provider value={controller}>{usePart(controller.root, \"div\", rest)}</Context.Provider>\n )\n}\n\nexport type ItemProps = PartComponentProps<\n \"div\",\n StateOf<Parts[\"item\"]>,\n ListboxItemOptions & {\n /** What is in the listbox's value while this item is chosen. */\n value: unknown\n }\n>\n\nfunction Item({ value, disabled, label, index, ...props }: ItemProps): ReactElement {\n const controller = useListbox(\"Item\")\n const options = useOptions({ disabled, label, index })\n const part = useMemo(\n () => controller.item(value, () => defined(options.get())),\n [controller, value, options]\n )\n return <ItemContext.Provider value={value}>{usePart(part, \"div\", props)}</ItemContext.Provider>\n}\n\nexport type ItemIndicatorProps = PartComponentProps<\n \"span\",\n StateOf<Parts[\"itemIndicator\"]>,\n {\n /** Keeps the mark in the page while its item is not chosen. */\n keepMounted?: boolean\n }\n>\n\nfunction ItemIndicator({ keepMounted, ...props }: ItemIndicatorProps): ReactElement | null {\n const controller = useListbox(\"ItemIndicator\")\n const value = useContext(ItemContext)\n const selected = useSignal(controller.selected(value))\n const part = useMemo(() => controller.indicator(value), [controller, value])\n return selected || keepMounted ? <PartElement of={part} tag=\"span\" {...props} /> : null\n}\n\nexport type GroupProps = PartComponentProps<\"div\", StateOf<Parts[\"group\"]>, { id?: string }>\n\nfunction Group({ id, ...props }: GroupProps): ReactElement {\n const controller = useListbox(\"Group\")\n const generated = useId()\n const group = useMemo(() => controller.group(id ?? generated), [controller, id, generated])\n return (\n <GroupContext.Provider value={group}>{usePart(group.root, \"div\", props)}</GroupContext.Provider>\n )\n}\n\nexport type GroupLabelProps = PartComponentProps<\"div\", StateOf<Parts[\"groupLabel\"]>>\n\nfunction GroupLabel(props: GroupLabelProps): ReactElement {\n const group = useContext(GroupContext)\n if (!group) throw new Error(\"<Listbox.GroupLabel> must be inside <Listbox.Group>\")\n return usePart(group.label, \"div\", props)\n}\n\nexport const Listbox = /* @__PURE__ */ parts(\"Listbox\", {\n Root,\n Item,\n ItemIndicator,\n Group,\n GroupLabel,\n})\n"],"mappings":";;;;;;AAkBA,MAAM,UAAU,cAAiC,IAAI;AACrD,MAAM,cAAc,cAAuB,KAAA,CAAS;AACpD,MAAM,eAAe,cAAmC,IAAI;AAE5D,SAAS,WAAW,MAA0B;CAC5C,MAAM,aAAa,WAAW,OAAO;CACrC,IAAI,CAAC,YAAY,MAAM,IAAI,MAAM,YAAY,KAAK,gCAAgC;CAClF,OAAO;AACT;AASA,SAAS,KAAsB,EAC7B,OACA,cACA,eACA,UACA,UACA,MACA,MACA,MACA,aACA,IACA,GAAG,QAC8B;CACjC,MAAM,aAAyB,cAC7B,eACA;EAAE;EAAO;EAAc;EAAe;EAAU;EAAU;EAAM;EAAM;EAAM;EAAa;CAAG,CAC9F;CACA,OACE,oBAAC,QAAQ,UAAT;EAAkB,OAAO;EAAa,UAAA,QAAQ,WAAW,MAAM,OAAO,IAAI;CAAoB,CAAA;AAElG;AAWA,SAAS,KAAK,EAAE,OAAO,UAAU,OAAO,OAAO,GAAG,SAAkC;CAClF,MAAM,aAAa,WAAW,MAAM;CACpC,MAAM,UAAU,WAAW;EAAE;EAAU;EAAO;CAAM,CAAC;CACrD,MAAM,OAAO,cACL,WAAW,KAAK,aAAa,QAAQ,QAAQ,IAAI,CAAC,CAAC,GACzD;EAAC;EAAY;EAAO;CAAO,CAC7B;CACA,OAAO,oBAAC,YAAY,UAAb;EAA6B;EAAQ,UAAA,QAAQ,MAAM,OAAO,KAAK;CAAwB,CAAA;AAChG;AAWA,SAAS,cAAc,EAAE,aAAa,GAAG,SAAkD;CACzF,MAAM,aAAa,WAAW,eAAe;CAC7C,MAAM,QAAQ,WAAW,WAAW;CACpC,MAAM,WAAW,UAAU,WAAW,SAAS,KAAK,CAAC;CACrD,MAAM,OAAO,cAAc,WAAW,UAAU,KAAK,GAAG,CAAC,YAAY,KAAK,CAAC;CAC3E,OAAO,YAAY,cAAc,oBAAC,aAAD;EAAa,IAAI;EAAM,KAAI;EAAO,GAAI;CAAQ,CAAA,IAAI;AACrF;AAIA,SAAS,MAAM,EAAE,IAAI,GAAG,SAAmC;CACzD,MAAM,aAAa,WAAW,OAAO;CACrC,MAAM,YAAY,MAAM;CACxB,MAAM,QAAQ,cAAc,WAAW,MAAM,MAAM,SAAS,GAAG;EAAC;EAAY;EAAI;CAAS,CAAC;CAC1F,OACE,oBAAC,aAAa,UAAd;EAAuB,OAAO;EAAQ,UAAA,QAAQ,MAAM,MAAM,OAAO,KAAK;CAAyB,CAAA;AAEnG;AAIA,SAAS,WAAW,OAAsC;CACxD,MAAM,QAAQ,WAAW,YAAY;CACrC,IAAI,CAAC,OAAO,MAAM,IAAI,MAAM,qDAAqD;CACjF,OAAO,QAAQ,MAAM,OAAO,OAAO,KAAK;AAC1C;AAEA,MAAa,UAA0B,sBAAM,WAAW;CACtD;CACA;CACA;CACA;CACA;AACF,CAAC"}