@algolia/satellite 2.3.0-rc.1 → 2.3.0-rc.11

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 (210) hide show
  1. package/dist/cjs/Actions/Button/PolymorphicButton.js +5 -5
  2. package/dist/cjs/Actions/Button/PolymorphicIconButton.js +2 -2
  3. package/dist/cjs/Actions/Button/styles.d.ts +1 -0
  4. package/dist/cjs/Actions/Button/styles.js +15 -10
  5. package/dist/cjs/Actions/ButtonLink/ButtonLink.d.ts +2 -0
  6. package/dist/cjs/Actions/ButtonLink/ButtonLink.js +4 -2
  7. package/dist/cjs/Actions/SegmentedControl/SegmentedControl.js +3 -2
  8. package/dist/cjs/Actions/SegmentedControl/SegmentedControlOption.js +6 -3
  9. package/dist/cjs/Actions/ToggleButton/ToggleButtonBase.js +3 -3
  10. package/dist/cjs/Actions/ToggleGroup/ToggleGroup.d.ts +13 -14
  11. package/dist/cjs/Chat/ChatContextAccordion/ChatContextAccordion.d.ts +23 -0
  12. package/dist/cjs/{Layout/Chat → Chat}/ChatContextAccordion/ChatContextAccordion.js +9 -2
  13. package/dist/cjs/{Layout/Chat → Chat}/ChatContextAccordion/ChatContextAccordion.styles.d.ts +20 -1
  14. package/dist/cjs/{Layout/Chat → Chat}/ChatContextAccordion/ChatContextAccordion.styles.js +3 -3
  15. package/dist/cjs/{Layout/Chat → Chat}/ChatMessage/ChatMessage.d.ts +80 -3
  16. package/dist/cjs/{Layout/Chat → Chat}/ChatMessage/ChatMessage.js +14 -5
  17. package/dist/{esm/Layout/Chat/ChatMessageError/ChatMessageError.styles.d.ts → cjs/Chat/ChatMessage/ChatMessage.styles.d.ts} +34 -40
  18. package/dist/cjs/{Layout/Chat → Chat}/ChatMessage/ChatMessage.styles.js +20 -14
  19. package/dist/{esm/Layout → cjs}/Chat/ChatMessageError/ChatMessageError.d.ts +7 -2
  20. package/dist/cjs/{Layout/Chat → Chat}/ChatMessageError/ChatMessageError.js +9 -4
  21. package/dist/cjs/Chat/ChatMessageError/ChatMessageError.styles.d.ts +253 -0
  22. package/dist/cjs/{Layout/Chat → Chat}/ChatMessageError/ChatMessageError.styles.js +2 -2
  23. package/dist/cjs/{Layout/Chat → Chat}/ChatMessageLoader/ChatMessageLoader.d.ts +6 -3
  24. package/dist/cjs/{Layout/Chat → Chat}/ChatMessageLoader/ChatMessageLoader.js +9 -4
  25. package/dist/{esm/Layout → cjs}/Chat/ChatMessageLoader/ChatMessageLoader.styles.d.ts +89 -9
  26. package/dist/cjs/{Layout/Chat → Chat}/ChatMessageLoader/ChatMessageLoader.styles.js +3 -3
  27. package/dist/cjs/Chat/ChatMessages/ChatMessages.d.ts +141 -0
  28. package/dist/cjs/{Layout/Chat → Chat}/ChatMessages/ChatMessages.js +64 -23
  29. package/dist/cjs/{Layout/Chat → Chat}/ChatMessages/ChatMessages.styles.d.ts +27 -1
  30. package/dist/cjs/{Layout/Chat → Chat}/ChatMessages/ChatMessages.styles.js +2 -2
  31. package/dist/cjs/Chat/ChatMessages/useLastMessageHeight.d.ts +14 -0
  32. package/dist/cjs/{Layout/Chat → Chat}/ChatMessages/useLastMessageHeight.js +21 -14
  33. package/dist/{esm/Layout → cjs}/Chat/ChatPrompt/ChatPrompt.d.ts +34 -12
  34. package/dist/cjs/{Layout/Chat → Chat}/ChatPrompt/ChatPrompt.js +46 -19
  35. package/dist/cjs/Chat/ChatPrompt/ChatPrompt.styles.d.ts +63 -0
  36. package/dist/cjs/{Layout/Chat → Chat}/ChatPrompt/ChatPrompt.styles.js +11 -4
  37. package/dist/cjs/Chat/ChatPrompt/useFocusTyping.d.ts +30 -0
  38. package/dist/cjs/Chat/ChatPrompt/useFocusTyping.js +65 -0
  39. package/dist/cjs/{Layout/Chat → Chat}/ChatPrompt/useTypewriter.d.ts +9 -0
  40. package/dist/cjs/{Layout/Chat → Chat}/ChatPrompt/useTypewriter.js +9 -0
  41. package/dist/cjs/Fields/Checkbox/Checkbox.d.ts +2 -2
  42. package/dist/cjs/Fields/Checkbox/Checkbox.js +2 -2
  43. package/dist/cjs/Fields/Dropzone/Dropzone.js +1 -1
  44. package/dist/cjs/Fields/Form/stories/Complex.js +123 -50
  45. package/dist/cjs/Fields/Input/Input.js +10 -13
  46. package/dist/cjs/Fields/RadioGroup/RadioButton.js +9 -2
  47. package/dist/cjs/Fields/RadioGroup/RadioButton.tailwind.js +1 -1
  48. package/dist/cjs/Fields/RadioGroup/RadioGroupContext.d.ts +2 -0
  49. package/dist/cjs/Fields/RadioGroup/RadioGroupItem.js +1 -1
  50. package/dist/cjs/Fields/Select/Select.tailwind.js +4 -3
  51. package/dist/cjs/Fields/SelectableCard/SelectableCard.d.ts +35 -0
  52. package/dist/cjs/Fields/SelectableCard/SelectableCard.js +105 -0
  53. package/dist/cjs/Fields/SelectableCard/SelectableCardContext.d.ts +13 -0
  54. package/dist/cjs/Fields/SelectableCard/SelectableCardContext.js +15 -0
  55. package/dist/cjs/Fields/SelectableCard/SelectableCardGroup.d.ts +13 -0
  56. package/dist/cjs/Fields/SelectableCard/SelectableCardGroup.js +55 -0
  57. package/dist/cjs/Fields/SelectableCard/index.d.ts +2 -0
  58. package/dist/cjs/Fields/SelectableCard/index.js +27 -0
  59. package/dist/cjs/Fields/Switch/Switch.js +1 -1
  60. package/dist/cjs/Fields/TextAreaAutoSize/TextAreaAutoSize.d.ts +12 -4
  61. package/dist/cjs/Fields/TextAreaAutoSize/TextAreaAutoSize.styles.d.ts +13 -1
  62. package/dist/cjs/Fields/index.d.ts +1 -0
  63. package/dist/cjs/Fields/index.js +11 -0
  64. package/dist/cjs/Helpers/MarkdownContent/MarkdownContent.d.ts +15 -0
  65. package/dist/cjs/Helpers/MarkdownContent/MarkdownContent.js +29 -0
  66. package/dist/cjs/Helpers/MarkdownContent/MarkdownContent.tailwind.d.ts +5 -0
  67. package/dist/cjs/Helpers/MarkdownContent/MarkdownContent.tailwind.js +138 -0
  68. package/dist/cjs/Helpers/MarkdownContent/index.d.ts +1 -0
  69. package/dist/cjs/Helpers/MarkdownContent/index.js +16 -0
  70. package/dist/cjs/Helpers/ShimmerText/ShimmerText.tailwind.js +1 -1
  71. package/dist/cjs/Helpers/index.d.ts +1 -0
  72. package/dist/cjs/Helpers/index.js +11 -0
  73. package/dist/cjs/Helpers/utilities/focusable.tailwind.js +1 -1
  74. package/dist/cjs/Layout/index.d.ts +0 -1
  75. package/dist/cjs/Layout/index.js +0 -11
  76. package/dist/cjs/Navigation/Link/Link.d.ts +10 -0
  77. package/dist/cjs/Navigation/Link/Link.js +4 -2
  78. package/dist/cjs/Satellite/locale.d.ts +3 -3
  79. package/dist/cjs/index.d.ts +1 -0
  80. package/dist/cjs/index.js +12 -0
  81. package/dist/cjs/styles/helpers/tv.d.ts +5 -1
  82. package/dist/cjs/styles/tailwind.config.js +1 -1
  83. package/dist/cjs/utils/isCssPropertySupported.d.ts +1 -1
  84. package/dist/esm/Actions/Button/PolymorphicButton.js +6 -6
  85. package/dist/esm/Actions/Button/PolymorphicIconButton.js +2 -2
  86. package/dist/esm/Actions/Button/styles.d.ts +1 -0
  87. package/dist/esm/Actions/Button/styles.js +14 -9
  88. package/dist/esm/Actions/ButtonLink/ButtonLink.d.ts +2 -0
  89. package/dist/esm/Actions/ButtonLink/ButtonLink.js +4 -2
  90. package/dist/esm/Actions/SegmentedControl/SegmentedControl.js +3 -2
  91. package/dist/esm/Actions/SegmentedControl/SegmentedControlOption.js +6 -3
  92. package/dist/esm/Actions/ToggleButton/ToggleButtonBase.js +4 -4
  93. package/dist/esm/Actions/ToggleGroup/ToggleGroup.d.ts +13 -14
  94. package/dist/esm/Chat/ChatContextAccordion/ChatContextAccordion.d.ts +23 -0
  95. package/dist/esm/{Layout/Chat → Chat}/ChatContextAccordion/ChatContextAccordion.js +9 -2
  96. package/dist/esm/{Layout/Chat → Chat}/ChatContextAccordion/ChatContextAccordion.styles.d.ts +20 -1
  97. package/dist/esm/{Layout/Chat → Chat}/ChatContextAccordion/ChatContextAccordion.styles.js +3 -3
  98. package/dist/esm/{Layout/Chat → Chat}/ChatMessage/ChatMessage.d.ts +80 -3
  99. package/dist/esm/{Layout/Chat → Chat}/ChatMessage/ChatMessage.js +14 -5
  100. package/dist/{cjs/Layout/Chat/ChatMessageError/ChatMessageError.styles.d.ts → esm/Chat/ChatMessage/ChatMessage.styles.d.ts} +34 -40
  101. package/dist/esm/{Layout/Chat → Chat}/ChatMessage/ChatMessage.styles.js +20 -14
  102. package/dist/{cjs/Layout → esm}/Chat/ChatMessageError/ChatMessageError.d.ts +7 -2
  103. package/dist/esm/{Layout/Chat → Chat}/ChatMessageError/ChatMessageError.js +8 -3
  104. package/dist/esm/Chat/ChatMessageError/ChatMessageError.styles.d.ts +253 -0
  105. package/dist/esm/{Layout/Chat → Chat}/ChatMessageError/ChatMessageError.styles.js +2 -2
  106. package/dist/esm/{Layout/Chat → Chat}/ChatMessageLoader/ChatMessageLoader.d.ts +6 -3
  107. package/dist/esm/{Layout/Chat → Chat}/ChatMessageLoader/ChatMessageLoader.js +9 -4
  108. package/dist/{cjs/Layout → esm}/Chat/ChatMessageLoader/ChatMessageLoader.styles.d.ts +89 -9
  109. package/dist/esm/{Layout/Chat → Chat}/ChatMessageLoader/ChatMessageLoader.styles.js +3 -3
  110. package/dist/esm/Chat/ChatMessages/ChatMessages.d.ts +141 -0
  111. package/dist/esm/{Layout/Chat → Chat}/ChatMessages/ChatMessages.js +64 -25
  112. package/dist/esm/{Layout/Chat → Chat}/ChatMessages/ChatMessages.styles.d.ts +27 -1
  113. package/dist/esm/{Layout/Chat → Chat}/ChatMessages/ChatMessages.styles.js +2 -2
  114. package/dist/esm/Chat/ChatMessages/useLastMessageHeight.d.ts +14 -0
  115. package/dist/esm/{Layout/Chat → Chat}/ChatMessages/useLastMessageHeight.js +22 -15
  116. package/dist/{cjs/Layout → esm}/Chat/ChatPrompt/ChatPrompt.d.ts +34 -12
  117. package/dist/esm/{Layout/Chat → Chat}/ChatPrompt/ChatPrompt.js +47 -19
  118. package/dist/esm/Chat/ChatPrompt/ChatPrompt.styles.d.ts +63 -0
  119. package/dist/esm/{Layout/Chat → Chat}/ChatPrompt/ChatPrompt.styles.js +11 -4
  120. package/dist/esm/Chat/ChatPrompt/useFocusTyping.d.ts +30 -0
  121. package/dist/esm/Chat/ChatPrompt/useFocusTyping.js +59 -0
  122. package/dist/esm/{Layout/Chat → Chat}/ChatPrompt/useTypewriter.d.ts +9 -0
  123. package/dist/esm/{Layout/Chat → Chat}/ChatPrompt/useTypewriter.js +9 -0
  124. package/dist/esm/Fields/Checkbox/Checkbox.d.ts +2 -2
  125. package/dist/esm/Fields/Checkbox/Checkbox.js +2 -2
  126. package/dist/esm/Fields/Dropzone/Dropzone.js +1 -1
  127. package/dist/esm/Fields/Form/stories/Complex.js +123 -50
  128. package/dist/esm/Fields/Input/Input.js +10 -13
  129. package/dist/esm/Fields/RadioGroup/RadioButton.js +10 -3
  130. package/dist/esm/Fields/RadioGroup/RadioButton.tailwind.js +1 -1
  131. package/dist/esm/Fields/RadioGroup/RadioGroupContext.d.ts +2 -0
  132. package/dist/esm/Fields/RadioGroup/RadioGroupItem.js +1 -1
  133. package/dist/esm/Fields/Select/Select.tailwind.js +4 -3
  134. package/dist/esm/Fields/SelectableCard/SelectableCard.d.ts +35 -0
  135. package/dist/esm/Fields/SelectableCard/SelectableCard.js +100 -0
  136. package/dist/esm/Fields/SelectableCard/SelectableCardContext.d.ts +13 -0
  137. package/dist/esm/Fields/SelectableCard/SelectableCardContext.js +9 -0
  138. package/dist/esm/Fields/SelectableCard/SelectableCardGroup.d.ts +13 -0
  139. package/dist/esm/Fields/SelectableCard/SelectableCardGroup.js +48 -0
  140. package/dist/esm/Fields/SelectableCard/index.d.ts +2 -0
  141. package/dist/esm/Fields/SelectableCard/index.js +2 -0
  142. package/dist/esm/Fields/Switch/Switch.js +1 -1
  143. package/dist/esm/Fields/TextAreaAutoSize/TextAreaAutoSize.d.ts +12 -4
  144. package/dist/esm/Fields/TextAreaAutoSize/TextAreaAutoSize.styles.d.ts +13 -1
  145. package/dist/esm/Fields/index.d.ts +1 -0
  146. package/dist/esm/Fields/index.js +1 -0
  147. package/dist/esm/Helpers/MarkdownContent/MarkdownContent.d.ts +15 -0
  148. package/dist/esm/Helpers/MarkdownContent/MarkdownContent.js +22 -0
  149. package/dist/esm/Helpers/MarkdownContent/MarkdownContent.tailwind.d.ts +5 -0
  150. package/dist/esm/Helpers/MarkdownContent/MarkdownContent.tailwind.js +138 -0
  151. package/dist/esm/Helpers/MarkdownContent/index.d.ts +1 -0
  152. package/dist/esm/Helpers/MarkdownContent/index.js +1 -0
  153. package/dist/esm/Helpers/ShimmerText/ShimmerText.tailwind.js +1 -1
  154. package/dist/esm/Helpers/index.d.ts +1 -0
  155. package/dist/esm/Helpers/index.js +2 -1
  156. package/dist/esm/Helpers/utilities/focusable.tailwind.js +1 -1
  157. package/dist/esm/Layout/index.d.ts +0 -1
  158. package/dist/esm/Layout/index.js +0 -1
  159. package/dist/esm/Navigation/Link/Link.d.ts +10 -0
  160. package/dist/esm/Navigation/Link/Link.js +4 -2
  161. package/dist/esm/Satellite/locale.d.ts +3 -3
  162. package/dist/esm/index.d.ts +1 -0
  163. package/dist/esm/index.js +1 -0
  164. package/dist/esm/styles/helpers/tv.d.ts +5 -1
  165. package/dist/esm/styles/tailwind.config.js +1 -1
  166. package/dist/esm/utils/isCssPropertySupported.d.ts +1 -1
  167. package/dist/satellite.min.css +1 -1
  168. package/package.json +5 -4
  169. package/dist/cjs/Layout/Chat/ChatContextAccordion/ChatContextAccordion.d.ts +0 -8
  170. package/dist/cjs/Layout/Chat/ChatMessage/ChatMessage.styles.d.ts +0 -100
  171. package/dist/cjs/Layout/Chat/ChatMessages/ChatMessages.d.ts +0 -42
  172. package/dist/cjs/Layout/Chat/ChatMessages/useLastMessageHeight.d.ts +0 -10
  173. package/dist/cjs/Layout/Chat/ChatPrompt/ChatPrompt.styles.d.ts +0 -61
  174. package/dist/esm/Layout/Chat/ChatContextAccordion/ChatContextAccordion.d.ts +0 -8
  175. package/dist/esm/Layout/Chat/ChatMessage/ChatMessage.styles.d.ts +0 -100
  176. package/dist/esm/Layout/Chat/ChatMessages/ChatMessages.d.ts +0 -42
  177. package/dist/esm/Layout/Chat/ChatMessages/useLastMessageHeight.d.ts +0 -10
  178. package/dist/esm/Layout/Chat/ChatPrompt/ChatPrompt.styles.d.ts +0 -61
  179. /package/dist/cjs/{Layout/Chat → Chat}/ChatContextAccordion/index.d.ts +0 -0
  180. /package/dist/cjs/{Layout/Chat → Chat}/ChatContextAccordion/index.js +0 -0
  181. /package/dist/cjs/{Layout/Chat → Chat}/ChatMessage/index.d.ts +0 -0
  182. /package/dist/cjs/{Layout/Chat → Chat}/ChatMessage/index.js +0 -0
  183. /package/dist/cjs/{Layout/Chat → Chat}/ChatMessageError/index.d.ts +0 -0
  184. /package/dist/cjs/{Layout/Chat → Chat}/ChatMessageError/index.js +0 -0
  185. /package/dist/cjs/{Layout/Chat → Chat}/ChatMessageLoader/index.d.ts +0 -0
  186. /package/dist/cjs/{Layout/Chat → Chat}/ChatMessageLoader/index.js +0 -0
  187. /package/dist/cjs/{Layout/Chat → Chat}/ChatMessages/index.d.ts +0 -0
  188. /package/dist/cjs/{Layout/Chat → Chat}/ChatMessages/index.js +0 -0
  189. /package/dist/cjs/{Layout/Chat → Chat}/ChatPrompt/index.d.ts +0 -0
  190. /package/dist/cjs/{Layout/Chat → Chat}/ChatPrompt/index.js +0 -0
  191. /package/dist/cjs/{Layout/Chat → Chat}/index.d.ts +0 -0
  192. /package/dist/cjs/{Layout/Chat → Chat}/index.js +0 -0
  193. /package/dist/cjs/{Layout/Chat → Chat}/types.d.ts +0 -0
  194. /package/dist/cjs/{Layout/Chat → Chat}/types.js +0 -0
  195. /package/dist/esm/{Layout/Chat → Chat}/ChatContextAccordion/index.d.ts +0 -0
  196. /package/dist/esm/{Layout/Chat → Chat}/ChatContextAccordion/index.js +0 -0
  197. /package/dist/esm/{Layout/Chat → Chat}/ChatMessage/index.d.ts +0 -0
  198. /package/dist/esm/{Layout/Chat → Chat}/ChatMessage/index.js +0 -0
  199. /package/dist/esm/{Layout/Chat → Chat}/ChatMessageError/index.d.ts +0 -0
  200. /package/dist/esm/{Layout/Chat → Chat}/ChatMessageError/index.js +0 -0
  201. /package/dist/esm/{Layout/Chat → Chat}/ChatMessageLoader/index.d.ts +0 -0
  202. /package/dist/esm/{Layout/Chat → Chat}/ChatMessageLoader/index.js +0 -0
  203. /package/dist/esm/{Layout/Chat → Chat}/ChatMessages/index.d.ts +0 -0
  204. /package/dist/esm/{Layout/Chat → Chat}/ChatMessages/index.js +0 -0
  205. /package/dist/esm/{Layout/Chat → Chat}/ChatPrompt/index.d.ts +0 -0
  206. /package/dist/esm/{Layout/Chat → Chat}/ChatPrompt/index.js +0 -0
  207. /package/dist/esm/{Layout/Chat → Chat}/index.d.ts +0 -0
  208. /package/dist/esm/{Layout/Chat → Chat}/index.js +0 -0
  209. /package/dist/esm/{Layout/Chat → Chat}/types.d.ts +0 -0
  210. /package/dist/esm/{Layout/Chat → Chat}/types.js +0 -0
