@sybilion/uilib 1.3.84 → 1.3.86
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/esm/components/ui/Chat/ChatEmptyState/ChatEmptyState.js +3 -2
- package/dist/esm/components/ui/Chat/ChatPrompt/ChatPrompt.styl.js +2 -2
- package/dist/esm/components/ui/Chat/ChatSheet/ChatSelector.js +3 -2
- package/dist/esm/components/ui/Chat/ChatSheet/ChatSelector.styl.js +2 -2
- package/dist/esm/components/ui/Chat/ChatSheet/ChatSheet.js +1 -1
- package/dist/esm/components/ui/FileChip/FileChip.js +4 -8
- package/dist/esm/components/ui/Select/Select.styl.js +1 -1
- package/dist/esm/types/src/components/ui/Chat/ChatEmptyState/ChatEmptyState.d.ts +2 -2
- package/dist/esm/types/src/components/ui/Chat/ChatEmptyState/ChatEmptyState.types.d.ts +1 -0
- package/dist/esm/types/src/components/ui/Chat/ChatSheet/ChatSelector.d.ts +3 -2
- package/dist/esm/types/src/components/ui/Chat/ChatSheet/ChatSheet.d.ts +1 -1
- package/dist/esm/types/src/components/ui/FileChip/FileChip.d.ts +1 -1
- package/dist/esm/types/src/components/ui/FileChip/FileChip.types.d.ts +2 -1
- package/package.json +1 -1
- package/src/components/ui/Chat/ChatEmptyState/ChatEmptyState.tsx +4 -3
- package/src/components/ui/Chat/ChatEmptyState/ChatEmptyState.types.ts +1 -0
- package/src/components/ui/Chat/ChatPrompt/ChatPrompt.styl +5 -1
- package/src/components/ui/Chat/ChatPrompt/ChatPrompt.styl.d.ts +1 -0
- package/src/components/ui/Chat/ChatSheet/ChatSelector.styl +18 -2
- package/src/components/ui/Chat/ChatSheet/ChatSelector.styl.d.ts +2 -0
- package/src/components/ui/Chat/ChatSheet/ChatSelector.tsx +23 -6
- package/src/components/ui/Chat/ChatSheet/ChatSheet.tsx +2 -2
- package/src/components/ui/FileChip/FileChip.tsx +8 -13
- package/src/components/ui/FileChip/FileChip.types.ts +2 -1
- package/src/components/ui/Select/Select.styl +15 -6
- package/src/docs/pages/SelectPage.tsx +73 -16
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import S from './ChatEmptyState.styl.js';
|
|
3
3
|
import SparklesIcon from './icons/sparkles.svg.js';
|
|
4
|
+
import cn from 'classnames';
|
|
4
5
|
|
|
5
|
-
function ChatEmptyState({ icon = jsx(SparklesIcon, {}), title = 'Start a conversation', description, additionalContent, children, }) {
|
|
6
|
-
return (jsxs("div", { className: S.root, children: [icon && jsx("div", { className: S.icon, children: icon }), title && jsx("h2", { children: title }), description && jsx("p", { children: description }), additionalContent, children] }));
|
|
6
|
+
function ChatEmptyState({ icon = jsx(SparklesIcon, {}), title = 'Start a conversation', description, additionalContent, children, className, }) {
|
|
7
|
+
return (jsxs("div", { className: cn(S.root, className), children: [icon && jsx("div", { className: S.icon, children: icon }), title && jsx("h2", { children: title }), description && jsx("p", { children: description }), additionalContent, children] }));
|
|
7
8
|
}
|
|
8
9
|
|
|
9
10
|
export { ChatEmptyState };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import styleInject from 'style-inject';
|
|
2
2
|
|
|
3
|
-
var css_248z = "@media (max-width:768px){:root{--page-x-padding:var(--p-6);--page-y-padding:var(--p-6)}}.ChatPrompt_root__5G5bq{align-items:stretch;display:flex;flex-direction:column;gap:var(--p-2);padding:var(--p-3);position:relative}.ChatPrompt_composer__H3c3N{align-items:flex-end;display:flex;flex-direction:row;gap:var(--p-3);position:relative;width:100%}.ChatPrompt_fileInput__xdgPn{display:none}.ChatPrompt_attachButton__gi-qF{align-self:flex-end;flex-shrink:0}.ChatPrompt_editorWrap__Q7gat{align-self:stretch;flex:1;min-width:0}.ChatPrompt_editorMount__Phh4D{background:transparent;border:none;border-radius:0!important;box-shadow:none!important;display:flex;flex:1;flex-direction:column;max-height:200px;min-height:40px;min-width:0;padding:0!important}.ChatPrompt_editorMount__Phh4D:focus-within{box-shadow:none!important}.ChatPrompt_editorMount__Phh4D .ProseMirror{border:none!important;box-shadow:none!important;flex:1;margin:0;max-height:200px!important;min-height:40px!important;outline:none!important;overflow-x:hidden!important;overflow-y:auto!important;padding:var(--p-2) 0 0!important;resize:none!important;white-space:pre-wrap;word-break:break-word}.ChatPrompt_editorMount__Phh4D .ProseMirror p.is-empty.is-editor-empty:before{color:var(--muted-foreground);content:attr(data-placeholder);float:left;height:0;pointer-events:none}.ChatPrompt_editorMount__Phh4D .ProseMirror .chat-prompt-command-chip,.ChatPrompt_editorMount__Phh4D .ProseMirror .slash-mention{align-items:center;background:var(--muted);border-radius:var(--radius-sm);display:inline-flex;font-size:.875em;line-height:1.4;padding:0 var(--p-1);-webkit-user-select:none;-moz-user-select:none;user-select:none;vertical-align:baseline;white-space:nowrap}.ChatPrompt_editorMount__Phh4D .ProseMirror .chat-prompt-command-chip{color:var(--foreground)}.ChatPrompt_submitColumn__0rY1R{align-items:center;display:flex;flex-direction:column;flex-shrink:0;justify-content:flex-end
|
|
4
|
-
var S = {"root":"ChatPrompt_root__5G5bq","composer":"ChatPrompt_composer__H3c3N","fileInput":"ChatPrompt_fileInput__xdgPn","attachButton":"ChatPrompt_attachButton__gi-qF","editorWrap":"ChatPrompt_editorWrap__Q7gat","editorMount":"ChatPrompt_editorMount__Phh4D","submitColumn":"ChatPrompt_submitColumn__0rY1R","attachments":"ChatPrompt_attachments__KG-fG","attachmentItem":"ChatPrompt_attachmentItem__QJk7J"};
|
|
3
|
+
var css_248z = "@media (max-width:768px){:root{--page-x-padding:var(--p-6);--page-y-padding:var(--p-6)}}.ChatPrompt_root__5G5bq{align-items:stretch;display:flex;flex-direction:column;gap:var(--p-2);padding:var(--p-3);position:relative}.ChatPrompt_composer__H3c3N{align-items:flex-end;display:flex;flex-direction:row;gap:var(--p-3);position:relative;width:100%}.ChatPrompt_fileInput__xdgPn{display:none}.ChatPrompt_attachButton__gi-qF,.ChatPrompt_submitButton__gvhDN{position:relative;top:-2px}.ChatPrompt_attachButton__gi-qF{align-self:flex-end;flex-shrink:0}.ChatPrompt_editorWrap__Q7gat{align-self:stretch;flex:1;min-width:0}.ChatPrompt_editorMount__Phh4D{background:transparent;border:none;border-radius:0!important;box-shadow:none!important;display:flex;flex:1;flex-direction:column;max-height:200px;min-height:40px;min-width:0;padding:0!important}.ChatPrompt_editorMount__Phh4D:focus-within{box-shadow:none!important}.ChatPrompt_editorMount__Phh4D .ProseMirror{border:none!important;box-shadow:none!important;flex:1;margin:0;max-height:200px!important;min-height:40px!important;outline:none!important;overflow-x:hidden!important;overflow-y:auto!important;padding:var(--p-2) 0 0!important;resize:none!important;white-space:pre-wrap;word-break:break-word}.ChatPrompt_editorMount__Phh4D .ProseMirror p.is-empty.is-editor-empty:before{color:var(--muted-foreground);content:attr(data-placeholder);float:left;height:0;pointer-events:none}.ChatPrompt_editorMount__Phh4D .ProseMirror .chat-prompt-command-chip,.ChatPrompt_editorMount__Phh4D .ProseMirror .slash-mention{align-items:center;background:var(--muted);border-radius:var(--radius-sm);display:inline-flex;font-size:.875em;line-height:1.4;padding:0 var(--p-1);-webkit-user-select:none;-moz-user-select:none;user-select:none;vertical-align:baseline;white-space:nowrap}.ChatPrompt_editorMount__Phh4D .ProseMirror .chat-prompt-command-chip{color:var(--foreground)}.ChatPrompt_submitColumn__0rY1R{align-items:center;display:flex;flex-direction:column;flex-shrink:0;justify-content:flex-end}.ChatPrompt_submitColumn__0rY1R>button:focus{box-shadow:0 0 0 2px var(--brand-color-500)!important}.ChatPrompt_submitColumn__0rY1R>button:first-child{border:none;position:relative;transition:all .2s}.ChatPrompt_submitColumn__0rY1R>button:first-child:focus{transform:scale(1.2)}.ChatPrompt_submitColumn__0rY1R>button:first-child:before{bottom:-100%;content:\"\";left:-100%;position:absolute;right:-100%;top:-100%}.ChatPrompt_attachments__KG-fG{display:flex;flex-wrap:wrap;gap:var(--p-2);margin-bottom:var(--p-2)}.ChatPrompt_attachmentItem__QJk7J{flex:1 1 300px;max-width:300px;min-width:0}";
|
|
4
|
+
var S = {"root":"ChatPrompt_root__5G5bq","composer":"ChatPrompt_composer__H3c3N","fileInput":"ChatPrompt_fileInput__xdgPn","attachButton":"ChatPrompt_attachButton__gi-qF","submitButton":"ChatPrompt_submitButton__gvhDN","editorWrap":"ChatPrompt_editorWrap__Q7gat","editorMount":"ChatPrompt_editorMount__Phh4D","submitColumn":"ChatPrompt_submitColumn__0rY1R","attachments":"ChatPrompt_attachments__KG-fG","attachmentItem":"ChatPrompt_attachmentItem__QJk7J"};
|
|
5
5
|
styleInject(css_248z);
|
|
6
6
|
|
|
7
7
|
export { S as default };
|
|
@@ -6,7 +6,8 @@ import { Button } from '../../Button/Button.js';
|
|
|
6
6
|
import { Select, SelectTrigger, SelectValue, SelectContent, SelectItem } from '../../Select/Select.js';
|
|
7
7
|
import S from './ChatSelector.styl.js';
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
const deleteIconSize = (s) => s === 'sm' ? 16 : s === 'md' ? 18 : 20;
|
|
10
|
+
function ChatSelector({ id, size = 'sm', variant = 'clear', wrapperClassName, className, onChatDeleted, onNewChat, }) {
|
|
10
11
|
const { chats, currentChatId, setCurrentChatId, newChat, deleteChat } = useChatsForScopeId(id);
|
|
11
12
|
const handleValueChange = (value) => {
|
|
12
13
|
if (value === 'new') {
|
|
@@ -39,7 +40,7 @@ function ChatSelector({ id, wrapperClassName, className, onChatDeleted, onNewCha
|
|
|
39
40
|
}
|
|
40
41
|
return 'New chat';
|
|
41
42
|
};
|
|
42
|
-
return (jsxs("div", { className: cn(S.wrapper, wrapperClassName), children: [jsx("div", { className: S.selectGrow, children: jsxs(Select, { variant:
|
|
43
|
+
return (jsxs("div", { className: cn(S.wrapper, variant === 'clear' ? S.variantClear : S.variantDefault, wrapperClassName), children: [jsx("div", { className: S.selectGrow, children: jsxs(Select, { variant: variant, value: currentChatId?.toString() ?? '', onValueChange: handleValueChange, children: [jsx(SelectTrigger, { size: size, variant: variant, className: className ? cn(S.selectTrigger, className) : S.selectTrigger, children: jsx(SelectValue, { placeholder: "Select chat" }) }), jsxs(SelectContent, { children: [jsx(SelectItem, { value: "new", children: "+ New Chat" }), chats.map(chat => (jsx(SelectItem, { value: chat.session_id.toString(), selected: chat.session_id === currentChatId, children: getChatDisplayName(chat) }, chat.session_id)))] })] }) }), currentChatId && chats.length > 0 && (jsx(Button, { type: "button", variant: "ghost", size: size, className: S.deleteBtn, "aria-label": "Delete chat", onClick: handleDeleteChat, children: jsx(Trash2Icon, { size: deleteIconSize(size) }) }))] }));
|
|
43
44
|
}
|
|
44
45
|
|
|
45
46
|
export { ChatSelector };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import styleInject from 'style-inject';
|
|
2
2
|
|
|
3
|
-
var css_248z = "@media (max-width:768px){:root{--page-x-padding:var(--p-6);--page-y-padding:var(--p-6)}}.ChatSelector_wrapper__8Z4wN{align-items:center;display:flex;gap:var(--p-
|
|
4
|
-
var S = {"wrapper":"ChatSelector_wrapper__8Z4wN","selectGrow":"ChatSelector_selectGrow__bGR0A","selectTrigger":"ChatSelector_selectTrigger__DASfc","deleteBtn":"ChatSelector_deleteBtn__oJ-9b"};
|
|
3
|
+
var css_248z = "@media (max-width:768px){:root{--page-x-padding:var(--p-6);--page-y-padding:var(--p-6)}}.ChatSelector_wrapper__8Z4wN{align-items:center;display:flex;gap:var(--p-1);min-width:160px;z-index:1000}.ChatSelector_selectGrow__bGR0A{flex:1;min-width:0}.ChatSelector_selectTrigger__DASfc{width:100%}.ChatSelector_deleteBtn__oJ-9b{border-radius:50px;flex-shrink:0;opacity:0;pointer-events:none}.ChatSelector_wrapper__8Z4wN:hover .ChatSelector_deleteBtn__oJ-9b{opacity:1;pointer-events:auto}.ChatSelector_variantClear__ZN0MI .ChatSelector_selectTrigger__DASfc{background-color:transparent;border:none;box-shadow:none}.ChatSelector_variantClear__ZN0MI .ChatSelector_selectTrigger__DASfc:hover{background-color:transparent;box-shadow:none}.ChatSelector_variantDefault__y-WeT .ChatSelector_selectTrigger__DASfc{background-color:var(--background)}.ChatSelector_variantDefault__y-WeT .ChatSelector_selectTrigger__DASfc:hover{box-shadow:0 0 0 2px var(--background)}";
|
|
4
|
+
var S = {"wrapper":"ChatSelector_wrapper__8Z4wN","selectGrow":"ChatSelector_selectGrow__bGR0A","selectTrigger":"ChatSelector_selectTrigger__DASfc","deleteBtn":"ChatSelector_deleteBtn__oJ-9b","variantClear":"ChatSelector_variantClear__ZN0MI","variantDefault":"ChatSelector_variantDefault__y-WeT"};
|
|
5
5
|
styleInject(css_248z);
|
|
6
6
|
|
|
7
7
|
export { S as default };
|
|
@@ -34,7 +34,7 @@ function ChatSheet({ triggerLabel = 'Open Chat', triggerAriaLabel, actionsRef, r
|
|
|
34
34
|
if (inline) {
|
|
35
35
|
return jsx(ChatChrome, { ...model.chromeProps });
|
|
36
36
|
}
|
|
37
|
-
return (jsxs(Fragment, { children: [renderTrigger?.(model.toggleOpen) ?? (jsx(Button, { variant: "outline", "aria-label": triggerAriaLabel, onClick: model.toggleOpen, children: triggerLabel })), model.isOpen &&
|
|
37
|
+
return (jsxs(Fragment, { children: [renderTrigger?.(model.toggleOpen, model.isOpen) ?? (jsx(Button, { variant: "outline", "aria-label": triggerAriaLabel, onClick: model.toggleOpen, children: triggerLabel })), model.isOpen &&
|
|
38
38
|
model.chatPanelContainer &&
|
|
39
39
|
createPortal(jsx(ChatChrome, { ...model.chromeProps }), model.chatPanelContainer)] }));
|
|
40
40
|
}
|
|
@@ -3,7 +3,6 @@ import cn from 'classnames';
|
|
|
3
3
|
import { CsvIcon } from '../../icons/CsvIcon/CsvIcon.js';
|
|
4
4
|
import { CardHeader, CardAction } from '../Card/Card.js';
|
|
5
5
|
import { XIcon, FileTextIcon } from '@phosphor-icons/react';
|
|
6
|
-
import { LayoutDashboard } from 'lucide-react';
|
|
7
6
|
import S from './FileChip.styl.js';
|
|
8
7
|
|
|
9
8
|
const FORMAT_ICON_SIZE = 32;
|
|
@@ -11,16 +10,13 @@ function FormatIcon({ format }) {
|
|
|
11
10
|
if (format === 'csv') {
|
|
12
11
|
return jsx(CsvIcon, { size: FORMAT_ICON_SIZE });
|
|
13
12
|
}
|
|
14
|
-
if (format === 'dashboard') {
|
|
15
|
-
return (jsx(LayoutDashboard, { size: FORMAT_ICON_SIZE, "aria-hidden": true, style: { color: 'var(--muted-foreground)' } }));
|
|
16
|
-
}
|
|
17
13
|
return (jsx(FileTextIcon, { size: FORMAT_ICON_SIZE, "aria-hidden": true, style: { color: 'var(--muted-foreground)' } }));
|
|
18
14
|
}
|
|
19
|
-
function FileChipHeader({ name, format, hint, onRemove, }) {
|
|
20
|
-
return (jsx(CardHeader, { className: S.header, icon: jsx(FormatIcon, { format: format }), title: name, description: hint, titleClassName: S.title, descriptionClassName: S.hint, tooltipProps: { maxWidth: 400 }, children: onRemove ? (jsx(CardAction, { children: jsx("button", { type: "button", className: S.remove, "aria-label": `Remove ${name}`, onClick: onRemove, children: jsx(XIcon, { size: 14, "aria-hidden": true }) }) })) : null }));
|
|
15
|
+
function FileChipHeader({ name, format, hint, icon, onRemove, }) {
|
|
16
|
+
return (jsx(CardHeader, { className: S.header, icon: icon ?? jsx(FormatIcon, { format: format }), title: name, description: hint, titleClassName: S.title, descriptionClassName: S.hint, tooltipProps: { maxWidth: 400 }, children: onRemove ? (jsx(CardAction, { children: jsx("button", { type: "button", className: S.remove, "aria-label": `Remove ${name}`, onClick: onRemove, children: jsx(XIcon, { size: 14, "aria-hidden": true }) }) })) : null }));
|
|
21
17
|
}
|
|
22
|
-
function FileChip({ name, format, hint, onClick, onRemove, className, }) {
|
|
23
|
-
const header = (jsx(FileChipHeader, { name: name, format: format, hint: hint, onRemove: onRemove }));
|
|
18
|
+
function FileChip({ name, format, hint, icon, onClick, onRemove, className, }) {
|
|
19
|
+
const header = (jsx(FileChipHeader, { name: name, format: format, hint: hint, icon: icon, onRemove: onRemove }));
|
|
24
20
|
if (onClick) {
|
|
25
21
|
return (jsx("button", { type: "button", className: cn(S.root, S.interactive, className), "aria-label": `${hint}: ${name}`, onClick: onClick, children: header }));
|
|
26
22
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import styleInject from 'style-inject';
|
|
2
2
|
|
|
3
|
-
var css_248z = ".Select_selectTrigger__oTOBl{align-items:center;background-color:var(--background);border:none;border-radius:var(--p-4);box-shadow:none;color:var(--foreground);cursor:pointer;display:flex;font-size:var(--text-sm);font-weight:500;gap:var(--p-1);justify-content:space-between;max-width:calc(90vw - var(--page-x-padding)*2);outline:none;overflow:hidden;padding:var(--p-1) var(--p-3);position:relative;transition:all .2s ease-in-out;white-space:nowrap;width:-moz-fit-content;width:fit-content}.Select_selectTrigger__oTOBl:before{background-image:linear-gradient(to right,transparent,var(--background));content:\"\";display:block;height:100%;left:60vw;min-height:100%;min-width:var(--page-x-padding);position:absolute;width:var(--page-x-padding);width:20%}.Select_selectTrigger__oTOBl[aria-expanded=true]:before{display:none}.Select_selectTrigger__oTOBl.Select_darker__wwisI{background-color:var(--muted)}.Select_selectTrigger__oTOBl:hover{box-shadow:0 0 0 2px var(--background)}.Select_selectTrigger__oTOBl[data-size=
|
|
3
|
+
var css_248z = ".Select_selectTrigger__oTOBl{align-items:center;background-color:var(--background);border:none;border-radius:var(--p-4);box-shadow:none;color:var(--foreground);cursor:pointer;display:flex;font-size:var(--text-sm);font-weight:500;gap:var(--p-1);justify-content:space-between;max-width:calc(90vw - var(--page-x-padding)*2);outline:none;overflow:hidden;padding:var(--p-1) var(--p-3);position:relative;transition:all .2s ease-in-out;white-space:nowrap;width:-moz-fit-content;width:fit-content}.Select_selectTrigger__oTOBl:before{background-image:linear-gradient(to right,transparent,var(--background));content:\"\";display:block;height:100%;left:60vw;min-height:100%;min-width:var(--page-x-padding);position:absolute;width:var(--page-x-padding);width:20%}.Select_selectTrigger__oTOBl[aria-expanded=true]:before{display:none}.Select_selectTrigger__oTOBl.Select_darker__wwisI{background-color:var(--muted)}.Select_selectTrigger__oTOBl:hover{box-shadow:0 0 0 2px var(--background)}.Select_selectTrigger__oTOBl[data-size=sm]{border-radius:var(--p-4);font-size:var(--text-xs);height:auto;min-height:28px;padding:0 var(--p-4)}.Select_selectTrigger__oTOBl[data-size=md]{border-radius:var(--p-4);font-size:var(--text-sm);height:auto;min-height:40px;padding:var(--p-3) var(--p-4)}.Select_selectTrigger__oTOBl[data-size=lg]{border-radius:var(--p-4);font-size:var(--text-sm);height:auto;min-height:auto;padding:var(--p-4) var(--p-6)}.Select_selectTrigger__oTOBl[data-placeholder]{color:var(--muted-foreground)}.Select_selectTrigger__oTOBl:focus-visible{border-color:var(--ring)}.Select_selectTrigger__oTOBl[aria-invalid=true]{border-color:var(--destructive)}.Select_selectTrigger__oTOBl:disabled{cursor:not-allowed;opacity:.5}.Select_selectTrigger__oTOBl [data-slot=select-value]{align-items:center;display:flex;gap:var(--p-2);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.Select_selectTrigger__oTOBl svg{flex-shrink:0;pointer-events:none}.Select_selectTrigger__oTOBl svg:not([class*=text-]){color:var(--foreground)}.Select_selectTrigger__oTOBl svg:not([class*=size-]){height:1rem;width:1rem}.dark .Select_selectTrigger__oTOBl:not(.Select_darker__wwisI){background-color:var(--background)}.dark .Select_selectTrigger__oTOBl:not(.Select_darker__wwisI):hover{background-color:var(--background-alpha-800)}.Select_clear__vxo-N{background-color:transparent;border:none;box-shadow:none}.Select_clear__vxo-N:focus-visible{border:none;box-shadow:none}@media (prefers-color-scheme:dark){.Select_clear__vxo-N,.Select_clear__vxo-N:hover{background-color:transparent}}.Select_selectContent__Wbegi{background-color:var(--popover);border:1px solid var(--border);border-radius:var(--p-4);box-shadow:0 10px 15px -3px rgba(0,0,0,.1);color:var(--popover-foreground);max-height:var(--radix-select-content-available-height);min-width:8rem;overflow-x:hidden;overflow-y:auto;position:relative;transform-origin:var(--radix-select-content-transform-origin);z-index:1100}.Select_selectContent__Wbegi[data-state=open]{animation:Select_fadeIn__hm7v- .25s,Select_zoomIn__ep77v .1s}.Select_selectContent__Wbegi[data-state=closed]{animation:Select_fadeOut__A-ccN .25s,Select_zoomOut__pZ-7e .1s}.Select_selectContent__Wbegi[data-side=bottom]{animation:Select_fadeIn__hm7v- .25s,Select_slideInFromTop__O1LeF .1s}.Select_selectContent__Wbegi[data-side=left]{animation:Select_fadeIn__hm7v- .25s,Select_slideInFromRight__iJq-J .1s}.Select_selectContent__Wbegi[data-side=right]{animation:Select_fadeIn__hm7v- .25s,Select_slideInFromLeft__8tm7S .1s}.Select_selectContent__Wbegi[data-side=top]{animation:Select_fadeIn__hm7v- .25s,Select_slideInFromBottom__PsvX6 .1s}.Select_selectContentPopper__TU8Jn[data-side=bottom]{transform:translateY(.25rem)}.Select_selectContentPopper__TU8Jn[data-side=left]{transform:translateX(-.25rem)}.Select_selectContentPopper__TU8Jn[data-side=right]{transform:translateX(.25rem)}.Select_selectContentPopper__TU8Jn[data-side=top]{transform:translateY(-.25rem)}.Select_selectViewport__OtOW7{padding:var(--p-1)}.Select_selectViewportPopper__dUoFi{height:var(--radix-select-trigger-height);min-width:var(--radix-select-trigger-width);scroll-margin:var(--p-1) 0;width:100%}.Select_selectLabel__rX9cj{color:var(--muted-foreground);font-size:var(--text-xs);padding:var(--p-2) var(--p-2);padding-bottom:var(--p-2);padding-top:var(--p-2)}.Select_selectItem__JLg4D{align-items:center;border-radius:var(--radius-sm);cursor:default;display:flex;flex-grow:1;font-size:var(--text-sm);gap:var(--p-2);outline:none;padding:var(--p-1) var(--p-2);position:relative;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:100%}.Select_selectItem__JLg4D.Select_selected__tmqut{background-color:var(--accent);font-weight:600}.Select_selectItem__JLg4D:first-child{border-top-left-radius:var(--p-3);border-top-right-radius:var(--p-3)}.Select_selectItem__JLg4D:last-child{border-bottom-left-radius:var(--p-3);border-bottom-right-radius:var(--p-3)}.Select_selectItem__JLg4D:focus{background-color:var(--accent);color:var(--accent-foreground)}.Select_selectItem__JLg4D[data-disabled]{opacity:.5;pointer-events:none}.Select_selectItem__JLg4D svg{flex-shrink:0;pointer-events:none}.Select_selectItem__JLg4D svg:not([class*=text-]){color:var(--muted-foreground)}.Select_selectItem__JLg4D svg:not([class*=size-]){height:1rem;width:1rem}.Select_selectItem__JLg4D span:not([data-slot=analysis-icon]){display:flex;flex-grow:1;width:100%}.Select_selectItem__JLg4D span:last-child{align-items:center;display:flex;gap:var(--p-2)}.Select_selectItemText__9JXv9{align-items:center;display:flex;gap:var(--p-1)}.Select_selectItemIndicatorContainer__Vte2-{align-items:center;display:flex;height:var(--p-8);justify-content:center;position:absolute;right:0;width:var(--p-8)}.Select_selectItemIndicator__9HcxQ{height:1rem;width:1rem}.Select_selectSeparator__OZw53{background-color:var(--border);height:1px;margin:-.25rem var(--p-1) var(--p-1);pointer-events:none}.Select_selectScrollButton__-z-iR{align-items:center;cursor:default;display:flex;justify-content:center;padding:var(--p-1) 0}.Select_selectIcon__-TfP9{height:1rem;margin-right:calc(var(--p-1)*-1);opacity:.5;width:1rem}.Select_selectScrollIcon__ZyTUI{height:1rem;width:1rem}@keyframes Select_fadeIn__hm7v-{0%{opacity:0}to{opacity:1}}@keyframes Select_fadeOut__A-ccN{0%{opacity:1}to{opacity:0}}@keyframes Select_zoomIn__ep77v{0%{transform:scale(.95)}to{transform:scale(1)}}@keyframes Select_zoomOut__pZ-7e{0%{transform:scale(1)}to{transform:scale(.95)}}@keyframes Select_slideInFromTop__O1LeF{0%{transform:translateY(-.5rem)}to{transform:translateY(.2)}}@keyframes Select_slideInFromBottom__PsvX6{0%{transform:translateY(.5rem)}to{transform:translateY(.2)}}@keyframes Select_slideInFromLeft__8tm7S{0%{transform:translateX(-.5rem)}to{transform:translateX(.2)}}@keyframes Select_slideInFromRight__iJq-J{0%{transform:translateX(.5rem)}to{transform:translateY(.2)}}";
|
|
4
4
|
var S = {"selectTrigger":"Select_selectTrigger__oTOBl","darker":"Select_darker__wwisI","clear":"Select_clear__vxo-N","selectContent":"Select_selectContent__Wbegi","fadeIn":"Select_fadeIn__hm7v-","zoomIn":"Select_zoomIn__ep77v","fadeOut":"Select_fadeOut__A-ccN","zoomOut":"Select_zoomOut__pZ-7e","slideInFromTop":"Select_slideInFromTop__O1LeF","slideInFromRight":"Select_slideInFromRight__iJq-J","slideInFromLeft":"Select_slideInFromLeft__8tm7S","slideInFromBottom":"Select_slideInFromBottom__PsvX6","selectContentPopper":"Select_selectContentPopper__TU8Jn","selectViewport":"Select_selectViewport__OtOW7","selectViewportPopper":"Select_selectViewportPopper__dUoFi","selectLabel":"Select_selectLabel__rX9cj","selectItem":"Select_selectItem__JLg4D","selected":"Select_selected__tmqut","selectItemText":"Select_selectItemText__9JXv9","selectItemIndicatorContainer":"Select_selectItemIndicatorContainer__Vte2-","selectItemIndicator":"Select_selectItemIndicator__9HcxQ","selectSeparator":"Select_selectSeparator__OZw53","selectScrollButton":"Select_selectScrollButton__-z-iR","selectIcon":"Select_selectIcon__-TfP9","selectScrollIcon":"Select_selectScrollIcon__ZyTUI"};
|
|
5
5
|
styleInject(css_248z);
|
|
6
6
|
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { PropsWithChildren } from 'react';
|
|
2
1
|
import type { ChatEmptyStateProps } from './ChatEmptyState.types';
|
|
3
|
-
|
|
2
|
+
import { PropsWithChildren } from 'react';
|
|
3
|
+
export declare function ChatEmptyState({ icon, title, description, additionalContent, children, className, }: PropsWithChildren<ChatEmptyStateProps>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -5,6 +5,7 @@ export type ChatEmptyStateContext = {
|
|
|
5
5
|
export interface ChatEmptyStateProps {
|
|
6
6
|
icon?: React.ReactNode;
|
|
7
7
|
title?: string;
|
|
8
|
+
className?: string;
|
|
8
9
|
description?: string;
|
|
9
10
|
/** Extra block below description (resolved before render in `ChatEmptyState`). */
|
|
10
11
|
additionalContent?: React.ReactNode;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import type { SelectProps, SelectTriggerProps } from '#uilib/components/ui/Select/Select.types.js';
|
|
2
|
+
export interface ChatSelectorProps extends SelectProps, Pick<SelectTriggerProps, 'size' | 'variant'> {
|
|
2
3
|
id: string;
|
|
3
4
|
wrapperClassName?: string;
|
|
4
5
|
className?: string;
|
|
@@ -6,4 +7,4 @@ export interface ChatSelectorProps {
|
|
|
6
7
|
/** When set, used for "+ New Chat" instead of the default empty `newChat()`. */
|
|
7
8
|
onNewChat?: () => void;
|
|
8
9
|
}
|
|
9
|
-
export declare function ChatSelector({ id, wrapperClassName, className, onChatDeleted, onNewChat, }: ChatSelectorProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare function ChatSelector({ id, size, variant, wrapperClassName, className, onChatDeleted, onNewChat, }: ChatSelectorProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -10,7 +10,7 @@ export interface ChatSheetProps extends Omit<UseChatPanelChromeModelInput, 'embe
|
|
|
10
10
|
title?: string;
|
|
11
11
|
/** Imperative open / new-chat for triggers outside `renderTrigger` (e.g. sidebar). */
|
|
12
12
|
actionsRef?: React.MutableRefObject<ChatSheetActions | null>;
|
|
13
|
-
renderTrigger?: (toggleOpen: () => void) => React.ReactNode;
|
|
13
|
+
renderTrigger?: (toggleOpen: () => void, isOpen: boolean) => React.ReactNode;
|
|
14
14
|
triggerLabel?: React.ReactNode;
|
|
15
15
|
/** aria-label for icon-only trigger (required when trigger has no visible text) */
|
|
16
16
|
triggerAriaLabel?: string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { FileChipProps } from './FileChip.types';
|
|
2
|
-
export declare function FileChip({ name, format, hint, onClick, onRemove, className, }: FileChipProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare function FileChip({ name, format, hint, icon, onClick, onRemove, className, }: FileChipProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
export type FileChipFormat = 'csv' | 'pdf' | 'text'
|
|
1
|
+
export type FileChipFormat = 'csv' | 'pdf' | 'text';
|
|
2
2
|
export type FileChipProps = {
|
|
3
3
|
name: string;
|
|
4
4
|
format: FileChipFormat;
|
|
5
5
|
hint: string;
|
|
6
|
+
icon?: React.ReactNode;
|
|
6
7
|
onClick?: () => void;
|
|
7
8
|
onRemove?: () => void;
|
|
8
9
|
disabled?: boolean;
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import type { ChatEmptyStateProps } from './ChatEmptyState.types';
|
|
1
2
|
import { PropsWithChildren } from 'react';
|
|
2
|
-
|
|
3
3
|
import S from './ChatEmptyState.styl';
|
|
4
|
-
import type { ChatEmptyStateProps } from './ChatEmptyState.types';
|
|
5
4
|
import SparklesIcon from './icons/sparkles.svg';
|
|
5
|
+
import cn from 'classnames';
|
|
6
6
|
|
|
7
7
|
export function ChatEmptyState({
|
|
8
8
|
icon = <SparklesIcon />,
|
|
@@ -10,9 +10,10 @@ export function ChatEmptyState({
|
|
|
10
10
|
description,
|
|
11
11
|
additionalContent,
|
|
12
12
|
children,
|
|
13
|
+
className,
|
|
13
14
|
}: PropsWithChildren<ChatEmptyStateProps>) {
|
|
14
15
|
return (
|
|
15
|
-
<div className={S.root}>
|
|
16
|
+
<div className={cn(S.root, className)}>
|
|
16
17
|
{icon && <div className={S.icon}>{icon}</div>}
|
|
17
18
|
{title && <h2>{title}</h2>}
|
|
18
19
|
{description && <p>{description}</p>}
|
|
@@ -7,6 +7,7 @@ export type ChatEmptyStateContext = {
|
|
|
7
7
|
export interface ChatEmptyStateProps {
|
|
8
8
|
icon?: React.ReactNode;
|
|
9
9
|
title?: string;
|
|
10
|
+
className?: string;
|
|
10
11
|
description?: string;
|
|
11
12
|
/** Extra block below description (resolved before render in `ChatEmptyState`). */
|
|
12
13
|
additionalContent?: React.ReactNode;
|
|
@@ -21,6 +21,11 @@ INPUT_MAX_HEIGHT = 200px
|
|
|
21
21
|
.fileInput
|
|
22
22
|
display none
|
|
23
23
|
|
|
24
|
+
.attachButton
|
|
25
|
+
.submitButton
|
|
26
|
+
position relative
|
|
27
|
+
top -2px
|
|
28
|
+
|
|
24
29
|
.attachButton
|
|
25
30
|
flex-shrink 0
|
|
26
31
|
align-self flex-end
|
|
@@ -99,7 +104,6 @@ INPUT_MAX_HEIGHT = 200px
|
|
|
99
104
|
flex-shrink 0
|
|
100
105
|
align-items center
|
|
101
106
|
justify-content flex-end
|
|
102
|
-
margin-top -4px
|
|
103
107
|
|
|
104
108
|
& > button:focus
|
|
105
109
|
box-shadow 0 0 0 2px var(--brand-color-500) !important
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
.wrapper
|
|
4
4
|
display flex
|
|
5
5
|
align-items center
|
|
6
|
-
gap var(--p-
|
|
7
|
-
min-width
|
|
6
|
+
gap var(--p-1)
|
|
7
|
+
min-width 160px
|
|
8
8
|
z-index 1000
|
|
9
9
|
|
|
10
10
|
.selectGrow
|
|
@@ -24,3 +24,19 @@
|
|
|
24
24
|
.wrapper:hover .deleteBtn
|
|
25
25
|
opacity 1
|
|
26
26
|
pointer-events auto
|
|
27
|
+
|
|
28
|
+
// Variant styles
|
|
29
|
+
.variantClear .selectTrigger
|
|
30
|
+
border none
|
|
31
|
+
background-color transparent
|
|
32
|
+
box-shadow none
|
|
33
|
+
|
|
34
|
+
&:hover
|
|
35
|
+
box-shadow none
|
|
36
|
+
background-color transparent
|
|
37
|
+
|
|
38
|
+
.variantDefault .selectTrigger
|
|
39
|
+
background-color var(--background)
|
|
40
|
+
|
|
41
|
+
&:hover
|
|
42
|
+
box-shadow 0 0 0 2px var(--background)
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import cn from 'classnames';
|
|
2
2
|
|
|
3
3
|
import { Chat } from '#uilib/components/ui/Chat/Chat.types';
|
|
4
|
+
import type {
|
|
5
|
+
SelectProps,
|
|
6
|
+
SelectTriggerProps,
|
|
7
|
+
} from '#uilib/components/ui/Select/Select.types.js';
|
|
4
8
|
import { useChatsForScopeId } from '#uilib/contexts/chat-context';
|
|
5
9
|
import { Trash2Icon } from 'lucide-react';
|
|
6
10
|
|
|
@@ -14,7 +18,8 @@ import {
|
|
|
14
18
|
} from '../../Select/Select';
|
|
15
19
|
import S from './ChatSelector.styl';
|
|
16
20
|
|
|
17
|
-
export interface ChatSelectorProps
|
|
21
|
+
export interface ChatSelectorProps
|
|
22
|
+
extends SelectProps, Pick<SelectTriggerProps, 'size' | 'variant'> {
|
|
18
23
|
id: string;
|
|
19
24
|
wrapperClassName?: string;
|
|
20
25
|
className?: string;
|
|
@@ -23,8 +28,13 @@ export interface ChatSelectorProps {
|
|
|
23
28
|
onNewChat?: () => void;
|
|
24
29
|
}
|
|
25
30
|
|
|
31
|
+
const deleteIconSize = (s: NonNullable<SelectTriggerProps['size']>) =>
|
|
32
|
+
s === 'sm' ? 16 : s === 'md' ? 18 : 20;
|
|
33
|
+
|
|
26
34
|
export function ChatSelector({
|
|
27
35
|
id,
|
|
36
|
+
size = 'sm',
|
|
37
|
+
variant = 'clear',
|
|
28
38
|
wrapperClassName,
|
|
29
39
|
className,
|
|
30
40
|
onChatDeleted,
|
|
@@ -67,15 +77,22 @@ export function ChatSelector({
|
|
|
67
77
|
};
|
|
68
78
|
|
|
69
79
|
return (
|
|
70
|
-
<div
|
|
80
|
+
<div
|
|
81
|
+
className={cn(
|
|
82
|
+
S.wrapper,
|
|
83
|
+
variant === 'clear' ? S.variantClear : S.variantDefault,
|
|
84
|
+
wrapperClassName,
|
|
85
|
+
)}
|
|
86
|
+
>
|
|
71
87
|
<div className={S.selectGrow}>
|
|
72
88
|
<Select
|
|
73
|
-
variant=
|
|
89
|
+
variant={variant}
|
|
74
90
|
value={currentChatId?.toString() ?? ''}
|
|
75
91
|
onValueChange={handleValueChange}
|
|
76
92
|
>
|
|
77
93
|
<SelectTrigger
|
|
78
|
-
size=
|
|
94
|
+
size={size}
|
|
95
|
+
variant={variant}
|
|
79
96
|
className={
|
|
80
97
|
className ? cn(S.selectTrigger, className) : S.selectTrigger
|
|
81
98
|
}
|
|
@@ -100,12 +117,12 @@ export function ChatSelector({
|
|
|
100
117
|
<Button
|
|
101
118
|
type="button"
|
|
102
119
|
variant="ghost"
|
|
103
|
-
size=
|
|
120
|
+
size={size}
|
|
104
121
|
className={S.deleteBtn}
|
|
105
122
|
aria-label="Delete chat"
|
|
106
123
|
onClick={handleDeleteChat}
|
|
107
124
|
>
|
|
108
|
-
<Trash2Icon size={
|
|
125
|
+
<Trash2Icon size={deleteIconSize(size)} />
|
|
109
126
|
</Button>
|
|
110
127
|
)}
|
|
111
128
|
</div>
|
|
@@ -22,7 +22,7 @@ export interface ChatSheetProps extends Omit<
|
|
|
22
22
|
title?: string;
|
|
23
23
|
/** Imperative open / new-chat for triggers outside `renderTrigger` (e.g. sidebar). */
|
|
24
24
|
actionsRef?: React.MutableRefObject<ChatSheetActions | null>;
|
|
25
|
-
renderTrigger?: (toggleOpen: () => void) => React.ReactNode;
|
|
25
|
+
renderTrigger?: (toggleOpen: () => void, isOpen: boolean) => React.ReactNode;
|
|
26
26
|
triggerLabel?: React.ReactNode;
|
|
27
27
|
/** aria-label for icon-only trigger (required when trigger has no visible text) */
|
|
28
28
|
triggerAriaLabel?: string;
|
|
@@ -88,7 +88,7 @@ export function ChatSheet({
|
|
|
88
88
|
|
|
89
89
|
return (
|
|
90
90
|
<>
|
|
91
|
-
{renderTrigger?.(model.toggleOpen) ?? (
|
|
91
|
+
{renderTrigger?.(model.toggleOpen, model.isOpen) ?? (
|
|
92
92
|
<Button
|
|
93
93
|
variant="outline"
|
|
94
94
|
aria-label={triggerAriaLabel}
|
|
@@ -3,7 +3,6 @@ import cn from 'classnames';
|
|
|
3
3
|
import { CsvIcon } from '#uilib/components/icons/CsvIcon/CsvIcon';
|
|
4
4
|
import { CardAction, CardHeader } from '#uilib/components/ui/Card';
|
|
5
5
|
import { FileTextIcon, XIcon } from '@phosphor-icons/react';
|
|
6
|
-
import { LayoutDashboard } from 'lucide-react';
|
|
7
6
|
|
|
8
7
|
import S from './FileChip.styl';
|
|
9
8
|
import type { FileChipFormat, FileChipProps } from './FileChip.types';
|
|
@@ -15,16 +14,6 @@ function FormatIcon({ format }: { format: FileChipFormat }) {
|
|
|
15
14
|
return <CsvIcon size={FORMAT_ICON_SIZE} />;
|
|
16
15
|
}
|
|
17
16
|
|
|
18
|
-
if (format === 'dashboard') {
|
|
19
|
-
return (
|
|
20
|
-
<LayoutDashboard
|
|
21
|
-
size={FORMAT_ICON_SIZE}
|
|
22
|
-
aria-hidden
|
|
23
|
-
style={{ color: 'var(--muted-foreground)' }}
|
|
24
|
-
/>
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
17
|
return (
|
|
29
18
|
<FileTextIcon
|
|
30
19
|
size={FORMAT_ICON_SIZE}
|
|
@@ -38,12 +27,16 @@ function FileChipHeader({
|
|
|
38
27
|
name,
|
|
39
28
|
format,
|
|
40
29
|
hint,
|
|
30
|
+
icon,
|
|
41
31
|
onRemove,
|
|
42
|
-
}: Pick<
|
|
32
|
+
}: Pick<
|
|
33
|
+
FileChipProps,
|
|
34
|
+
'name' | 'format' | 'hint' | 'icon' | 'onRemove' | 'disabled'
|
|
35
|
+
>) {
|
|
43
36
|
return (
|
|
44
37
|
<CardHeader
|
|
45
38
|
className={S.header}
|
|
46
|
-
icon={<FormatIcon format={format} />}
|
|
39
|
+
icon={icon ?? <FormatIcon format={format} />}
|
|
47
40
|
title={name}
|
|
48
41
|
description={hint}
|
|
49
42
|
titleClassName={S.title}
|
|
@@ -70,6 +63,7 @@ export function FileChip({
|
|
|
70
63
|
name,
|
|
71
64
|
format,
|
|
72
65
|
hint,
|
|
66
|
+
icon,
|
|
73
67
|
onClick,
|
|
74
68
|
onRemove,
|
|
75
69
|
className,
|
|
@@ -79,6 +73,7 @@ export function FileChip({
|
|
|
79
73
|
name={name}
|
|
80
74
|
format={format}
|
|
81
75
|
hint={hint}
|
|
76
|
+
icon={icon}
|
|
82
77
|
onRemove={onRemove}
|
|
83
78
|
/>
|
|
84
79
|
);
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
export type FileChipFormat = 'csv' | 'pdf' | 'text'
|
|
1
|
+
export type FileChipFormat = 'csv' | 'pdf' | 'text';
|
|
2
2
|
|
|
3
3
|
export type FileChipProps = {
|
|
4
4
|
name: string;
|
|
5
5
|
format: FileChipFormat;
|
|
6
6
|
hint: string;
|
|
7
|
+
icon?: React.ReactNode;
|
|
7
8
|
onClick?: () => void;
|
|
8
9
|
onRemove?: () => void;
|
|
9
10
|
disabled?: boolean;
|
|
@@ -46,15 +46,25 @@
|
|
|
46
46
|
box-shadow 0 0 0 2px var(--background)
|
|
47
47
|
// color var(--muted-foreground)
|
|
48
48
|
|
|
49
|
-
&[data-size="md"]
|
|
50
|
-
height 1.75rem
|
|
51
|
-
|
|
52
49
|
&[data-size="sm"]
|
|
53
|
-
height
|
|
50
|
+
height auto
|
|
51
|
+
min-height 28px
|
|
52
|
+
padding 0 var(--p-4)
|
|
53
|
+
border-radius var(--p-4)
|
|
54
54
|
font-size var(--text-xs)
|
|
55
55
|
|
|
56
|
+
&[data-size="md"]
|
|
57
|
+
height auto
|
|
58
|
+
min-height 40px
|
|
59
|
+
padding var(--p-3) var(--p-4)
|
|
60
|
+
border-radius var(--p-4)
|
|
61
|
+
font-size var(--text-sm)
|
|
62
|
+
|
|
56
63
|
&[data-size="lg"]
|
|
57
|
-
height
|
|
64
|
+
height auto
|
|
65
|
+
min-height auto
|
|
66
|
+
padding var(--p-4) var(--p-6)
|
|
67
|
+
border-radius var(--p-4)
|
|
58
68
|
font-size var(--text-sm)
|
|
59
69
|
|
|
60
70
|
&[data-placeholder]
|
|
@@ -97,7 +107,6 @@
|
|
|
97
107
|
|
|
98
108
|
|
|
99
109
|
.clear
|
|
100
|
-
padding 0
|
|
101
110
|
border none
|
|
102
111
|
background-color transparent
|
|
103
112
|
box-shadow none
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
2
|
-
|
|
3
1
|
import { PageContentSection } from '#uilib/components/ui/Page';
|
|
4
2
|
import {
|
|
5
3
|
Select,
|
|
@@ -12,28 +10,87 @@ import {
|
|
|
12
10
|
import { AppPageHeader } from '../components/AppPageHeader/AppPageHeader';
|
|
13
11
|
import { DocsHeaderActions } from '../docsHeaderActions';
|
|
14
12
|
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
const VARIANTS = ['default', 'clear'] as const;
|
|
14
|
+
const SIZES = ['sm', 'md', 'lg'] as const;
|
|
15
|
+
|
|
16
|
+
const FRUIT_OPTIONS = [
|
|
17
|
+
{ value: 'apple', label: 'Apple' },
|
|
18
|
+
{ value: 'orange', label: 'Orange' },
|
|
19
|
+
{ value: 'banana', label: 'Banana' },
|
|
20
|
+
] as const;
|
|
21
|
+
|
|
22
|
+
function DemoSelect({
|
|
23
|
+
variant,
|
|
24
|
+
size,
|
|
25
|
+
}: {
|
|
26
|
+
variant: (typeof VARIANTS)[number];
|
|
27
|
+
size: (typeof SIZES)[number];
|
|
28
|
+
}) {
|
|
29
|
+
return (
|
|
30
|
+
<Select defaultValue="apple">
|
|
31
|
+
<SelectTrigger variant={variant} size={size} style={{ width: 200 }}>
|
|
32
|
+
<SelectValue placeholder="Pick fruit" />
|
|
33
|
+
</SelectTrigger>
|
|
34
|
+
<SelectContent>
|
|
35
|
+
{FRUIT_OPTIONS.map(o => (
|
|
36
|
+
<SelectItem key={o.value} value={o.value}>
|
|
37
|
+
{o.label}
|
|
38
|
+
</SelectItem>
|
|
39
|
+
))}
|
|
40
|
+
</SelectContent>
|
|
41
|
+
</Select>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
17
44
|
|
|
45
|
+
export default function SelectPage() {
|
|
18
46
|
return (
|
|
19
47
|
<>
|
|
20
48
|
<AppPageHeader
|
|
21
49
|
breadcrumbs={[{ label: 'Select' }]}
|
|
22
50
|
title="Select"
|
|
23
|
-
subheader="Radix select."
|
|
51
|
+
subheader="Radix select — variants and sizes."
|
|
24
52
|
actions={<DocsHeaderActions />}
|
|
25
53
|
/>
|
|
26
|
-
<PageContentSection
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
</
|
|
31
|
-
<
|
|
32
|
-
<
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
54
|
+
<PageContentSection
|
|
55
|
+
style={{ display: 'flex', flexDirection: 'column', gap: '2rem' }}
|
|
56
|
+
>
|
|
57
|
+
<section>
|
|
58
|
+
<h3 style={{ marginBottom: '1rem' }}>Variants × sizes</h3>
|
|
59
|
+
<div style={{ overflowX: 'auto' }}>
|
|
60
|
+
<table style={{ borderCollapse: 'collapse', width: '100%' }}>
|
|
61
|
+
<thead>
|
|
62
|
+
<tr>
|
|
63
|
+
<th style={{ textAlign: 'left', padding: '0.5rem' }} />
|
|
64
|
+
{SIZES.map(s => (
|
|
65
|
+
<th key={s} style={{ padding: '0.5rem' }}>
|
|
66
|
+
{s}
|
|
67
|
+
</th>
|
|
68
|
+
))}
|
|
69
|
+
</tr>
|
|
70
|
+
</thead>
|
|
71
|
+
<tbody>
|
|
72
|
+
{VARIANTS.map(v => (
|
|
73
|
+
<tr key={v}>
|
|
74
|
+
<td
|
|
75
|
+
style={{
|
|
76
|
+
padding: '0.5rem',
|
|
77
|
+
fontWeight: 600,
|
|
78
|
+
whiteSpace: 'nowrap',
|
|
79
|
+
}}
|
|
80
|
+
>
|
|
81
|
+
{v}
|
|
82
|
+
</td>
|
|
83
|
+
{SIZES.map(s => (
|
|
84
|
+
<td key={s} style={{ padding: '0.5rem' }}>
|
|
85
|
+
<DemoSelect variant={v} size={s} />
|
|
86
|
+
</td>
|
|
87
|
+
))}
|
|
88
|
+
</tr>
|
|
89
|
+
))}
|
|
90
|
+
</tbody>
|
|
91
|
+
</table>
|
|
92
|
+
</div>
|
|
93
|
+
</section>
|
|
37
94
|
</PageContentSection>
|
|
38
95
|
</>
|
|
39
96
|
);
|