Skip to content

Commit

Permalink
New badges, updated components and code
Browse files Browse the repository at this point in the history
- Add Latest and Maintenance badges
- Add a tooltip for explaining what badges mean
- Update shadcn components for faster dev mode
- Code improvements
  • Loading branch information
WarningImHack3r committed Feb 23, 2024
1 parent d4972de commit 201da2d
Show file tree
Hide file tree
Showing 24 changed files with 243 additions and 63 deletions.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"@tailwindcss/typography": "^0.5.10",
"@total-typescript/ts-reset": "^0.5.1",
"@types/eslint": "^8.56.2",
"@types/semver": "^7.5.7",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^6.21.0",
"@vercel/speed-insights": "^1.0.9",
Expand All @@ -35,6 +36,7 @@
"prettier": "^3.2.5",
"prettier-plugin-svelte": "^3.1.2",
"prettier-plugin-tailwindcss": "^0.5.11",
"semver": "^7.6.0",
"svelte": "^4.2.10",
"svelte-check": "^3.6.4",
"svelte-exmarkdown": "^3.0.3",
Expand Down
28 changes: 17 additions & 11 deletions pnpm-lock.yaml

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

2 changes: 1 addition & 1 deletion src/lib/components/ui/accordion/accordion-content.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
let className: $$Props["class"] = undefined;
export let transition: $$Props["transition"] = slide;
export let transitionConfig: $$Props["transitionConfig"] = {
duration: 200
duration: 200,
};
export { className as class };
</script>
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/ui/accordion/accordion-trigger.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts">
import { Accordion as AccordionPrimitive } from "bits-ui";
import { ChevronDown } from "lucide-svelte";
import ChevronDown from "lucide-svelte/icons/chevron-down";
import { cn } from "$lib/utils";
type $$Props = AccordionPrimitive.TriggerProps;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/ui/accordion/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ export {
Root as Accordion,
Content as AccordionContent,
Item as AccordionItem,
Trigger as AccordionTrigger
Trigger as AccordionTrigger,
};
8 changes: 4 additions & 4 deletions src/lib/components/ui/badge/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ export const badgeVariants = tv({
"bg-secondary hover:bg-secondary/80 border-transparent text-secondary-foreground",
destructive:
"bg-destructive hover:bg-destructive/80 border-transparent text-destructive-foreground",
outline: "text-foreground"
}
outline: "text-foreground",
},
},
defaultVariants: {
variant: "default"
}
variant: "default",
},
});

export type Variant = VariantProps<typeof badgeVariants>["variant"];
12 changes: 6 additions & 6 deletions src/lib/components/ui/button/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ const buttonVariants = tv({
"border border-input bg-background hover:bg-accent hover:text-accent-foreground",
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
ghost: "hover:bg-accent hover:text-accent-foreground",
link: "text-primary underline-offset-4 hover:underline"
link: "text-primary underline-offset-4 hover:underline",
},
size: {
default: "h-10 px-4 py-2",
sm: "h-9 rounded-md px-3",
lg: "h-11 rounded-md px-8",
icon: "h-10 w-10"
}
icon: "h-10 w-10",
},
},
defaultVariants: {
variant: "default",
size: "default"
}
size: "default",
},
});

type Variant = VariantProps<typeof buttonVariants>["variant"];
Expand All @@ -45,5 +45,5 @@ export {
Root as Button,
type Props as ButtonProps,
type Events as ButtonEvents,
buttonVariants
buttonVariants,
};
7 changes: 4 additions & 3 deletions src/lib/components/ui/checkbox/checkbox.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script lang="ts">
import { Checkbox as CheckboxPrimitive } from "bits-ui";
import { Check, Minus } from "lucide-svelte";
import Check from "lucide-svelte/icons/check";
import Minus from "lucide-svelte/icons/minus";
import { cn } from "$lib/utils";
type $$Props = CheckboxPrimitive.Props;
Expand All @@ -13,15 +14,15 @@

