cherry-styled-components 0.2.11 → 0.2.13
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/README.md +89 -28
- package/dist/avatar-dropzone.js +8 -8
- package/dist/avatar.d.ts +17 -0
- package/dist/avatar.js +68 -0
- package/dist/button.js +15 -12
- package/dist/callout.d.ts +13 -0
- package/dist/callout.js +121 -0
- package/dist/chat-input.d.ts +18 -0
- package/dist/chat-input.js +257 -0
- package/dist/chat-launcher.d.ts +10 -0
- package/dist/chat-launcher.js +78 -0
- package/dist/chat-message-list.d.ts +12 -0
- package/dist/chat-message-list.js +88 -0
- package/dist/chat-message.d.ts +16 -0
- package/dist/chat-message.js +56 -0
- package/dist/chat-panel.d.ts +25 -0
- package/dist/chat-panel.js +163 -0
- package/dist/chat-provider.d.ts +86 -0
- package/dist/chat-provider.js +295 -0
- package/dist/chat-showcase.d.ts +18 -0
- package/dist/chat-showcase.js +234 -0
- package/dist/chat-sources.d.ts +10 -0
- package/dist/chat-sources.js +41 -0
- package/dist/chat-typing.d.ts +7 -0
- package/dist/chat-typing.js +44 -0
- package/dist/dropzone.js +14 -14
- package/dist/icon-button.js +7 -7
- package/dist/index.d.ts +13 -0
- package/dist/index.js +18 -3
- package/dist/input.js +6 -6
- package/dist/modal.js +6 -6
- package/dist/prose.d.ts +17 -0
- package/dist/prose.js +75 -0
- package/dist/spinner.d.ts +11 -0
- package/dist/spinner.js +21 -0
- package/dist/styled-components/client-theme-provider.js +13 -3
- package/dist/tabs.js +6 -7
- package/dist/theme-toggle.js +5 -5
- package/dist/toast.d.ts +2 -2
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/mixins.d.ts +30 -0
- package/dist/utils/mixins.js +24 -3
- package/dist/utils/use-lock-body-scroll.d.ts +5 -0
- package/dist/utils/use-lock-body-scroll.js +25 -0
- package/dist/utils/use-media-query.d.ts +14 -0
- package/dist/utils/use-media-query.js +28 -0
- package/package.json +15 -14
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
import { Avatar } from "./avatar.js";
|
|
4
|
+
import { Callout } from "./callout.js";
|
|
5
|
+
import { ChatSource, ChatSources } from "./chat-sources.js";
|
|
6
|
+
import { ChatTyping } from "./chat-typing.js";
|
|
7
|
+
import { Prose } from "./prose.js";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
import React from "react";
|
|
10
|
+
import styled from "styled-components";
|
|
11
|
+
//#region src/lib/chat-showcase.tsx
|
|
12
|
+
var StyledStack = styled.div.withConfig({
|
|
13
|
+
displayName: "chat-showcase__StyledStack",
|
|
14
|
+
componentId: "sc-37301b14-0"
|
|
15
|
+
})([`display:flex;flex-direction:column;gap:12px;width:100%;`]);
|
|
16
|
+
var StyledRow = styled.div.withConfig({
|
|
17
|
+
displayName: "chat-showcase__StyledRow",
|
|
18
|
+
componentId: "sc-37301b14-1"
|
|
19
|
+
})([`display:flex;align-items:center;gap:12px;flex-wrap:wrap;`]);
|
|
20
|
+
var CATALOG = [
|
|
21
|
+
{
|
|
22
|
+
group: "Form",
|
|
23
|
+
components: [
|
|
24
|
+
"Button",
|
|
25
|
+
"IconButton",
|
|
26
|
+
"Input (Checkbox / Radio via type)",
|
|
27
|
+
"Select",
|
|
28
|
+
"Textarea",
|
|
29
|
+
"Toggle",
|
|
30
|
+
"Range",
|
|
31
|
+
"Password",
|
|
32
|
+
"Dropzone",
|
|
33
|
+
"AvatarDropzone"
|
|
34
|
+
]
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
group: "Layout",
|
|
38
|
+
components: [
|
|
39
|
+
"Container",
|
|
40
|
+
"Grid",
|
|
41
|
+
"Col",
|
|
42
|
+
"Flex",
|
|
43
|
+
"Box",
|
|
44
|
+
"MaxWidth",
|
|
45
|
+
"Space"
|
|
46
|
+
]
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
group: "Interactive",
|
|
50
|
+
components: [
|
|
51
|
+
"Accordion",
|
|
52
|
+
"Tabs",
|
|
53
|
+
"Modal",
|
|
54
|
+
"Toast",
|
|
55
|
+
"ThemeToggle",
|
|
56
|
+
"Icon"
|
|
57
|
+
]
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
group: "Content",
|
|
61
|
+
components: [
|
|
62
|
+
"Prose",
|
|
63
|
+
"Callout",
|
|
64
|
+
"Avatar"
|
|
65
|
+
]
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
group: "Chat",
|
|
69
|
+
components: [
|
|
70
|
+
"ChatProvider",
|
|
71
|
+
"ChatPanel",
|
|
72
|
+
"ChatMessageList",
|
|
73
|
+
"ChatMessage",
|
|
74
|
+
"ChatInput",
|
|
75
|
+
"ChatLauncher",
|
|
76
|
+
"ChatTyping",
|
|
77
|
+
"ChatSources"
|
|
78
|
+
]
|
|
79
|
+
}
|
|
80
|
+
];
|
|
81
|
+
function HelpReply() {
|
|
82
|
+
return /*#__PURE__*/ jsxs(Prose, {
|
|
83
|
+
$compact: true,
|
|
84
|
+
children: [/*#__PURE__*/ jsx("p", { children: "Here is what I can render:" }), /*#__PURE__*/ jsx("ul", { children: showcaseCommands.map((command) => /*#__PURE__*/ jsxs("li", { children: [
|
|
85
|
+
/*#__PURE__*/ jsx("code", { children: command.name }),
|
|
86
|
+
" — ",
|
|
87
|
+
command.description
|
|
88
|
+
] }, command.name)) })]
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
function ListReply() {
|
|
92
|
+
return /*#__PURE__*/ jsxs(Prose, {
|
|
93
|
+
$compact: true,
|
|
94
|
+
children: [/*#__PURE__*/ jsx("p", { children: "The Cherry component catalog:" }), CATALOG.map(({ group, components }) => /*#__PURE__*/ jsxs(React.Fragment, { children: [/*#__PURE__*/ jsx("h6", { children: group }), /*#__PURE__*/ jsx("ul", { children: components.map((component) => /*#__PURE__*/ jsx("li", { children: component }, component)) })] }, group))]
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
function CalloutReply() {
|
|
98
|
+
return /*#__PURE__*/ jsxs(StyledStack, { children: [
|
|
99
|
+
/*#__PURE__*/ jsx(Callout, {
|
|
100
|
+
$type: "note",
|
|
101
|
+
children: /*#__PURE__*/ jsx("p", { children: "A note callout for supplementary details." })
|
|
102
|
+
}),
|
|
103
|
+
/*#__PURE__*/ jsx(Callout, {
|
|
104
|
+
$type: "info",
|
|
105
|
+
children: /*#__PURE__*/ jsx("p", { children: "An info callout for neutral information." })
|
|
106
|
+
}),
|
|
107
|
+
/*#__PURE__*/ jsx(Callout, {
|
|
108
|
+
$type: "warning",
|
|
109
|
+
children: /*#__PURE__*/ jsx("p", { children: "A warning callout for things to watch out for." })
|
|
110
|
+
}),
|
|
111
|
+
/*#__PURE__*/ jsx(Callout, {
|
|
112
|
+
$type: "danger",
|
|
113
|
+
children: /*#__PURE__*/ jsx("p", { children: "A danger callout for destructive outcomes." })
|
|
114
|
+
}),
|
|
115
|
+
/*#__PURE__*/ jsx(Callout, {
|
|
116
|
+
$type: "success",
|
|
117
|
+
children: /*#__PURE__*/ jsx("p", { children: "A success callout for confirmations." })
|
|
118
|
+
})
|
|
119
|
+
] });
|
|
120
|
+
}
|
|
121
|
+
function AvatarReply() {
|
|
122
|
+
return /*#__PURE__*/ jsxs(StyledRow, { children: [
|
|
123
|
+
/*#__PURE__*/ jsx(Avatar, {
|
|
124
|
+
$size: "small",
|
|
125
|
+
$name: "Ada Lovelace"
|
|
126
|
+
}),
|
|
127
|
+
/*#__PURE__*/ jsx(Avatar, {
|
|
128
|
+
$name: "Cherry",
|
|
129
|
+
$color: "secondary"
|
|
130
|
+
}),
|
|
131
|
+
/*#__PURE__*/ jsx(Avatar, {
|
|
132
|
+
$size: "big",
|
|
133
|
+
$color: "tertiary",
|
|
134
|
+
$alt: "Assistant"
|
|
135
|
+
})
|
|
136
|
+
] });
|
|
137
|
+
}
|
|
138
|
+
function ProseReply() {
|
|
139
|
+
return /*#__PURE__*/ jsxs(Prose, {
|
|
140
|
+
$compact: true,
|
|
141
|
+
children: [
|
|
142
|
+
/*#__PURE__*/ jsx("h5", { children: "Rendered markdown" }),
|
|
143
|
+
/*#__PURE__*/ jsxs("p", { children: [
|
|
144
|
+
"Prose styles ",
|
|
145
|
+
/*#__PURE__*/ jsx("a", {
|
|
146
|
+
href: "#",
|
|
147
|
+
children: "links"
|
|
148
|
+
}),
|
|
149
|
+
", lists, tables and",
|
|
150
|
+
" ",
|
|
151
|
+
/*#__PURE__*/ jsx("code", { children: "inline code" }),
|
|
152
|
+
" with Cherry typography."
|
|
153
|
+
] }),
|
|
154
|
+
/*#__PURE__*/ jsxs("ul", { children: [/*#__PURE__*/ jsx("li", { children: "First item" }), /*#__PURE__*/ jsx("li", { children: "Second item" })] }),
|
|
155
|
+
/*#__PURE__*/ jsx("div", {
|
|
156
|
+
className: "table-wrapper",
|
|
157
|
+
children: /*#__PURE__*/ jsxs("table", { children: [/*#__PURE__*/ jsx("thead", { children: /*#__PURE__*/ jsxs("tr", { children: [/*#__PURE__*/ jsx("th", { children: "Prop" }), /*#__PURE__*/ jsx("th", { children: "Default" })] }) }), /*#__PURE__*/ jsx("tbody", { children: /*#__PURE__*/ jsxs("tr", { children: [/*#__PURE__*/ jsx("td", { children: "$compact" }), /*#__PURE__*/ jsx("td", { children: "false" })] }) })] })
|
|
158
|
+
})
|
|
159
|
+
]
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
function SourcesReply() {
|
|
163
|
+
return /*#__PURE__*/ jsxs(StyledStack, { children: [/*#__PURE__*/ jsx(Prose, {
|
|
164
|
+
$compact: true,
|
|
165
|
+
children: /*#__PURE__*/ jsx("p", { children: "Source chips link an answer back to where it came from:" })
|
|
166
|
+
}), /*#__PURE__*/ jsxs(ChatSources, { children: [
|
|
167
|
+
/*#__PURE__*/ jsx(ChatSource, {
|
|
168
|
+
href: "#",
|
|
169
|
+
children: "Getting Started"
|
|
170
|
+
}),
|
|
171
|
+
/*#__PURE__*/ jsx(ChatSource, {
|
|
172
|
+
href: "#",
|
|
173
|
+
children: "Theming"
|
|
174
|
+
}),
|
|
175
|
+
/*#__PURE__*/ jsx(ChatSource, {
|
|
176
|
+
href: "#",
|
|
177
|
+
children: "Chat Kit"
|
|
178
|
+
})
|
|
179
|
+
] })] });
|
|
180
|
+
}
|
|
181
|
+
function TypingReply() {
|
|
182
|
+
return /*#__PURE__*/ jsxs(StyledStack, { children: [/*#__PURE__*/ jsx(Prose, {
|
|
183
|
+
$compact: true,
|
|
184
|
+
children: /*#__PURE__*/ jsx("p", { children: "The typing indicator shown while a reply is on its way:" })
|
|
185
|
+
}), /*#__PURE__*/ jsx(ChatTyping, {})] });
|
|
186
|
+
}
|
|
187
|
+
var showcaseCommands = [
|
|
188
|
+
{
|
|
189
|
+
name: "help",
|
|
190
|
+
description: "list these commands",
|
|
191
|
+
render: () => /*#__PURE__*/ jsx(HelpReply, {})
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
name: "list",
|
|
195
|
+
description: "the full Cherry component catalog",
|
|
196
|
+
render: () => /*#__PURE__*/ jsx(ListReply, {})
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
name: "callout",
|
|
200
|
+
description: "the five callout intents",
|
|
201
|
+
render: () => /*#__PURE__*/ jsx(CalloutReply, {})
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
name: "avatar",
|
|
205
|
+
description: "avatars with initials and icon fallbacks",
|
|
206
|
+
render: () => /*#__PURE__*/ jsx(AvatarReply, {})
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
name: "prose",
|
|
210
|
+
description: "markdown-style content with Cherry typography",
|
|
211
|
+
render: () => /*#__PURE__*/ jsx(ProseReply, {})
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
name: "sources",
|
|
215
|
+
description: "the source-chip row",
|
|
216
|
+
render: () => /*#__PURE__*/ jsx(SourcesReply, {})
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
name: "typing",
|
|
220
|
+
description: "the three-dot typing indicator",
|
|
221
|
+
render: () => /*#__PURE__*/ jsx(TypingReply, {})
|
|
222
|
+
}
|
|
223
|
+
];
|
|
224
|
+
/**
|
|
225
|
+
* Matches a chat question against the showcase commands ("help", "/help" and
|
|
226
|
+
* any casing all work) and returns the rendered demo, or null when the input
|
|
227
|
+
* is not a command and should go to the transport.
|
|
228
|
+
*/ function resolveShowcaseCommand(input) {
|
|
229
|
+
const name = input.trim().toLowerCase().replace(/^\//, "");
|
|
230
|
+
const command = showcaseCommands.find((entry) => entry.name === name);
|
|
231
|
+
return command ? command.render() : null;
|
|
232
|
+
}
|
|
233
|
+
//#endregion
|
|
234
|
+
export { resolveShowcaseCommand, showcaseCommands };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface ChatSourcesProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
}
|
|
5
|
+
export interface ChatSourceProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
declare const ChatSources: React.ForwardRefExoticComponent<ChatSourcesProps & React.RefAttributes<HTMLDivElement>>;
|
|
9
|
+
declare const ChatSource: React.ForwardRefExoticComponent<ChatSourceProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
10
|
+
export { ChatSource, ChatSources };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
import { alpha, interactiveStyles } from "./utils/mixins.js";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { forwardRef } from "react";
|
|
6
|
+
import styled from "styled-components";
|
|
7
|
+
//#region src/lib/chat-sources.tsx
|
|
8
|
+
var StyledChatSources = styled.div.withConfig({
|
|
9
|
+
displayName: "chat-sources__StyledChatSources",
|
|
10
|
+
componentId: "sc-7fa69b52-0"
|
|
11
|
+
})([`display:flex;gap:16px;flex-wrap:wrap;`]);
|
|
12
|
+
var StyledChatSource = styled.a.withConfig({
|
|
13
|
+
displayName: "chat-sources__StyledChatSource",
|
|
14
|
+
componentId: "sc-7fa69b52-1"
|
|
15
|
+
})([
|
|
16
|
+
`position:relative;text-decoration:none;font-size:`,
|
|
17
|
+
`;line-height:1;color:`,
|
|
18
|
+
`;display:flex;align-items:center;gap:6px;transition:all 0.3s ease;font-weight:600;white-space:nowrap;min-width:fit-content;background:`,
|
|
19
|
+
`;padding:6px 8px;border-radius:`,
|
|
20
|
+
`;`,
|
|
21
|
+
`;& svg{width:14px;height:14px;flex-shrink:0;}&:hover{color:`,
|
|
22
|
+
`;}`
|
|
23
|
+
], ({ theme }) => theme.fontSizes.small.lg, ({ theme }) => theme.colors.primary, ({ theme }) => alpha(theme.colors.primaryLight, 10), ({ theme }) => theme.spacing.radius.xs, interactiveStyles, ({ theme }) => theme.isDark ? theme.colors.primaryLight : theme.colors.primaryDark);
|
|
24
|
+
function LocalChatSources({ children, ...props }, ref) {
|
|
25
|
+
return /*#__PURE__*/ jsx(StyledChatSources, {
|
|
26
|
+
...props,
|
|
27
|
+
ref,
|
|
28
|
+
children
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
function LocalChatSource({ children, ...props }, ref) {
|
|
32
|
+
return /*#__PURE__*/ jsx(StyledChatSource, {
|
|
33
|
+
...props,
|
|
34
|
+
ref,
|
|
35
|
+
children
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
var ChatSources = /*#__PURE__*/ forwardRef(LocalChatSources);
|
|
39
|
+
var ChatSource = /*#__PURE__*/ forwardRef(LocalChatSource);
|
|
40
|
+
//#endregion
|
|
41
|
+
export { ChatSource, ChatSources };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface ChatTypingProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
/** The label before the dots. */
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
}
|
|
6
|
+
declare const ChatTyping: React.ForwardRefExoticComponent<ChatTypingProps & React.RefAttributes<HTMLDivElement>>;
|
|
7
|
+
export { ChatTyping };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
import { chatTextStyles } from "./chat-message.js";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { forwardRef } from "react";
|
|
6
|
+
import styled, { keyframes } from "styled-components";
|
|
7
|
+
//#region src/lib/chat-typing.tsx
|
|
8
|
+
var dotFade = keyframes([`0%{opacity:0;}50%{opacity:1;}100%{opacity:0;}`]);
|
|
9
|
+
var StyledChatTyping = styled.div.withConfig({
|
|
10
|
+
displayName: "chat-typing__StyledChatTyping",
|
|
11
|
+
componentId: "sc-ef02cd3b-0"
|
|
12
|
+
})([
|
|
13
|
+
`width:100%;font-weight:600;color:`,
|
|
14
|
+
`;`,
|
|
15
|
+
`;& .chat-typing-dot{animation:`,
|
|
16
|
+
` 1s ease infinite;&:nth-child(2){animation-delay:0.2s;}&:nth-child(3){animation-delay:0.4s;}}@media (prefers-reduced-motion:reduce){& .chat-typing-dot{animation:none;}}`
|
|
17
|
+
], ({ theme }) => theme.colors.dark, ({ theme }) => chatTextStyles(theme), dotFade);
|
|
18
|
+
function LocalChatTyping({ children = "Answering", ...props }, ref) {
|
|
19
|
+
return /*#__PURE__*/ jsxs(StyledChatTyping, {
|
|
20
|
+
role: "status",
|
|
21
|
+
...props,
|
|
22
|
+
ref,
|
|
23
|
+
children: [children, /*#__PURE__*/ jsxs("span", {
|
|
24
|
+
"aria-hidden": "true",
|
|
25
|
+
children: [
|
|
26
|
+
/*#__PURE__*/ jsx("span", {
|
|
27
|
+
className: "chat-typing-dot",
|
|
28
|
+
children: "."
|
|
29
|
+
}),
|
|
30
|
+
/*#__PURE__*/ jsx("span", {
|
|
31
|
+
className: "chat-typing-dot",
|
|
32
|
+
children: "."
|
|
33
|
+
}),
|
|
34
|
+
/*#__PURE__*/ jsx("span", {
|
|
35
|
+
className: "chat-typing-dot",
|
|
36
|
+
children: "."
|
|
37
|
+
})
|
|
38
|
+
]
|
|
39
|
+
})]
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
var ChatTyping = /*#__PURE__*/ forwardRef(LocalChatTyping);
|
|
43
|
+
//#endregion
|
|
44
|
+
export { ChatTyping };
|
package/dist/dropzone.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use client";
|
|
3
3
|
import { mq } from "./utils/theme.js";
|
|
4
|
-
import { resetButton } from "./utils/mixins.js";
|
|
4
|
+
import { alpha, resetButton } from "./utils/mixins.js";
|
|
5
5
|
import { Icon } from "./icon.js";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import { forwardRef, useEffect, useImperativeHandle, useRef, useState } from "react";
|
|
8
8
|
import styled, { css } from "styled-components";
|
|
9
|
-
import { rgba } from "polished";
|
|
10
9
|
//#region src/lib/dropzone.tsx
|
|
11
10
|
/** Matches a file against an `accept` string (".pdf,image/*,text/plain"),
|
|
12
11
|
mirroring the native file-picker filter for dropped files. */ var matchesAccept = (file, accept) => {
|
|
@@ -155,11 +154,11 @@ function LocalDropzone({ $prompt = "Drag & drop files here", $browse, $hint, $ic
|
|
|
155
154
|
var Dropzone = /*#__PURE__*/ forwardRef(LocalDropzone);
|
|
156
155
|
var StyledDropzoneWrapper = styled.div.withConfig({
|
|
157
156
|
displayName: "dropzone__StyledDropzoneWrapper",
|
|
158
|
-
componentId: "sc-
|
|
157
|
+
componentId: "sc-a5a0875f-0"
|
|
159
158
|
})([`display:flex;flex-direction:column;gap:12px;width:100%;`]);
|
|
160
159
|
var StyledDropzone = styled.button.withConfig({
|
|
161
160
|
displayName: "dropzone__StyledDropzone",
|
|
162
|
-
componentId: "sc-
|
|
161
|
+
componentId: "sc-a5a0875f-1"
|
|
163
162
|
})([
|
|
164
163
|
``,
|
|
165
164
|
`;font-family:inherit;display:flex;flex-direction:`,
|
|
@@ -179,11 +178,12 @@ var StyledDropzone = styled.button.withConfig({
|
|
|
179
178
|
], resetButton, ({ $inline }) => $inline ? "row" : "column", ({ $inline }) => $inline ? "10px" : "8px", ({ $inline }) => $inline ? "10px 14px" : "24px 20px", ({ theme }) => theme.spacing.radius.lg, ({ theme }) => theme.colors.grayLight, ({ theme, $inline }) => $inline ? "transparent" : theme.colors.light, ({ theme }) => theme.colors.grayDark, ({ $inline }) => $inline ? "left" : "center", ({ theme, $dragOver }) => $dragOver && css([
|
|
180
179
|
`border-color:`,
|
|
181
180
|
`;background:`,
|
|
182
|
-
|
|
183
|
-
|
|
181
|
+
`;:root.dark &{background:`,
|
|
182
|
+
`;}`
|
|
183
|
+
], theme.colors.primary, alpha(theme.colors.primary, theme.isDark ? 12 : 5), alpha(theme.colors.primary, 12)), ({ theme }) => theme.colors.primary, ({ theme }) => alpha(theme.colors.primary, theme.isDark ? 10 : 4), ({ theme }) => theme.colors.primary, ({ theme }) => theme.colors.primaryLight);
|
|
184
184
|
var StyledDropIcon = styled.span.withConfig({
|
|
185
185
|
displayName: "dropzone__StyledDropIcon",
|
|
186
|
-
componentId: "sc-
|
|
186
|
+
componentId: "sc-a5a0875f-2"
|
|
187
187
|
})([
|
|
188
188
|
`display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:`,
|
|
189
189
|
`;height:`,
|
|
@@ -197,7 +197,7 @@ var StyledDropIcon = styled.span.withConfig({
|
|
|
197
197
|
], ({ $inline }) => $inline ? "32px" : "44px", ({ $inline }) => $inline ? "32px" : "44px", ({ theme }) => theme.spacing.radius.lg, ({ theme }) => theme.colors.grayLight, ({ theme }) => theme.colors.grayLight, ({ theme }) => theme.colors.primary, ({ $inline }) => $inline ? "18px" : "22px", ({ $inline }) => $inline ? "18px" : "22px");
|
|
198
198
|
var StyledDropPrompt = styled.span.withConfig({
|
|
199
199
|
displayName: "dropzone__StyledDropPrompt",
|
|
200
|
-
componentId: "sc-
|
|
200
|
+
componentId: "sc-a5a0875f-3"
|
|
201
201
|
})([
|
|
202
202
|
`display:flex;flex-direction:`,
|
|
203
203
|
`;flex-wrap:wrap;align-items:baseline;gap:`,
|
|
@@ -209,7 +209,7 @@ var StyledDropPrompt = styled.span.withConfig({
|
|
|
209
209
|
], ({ $inline }) => $inline ? "row" : "column", ({ $inline }) => $inline ? "0 6px" : "2px", ({ theme }) => theme.fontSizes.text.xs, ({ theme }) => theme.lineHeights.text.xs, ({ theme }) => theme.colors.dark, ({ theme }) => theme.colors.grayDark);
|
|
210
210
|
var StyledDropHint = styled.span.withConfig({
|
|
211
211
|
displayName: "dropzone__StyledDropHint",
|
|
212
|
-
componentId: "sc-
|
|
212
|
+
componentId: "sc-a5a0875f-4"
|
|
213
213
|
})([
|
|
214
214
|
`font-family:inherit;font-size:`,
|
|
215
215
|
`;line-height:`,
|
|
@@ -219,11 +219,11 @@ var StyledDropHint = styled.span.withConfig({
|
|
|
219
219
|
], ({ theme }) => theme.fontSizes.small.xs, ({ theme }) => theme.lineHeights.small.xs, ({ theme }) => theme.colors.gray, ({ $inline }) => $inline && css([`margin-left:auto;`]));
|
|
220
220
|
var StyledThumbs = styled.div.withConfig({
|
|
221
221
|
displayName: "dropzone__StyledThumbs",
|
|
222
|
-
componentId: "sc-
|
|
222
|
+
componentId: "sc-a5a0875f-5"
|
|
223
223
|
})([`display:grid;grid-template-columns:repeat(auto-fill,72px);gap:10px;`, `{grid-template-columns:repeat(auto-fill,84px);}`], mq("sm"));
|
|
224
224
|
var StyledThumb = styled.div.withConfig({
|
|
225
225
|
displayName: "dropzone__StyledThumb",
|
|
226
|
-
componentId: "sc-
|
|
226
|
+
componentId: "sc-a5a0875f-6"
|
|
227
227
|
})([
|
|
228
228
|
`position:relative;width:72px;height:72px;border-radius:`,
|
|
229
229
|
`;overflow:hidden;border:solid 1px `,
|
|
@@ -233,7 +233,7 @@ var StyledThumb = styled.div.withConfig({
|
|
|
233
233
|
], ({ theme }) => theme.spacing.radius.lg, ({ theme }) => theme.colors.grayLight, ({ theme }) => theme.colors.light, mq("sm"));
|
|
234
234
|
var StyledThumbFile = styled.span.withConfig({
|
|
235
235
|
displayName: "dropzone__StyledThumbFile",
|
|
236
|
-
componentId: "sc-
|
|
236
|
+
componentId: "sc-a5a0875f-7"
|
|
237
237
|
})([
|
|
238
238
|
`display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;width:100%;height:100%;padding:6px;color:`,
|
|
239
239
|
`;& svg{width:20px;height:20px;color:`,
|
|
@@ -241,12 +241,12 @@ var StyledThumbFile = styled.span.withConfig({
|
|
|
241
241
|
], ({ theme }) => theme.colors.grayDark, ({ theme }) => theme.colors.primary);
|
|
242
242
|
var StyledThumbRemove = styled.button.withConfig({
|
|
243
243
|
displayName: "dropzone__StyledThumbRemove",
|
|
244
|
-
componentId: "sc-
|
|
244
|
+
componentId: "sc-a5a0875f-8"
|
|
245
245
|
})([
|
|
246
246
|
``,
|
|
247
247
|
`;position:absolute;top:4px;right:4px;display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px;border-radius:50%;color:#ffffff;background:`,
|
|
248
248
|
`;transition:background 0.3s ease;& svg{width:14px;height:14px;}&:hover:not(:disabled){background:`,
|
|
249
249
|
`;}&:disabled{cursor:not-allowed;opacity:0.6;}`
|
|
250
|
-
], resetButton, ({ theme }) =>
|
|
250
|
+
], resetButton, ({ theme }) => alpha(theme.colors.dark, 60), ({ theme }) => theme.colors.error);
|
|
251
251
|
//#endregion
|
|
252
252
|
export { Dropzone, matchesAccept };
|
package/dist/icon-button.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use client";
|
|
3
|
-
import { resetButton } from "./utils/mixins.js";
|
|
3
|
+
import { alpha, resetButton, shade, tint } from "./utils/mixins.js";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
import { forwardRef } from "react";
|
|
6
6
|
import styled, { css } from "styled-components";
|
|
7
|
-
import { darken, lighten, rgba } from "polished";
|
|
8
7
|
//#region src/lib/icon-button.tsx
|
|
9
8
|
var iconButtonSizes = {
|
|
10
9
|
small: {
|
|
@@ -36,14 +35,14 @@ var iconButtonStyles = (theme, $size, $error, disabled, $active) => {
|
|
|
36
35
|
` `,
|
|
37
36
|
` `,
|
|
38
37
|
``
|
|
39
|
-
], resetButton, box, box, theme.colors.light, theme.colors.grayLight, $error ? theme.colors.error : theme.colors.grayDark, $error ?
|
|
38
|
+
], resetButton, box, box, theme.colors.light, theme.colors.grayLight, $error ? theme.colors.error : theme.colors.grayDark, $error ? tint(theme.colors.error, 10) : theme.colors.primaryLight, icon, icon, !disabled && ($error ? css([
|
|
40
39
|
`border-color:`,
|
|
41
40
|
`;&:hover{border-color:`,
|
|
42
41
|
`;color:`,
|
|
43
42
|
`;}&:focus{box-shadow:0 0 0 4px `,
|
|
44
43
|
`;}&:active{box-shadow:0 0 0 2px `,
|
|
45
44
|
`;}`
|
|
46
|
-
], theme.colors.error,
|
|
45
|
+
], theme.colors.error, shade(theme.colors.error, 10), shade(theme.colors.error, 10), tint(theme.colors.error, 10), tint(theme.colors.error, 10)) : css([
|
|
47
46
|
`&:hover{border-color:`,
|
|
48
47
|
`;color:`,
|
|
49
48
|
`;}&:focus{box-shadow:0 0 0 4px `,
|
|
@@ -54,8 +53,9 @@ var iconButtonStyles = (theme, $size, $error, disabled, $active) => {
|
|
|
54
53
|
`border-color:`,
|
|
55
54
|
`;background:`,
|
|
56
55
|
`;color:`,
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
`;:root.dark &{background:`,
|
|
57
|
+
`;}`
|
|
58
|
+
], theme.colors.primary, alpha(theme.colors.primary, theme.isDark ? 18 : 10), theme.colors.primary, alpha(theme.colors.primary, 18)), disabled && css([
|
|
59
59
|
`cursor:not-allowed;background:`,
|
|
60
60
|
`;border-color:`,
|
|
61
61
|
`;color:`,
|
|
@@ -64,7 +64,7 @@ var iconButtonStyles = (theme, $size, $error, disabled, $active) => {
|
|
|
64
64
|
};
|
|
65
65
|
var StyledIconButton = styled.button.withConfig({
|
|
66
66
|
displayName: "icon-button__StyledIconButton",
|
|
67
|
-
componentId: "sc-
|
|
67
|
+
componentId: "sc-3df98d32-0"
|
|
68
68
|
})([``, ``], ({ theme, $size, $error, disabled, $active }) => iconButtonStyles(theme, $size, $error, disabled, $active));
|
|
69
69
|
function LocalIconButton({ ...props }, ref) {
|
|
70
70
|
return /*#__PURE__*/ jsx(StyledIconButton, {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,20 @@
|
|
|
1
1
|
export * from './styled-components';
|
|
2
2
|
export * from './utils';
|
|
3
3
|
export * from './accordion';
|
|
4
|
+
export * from './avatar';
|
|
4
5
|
export * from './avatar-dropzone';
|
|
5
6
|
export * from './box';
|
|
6
7
|
export * from './button';
|
|
8
|
+
export * from './callout';
|
|
9
|
+
export * from './chat-input';
|
|
10
|
+
export * from './chat-launcher';
|
|
11
|
+
export * from './chat-message';
|
|
12
|
+
export * from './chat-message-list';
|
|
13
|
+
export * from './chat-panel';
|
|
14
|
+
export * from './chat-provider';
|
|
15
|
+
export * from './chat-showcase';
|
|
16
|
+
export * from './chat-sources';
|
|
17
|
+
export * from './chat-typing';
|
|
7
18
|
export * from './col';
|
|
8
19
|
export * from './container';
|
|
9
20
|
export * from './dropzone';
|
|
@@ -15,9 +26,11 @@ export * from './input';
|
|
|
15
26
|
export * from './max-width';
|
|
16
27
|
export * from './modal';
|
|
17
28
|
export * from './password';
|
|
29
|
+
export * from './prose';
|
|
18
30
|
export * from './range';
|
|
19
31
|
export * from './select';
|
|
20
32
|
export * from './space';
|
|
33
|
+
export * from './spinner';
|
|
21
34
|
export * from './tabs';
|
|
22
35
|
export * from './textarea';
|
|
23
36
|
export * from './theme-toggle';
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { GlobalStyles } from "./utils/global.js";
|
|
2
2
|
import { breakpoints, colors, colorsDark, fontSizes, fonts, lineHeights, mq, shadows, shadowsDark, spacing, theme, themeDark } from "./utils/theme.js";
|
|
3
|
-
import { errorInteractiveStyles, formElementHeightStyles, fullWidthStyles, generateAlignContentStyles, generateAlignItemsStyles, generateColSpanStyles, generateColsStyles, generateDirectionStyles, generateGapStyles, generateJustifyContentStyles, generatePaddingStyles, interactiveStyles, resetButton, resetInput, statusBorderStyles } from "./utils/mixins.js";
|
|
3
|
+
import { alpha, darkFilledTextRule, errorInteractiveStyles, filledTextColor, formElementHeightStyles, fullWidthStyles, generateAlignContentStyles, generateAlignItemsStyles, generateColSpanStyles, generateColsStyles, generateDirectionStyles, generateGapStyles, generateJustifyContentStyles, generatePaddingStyles, interactiveStyles, resetButton, resetInput, shade, statusBorderStyles, thinScrollbar, tint } from "./utils/mixins.js";
|
|
4
4
|
import { createTypographyStyle, styledBlockquote, styledButton, styledButtonBig, styledCode, styledH1, styledH2, styledH3, styledH4, styledH5, styledH6, styledHero1, styledHero2, styledHero3, styledInput, styledInputBig, styledSmall, styledStrong, styledText } from "./utils/typography.js";
|
|
5
|
+
import { useLockBodyScroll } from "./utils/use-lock-body-scroll.js";
|
|
6
|
+
import { useBelowBreakpoint, useMediaQuery } from "./utils/use-media-query.js";
|
|
5
7
|
import { useOnClickOutside } from "./utils/use-on-click-outside.js";
|
|
6
8
|
import { CherryThemeProvider, ThemeContext } from "./styled-components/theme-provider.js";
|
|
7
9
|
import { ClientThemeProvider } from "./styled-components/client-theme-provider.js";
|
|
@@ -9,15 +11,28 @@ import { StyledComponentsRegistry } from "./styled-components/registry.js";
|
|
|
9
11
|
import { createThemeInitScript, resolveTheme, themeInitScript } from "./styled-components/theme-init.js";
|
|
10
12
|
import { Icon } from "./icon.js";
|
|
11
13
|
import { Accordion } from "./accordion.js";
|
|
14
|
+
import { Avatar } from "./avatar.js";
|
|
12
15
|
import { Dropzone, matchesAccept } from "./dropzone.js";
|
|
13
16
|
import { AvatarDropzone } from "./avatar-dropzone.js";
|
|
14
17
|
import { Container } from "./container.js";
|
|
15
18
|
import { Box } from "./box.js";
|
|
16
19
|
import { Button, buttonStyles } from "./button.js";
|
|
20
|
+
import { Callout } from "./callout.js";
|
|
21
|
+
import { ChatSource, ChatSources } from "./chat-sources.js";
|
|
22
|
+
import { ChatMessage, chatTextStyles } from "./chat-message.js";
|
|
23
|
+
import { ChatTyping } from "./chat-typing.js";
|
|
24
|
+
import { Prose, proseStyles } from "./prose.js";
|
|
25
|
+
import { resolveShowcaseCommand, showcaseCommands } from "./chat-showcase.js";
|
|
26
|
+
import { ChatContext, ChatProvider, useChat } from "./chat-provider.js";
|
|
27
|
+
import { Spinner } from "./spinner.js";
|
|
28
|
+
import { ChatInput } from "./chat-input.js";
|
|
29
|
+
import { ChatLauncher } from "./chat-launcher.js";
|
|
30
|
+
import { ChatMessageList } from "./chat-message-list.js";
|
|
31
|
+
import { IconButton, iconButtonStyles } from "./icon-button.js";
|
|
32
|
+
import { ChatPanel } from "./chat-panel.js";
|
|
17
33
|
import { Col } from "./col.js";
|
|
18
34
|
import { Flex } from "./flex.js";
|
|
19
35
|
import { Grid } from "./grid.js";
|
|
20
|
-
import { IconButton, iconButtonStyles } from "./icon-button.js";
|
|
21
36
|
import { Input, StyledInputWrapper, StyledLabel } from "./input.js";
|
|
22
37
|
import { MaxWidth } from "./max-width.js";
|
|
23
38
|
import { Modal } from "./modal.js";
|
|
@@ -30,4 +45,4 @@ import { Textarea } from "./textarea.js";
|
|
|
30
45
|
import { ThemeToggle } from "./theme-toggle.js";
|
|
31
46
|
import { StyledNotificationItem, StyledNotifications, ToastNotifications, ToastNotificationsContext, ToastNotificationsProvider, useToastNotifications } from "./toast.js";
|
|
32
47
|
import { Toggle } from "./toggle.js";
|
|
33
|
-
export { Accordion, AvatarDropzone, Box, Button, CherryThemeProvider, ClientThemeProvider, Col, Container, Dropzone, Flex, GlobalStyles, Grid, Icon, IconButton, Input, MaxWidth, Modal, Password, Range, Select, Space, StyledComponentsRegistry, StyledIconWrapper, StyledInputWrapper, StyledLabel, StyledNotificationItem, StyledNotifications, TabContent, Tabs, Textarea, ThemeContext, ThemeToggle, ToastNotifications, ToastNotificationsContext, ToastNotificationsProvider, Toggle, breakpoints, buttonStyles, colors, colorsDark, createThemeInitScript, createTypographyStyle, errorInteractiveStyles, fontSizes, fonts, formElementHeightStyles, fullWidthStyles, generateAlignContentStyles, generateAlignItemsStyles, generateColSpanStyles, generateColsStyles, generateDirectionStyles, generateGapStyles, generateJustifyContentStyles, generatePaddingStyles, iconButtonStyles, interactiveStyles, lineHeights, matchesAccept, mq, resetButton, resetInput, resolveTheme, shadows, shadowsDark, spacing, statusBorderStyles, styledBlockquote, styledButton, styledButtonBig, styledCode, styledH1, styledH2, styledH3, styledH4, styledH5, styledH6, styledHero1, styledHero2, styledHero3, styledInput, styledInputBig, styledSmall, styledStrong, styledText, theme, themeDark, themeInitScript, useOnClickOutside, useToastNotifications };
|
|
48
|
+
export { Accordion, Avatar, AvatarDropzone, Box, Button, Callout, ChatContext, ChatInput, ChatLauncher, ChatMessage, ChatMessageList, ChatPanel, ChatProvider, ChatSource, ChatSources, ChatTyping, CherryThemeProvider, ClientThemeProvider, Col, Container, Dropzone, Flex, GlobalStyles, Grid, Icon, IconButton, Input, MaxWidth, Modal, Password, Prose, Range, Select, Space, Spinner, StyledComponentsRegistry, StyledIconWrapper, StyledInputWrapper, StyledLabel, StyledNotificationItem, StyledNotifications, TabContent, Tabs, Textarea, ThemeContext, ThemeToggle, ToastNotifications, ToastNotificationsContext, ToastNotificationsProvider, Toggle, alpha, breakpoints, buttonStyles, chatTextStyles, colors, colorsDark, createThemeInitScript, createTypographyStyle, darkFilledTextRule, errorInteractiveStyles, filledTextColor, fontSizes, fonts, formElementHeightStyles, fullWidthStyles, generateAlignContentStyles, generateAlignItemsStyles, generateColSpanStyles, generateColsStyles, generateDirectionStyles, generateGapStyles, generateJustifyContentStyles, generatePaddingStyles, iconButtonStyles, interactiveStyles, lineHeights, matchesAccept, mq, proseStyles, resetButton, resetInput, resolveShowcaseCommand, resolveTheme, shade, shadows, shadowsDark, showcaseCommands, spacing, statusBorderStyles, styledBlockquote, styledButton, styledButtonBig, styledCode, styledH1, styledH2, styledH3, styledH4, styledH5, styledH6, styledHero1, styledHero2, styledHero3, styledInput, styledInputBig, styledSmall, styledStrong, styledText, theme, themeDark, themeInitScript, thinScrollbar, tint, useBelowBreakpoint, useChat, useLockBodyScroll, useMediaQuery, useOnClickOutside, useToastNotifications };
|
package/dist/input.js
CHANGED
|
@@ -8,7 +8,7 @@ import styled, { css } from "styled-components";
|
|
|
8
8
|
//#region src/lib/input.tsx
|
|
9
9
|
var StyledInputWrapper = styled.span.withConfig({
|
|
10
10
|
displayName: "input__StyledInputWrapper",
|
|
11
|
-
componentId: "sc-
|
|
11
|
+
componentId: "sc-5352dea9-0"
|
|
12
12
|
})([
|
|
13
13
|
`display:inline-flex;flex-wrap:`,
|
|
14
14
|
`;align-items:center;`,
|
|
@@ -20,7 +20,7 @@ var StyledInputWrapper = styled.span.withConfig({
|
|
|
20
20
|
], ({ type }) => type === "checkbox" || type === "radio" ? "nowrap" : "wrap", ({ $label }) => $label && css([`gap:5px;align-items:flex-start;align-content:flex-start;`]), ({ $size }) => $size === "small" ? "14px" : "17px", ({ $size }) => $size === "small" ? "18px" : "24px", ({ $size }) => $size === "small" ? "18px" : "24px", ({ $fullWidth }) => fullWidthStyles($fullWidth));
|
|
21
21
|
var StyledLabel = styled.label.withConfig({
|
|
22
22
|
displayName: "input__StyledLabel",
|
|
23
|
-
componentId: "sc-
|
|
23
|
+
componentId: "sc-5352dea9-1"
|
|
24
24
|
})([
|
|
25
25
|
`display:inline-block;color:`,
|
|
26
26
|
`;font-size:`,
|
|
@@ -29,7 +29,7 @@ var StyledLabel = styled.label.withConfig({
|
|
|
29
29
|
], ({ theme }) => theme.colors.grayDark, ({ theme }) => theme.fontSizes.small.lg, ({ theme }) => theme.lineHeights.small.lg);
|
|
30
30
|
var StyledInput = styled.input.withConfig({
|
|
31
31
|
displayName: "input__StyledInput",
|
|
32
|
-
componentId: "sc-
|
|
32
|
+
componentId: "sc-5352dea9-2"
|
|
33
33
|
})([
|
|
34
34
|
``,
|
|
35
35
|
`;`,
|
|
@@ -85,7 +85,7 @@ var StyledInput = styled.input.withConfig({
|
|
|
85
85
|
`, ({ $fullWidth }) => fullWidthStyles($fullWidth));
|
|
86
86
|
var StyledIconWrapper = styled.span.withConfig({
|
|
87
87
|
displayName: "input__StyledIconWrapper",
|
|
88
|
-
componentId: "sc-
|
|
88
|
+
componentId: "sc-5352dea9-3"
|
|
89
89
|
})([
|
|
90
90
|
`display:inline-flex;position:relative;line-height:0;min-width:fit-content;& em{display:block;border-radius:50%;background:`,
|
|
91
91
|
`;}& svg,& em{object-fit:contain;position:absolute;top:50%;left:50%;color:`,
|
|
@@ -93,7 +93,7 @@ var StyledIconWrapper = styled.span.withConfig({
|
|
|
93
93
|
], ({ theme }) => theme.colors.primary, ({ theme }) => theme.colors.primary);
|
|
94
94
|
var StyledRadioCheckboxInput = styled.input.withConfig({
|
|
95
95
|
displayName: "input__StyledRadioCheckboxInput",
|
|
96
|
-
componentId: "sc-
|
|
96
|
+
componentId: "sc-5352dea9-4"
|
|
97
97
|
})([
|
|
98
98
|
``,
|
|
99
99
|
`;display:inline-block;background:`,
|
|
@@ -178,7 +178,7 @@ var StyledRadioCheckboxInput = styled.input.withConfig({
|
|
|
178
178
|
});
|
|
179
179
|
var StyledCustomIconWrapper = styled.span.withConfig({
|
|
180
180
|
displayName: "input__StyledCustomIconWrapper",
|
|
181
|
-
componentId: "sc-
|
|
181
|
+
componentId: "sc-5352dea9-5"
|
|
182
182
|
})([
|
|
183
183
|
`position:relative;`,
|
|
184
184
|
`;& svg{position:absolute;top:50%;transform:translateY(-50%);pointer-events:none;width:24px;height:24px;object-fit:contain;color:`,
|