@algolia/satellite 2.3.0-rc.5 → 2.3.0-rc.8
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.
- package/dist/cjs/Chat/ChatContextAccordion/ChatContextAccordion.d.ts +23 -0
- package/dist/cjs/{Layout/Chat → Chat}/ChatContextAccordion/ChatContextAccordion.js +9 -2
- package/dist/cjs/{Layout/Chat → Chat}/ChatContextAccordion/ChatContextAccordion.styles.d.ts +23 -4
- package/dist/cjs/{Layout/Chat → Chat}/ChatContextAccordion/ChatContextAccordion.styles.js +3 -3
- package/dist/cjs/{Layout/Chat → Chat}/ChatMessage/ChatMessage.d.ts +80 -3
- package/dist/cjs/{Layout/Chat → Chat}/ChatMessage/ChatMessage.js +14 -5
- package/dist/{esm/Layout/Chat/ChatMessageError/ChatMessageError.styles.d.ts → cjs/Chat/ChatMessage/ChatMessage.styles.d.ts} +34 -40
- package/dist/cjs/{Layout/Chat → Chat}/ChatMessage/ChatMessage.styles.js +12 -12
- package/dist/{esm/Layout → cjs}/Chat/ChatMessageError/ChatMessageError.d.ts +7 -2
- package/dist/cjs/{Layout/Chat → Chat}/ChatMessageError/ChatMessageError.js +8 -3
- package/dist/cjs/Chat/ChatMessageError/ChatMessageError.styles.d.ts +253 -0
- package/dist/cjs/{Layout/Chat → Chat}/ChatMessageError/ChatMessageError.styles.js +2 -2
- package/dist/cjs/{Layout/Chat → Chat}/ChatMessageLoader/ChatMessageLoader.d.ts +6 -3
- package/dist/cjs/{Layout/Chat → Chat}/ChatMessageLoader/ChatMessageLoader.js +9 -4
- package/dist/{esm/Layout → cjs}/Chat/ChatMessageLoader/ChatMessageLoader.styles.d.ts +89 -9
- package/dist/cjs/{Layout/Chat → Chat}/ChatMessageLoader/ChatMessageLoader.styles.js +2 -2
- package/dist/cjs/Chat/ChatMessages/ChatMessages.d.ts +141 -0
- package/dist/cjs/{Layout/Chat → Chat}/ChatMessages/ChatMessages.js +18 -7
- package/dist/cjs/{Layout/Chat → Chat}/ChatMessages/ChatMessages.styles.d.ts +27 -1
- package/dist/cjs/{Layout/Chat → Chat}/ChatMessages/ChatMessages.styles.js +2 -2
- package/dist/cjs/{Layout/Chat → Chat}/ChatMessages/useLastMessageHeight.d.ts +7 -1
- package/dist/cjs/{Layout/Chat → Chat}/ChatMessages/useLastMessageHeight.js +6 -0
- package/dist/cjs/{Layout/Chat → Chat}/ChatPrompt/ChatPrompt.d.ts +16 -2
- package/dist/cjs/{Layout/Chat → Chat}/ChatPrompt/ChatPrompt.js +32 -20
- package/dist/cjs/Chat/ChatPrompt/ChatPrompt.styles.d.ts +63 -0
- package/dist/cjs/{Layout/Chat → Chat}/ChatPrompt/ChatPrompt.styles.js +10 -3
- package/dist/cjs/Chat/ChatPrompt/useFocusTyping.d.ts +30 -0
- package/dist/cjs/{Layout/Chat → Chat}/ChatPrompt/useFocusTyping.js +19 -14
- package/dist/cjs/{Layout/Chat → Chat}/ChatPrompt/useTypewriter.d.ts +9 -0
- package/dist/cjs/{Layout/Chat → Chat}/ChatPrompt/useTypewriter.js +9 -0
- package/dist/cjs/Fields/Checkbox/Checkbox.d.ts +2 -2
- package/dist/cjs/Fields/Checkbox/Checkbox.js +2 -2
- package/dist/cjs/Fields/Dropzone/Dropzone.js +1 -1
- package/dist/cjs/Fields/Form/stories/Complex.js +123 -50
- package/dist/cjs/Fields/RadioGroup/RadioButton.js +9 -2
- package/dist/cjs/Fields/RadioGroup/RadioButton.tailwind.js +1 -1
- package/dist/cjs/Fields/RadioGroup/RadioGroupItem.js +1 -1
- package/dist/cjs/Fields/SelectableCard/SelectableCard.d.ts +35 -0
- package/dist/cjs/Fields/SelectableCard/SelectableCard.js +105 -0
- package/dist/cjs/Fields/SelectableCard/SelectableCardContext.d.ts +13 -0
- package/dist/cjs/Fields/SelectableCard/SelectableCardContext.js +15 -0
- package/dist/cjs/Fields/SelectableCard/SelectableCardGroup.d.ts +13 -0
- package/dist/cjs/Fields/SelectableCard/SelectableCardGroup.js +55 -0
- package/dist/cjs/Fields/SelectableCard/index.d.ts +2 -0
- package/dist/cjs/Fields/SelectableCard/index.js +27 -0
- package/dist/cjs/Fields/Switch/Switch.js +1 -1
- package/dist/cjs/Fields/TextAreaAutoSize/TextAreaAutoSize.d.ts +12 -4
- package/dist/cjs/Fields/TextAreaAutoSize/TextAreaAutoSize.styles.d.ts +13 -1
- package/dist/cjs/Fields/index.d.ts +1 -0
- package/dist/cjs/Fields/index.js +11 -0
- package/dist/cjs/Helpers/utilities/focusable.tailwind.js +1 -1
- package/dist/cjs/Layout/index.d.ts +0 -1
- package/dist/cjs/Layout/index.js +0 -11
- package/dist/cjs/Satellite/locale.d.ts +3 -3
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +12 -0
- package/dist/cjs/styles/helpers/tv.d.ts +5 -1
- package/dist/cjs/utils/isCssPropertySupported.d.ts +1 -1
- package/dist/esm/Chat/ChatContextAccordion/ChatContextAccordion.d.ts +23 -0
- package/dist/esm/{Layout/Chat → Chat}/ChatContextAccordion/ChatContextAccordion.js +9 -2
- package/dist/esm/{Layout/Chat → Chat}/ChatContextAccordion/ChatContextAccordion.styles.d.ts +23 -4
- package/dist/esm/{Layout/Chat → Chat}/ChatContextAccordion/ChatContextAccordion.styles.js +3 -3
- package/dist/esm/{Layout/Chat → Chat}/ChatMessage/ChatMessage.d.ts +80 -3
- package/dist/esm/{Layout/Chat → Chat}/ChatMessage/ChatMessage.js +14 -5
- package/dist/{cjs/Layout/Chat/ChatMessageError/ChatMessageError.styles.d.ts → esm/Chat/ChatMessage/ChatMessage.styles.d.ts} +34 -40
- package/dist/esm/{Layout/Chat → Chat}/ChatMessage/ChatMessage.styles.js +12 -12
- package/dist/{cjs/Layout → esm}/Chat/ChatMessageError/ChatMessageError.d.ts +7 -2
- package/dist/esm/{Layout/Chat → Chat}/ChatMessageError/ChatMessageError.js +8 -3
- package/dist/esm/Chat/ChatMessageError/ChatMessageError.styles.d.ts +253 -0
- package/dist/esm/{Layout/Chat → Chat}/ChatMessageError/ChatMessageError.styles.js +2 -2
- package/dist/esm/{Layout/Chat → Chat}/ChatMessageLoader/ChatMessageLoader.d.ts +6 -3
- package/dist/esm/{Layout/Chat → Chat}/ChatMessageLoader/ChatMessageLoader.js +9 -4
- package/dist/{cjs/Layout → esm}/Chat/ChatMessageLoader/ChatMessageLoader.styles.d.ts +89 -9
- package/dist/esm/{Layout/Chat → Chat}/ChatMessageLoader/ChatMessageLoader.styles.js +2 -2
- package/dist/esm/Chat/ChatMessages/ChatMessages.d.ts +141 -0
- package/dist/esm/{Layout/Chat → Chat}/ChatMessages/ChatMessages.js +18 -7
- package/dist/esm/{Layout/Chat → Chat}/ChatMessages/ChatMessages.styles.d.ts +27 -1
- package/dist/esm/{Layout/Chat → Chat}/ChatMessages/ChatMessages.styles.js +2 -2
- package/dist/esm/{Layout/Chat → Chat}/ChatMessages/useLastMessageHeight.d.ts +7 -1
- package/dist/esm/{Layout/Chat → Chat}/ChatMessages/useLastMessageHeight.js +6 -0
- package/dist/esm/{Layout/Chat → Chat}/ChatPrompt/ChatPrompt.d.ts +16 -2
- package/dist/esm/{Layout/Chat → Chat}/ChatPrompt/ChatPrompt.js +33 -20
- package/dist/esm/Chat/ChatPrompt/ChatPrompt.styles.d.ts +63 -0
- package/dist/esm/{Layout/Chat → Chat}/ChatPrompt/ChatPrompt.styles.js +10 -3
- package/dist/esm/Chat/ChatPrompt/useFocusTyping.d.ts +30 -0
- package/dist/esm/{Layout/Chat → Chat}/ChatPrompt/useFocusTyping.js +19 -14
- package/dist/esm/{Layout/Chat → Chat}/ChatPrompt/useTypewriter.d.ts +9 -0
- package/dist/esm/{Layout/Chat → Chat}/ChatPrompt/useTypewriter.js +9 -0
- package/dist/esm/Fields/Checkbox/Checkbox.d.ts +2 -2
- package/dist/esm/Fields/Checkbox/Checkbox.js +2 -2
- package/dist/esm/Fields/Dropzone/Dropzone.js +1 -1
- package/dist/esm/Fields/Form/stories/Complex.js +123 -50
- package/dist/esm/Fields/RadioGroup/RadioButton.js +10 -3
- package/dist/esm/Fields/RadioGroup/RadioButton.tailwind.js +1 -1
- package/dist/esm/Fields/RadioGroup/RadioGroupItem.js +1 -1
- package/dist/esm/Fields/SelectableCard/SelectableCard.d.ts +35 -0
- package/dist/esm/Fields/SelectableCard/SelectableCard.js +100 -0
- package/dist/esm/Fields/SelectableCard/SelectableCardContext.d.ts +13 -0
- package/dist/esm/Fields/SelectableCard/SelectableCardContext.js +9 -0
- package/dist/esm/Fields/SelectableCard/SelectableCardGroup.d.ts +13 -0
- package/dist/esm/Fields/SelectableCard/SelectableCardGroup.js +48 -0
- package/dist/esm/Fields/SelectableCard/index.d.ts +2 -0
- package/dist/esm/Fields/SelectableCard/index.js +2 -0
- package/dist/esm/Fields/Switch/Switch.js +1 -1
- package/dist/esm/Fields/TextAreaAutoSize/TextAreaAutoSize.d.ts +12 -4
- package/dist/esm/Fields/TextAreaAutoSize/TextAreaAutoSize.styles.d.ts +13 -1
- package/dist/esm/Fields/index.d.ts +1 -0
- package/dist/esm/Fields/index.js +1 -0
- package/dist/esm/Helpers/utilities/focusable.tailwind.js +1 -1
- package/dist/esm/Layout/index.d.ts +0 -1
- package/dist/esm/Layout/index.js +0 -1
- package/dist/esm/Satellite/locale.d.ts +3 -3
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/styles/helpers/tv.d.ts +5 -1
- package/dist/esm/utils/isCssPropertySupported.d.ts +1 -1
- package/dist/satellite.min.css +1 -1
- package/package.json +3 -3
- package/dist/cjs/Layout/Chat/ChatContextAccordion/ChatContextAccordion.d.ts +0 -8
- package/dist/cjs/Layout/Chat/ChatMessage/ChatMessage.styles.d.ts +0 -100
- package/dist/cjs/Layout/Chat/ChatMessages/ChatMessages.d.ts +0 -44
- package/dist/cjs/Layout/Chat/ChatPrompt/ChatPrompt.styles.d.ts +0 -61
- package/dist/cjs/Layout/Chat/ChatPrompt/useFocusTyping.d.ts +0 -12
- package/dist/esm/Layout/Chat/ChatContextAccordion/ChatContextAccordion.d.ts +0 -8
- package/dist/esm/Layout/Chat/ChatMessage/ChatMessage.styles.d.ts +0 -100
- package/dist/esm/Layout/Chat/ChatMessages/ChatMessages.d.ts +0 -44
- package/dist/esm/Layout/Chat/ChatPrompt/ChatPrompt.styles.d.ts +0 -61
- package/dist/esm/Layout/Chat/ChatPrompt/useFocusTyping.d.ts +0 -12
- /package/dist/cjs/{Layout/Chat → Chat}/ChatContextAccordion/index.d.ts +0 -0
- /package/dist/cjs/{Layout/Chat → Chat}/ChatContextAccordion/index.js +0 -0
- /package/dist/cjs/{Layout/Chat → Chat}/ChatMessage/index.d.ts +0 -0
- /package/dist/cjs/{Layout/Chat → Chat}/ChatMessage/index.js +0 -0
- /package/dist/cjs/{Layout/Chat → Chat}/ChatMessageError/index.d.ts +0 -0
- /package/dist/cjs/{Layout/Chat → Chat}/ChatMessageError/index.js +0 -0
- /package/dist/cjs/{Layout/Chat → Chat}/ChatMessageLoader/index.d.ts +0 -0
- /package/dist/cjs/{Layout/Chat → Chat}/ChatMessageLoader/index.js +0 -0
- /package/dist/cjs/{Layout/Chat → Chat}/ChatMessages/index.d.ts +0 -0
- /package/dist/cjs/{Layout/Chat → Chat}/ChatMessages/index.js +0 -0
- /package/dist/cjs/{Layout/Chat → Chat}/ChatPrompt/index.d.ts +0 -0
- /package/dist/cjs/{Layout/Chat → Chat}/ChatPrompt/index.js +0 -0
- /package/dist/cjs/{Layout/Chat → Chat}/index.d.ts +0 -0
- /package/dist/cjs/{Layout/Chat → Chat}/index.js +0 -0
- /package/dist/cjs/{Layout/Chat → Chat}/types.d.ts +0 -0
- /package/dist/cjs/{Layout/Chat → Chat}/types.js +0 -0
- /package/dist/esm/{Layout/Chat → Chat}/ChatContextAccordion/index.d.ts +0 -0
- /package/dist/esm/{Layout/Chat → Chat}/ChatContextAccordion/index.js +0 -0
- /package/dist/esm/{Layout/Chat → Chat}/ChatMessage/index.d.ts +0 -0
- /package/dist/esm/{Layout/Chat → Chat}/ChatMessage/index.js +0 -0
- /package/dist/esm/{Layout/Chat → Chat}/ChatMessageError/index.d.ts +0 -0
- /package/dist/esm/{Layout/Chat → Chat}/ChatMessageError/index.js +0 -0
- /package/dist/esm/{Layout/Chat → Chat}/ChatMessageLoader/index.d.ts +0 -0
- /package/dist/esm/{Layout/Chat → Chat}/ChatMessageLoader/index.js +0 -0
- /package/dist/esm/{Layout/Chat → Chat}/ChatMessages/index.d.ts +0 -0
- /package/dist/esm/{Layout/Chat → Chat}/ChatMessages/index.js +0 -0
- /package/dist/esm/{Layout/Chat → Chat}/ChatPrompt/index.d.ts +0 -0
- /package/dist/esm/{Layout/Chat → Chat}/ChatPrompt/index.js +0 -0
- /package/dist/esm/{Layout/Chat → Chat}/index.d.ts +0 -0
- /package/dist/esm/{Layout/Chat → Chat}/index.js +0 -0
- /package/dist/esm/{Layout/Chat → Chat}/types.d.ts +0 -0
- /package/dist/esm/{Layout/Chat → Chat}/types.js +0 -0
@@ -1,28 +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", "autoFocusOnTyping", "defaultValue", "value", "locale", "id"];
|
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 { useMemo } from "react";
|
7
8
|
import { useState } from "react";
|
8
9
|
import { useRef } from "react";
|
9
10
|
import { forwardRef } from "react";
|
10
11
|
import { chatPromptStyles } from "./ChatPrompt.styles";
|
11
12
|
import { useFocusOnTyping } from "./useFocusTyping";
|
12
13
|
import { useTypewriter } from "./useTypewriter";
|
13
|
-
import { IconButton } from "
|
14
|
-
import { TextAreaAutoSize } from "
|
15
|
-
import { ArrowUpIcon, StopCircleIcon } from "
|
16
|
-
import { useLocale } from "
|
17
|
-
import { uniqueId } from "
|
18
|
-
import { mergeRefs } from "
|
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";
|
19
20
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
20
21
|
var DEFAULT_CHAT_PROMPT_LOCALE = {
|
21
22
|
textareaLabel: "Type your message...",
|
22
23
|
emptyMessageTooltip: "Message is empty",
|
23
24
|
stopResponseTooltip: "Stop response",
|
24
|
-
sendMessageTooltip: "Send message"
|
25
|
+
sendMessageTooltip: "Send message",
|
26
|
+
disabledTooltip: "Chat prompt is disabled"
|
25
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
|
+
*/
|
26
33
|
export var ChatPrompt = /*#__PURE__*/forwardRef(function (_ref, forwardedRef) {
|
27
34
|
var _ref2;
|
28
35
|
var className = _ref.className,
|
@@ -38,6 +45,8 @@ export var ChatPrompt = /*#__PURE__*/forwardRef(function (_ref, forwardedRef) {
|
|
38
45
|
status = _ref$status === void 0 ? "ready" : _ref$status,
|
39
46
|
_ref$autoFocusOnTypin = _ref.autoFocusOnTyping,
|
40
47
|
autoFocusOnTyping = _ref$autoFocusOnTypin === void 0 ? false : _ref$autoFocusOnTypin,
|
48
|
+
_ref$rtl = _ref.rtl,
|
49
|
+
rtl = _ref$rtl === void 0 ? false : _ref$rtl,
|
41
50
|
defaultValue = _ref.defaultValue,
|
42
51
|
valueProp = _ref.value,
|
43
52
|
propsLocale = _ref.locale,
|
@@ -47,10 +56,14 @@ export var ChatPrompt = /*#__PURE__*/forwardRef(function (_ref, forwardedRef) {
|
|
47
56
|
var locale = _objectSpread(_objectSpread(_objectSpread({}, DEFAULT_CHAT_PROMPT_LOCALE), contextLocale), propsLocale);
|
48
57
|
|
49
58
|
// eslint-disable-next-line @algolia/stl/prefer-stl-helper
|
50
|
-
var generatedId =
|
59
|
+
var generatedId = useMemo(function () {
|
60
|
+
return uniqueId("stl-chat-prompt-");
|
61
|
+
}, []);
|
51
62
|
var textareaId = propId !== null && propId !== void 0 ? propId : generatedId;
|
52
63
|
var internalRef = useRef(null);
|
53
|
-
var styles = chatPromptStyles(
|
64
|
+
var styles = chatPromptStyles({
|
65
|
+
disabled: props.disabled
|
66
|
+
});
|
54
67
|
var _useState = useState(defaultValue !== null && defaultValue !== void 0 ? defaultValue : ""),
|
55
68
|
_useState2 = _slicedToArray(_useState, 2),
|
56
69
|
internalValue = _useState2[0],
|
@@ -68,7 +81,11 @@ export var ChatPrompt = /*#__PURE__*/forwardRef(function (_ref, forwardedRef) {
|
|
68
81
|
});
|
69
82
|
var submit = function submit(e) {
|
70
83
|
e.preventDefault();
|
71
|
-
if (
|
84
|
+
if (canStop) {
|
85
|
+
onStop === null || onStop === void 0 || onStop();
|
86
|
+
return;
|
87
|
+
}
|
88
|
+
if (!hasValue) {
|
72
89
|
return;
|
73
90
|
}
|
74
91
|
onSubmit === null || onSubmit === void 0 || onSubmit(e);
|
@@ -76,6 +93,7 @@ export var ChatPrompt = /*#__PURE__*/forwardRef(function (_ref, forwardedRef) {
|
|
76
93
|
return /*#__PURE__*/_jsxs("form", {
|
77
94
|
className: styles.base(),
|
78
95
|
onSubmit: submit,
|
96
|
+
dir: rtl ? "rtl" : "ltr",
|
79
97
|
children: [!!renderHeader && /*#__PURE__*/_jsx("div", {
|
80
98
|
className: styles.header(),
|
81
99
|
children: renderHeader
|
@@ -120,20 +138,15 @@ export var ChatPrompt = /*#__PURE__*/forwardRef(function (_ref, forwardedRef) {
|
|
120
138
|
children: /*#__PURE__*/_jsx("div", {
|
121
139
|
className: styles.actions(),
|
122
140
|
children: /*#__PURE__*/_jsx(IconButton, {
|
123
|
-
type:
|
124
|
-
onClick: function onClick(e) {
|
125
|
-
if (canStop) {
|
126
|
-
e.preventDefault();
|
127
|
-
onStop === null || onStop === void 0 || onStop();
|
128
|
-
}
|
129
|
-
},
|
141
|
+
type: "submit",
|
130
142
|
icon: canStop ? StopCircleIcon : ArrowUpIcon,
|
131
143
|
variant: canStop ? "neutral" : "primary",
|
132
144
|
size: "small",
|
133
|
-
title: buttonDisabled ? locale.emptyMessageTooltip : canStop ? locale.stopResponseTooltip : locale.sendMessageTooltip,
|
145
|
+
title: props.disabled ? locale.disabledTooltip : buttonDisabled ? locale.emptyMessageTooltip : canStop ? locale.stopResponseTooltip : locale.sendMessageTooltip,
|
134
146
|
tooltipSide: "top",
|
135
147
|
disabled: buttonDisabled,
|
136
|
-
className: styles.submit()
|
148
|
+
className: styles.submit(),
|
149
|
+
"data-status": status
|
137
150
|
})
|
138
151
|
})
|
139
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,7 +1,7 @@
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
2
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
|
3
|
-
import stl from "
|
4
|
-
import { tv } from "
|
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"]))),
|
@@ -11,5 +11,12 @@ export var chatPromptStyles = tv({
|
|
11
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 {};
|
@@ -1,33 +1,37 @@
|
|
1
1
|
import { useCallback, useEffect } from "react";
|
2
|
-
|
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) {
|
3
9
|
if (el.isContentEditable) return true;
|
4
10
|
var tag = el.tagName.toUpperCase();
|
5
11
|
if (tag === "TEXTAREA") return true;
|
6
12
|
if (tag === "INPUT") {
|
7
|
-
|
8
|
-
var t = (el.type || "text").toLowerCase();
|
13
|
+
var t = el.type.toLowerCase();
|
9
14
|
return ["text", "search", "url", "email", "tel", "password", "number", "date", "datetime-local", "month", "week", "time"].includes(t);
|
10
15
|
}
|
11
16
|
return false;
|
12
17
|
};
|
13
|
-
var shouldFocusEditable = function shouldFocusEditable(target) {
|
14
|
-
var el = target;
|
15
|
-
if (!el) return true;
|
16
|
-
return !isTextualElement(el);
|
17
|
-
};
|
18
18
|
|
19
19
|
// e.g. <div contentEditable>
|
20
20
|
|
21
21
|
/**
|
22
22
|
* Focus `editableRef` the moment the user types anywhere on the page,
|
23
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.
|
24
28
|
*/
|
25
29
|
export function useFocusOnTyping(editableRef) {
|
26
|
-
var
|
27
|
-
|
28
|
-
enabled =
|
29
|
-
|
30
|
-
strictChars =
|
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;
|
31
35
|
var handleKeyDown = useCallback(function (e) {
|
32
36
|
if (!enabled || e.ctrlKey || e.altKey || e.metaKey || e.isComposing || e.repeat || (
|
33
37
|
// Printable-character test
|
@@ -37,7 +41,8 @@ export function useFocusOnTyping(editableRef) {
|
|
37
41
|
var node = editableRef.current;
|
38
42
|
if (!node) return;
|
39
43
|
if (node.contains(document.activeElement)) return;
|
40
|
-
|
44
|
+
var el = e.target;
|
45
|
+
if (!el || !isTextualElement(el)) {
|
41
46
|
node.focus();
|
42
47
|
}
|
43
48
|
}, [enabled, strictChars, editableRef]);
|
@@ -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
|
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")) {
|