<CheckboxPrimitive.Root
class={cn(
"box-content peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[disabled=true]:cursor-not-allowed data-[disabled=true]:opacity-50",
"peer box-content h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[disabled=true]:cursor-not-allowed data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[disabled=true]:opacity-50",
className
)}
bind:checked
{...$$restProps}
on:click
>
<CheckboxPrimitive.Indicator
class={cn("flex items-center justify-center text-current h-4 w-4")}
class={cn("flex h-4 w-4 items-center justify-center text-current")}
let:isChecked
let:isIndeterminate
>
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/ui/checkbox/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ import Root from "./checkbox.svelte";
export {
Root,
//
Root as Checkbox
Root as Checkbox,
};
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts">
import { DropdownMenu as DropdownMenuPrimitive } from "bits-ui";
import Check from "lucide-svelte/icons/check";
import { cn } from "$lib/utils";
import { Check } from "lucide-svelte";
type $$Props = DropdownMenuPrimitive.CheckboxItemProps;
type $$Events = DropdownMenuPrimitive.CheckboxItemEvents;
Expand All @@ -14,7 +14,7 @@
<DropdownMenuPrimitive.CheckboxItem
bind:checked
class={cn(
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none data-[disabled]:pointer-events-none data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[disabled]:opacity-50",
className
)}
{...$$restProps}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<DropdownMenuPrimitive.Item
class={cn(
"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled]:pointer-events-none data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[disabled]:opacity-50",
inset && "pl-8",
className
)}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts">
import { DropdownMenu as DropdownMenuPrimitive } from "bits-ui";
import Circle from "lucide-svelte/icons/circle";
import { cn } from "$lib/utils";
import { Circle } from "lucide-svelte";
type $$Props = DropdownMenuPrimitive.RadioItemProps;
type $$Events = DropdownMenuPrimitive.RadioItemEvents;
Expand All @@ -13,7 +13,7 @@

<DropdownMenuPrimitive.RadioItem
class={cn(
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none data-[disabled]:pointer-events-none data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[disabled]:opacity-50",
className
)}
{value}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
export let transition: $$Props["transition"] = flyAndScale;
export let transitionConfig: $$Props["transitionConfig"] = {
x: -10,
y: 0
y: 0,
};
export { className as class };
</script>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts">
import { DropdownMenu as DropdownMenuPrimitive } from "bits-ui";
import ChevronRight from "lucide-svelte/icons/chevron-right";
import { cn } from "$lib/utils";
import { ChevronRight } from "lucide-svelte";
type $$Props = DropdownMenuPrimitive.SubTriggerProps & {
inset?: boolean;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/ui/dropdown-menu/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,5 @@ export {
RadioGroup as DropdownMenuRadioGroup,
SubContent as DropdownMenuSubContent,
SubTrigger as DropdownMenuSubTrigger,
CheckboxItem as DropdownMenuCheckboxItem
CheckboxItem as DropdownMenuCheckboxItem,
};
2 changes: 1 addition & 1 deletion src/lib/components/ui/label/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ import Root from "./label.svelte";
export {
Root,
//
Root as Label
Root as Label,
};
2 changes: 1 addition & 1 deletion src/lib/components/ui/tabs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ export {
Root as Tabs,
Content as TabsContent,
List as TabsList,
Trigger as TabsTrigger
Trigger as TabsTrigger,
};
2 changes: 1 addition & 1 deletion src/lib/components/ui/toggle-group/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ export {
Item,
//
Root as ToggleGroup,
Item as ToggleGroupItem
Item as ToggleGroupItem,
};
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
class={cn(
toggleVariants({
variant: ctx.variant || variant,
size: ctx.size || size
size: ctx.size || size,
}),
className
)}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/ui/toggle-group/toggle-group.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
setToggleGroupCtx({
variant,
size
size,
});
</script>

Expand Down
12 changes: 6 additions & 6 deletions src/lib/components/ui/toggle/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ export const toggleVariants = tv({
variant: {
default: "bg-transparent",
outline:
"bg-transparent border border-input hover:bg-accent hover:text-accent-foreground"
"bg-transparent border border-input hover:bg-accent hover:text-accent-foreground",
},
size: {
default: "h-10 px-3",
sm: "h-9 px-2.5",
lg: "h-11 px-5"
}
lg: "h-11 px-5",
},
},
defaultVariants: {
variant: "default",
size: "default"
}
size: "default",
},
});

export type Variant = VariantProps<typeof toggleVariants>["variant"];
Expand All @@ -27,5 +27,5 @@ export type Size = VariantProps<typeof toggleVariants>["size"];
export {
Root,
//
Root as Toggle
Root as Toggle,
};
15 changes: 15 additions & 0 deletions src/lib/components/ui/tooltip/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Tooltip as TooltipPrimitive } from "bits-ui";
import Content from "./tooltip-content.svelte";

const Root = TooltipPrimitive.Root;
const Trigger = TooltipPrimitive.Trigger;

export {
Root,
Trigger,
Content,
//
Root as Tooltip,
Content as TooltipContent,
Trigger as TooltipTrigger,
};
Loading

0 comments on commit 201da2d

Please sign in to comment.