@@ -1,34 +1,41 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+ import { useRef } from "react";
2
3
  import { useLayoutEffect, useState } from "react";
3
-
4
4
  /**
5
5
  * React hook to compute the “fill” height below the last user message,
6
6
  * based on the scroll container’s height, the last user‐message element’s height,
7
7
  * and any CSS gap/padding offsets.
8
+ *
9
+ * @param scrollRef - The ref to the scroll container.
10
+ * @param lastUserMessageRef - The ref to the last user message.
11
+ * @param messages - The messages to display in the chat.
12
+ * @param lastMessageSubmitted - Whether the last message has been submitted.
13
+ * @param spacingOffset - The spacing offset.
8
14
  */
9
- export function useLastMessageHeight(scrollRef, messages, lastUserMessageEl, lastMessageSubmitted) {
15
+ export function useLastMessageHeight(scrollRef, lastUserMessageRef, messages, lastMessageSubmitted) {
10
16
  var spacingOffset = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
11
17
  var _useState = useState(0),
12
18
  _useState2 = _slicedToArray(_useState, 2),
13
19
  lastMessageHeight = _useState2[0],
14
20
  setLastMessageHeight = _useState2[1];
15
- var updateLastMessageHeight = function updateLastMessageHeight() {
16
- var scrollEl = scrollRef.current;
17
- if (!scrollEl || messages.length === 0 || !lastMessageSubmitted || !lastUserMessageEl) return;
18
-
19
- // Measure parent/container height
20
- var parentHeight = scrollEl.clientHeight;
21
+ var offsetsRef = useRef(0);
22
+ function getStaticOffsets() {
23
+ if (offsetsRef.current || !scrollRef.current) return offsetsRef.current;
21
24
 
22
25
  // Compute any CSS gap/rowGap/padding offsets by reading computed style
23
- var computed = window.getComputedStyle(scrollEl);
26
+ var computed = window.getComputedStyle(scrollRef.current);
24
27
  var rowGapValue = parseFloat(computed.rowGap) || parseFloat(computed.gap) || 0;
25
28
  var paddingTop = parseFloat(computed.paddingTop) || 0;
26
29
  var paddingBottom = parseFloat(computed.paddingBottom) || 0;
27
- var totalOffset = spacingOffset + rowGapValue + paddingTop + paddingBottom;
28
-
29
- // The “remaining” height is parentHeight − lastMsgElem.offsetHeight − totalOffset
30
- var remaining = parentHeight - lastUserMessageEl.offsetHeight - totalOffset;
31
- setLastMessageHeight(Math.max(remaining, 0));
30
+ offsetsRef.current = spacingOffset + rowGapValue + paddingTop + paddingBottom;
31
+ return offsetsRef.current;
32
+ }
33
+ var updateLastMessageHeight = function updateLastMessageHeight() {
34
+ var scrollEl = scrollRef.current;
35
+ var lastUserMessageEl = lastUserMessageRef.current;
36
+ if (!scrollEl || messages.length === 0 || !lastMessageSubmitted || !lastUserMessageEl) return;
37
+ var height = Math.max(scrollEl.clientHeight - lastUserMessageEl.offsetHeight - getStaticOffsets(), 0);
38
+ setLastMessageHeight(height);
32
39
  };
33
40
 
34
41
  // Recompute whenever messages change and a new user message has just been submitted
@@ -36,6 +43,6 @@ export function useLastMessageHeight(scrollRef, messages, lastUserMessageEl, las
36
43
  if (!lastMessageSubmitted) return;
37
44
  updateLastMessageHeight();
38
45
  // eslint-disable-next-line react-hooks/exhaustive-deps
39
- }, [messages, lastMessageSubmitted]);
46
+ }, [messages.length, lastMessageSubmitted]);
40
47
  return lastMessageHeight;
