@algolia/satellite 2.2.2 → 2.3.0-rc.1

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 (158) hide show
  1. package/dist/cjs/Actions/Accordion/Accordion.d.ts +8 -0
  2. package/dist/cjs/Actions/Accordion/Accordion.js +5 -3
  3. package/dist/cjs/Fields/AutoComplete/AutoComplete.js +6 -1
  4. package/dist/cjs/Fields/TextArea/TextArea.d.ts +5 -1
  5. package/dist/cjs/Fields/TextArea/TextArea.js +3 -2
  6. package/dist/cjs/Fields/TextArea/TextArea.tailwind.js +1 -1
  7. package/dist/cjs/Fields/TextAreaAutoSize/TextAreaAutoSize.d.ts +18 -0
  8. package/dist/cjs/Fields/TextAreaAutoSize/TextAreaAutoSize.js +82 -0
  9. package/dist/cjs/Fields/TextAreaAutoSize/TextAreaAutoSize.styles.d.ts +25 -0
  10. package/dist/cjs/Fields/TextAreaAutoSize/TextAreaAutoSize.styles.js +16 -0
  11. package/dist/cjs/Fields/TextAreaAutoSize/index.d.ts +2 -0
  12. package/dist/cjs/Fields/TextAreaAutoSize/index.js +12 -0
  13. package/dist/cjs/Fields/index.d.ts +2 -1
  14. package/dist/cjs/Fields/index.js +15 -4
  15. package/dist/cjs/Helpers/ShimmerText/ShimmerText.d.ts +3 -0
  16. package/dist/cjs/Helpers/ShimmerText/ShimmerText.js +28 -0
  17. package/dist/cjs/Helpers/ShimmerText/ShimmerText.tailwind.d.ts +5 -0
  18. package/dist/cjs/Helpers/ShimmerText/ShimmerText.tailwind.js +37 -0
  19. package/dist/cjs/Helpers/ShimmerText/index.d.ts +2 -0
  20. package/dist/cjs/Helpers/ShimmerText/index.js +12 -0
  21. package/dist/cjs/Helpers/index.d.ts +1 -0
  22. package/dist/cjs/Helpers/index.js +11 -0
  23. package/dist/cjs/Helpers/utilities/utilities.tailwind.js +6 -1
  24. package/dist/cjs/Indicators/Skeleton/Skeleton.d.ts +2 -2
  25. package/dist/cjs/Layout/Chat/ChatContextAccordion/ChatContextAccordion.d.ts +8 -0
  26. package/dist/cjs/Layout/Chat/ChatContextAccordion/ChatContextAccordion.js +44 -0
  27. package/dist/cjs/Layout/Chat/ChatContextAccordion/ChatContextAccordion.styles.d.ts +67 -0
  28. package/dist/cjs/Layout/Chat/ChatContextAccordion/ChatContextAccordion.styles.js +23 -0
  29. package/dist/cjs/Layout/Chat/ChatContextAccordion/index.d.ts +1 -0
  30. package/dist/cjs/Layout/Chat/ChatContextAccordion/index.js +16 -0
  31. package/dist/cjs/Layout/Chat/ChatMessage/ChatMessage.d.ts +40 -0
  32. package/dist/cjs/Layout/Chat/ChatMessage/ChatMessage.js +83 -0
  33. package/dist/cjs/Layout/Chat/ChatMessage/ChatMessage.styles.d.ts +100 -0
  34. package/dist/cjs/Layout/Chat/ChatMessage/ChatMessage.styles.js +71 -0
  35. package/dist/cjs/Layout/Chat/ChatMessage/index.d.ts +1 -0
  36. package/dist/cjs/Layout/Chat/ChatMessage/index.js +16 -0
  37. package/dist/cjs/Layout/Chat/ChatMessageError/ChatMessageError.d.ts +57 -0
  38. package/dist/cjs/Layout/Chat/ChatMessageError/ChatMessageError.js +68 -0
  39. package/dist/cjs/Layout/Chat/ChatMessageError/ChatMessageError.styles.d.ts +173 -0
  40. package/dist/cjs/Layout/Chat/ChatMessageError/ChatMessageError.styles.js +18 -0
  41. package/dist/cjs/Layout/Chat/ChatMessageError/index.d.ts +1 -0
  42. package/dist/cjs/Layout/Chat/ChatMessageError/index.js +16 -0
  43. package/dist/cjs/Layout/Chat/ChatMessageLoader/ChatMessageLoader.d.ts +18 -0
  44. package/dist/cjs/Layout/Chat/ChatMessageLoader/ChatMessageLoader.js +63 -0
  45. package/dist/cjs/Layout/Chat/ChatMessageLoader/ChatMessageLoader.styles.d.ts +200 -0
  46. package/dist/cjs/Layout/Chat/ChatMessageLoader/ChatMessageLoader.styles.js +21 -0
  47. package/dist/cjs/Layout/Chat/ChatMessageLoader/index.d.ts +1 -0
  48. package/dist/cjs/Layout/Chat/ChatMessageLoader/index.js +16 -0
  49. package/dist/cjs/Layout/Chat/ChatMessages/ChatMessages.d.ts +42 -0
  50. package/dist/cjs/Layout/Chat/ChatMessages/ChatMessages.js +124 -0
  51. package/dist/cjs/Layout/Chat/ChatMessages/ChatMessages.styles.d.ts +43 -0
  52. package/dist/cjs/Layout/Chat/ChatMessages/ChatMessages.styles.js +29 -0
  53. package/dist/cjs/Layout/Chat/ChatMessages/index.d.ts +1 -0
  54. package/dist/cjs/Layout/Chat/ChatMessages/index.js +16 -0
  55. package/dist/cjs/Layout/Chat/ChatMessages/useLastMessageHeight.d.ts +10 -0
  56. package/dist/cjs/Layout/Chat/ChatMessages/useLastMessageHeight.js +47 -0
  57. package/dist/cjs/Layout/Chat/ChatPrompt/ChatPrompt.d.ts +83 -0
  58. package/dist/cjs/Layout/Chat/ChatPrompt/ChatPrompt.js +136 -0
  59. package/dist/cjs/Layout/Chat/ChatPrompt/ChatPrompt.styles.d.ts +61 -0
  60. package/dist/cjs/Layout/Chat/ChatPrompt/ChatPrompt.styles.js +22 -0
  61. package/dist/cjs/Layout/Chat/ChatPrompt/index.d.ts +1 -0
  62. package/dist/cjs/Layout/Chat/ChatPrompt/index.js +16 -0
  63. package/dist/cjs/Layout/Chat/ChatPrompt/useTypewriter.d.ts +18 -0
  64. package/dist/cjs/Layout/Chat/ChatPrompt/useTypewriter.js +78 -0
  65. package/dist/cjs/Layout/Chat/index.d.ts +15 -0
  66. package/dist/cjs/Layout/Chat/index.js +47 -0
  67. package/dist/cjs/Layout/Chat/types.d.ts +7 -0
  68. package/dist/cjs/Layout/Chat/types.js +5 -0
  69. package/dist/cjs/Layout/index.d.ts +1 -0
  70. package/dist/cjs/Layout/index.js +11 -0
  71. package/dist/cjs/Overlay/Modal/Modal.js +1 -1
  72. package/dist/cjs/Satellite/locale.d.ts +7 -1
  73. package/dist/cjs/styles/helpers/tv.d.ts +1 -0
  74. package/dist/cjs/styles/helpers/tv.js +13 -0
  75. package/dist/cjs/styles/tailwind.config.js +1 -1
  76. package/dist/cjs/utils/getTextFromReactNode.d.ts +2 -1
  77. package/dist/cjs/utils/getTextFromReactNode.js +12 -7
  78. package/dist/cjs/utils/isCssPropertySupported.d.ts +1 -1
  79. package/dist/esm/Actions/Accordion/Accordion.d.ts +8 -0
  80. package/dist/esm/Actions/Accordion/Accordion.js +5 -3
  81. package/dist/esm/Fields/AutoComplete/AutoComplete.js +6 -1
  82. package/dist/esm/Fields/TextArea/TextArea.d.ts +5 -1
  83. package/dist/esm/Fields/TextArea/TextArea.js +3 -2
  84. package/dist/esm/Fields/TextArea/TextArea.tailwind.js +1 -1
  85. package/dist/esm/Fields/TextAreaAutoSize/TextAreaAutoSize.d.ts +18 -0
  86. package/dist/esm/Fields/TextAreaAutoSize/TextAreaAutoSize.js +75 -0
  87. package/dist/esm/Fields/TextAreaAutoSize/TextAreaAutoSize.styles.d.ts +25 -0
  88. package/dist/esm/Fields/TextAreaAutoSize/TextAreaAutoSize.styles.js +9 -0
  89. package/dist/esm/Fields/TextAreaAutoSize/index.d.ts +2 -0
  90. package/dist/esm/Fields/TextAreaAutoSize/index.js +1 -0
  91. package/dist/esm/Fields/index.d.ts +2 -1
  92. package/dist/esm/Fields/index.js +2 -1
  93. package/dist/esm/Helpers/ShimmerText/ShimmerText.d.ts +3 -0
  94. package/dist/esm/Helpers/ShimmerText/ShimmerText.js +21 -0
  95. package/dist/esm/Helpers/ShimmerText/ShimmerText.tailwind.d.ts +5 -0
  96. package/dist/esm/Helpers/ShimmerText/ShimmerText.tailwind.js +36 -0
  97. package/dist/esm/Helpers/ShimmerText/index.d.ts +2 -0
  98. package/dist/esm/Helpers/ShimmerText/index.js +1 -0
  99. package/dist/esm/Helpers/index.d.ts +1 -0
  100. package/dist/esm/Helpers/index.js +2 -1
  101. package/dist/esm/Helpers/utilities/utilities.tailwind.js +6 -1
  102. package/dist/esm/Indicators/Skeleton/Skeleton.d.ts +2 -2
  103. package/dist/esm/Layout/Chat/ChatContextAccordion/ChatContextAccordion.d.ts +8 -0
  104. package/dist/esm/Layout/Chat/ChatContextAccordion/ChatContextAccordion.js +37 -0
  105. package/dist/esm/Layout/Chat/ChatContextAccordion/ChatContextAccordion.styles.d.ts +67 -0
  106. package/dist/esm/Layout/Chat/ChatContextAccordion/ChatContextAccordion.styles.js +16 -0
  107. package/dist/esm/Layout/Chat/ChatContextAccordion/index.d.ts +1 -0
  108. package/dist/esm/Layout/Chat/ChatContextAccordion/index.js +1 -0
  109. package/dist/esm/Layout/Chat/ChatMessage/ChatMessage.d.ts +40 -0
  110. package/dist/esm/Layout/Chat/ChatMessage/ChatMessage.js +77 -0
  111. package/dist/esm/Layout/Chat/ChatMessage/ChatMessage.styles.d.ts +100 -0
  112. package/dist/esm/Layout/Chat/ChatMessage/ChatMessage.styles.js +64 -0
  113. package/dist/esm/Layout/Chat/ChatMessage/index.d.ts +1 -0
  114. package/dist/esm/Layout/Chat/ChatMessage/index.js +1 -0
  115. package/dist/esm/Layout/Chat/ChatMessageError/ChatMessageError.d.ts +57 -0
  116. package/dist/esm/Layout/Chat/ChatMessageError/ChatMessageError.js +61 -0
  117. package/dist/esm/Layout/Chat/ChatMessageError/ChatMessageError.styles.d.ts +173 -0
  118. package/dist/esm/Layout/Chat/ChatMessageError/ChatMessageError.styles.js +11 -0
  119. package/dist/esm/Layout/Chat/ChatMessageError/index.d.ts +1 -0
  120. package/dist/esm/Layout/Chat/ChatMessageError/index.js +1 -0
  121. package/dist/esm/Layout/Chat/ChatMessageLoader/ChatMessageLoader.d.ts +18 -0
  122. package/dist/esm/Layout/Chat/ChatMessageLoader/ChatMessageLoader.js +56 -0
  123. package/dist/esm/Layout/Chat/ChatMessageLoader/ChatMessageLoader.styles.d.ts +200 -0
  124. package/dist/esm/Layout/Chat/ChatMessageLoader/ChatMessageLoader.styles.js +14 -0
  125. package/dist/esm/Layout/Chat/ChatMessageLoader/index.d.ts +1 -0
  126. package/dist/esm/Layout/Chat/ChatMessageLoader/index.js +1 -0
  127. package/dist/esm/Layout/Chat/ChatMessages/ChatMessages.d.ts +42 -0
  128. package/dist/esm/Layout/Chat/ChatMessages/ChatMessages.js +119 -0
  129. package/dist/esm/Layout/Chat/ChatMessages/ChatMessages.styles.d.ts +43 -0
  130. package/dist/esm/Layout/Chat/ChatMessages/ChatMessages.styles.js +22 -0
  131. package/dist/esm/Layout/Chat/ChatMessages/index.d.ts +1 -0
  132. package/dist/esm/Layout/Chat/ChatMessages/index.js +1 -0
  133. package/dist/esm/Layout/Chat/ChatMessages/useLastMessageHeight.d.ts +10 -0
  134. package/dist/esm/Layout/Chat/ChatMessages/useLastMessageHeight.js +41 -0
  135. package/dist/esm/Layout/Chat/ChatPrompt/ChatPrompt.d.ts +83 -0
  136. package/dist/esm/Layout/Chat/ChatPrompt/ChatPrompt.js +131 -0
  137. package/dist/esm/Layout/Chat/ChatPrompt/ChatPrompt.styles.d.ts +61 -0
  138. package/dist/esm/Layout/Chat/ChatPrompt/ChatPrompt.styles.js +15 -0
  139. package/dist/esm/Layout/Chat/ChatPrompt/index.d.ts +1 -0
  140. package/dist/esm/Layout/Chat/ChatPrompt/index.js +1 -0
  141. package/dist/esm/Layout/Chat/ChatPrompt/useTypewriter.d.ts +18 -0
  142. package/dist/esm/Layout/Chat/ChatPrompt/useTypewriter.js +71 -0
  143. package/dist/esm/Layout/Chat/index.d.ts +15 -0
  144. package/dist/esm/Layout/Chat/index.js +6 -0
  145. package/dist/esm/Layout/Chat/types.d.ts +7 -0
  146. package/dist/esm/Layout/Chat/types.js +1 -0
  147. package/dist/esm/Layout/index.d.ts +1 -0
  148. package/dist/esm/Layout/index.js +1 -0
  149. package/dist/esm/Overlay/Modal/Modal.js +1 -1
  150. package/dist/esm/Satellite/locale.d.ts +7 -1
  151. package/dist/esm/styles/helpers/tv.d.ts +1 -0
  152. package/dist/esm/styles/helpers/tv.js +7 -0
  153. package/dist/esm/styles/tailwind.config.js +1 -1
  154. package/dist/esm/utils/getTextFromReactNode.d.ts +2 -1
  155. package/dist/esm/utils/getTextFromReactNode.js +13 -8
  156. package/dist/esm/utils/isCssPropertySupported.d.ts +1 -1
  157. package/dist/satellite.min.css +1 -1
  158. package/package.json +12 -3
