Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Container cpacity to tables and Static Items to Dropdowns #10217

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions front/components/assistant/conversation/AgentMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -624,11 +624,13 @@ export function AgentMessage({
</div>
)}
{agentMessage.status === "cancelled" && (
<Chip
label="Message generation was interrupted"
size="xs"
className="mt-4"
/>
<div>
<Chip
label="The message generation was interrupted"
size="xs"
className="mt-4"
/>
</div>
)}
</div>
);
Expand Down
1 change: 1 addition & 0 deletions sparkle/.storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const config: StorybookConfig = {
"@storybook/addon-links",
"@storybook/addon-essentials",
"@storybook/addon-interactions",
"@storybook/addon-viewport",
"@storybook/addon-themes",
{
name: "@storybook/addon-styling",
Expand Down
6 changes: 6 additions & 0 deletions sparkle/.storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
import { withThemeByClassName } from "@storybook/addon-themes";
import type { Preview } from "@storybook/react";
import { INITIAL_VIEWPORTS } from "@storybook/addon-viewport";

const preview: Preview = {
parameters: {
actions: { argTypesRegex: "^on[A-Z].*" },
viewport: {
viewports: INITIAL_VIEWPORTS,
defaultViewport: "iphone12",
disable: true,
},
controls: {
matchers: {
color: /(background|color)$/i,
Expand Down
194 changes: 39 additions & 155 deletions sparkle/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion sparkle/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dust-tt/sparkle",
"version": "0.2.372",
"version": "0.2.373",
"scripts": {
"build": "rm -rf dist && npm run tailwind && npm run build:esm && npm run build:cjs",
"tailwind": "tailwindcss -i ./src/styles/tailwind.css -o dist/sparkle.css",
Expand Down Expand Up @@ -39,6 +39,7 @@
"@storybook/addon-mdx-gfm": "^7.4.6",
"@storybook/addon-styling": "^1.3.7",
"@storybook/addon-themes": "^7.4.6",
"@storybook/addon-viewport": "^7.6.20",
"@storybook/blocks": "^7.4.6",
"@storybook/react": "^7.4.6",
"@storybook/react-webpack5": "^7.4.6",
Expand Down
2 changes: 1 addition & 1 deletion sparkle/src/components/Chip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ const Chip = React.forwardRef<HTMLDivElement, ChipProps>(
aria-label={label}
ref={ref}
>
{children}
{icon && <Icon visual={icon} size={size as IconProps["size"]} />}
{label && (
<span className={cn("s-pointer s-grow s-cursor-default s-truncate")}>
Expand All @@ -101,7 +102,6 @@ const Chip = React.forwardRef<HTMLDivElement, ChipProps>(
)}
</span>
)}
{children}
</div>
)
);
Expand Down
19 changes: 16 additions & 3 deletions sparkle/src/components/DataTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -257,16 +257,29 @@ export function DataTable<TData extends TBaseData>({

interface DataTableRootProps extends React.HTMLAttributes<HTMLTableElement> {
children: ReactNode;
containerClassName?: string;
containerProps?: React.HTMLAttributes<HTMLDivElement>;
}

DataTable.Root = function DataTableRoot({
children,
className,
containerClassName,
containerProps,
...props
}: DataTableRootProps) {
return (
<table className="s-w-full s-table-fixed s-border-collapse" {...props}>
{children}
</table>
<div
className={cn("s-@container/table", containerClassName)}
{...containerProps}
>
<table
className={cn("s-w-full s-table-fixed s-border-collapse", className)}
{...props}
>
{children}
</table>
</div>
);
};

Expand Down
28 changes: 28 additions & 0 deletions sparkle/src/components/Dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,33 @@ const DropdownMenuSearchbar = React.forwardRef<

DropdownMenuSearchbar.displayName = "DropdownMenuSearchbar";

interface DropdownMenuStaticItemProps {
label: string;
value?: string;
children?: React.ReactNode;
className?: string;
}

const DropdownMenuStaticItem = React.forwardRef<
HTMLDivElement,
DropdownMenuStaticItemProps
>(({ label, value, children, className }, ref) => (
<div
ref={ref}
className={cn(
"s-flex s-h-9 s-items-center s-gap-2 s-px-2 s-text-sm s-text-foreground",
className
)}
>
<span className="s-grow s-font-medium">{label}</span>
{value && (
<span className="s-shrink-0 s-text-muted-foreground">{value}</span>
)}
{children && <div className="s-shrink-0">{children}</div>}
</div>
));
DropdownMenuStaticItem.displayName = "DropdownMenuStaticItem";

export {
DropdownMenu,
DropdownMenuCheckboxItem,
Expand All @@ -397,6 +424,7 @@ export {
DropdownMenuSearchbar,
DropdownMenuSeparator,
DropdownMenuShortcut,
DropdownMenuStaticItem,
DropdownMenuSub,
DropdownMenuSubContent,
DropdownMenuSubTrigger,
Expand Down
Loading
Loading