41
48
  }
@@ -1,13 +1,14 @@
1
1
  import type { FormEvent, KeyboardEvent, ReactNode } from "react";
2
- import type { TextAreaProps } from "../../../Fields";
3
- import type { ChatStatus } from "../../../Layout/Chat/types";
2
+ import type { ChatStatus } from "../../Chat/types";
3
+ import type { TextAreaAutoSizeProps } from "../../Fields/TextAreaAutoSize/TextAreaAutoSize";
4
4
  export declare type ChatPromptLocale = {
5
5
  textareaLabel?: string;
6
6
  emptyMessageTooltip?: string;
7
7
  stopResponseTooltip?: string;
8
8
  sendMessageTooltip?: string;
9
+ disabledTooltip?: string;
9
10
  };
10
- export declare type ChatPromptProps = Omit<TextAreaProps, "onSubmit"> & {
11
+ export declare type ChatPromptProps = Omit<TextAreaAutoSizeProps, "onSubmit"> & {
11
12
  /**
12
13
  * Content to render above the textarea (e.g., a title or instructions).
13
14
  */
@@ -30,6 +31,18 @@ export declare type ChatPromptProps = Omit<TextAreaProps, "onSubmit"> & {
30
31
  * - "error": An error occurred during the API request, preventing successful completion.
31
32
  */
32
33
  status?: ChatStatus;
34
+ /**
35
+ * Whether to automatically focus the textarea when the user starts typing.
36
+ */
37
+ autoFocusOnTyping?: boolean;
38
+ /**
39
+ * Whether to enable right-to-left (RTL) layout support.
40
+ */
41
+ rtl?: boolean;
42
+ /**
43
+ * Optional locale.
44
+ */
45
+ locale?: ChatPromptLocale;
33
46
  /**
34
47
  * Callback invoked when the user submits the form, either by clicking
35
48
  * the submit button or pressing Enter (without Shift) inside the textarea.
@@ -39,12 +52,13 @@ export declare type ChatPromptProps = Omit<TextAreaProps, "onSubmit"> & {
39
52
  * Callback invoked when the user requests to stop the current chat response stream.
40
53
  */
41
54
  onStop?: () => void;
42
- /**
43
- * Optional locale.
44
- */
45
- locale?: ChatPromptLocale;
46
55
  };
47
- export declare const ChatPrompt: import("react").ForwardRefExoticComponent<Omit<TextAreaProps, "onSubmit"> & {
56
+ /**
57
+ * The `ChatPrompt` component provides a textarea for users to type messages and a button to submit them.
58
+ *
59
+ * See the [ChatPrompt documentation page](https://satellite.algolia.com/8261d6576/p/06f740-chat-prompt) for more information.
60
+ */
61
+ export declare const ChatPrompt: import("react").ForwardRefExoticComponent<Omit<TextAreaAutoSizeProps, "onSubmit"> & {
48
62
  /**
49
63
  * Content to render above the textarea (e.g., a title or instructions).
50
64
  */
@@ -67,6 +81,18 @@ export declare const ChatPrompt: import("react").ForwardRefExoticComponent<Omit<
67
81
  * - "error": An error occurred during the API request, preventing successful completion.
68
82
  */
69
83
  status?: ChatStatus | undefined;
84
+ /**
85
+ * Whether to automatically focus the textarea when the user starts typing.
86
+ */
87
+ autoFocusOnTyping?: boolean | undefined;
88
+ /**
89
+ * Whether to enable right-to-left (RTL) layout support.
90
+ */
91
+ rtl?: boolean | undefined;
92
+ /**
93
+ * Optional locale.
94
+ */
95
+ locale?: ChatPromptLocale | undefined;
70
96
  /**
71
97
  * Callback invoked when the user submits the form, either by clicking
72
98
  * the submit button or pressing Enter (without Shift) inside the textarea.
@@ -76,8 +102,4 @@ export declare const ChatPrompt: import("react").ForwardRefExoticComponent<Omit<
76
102
  * Callback invoked when the user requests to stop the current chat response stream.
77
103
  */
78
104
  onStop?: (() => void) | undefined;
79
- /**
80
- * Optional locale.
81
- */
82
- locale?: ChatPromptLocale | undefined;
83
105
  } & import("react").RefAttributes<HTMLTextAreaElement>>;
@@ -1,26 +1,35 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
- var _excluded = ["className", "renderHeader", "children", "renderFooter", "onSubmit", "onStop", "placeholder", "placeholders", "status", "defaultValue", "value", "locale"];
4
+ var _excluded = ["className", "renderHeader", "children", "renderFooter", "onSubmit", "onStop", "placeholder", "placeholders", "status", "autoFocusOnTyping", "rtl", "defaultValue", "value", "locale", "id"];
5
5
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
6
6
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
7
- import { ArrowUpIcon, CircleStopIcon } from "lucide-react";
7
+ import { useMemo } from "react";
8
8
  import { useState } from "react";
9
9
  import { useRef } from "react";
10
10
  import { forwardRef } from "react";
11
11
  import { chatPromptStyles } from "./ChatPrompt.styles";
12
+ import { useFocusOnTyping } from "./useFocusTyping";
12
13
  import { useTypewriter } from "./useTypewriter";
13
- import { IconButton } from "./../../../Actions";
14
- import { TextAreaAutoSize } from "./../../../Fields/TextAreaAutoSize/TextAreaAutoSize";
15
- import { useLocale } from "./../../../Satellite";
16
- import { mergeRefs } from "./../../../utils/mergeRefs";
14
+ import { IconButton } from "./../../Actions";
15
+ import { TextAreaAutoSize } from "./../../Fields/TextAreaAutoSize/TextAreaAutoSize";
16
+ import { ArrowUpIcon, StopCircleIcon } from "./../../Icons";
17
+ import { useLocale } from "./../../Satellite";
18
+ import { uniqueId } from "./../../utils";
19
+ import { mergeRefs } from "./../../utils/mergeRefs";
17
20
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
18
21
  var DEFAULT_CHAT_PROMPT_LOCALE = {
19
22
  textareaLabel: "Type your message...",
20
23
  emptyMessageTooltip: "Message is empty",
21
24
  stopResponseTooltip: "Stop response",
22
- sendMessageTooltip: "Send message"
25
+ sendMessageTooltip: "Send message",
26
+ disabledTooltip: "Chat prompt is disabled"
23
27
  };
28
+ /**
29
+ * The `ChatPrompt` component provides a textarea for users to type messages and a button to submit them.
30
+ *
31
+ * See the [ChatPrompt documentation page](https://satellite.algolia.com/8261d6576/p/06f740-chat-prompt) for more information.
32
+ */
24
33
  export var ChatPrompt = /*#__PURE__*/forwardRef(function (_ref, forwardedRef) {
25
34
  var _ref2;
26
35
  var className = _ref.className,
@@ -34,14 +43,27 @@ export var ChatPrompt = /*#__PURE__*/forwardRef(function (_ref, forwardedRef) {
34
43
  placeholders = _ref$placeholders === void 0 ? [] : _ref$placeholders,
35
44
  _ref$status = _ref.status,
36
45
  status = _ref$status === void 0 ? "ready" : _ref$status,
46
+ _ref$autoFocusOnTypin = _ref.autoFocusOnTyping,
47
+ autoFocusOnTyping = _ref$autoFocusOnTypin === void 0 ? false : _ref$autoFocusOnTypin,
48
+ _ref$rtl = _ref.rtl,
49
+ rtl = _ref$rtl === void 0 ? false : _ref$rtl,
37
50
  defaultValue = _ref.defaultValue,
38
51
  valueProp = _ref.value,
39
52
  propsLocale = _ref.locale,
53
+ propId = _ref.id,
40
54
  props = _objectWithoutProperties(_ref, _excluded);
41
55
  var contextLocale = useLocale("chatPrompt");
42
56
  var locale = _objectSpread(_objectSpread(_objectSpread({}, DEFAULT_CHAT_PROMPT_LOCALE), contextLocale), propsLocale);
57
+
58
+ // eslint-disable-next-line @algolia/stl/prefer-stl-helper
59
+ var generatedId = useMemo(function () {
60
+ return uniqueId("stl-chat-prompt-");
61
+ }, []);
62
+ var textareaId = propId !== null && propId !== void 0 ? propId : generatedId;
43
63
  var internalRef = useRef(null);
44
- var styles = chatPromptStyles();
64
+ var styles = chatPromptStyles({
65
+ disabled: props.disabled
66
+ });
45
67
  var _useState = useState(defaultValue !== null && defaultValue !== void 0 ? defaultValue : ""),
46
68
  _useState2 = _slicedToArray(_useState, 2),
47
69
  internalValue = _useState2[0],
@@ -53,9 +75,17 @@ export var ChatPrompt = /*#__PURE__*/forwardRef(function (_ref, forwardedRef) {
53
75
  var buttonDisabled = !hasValue && !canStop;
54
76
  var dynamicPlaceholder = useTypewriter(placeholders, !hasValue);
55
77
  var computedPlaceholder = placeholders.length > 0 ? dynamicPlaceholder : staticPlaceholder;
78
+ useFocusOnTyping(internalRef, {
79
+ enabled: autoFocusOnTyping,
80
+ strictChars: true
81
+ });
56
82
  var submit = function submit(e) {
57
83
  e.preventDefault();
58
- if (!hasValue || canStop) {
84
+ if (canStop) {
85
+ onStop === null || onStop === void 0 || onStop();
86
+ return;
87
+ }
88
+ if (!hasValue) {
59
89
  return;
60
90
  }
61
91
  onSubmit === null || onSubmit === void 0 || onSubmit(e);
@@ -63,6 +93,7 @@ export var ChatPrompt = /*#__PURE__*/forwardRef(function (_ref, forwardedRef) {
63
93
  return /*#__PURE__*/_jsxs("form", {
64
94
  className: styles.base(),
65
95
  onSubmit: submit,
96
+ dir: rtl ? "rtl" : "ltr",
66
97
  children: [!!renderHeader && /*#__PURE__*/_jsx("div", {
67
98
  className: styles.header(),
68
99
  children: renderHeader
@@ -74,6 +105,7 @@ export var ChatPrompt = /*#__PURE__*/forwardRef(function (_ref, forwardedRef) {
74
105
  (_internalRef$current = internalRef.current) === null || _internalRef$current === void 0 || _internalRef$current.focus();
75
106
  },
76
107
  children: /*#__PURE__*/_jsx(TextAreaAutoSize, _objectSpread(_objectSpread({
108
+ id: textareaId,
77
109
  ref: mergeRefs([forwardedRef, internalRef]),
78
110
  rows: 2,
79
111
  maxRows: 8,
@@ -81,6 +113,7 @@ export var ChatPrompt = /*#__PURE__*/forwardRef(function (_ref, forwardedRef) {
81
113
  value: value,
82
114
  "aria-label": (_ref2 = placeholders[0] ? placeholders[0] : staticPlaceholder) !== null && _ref2 !== void 0 ? _ref2 : locale.textareaLabel,
83
115
  translate: "no",
116
+ autoComplete: "off",
84
117
  onInput: function onInput(e) {
85
118
  var _props$onInput;
86
119
  if (!isControlled) {
@@ -105,20 +138,15 @@ export var ChatPrompt = /*#__PURE__*/forwardRef(function (_ref, forwardedRef) {
105
138
  children: /*#__PURE__*/_jsx("div", {
106
139
  className: styles.actions(),
107
140
  children: /*#__PURE__*/_jsx(IconButton, {
108
- type: status === "ready" ? "submit" : undefined,
109
- onClick: function onClick(e) {
110
- if (canStop) {
111
- e.preventDefault();
112
- onStop === null || onStop === void 0 || onStop();
113
- }
114
- },
115
- icon: canStop ? CircleStopIcon : ArrowUpIcon,
141
+ type: "submit",
142
+ icon: canStop ? StopCircleIcon : ArrowUpIcon,
116
143
  variant: canStop ? "neutral" : "primary",
117
144
  size: "small",
118
- title: buttonDisabled ? locale.emptyMessageTooltip : canStop ? locale.stopResponseTooltip : locale.sendMessageTooltip,
145
+ title: props.disabled ? locale.disabledTooltip : buttonDisabled ? locale.emptyMessageTooltip : canStop ? locale.stopResponseTooltip : locale.sendMessageTooltip,
119
146
  tooltipSide: "top",
120
147
  disabled: buttonDisabled,
121
- className: styles.submit()
148
+ className: styles.submit(),
149
+ "data-status": status
122
150
  })
123
151
  })
124
152
  }))
@@ -0,0 +1,63 @@
1
+ export declare const chatPromptStyles: import("tailwind-variants").TVReturnType<{
2
+ disabled: {
3
+ true: {
4
+ actions: string;
5
+ };
6
+ };
7
+ }, {
8
+ base: string;
9
+ header: string;
10
+ body: string;
11
+ textarea: string;
12
+ actions: string;
13
+ submit: string;
14
+ footer: string;
15
+ }, undefined, {
16
+ responsiveVariants?: boolean | ("sm" | "md" | "lg" | "xl" | "2xl")[] | {
17
+ disabled?: boolean | ("sm" | "md" | "lg" | "xl" | "2xl")[] | undefined;
18
+ } | undefined;
19
+ } & import("tailwind-variants/dist/config").TWMConfig & {
20
+ twMergeConfig: {
21
+ prefix: string;
22
+ };
23
+ }, {
24
+ disabled: {
25
+ true: {
26
+ actions: string;
27
+ };
28
+ };
29
+ }, {
30
+ base: string;
31
+ header: string;
32
+ body: string;
33
+ textarea: string;
34
+ actions: string;
35
+ submit: string;
36
+ footer: string;
37
+ }, import("tailwind-variants").TVReturnType<{
38
+ disabled: {
39
+ true: {
40
+ actions: string;
41
+ };
42
+ };
43
+ }, {
44
+ base: string;
45
+ header: string;
46
+ body: string;
47
+ textarea: string;
48
+ actions: string;
49
+ submit: string;
50
+ footer: string;
51
+ }, undefined, import("tailwind-variants/dist/config").TVConfig<{
52
+ disabled: {
53
+ true: {
54
+ actions: string;
55
+ };
56
+ };
57
+ }, {
58
+ disabled: {
59
+ true: {
60
+ actions: string;
61
+ };
62
+ };
63
+ }>, unknown, unknown, undefined>>;
@@ -1,15 +1,22 @@
1
1
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
3
- import stl from "./../../../styles/helpers/satellitePrefixer";
4
- import { tv } from "./../../../styles/helpers/tv";
2
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8;
3
+ import stl from "./../../styles/helpers/satellitePrefixer";
4
+ import { tv } from "./../../styles/helpers/tv";
5
5
  export var chatPromptStyles = tv({
6
6
  slots: {
7
7
  base: stl(_templateObject || (_templateObject = _taggedTemplateLiteral(["relative flex flex-col items-stretch gap-2 w-full"]))),
8
8
  header: stl(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["flex items-center gap-1.5"]))),
9
9
  body: stl(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral([""]))),
10
10
  textarea: stl(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["[&>textarea]:p-3 [&>textarea]:pb-0 [&>textarea]:thin-scrollbar"]))),
11
- actions: stl(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["flex flex-row p-3 pt-2 justify-end"]))),
11
+ actions: stl(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["flex flex-row p-3 pt-2 justify-end cursor-text"]))),
12
12
  submit: stl(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral([""]))),
13
13
  footer: stl(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["flex items-center justify-between gap-1.5"])))
14
+ },
15
+ variants: {
16
+ disabled: {
17
+ "true": {
18
+ actions: stl(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["bg-grey-100 cursor-not-allowed"])))
19
+ }
20
+ }
14
21
  }
15
22
  });
@@ -0,0 +1,30 @@
1
+ /// <reference types="react" />
2
+ /**
3
+ * Check if the element is a textual element.
4
+ * @param el - The element to check.
5
+ * @returns True if the element is a textual element, false otherwise.
6
+ */
7
+ export declare const isTextualElement: (el: HTMLElement) => boolean;
8
+ declare type Editable = HTMLTextAreaElement | HTMLInputElement | HTMLElement;
9
+ export interface UseFocusOnTypingOptions {
10
+ /**
11
+ * Whether the hook is enabled.
12
+ * @default true
13
+ */
14
+ enabled?: boolean;
15
+ /**
16
+ * Whether to allow punctuation, diacritics, etc.
17
+ * @default false
18
+ */
19
+ strictChars?: boolean;
20
+ }
21
+ /**
22
+ * Focus `editableRef` the moment the user types anywhere on the page,
23
+ * *unless* their cursor is already inside an editable control.
24
+ * @param editableRef - The ref to the editable element.
25
+ * @param options - The options for the hook.
26
+ * @param options.enabled - Whether the hook is enabled.
27
+ * @param options.strictChars - Whether to allow punctuation, diacritics, etc.
28
+ */
29
+ export declare function useFocusOnTyping<E extends Editable = Editable>(editableRef: React.RefObject<E>, options?: UseFocusOnTypingOptions): void;
30
+ export {};
@@ -0,0 +1,59 @@
1
+ import { useCallback, useEffect } from "react";
2
+
3
+ /**
4
+ * Check if the element is a textual element.
5
+ * @param el - The element to check.
6
+ * @returns True if the element is a textual element, false otherwise.
7
+ */
8
+ export var isTextualElement = function isTextualElement(el) {
9
+ if (el.isContentEditable) return true;
10
+ var tag = el.tagName.toUpperCase();
11
+ if (tag === "TEXTAREA") return true;
12
+ if (tag === "INPUT") {
13
+ var t = el.type.toLowerCase();
14
+ return ["text", "search", "url", "email", "tel", "password", "number", "date", "datetime-local", "month", "week", "time"].includes(t);
15
+ }
16
+ return false;
17
+ };
18
+
19
+ // e.g. <div contentEditable>
20
+
21
+ /**
22
+ * Focus `editableRef` the moment the user types anywhere on the page,
23
+ * *unless* their cursor is already inside an editable control.
24
+ * @param editableRef - The ref to the editable element.
25
+ * @param options - The options for the hook.
26
+ * @param options.enabled - Whether the hook is enabled.
27
+ * @param options.strictChars - Whether to allow punctuation, diacritics, etc.
28
+ */
29
+ export function useFocusOnTyping(editableRef) {
30
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
31
+ var _options$enabled = options.enabled,
32
+ enabled = _options$enabled === void 0 ? true : _options$enabled,
33
+ _options$strictChars = options.strictChars,
34
+ strictChars = _options$strictChars === void 0 ? false : _options$strictChars;
35
+ var handleKeyDown = useCallback(function (e) {
36
+ if (!enabled || e.ctrlKey || e.altKey || e.metaKey || e.isComposing || e.repeat || (
37
+ // Printable-character test
38
+ strictChars ? !/^[A-Za-z0-9]$/.test(e.key) : e.key.length !== 1)) {
39
+ return;
40
+ }
41
+ var node = editableRef.current;
42
+ if (!node) return;
43
+ if (node.contains(document.activeElement)) return;
44
+ var el = e.target;
45
+ if (!el || !isTextualElement(el)) {
46
+ node.focus();
47
+ }
48
+ }, [enabled, strictChars, editableRef]);
49
+ useEffect(function () {
50
+ if (typeof window === "undefined") return; // SSR/test guard
51
+
52
+ window.addEventListener("keydown", handleKeyDown, {
53
+ passive: true
54
+ });
55
+ return function () {
56
+ return window.removeEventListener("keydown", handleKeyDown);
57
+ };
58
+ }, [handleKeyDown]);
59
+ }
@@ -15,4 +15,13 @@ export interface UseTypewriterOptions {
15
15
  */
16
16
  pauseDuration?: number;
17
17
  }
18
+ /**
19
+ * A hook that types out a list of texts character by character.
20
+ * @param texts - The list of texts to type out.
21
+ * @param enabled - Whether the hook is enabled.
22
+ * @param options - The options for the hook.
23
+ * @param options.typingSpeed - The speed at which to type out the text.
24
+ * @param options.deletingSpeed - The speed at which to delete the text.
25
+ * @param options.pauseDuration - The duration to pause after typing a full word before deleting.
26
+ */
18
27
  export declare function useTypewriter(texts: string[], enabled?: boolean, options?: UseTypewriterOptions): string;
@@ -1,5 +1,14 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  import { useEffect, useState } from "react";
3
+ /**
4
+ * A hook that types out a list of texts character by character.
5
+ * @param texts - The list of texts to type out.
6
+ * @param enabled - Whether the hook is enabled.
7
+ * @param options - The options for the hook.
8
+ * @param options.typingSpeed - The speed at which to type out the text.
9
+ * @param options.deletingSpeed - The speed at which to delete the text.
10
+ * @param options.pauseDuration - The duration to pause after typing a full word before deleting.
11
+ */
3
12
  export function useTypewriter(texts) {
4
13
  var enabled = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
5
14
  var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
@@ -15,12 +15,12 @@ declare type CheckboxCustomProps = {
15
15
  */
16
16
  checkedColor?: string;
17
17
  };
18
- declare type CheckboxInputProps = Omit<HTMLAttributes<HTMLInputElement>, "onChange"> & Pick<InputHTMLAttributes<HTMLInputElement>, "onChange" | "required" | "autoFocus" | "disabled" | "checked" | "defaultChecked">;
18
+ declare type CheckboxInputProps = Omit<HTMLAttributes<HTMLInputElement>, "onChange"> & Pick<InputHTMLAttributes<HTMLInputElement>, "onChange" | "required" | "autoFocus" | "disabled" | "checked" | "defaultChecked" | "name">;
19
19
  export declare type CheckboxProps = CheckboxInputProps & CheckboxCustomProps;
20
20
  /**
21
21
  * The `Checkbox` component is a control that allows single or multiple selections from a set of options.
22
22
  *
23
23
  * See the [Checkbox documentation page](https://satellite.algolia.com/8261d6576/p/023233-checkbox) for more information.
24
24
  */
25
- export declare const Checkbox: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLInputElement>, "onChange"> & Pick<InputHTMLAttributes<HTMLInputElement>, "onChange" | "defaultChecked" | "autoFocus" | "disabled" | "checked" | "required"> & CheckboxCustomProps & import("react").RefAttributes<HTMLInputElement>>;
25
+ export declare const Checkbox: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLInputElement>, "onChange"> & Pick<InputHTMLAttributes<HTMLInputElement>, "name" | "onChange" | "defaultChecked" | "autoFocus" | "disabled" | "checked" | "required"> & CheckboxCustomProps & import("react").RefAttributes<HTMLInputElement>>;
26
26
  export {};
@@ -66,7 +66,7 @@ export var Checkbox = /*#__PURE__*/forwardRef(function (_ref, ref) {
66
66
  return /*#__PURE__*/_jsxs("div", {
67
67
  className: cx(stl(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["group/checkbox inline-flex items-center ", ""])), textPosition === "left" && "flex-row-reverse"), className),
68
68
  children: [/*#__PURE__*/_jsxs("span", {
69
- className: cx(stl(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n checkbox focusable-within\n ", "\n ", "\n ", "\n "])), indeterminate && "checkbox-indeterminate", isChecked && "checkbox-checked", disabled && "checkbox-disabled"), STATUS_CLASSNAMES[status]),
69
+ className: cx(stl(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n checkbox focusable-visible-within\n ", "\n ", "\n ", "\n "])), indeterminate && "checkbox-indeterminate", isChecked && "checkbox-checked", disabled && "checkbox-disabled"), STATUS_CLASSNAMES[status]),
70
70
  style: {
71
71
  color: checkedColor
72
72
  },
@@ -76,7 +76,7 @@ export var Checkbox = /*#__PURE__*/forwardRef(function (_ref, ref) {
76
76
  "aria-labelledby": labelId,
77
77
  "aria-describedby": descriptionId
78
78
  }, checkboxProps), {}, {
79
- id: id !== null && id !== void 0 ? id : inputId,
79
+ id: id,
80
80
  required: required,
81
81
  "aria-invalid": status === "invalid",
82
82
  "aria-checked": indeterminate ? "mixed" : isChecked,
@@ -135,7 +135,7 @@ export var Dropzone = /*#__PURE__*/forwardRef(function (_ref2, ref) {
135
135
  "aria-labelledby": labelId,
136
136
  "aria-describedby": descriptionId,
137
137
  "aria-invalid": isInvalid,
138
- className: cx(stl(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n relative flex items-center group/dropzone bg-white\n border border-dashed rounded\n overflow-hidden transition-colors\n focusable focus-visible:border-transparent\n min-h-16 p-4\n ", "\n ", "\n ", ""])), disabled ? "cursor-not-allowed border-grey-200" : "cursor-pointer border-grey-500", isDragReject && !disabled ? "border-red-200 cursor-not-allowed" : isDragActive ? "border-accent-500 cursor-pointer" : null, !disabled && (isInvalid ? "bg-red-100 border-red-700 hover:bg-red-50" : "bg-white hover:bg-grey-100")), className),
138
+ className: cx(stl(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n relative flex items-center group/dropzone bg-white\n border border-dashed rounded\n overflow-hidden transition-colors\n focusable-visible focus-visible:border-transparent\n min-h-16 p-4\n ", "\n ", "\n ", ""])), disabled ? "cursor-not-allowed border-grey-200" : "cursor-pointer border-grey-500", isDragReject && !disabled ? "border-red-200 cursor-not-allowed" : isDragActive ? "border-accent-500 cursor-pointer" : null, !disabled && (isInvalid ? "bg-red-100 border-red-700 hover:bg-red-50" : "bg-white hover:bg-grey-100")), className),
139
139
  onClick: function onClick(evt) {
140
140
  // Helps with https://github.com/react-dropzone/react-dropzone/issues/182
141
141
  if (evt.target.closest("label")) {