@@ -0,0 +1,40 @@
1
+ import type { HTMLAttributes, MouseEvent, ReactElement, ReactNode, Ref } from "react";
2
+ import type { VariantProps } from "tailwind-variants";
3
+ import { chatMessageStyles } from "./ChatMessage.styles";
4
+ import type { IconButtonWithFeedbackProps } from "../../../Actions";
5
+ import type { UserAvatarProps } from "../../../Indicators";
6
+ declare type ChatMessageVariants = VariantProps<typeof chatMessageStyles>;
7
+ declare type Actions<ActionsExtraData extends Record<string, any> = Record<string, any>> = Array<Omit<IconButtonWithFeedbackProps, "onClick" | "tooltipDelay" | "tooltipHideDelay"> & {
8
+ onClick?: (e: MouseEvent<HTMLButtonElement>, actionsExtraData?: ActionsExtraData) => Promise<void> | void;
9
+ }>;
10
+ export declare type ChatMessageProps<ActionsExtraData extends Record<string, any> = Record<string, any>> = Omit<HTMLAttributes<HTMLElement>, "children" | "content"> & {
11
+ content: ReactNode;
12
+ avatar?: UserAvatarProps["user"];
13
+ avatarSize?: UserAvatarProps["size"];
14
+ side?: ChatMessageVariants["side"];
15
+ variant?: ChatMessageVariants["variant"];
16
+ actions?: Actions<ActionsExtraData>;
17
+ autoHideActions?: boolean;
18
+ renderLeading?: ReactNode;
19
+ renderActions?: (actions?: Actions<ActionsExtraData>) => ReactNode;
20
+ renderFooter?: ReactNode;
21
+ actionsExtraData?: ActionsExtraData;
22
+ rtl?: boolean;
23
+ };
24
+ export declare const ChatMessage: <ActionsExtraData extends Record<string, any> = Record<string, any>>(props: Omit<HTMLAttributes<HTMLElement>, "children" | "content"> & {
25
+ content: ReactNode;
26
+ avatar?: import("../../../Indicators/Avatars/types").MinimalUser | undefined;
27
+ avatarSize?: UserAvatarProps["size"];
28
+ side?: ChatMessageVariants["side"];
29
+ variant?: ChatMessageVariants["variant"];
30
+ actions?: Actions<ActionsExtraData> | undefined;
31
+ autoHideActions?: boolean | undefined;
32
+ renderLeading?: ReactNode;
33
+ renderActions?: ((actions?: Actions<ActionsExtraData> | undefined) => ReactNode) | undefined;
34
+ renderFooter?: ReactNode;
35
+ actionsExtraData?: ActionsExtraData | undefined;
36
+ rtl?: boolean | undefined;
37
+ } & {
38
+ ref?: Ref<HTMLDivElement> | undefined;
39
+ }) => ReactElement | null;
40
+ export {};
@@ -0,0 +1,77 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["content", "avatar", "avatarSize", "side", "variant", "actions", "autoHideActions", "renderLeading", "renderActions", "renderFooter", "actionsExtraData", "rtl", "className"];
4
+ 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; }
5
+ 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; }
6
+ import { memo } from "react";
7
+ import { forwardRef } from "react";
8
+ import { chatMessageStyles } from "./ChatMessage.styles";
9
+ import { IconButtonWithFeedback } from "./../../../Actions";
10
+ import { UserAvatar } from "./../../../Indicators";
11
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
+ var ChatMessageBase = function ChatMessageBase(_ref, ref) {
13
+ var content = _ref.content,
14
+ avatar = _ref.avatar,
15
+ _ref$avatarSize = _ref.avatarSize,
16
+ avatarSize = _ref$avatarSize === void 0 ? "medium" : _ref$avatarSize,
17
+ side = _ref.side,
18
+ variant = _ref.variant,
19
+ actions = _ref.actions,
20
+ _ref$autoHideActions = _ref.autoHideActions,
21
+ autoHideActions = _ref$autoHideActions === void 0 ? false : _ref$autoHideActions,
22
+ renderLeading = _ref.renderLeading,
23
+ renderActions = _ref.renderActions,
24
+ renderFooter = _ref.renderFooter,
25
+ actionsExtraData = _ref.actionsExtraData,
26
+ _ref$rtl = _ref.rtl,
27
+ rtl = _ref$rtl === void 0 ? false : _ref$rtl,
28
+ className = _ref.className,
29
+ props = _objectWithoutProperties(_ref, _excluded);
30
+ var styles = chatMessageStyles({
31
+ side: side,
32
+ variant: variant,
33
+ leading: !!avatar,
34
+ actions: !!actions,
35
+ autoHideActions: autoHideActions
36
+ });
37
+ return /*#__PURE__*/_jsx("article", _objectSpread(_objectSpread({}, props), {}, {
38
+ ref: ref,
39
+ className: styles.base({
40
+ className: className
41
+ }),
42
+ dir: rtl ? "rtl" : "ltr",
43
+ children: /*#__PURE__*/_jsxs("div", {
44
+ className: styles.container(),
45
+ children: [(!!avatar || !!renderLeading) && /*#__PURE__*/_jsx("div", {
46
+ className: styles.leading(),
47
+ children: avatar ? /*#__PURE__*/_jsx(UserAvatar, {
48
+ user: avatar,
49
+ size: avatarSize
50
+ }) : renderLeading
51
+ }), /*#__PURE__*/_jsxs("div", {
52
+ className: styles.content(),
53
+ children: [/*#__PURE__*/_jsx("div", {
54
+ className: styles.message(),
55
+ children: content
56
+ }), (!!actions || !!renderActions) && /*#__PURE__*/_jsx("div", {
57
+ className: styles.actions(),
58
+ children: (renderActions === null || renderActions === void 0 ? void 0 : renderActions(actions)) || (actions === null || actions === void 0 ? void 0 : actions.map(function (actionProps, index) {
59
+ return /*#__PURE__*/_jsx(IconButtonWithFeedback, _objectSpread(_objectSpread({
60
+ size: "small",
61
+ variant: "subtle",
62
+ tooltipSide: "bottom"
63
+ }, actionProps), {}, {
64
+ onClick: function onClick(e) {
65
+ var _actionProps$onClick;
66
+ return (_actionProps$onClick = actionProps.onClick) === null || _actionProps$onClick === void 0 ? void 0 : _actionProps$onClick.call(actionProps, e, actionsExtraData);
67
+ },
68
+ tooltipDelay: 0,
69
+ tooltipHideDelay: 0
70
+ }), index);
71
+ }))
72
+ }), renderFooter]
73
+ })]
74
+ })
75
+ }));
76
+ };
77
+ export var ChatMessage = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(ChatMessageBase));
@@ -0,0 +1,100 @@
1
+ export declare const chatMessageStyles: import("tailwind-variants").TVReturnType<{
2
+ variant: {
3
+ neutral: {
4
+ message: string;
5
+ };
6
+ subtle: {
7
+ message: string;
8
+ };
9
+ };
10
+ side: {
11
+ left: {
12
+ container: string;
13
+ };
14
+ right: {
15
+ container: string;
16
+ };
17
+ };
18
+ leading: {
19
+ true: string;
20
+ };
21
+ actions: {
22
+ true: string;
23
+ };
24
+ autoHideActions: {
25
+ true: string;
26
+ };
27
+ }, {
28
+ base: string;
29
+ container: string;
30
+ leading: string;
31
+ content: string;
32
+ message: string;
33
+ actions: string;
34
+ }, undefined, {
35
+ variant: {
36
+ neutral: {
37
+ message: string;
38
+ };
39
+ subtle: {
40
+ message: string;
41
+ };
42
+ };
43
+ side: {
44
+ left: {
45
+ container: string;
46
+ };
47
+ right: {
48
+ container: string;
49
+ };
50
+ };
51
+ leading: {
52
+ true: string;
53
+ };
54
+ actions: {
55
+ true: string;
56
+ };
57
+ autoHideActions: {
58
+ true: string;
59
+ };
60
+ }, {
61
+ base: string;
62
+ container: string;
63
+ leading: string;
64
+ content: string;
65
+ message: string;
66
+ actions: string;
67
+ }, import("tailwind-variants").TVReturnType<{
68
+ variant: {
69
+ neutral: {
70
+ message: string;
71
+ };
72
+ subtle: {
73
+ message: string;
74
+ };
75
+ };
76
+ side: {
77
+ left: {
78
+ container: string;
79
+ };
80
+ right: {
81
+ container: string;
82
+ };
83
+ };
84
+ leading: {
85
+ true: string;
86
+ };
87
+ actions: {
88
+ true: string;
89
+ };
90
+ autoHideActions: {
91
+ true: string;
92
+ };
93
+ }, {
94
+ base: string;
95
+ container: string;
96
+ leading: string;
97
+ content: string;
98
+ message: string;
99
+ actions: string;
100
+ }, undefined, unknown, unknown, undefined>>;
@@ -0,0 +1,64 @@
1
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17;
3
+ import stl from "./../../../styles/helpers/satellitePrefixer";
4
+ import { tv } from "./../../../styles/helpers/tv";
5
+ export var chatMessageStyles = tv({
6
+ slots: {
7
+ base: stl(_templateObject || (_templateObject = _taggedTemplateLiteral(["relative w-full scroll-mt-4 group/message"]))),
8
+ container: stl(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["relative flex items-start group-data-[role=user]/message:max-w-[70%] gap-3"]))),
9
+ leading: stl(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["inline-flex items-center justify-center"]))),
10
+ content: stl(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["flex flex-col gap-3 group-data-[role=assistant]/message:grow overflow-x-auto"]))),
11
+ message: stl(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["relative text-pretty typo-display-body"]))),
12
+ actions: stl(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["flex items-center gap-1"])))
13
+ },
14
+ variants: {
15
+ variant: {
16
+ neutral: {
17
+ message: stl(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["bg-grey-100"])))
18
+ },
19
+ subtle: {
20
+ message: stl(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral([""])))
21
+ }
22
+ },
23
+ side: {
24
+ left: {
25
+ container: stl(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["rtl:justify-end"])))
26
+ },
27
+ right: {
28
+ container: stl(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["ltr:justify-end ms-auto"])))
29
+ }
30
+ },
31
+ leading: {
32
+ "true": stl(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral([""])))
33
+ },
34
+ actions: {
35
+ "true": stl(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral([""])))
36
+ },
37
+ autoHideActions: {
38
+ "true": stl(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral([""])))
39
+ }
40
+ },
41
+ compoundVariants: [{
42
+ variant: "neutral",
43
+ className: {
44
+ message: stl(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["p-3 rounded-[8px]"]))),
45
+ leading: stl(_templateObject15 || (_templateObject15 = _taggedTemplateLiteral(["mt-3"])))
46
+ }
47
+ }, {
48
+ leading: true,
49
+ side: "left",
50
+ className: {
51
+ actions: stl(_templateObject16 || (_templateObject16 = _taggedTemplateLiteral(["left-11"])))
52
+ }
53
+ }, {
54
+ actions: true,
55
+ autoHideActions: true,
56
+ className: {
57
+ actions: stl(_templateObject17 || (_templateObject17 = _taggedTemplateLiteral(["opacity-0 group-hover/message:opacity-100 transition-opacity"])))
58
+ }
59
+ }],
60
+ defaultVariants: {
61
+ variant: "subtle",
62
+ side: "left"
63
+ }
64
+ });
@@ -0,0 +1 @@
1
+ export * from "./ChatMessage";
@@ -0,0 +1 @@
1
+ export * from "./ChatMessage";
@@ -0,0 +1,57 @@
1
+ import type { HTMLAttributes, ReactNode } from "react";
2
+ import type { ButtonProps } from "../../../Actions";
3
+ import type { ChatMessageProps } from "../../../Layout/Chat/ChatMessage";
4
+ export declare type ChatMessageErrorLocale = {
5
+ error?: string;
6
+ retry?: string;
7
+ };
8
+ export declare type ChatMessageErrorProps = Omit<HTMLAttributes<HTMLElement>, "children"> & Pick<ChatMessageProps, "rtl"> & {
9
+ /**
10
+ * Content to render as the error message.
11
+ * If not provided, a default error message will be shown.
12
+ */
13
+ renderError?: ReactNode;
14
+ /**
15
+ * Content to render below the error message.
16
+ */
17
+ renderFooter?: ReactNode;
18
+ /**
19
+ * Optional actions to display below the error message.
20
+ * If not provided, a default retry button will be shown.
21
+ */
22
+ actions?: ButtonProps[];
23
+ /**
24
+ * Callback function to be called when the retry button is clicked.
25
+ * If not provided, the default retry button will not have any action.
26
+ */
27
+ onReload?: () => void;
28
+ /**
29
+ * Optional locale.
30
+ */
31
+ locale?: ChatMessageErrorLocale;
32
+ };
33
+ export declare const ChatMessageError: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLElement>, "children"> & Pick<ChatMessageProps<Record<string, any>>, "rtl"> & {
34
+ /**
35
+ * Content to render as the error message.
36
+ * If not provided, a default error message will be shown.
37
+ */
38
+ renderError?: ReactNode;
39
+ /**
40
+ * Content to render below the error message.
41
+ */
42
+ renderFooter?: ReactNode;
43
+ /**
44
+ * Optional actions to display below the error message.
45
+ * If not provided, a default retry button will be shown.
46
+ */
47
+ actions?: ButtonProps[] | undefined;
48
+ /**
49
+ * Callback function to be called when the retry button is clicked.
50
+ * If not provided, the default retry button will not have any action.
51
+ */
52
+ onReload?: (() => void) | undefined;
53
+ /**
54
+ * Optional locale.
55
+ */
56
+ locale?: ChatMessageErrorLocale | undefined;
57
+ } & import("react").RefAttributes<HTMLElement>>;
@@ -0,0 +1,61 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["renderError", "actions", "renderFooter", "locale", "onReload", "rtl", "className"];
4
+ 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; }
5
+ 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; }
6
+ import { RotateCwIcon } from "lucide-react";
7
+ import { forwardRef } from "react";
8
+ import { chatMessageErrorStyles } from "./ChatMessageError.styles";
9
+ import { Button } from "./../../../Actions";
10
+ import { useLocale } from "./../../../Satellite";
11
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
+ var DEFAULT_CHAT_MESSAGE_ERROR_LOCALE = {
13
+ error: "Sorry, we are not able to generate a response at the moment. Please retry or contact support.",
14
+ retry: "Retry"
15
+ };
16
+ export var ChatMessageError = /*#__PURE__*/forwardRef(function (_ref, ref) {
17
+ var renderError = _ref.renderError,
18
+ actions = _ref.actions,
19
+ renderFooter = _ref.renderFooter,
20
+ propsLocale = _ref.locale,
21
+ onReload = _ref.onReload,
22
+ rtl = _ref.rtl,
23
+ className = _ref.className,
24
+ props = _objectWithoutProperties(_ref, _excluded);
25
+ var contextLocale = useLocale("chatMessageError");
26
+ var locale = _objectSpread(_objectSpread(_objectSpread({}, DEFAULT_CHAT_MESSAGE_ERROR_LOCALE), contextLocale), propsLocale);
27
+ var styles = chatMessageErrorStyles({
28
+ side: "left",
29
+ variant: "subtle"
30
+ });
31
+ return /*#__PURE__*/_jsx("article", _objectSpread(_objectSpread({}, props), {}, {
32
+ ref: ref,
33
+ className: styles.base({
34
+ className: className
35
+ }),
36
+ dir: rtl ? "rtl" : "ltr",
37
+ children: /*#__PURE__*/_jsx("div", {
38
+ className: styles.container(),
39
+ children: /*#__PURE__*/_jsxs("div", {
40
+ className: styles.content(),
41
+ children: [/*#__PURE__*/_jsx("div", {
42
+ className: styles.message(),
43
+ children: renderError !== null && renderError !== void 0 ? renderError : locale.error
44
+ }), actions ? /*#__PURE__*/_jsx("div", {
45
+ className: styles.actions(),
46
+ children: actions.map(function (action, index) {
47
+ return /*#__PURE__*/_jsx(Button, _objectSpread(_objectSpread({}, action), {}, {
48
+ children: action.children
49
+ }), index);
50
+ })
51
+ }) : /*#__PURE__*/_jsx(Button, {
52
+ variant: "primary",
53
+ startIcon: RotateCwIcon,
54
+ onClick: onReload,
55
+ children: locale.retry
56
+ }), renderFooter]
57
+ })
58
+ })
59
+ }));
60
+ });
61
+ ChatMessageError.displayName = "ChatMessageError";
@@ -0,0 +1,173 @@
1
+ export declare const chatMessageErrorStyles: import("tailwind-variants").TVReturnType<{
2
+ [key: string]: {
3
+ [key: string]: import("tailwind-merge").ClassNameValue | {
4
+ content?: import("tailwind-merge").ClassNameValue;
5
+ };
6
+ };
7
+ } | {
8
+ variant: {
9
+ neutral: import("tailwind-merge").ClassNameValue | {
10
+ content?: import("tailwind-merge").ClassNameValue;
11
+ };
12
+ subtle: import("tailwind-merge").ClassNameValue | {
13
+ content?: import("tailwind-merge").ClassNameValue;
14
+ };
15
+ };
16
+ side: {
17
+ left: import("tailwind-merge").ClassNameValue | {
18
+ content?: import("tailwind-merge").ClassNameValue;
19
+ };
20
+ right: import("tailwind-merge").ClassNameValue | {
21
+ content?: import("tailwind-merge").ClassNameValue;
22
+ };
23
+ };
24
+ leading: {
25
+ true: import("tailwind-merge").ClassNameValue | {
26
+ content?: import("tailwind-merge").ClassNameValue;
27
+ };
28
+ };
29
+ actions: {
30
+ true: import("tailwind-merge").ClassNameValue | {
31
+ content?: import("tailwind-merge").ClassNameValue;
32
+ };
33
+ };
34
+ autoHideActions: {
35
+ true: import("tailwind-merge").ClassNameValue | {
36
+ content?: import("tailwind-merge").ClassNameValue;
37
+ };
38
+ };
39
+ }, {
40
+ content: string;
41
+ }, undefined, {
42
+ variant: {
43
+ neutral: {
44
+ message: string;
45
+ };
46
+ subtle: {
47
+ message: string;
48
+ };
49
+ };
50
+ side: {
51
+ left: {
52
+ container: string;
53
+ };
54
+ right: {
55
+ container: string;
56
+ };
57
+ };
58
+ leading: {
59
+ true: string;
60
+ };
61
+ actions: {
62
+ true: string;
63
+ };
64
+ autoHideActions: {
65
+ true: string;
66
+ };
67
+ }, {
68
+ base: string;
69
+ container: string;
70
+ leading: string;
71
+ content: string;
72
+ message: string;
73
+ actions: string;
74
+ }, import("tailwind-variants").TVReturnType<{
75
+ variant: {
76
+ neutral: {
77
+ message: string;
78
+ };
79
+ subtle: {
80
+ message: string;
81
+ };
82
+ };
83
+ side: {
84
+ left: {
85
+ container: string;
86
+ };
87
+ right: {
88
+ container: string;
89
+ };
90
+ };
91
+ leading: {
92
+ true: string;
93
+ };
94
+ actions: {
95
+ true: string;
96
+ };
97
+ autoHideActions: {
98
+ true: string;
99
+ };
100
+ }, {
101
+ base: string;
102
+ container: string;
103
+ leading: string;
104
+ content: string;
105
+ message: string;
106
+ actions: string;
107
+ }, undefined, {
108
+ variant: {
109
+ neutral: {
110
+ message: string;
111
+ };
112
+ subtle: {
113
+ message: string;
114
+ };
115
+ };
116
+ side: {
117
+ left: {
118
+ container: string;
119
+ };
120
+ right: {
121
+ container: string;
122
+ };
123
+ };
124
+ leading: {
125
+ true: string;
126
+ };
127
+ actions: {
128
+ true: string;
129
+ };
130
+ autoHideActions: {
131
+ true: string;
132
+ };
133
+ }, {
134
+ base: string;
135
+ container: string;
136
+ leading: string;
137
+ content: string;
138
+ message: string;
139
+ actions: string;
140
+ }, import("tailwind-variants").TVReturnType<{
141
+ variant: {
142
+ neutral: {
143
+ message: string;
144
+ };
145
+ subtle: {
146
+ message: string;
147
+ };
148
+ };
149
+ side: {
150
+ left: {
151
+ container: string;
152
+ };
153
+ right: {
154
+ container: string;
155
+ };
156
+ };
157
+ leading: {
158
+ true: string;
159
+ };
160
+ actions: {
161
+ true: string;
162
+ };
163
+ autoHideActions: {
164
+ true: string;
165
+ };
166
+ }, {
167
+ base: string;
168
+ container: string;
169
+ leading: string;
170
+ content: string;
171
+ message: string;
172
+ actions: string;
173
+ }, undefined, unknown, unknown, undefined>>>;
@@ -0,0 +1,11 @@
1
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
+ var _templateObject;
3
+ import { chatMessageStyles } from "./../ChatMessage/ChatMessage.styles";
4
+ import stl from "./../../../styles/helpers/satellitePrefixer";
5
+ import { tv } from "./../../../styles/helpers/tv";
6
+ export var chatMessageErrorStyles = tv({
7
+ extend: chatMessageStyles,
8
+ slots: {
9
+ content: stl(_templateObject || (_templateObject = _taggedTemplateLiteral(["w-full items-start"])))
10
+ }
11
+ });
@@ -0,0 +1 @@
1
+ export * from "./ChatMessageError";
@@ -0,0 +1 @@
1
+ export * from "./ChatMessageError";
@@ -0,0 +1,18 @@
1
+ import type { HTMLAttributes, ReactNode } from "react";
2
+ import type { ChatMessageProps } from "../../../Layout/Chat/ChatMessage";
3
+ export declare type ChatMessageLoaderProps = Omit<HTMLAttributes<HTMLElement>, "children"> & Pick<ChatMessageProps, "rtl"> & {
4
+ /**
5
+ * Message to display in the loader.
6
+ * If not provided, no message will be shown.
7
+ * @default undefined
8
+ */
9
+ message?: ReactNode;
10
+ };
11
+ export declare const ChatMessageLoader: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLElement>, "children"> & Pick<ChatMessageProps<Record<string, any>>, "rtl"> & {
12
+ /**
13
+ * Message to display in the loader.
14
+ * If not provided, no message will be shown.
15
+ * @default undefined
16
+ */
17
+ message?: ReactNode;
18
+ } & import("react").RefAttributes<HTMLElement>>;
@@ -0,0 +1,56 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
3
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
+ var _templateObject;
5
+ var _excluded = ["message", "rtl", "className"];
6
+ 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; }
7
+ 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; }
8
+ import { forwardRef } from "react";
9
+ import { chatMessageLoaderStyles } from "./ChatMessageLoader.styles";
10
+ import { ShimmerText } from "./../../../Helpers/ShimmerText/ShimmerText";
11
+ import { ProgressSpinner, Skeleton } from "./../../../Indicators";
12
+ import stl from "./../../../styles/helpers/satellitePrefixer";
13
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
+ export var ChatMessageLoader = /*#__PURE__*/forwardRef(function (_ref, ref) {
15
+ var message = _ref.message,
16
+ rtl = _ref.rtl,
17
+ className = _ref.className,
18
+ props = _objectWithoutProperties(_ref, _excluded);
19
+ var styles = chatMessageLoaderStyles({
20
+ side: "left",
21
+ variant: "subtle",
22
+ leading: true
23
+ });
24
+ return /*#__PURE__*/_jsx("article", _objectSpread(_objectSpread({}, props), {}, {
25
+ ref: ref,
26
+ className: styles.base({
27
+ className: className
28
+ }),
29
+ dir: rtl ? "rtl" : "ltr",
30
+ children: /*#__PURE__*/_jsxs("div", {
31
+ className: styles.container(),
32
+ children: [/*#__PURE__*/_jsx("div", {
33
+ className: styles.leading(),
34
+ children: /*#__PURE__*/_jsx(ProgressSpinner, {})
35
+ }), /*#__PURE__*/_jsx("div", {
36
+ className: styles.content(),
37
+ children: /*#__PURE__*/_jsxs("div", {
38
+ className: styles.message(),
39
+ children: [/*#__PURE__*/_jsx(ShimmerText, {
40
+ children: message
41
+ }), /*#__PURE__*/_jsxs("div", {
42
+ className: styles.skeletonWrapper(),
43
+ children: [/*#__PURE__*/_jsx(Skeleton, {
44
+ className: styles.skeleton()
45
+ }), /*#__PURE__*/_jsx(Skeleton, {
46
+ className: styles.skeleton({
47
+ className: stl(_templateObject || (_templateObject = _taggedTemplateLiteral(["w-2/5"])))
48
+ })
49
+ })]
50
+ })]
51
+ })
52
+ })]
53
+ })
54
+ }));
55
+ });
56
+ ChatMessageLoader.displayName = "ChatMessageLoader";