Skip to content
Merged
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

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./_virtual_cosmos-imports-BjJlCujV.js","./_virtual_cosmos-imports-m6w9TwDV.css"])))=>i.map(i=>d[i]);
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./_virtual_cosmos-imports-DNh6WwHb.js","./_virtual_cosmos-imports-CghTF5Lu.css"])))=>i.map(i=>d[i]);
function _mergeNamespaces(n, m) {
for (var i = 0; i < m.length; i++) {
const e = m[i];
Expand Down Expand Up @@ -15038,7 +15038,7 @@ function mountDomRenderer({ rendererConfig, moduleWrappers }) {
}
mount();
async function mount() {
const args = await __vitePreload(() => import("./_virtual_cosmos-imports-BjJlCujV.js"), true ? __vite__mapDeps([0,1]) : void 0, import.meta.url);
const args = await __vitePreload(() => import("./_virtual_cosmos-imports-DNh6WwHb.js"), true ? __vite__mapDeps([0,1]) : void 0, import.meta.url);
mountDomRenderer(args);
}
export {
Expand Down
2 changes: 1 addition & 1 deletion docs/renderer.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
margin: 2.5rem;
}
</style>
<script type="module" crossorigin src="./assets/index-BFuX6RyW.js"></script>
<script type="module" crossorigin src="./assets/index-B5zrIT0p.js"></script>
</head>
<body>
<div id="root"></div>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"publishConfig": {
"access": "public"
},
"version": "0.2.4",
"version": "0.2.5",
"type": "module",
"module": "./dist/main.js",
"exports": {
Expand Down
2 changes: 1 addition & 1 deletion src/__cosmos__/code-block.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export function CodeBlock({ className, code, ...props }: CodeBlockProps) {
return (
<pre
className={cn(
'lsd:overflow-x-auto lsd:rounded-md lsd:bg-lsd-surface lsd:p-4 lsd:text-sm lsd:text-lsd-text-primary',
'lsd:overflow-x-auto lsd:rounded-md lsd:bg-lsd-surface lsd:p-(--lsd-spacing-base) lsd:text-sm lsd:text-lsd-text-primary',
className,
)}
{...props}
Expand Down
2 changes: 1 addition & 1 deletion src/__cosmos__/code-example.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ interface CodeExampleProps {

export function CodeExample({ children, code }: CodeExampleProps) {
return (
<div className="lsd:space-y-4">
<div className="lsd:space-y-(--lsd-spacing-base)">
<div>{children}</div>
<Accordion type="single" collapsible>
<AccordionItem value="code">
Expand Down
12 changes: 0 additions & 12 deletions src/__cosmos__/fixtures/Badge.fixture.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,19 +129,15 @@ export default function BadgeFixture() {
<CodeExample
title="Badge Sizes"
code={`<div className="lsd:flex lsd:gap-4 lsd:items-center">
<Badge size="xs">Extra Small</Badge>
<Badge size="sm">Small</Badge>
<Badge size="md">Medium</Badge>
<Badge size="lg">Large</Badge>
<Badge size="xl">Extra Large</Badge>
</div>`}
>
<div className="lsd:flex lsd:gap-4 lsd:items-center">
<Badge size="xs">Extra Small</Badge>
<Badge size="sm">Small</Badge>
<Badge size="md">Medium</Badge>
<Badge size="lg">Large</Badge>
<Badge size="xl">Extra Large</Badge>
</div>
</CodeExample>
</div>
Expand All @@ -162,7 +158,6 @@ export default function BadgeFixture() {
<div className="lsd:flex lsd:gap-4 lsd:items-center">
<Badge variant="warning" size="sm">Warning Small</Badge>
<Badge variant="info" size="sm">Info Small</Badge>
<Badge variant="filled" size="xs">XS Filled</Badge>
<Badge variant="outlined" size="lg">LG Outlined</Badge>
</div>
</div>`}
Expand All @@ -189,9 +184,6 @@ export default function BadgeFixture() {
<Badge variant="info" size="sm">
Info Small
</Badge>
<Badge variant="filled" size="xs">
XS Filled
</Badge>
<Badge variant="outlined" size="lg">
LG Outlined
</Badge>
Expand Down Expand Up @@ -319,19 +311,15 @@ export default function BadgeFixture() {
<CodeExample
title="Dot Badges"
code={`<div className="lsd:flex lsd:gap-4 lsd:items-center">
<Badge variant="dot" size="xs" />
<Badge variant="dot" size="sm" />
<Badge variant="dot" size="md" />
<Badge variant="dot" size="lg" />
<Badge variant="dot" size="xl" />
</div>`}
>
<div className="lsd:flex lsd:gap-4 lsd:items-center">
<Badge variant="dot" size="xs" />
<Badge variant="dot" size="sm" />
<Badge variant="dot" size="md" />
<Badge variant="dot" size="lg" />
<Badge variant="dot" size="xl" />
</div>
</CodeExample>
</div>
Expand Down
20 changes: 4 additions & 16 deletions src/__cosmos__/fixtures/Button.fixture.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ export default function ButtonFixture() {
<CodeExample
title="Icon Button Variants"
code={`<div className="lsd:flex lsd:gap-4 lsd:items-center">
<Button variant="filled-icon" size="icon-xs" aria-label="Add">
<Plus size={12} />
<Button variant="filled-icon" size="icon-sm" aria-label="Add">
<Plus size={14} />
</Button>
<Button variant="filled-icon" size="icon-md" aria-label="Add">
<Plus />
Expand All @@ -144,8 +144,8 @@ export default function ButtonFixture() {
</div>`}
>
<div className="lsd:flex lsd:gap-4 lsd:items-center">
<Button variant="filled-icon" size="icon-xs" aria-label="Add">
<Plus size={12} />
<Button variant="filled-icon" size="icon-sm" aria-label="Add">
<Plus size={14} />
</Button>
<Button variant="filled-icon" size="icon-md" aria-label="Add">
<Plus />
Expand All @@ -165,9 +165,6 @@ export default function ButtonFixture() {
<CodeExample
title="Icon Button Sizes"
code={`<div className="lsd:flex lsd:gap-4 lsd:items-center">
<Button variant="filled-icon" size="icon-xs" aria-label="Add">
<Plus size={12} />
</Button>
<Button variant="filled-icon" size="icon-sm" aria-label="Add">
<Plus size={14} />
</Button>
Expand All @@ -177,15 +174,9 @@ export default function ButtonFixture() {
<Button variant="filled-icon" size="icon-lg" aria-label="Add">
<Plus size={24} />
</Button>
<Button variant="filled-icon" size="icon-xl" aria-label="Add">
<Plus size={32} />
</Button>
</div>`}
>
<div className="lsd:flex lsd:gap-4 lsd:items-center">
<Button variant="filled-icon" size="icon-xs" aria-label="Add">
<Plus size={12} />
</Button>
<Button variant="filled-icon" size="icon-sm" aria-label="Add">
<Plus size={14} />
</Button>
Expand All @@ -195,9 +186,6 @@ export default function ButtonFixture() {
<Button variant="filled-icon" size="icon-lg" aria-label="Add">
<Plus size={30} />
</Button>
<Button variant="filled-icon" size="icon-xl" aria-label="Add">
<Plus size={32} />
</Button>
</div>
</CodeExample>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/__cosmos__/font-toggle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function FontToggle() {
}, [font]);

return (
<div className="lsd:flex lsd:items-center lsd:space-x-2">
<div className="lsd:flex lsd:items-center lsd:space-x-(--lsd-spacing-smaller)">
<span className="lsd:text-sm">Font:</span>
<ToggleGroup
type="single"
Expand Down
4 changes: 2 additions & 2 deletions src/__cosmos__/theme-toggle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ export function ThemeToggle() {
aria-label="Theme toggle"
>
<ToggleGroupItem value="light" aria-label="Light theme">
<Sun className="lsd:h-4 lsd:w-4" />
<Sun className="lsd:h-(--lsd-spacing-base) lsd:w-(--lsd-spacing-base)" />
</ToggleGroupItem>
<ToggleGroupItem value="dark" aria-label="Dark theme">
<Moon className="lsd:h-4 lsd:w-4" />
<Moon className="lsd:h-(--lsd-spacing-base) lsd:w-(--lsd-spacing-base)" />
</ToggleGroupItem>
</ToggleGroup>
);
Expand Down
6 changes: 3 additions & 3 deletions src/components/ui/accordion/AccordionContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ function AccordionContent({
const getPaddingBottom = () => {
switch (size) {
case 'sm':
return 'lsd:pb-2';
return 'lsd:pb-[var(--lsd-spacing-smaller)]';
case 'lg':
return 'lsd:pb-6';
return 'lsd:pb-[var(--lsd-spacing-larger)]';
default:
return 'lsd:pb-4';
return 'lsd:pb-[var(--lsd-spacing-base)]';
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,6 @@ describe('AccordionContent', () => {
'[data-slot="accordion-content"] > div',
);
expect(innerDiv).toHaveClass('lsd:pt-0');
expect(innerDiv).toHaveClass('lsd:pb-4');
expect(innerDiv).toHaveClass('lsd:pb-[var(--lsd-spacing-base)]');
});
});
2 changes: 1 addition & 1 deletion src/components/ui/alert-dialog/AlertDialogContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function AlertDialogContent({
<AlertDialogPrimitive.Content
data-slot="alert-dialog-content"
className={cn(
'lsd:bg-lsd-surface lsd:data-[state=open]:animate-in lsd:data-[state=closed]:animate-out lsd:data-[state=closed]:fade-out-0 lsd:data-[state=open]:fade-in-0 lsd:data-[state=closed]:zoom-out-95 lsd:data-[state=open]:zoom-in-95 lsd:fixed lsd:top-[50%] lsd:left-[50%] lsd:z-50 lsd:grid lsd:w-full lsd:max-w-[calc(100%-2rem)] lsd:translate-x-[-50%] lsd:translate-y-[-50%] lsd:gap-4 lsd:border lsd:border-lsd-border lsd:p-6 lsd:shadow-lg lsd:duration-200 lsd:sm:max-w-lg',
'lsd:bg-lsd-surface lsd:data-[state=open]:animate-in lsd:data-[state=closed]:animate-out lsd:data-[state=closed]:fade-out-0 lsd:data-[state=open]:fade-in-0 lsd:data-[state=closed]:zoom-out-95 lsd:data-[state=open]:zoom-in-95 lsd:fixed lsd:top-[50%] lsd:left-[50%] lsd:z-50 lsd:grid lsd:w-full lsd:max-w-[calc(100%-2rem)] lsd:translate-x-[-50%] lsd:translate-y-[-50%] lsd:gap-(--lsd-spacing-base) lsd:border lsd:border-lsd-border lsd:p-(--lsd-spacing-larger) lsd:shadow-lg lsd:duration-200 lsd:sm:max-w-lg',
className,
)}
{...props}
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/alert-dialog/AlertDialogFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function AlertDialogFooter({
<div
data-slot="alert-dialog-footer"
className={cn(
'lsd:flex lsd:flex-col-reverse lsd:gap-2 lsd:sm:flex-row lsd:sm:justify-end',
'lsd:flex lsd:flex-col-reverse lsd:gap-(--lsd-spacing-smaller) lsd:sm:flex-row lsd:sm:justify-end',
className,
)}
{...props}
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/alert-dialog/AlertDialogHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function AlertDialogHeader({
<div
data-slot="alert-dialog-header"
className={cn(
'lsd:flex lsd:flex-col lsd:gap-2 lsd:text-center lsd:sm:text-left',
'lsd:flex lsd:flex-col lsd:gap-(--lsd-spacing-smaller) lsd:text-center lsd:sm:text-left',
className,
)}
{...props}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe('AlertDialogContent', () => {
expect(content).toHaveClass('lsd:w-full');
expect(content).toHaveClass('lsd:border');
expect(content).toHaveClass('lsd:border-lsd-border');
expect(content).toHaveClass('lsd:p-6');
expect(content).toHaveClass('lsd:p-(--lsd-spacing-larger)');
});

it('applies data-slot attribute', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('AlertDialogFooter', () => {
const footer = document.querySelector('[data-slot="alert-dialog-footer"]');
expect(footer).toHaveClass('lsd:flex');
expect(footer).toHaveClass('lsd:flex-col-reverse');
expect(footer).toHaveClass('lsd:gap-2');
expect(footer).toHaveClass('lsd:gap-(--lsd-spacing-smaller)');
});

it('applies data-slot attribute', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ describe('AlertDialogHeader', () => {
const header = document.querySelector('[data-slot="alert-dialog-header"]');
expect(header).toHaveClass('lsd:flex');
expect(header).toHaveClass('lsd:flex-col');
expect(header).toHaveClass('lsd:gap-2');
expect(header).toHaveClass('lsd:gap-(--lsd-spacing-smaller)');
expect(header).toHaveClass('lsd:text-center');
});

Expand Down
49 changes: 29 additions & 20 deletions src/components/ui/autocomplete/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,38 +47,47 @@ export const AUTOCOMPLETE_SIZE_CLASSES: Record<
> = {
xs: {
container: 'lsd:w-[140px]',
label: 'lsd:mb-1.5 lsd:ml-[10px]',
inputContainer: 'lsd:h-[24px]',
input: 'lsd:px-[9px] lsd:py-[4px]',
icon: 'lsd:px-[7px] lsd:py-[5px]',
label:
'lsd:mb-[var(--lsd-spacing-smaller)] lsd:ml-[var(--lsd-spacing-small)]',
inputContainer: 'lsd:h-[var(--lsd-spacing-larger)]',
input:
'lsd:px-[var(--lsd-spacing-smaller)] lsd:py-[var(--lsd-spacing-smallest)]',
icon: 'lsd:px-[var(--lsd-spacing-smaller)] lsd:py-[var(--lsd-spacing-smaller)]',
},
sm: {
container: 'lsd:w-[164px]',
label: 'lsd:mb-1.5 lsd:ml-[12px]',
inputContainer: 'lsd:h-[28px]',
input: 'lsd:px-[11px] lsd:py-[5px]',
icon: 'lsd:px-[9px] lsd:py-[6px]',
label:
'lsd:mb-[var(--lsd-spacing-smaller)] lsd:ml-[var(--lsd-spacing-small)]',
inputContainer: 'lsd:h-[var(--lsd-spacing-largest)]',
input:
'lsd:px-[var(--lsd-spacing-small)] lsd:py-[var(--lsd-spacing-smaller)]',
icon: 'lsd:px-[var(--lsd-spacing-smaller)] lsd:py-[var(--lsd-spacing-smaller)]',
},
md: {
container: 'lsd:w-[188px]',
label: 'lsd:mb-1.5 lsd:ml-[14px]',
inputContainer: 'lsd:h-[32px]',
input: 'lsd:px-[13px] lsd:py-[5px]',
icon: 'lsd:px-[11px] lsd:py-[8px]',
label:
'lsd:mb-[var(--lsd-spacing-smaller)] lsd:ml-[var(--lsd-spacing-base)]',
inputContainer: 'lsd:h-8',
input:
'lsd:px-[var(--lsd-spacing-base)] lsd:py-[var(--lsd-spacing-smaller)]',
icon: 'lsd:px-[var(--lsd-spacing-small)] lsd:py-[var(--lsd-spacing-smaller)]',
},
lg: {
container: 'lsd:w-[208px]',
label: 'lsd:mb-1.5 lsd:ml-[14px]',
inputContainer: 'lsd:h-[40px]',
input: 'lsd:px-[17px] lsd:py-[9px]',
icon: 'lsd:px-[13px] lsd:py-[12px]',
label:
'lsd:mb-[var(--lsd-spacing-smaller)] lsd:ml-[var(--lsd-spacing-base)]',
inputContainer: 'lsd:h-10',
input: 'lsd:px-[var(--lsd-spacing-base)] lsd:py-[var(--lsd-spacing-small)]',
icon: 'lsd:px-[var(--lsd-spacing-base)] lsd:py-[var(--lsd-spacing-small)]',
},
xl: {
container: 'lsd:w-[240px]',
label: 'lsd:mb-1.5 lsd:ml-[16px]',
inputContainer: 'lsd:h-[48px]',
input: 'lsd:px-[20px] lsd:py-[12px]',
icon: 'lsd:px-[15px] lsd:py-[14px]',
label:
'lsd:mb-[var(--lsd-spacing-smaller)] lsd:ml-[var(--lsd-spacing-base)]',
inputContainer: 'lsd:h-12',
input:
'lsd:px-[var(--lsd-spacing-large)] lsd:py-[var(--lsd-spacing-small)]',
icon: 'lsd:px-[var(--lsd-spacing-base)] lsd:py-[var(--lsd-spacing-base)]',
},
};

Expand Down
14 changes: 6 additions & 8 deletions src/components/ui/badge/Badge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,19 +64,17 @@ function Badge({

// Get dot size based on size prop
const getDotSize = () => {
const md =
'lsd:w-[var(--lsd-spacing-small)] lsd:h-[var(--lsd-spacing-small)]';
switch (size) {
case 'xs':
return 'lsd:w-[8px] lsd:h-[8px]';
case 'sm':
return 'lsd:w-[10px] lsd:h-[10px]';
return 'lsd:w-[var(--lsd-spacing-smaller)] lsd:h-[var(--lsd-spacing-smaller)]';
case 'md':
return 'lsd:w-[12px] lsd:h-[12px]';
return md;
case 'lg':
return 'lsd:w-[14px] lsd:h-[14px]';
case 'xl':
return 'lsd:w-[16px] lsd:h-[16px]';
return 'lsd:w-[var(--lsd-spacing-base)] lsd:h-[var(--lsd-spacing-base)]';
default:
return 'lsd:w-[12px] lsd:h-[12px]';
return md;
}
};

Expand Down
Loading